2022-01-30 20:41:58 -06:00
|
|
|
// Maps the ID of the nav item to a translated phrase to later pass to <Trans />
|
|
|
|
// Because the navigation content is dynamic (defined in the backend), we can not use
|
|
|
|
// the normal inline message definition method.
|
2022-07-20 10:26:52 -05:00
|
|
|
|
2022-10-11 05:45:58 -05:00
|
|
|
import { config } from '@grafana/runtime';
|
2022-10-06 10:34:04 -05:00
|
|
|
import { t } from 'app/core/internationalization';
|
|
|
|
|
2022-07-20 10:26:52 -05:00
|
|
|
// 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
|
|
|
|
|
2022-01-30 20:41:58 -06:00
|
|
|
// see pkg/api/index.go
|
2022-10-11 05:45:58 -05:00
|
|
|
export function getNavTitle(navId: string | undefined) {
|
2022-10-06 10:34:04 -05:00
|
|
|
switch (navId) {
|
|
|
|
case 'home':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.home.title', 'Home');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'create':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.create.title', 'Create');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'create-dashboard':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.create-dashboard.title', 'Dashboard');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'folder':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.create-folder.title', 'Folder');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'import':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.create-import.title', 'Import');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'alert':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.create-alert.title', 'New alert rule');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'starred':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.starred.title', 'Starred');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'starred-empty':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.starred-empty.title', 'Your starred dashboards will appear here');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.dashboards.title', 'Dashboards');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards/browse':
|
2022-10-11 05:45:58 -05:00
|
|
|
return config.featureToggles.topnav
|
|
|
|
? t('nav.dashboards.title', 'Dashboards')
|
|
|
|
: t('nav.manage-dashboards.title', 'Browse');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards/playlists':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.playlists.title', 'Playlists');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards/snapshots':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.snapshots.title', 'Snapshots');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards/library-panels':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.library-panels.title', 'Library panels');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards/new':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.new-dashboard.title', 'New dashboard');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'dashboards/folder/new':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.new-folder.title', 'New folder');
|
|
|
|
case 'scenes':
|
|
|
|
return t('nav.scenes.title', 'Scenes');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'explore':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.explore.title', 'Explore');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'alerting':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting.title', 'Alerting');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'alerting-legacy':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-legacy.title', 'Alerting (legacy)');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'alert-list':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-list.title', 'Alert rules');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'receivers':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-receivers.title', 'Contact points');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'am-routes':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-am-routes.title', 'Notification policies');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'channels':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-channels.title', 'Notification channels');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'silences':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-silences.title', 'Silences');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'groups':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-groups.title', 'Groups');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'alerting-admin':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.alerting-admin.title', 'Admin');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'cfg':
|
2022-10-12 10:37:14 -05:00
|
|
|
return config.featureToggles.topnav
|
|
|
|
? t('nav.config.title', 'Administration')
|
|
|
|
: t('nav.config.titleBeforeTopnav', 'Configuration');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'datasources':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.datasources.title', 'Data sources');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'correlations':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.correlations.title', 'Correlations');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'users':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.users.title', 'Users');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'teams':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.teams.title', 'Teams');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'plugins':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.plugins.title', 'Plugins');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'org-settings':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.org-settings.title', 'Preferences');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'apikeys':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.api-keys.title', 'API keys');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'serviceaccounts':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.service-accounts.title', 'Service accounts');
|
|
|
|
case 'admin':
|
|
|
|
return t('nav.admin.title', 'Server admin');
|
|
|
|
case 'global-users':
|
|
|
|
return t('nav.global-users.title', 'Users');
|
|
|
|
case 'global-orgs':
|
|
|
|
return t('nav.global-orgs.title', 'Organizations');
|
|
|
|
case 'server-settings':
|
|
|
|
return t('nav.server-settings.title', 'Settings');
|
|
|
|
case 'storage':
|
|
|
|
return t('nav.storage.title', 'Storage');
|
|
|
|
case 'upgrading':
|
|
|
|
return t('nav.upgrading.title', 'Stats and license');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'live':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.live.title', 'Event streaming');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'live-status':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.live-status.title', 'Status');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'live-pipeline':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.live-pipeline.title', 'Pipeline');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'live-cloud':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.live-cloud.title', 'Cloud');
|
|
|
|
case 'monitoring':
|
|
|
|
return t('nav.monitoring.title', 'Monitoring');
|
|
|
|
case 'apps':
|
|
|
|
return t('nav.apps.title', 'Apps');
|
|
|
|
case 'alerts-and-incidents':
|
|
|
|
return t('nav.alerts-and-incidents.title', 'Alerts & incidents');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'help':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.help.title', 'Help');
|
|
|
|
case 'profile/settings':
|
|
|
|
return t('nav.profile/settings.title', 'Preferences');
|
|
|
|
case 'profile/notifications':
|
|
|
|
return t('nav.profile/notifications.title', 'Notification history');
|
|
|
|
case 'profile/password':
|
|
|
|
return t('nav.profile/password.title', 'Change password');
|
2022-10-06 10:34:04 -05:00
|
|
|
case 'sign-out':
|
2022-10-11 05:45:58 -05:00
|
|
|
return t('nav.sign-out.title', 'Sign out');
|
|
|
|
default:
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function getNavSubTitle(navId: string | undefined) {
|
|
|
|
switch (navId) {
|
|
|
|
case 'dashboards':
|
|
|
|
return t('nav.dashboards.subtitle', 'Create and manage dashboards to visualize your data');
|
|
|
|
case 'dashboards/browse':
|
|
|
|
return config.featureToggles.topnav
|
|
|
|
? t('nav.dashboards.subtitle', 'Create and manage dashboards to visualize your data')
|
|
|
|
: undefined;
|
|
|
|
case 'dashboards/playlists':
|
|
|
|
return t('nav.playlists.subtitle', 'Groups of dashboards that are displayed in a sequence');
|
|
|
|
case 'dashboards/snapshots':
|
|
|
|
return t(
|
|
|
|
'nav.snapshots.subtitle',
|
|
|
|
'Interactive, publically available, point-in-time representations of dashboards'
|
|
|
|
);
|
|
|
|
case 'dashboards/library-panels':
|
|
|
|
return t('nav.library-panels.subtitle', 'Reusable panels that can be added to multiple dashboards');
|
|
|
|
case 'alerting':
|
|
|
|
return t('nav.alerting.subtitle', 'Learn about problems in your systems moments after they occur');
|
|
|
|
case 'alert-list':
|
|
|
|
return t('nav.alerting-list.subtitle', 'Rules that determine whether an alert will fire');
|
|
|
|
case 'receivers':
|
|
|
|
return t('nav.alerting-receivers.subtitle', 'Decide how your contacts are notified when an alert fires');
|
|
|
|
case 'am-routes':
|
|
|
|
return t('nav.alerting-am-routes.subtitle', 'Determine how alerts are routed to contact points');
|
|
|
|
case 'silences':
|
|
|
|
return t('nav.alerting-silences.subtitle', 'Stop notifications from one or more alerting rules');
|
|
|
|
case 'groups':
|
|
|
|
return t('nav.alerting-groups.subtitle', 'See grouped alerts from an Alertmanager instance');
|
|
|
|
case 'datasources':
|
|
|
|
return t('nav.datasources.subtitle', 'Add and configure data sources');
|
|
|
|
case 'correlations':
|
|
|
|
return t('nav.correlations.subtitle', 'Add and configure correlations');
|
|
|
|
case 'users':
|
|
|
|
return t('nav.users.subtitle', 'Invite and assign roles to users');
|
|
|
|
case 'teams':
|
|
|
|
return t('nav.teams.subtitle', 'Groups of users that have common dashboard and permission needs');
|
|
|
|
case 'plugins':
|
|
|
|
return t('nav.plugins.subtitle', 'Extend the Grafana experience with plugins');
|
|
|
|
case 'org-settings':
|
|
|
|
return t('nav.org-settings.subtitle', 'Manage preferences across an organization');
|
|
|
|
case 'apikeys':
|
|
|
|
return t('nav.api-keys.subtitle', 'Manage and create API keys that are used to interact with Grafana HTTP APIs');
|
|
|
|
case 'serviceaccounts':
|
|
|
|
return t('nav.service-accounts.subtitle', 'Use service accounts to run automated workloads in Grafana');
|
|
|
|
case 'global-users':
|
|
|
|
return t('nav.global-users.subtitle', 'Manage and create users across the whole Grafana server');
|
|
|
|
case 'global-orgs':
|
|
|
|
return t('nav.global-orgs.subtitle', 'Isolated instances of Grafana running on the same server');
|
|
|
|
case 'server-settings':
|
|
|
|
return t('nav.server-settings.subtitle', 'View the settings defined in your Grafana config');
|
|
|
|
case 'storage':
|
|
|
|
return t('nav.storage.subtitle', 'Manage file storage');
|
|
|
|
case 'admin':
|
|
|
|
return config.featureToggles.topnav
|
|
|
|
? t(
|
|
|
|
'nav.admin.subtitle',
|
|
|
|
'Manage server-wide settings and access to resources such as organizations, users, and licenses'
|
|
|
|
)
|
|
|
|
: undefined;
|
|
|
|
case 'apps':
|
|
|
|
return t('nav.apps.subtitle', 'App plugins that extend the Grafana experience');
|
|
|
|
case 'monitoring':
|
|
|
|
return t('nav.monitoring.subtitle', 'Monitoring and infrastructure apps');
|
|
|
|
case 'alerts-and-incidents':
|
|
|
|
return t('nav.alerts-and-incidents.subtitle', 'Alerting and incident management apps');
|
2022-10-06 10:34:04 -05:00
|
|
|
default:
|
|
|
|
return undefined;
|
|
|
|
}
|
|
|
|
}
|