Update preview banner copy

This commit is contained in:
Clarity-89 committed 2025-02-17 08:43:12 +02:00
1 parent cfd29c1653
commit 7d8fbe645d
2 files changed
+19 -6

No files matched your search

@@ -10,15 +10,16 @@ interface DashboardPreviewBannerProps {
export function DashboardPreviewBanner({ queryParams, route, path }: DashboardPreviewBannerProps) {
const hasPrLink = Boolean(queryParams.prLink);
const isProvisioned = route === DashboardRoutes.Provisioning && path;
const isProvisioned = Boolean(route === DashboardRoutes.Provisioning && path);
if ('kiosk' in queryParams || (!queryParams.isPreview && !isProvisioned)) {
return null;
}
const title = getTitle({ isProvisioned, hasPR: hasPrLink });
return (
<Alert
title={isProvisioned ? 'This dashboard is loaded from an external repository' : 'Dashboard preview'}
title={title}
severity={isProvisioned ? 'info' : 'success'}
style={{ flex: 0 }}
buttonContent={
@@ -35,9 +36,21 @@ export function DashboardPreviewBanner({ queryParams, route, path }: DashboardPr
<>
The value is <strong>not</strong> saved in the grafana database.
</>
) : (
queryParams.prLink && <>Branch successfully created.</>
)}
) : null}
</Alert>
);
}
type Opts = {
isProvisioned?: boolean;
hasPR: boolean;
};
function getTitle({ isProvisioned, hasPR }: Opts) {
if (isProvisioned) {
return 'This dashboard is loaded from an external repository';
}
if (hasPR) {
return "This dashboard is a draft. The changes aren't live yet. You can review them in GitHub.";
}
return 'This dashboard is a draft. The changes aren’t live yet. Submit a pull request for review.';
}
@@ -12,7 +12,7 @@ export function getWorkflowOptions(config?: RepositorySpec) {
const availableOptions: Array<{ label: string; value: WorkflowOption }> = [
{ label: `Push to ${config.github?.branch}`, value: 'push' },
{ label: 'Push to Different Branch', value: 'branch' },
{ label: 'Push to different branch', value: 'branch' },
];
// Filter options based on the workflows in the config