Submit
Path:
~
/
/
usr
/
share
/
grafana
/
public
/
app
/
features
/
datasources
/
components
/
File Content:
DataSourcesListHeader.tsx
import React, { useCallback } from 'react'; import { SelectableValue } from '@grafana/data'; import PageActionBar from 'app/core/components/PageActionBar/PageActionBar'; import { StoreState, useSelector, useDispatch } from 'app/types'; import { getDataSourcesSearchQuery, getDataSourcesSort, setDataSourcesSearchQuery, setIsSortAscending } from '../state'; const ascendingSortValue = 'alpha-asc'; const descendingSortValue = 'alpha-desc'; const sortOptions = [ // We use this unicode 'en dash' character (U+2013), because it looks nicer // than simple dash in this context. This is also used in the response of // the `sorting` endpoint, which is used in the search dashboard page. { label: 'Sort by A–Z', value: ascendingSortValue }, { label: 'Sort by Z–A', value: descendingSortValue }, ]; export function DataSourcesListHeader() { const dispatch = useDispatch(); const setSearchQuery = useCallback((q: string) => dispatch(setDataSourcesSearchQuery(q)), [dispatch]); const searchQuery = useSelector(({ dataSources }: StoreState) => getDataSourcesSearchQuery(dataSources)); const setSort = useCallback( (sort: SelectableValue) => dispatch(setIsSortAscending(sort.value === ascendingSortValue)), [dispatch] ); const isSortAscending = useSelector(({ dataSources }: StoreState) => getDataSourcesSort(dataSources)); const sortPicker = { onChange: setSort, value: isSortAscending ? ascendingSortValue : descendingSortValue, getSortOptions: () => Promise.resolve(sortOptions), }; return ( <PageActionBar searchQuery={searchQuery} setSearchQuery={setSearchQuery} key="action-bar" sortPicker={sortPicker} /> ); }
Submit
FILE
FOLDER
INFO
Name
Size
Permission
Action
picker
---
0755
BasicSettings.test.tsx
682 bytes
0644
BasicSettings.tsx
2358 bytes
0644
ButtonRow.test.tsx
876 bytes
0644
ButtonRow.tsx
1160 bytes
0644
CloudInfoBox.tsx
2179 bytes
0644
DashboardsTable.test.tsx
3372 bytes
0644
DashboardsTable.tsx
2137 bytes
0644
DataSourceAddButton.tsx
754 bytes
0644
DataSourceCategories.tsx
1379 bytes
0644
DataSourceDashboards.test.tsx
1476 bytes
0644
DataSourceDashboards.tsx
2417 bytes
0644
DataSourceLoadError.tsx
917 bytes
0644
DataSourceMissingRightsMessage.tsx
379 bytes
0644
DataSourcePluginConfigPage.tsx
576 bytes
0644
DataSourcePluginSettings.tsx
2480 bytes
0644
DataSourcePluginState.tsx
508 bytes
0644
DataSourceReadOnlyMessage.tsx
520 bytes
0644
DataSourceTabPage.tsx
1166 bytes
0644
DataSourceTestingStatus.test.tsx
3313 bytes
0644
DataSourceTestingStatus.tsx
4054 bytes
0644
DataSourceTitle.tsx
779 bytes
0644
DataSourceTypeCard.tsx
3209 bytes
0644
DataSourceTypeCardList.tsx
961 bytes
0644
DataSourcesList.test.tsx
1787 bytes
0644
DataSourcesList.tsx
3664 bytes
0644
DataSourcesListCard.tsx
3749 bytes
0644
DataSourcesListHeader.tsx
1672 bytes
0644
EditDataSource.test.tsx
10928 bytes
0644
EditDataSource.tsx
7557 bytes
0644
EditDataSourceActions.tsx
1717 bytes
0644
NewDataSource.tsx
3154 bytes
0644
useDataSourceInfo.tsx
691 bytes
0644
N4ST4R_ID | Naxtarrr