From 1ef7cfda3f9cc86ea5d6a8cfa10e011f4df349ab Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Fri, 27 Jan 2023 16:21:48 +0000 Subject: [PATCH] Navigation: more command palette tweaks (#62286) * update placeholder text, only create search keybindings if topNavCommandPalette is disabled * make search input wider --- public/app/core/components/AppChrome/TopSearchBar.tsx | 2 +- .../AppChrome/TopSearchBarCommandPaletteTrigger.tsx | 4 ++-- public/app/core/services/keybindingSrv.ts | 6 ++++-- public/app/features/commandPalette/CommandPalette.tsx | 2 +- public/locales/de-DE/grafana.json | 3 ++- public/locales/en-US/grafana.json | 3 ++- public/locales/es-ES/grafana.json | 3 ++- public/locales/fr-FR/grafana.json | 3 ++- public/locales/pseudo-LOCALE/grafana.json | 3 ++- public/locales/zh-Hans/grafana.json | 3 ++- 10 files changed, 20 insertions(+), 12 deletions(-) diff --git a/public/app/core/components/AppChrome/TopSearchBar.tsx b/public/app/core/components/AppChrome/TopSearchBar.tsx index b6246da47bd..726171f4ddc 100644 --- a/public/app/core/components/AppChrome/TopSearchBar.tsx +++ b/public/app/core/components/AppChrome/TopSearchBar.tsx @@ -79,7 +79,7 @@ const getStyles = (theme: GrafanaTheme2) => ({ justifyContent: 'space-between', [theme.breakpoints.up('sm')]: { - gridTemplateColumns: '1.5fr minmax(200px, 1fr) 1.5fr', // search should not be smaller than 200px + gridTemplateColumns: '1.5fr minmax(240px, 1fr) 1.5fr', // search should not be smaller than 240px display: 'grid', justifyContent: 'flex-start', diff --git a/public/app/core/components/AppChrome/TopSearchBarCommandPaletteTrigger.tsx b/public/app/core/components/AppChrome/TopSearchBarCommandPaletteTrigger.tsx index c67660acaae..08a5c701c51 100644 --- a/public/app/core/components/AppChrome/TopSearchBarCommandPaletteTrigger.tsx +++ b/public/app/core/components/AppChrome/TopSearchBarCommandPaletteTrigger.tsx @@ -36,7 +36,7 @@ export function TopSearchBarCommandPaletteTrigger() { ); @@ -65,7 +65,7 @@ function PretendTextInput({ onClick }: PretendTextInputProps) {
diff --git a/public/app/core/services/keybindingSrv.ts b/public/app/core/services/keybindingSrv.ts index b48bbbe1650..51b7518e9d2 100644 --- a/public/app/core/services/keybindingSrv.ts +++ b/public/app/core/services/keybindingSrv.ts @@ -39,9 +39,11 @@ export class KeybindingSrv { this.bind('g a', this.openAlerting); this.bind('g p', this.goToProfile); this.bind('g e', this.goToExplore); - this.bind('s o', this.openSearch); + if (!config.featureToggles.topNavCommandPalette) { + this.bind('s o', this.openSearch); + this.bind('f', this.openSearch); + } this.bind('t a', this.makeAbsoluteTime); - this.bind('f', this.openSearch); this.bind('esc', this.exit); this.bindGlobalEsc(); } diff --git a/public/app/features/commandPalette/CommandPalette.tsx b/public/app/features/commandPalette/CommandPalette.tsx index 4636c8e543a..fa6671affa3 100644 --- a/public/app/features/commandPalette/CommandPalette.tsx +++ b/public/app/features/commandPalette/CommandPalette.tsx @@ -59,7 +59,7 @@ export const CommandPalette = () => {
{isFetchingDashboardResults ? : }
diff --git a/public/locales/de-DE/grafana.json b/public/locales/de-DE/grafana.json index dd79858a00e..7938d1ed771 100644 --- a/public/locales/de-DE/grafana.json +++ b/public/locales/de-DE/grafana.json @@ -292,7 +292,8 @@ "title": "Szenen" }, "search": { - "placeholder": "Grafana durchsuchen" + "placeholder": "Grafana durchsuchen", + "placeholderCommandPalette": "" }, "search-dashboards": { "title": "Dashboards durchsuchen" diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index 1f9efec846a..4450f5977a4 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -292,7 +292,8 @@ "title": "Scenes" }, "search": { - "placeholder": "Search Grafana" + "placeholder": "Search Grafana", + "placeholderCommandPalette": "Search or jump to..." }, "search-dashboards": { "title": "Search dashboards" diff --git a/public/locales/es-ES/grafana.json b/public/locales/es-ES/grafana.json index 24d17509b06..a921571d27b 100644 --- a/public/locales/es-ES/grafana.json +++ b/public/locales/es-ES/grafana.json @@ -292,7 +292,8 @@ "title": "Escenas" }, "search": { - "placeholder": "Buscar Grafana" + "placeholder": "Buscar Grafana", + "placeholderCommandPalette": "" }, "search-dashboards": { "title": "Buscar paneles de control" diff --git a/public/locales/fr-FR/grafana.json b/public/locales/fr-FR/grafana.json index 76f0cf8e44c..753dcced8d3 100644 --- a/public/locales/fr-FR/grafana.json +++ b/public/locales/fr-FR/grafana.json @@ -292,7 +292,8 @@ "title": "Scènes" }, "search": { - "placeholder": "Rechercher dans Grafana" + "placeholder": "Rechercher dans Grafana", + "placeholderCommandPalette": "" }, "search-dashboards": { "title": "Rechercher dans les tableaux de bord" diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index 266e11b36c8..9b900ef8d2f 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -292,7 +292,8 @@ "title": "Ŝčęʼnęş" }, "search": { - "placeholder": "Ŝęäřčĥ Ğřäƒäʼnä" + "placeholder": "Ŝęäřčĥ Ğřäƒäʼnä", + "placeholderCommandPalette": "Ŝęäřčĥ őř ĵūmp ŧő..." }, "search-dashboards": { "title": "Ŝęäřčĥ đäşĥþőäřđş" diff --git a/public/locales/zh-Hans/grafana.json b/public/locales/zh-Hans/grafana.json index 756b9b2c3b5..cd6416ae13f 100644 --- a/public/locales/zh-Hans/grafana.json +++ b/public/locales/zh-Hans/grafana.json @@ -292,7 +292,8 @@ "title": "场景" }, "search": { - "placeholder": "搜索 Grafana" + "placeholder": "搜索 Grafana", + "placeholderCommandPalette": "" }, "search-dashboards": { "title": ""