diff --git a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md index 48197db9a65..4abb7257cb9 100644 --- a/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md +++ b/docs/sources/setup-grafana/configure-grafana/feature-toggles/index.md @@ -56,7 +56,6 @@ Most [generally available](https://grafana.com/docs/release-life-cycle/#general- | `newPDFRendering` | New implementation for the dashboard-to-PDF rendering | Yes | | `tlsMemcached` | Use TLS-enabled memcached in the enterprise caching feature | Yes | | `cloudWatchNewLabelParsing` | Updates CloudWatch label parsing to be more accurate | Yes | -| `newDashboardSharingComponent` | Enables the new sharing drawer design | Yes | | `pluginProxyPreserveTrailingSlash` | Preserve plugin proxy trailing slash. | | | `azureMonitorPrometheusExemplars` | Allows configuration of Azure Monitor as a data source that can provide Prometheus exemplars | Yes | | `pinNavItems` | Enables pinning of nav items | Yes | diff --git a/e2e-playwright/dashboards-suite/dashboard-export-image.spec.ts b/e2e-playwright/dashboards-suite/dashboard-export-image.spec.ts index 855b1a47c92..3b3c6d26fac 100644 --- a/e2e-playwright/dashboards-suite/dashboard-export-image.spec.ts +++ b/e2e-playwright/dashboards-suite/dashboard-export-image.spec.ts @@ -5,7 +5,6 @@ const DASHBOARD_UID = 'ZqZnVvFZz'; test.use({ featureToggles: { scenes: true, - newDashboardSharingComponent: true, sharingDashboardImage: true, // Enable the export image feature kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', }, diff --git a/e2e-playwright/dashboards-suite/dashboard-public-create.spec.ts b/e2e-playwright/dashboards-suite/dashboard-public-create.spec.ts index 874209513bc..5c52138ee08 100644 --- a/e2e-playwright/dashboards-suite/dashboard-public-create.spec.ts +++ b/e2e-playwright/dashboards-suite/dashboard-public-create.spec.ts @@ -2,8 +2,8 @@ import { test, expect } from '@grafana/plugin-e2e'; test.use({ featureToggles: { - newDashboardSharingComponent: false, kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', + dashboardScene: false, // this test is for the old sharing modal only used when scenes is turned off }, }); @@ -18,10 +18,10 @@ test.describe( let dashboardPage = await gotoDashboardPage({ uid: 'ZqZnVvFZz' }); // Open sharing modal - await dashboardPage.getByGrafanaSelector(selectors.components.NavToolbar.shareDashboard).click(); + await dashboardPage.getByGrafanaSelector(selectors.pages.Dashboard.DashNav.shareButton).click(); // Select public dashboards tab - await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public Dashboard')).click(); + await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public dashboard')).click(); // Create button should be disabled await expect( @@ -120,10 +120,10 @@ test.describe( ).toBeVisible(); // Open sharing modal - await dashboardPage.getByGrafanaSelector(selectors.components.NavToolbar.shareDashboard).click(); + await dashboardPage.getByGrafanaSelector(selectors.pages.Dashboard.DashNav.shareButton).click(); // Select public dashboards tab - await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public Dashboard')).click(); + await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public dashboard')).click(); await expect( dashboardPage.getByGrafanaSelector(selectors.pages.ShareDashboardModal.PublicDashboard.CopyUrlInput) @@ -171,10 +171,10 @@ test.describe( dashboardPage = await gotoDashboardPage({ uid: 'ZqZnVvFZz' }); // Open sharing modal - await dashboardPage.getByGrafanaSelector(selectors.components.NavToolbar.shareDashboard).click(); + await dashboardPage.getByGrafanaSelector(selectors.pages.Dashboard.DashNav.shareButton).click(); // Select public dashboards tab - await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public Dashboard')).click(); + await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public dashboard')).click(); // Save url before disabling public dashboard copyUrlInput = dashboardPage.getByGrafanaSelector( diff --git a/e2e-playwright/dashboards-suite/dashboard-public-templating.spec.ts b/e2e-playwright/dashboards-suite/dashboard-public-templating.spec.ts index a9bc269427f..82a2670ef9e 100644 --- a/e2e-playwright/dashboards-suite/dashboard-public-templating.spec.ts +++ b/e2e-playwright/dashboards-suite/dashboard-public-templating.spec.ts @@ -2,8 +2,8 @@ import { test, expect } from '@grafana/plugin-e2e'; test.use({ featureToggles: { - newDashboardSharingComponent: false, kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', + dashboardScene: false, // this test is for the old sharing modal only used when scenes is turned off }, }); @@ -23,10 +23,10 @@ test.describe( }); // Open sharing modal - await dashboardPage.getByGrafanaSelector(selectors.components.NavToolbar.shareDashboard).click(); + await dashboardPage.getByGrafanaSelector(selectors.pages.Dashboard.DashNav.shareButton).click(); // Select public dashboards tab - await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public Dashboard')).click(); + await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Public dashboard')).click(); // Warning Alert dashboard cannot be made public because it has template variables await expect( diff --git a/e2e-playwright/dashboards-suite/dashboard-share-externally-create.spec.ts b/e2e-playwright/dashboards-suite/dashboard-share-externally-create.spec.ts index b7a0eb5f35e..d0a6652ccc6 100644 --- a/e2e-playwright/dashboards-suite/dashboard-share-externally-create.spec.ts +++ b/e2e-playwright/dashboards-suite/dashboard-share-externally-create.spec.ts @@ -3,7 +3,6 @@ import { test, expect } from '@grafana/plugin-e2e'; test.use({ featureToggles: { scenes: true, - newDashboardSharingComponent: true, kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', }, }); diff --git a/e2e-playwright/dashboards-suite/dashboard-share-internally.spec.ts b/e2e-playwright/dashboards-suite/dashboard-share-internally.spec.ts index 82c9f4a8c17..98d394ccc91 100644 --- a/e2e-playwright/dashboards-suite/dashboard-share-internally.spec.ts +++ b/e2e-playwright/dashboards-suite/dashboard-share-internally.spec.ts @@ -3,7 +3,6 @@ import { test, expect } from '@grafana/plugin-e2e'; test.use({ featureToggles: { scenes: true, - newDashboardSharingComponent: true, kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', }, }); diff --git a/e2e-playwright/dashboards-suite/dashboard-share-snapshot-create.spec.ts b/e2e-playwright/dashboards-suite/dashboard-share-snapshot-create.spec.ts index b60cee55733..3ac515e36e6 100644 --- a/e2e-playwright/dashboards-suite/dashboard-share-snapshot-create.spec.ts +++ b/e2e-playwright/dashboards-suite/dashboard-share-snapshot-create.spec.ts @@ -5,7 +5,6 @@ import { SnapshotCreateResponse } from '../../public/app/features/dashboard/serv test.use({ featureToggles: { scenes: true, - newDashboardSharingComponent: true, kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', }, }); diff --git a/e2e-playwright/dashboards-suite/snapshot-create.spec.ts b/e2e-playwright/dashboards-suite/snapshot-create.spec.ts index 0a37d134b2b..78c6a6a44c9 100644 --- a/e2e-playwright/dashboards-suite/snapshot-create.spec.ts +++ b/e2e-playwright/dashboards-suite/snapshot-create.spec.ts @@ -4,8 +4,8 @@ const DASHBOARD_UID = 'ZqZnVvFZz'; test.use({ featureToggles: { - newDashboardSharingComponent: false, // Use legacy sharing component for this test kubernetesDashboards: process.env.KUBERNETES_DASHBOARDS === 'true', + dashboardScene: false, // this test is for the old sharing modal only used when scenes is turned off }, }); @@ -29,7 +29,7 @@ test.describe( ]; // Open the sharing modal - await dashboardPage.getByGrafanaSelector(selectors.components.NavToolbar.shareDashboard).click(); + await dashboardPage.getByGrafanaSelector(selectors.pages.Dashboard.DashNav.shareButton).click(); // Select the snapshot tab await dashboardPage.getByGrafanaSelector(selectors.components.Tab.title('Snapshot')).click(); @@ -54,9 +54,6 @@ test.describe( const snapshotKey = getSnapshotKey(snapshotUrl); await page.goto(`/dashboard/snapshot/${snapshotKey}`); - // Validate the dashboard controls are rendered - await expect(dashboardPage.getByGrafanaSelector(selectors.pages.Dashboard.Controls)).toBeVisible(); - // Validate the panels are rendered for (const title of panelsToCheck) { await expect(dashboardPage.getByGrafanaSelector(selectors.components.Panels.Panel.title(title))).toBeVisible(); diff --git a/e2e/old-arch/dashboards-suite/dashboard-public-create.spec.ts b/e2e/old-arch/dashboards-suite/dashboard-public-create.spec.ts index 6fa08c988e5..78334eb38c9 100644 --- a/e2e/old-arch/dashboards-suite/dashboard-public-create.spec.ts +++ b/e2e/old-arch/dashboards-suite/dashboard-public-create.spec.ts @@ -3,6 +3,7 @@ import { e2e } from '../utils'; describe('Public dashboards', () => { beforeEach(() => { e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD')); + cy.setLocalStorage('grafana.featureToggles', 'dashboardScene=false'); // this test is for the old sharing modal only used when scenes is turned off }); it('Create a public dashboard', () => { diff --git a/e2e/old-arch/dashboards-suite/dashboard-public-templating.spec.ts b/e2e/old-arch/dashboards-suite/dashboard-public-templating.spec.ts index fa3a4a91242..cbdbf1ddde0 100644 --- a/e2e/old-arch/dashboards-suite/dashboard-public-templating.spec.ts +++ b/e2e/old-arch/dashboards-suite/dashboard-public-templating.spec.ts @@ -3,6 +3,7 @@ import { e2e } from '../utils'; describe('Create a public dashboard with template variables shows a template variable warning', () => { beforeEach(() => { e2e.flows.login(Cypress.env('USERNAME'), Cypress.env('PASSWORD')); + cy.setLocalStorage('grafana.featureToggles', 'dashboardScene=false'); // this test is for the old sharing modal only used when scenes is turned off }); it('Create a public dashboard with template variables shows a template variable warning', () => { diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 94bea16b78f..62adc2d4506 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -553,11 +553,6 @@ export interface FeatureToggles { */ logsExploreTableDefaultVisualization?: boolean; /** - * Enables the new sharing drawer design - * @default true - */ - newDashboardSharingComponent?: boolean; - /** * Enables the new alert list view design */ alertingListViewV2?: boolean; diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index 93e49fa5941..9709d530306 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -947,14 +947,6 @@ var ( Owner: grafanaObservabilityLogsSquad, FrontendOnly: true, }, - { - Name: "newDashboardSharingComponent", - Description: "Enables the new sharing drawer design", - Stage: FeatureStageGeneralAvailability, - Owner: grafanaSharingSquad, - FrontendOnly: true, - Expression: "true", // enabled by default - }, { Name: "alertingListViewV2", Description: "Enables the new alert list view design", diff --git a/pkg/services/featuremgmt/toggles_gen.csv b/pkg/services/featuremgmt/toggles_gen.csv index 3aa2d7c77fe..2b149bfa3cb 100644 --- a/pkg/services/featuremgmt/toggles_gen.csv +++ b/pkg/services/featuremgmt/toggles_gen.csv @@ -123,7 +123,6 @@ grafanaManagedRecordingRules,experimental,@grafana/alerting-squad,false,false,fa queryLibrary,privatePreview,@grafana/sharing-squad,false,false,false savedQueries,preview,@grafana/sharing-squad,false,false,false logsExploreTableDefaultVisualization,experimental,@grafana/observability-logs,false,false,true -newDashboardSharingComponent,GA,@grafana/sharing-squad,false,false,true alertingListViewV2,privatePreview,@grafana/alerting-squad,false,false,true alertingDisableSendAlertsExternal,experimental,@grafana/alerting-squad,false,false,false preserveDashboardStateWhenNavigating,experimental,@grafana/dashboards-squad,false,false,false diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 7c6a68a81b2..c0737e1f396 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -503,10 +503,6 @@ const ( // Sets the logs table as default visualisation in logs explore FlagLogsExploreTableDefaultVisualization = "logsExploreTableDefaultVisualization" - // FlagNewDashboardSharingComponent - // Enables the new sharing drawer design - FlagNewDashboardSharingComponent = "newDashboardSharingComponent" - // FlagAlertingListViewV2 // Enables the new alert list view design FlagAlertingListViewV2 = "alertingListViewV2" diff --git a/pkg/services/featuremgmt/toggles_gen.json b/pkg/services/featuremgmt/toggles_gen.json index 9fb57ddaeb0..83140e83a84 100644 --- a/pkg/services/featuremgmt/toggles_gen.json +++ b/pkg/services/featuremgmt/toggles_gen.json @@ -2410,7 +2410,8 @@ "metadata": { "name": "newDashboardSharingComponent", "resourceVersion": "1753448760331", - "creationTimestamp": "2024-05-03T15:02:18Z" + "creationTimestamp": "2024-05-03T15:02:18Z", + "deletionTimestamp": "2025-09-12T17:27:39Z" }, "spec": { "description": "Enables the new sharing drawer design", diff --git a/public/app/core/utils/navBarItem-translations.ts b/public/app/core/utils/navBarItem-translations.ts index 379e5dca64d..8d00c2049de 100644 --- a/public/app/core/utils/navBarItem-translations.ts +++ b/public/app/core/utils/navBarItem-translations.ts @@ -1,6 +1,4 @@ import { t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; - // Maps the ID of the nav item to a translated phrase to later pass to // Because the navigation content is dynamic (defined in the backend), we can not use // the normal inline message definition method. @@ -46,9 +44,7 @@ export function getNavTitle(navId: string | undefined) { case 'reports': return t('nav.reporting.title', 'Reporting'); case 'dashboards/public': - return config.featureToggles.newDashboardSharingComponent - ? t('nav.shared-dashboard.title', 'Shared dashboards') - : t('nav.public.title', 'Public dashboards'); + return t('nav.shared-dashboard.title', 'Shared dashboards'); case 'dashboards/recently-deleted': return t('nav.recently-deleted.title', 'Recently deleted'); case 'dashboards/new': @@ -218,9 +214,7 @@ export function getNavSubTitle(navId: string | undefined) { 'Interactive, publically available, point-in-time representations of dashboards and panels' ); case 'dashboards/public': - return config.featureToggles.newDashboardSharingComponent - ? t('nav.shared-dashboard.subtitle', "Manage your organization's externally shared dashboards") - : undefined; + t('nav.shared-dashboard.subtitle', "Manage your organization's externally shared dashboards"); case 'dashboards/library-panels': return t('nav.library-panels.subtitle', 'Reusable panels that can be added to multiple dashboards'); case 'dashboards/recently-deleted': diff --git a/public/app/features/admin/UserListPage.tsx b/public/app/features/admin/UserListPage.tsx index a2357b4aecf..fab60183deb 100644 --- a/public/app/features/admin/UserListPage.tsx +++ b/public/app/features/admin/UserListPage.tsx @@ -30,11 +30,7 @@ const selectors = e2eSelectors.pages.UserListPage; const PublicDashboardsTab = ({ view, setView }: { view: TabView | null; setView: (v: TabView | null) => void }) => { return ( setView(TabView.PUBLIC_DASHBOARDS)} data-testid={selectors.tabs.publicDashboardsUsers} diff --git a/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx b/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx index e10c3734775..af1eda1f2fd 100644 --- a/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx +++ b/public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx @@ -3,7 +3,6 @@ import { css, cx } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src'; import { Trans, t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { Button, LoadingPlaceholder, Modal, ModalsController, useStyles2 } from '@grafana/ui'; import { generatePublicDashboardConfigUrl, @@ -22,11 +21,7 @@ export const DashboardsListModal = ({ email, onDismiss }: { email: string; onDis {isLoading ? ( @@ -47,15 +42,7 @@ export const DashboardsListModal = ({ email, onDismiss }: { email: string; onDis href={generatePublicDashboardUrl(dash.publicDashboardAccessToken)} onClick={onDismiss} > - {config.featureToggles.newDashboardSharingComponent ? ( - - External link - - ) : ( - - Public dashboard URL - - )} + External link {'•'} - {config.featureToggles.newDashboardSharingComponent ? ( - - Sharing settings - - ) : ( - - Public dashboard settings - - )} + + Sharing settings +
diff --git a/public/app/features/admin/UserListPublicDashboardPage/DeleteUserModalButton.tsx b/public/app/features/admin/UserListPublicDashboardPage/DeleteUserModalButton.tsx index d55ac63e8b3..cea6cced8d6 100644 --- a/public/app/features/admin/UserListPublicDashboardPage/DeleteUserModalButton.tsx +++ b/public/app/features/admin/UserListPublicDashboardPage/DeleteUserModalButton.tsx @@ -2,7 +2,6 @@ import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; import { Trans, t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { Button, Modal, ModalsController, useStyles2 } from '@grafana/ui'; import { SessionUser } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils'; @@ -30,21 +29,12 @@ const DeleteUserModal = ({ user, hideModal }: { user: SessionUser; hideModal: ()

- {config.featureToggles.newDashboardSharingComponent ? ( - - This action will immediately revoke {{ email: user.email }}'s access to all shared dashboards. - - ) : ( - - This action will immediately revoke {{ email: user.email }}'s access to all public dashboards. - - )} + + This action will immediately revoke {{ email: user.email }}'s access to all shared dashboards. +

- ), - }); toolbarActions.push({ group: 'main-buttons', @@ -358,7 +337,7 @@ export function ToolbarActions({ dashboard }: Props) { } key="edit" className={styles.buttonWithExtraMargin} - variant={config.featureToggles.newDashboardSharingComponent ? 'secondary' : 'primary'} + variant={'secondary'} size="sm" data-testid={selectors.components.NavToolbar.editDashboard.editButton} disabled={isReadOnlyRepo} @@ -391,13 +370,13 @@ export function ToolbarActions({ dashboard }: Props) { toolbarActions.push({ group: 'new-share-dashboard-buttons', - condition: config.featureToggles.newDashboardSharingComponent && showShareButton, + condition: showShareButton, render: () => , }); toolbarActions.push({ group: 'new-share-dashboard-buttons', - condition: config.featureToggles.newDashboardSharingComponent && showShareButton, + condition: showShareButton, render: () => , }); diff --git a/public/app/features/dashboard-scene/scene/PanelMenuBehavior.test.tsx b/public/app/features/dashboard-scene/scene/PanelMenuBehavior.test.tsx index 02490e3d5c7..9b0fc321440 100644 --- a/public/app/features/dashboard-scene/scene/PanelMenuBehavior.test.tsx +++ b/public/app/features/dashboard-scene/scene/PanelMenuBehavior.test.tsx @@ -534,7 +534,7 @@ describe('panelMenuBehavior', () => { expect(menu.state.items?.find((i) => i.text === 'Remove')).toBeDefined(); const moreMenu = menu.state.items?.find((i) => i.text === 'More...')?.subMenu; expect(moreMenu?.find((i) => i.text === 'Duplicate')).toBeDefined(); - expect(moreMenu?.find((i) => i.text === 'Create library panel')).toBeDefined(); + expect(moreMenu?.find((i) => i.text === 'New library panel')).toBeDefined(); }); it('should only contain explore when embedded', async () => { diff --git a/public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx b/public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx index e665be6f773..b357e734bb7 100644 --- a/public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx +++ b/public/app/features/dashboard-scene/scene/PanelMenuBehavior.tsx @@ -35,7 +35,6 @@ import { ShowConfirmModalEvent } from 'app/types/events'; import { PanelInspectDrawer } from '../inspect/PanelInspectDrawer'; import { ShareDrawer } from '../sharing/ShareDrawer/ShareDrawer'; -import { ShareModal } from '../sharing/ShareModal'; import { isRepeatCloneOrChildOf } from '../utils/clone'; import { DashboardInteractions } from '../utils/interactions'; import { getEditPanelUrl, tryGetExploreUrlForPanel } from '../utils/urlBuilders'; @@ -109,90 +108,79 @@ export function panelMenuBehavior(menu: VizPanelMenu) { }); } - if (config.featureToggles.newDashboardSharingComponent) { - const subMenu: PanelMenuItem[] = []; + const subMenu: PanelMenuItem[] = []; + subMenu.push({ + text: t('share-panel.menu.share-link-title', 'Share link'), + iconClassName: 'link', + shortcut: 'p u', + onClick: () => { + DashboardInteractions.sharingCategoryClicked({ + item: shareDashboardType.link, + shareResource: getTrackingSource(panel?.getRef()), + }); + + const drawer = new ShareDrawer({ + shareView: shareDashboardType.link, + panelRef: panel.getRef(), + }); + + dashboard.showModal(drawer); + }, + }); + subMenu.push({ + text: t('share-panel.menu.share-embed-title', 'Share embed'), + iconClassName: 'arrow', + shortcut: 'p e', + onClick: () => { + DashboardInteractions.sharingCategoryClicked({ + item: shareDashboardType.embed, + shareResource: getTrackingSource(panel.getRef()), + }); + + const drawer = new ShareDrawer({ + shareView: shareDashboardType.embed, + panelRef: panel.getRef(), + }); + + dashboard.showModal(drawer); + }, + }); + + if ( + contextSrv.isSignedIn && + config.snapshotEnabled && + contextSrv.hasPermission(AccessControlAction.SnapshotsCreate) + ) { subMenu.push({ - text: t('share-panel.menu.share-link-title', 'Share link'), - iconClassName: 'link', - shortcut: 'p u', + text: t('share-panel.menu.share-snapshot-title', 'Share snapshot'), + iconClassName: 'camera', + shortcut: 'p s', onClick: () => { DashboardInteractions.sharingCategoryClicked({ - item: shareDashboardType.link, - shareResource: getTrackingSource(panel?.getRef()), - }); - - const drawer = new ShareDrawer({ - shareView: shareDashboardType.link, - panelRef: panel.getRef(), - }); - - dashboard.showModal(drawer); - }, - }); - subMenu.push({ - text: t('share-panel.menu.share-embed-title', 'Share embed'), - iconClassName: 'arrow', - shortcut: 'p e', - onClick: () => { - DashboardInteractions.sharingCategoryClicked({ - item: shareDashboardType.embed, + item: shareDashboardType.snapshot, shareResource: getTrackingSource(panel.getRef()), }); const drawer = new ShareDrawer({ - shareView: shareDashboardType.embed, + shareView: shareDashboardType.snapshot, panelRef: panel.getRef(), }); dashboard.showModal(drawer); }, }); - - if ( - contextSrv.isSignedIn && - config.snapshotEnabled && - contextSrv.hasPermission(AccessControlAction.SnapshotsCreate) - ) { - subMenu.push({ - text: t('share-panel.menu.share-snapshot-title', 'Share snapshot'), - iconClassName: 'camera', - shortcut: 'p s', - onClick: () => { - DashboardInteractions.sharingCategoryClicked({ - item: shareDashboardType.snapshot, - shareResource: getTrackingSource(panel.getRef()), - }); - - const drawer = new ShareDrawer({ - shareView: shareDashboardType.snapshot, - panelRef: panel.getRef(), - }); - - dashboard.showModal(drawer); - }, - }); - } - - items.push({ - type: 'submenu', - text: t('panel.header-menu.share', 'Share'), - iconClassName: 'share-alt', - subMenu, - onClick: (e) => { - e.preventDefault(); - }, - }); - } else { - items.push({ - text: t('panel.header-menu.share', 'Share'), - iconClassName: 'share-alt', - onClick: () => { - dashboard.showModal(new ShareModal({ panelRef: panel.getRef() })); - }, - shortcut: 'p s', - }); } + items.push({ + type: 'submenu', + text: t('panel.header-menu.share', 'Share'), + iconClassName: 'share-alt', + subMenu, + onClick: (e) => { + e.preventDefault(); + }, + }); + if (dashboard.state.isEditing && !isReadOnlyRepeat && !isEditingPanel) { moreSubMenu.push({ text: t('panel.header-menu.duplicate', `Duplicate`), @@ -236,32 +224,18 @@ export function panelMenuBehavior(menu: VizPanelMenu) { }, }); } else { - if (config.featureToggles.newDashboardSharingComponent) { - moreSubMenu.push({ - text: t('share-panel.menu.new-library-panel-title', 'New library panel'), - iconClassName: 'plus-square', - onClick: () => { - const drawer = new ShareDrawer({ - shareView: shareDashboardType.libraryPanel, - panelRef: panel.getRef(), - }); + moreSubMenu.push({ + text: t('share-panel.menu.new-library-panel-title', 'New library panel'), + iconClassName: 'plus-square', + onClick: () => { + const drawer = new ShareDrawer({ + shareView: shareDashboardType.libraryPanel, + panelRef: panel.getRef(), + }); - dashboard.showModal(drawer); - }, - }); - } else { - moreSubMenu.push({ - text: t('panel.header-menu.create-library-panel', `Create library panel`), - onClick: () => { - dashboard.showModal( - new ShareModal({ - panelRef: panel.getRef(), - activeTab: shareDashboardType.libraryPanel, - }) - ); - }, - }); - } + dashboard.showModal(drawer); + }, + }); } } diff --git a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts index 3284dd50e51..61c42b6ceeb 100644 --- a/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts +++ b/public/app/features/dashboard-scene/scene/keyboardShortcuts.ts @@ -10,7 +10,6 @@ import { AccessControlAction } from 'app/types/accessControl'; import { shareDashboardType } from '../../dashboard/components/ShareModal/utils'; import { PanelInspectDrawer } from '../inspect/PanelInspectDrawer'; import { ShareDrawer } from '../sharing/ShareDrawer/ShareDrawer'; -import { ShareModal } from '../sharing/ShareModal'; import { dashboardSceneGraph } from '../utils/dashboardSceneGraph'; import { findVizPanelByPathId } from '../utils/pathId'; import { getEditPanelUrl, tryGetExploreUrlForPanel } from '../utils/urlBuilders'; @@ -59,52 +58,43 @@ export function setupKeyboardShortcuts(scene: DashboardScene) { }); // Panel share - if (config.featureToggles.newDashboardSharingComponent) { - keybindings.addBinding({ - key: 'p u', - onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { - const drawer = new ShareDrawer({ - shareView: shareDashboardType.link, - panelRef: vizPanel.getRef(), - }); - - scene.showModal(drawer); - }), - }); - keybindings.addBinding({ - key: 'p e', - onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { - const drawer = new ShareDrawer({ - shareView: shareDashboardType.embed, - panelRef: vizPanel.getRef(), - }); - - scene.showModal(drawer); - }), - }); - - if ( - contextSrv.isSignedIn && - config.snapshotEnabled && - contextSrv.hasPermission(AccessControlAction.SnapshotsCreate) - ) { - keybindings.addBinding({ - key: 'p s', - onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { - const drawer = new ShareDrawer({ - shareView: shareDashboardType.snapshot, - panelRef: vizPanel.getRef(), - }); - - scene.showModal(drawer); - }), + keybindings.addBinding({ + key: 'p u', + onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { + const drawer = new ShareDrawer({ + shareView: shareDashboardType.link, + panelRef: vizPanel.getRef(), }); - } - } else { + + scene.showModal(drawer); + }), + }); + keybindings.addBinding({ + key: 'p e', + onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { + const drawer = new ShareDrawer({ + shareView: shareDashboardType.embed, + panelRef: vizPanel.getRef(), + }); + + scene.showModal(drawer); + }), + }); + + if ( + contextSrv.isSignedIn && + config.snapshotEnabled && + contextSrv.hasPermission(AccessControlAction.SnapshotsCreate) + ) { keybindings.addBinding({ key: 'p s', onTrigger: withFocusedPanel(scene, async (vizPanel: VizPanel) => { - scene.showModal(new ShareModal({ panelRef: vizPanel.getRef() })); + const drawer = new ShareDrawer({ + shareView: shareDashboardType.snapshot, + panelRef: vizPanel.getRef(), + }); + + scene.showModal(drawer); }), }); } diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareExternally.test.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareExternally.test.tsx index b3c7a22a257..fe13caefd84 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareExternally.test.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareExternally.test.tsx @@ -4,7 +4,7 @@ import { render } from 'test/test-utils'; import { getDefaultTimeRange, LoadingState } from '@grafana/data'; import { getPanelPlugin } from '@grafana/data/test'; import { selectors as e2eSelectors } from '@grafana/e2e-selectors'; -import { config, setPluginImportUtils } from '@grafana/runtime'; +import { setPluginImportUtils } from '@grafana/runtime'; import { CustomVariable, SceneQueryRunner, @@ -31,7 +31,6 @@ setPluginImportUtils({ }); beforeEach(() => { - config.featureToggles.newDashboardSharingComponent = true; jest.spyOn(contextSrv, 'hasPermission').mockReturnValue(true); jest.spyOn(contextSrv, 'hasRole').mockReturnValue(true); }); diff --git a/public/app/features/dashboard-scene/sharing/ShareLibraryPanelTab.tsx b/public/app/features/dashboard-scene/sharing/ShareLibraryPanelTab.tsx index 1aabdae94ae..53a0a9dc222 100644 --- a/public/app/features/dashboard-scene/sharing/ShareLibraryPanelTab.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareLibraryPanelTab.tsx @@ -1,5 +1,4 @@ import { t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { SceneComponentProps, SceneObjectBase, SceneObjectRef, VizPanel } from '@grafana/scenes'; import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen'; import { ShareLibraryPanel } from 'app/features/dashboard/components/ShareModal/ShareLibraryPanel'; @@ -22,9 +21,7 @@ export class ShareLibraryPanelTab extends SceneObjectBase; - tabs?: SceneShareTab[]; - activeTab: string; -} - -type customDashboardTabType = new (...args: SceneShareTabState[]) => SceneShareTab; -const customDashboardTabs: customDashboardTabType[] = []; - -export function addDashboardShareTab(tab: customDashboardTabType) { - customDashboardTabs.push(tab); -} - -/** - * Used for full dashboard share modal and the panel level share modal - */ -export class ShareModal extends SceneObjectBase implements ModalSceneObjectLike { - static Component = SharePanelModalRenderer; - - constructor(state: Omit & { activeTab?: string }) { - super({ - activeTab: 'link', - ...state, - }); - - this.addActivationHandler(() => this.buildTabs(state.activeTab)); - } - - private buildTabs(activeTab?: string) { - const { panelRef } = this.state; - const modalRef = this.getRef(); - - const tabs: SceneShareTab[] = [new ShareLinkTab({ panelRef, modalRef })]; - const dashboard = getDashboardSceneFor(this); - - if (!panelRef) { - tabs.push(new ShareExportTab({ modalRef })); - } - - if ( - contextSrv.isSignedIn && - config.snapshotEnabled && - contextSrv.hasPermission(AccessControlAction.SnapshotsCreate) - ) { - tabs.push(new ShareSnapshotTab({ panelRef, dashboardRef: dashboard.getRef(), modalRef })); - } - - if (panelRef) { - tabs.push(new SharePanelEmbedTab({ panelRef })); - const panel = panelRef.resolve(); - if (panel instanceof VizPanel) { - if (!isLibraryPanel(panel)) { - tabs.push(new ShareLibraryPanelTab({ panelRef, modalRef })); - } - } - } - - if (!panelRef) { - tabs.push(...customDashboardTabs.map((Tab) => new Tab({ modalRef }))); - - if (isPublicDashboardsEnabled()) { - tabs.push(new SharePublicDashboardTab({ modalRef })); - } - } - - const at = tabs.find((t) => t.tabId === activeTab); - - this.setState({ activeTab: at?.tabId ?? tabs[0].tabId, tabs }); - } - - onDismiss = () => { - if (this.state.panelRef) { - const dashboard = getDashboardSceneFor(this); - dashboard.closeModal(); - } else { - locationService.partial({ shareView: null }); - } - }; - - onChangeTab: ComponentProps['onChangeTab'] = (tab) => { - DashboardInteractions.sharingCategoryClicked({ - item: tab.value, - shareResource: getTrackingSource(this.state.panelRef), - }); - this.setState({ activeTab: tab.value }); - }; -} - -function SharePanelModalRenderer({ model }: SceneComponentProps) { - const { panelRef, tabs, activeTab } = model.useState(); - const title = panelRef ? t('share-modal.panel.title', 'Share Panel') : t('share-modal.dashboard.title', 'Share'); - - if (!tabs) { - return; - } - - const modalTabs = tabs?.map((tab) => ({ - label: tab.getTabLabel(), - value: tab.tabId, - })); - - const header = ( - - ); - - const currentTab = tabs.find((t) => t.tabId === activeTab); - - return ( - - {currentTab && } - - ); -} diff --git a/public/app/features/dashboard-scene/sharing/SharePanelEmbedTab.tsx b/public/app/features/dashboard-scene/sharing/SharePanelEmbedTab.tsx index 5d37b375dbe..7652a2c6f17 100644 --- a/public/app/features/dashboard-scene/sharing/SharePanelEmbedTab.tsx +++ b/public/app/features/dashboard-scene/sharing/SharePanelEmbedTab.tsx @@ -1,6 +1,5 @@ import { TimeRange } from '@grafana/data'; import { t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { SceneComponentProps, sceneGraph, SceneObjectBase, SceneObjectRef, VizPanel } from '@grafana/scenes'; import { ShareEmbed } from 'app/features/dashboard/components/ShareModal/ShareEmbed'; import { buildParams, shareDashboardType } from 'app/features/dashboard/components/ShareModal/utils'; @@ -25,9 +24,7 @@ export class SharePanelEmbedTab extends SceneObjectBase } public getTabLabel() { - return config.featureToggles.newDashboardSharingComponent - ? t('share-panel.drawer.share-embed-title', 'Share embed') - : t('share-modal.tab-title.panel-embed', 'Embed'); + return t('share-panel.drawer.share-embed-title', 'Share embed'); } } diff --git a/public/app/features/dashboard-scene/sharing/public-dashboards/ConfigPublicDashboard.tsx b/public/app/features/dashboard-scene/sharing/public-dashboards/ConfigPublicDashboard.tsx deleted file mode 100644 index 99f55253598..00000000000 --- a/public/app/features/dashboard-scene/sharing/public-dashboards/ConfigPublicDashboard.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { css } from '@emotion/css'; - -import { GrafanaTheme2 } from '@grafana/data'; -import { Trans, t } from '@grafana/i18n'; -import { SceneComponentProps, sceneGraph } from '@grafana/scenes'; -import { useStyles2 } from '@grafana/ui'; -import { contextSrv } from 'app/core/core'; -import { useDeletePublicDashboardMutation } from 'app/features/dashboard/api/publicDashboardApi'; -import { ConfigPublicDashboardBase } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/ConfigPublicDashboard/ConfigPublicDashboard'; -import { PublicDashboard } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils'; -import { AccessControlAction } from 'app/types/accessControl'; - -import { shareDashboardType } from '../../../dashboard/components/ShareModal/utils'; -import { getDashboardSceneFor } from '../../utils/utils'; -import { ShareModal } from '../ShareModal'; - -import { ConfirmModal } from './ConfirmModal'; -import { SharePublicDashboardTab } from './SharePublicDashboardTab'; -import { useUnsupportedDatasources } from './hooks'; - -interface Props extends SceneComponentProps { - publicDashboard?: PublicDashboard; - isGetLoading?: boolean; -} - -export function ConfigPublicDashboard({ model, publicDashboard, isGetLoading }: Props) { - const styles = useStyles2(getStyles); - - const hasWritePermissions = contextSrv.hasPermission(AccessControlAction.DashboardsPublicWrite); - - const dashboard = getDashboardSceneFor(model); - const { isDirty } = dashboard.useState(); - const [deletePublicDashboard] = useDeletePublicDashboardMutation(); - const hasTemplateVariables = (dashboard.state.$variables?.state.variables.length ?? 0) > 0; - const unsupportedDataSources = useUnsupportedDatasources(dashboard); - const timeRangeState = sceneGraph.getTimeRange(model); - const timeRange = timeRangeState.useState(); - - return ( - { - dashboard.showModal( - new ConfirmModal({ - isOpen: true, - title: t('dashboard-scene.config-public-dashboard.title.revoke-public-url', 'Revoke public URL'), - icon: 'trash-alt', - confirmText: t( - 'dashboard-scene.config-public-dashboard.confirmText.revoke-public-url', - 'Revoke public URL' - ), - body: ( -

- - Are you sure you want to revoke this URL? The dashboard will no longer be public. - -

- ), - onDismiss: () => { - dashboard.showModal(new ShareModal({ activeTab: shareDashboardType.publicDashboard })); - }, - onConfirm: () => { - deletePublicDashboard({ dashboard, dashboardUid: dashboard.state.uid!, uid: publicDashboard!.uid }); - dashboard.closeModal(); - }, - }) - ); - }} - timeRange={timeRange.value} - showSaveChangesAlert={hasWritePermissions && isDirty} - hasTemplateVariables={hasTemplateVariables} - /> - ); -} - -const getStyles = (theme: GrafanaTheme2) => ({ - description: css({ - fontSize: theme.typography.body.fontSize, - }), -}); diff --git a/public/app/features/dashboard-scene/sharing/public-dashboards/CreatePublicDashboard.tsx b/public/app/features/dashboard-scene/sharing/public-dashboards/CreatePublicDashboard.tsx deleted file mode 100644 index ec733e57d00..00000000000 --- a/public/app/features/dashboard-scene/sharing/public-dashboards/CreatePublicDashboard.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { SceneComponentProps } from '@grafana/scenes'; -import { CreatePublicDashboardBase } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/CreatePublicDashboard/CreatePublicDashboard'; - -import { getDashboardSceneFor } from '../../utils/utils'; - -import { SharePublicDashboardTab } from './SharePublicDashboardTab'; -import { useUnsupportedDatasources } from './hooks'; - -export function CreatePublicDashboard({ model }: SceneComponentProps) { - const dashboard = getDashboardSceneFor(model); - const unsupportedDataSources = useUnsupportedDatasources(dashboard); - const hasTemplateVariables = (dashboard.state.$variables?.state.variables.length ?? 0) > 0; - - return ( - - ); -} diff --git a/public/app/features/dashboard-scene/sharing/public-dashboards/SharePublicDashboardTab.tsx b/public/app/features/dashboard-scene/sharing/public-dashboards/SharePublicDashboardTab.tsx deleted file mode 100644 index 731e47c63d0..00000000000 --- a/public/app/features/dashboard-scene/sharing/public-dashboards/SharePublicDashboardTab.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { t } from '@grafana/i18n'; -import { SceneComponentProps, SceneObjectBase } from '@grafana/scenes'; -import { useGetPublicDashboardQuery } from 'app/features/dashboard/api/publicDashboardApi'; -import { Loader } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboard'; -import { publicDashboardPersisted } from 'app/features/dashboard/components/ShareModal/SharePublicDashboard/SharePublicDashboardUtils'; -import { shareDashboardType } from 'app/features/dashboard/components/ShareModal/utils'; - -import { getDashboardSceneFor } from '../../utils/utils'; -import { SceneShareTabState } from '../types'; - -import { ConfigPublicDashboard } from './ConfigPublicDashboard'; -import { CreatePublicDashboard } from './CreatePublicDashboard'; - -export class SharePublicDashboardTab extends SceneObjectBase { - public tabId = shareDashboardType.publicDashboard; - static Component = SharePublicDashboardTabRenderer; - - public getTabLabel() { - return t('share-modal.tab-title.public-dashboard', 'Public Dashboard'); - } -} - -function SharePublicDashboardTabRenderer({ model }: SceneComponentProps) { - const { data: publicDashboard, isLoading: isGetLoading } = useGetPublicDashboardQuery( - getDashboardSceneFor(model).state.uid! - ); - - return ( - <> - {isGetLoading ? ( - - ) : !publicDashboardPersisted(publicDashboard) ? ( - - ) : ( - - )} - - ); -} diff --git a/public/app/features/dashboard/api/publicDashboardApi.ts b/public/app/features/dashboard/api/publicDashboardApi.ts index 99fa565a453..507a8ee1d9d 100644 --- a/public/app/features/dashboard/api/publicDashboardApi.ts +++ b/public/app/features/dashboard/api/publicDashboardApi.ts @@ -64,13 +64,10 @@ export const publicDashboardApi = createApi({ }, async onQueryStarted({ dashboard, payload: { share } }, { dispatch, queryFulfilled }) { const { data } = await queryFulfilled; - let message = t('public-dashboard.sharing.success-creation', 'Dashboard is public!'); - if (config.featureToggles.newDashboardSharingComponent) { - message = - share === PublicDashboardShareType.PUBLIC - ? t('public-dashboard.public-sharing.success-creation', 'Your dashboard is now publicly accessible') - : t('public-dashboard.email-sharing.success-creation', 'Your dashboard is ready for external sharing'); - } + const message = + share === PublicDashboardShareType.PUBLIC + ? t('public-dashboard.public-sharing.success-creation', 'Your dashboard is now publicly accessible') + : t('public-dashboard.email-sharing.success-creation', 'Your dashboard is ready for external sharing'); dispatch(notifyApp(createSuccessNotification(message))); if (dashboard instanceof DashboardScene) { @@ -107,9 +104,7 @@ export const publicDashboardApi = createApi({ dispatch( notifyApp( createSuccessNotification( - config.featureToggles.newDashboardSharingComponent - ? t('public-dashboard.configuration.success-update', 'Settings have been successfully updated') - : t('public-dashboard.configuration.success-update-old', 'Public dashboard updated!') + t('public-dashboard.configuration.success-update', 'Settings have been successfully updated') ) ) ); @@ -136,12 +131,9 @@ export const publicDashboardApi = createApi({ }, async onQueryStarted({ dashboard, payload: { isEnabled } }, { dispatch, queryFulfilled }) { const { data } = await queryFulfilled; - let message = t('public-dashboard.configuration.success-update-old', 'Public dashboard updated!'); - if (config.featureToggles.newDashboardSharingComponent) { - message = isEnabled - ? t('public-dashboard.configuration.success-resume', 'Your dashboard access has been resumed') - : t('public-dashboard.configuration.success-pause', 'Your dashboard access has been paused'); - } + const message = isEnabled + ? t('public-dashboard.configuration.success-resume', 'Your dashboard access has been resumed') + : t('public-dashboard.configuration.success-pause', 'Your dashboard access has been paused'); dispatch(notifyApp(createSuccessNotification(message))); if (dashboard instanceof DashboardScene) { @@ -176,20 +168,16 @@ export const publicDashboardApi = createApi({ }, async onQueryStarted({ dashboard, payload: { share } }, { dispatch, queryFulfilled }) { await queryFulfilled; - let message = t('public-dashboard.configuration.success-update-old', 'Public dashboard updated!'); - - if (config.featureToggles.newDashboardSharingComponent) { - message = - share === PublicDashboardShareType.PUBLIC - ? t( - 'public-dashboard.public-sharing.success-share-type-change', - 'Dashboard access updated: Anyone with the link can now access' - ) - : t( - 'public-dashboard.email-sharing.success-share-type-change', - 'Dashboard access updated: Only specific people can now access with the link' - ); - } + const message = + share === PublicDashboardShareType.PUBLIC + ? t( + 'public-dashboard.public-sharing.success-share-type-change', + 'Dashboard access updated: Anyone with the link can now access' + ) + : t( + 'public-dashboard.email-sharing.success-share-type-change', + 'Dashboard access updated: Only specific people can now access with the link' + ); dispatch(notifyApp(createSuccessNotification(message))); }, invalidatesTags: (result, error, { payload }) => [ @@ -250,9 +238,7 @@ export const publicDashboardApi = createApi({ dispatch( notifyApp( createSuccessNotification( - config.featureToggles.newDashboardSharingComponent - ? t('public-dashboard.share.success-delete', 'Your dashboard is no longer shareable') - : t('public-dashboard.share.success-delete-old', 'Public dashboard deleted!') + t('public-dashboard.share.success-delete', 'Your dashboard is no longer shareable') ) ) ); diff --git a/public/app/features/dashboard/components/ShareModal/ShareEmbed.tsx b/public/app/features/dashboard/components/ShareModal/ShareEmbed.tsx index 2bc55485818..074dfb228fb 100644 --- a/public/app/features/dashboard/components/ShareModal/ShareEmbed.tsx +++ b/public/app/features/dashboard/components/ShareModal/ShareEmbed.tsx @@ -2,8 +2,7 @@ import { FormEvent, useEffect, useState } from 'react'; import { RawTimeRange, TimeRange } from '@grafana/data'; import { Trans, t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; -import { Button, ClipboardButton, Field, Label, Modal, Stack, Switch, TextArea } from '@grafana/ui'; +import { Button, ClipboardButton, Field, Label, Stack, Switch, TextArea } from '@grafana/ui'; import { DashboardInteractions } from 'app/features/dashboard-scene/utils/interactions'; import { ThemePicker } from './ThemePicker'; @@ -104,16 +103,12 @@ export function ShareEmbed({ onChange={onIframeHtmlChange} /> - {config.featureToggles.newDashboardSharingComponent ? ( - - {clipboardButton} - - - ) : ( - {clipboardButton} - )} + + {clipboardButton} + + ); } diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/NoUpsertPermissionsAlert.tsx b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/NoUpsertPermissionsAlert.tsx index bc74ea00aa9..a480fdd918f 100644 --- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/NoUpsertPermissionsAlert.tsx +++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/NoUpsertPermissionsAlert.tsx @@ -1,34 +1,21 @@ import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src'; import { Trans, t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { Alert } from '@grafana/ui'; const selectors = e2eSelectors.pages.ShareDashboardModal.PublicDashboard; export const NoUpsertPermissionsAlert = ({ mode }: { mode: 'create' | 'edit' }) => { - const title = config.featureToggles.newDashboardSharingComponent - ? t( - 'public-dashboard.share-externally.no-upsert-perm-alert-title', - 'You don’t have permission to {{ action }} a shared dashboard', - { action: mode } - ) - : t( - 'public-dashboard.modal-alerts.no-upsert-perm-alert-title', - 'You don’t have permission to {{ action }} a public dashboard', - { action: mode } - ); + const title = t( + 'public-dashboard.share-externally.no-upsert-perm-alert-title', + 'You don’t have permission to {{ action }} a shared dashboard', + { action: mode } + ); return ( - {config.featureToggles.newDashboardSharingComponent ? ( - - Contact your admin to get permission to {{ action: mode }} shared dashboards - - ) : ( - - Contact your admin to get permission to {{ action: mode }} public dashboards - - )} + + Contact your admin to get permission to {{ action: mode }} shared dashboards + ); }; diff --git a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/UnsupportedDataSourcesAlert.tsx b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/UnsupportedDataSourcesAlert.tsx index dbc2c8c1665..cc000e869ab 100644 --- a/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/UnsupportedDataSourcesAlert.tsx +++ b/public/app/features/dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/UnsupportedDataSourcesAlert.tsx @@ -4,7 +4,6 @@ import cx from 'classnames'; import { GrafanaTheme2 } from '@grafana/data'; import { selectors as e2eSelectors } from '@grafana/e2e-selectors/src'; import { Trans, t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { Alert, useStyles2 } from '@grafana/ui'; const selectors = e2eSelectors.pages.ShareDashboardModal.PublicDashboard; @@ -20,23 +19,14 @@ export const UnsupportedDataSourcesAlert = ({ unsupportedDataSources }: { unsupp bottomSpacing={0} >

- {config.featureToggles.newDashboardSharingComponent ? ( - - There are data sources in this dashboard that are unsupported for shared dashboards. Panels that use these - data sources may not function properly: {{ unsupportedDataSources }}. - - ) : ( - - There are data sources in this dashboard that are unsupported for public dashboards. Panels that use these - data sources may not function properly: {{ unsupportedDataSources }}. - - )} + + There are data sources in this dashboard that are unsupported for shared dashboards. Panels that use these + data sources may not function properly: {{ unsupportedDataSources }}. +

{ private dashboard: DashboardModel; private expireOptions: Array>; @@ -280,7 +283,12 @@ export class ShareSnapshot extends PureComponent { {sharingButtonText} )} -
@@ -297,9 +305,15 @@ export class ShareSnapshot extends PureComponent { + Copy } diff --git a/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx b/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx index f6a39a2dad9..753b01e8e15 100644 --- a/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx +++ b/public/app/features/library-panels/components/AddLibraryPanelModal/AddLibraryPanelModal.tsx @@ -2,7 +2,7 @@ import { useCallback, useEffect, useState } from 'react'; import { useAsync, useDebounce } from 'react-use'; import { Trans, t } from '@grafana/i18n'; -import { config, FetchError, isFetchError } from '@grafana/runtime'; +import { FetchError, isFetchError } from '@grafana/runtime'; import { LibraryPanel } from '@grafana/schema/dist/esm/index.gen'; import { Button, Field, Input, Modal, Stack } from '@grafana/ui'; import { FolderPicker } from 'app/core/components/Select/FolderPicker'; @@ -86,25 +86,14 @@ export const AddLibraryPanelContents = ({ > setFolderUid(uid)} value={folderUid} /> - {config.featureToggles.newDashboardSharingComponent ? ( - - - - - ) : ( - - - - - )} + + + + ); }; diff --git a/public/app/features/manage-dashboards/components/PublicDashboardListTable/DeletePublicDashboardButton.tsx b/public/app/features/manage-dashboards/components/PublicDashboardListTable/DeletePublicDashboardButton.tsx index 67d8070ce26..b35bcce3afc 100644 --- a/public/app/features/manage-dashboards/components/PublicDashboardListTable/DeletePublicDashboardButton.tsx +++ b/public/app/features/manage-dashboards/components/PublicDashboardListTable/DeletePublicDashboardButton.tsx @@ -1,7 +1,6 @@ import * as React from 'react'; import { t } from '@grafana/i18n'; -import { config } from '@grafana/runtime'; import { Button, ModalsController, ButtonProps } from '@grafana/ui'; import { useDeletePublicDashboardMutation } from 'app/features/dashboard/api/publicDashboardApi'; import { DashboardModel } from 'app/features/dashboard/state/DashboardModel'; @@ -42,9 +41,7 @@ export const DeletePublicDashboardButton = ({ return ( {({ showModal, hideModal }) => { - const translatedRevocationButtonText = config.featureToggles.newDashboardSharingComponent - ? t('shared-dashboard-list.button.revoke-button-text', 'Revoke access') - : t('public-dashboard-list.button.revoke-button-text', 'Revoke public URL'); + const translatedRevocationButtonText = t('shared-dashboard-list.button.revoke-button-text', 'Revoke access'); return (