From 8b2091ee4fc35e394afd0db4de951ae82b8fd05f Mon Sep 17 00:00:00 2001 From: Juan Cabanas Date: Fri, 6 Sep 2024 09:37:00 -0300 Subject: [PATCH] ShareDrawer: Improvements (#92956) --- .../sharing/ExportButton/ExportAsJson.tsx | 2 +- .../EmailShare/CreateEmailSharing.tsx | 4 +-- .../share-externally/ShareAlerts.test.tsx | 2 +- .../share-externally/ShareAlerts.tsx | 2 ++ .../share-externally/ShareConfiguration.tsx | 2 +- .../share-externally/ShareTypeSelect.tsx | 4 +-- .../share-internally/ShareInternally.tsx | 28 ++++++++++--------- .../sharing/ShareDrawer/ShareDrawer.tsx | 2 +- .../ShareDrawer/ShareDrawerContext.tsx | 1 + .../dashboard/api/publicDashboardApi.ts | 2 +- public/locales/en-US/grafana.json | 8 +++--- public/locales/pseudo-LOCALE/grafana.json | 8 +++--- 12 files changed, 35 insertions(+), 30 deletions(-) diff --git a/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx b/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx index 42fd0ef7a51..0130441e843 100644 --- a/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx +++ b/public/app/features/dashboard-scene/sharing/ExportButton/ExportAsJson.tsx @@ -19,7 +19,7 @@ export class ExportAsJson extends ShareExportTab { static Component = ExportAsJsonRenderer; public getTabLabel(): string { - return t('export.json.title', 'Save dashboard JSON'); + return t('export.json.title', 'Export dashboard JSON'); } } diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/EmailShare/CreateEmailSharing.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/EmailShare/CreateEmailSharing.tsx index bdece958b30..cf2761f8a40 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/EmailShare/CreateEmailSharing.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/EmailShare/CreateEmailSharing.tsx @@ -15,7 +15,7 @@ import { EmailSharingPricingAlert } from '../../../../../dashboard/components/Sh import { useShareDrawerContext } from '../../../ShareDrawer/ShareDrawerContext'; export const CreateEmailSharing = ({ hasError }: { hasError: boolean }) => { - const { dashboard } = useShareDrawerContext(); + const { dashboard, onDismiss } = useShareDrawerContext(); const styles = useStyles2(getStyles); const [createPublicDashboard, { isLoading, isError }] = useCreatePublicDashboardMutation(); @@ -49,7 +49,7 @@ export const CreateEmailSharing = ({ hasError }: { hasError: boolean }) => { - {isLoading && } diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.test.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.test.tsx index 39399c1d8c5..205bf6bc12c 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.test.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.test.tsx @@ -108,7 +108,7 @@ async function setup(panelState?: Partial, dashboardState?: Parti await act(async () => render( - + {} }}> ) diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.tsx index e81d6159dae..9e74065d62e 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareAlerts.tsx @@ -10,6 +10,7 @@ import { import { AccessControlAction } from 'app/types'; import { NoUpsertPermissionsAlert } from '../../../../dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/NoUpsertPermissionsAlert'; +import { PublicDashboardAlert } from '../../../../dashboard/components/ShareModal/SharePublicDashboard/ModalAlerts/PublicDashboardAlert'; import { useShareDrawerContext } from '../../ShareDrawer/ShareDrawerContext'; import { useUnsupportedDatasources } from '../../public-dashboards/hooks'; @@ -29,6 +30,7 @@ export default function ShareAlerts({ publicDashboard }: { publicDashboard?: Pub {publicDashboard?.share === PublicDashboardShareType.EMAIL && isEmailSharingEnabled() && ( )} + {publicDashboard?.share === PublicDashboardShareType.PUBLIC && } ); } diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareConfiguration.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareConfiguration.tsx index 405389d802f..f27a9d2e84b 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareConfiguration.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareConfiguration.tsx @@ -113,7 +113,7 @@ export default function ShareConfiguration() { style={{ flex: 1 }} description={t( 'public-dashboard.configuration.display-annotations-description', - 'Present annotations on this Dashboard' + 'Present annotations on this dashboard' )} > Display annotations diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareTypeSelect.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareTypeSelect.tsx index 6ad6e11776e..395ea3cf380 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareTypeSelect.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-externally/ShareTypeSelect.tsx @@ -82,10 +82,10 @@ export default function ShareTypeSelect({ className={styles.select} /> ) : ( - <> + {toIconName(anyOneWithTheLinkOpt.icon) && } {anyOneWithTheLinkOpt.label} - + )} ); diff --git a/public/app/features/dashboard-scene/sharing/ShareButton/share-internally/ShareInternally.tsx b/public/app/features/dashboard-scene/sharing/ShareButton/share-internally/ShareInternally.tsx index fb29868b59e..76a9111d645 100644 --- a/public/app/features/dashboard-scene/sharing/ShareButton/share-internally/ShareInternally.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareButton/share-internally/ShareInternally.tsx @@ -2,7 +2,7 @@ import { css } from '@emotion/css'; import { GrafanaTheme2 } from '@grafana/data'; import { SceneComponentProps } from '@grafana/scenes'; -import { Alert, ClipboardButton, Divider, Text, useStyles2 } from '@grafana/ui'; +import { Alert, ClipboardButton, Divider, Stack, Text, useStyles2 } from '@grafana/ui'; import { t, Trans } from 'app/core/internationalization'; import ShareInternallyConfiguration from '../../ShareInternallyConfiguration'; @@ -66,7 +66,7 @@ function ShareInternallyRenderer({ model }: SceneComponentProps return ( <> - + Updating your settings will modify the default copy link to include these changes. Please note that these settings are saved within your current browser scope. @@ -90,17 +90,19 @@ function ShareInternallyRenderer({ model }: SceneComponentProps isLoading={isBuildUrlLoading} /> - - Copy link - + + + Copy link + + ); } diff --git a/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.tsx b/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.tsx index e06e31549a4..5e3753ca32c 100644 --- a/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawer.tsx @@ -64,7 +64,7 @@ function ShareDrawerRenderer({ model }: SceneComponentProps) { return ( - + {} diff --git a/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawerContext.tsx b/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawerContext.tsx index 213f2c2f964..1c9ab287cf3 100644 --- a/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawerContext.tsx +++ b/public/app/features/dashboard-scene/sharing/ShareDrawer/ShareDrawerContext.tsx @@ -4,6 +4,7 @@ import { DashboardScene } from '../../scene/DashboardScene'; interface Context { dashboard: DashboardScene; + onDismiss: () => void; } export const ShareDrawerContext = createContext(undefined); diff --git a/public/app/features/dashboard/api/publicDashboardApi.ts b/public/app/features/dashboard/api/publicDashboardApi.ts index 5ff1aff23f2..3a94b0670c4 100644 --- a/public/app/features/dashboard/api/publicDashboardApi.ts +++ b/public/app/features/dashboard/api/publicDashboardApi.ts @@ -209,7 +209,7 @@ export const publicDashboardApi = createApi({ ) : t( 'public-dashboard.email-sharing.success-share-type-change', - 'Dashboard access restricted: Only specific people can now access with the link' + 'Dashboard access updated: Only specific people can now access with the link' ); } dispatch(notifyApp(createSuccessNotification(message))); diff --git a/public/locales/en-US/grafana.json b/public/locales/en-US/grafana.json index ad59517f703..8d5f32cff7d 100644 --- a/public/locales/en-US/grafana.json +++ b/public/locales/en-US/grafana.json @@ -912,7 +912,7 @@ "download-successful_toast_message": "Your JSON has been downloaded", "export-externally-label": "Export the dashboard to use in another instance", "info-text": "Copy or download a JSON file containing the JSON of your dashboard", - "title": "Save dashboard JSON" + "title": "Export dashboard JSON" }, "menu": { "export-as-json-label": "Export", @@ -1187,7 +1187,7 @@ "link": { "share": { "config-alert-description": "Updating your settings will modify the default copy link to include these changes. Please note that these settings are saved within your current browser scope.", - "config-alert-title": "Link configuration", + "config-alert-title": "Link settings", "config-description": "Create a personalized, direct link to share your dashboard within your organization, with the following customization settings:", "copy-link-button": "Copy link", "copy-to-clipboard": "Link copied to clipboard", @@ -1930,7 +1930,7 @@ "settings-title": "Settings" }, "configuration": { - "display-annotations-description": "Present annotations on this Dashboard", + "display-annotations-description": "Present annotations on this dashboard", "display-annotations-label": "Display annotations", "enable-time-range-description": "Allow people to change time range", "enable-time-range-label": "Enable time range", @@ -1976,7 +1976,7 @@ "revoke-button": "Revoke", "revoke-button-title": "Revoke", "success-creation": "Your dashboard is ready for external sharing", - "success-share-type-change": "Dashboard access restricted: Only specific people can now access with the link" + "success-share-type-change": "Dashboard access updated: Only specific people can now access with the link" }, "modal-alerts": { "no-upsert-perm-alert-desc": "Contact your admin to get permission to {{mode}} public dashboards", diff --git a/public/locales/pseudo-LOCALE/grafana.json b/public/locales/pseudo-LOCALE/grafana.json index 7edc131b2ce..77e98815d57 100644 --- a/public/locales/pseudo-LOCALE/grafana.json +++ b/public/locales/pseudo-LOCALE/grafana.json @@ -912,7 +912,7 @@ "download-successful_toast_message": "Ÿőūř ĴŜØŃ ĥäş þęęʼn đőŵʼnľőäđęđ", "export-externally-label": "Ēχpőřŧ ŧĥę đäşĥþőäřđ ŧő ūşę įʼn äʼnőŧĥęř įʼnşŧäʼnčę", "info-text": "Cőpy őř đőŵʼnľőäđ ä ĴŜØŃ ƒįľę čőʼnŧäįʼnįʼnģ ŧĥę ĴŜØŃ őƒ yőūř đäşĥþőäřđ", - "title": "Ŝävę đäşĥþőäřđ ĴŜØŃ" + "title": "Ēχpőřŧ đäşĥþőäřđ ĴŜØŃ" }, "menu": { "export-as-json-label": "Ēχpőřŧ", @@ -1187,7 +1187,7 @@ "link": { "share": { "config-alert-description": "Ůpđäŧįʼnģ yőūř şęŧŧįʼnģş ŵįľľ mőđįƒy ŧĥę đęƒäūľŧ čőpy ľįʼnĸ ŧő įʼnčľūđę ŧĥęşę čĥäʼnģęş. Pľęäşę ʼnőŧę ŧĥäŧ ŧĥęşę şęŧŧįʼnģş äřę şävęđ ŵįŧĥįʼn yőūř čūřřęʼnŧ þřőŵşęř şčőpę.", - "config-alert-title": "Ŀįʼnĸ čőʼnƒįģūřäŧįőʼn", + "config-alert-title": "Ŀįʼnĸ şęŧŧįʼnģş", "config-description": "Cřęäŧę ä pęřşőʼnäľįžęđ, đįřęčŧ ľįʼnĸ ŧő şĥäřę yőūř đäşĥþőäřđ ŵįŧĥįʼn yőūř őřģäʼnįžäŧįőʼn, ŵįŧĥ ŧĥę ƒőľľőŵįʼnģ čūşŧőmįžäŧįőʼn şęŧŧįʼnģş:", "copy-link-button": "Cőpy ľįʼnĸ", "copy-to-clipboard": "Ŀįʼnĸ čőpįęđ ŧő čľįpþőäřđ", @@ -1930,7 +1930,7 @@ "settings-title": "Ŝęŧŧįʼnģş" }, "configuration": { - "display-annotations-description": "Přęşęʼnŧ äʼnʼnőŧäŧįőʼnş őʼn ŧĥįş Đäşĥþőäřđ", + "display-annotations-description": "Přęşęʼnŧ äʼnʼnőŧäŧįőʼnş őʼn ŧĥįş đäşĥþőäřđ", "display-annotations-label": "Đįşpľäy äʼnʼnőŧäŧįőʼnş", "enable-time-range-description": "Åľľőŵ pęőpľę ŧő čĥäʼnģę ŧįmę řäʼnģę", "enable-time-range-label": "Ēʼnäþľę ŧįmę řäʼnģę", @@ -1976,7 +1976,7 @@ "revoke-button": "Ŗęvőĸę", "revoke-button-title": "Ŗęvőĸę", "success-creation": "Ÿőūř đäşĥþőäřđ įş řęäđy ƒőř ęχŧęřʼnäľ şĥäřįʼnģ", - "success-share-type-change": "Đäşĥþőäřđ äččęşş řęşŧřįčŧęđ: Øʼnľy şpęčįƒįč pęőpľę čäʼn ʼnőŵ äččęşş ŵįŧĥ ŧĥę ľįʼnĸ" + "success-share-type-change": "Đäşĥþőäřđ äččęşş ūpđäŧęđ: Øʼnľy şpęčįƒįč pęőpľę čäʼn ʼnőŵ äččęşş ŵįŧĥ ŧĥę ľįʼnĸ" }, "modal-alerts": { "no-upsert-perm-alert-desc": "Cőʼnŧäčŧ yőūř äđmįʼn ŧő ģęŧ pęřmįşşįőʼn ŧő {{mode}} pūþľįč đäşĥþőäřđş",