mirror of
https://github.com/grafana/grafana.git
synced 2024-12-01 21:19:28 -06:00
Search: Fix strict null errors (#23804)
This commit is contained in:
parent
c0fe565499
commit
906cc6d317
@ -8,7 +8,7 @@ const searchSrv = new SearchSrv();
|
||||
|
||||
export interface Props {
|
||||
onChange: (sortValue: SelectableValue) => void;
|
||||
value?: SelectableValue;
|
||||
value?: SelectableValue | null;
|
||||
placeholder?: string;
|
||||
}
|
||||
|
||||
|
@ -25,17 +25,19 @@ interface Props {
|
||||
query: DashboardQuery;
|
||||
showStarredFilter?: boolean;
|
||||
hideSelectedTags?: boolean;
|
||||
hideLayout?: boolean;
|
||||
}
|
||||
|
||||
export const ActionRow: FC<Props> = ({
|
||||
layout,
|
||||
onLayoutChange,
|
||||
onSortChange,
|
||||
onStarredFilterChange,
|
||||
onStarredFilterChange = () => {},
|
||||
onTagFilterChange,
|
||||
query,
|
||||
showStarredFilter,
|
||||
hideSelectedTags,
|
||||
hideLayout,
|
||||
}) => {
|
||||
const theme = useTheme();
|
||||
const styles = getStyles(theme);
|
||||
@ -43,7 +45,7 @@ export const ActionRow: FC<Props> = ({
|
||||
return (
|
||||
<div className={styles.actionRow}>
|
||||
<HorizontalGroup spacing="md" width="100%">
|
||||
{layout ? <RadioButtonGroup options={layoutOptions} onChange={onLayoutChange} value={layout} /> : null}
|
||||
{!hideLayout ? <RadioButtonGroup options={layoutOptions} onChange={onLayoutChange} value={layout} /> : null}
|
||||
<SortPicker onChange={onSortChange} value={query.sort} />
|
||||
</HorizontalGroup>
|
||||
<HorizontalGroup spacing="md" justify="space-between">
|
||||
|
@ -154,7 +154,8 @@ export const ManageDashboards: FC<Props> = memo(({ folderId, folderUid }) => {
|
||||
onSortChange={onSortChange}
|
||||
onTagFilterChange={onTagFilterChange}
|
||||
query={query}
|
||||
layout={!folderUid && layout}
|
||||
layout={layout}
|
||||
hideLayout={!!folderUid}
|
||||
onLayoutChange={onLayoutChange}
|
||||
/>
|
||||
)}
|
||||
|
@ -12,14 +12,15 @@ export interface Props {
|
||||
canDelete?: boolean;
|
||||
canMove?: boolean;
|
||||
deleteItem: () => void;
|
||||
hideLayout?: boolean;
|
||||
layout: string;
|
||||
moveTo: () => void;
|
||||
onLayoutChange: Dispatch<SetStateAction<string>>;
|
||||
onSortChange: onSelectChange;
|
||||
onStarredFilterChange: onSelectChange;
|
||||
onTagFilterChange: onSelectChange;
|
||||
onToggleAllChecked: () => void;
|
||||
query: DashboardQuery;
|
||||
onSortChange: onSelectChange;
|
||||
onLayoutChange: Dispatch<SetStateAction<string>>;
|
||||
layout: string;
|
||||
}
|
||||
|
||||
export const SearchResultsFilter: FC<Props> = ({
|
||||
@ -27,14 +28,15 @@ export const SearchResultsFilter: FC<Props> = ({
|
||||
canDelete,
|
||||
canMove,
|
||||
deleteItem,
|
||||
hideLayout,
|
||||
layout,
|
||||
moveTo,
|
||||
onToggleAllChecked,
|
||||
onLayoutChange,
|
||||
onSortChange,
|
||||
onStarredFilterChange,
|
||||
onTagFilterChange,
|
||||
onToggleAllChecked,
|
||||
query,
|
||||
onSortChange,
|
||||
layout,
|
||||
onLayoutChange,
|
||||
}) => {
|
||||
const showActions = canDelete || canMove;
|
||||
const theme = useTheme();
|
||||
@ -56,6 +58,7 @@ export const SearchResultsFilter: FC<Props> = ({
|
||||
<ActionRow
|
||||
{...{
|
||||
layout,
|
||||
hideLayout,
|
||||
onLayoutChange,
|
||||
onSortChange,
|
||||
onStarredFilterChange,
|
||||
|
@ -46,7 +46,7 @@ export const useSearchQuery = (queryParams: Partial<DashboardQuery>) => {
|
||||
dispatch({ type: TOGGLE_STARRED, payload: filter.value });
|
||||
};
|
||||
|
||||
const onSortChange = (sort: SelectableValue) => {
|
||||
const onSortChange = (sort: SelectableValue | null) => {
|
||||
dispatch({ type: TOGGLE_SORT, payload: sort });
|
||||
};
|
||||
|
||||
|
@ -41,16 +41,16 @@ export const loadFolderPage = (uid: string, activeChildId: string) => {
|
||||
navModel.main.text = folderTitle;
|
||||
|
||||
const dashTab = navModel.main.children.find((child: any) => child.id === 'manage-folder-dashboards');
|
||||
dashTab.url = folderUrl;
|
||||
dashTab!.url = folderUrl;
|
||||
|
||||
if (folder.canAdmin) {
|
||||
const permTab = navModel.main.children.find((child: any) => child.id === 'manage-folder-permissions');
|
||||
permTab.url = folderUrl + '/permissions';
|
||||
permTab!.url = folderUrl + '/permissions';
|
||||
|
||||
const settingsTab = navModel.main.children.find((child: any) => child.id === 'manage-folder-settings');
|
||||
settingsTab.url = folderUrl + '/settings';
|
||||
settingsTab!.url = folderUrl + '/settings';
|
||||
} else {
|
||||
navModel.main.children = [dashTab];
|
||||
navModel.main.children = [dashTab!];
|
||||
}
|
||||
|
||||
return { folder, model: navModel };
|
||||
|
Loading…
Reference in New Issue
Block a user