mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
CommandPalette: Move quick add actions to top level (#62900)
* Move quick actions to top level * Change quick action verb to "Create" * create to 'new' * fix comment * update translations * undo changing alerting
This commit is contained in:
@@ -5,11 +5,8 @@
|
||||
import { config } from '@grafana/runtime';
|
||||
import { t } from 'app/core/internationalization';
|
||||
|
||||
// The keys of the TRANSLATED_MENU_ITEMS object (NOT the id inside the defineMessage function)
|
||||
// must match the ID of the navigation item, as defined in the backend nav model
|
||||
|
||||
// see pkg/api/index.go
|
||||
export function getNavTitle(navId: string | undefined) {
|
||||
// the switch cases must match the ID of the navigation item, as defined in the backend nav model
|
||||
switch (navId) {
|
||||
case 'home':
|
||||
return t('nav.home.title', 'Home');
|
||||
@@ -24,7 +21,7 @@ export function getNavTitle(navId: string | undefined) {
|
||||
case 'import':
|
||||
return t('nav.create-import.title', 'Import');
|
||||
case 'alert':
|
||||
return t('nav.create-alert.title', 'New alert rule');
|
||||
return t('nav.create-alert.title', 'Create alert rule');
|
||||
case 'starred':
|
||||
return t('nav.starred.title', 'Starred');
|
||||
case 'starred-empty':
|
||||
|
||||
@@ -4,10 +4,7 @@ import { t } from 'app/core/internationalization';
|
||||
import { changeTheme } from 'app/core/services/theme';
|
||||
|
||||
import { CommandPaletteAction } from '../types';
|
||||
import { DEFAULT_PRIORITY, PREFERENCES_PRIORITY } from '../values';
|
||||
|
||||
// We reuse this, but translations cannot be in module scope (t must be called after i18n has set up,)
|
||||
const getPagesSectionTranslation = () => t('command-palette.section.pages', 'Pages');
|
||||
import { ACTIONS_PRIORITY, DEFAULT_PRIORITY, PREFERENCES_PRIORITY } from '../values';
|
||||
|
||||
// TODO: Clean this once ID is mandatory on nav items
|
||||
function idForNavItem(navItem: NavModelItem) {
|
||||
@@ -25,15 +22,19 @@ function navTreeToActions(navTree: NavModelItem[], parent?: NavModelItem): Comma
|
||||
continue;
|
||||
}
|
||||
|
||||
const section = isCreateAction ? t('command-palette.section.actions', 'Actions') : getPagesSectionTranslation();
|
||||
const section = isCreateAction
|
||||
? t('command-palette.section.actions', 'Actions')
|
||||
: t('command-palette.section.pages', 'Pages');
|
||||
|
||||
const priority = isCreateAction ? ACTIONS_PRIORITY : DEFAULT_PRIORITY;
|
||||
|
||||
const action = {
|
||||
id: idForNavItem(navItem),
|
||||
name: text, // TODO: translate
|
||||
section: section,
|
||||
url: url && locationUtil.stripBaseFromUrl(url),
|
||||
parent: parent && idForNavItem(parent),
|
||||
priority: DEFAULT_PRIORITY,
|
||||
parent: parent && !isCreateAction && idForNavItem(parent),
|
||||
priority: priority,
|
||||
};
|
||||
|
||||
navActions.push(action);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
export const RECENT_DASHBOARDS_PRORITY = 4;
|
||||
export const RECENT_DASHBOARDS_PRORITY = 5;
|
||||
export const ACTIONS_PRIORITY = 4;
|
||||
export const DEFAULT_PRIORITY = 3;
|
||||
export const PREFERENCES_PRIORITY = 2;
|
||||
export const SEARCH_RESULTS_PRORITY = 1; // Dynamic actions should be below static ones so the list doesn't 'jump' when they come in
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"search": "Search"
|
||||
},
|
||||
"search-box": {
|
||||
"placeholder": "Search Grafana"
|
||||
"placeholder": "Search or jump to..."
|
||||
},
|
||||
"section": {
|
||||
"actions": "Actions",
|
||||
@@ -160,7 +160,7 @@
|
||||
"title": "Alert rules"
|
||||
},
|
||||
"alerting-receivers": {
|
||||
"subtitle": "Choose how to notify your contact points when an alert instance fires",
|
||||
"subtitle": "Choose how to notify your contact points when an alert instance fires",
|
||||
"title": "Contact points"
|
||||
},
|
||||
"alerting-silences": {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
"search": "Ŝęäřčĥ"
|
||||
},
|
||||
"search-box": {
|
||||
"placeholder": "Ŝęäřčĥ Ğřäƒäʼnä"
|
||||
"placeholder": "Ŝęäřčĥ őř ĵūmp ŧő..."
|
||||
},
|
||||
"section": {
|
||||
"actions": "Åčŧįőʼnş",
|
||||
@@ -160,7 +160,7 @@
|
||||
"title": "Åľęřŧ řūľęş"
|
||||
},
|
||||
"alerting-receivers": {
|
||||
"subtitle": "Đęčįđę ĥőŵ yőūř čőʼnŧäčŧş äřę ʼnőŧįƒįęđ ŵĥęʼn äʼn äľęřŧ ƒįřęş",
|
||||
"subtitle": "Cĥőőşę ĥőŵ ŧő ʼnőŧįƒy yőūř čőʼnŧäčŧ pőįʼnŧş ŵĥęʼn äʼn äľęřŧ įʼnşŧäʼnčę ƒįřęş",
|
||||
"title": "Cőʼnŧäčŧ pőįʼnŧş"
|
||||
},
|
||||
"alerting-silences": {
|
||||
@@ -191,7 +191,7 @@
|
||||
"title": "Cřęäŧę"
|
||||
},
|
||||
"create-alert": {
|
||||
"title": "Ńęŵ äľęřŧ řūľę"
|
||||
"title": "Cřęäŧę äľęřŧ řūľę"
|
||||
},
|
||||
"create-dashboard": {
|
||||
"title": "Đäşĥþőäřđ"
|
||||
|
||||
Reference in New Issue
Block a user