import { reportInteraction } from '@grafana/runtime'; import { Alert, Button } from '@grafana/ui'; import { LocalStorageValueProvider } from 'app/core/components/LocalStorageValueProvider'; const LOCAL_STORAGE_KEY_PREFIX = 'grafana.angularDeprecation.dashboardNoticeAndMigration.isDismissed'; function localStorageKey(dashboardUid: string): string { return LOCAL_STORAGE_KEY_PREFIX + '.' + dashboardUid; } export interface Props { dashboardUid: string; showAutoMigrateLink?: boolean; } function tryMigration() { const autoMigrateParam = '__feature.autoMigrateOldPanels'; const url = new URL(window.location.toString()); if (!url.searchParams.has(autoMigrateParam)) { url.searchParams.append(autoMigrateParam, 'true'); } window.open(url.toString(), '_self'); } export function AngularDeprecationNotice({ dashboardUid, showAutoMigrateLink }: Props) { return ( storageKey={localStorageKey(dashboardUid)} defaultValue={false}> {(isDismissed, onDismiss) => { if (isDismissed) { return null; } return (
{ reportInteraction('angular_deprecation_notice_dismissed'); onDismiss(true); }} >
Read our deprecation notice and migration advice.
{showAutoMigrateLink && ( )}
); }} ); }