diff --git a/public/app/core/components/Footer/Footer.tsx b/public/app/core/components/Footer/Footer.tsx index 92b906b16ce40..0c4a6752de03f 100644 --- a/public/app/core/components/Footer/Footer.tsx +++ b/public/app/core/components/Footer/Footer.tsx @@ -5,6 +5,7 @@ import { GrafanaTheme2, LinkTarget } from '@grafana/data'; import { config } from '@grafana/runtime'; import { Icon, IconName, useStyles2 } from '@grafana/ui'; import { t } from 'app/core/internationalization'; +import { isPmmAdmin } from 'app/percona/shared/helpers/permissions'; export interface FooterLink { // @PERCONA - make target optional @@ -17,42 +18,68 @@ export interface FooterLink { export let getFooterLinks = (): FooterLink[] => { // @PERCONA - return [ - { - id: 'pmm-dump', - text: 'PMM Dump', - icon: 'brain', - url: '/graph/pmm-dump', - }, - { - id: 'pmm-logs', - text: 'PMM Logs', - icon: 'download-alt', - url: '/logs.zip', - target: '_blank', - }, - { - target: '_blank', - id: 'pmm-docs', - text: t('nav.help/documentation', 'Documentation'), - icon: 'document-info', - url: 'https://per.co.na/pmm_documentation', - }, - { - target: '_blank', - id: 'support', - text: t('nav.help/support', 'Support'), - icon: 'question-circle', - url: 'https://per.co.na/pmm_support', - }, - { - target: '_blank', - id: 'community', - text: t('nav.help/community', 'Community'), - icon: 'comments-alt', - url: 'https://per.co.na/pmm_community', - }, - ]; + if (isPmmAdmin(config.bootData.user)) { + return [ + { + id: 'pmm-dump', + text: 'PMM Dump', + icon: 'brain', + url: '/graph/pmm-dump', + }, + { + id: 'pmm-logs', + text: 'PMM Logs', + icon: 'download-alt', + url: '/logs.zip', + target: '_blank', + }, + { + target: '_blank', + id: 'pmm-docs', + text: t('nav.help/documentation', 'Documentation'), + icon: 'document-info', + url: 'https://per.co.na/pmm_documentation', + }, + { + target: '_blank', + id: 'support', + text: t('nav.help/support', 'Support'), + icon: 'question-circle', + url: 'https://per.co.na/pmm_support', + }, + { + target: '_blank', + id: 'community', + text: t('nav.help/community', 'Community'), + icon: 'comments-alt', + url: 'https://per.co.na/pmm_community', + }, + ]; + } else { + return [ + { + target: '_blank', + id: 'pmm-docs', + text: t('nav.help/documentation', 'Documentation'), + icon: 'document-info', + url: 'https://per.co.na/pmm_documentation', + }, + { + target: '_blank', + id: 'support', + text: t('nav.help/support', 'Support'), + icon: 'question-circle', + url: 'https://per.co.na/pmm_support', + }, + { + target: '_blank', + id: 'community', + text: t('nav.help/community', 'Community'), + icon: 'comments-alt', + url: 'https://per.co.na/pmm_community', + }, + ]; + } }; export function getVersionMeta(version: string) { diff --git a/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx b/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx index 269e2cd321d3f..b8b4faf7d0b36 100644 --- a/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx +++ b/public/app/percona/pmm-dump/components/ExportDataset/ExportDataset.tsx @@ -31,6 +31,7 @@ const ExportDataset: FC const styles = useStyles2(getStyles); const dispatch = useAppDispatch(); const { isLoading, services: fetchedServices } = useSelector(getServices); + const initialValues = useMemo>(() => ({ load: true }), []); const serviceNames = useMemo( () => @@ -109,6 +110,7 @@ const ExportDataset: FC
( diff --git a/public/app/percona/shared/components/PerconaBootstrapper/PerconaNavigation/PerconaNavigation.tsx b/public/app/percona/shared/components/PerconaBootstrapper/PerconaNavigation/PerconaNavigation.tsx index f75af557570ee..6a7c031aa6b3f 100644 --- a/public/app/percona/shared/components/PerconaBootstrapper/PerconaNavigation/PerconaNavigation.tsx +++ b/public/app/percona/shared/components/PerconaBootstrapper/PerconaNavigation/PerconaNavigation.tsx @@ -104,17 +104,17 @@ const PerconaNavigation: FC = () => { updatedNavTree.push(PMM_ENVIRONMENT_OVERVIEW_PAGE); } - // PMM Dump - const help = updatedNavTree.find((i) => i.id === 'help'); - if (help) { - help.children = help.children || []; - help.children.push(PMM_DUMP_PAGE); - - dispatch(updateNavIndex(PMM_DUMP_PAGE)); - dispatch(updateNavIndex(help)); - } - if (isPmmAdmin(config.bootData.user)) { + // PMM Dump + const help = updatedNavTree.find((i) => i.id === 'help'); + if (help) { + help.children = help.children || []; + help.children.push(PMM_DUMP_PAGE); + + dispatch(updateNavIndex(PMM_DUMP_PAGE)); + dispatch(updateNavIndex(help)); + } + if (result?.enableAccessControl) { const cfg = cloneDeep(initialState).find((i) => i.id === 'cfg'); diff --git a/public/app/routes/routes.tsx b/public/app/routes/routes.tsx index 40bc67ea24be8..fbd027bebce5c 100644 --- a/public/app/routes/routes.tsx +++ b/public/app/routes/routes.tsx @@ -19,6 +19,7 @@ import { ConfigureIRM } from 'app/features/gops/configuration-tracker/components import { getRoutes as getPluginCatalogRoutes } from 'app/features/plugins/admin/routes'; import { getAppPluginRoutes } from 'app/features/plugins/routes'; import { getProfileRoutes } from 'app/features/profile/routes'; +import { isPmmAdmin } from 'app/percona/shared/helpers/permissions'; import { AccessControlAction, DashboardRoutes } from 'app/types'; import { SafeDynamicImport } from '../core/components/DynamicImports/SafeDynamicImport'; @@ -787,19 +788,25 @@ export function getAppRoutes(): RouteDescriptor[] { () => import(/* webpackChunkName: "DataTrailsPage"*/ 'app/features/trails/DataTrailsPage') ), }, - { - path: '/pmm-dump', - component: SafeDynamicImport(() => import(/* webpackChunkName: "PMMDump" */ 'app/percona/pmm-dump/PMMDump')), - }, - { - path: '/pmm-dump/new', - component: SafeDynamicImport( - () => - import( - /* webpackChunkName: "BackupInventoryPage" */ 'app/percona/pmm-dump/components/ExportDataset/ExportDataset' - ) - ), - }, + ...(isPmmAdmin(config.bootData.user) + ? [ + { + path: '/pmm-dump', + component: SafeDynamicImport( + () => import(/* webpackChunkName: "PMMDump" */ 'app/percona/pmm-dump/PMMDump') + ), + }, + { + path: '/pmm-dump/new', + component: SafeDynamicImport( + () => + import( + /* webpackChunkName: "BackupInventoryPage" */ 'app/percona/pmm-dump/components/ExportDataset/ExportDataset' + ) + ), + }, + ] + : []), ...getPluginCatalogRoutes(), ...getSupportBundleRoutes(), ...getAlertingRoutes(),