| This is a introspection query to get the DataSourceType enums:
const GET_DATA_SOURCES_NAMES = gql` |
{ |
__type(name: "DataSourceType") { |
name |
states: enumValues { |
name |
} |
} |
} |
`
|
Using this query:
const DataSourcesNames = () => { |
return <Query query={GET_DATA_SOURCES_NAMES}> |
{({loading, error, data}) => { |
if (loading) return "Loading..."; |
if (error) return error.message; |
const items = data.__type.states.map((item, idx) => { |
return ( |
<ListView.Item |
key={idx} |
name={item.name} |
className="ds-list-item" |
leftContent={<span className="list-item-name">{item.name}</span>} |
> |
</ListView.Item> |
) |
}) |
return ( |
<div> |
<ListView> |
{items} |
</ListView> |
</div> |
); |
}} |
</Query> |
};
|
Then in the DatasourceView Components render function:
<div> |
<DataSourcesNames/> |
</div>
|
|