mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
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:
@@ -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>
|
||||
|
||||
@@ -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} />}
|
||||
|
||||
@@ -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`);
|
||||
}
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user