Alerting: upgrade preview enable folder alert tab and dashboard alert panel (#81992)

* Alerting: upgrade preview enable folder alert tab and dashboard alert panel

Enable the folder alert tab and the dashboard alert panel when the
alertingPreviewUpgrade feature flag is enabled

* Link directly to folder alerts in upgrade page
This commit is contained in:
Matthew Jacobson
2024-02-07 16:14:56 -05:00
committed by GitHub
parent b25ffe2b15
commit 4b609f1121
4 changed files with 12 additions and 5 deletions

View File

@@ -42,7 +42,7 @@ import { DynamicTable, DynamicTableColumnProps, DynamicTableItemProps } from './
import { DynamicTableWithGuidelines } from './unified/components/DynamicTableWithGuidelines';
import { Matchers } from './unified/components/notification-policies/Matchers';
import { ActionIcon } from './unified/components/rules/ActionIcon';
import { createContactPointLink, makeDashboardLink, makeFolderLink } from './unified/utils/misc';
import { createContactPointLink, makeDashboardLink, makeFolderAlertsLink } from './unified/utils/misc';
import { createUrl } from './unified/utils/url';
export const UpgradePage = () => {
@@ -1011,7 +1011,7 @@ const useAlertColumns = (): Array<DynamicTableColumnProps<DashboardUpgrade>> =>
rel="noreferrer"
target="_blank"
className={styles.textLink}
href={makeFolderLink(dashUpgrade.folderUid)}
href={makeFolderAlertsLink(dashUpgrade.folderUid, dashUpgrade.folderName)}
>
{dashUpgrade.folderName}
</Link>
@@ -1075,7 +1075,7 @@ const useAlertColumns = (): Array<DynamicTableColumnProps<DashboardUpgrade>> =>
rel="noreferrer"
target="_blank"
className={styles.textLink}
href={makeFolderLink(migratedFolderUid)}
href={makeFolderAlertsLink(migratedFolderUid, dashUpgrade.newFolderName)}
>
{dashUpgrade.newFolderName}
</Link>

View File

@@ -10,7 +10,7 @@ const AlertRulesToolbarButton = React.lazy(
export function initAlerting() {
addCustomRightAction({
show: () => config.unifiedAlertingEnabled,
show: () => config.unifiedAlertingEnabled || (config.featureToggles.alertingPreviewUpgrade ?? false),
component: ({ dashboard }) => (
<React.Suspense fallback={null} key="alert-rules-button">
{dashboard && <AlertRulesToolbarButton dashboardUid={dashboard.uid} />}

View File

@@ -145,6 +145,10 @@ export function makeFolderLink(folderUID: string): string {
return createUrl(`/dashboards/f/${folderUID}`);
}
export function makeFolderAlertsLink(folderUID: string, title: string): string {
return createUrl(`/dashboards/f/${folderUID}/${title}/alerting`);
}
export function makeFolderSettingsLink(folder: FolderDTO): string {
return createUrl(`/dashboards/f/${folder.uid}/${folder.title}/settings`);
}

View File

@@ -45,7 +45,10 @@ export function buildNavModel(folder: FolderDTO, parents = folder.parents): NavM
url: `${folder.url}/library-panels`,
});
if (contextSrv.hasPermission(AccessControlAction.AlertingRuleRead) && config.unifiedAlertingEnabled) {
if (
contextSrv.hasPermission(AccessControlAction.AlertingRuleRead) &&
(config.unifiedAlertingEnabled || config.featureToggles.alertingPreviewUpgrade)
) {
model.children!.push({
active: false,
icon: 'bell',