Search/ActionRow: drill placeholder to SortPicker (#56475)

This commit is contained in:
Leon Sorokin 2022-10-13 14:30:20 -05:00 committed by GitHub
parent 145b970557
commit 5acda40248
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 1 deletions

View File

@ -26,6 +26,7 @@ interface Props {
onTagFilterChange: (tags: string[]) => void;
getTagOptions: () => Promise<TermCount[]>;
getSortOptions: () => Promise<SelectableValue[]>;
sortPlaceholder?: string;
onDatasourceChange: (ds?: string) => void;
includePanels: boolean;
setIncludePanels: (v: boolean) => void;
@ -57,6 +58,7 @@ export const ActionRow: FC<Props> = ({
onTagFilterChange,
getTagOptions,
getSortOptions,
sortPlaceholder,
onDatasourceChange,
query,
showStarredFilter,
@ -116,7 +118,13 @@ export const ActionRow: FC<Props> = ({
value={layout}
/>
)}
<SortPicker onChange={onSortChange} value={query.sort?.value} getSortOptions={getSortOptions} isClearable />
<SortPicker
onChange={onSortChange}
value={query.sort?.value}
getSortOptions={getSortOptions}
placeholder={sortPlaceholder}
isClearable
/>
</HorizontalGroup>
</div>
</div>

View File

@ -337,6 +337,7 @@ export const SearchView = ({
onTagFilterChange={onTagFilterChange}
getTagOptions={getTagOptions}
getSortOptions={getGrafanaSearcher().getSortOptions}
sortPlaceholder={getGrafanaSearcher().sortPlaceholder}
onDatasourceChange={onDatasourceChange}
query={query}
includePanels={includePanels!}

View File

@ -71,4 +71,5 @@ export interface GrafanaSearcher {
starred: (query: SearchQuery) => Promise<QueryResponse>;
tags: (query: SearchQuery) => Promise<TermCount[]>;
getSortOptions: () => Promise<SelectableValue[]>;
sortPlaceholder?: string;
}