@@ -18,7 +21,7 @@ export const UpgradeBox = ({ text, className, ...htmlProps }: Props) => {
{text}
{
);
};
-const getUpgradeBoxStyles = (theme: GrafanaTheme2) => {
+const getUpgradeBoxStyles = (theme: GrafanaTheme2, size: ComponentSize) => {
const borderRadius = theme.shape.borderRadius(2);
+ const fontBase = size === 'md' ? 'body' : 'bodySmall';
return {
box: css`
@@ -43,7 +47,7 @@ const getUpgradeBoxStyles = (theme: GrafanaTheme2) => {
border: 1px solid ${theme.colors.primary.shade};
padding: ${theme.spacing(2)};
color: ${theme.colors.primary.text};
- font-size: ${theme.typography.bodySmall.fontSize};
+ font-size: ${theme.typography[fontBase].fontSize};
text-align: left;
line-height: 16px;
`,
@@ -52,6 +56,12 @@ const getUpgradeBoxStyles = (theme: GrafanaTheme2) => {
`,
button: css`
margin-top: ${theme.spacing(2)};
+
+ &:focus-visible {
+ box-shadow: none;
+ color: ${theme.colors.text.primary};
+ outline: 2px solid ${theme.colors.primary.main};
+ }
`,
icon: css`
border: 1px solid ${theme.colors.primary.shade};
diff --git a/public/app/features/dashboard/components/ShareModal/types.ts b/public/app/features/dashboard/components/ShareModal/types.ts
index 8b7f47a12cf..42d45c9ea89 100644
--- a/public/app/features/dashboard/components/ShareModal/types.ts
+++ b/public/app/features/dashboard/components/ShareModal/types.ts
@@ -1,4 +1,5 @@
import React from 'react';
+import { NavModelItem } from '@grafana/data';
import { DashboardModel, PanelModel } from 'app/features/dashboard/state';
export interface ShareModalTabProps {
@@ -10,6 +11,6 @@ export interface ShareModalTabProps {
export interface ShareModalTabModel {
label: string;
value: string;
- labelSuffix?: () => JSX.Element;
+ tabSuffix?: NavModelItem['tabSuffix'];
component: React.ComponentType;
}
diff --git a/public/app/features/datasources/state/navModel.ts b/public/app/features/datasources/state/navModel.ts
index b75dfad3d91..2cf04410370 100644
--- a/public/app/features/datasources/state/navModel.ts
+++ b/public/app/features/datasources/state/navModel.ts
@@ -3,6 +3,7 @@ import { featureEnabled } from '@grafana/runtime';
import config from 'app/core/config';
import { contextSrv } from 'app/core/core';
import { AccessControlAction } from 'app/types';
+import { ProBadge } from 'app/core/components/Upgrade/ProBadge';
import { GenericDataSourcePlugin } from '../settings/PluginSettings';
export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDataSourcePlugin): NavModelItem {
@@ -48,36 +49,60 @@ export function buildNavModel(dataSource: DataSourceSettings, plugin: GenericDat
});
}
+ const dsPermissions = {
+ active: false,
+ icon: 'lock',
+ id: `datasource-permissions-${dataSource.id}`,
+ text: 'Permissions',
+ url: `datasources/edit/${dataSource.id}/permissions`,
+ };
+
if (featureEnabled('dspermissions')) {
if (contextSrv.hasPermission(AccessControlAction.DataSourcesPermissionsRead)) {
- navModel.children!.push({
- active: false,
- icon: 'lock',
- id: `datasource-permissions-${dataSource.id}`,
- text: 'Permissions',
- url: `datasources/edit/${dataSource.id}/permissions`,
- });
+ navModel.children!.push(dsPermissions);
}
- }
-
- if (featureEnabled('analytics')) {
+ } else if (config.featureHighlights.enabled) {
navModel.children!.push({
- active: false,
- icon: 'info-circle',
- id: `datasource-insights-${dataSource.id}`,
- text: 'Insights',
- url: `datasources/edit/${dataSource.id}/insights`,
+ ...dsPermissions,
+ url: dsPermissions.url + '/upgrade',
+ tabSuffix: ProBadge,
});
}
- if (featureEnabled('caching')) {
+ const analytics = {
+ active: false,
+ icon: 'info-circle',
+ id: `datasource-insights-${dataSource.id}`,
+ text: 'Insights',
+ url: `datasources/edit/${dataSource.id}/insights`,
+ };
+
+ if (featureEnabled('analytics')) {
+ navModel.children!.push(analytics);
+ } else if (config.featureHighlights.enabled) {
navModel.children!.push({
- active: false,
- icon: 'database',
- id: `datasource-cache-${dataSource.uid}`,
- text: 'Cache',
- url: `datasources/edit/${dataSource.uid}/cache`,
- hideFromTabs: !pluginMeta.isBackend || !config.caching.enabled,
+ ...analytics,
+ url: analytics.url + '/upgrade',
+ tabSuffix: ProBadge,
+ });
+ }
+
+ const caching = {
+ active: false,
+ icon: 'database',
+ id: `datasource-cache-${dataSource.uid}`,
+ text: 'Cache',
+ url: `datasources/edit/${dataSource.uid}/cache`,
+ hideFromTabs: !pluginMeta.isBackend || !config.caching.enabled,
+ };
+
+ if (featureEnabled('caching')) {
+ navModel.children!.push(caching);
+ } else if (config.featureHighlights.enabled) {
+ navModel.children!.push({
+ ...caching,
+ url: caching.url + '/upgrade',
+ tabSuffix: ProBadge,
});
}