mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
SupportBundles: Feature flag + access control navtree item (#62337)
* SupportBundles: Feature flag + access control navtree item * remove translation
This commit is contained in:
@@ -4,11 +4,10 @@ import { locationUtil, NavModelItem, NavSection } from '@grafana/data';
|
||||
import { config, reportInteraction } from '@grafana/runtime';
|
||||
import { t } from 'app/core/internationalization';
|
||||
import { contextSrv } from 'app/core/services/context_srv';
|
||||
import { AccessControlAction } from 'app/types';
|
||||
|
||||
import { ShowModalReactEvent } from '../../../types/events';
|
||||
import appEvents from '../../app_events';
|
||||
import { FooterLink, getFooterLinks } from '../Footer/Footer';
|
||||
import { getFooterLinks } from '../Footer/Footer';
|
||||
import { OrgSwitcher } from '../OrgSwitcher';
|
||||
import { HelpModal } from '../help/HelpModal';
|
||||
|
||||
@@ -53,8 +52,8 @@ export const enrichConfigItems = (items: NavModelItem[], location: Location<unkn
|
||||
|
||||
if (link.id === 'help') {
|
||||
link.children = [
|
||||
...menuItems,
|
||||
...getFooterLinks(),
|
||||
...getSupportBundleFooterLinks(),
|
||||
{
|
||||
id: 'keyboard-shortcuts',
|
||||
text: t('nav.help/keyboard-shortcuts', 'Keyboard shortcuts'),
|
||||
@@ -79,26 +78,6 @@ export const enrichConfigItems = (items: NavModelItem[], location: Location<unkn
|
||||
return items;
|
||||
};
|
||||
|
||||
export let getSupportBundleFooterLinks = (cfg = config): FooterLink[] => {
|
||||
const hasAccess =
|
||||
contextSrv.hasAccess(AccessControlAction.ActionSupportBundlesCreate, contextSrv.isGrafanaAdmin) ||
|
||||
contextSrv.hasAccess(AccessControlAction.ActionSupportBundlesRead, contextSrv.isGrafanaAdmin);
|
||||
|
||||
if (!cfg.supportBundlesEnabled || !hasAccess) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return [
|
||||
{
|
||||
target: '_self',
|
||||
id: 'support-bundle',
|
||||
text: t('nav.help/support-bundle', 'Support Bundles'),
|
||||
icon: 'question-circle',
|
||||
url: '/support-bundles',
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
export const enrichWithInteractionTracking = (item: NavModelItem, expandedState: boolean) => {
|
||||
const onClick = item.onClick;
|
||||
item.onClick = () => {
|
||||
|
||||
Reference in New Issue
Block a user