From 8b509eb6ddd4fef5a4ed1274af18639a70c91c15 Mon Sep 17 00:00:00 2001 From: Ashley Harrison Date: Thu, 26 May 2022 12:03:04 +0100 Subject: [PATCH] Notification history: Enable by default (#49502) * remove persistNotifications feature flag * remove unused imports --- packages/grafana-data/src/types/featureToggles.gen.ts | 1 - pkg/api/index.go | 8 +++----- pkg/services/featuremgmt/registry.go | 6 ------ pkg/services/featuremgmt/toggles_gen.go | 4 ---- public/app/core/reducers/appNotification.ts | 9 --------- public/app/features/notifications/NotificationsPage.tsx | 6 ------ 6 files changed, 3 insertions(+), 31 deletions(-) diff --git a/packages/grafana-data/src/types/featureToggles.gen.ts b/packages/grafana-data/src/types/featureToggles.gen.ts index 2267c7a0115..7fdfab135f2 100644 --- a/packages/grafana-data/src/types/featureToggles.gen.ts +++ b/packages/grafana-data/src/types/featureToggles.gen.ts @@ -51,7 +51,6 @@ export interface FeatureToggles { azureMonitorResourcePickerForMetrics?: boolean; explore2Dashboard?: boolean; tracing?: boolean; - persistNotifications?: boolean; commandPalette?: boolean; savedItems?: boolean; cloudWatchDynamicLabels?: boolean; diff --git a/pkg/api/index.go b/pkg/api/index.go index fa411a50697..08b3fd0012b 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -40,11 +40,9 @@ func (hs *HTTPServer) getProfileNode(c *models.ReqContext) *dtos.NavLink { }, } - if hs.Features.IsEnabled(featuremgmt.FlagPersistNotifications) { - children = append(children, &dtos.NavLink{ - Text: "Notification history", Id: "notifications", Url: hs.Cfg.AppSubURL + "/notifications", Icon: "bell", - }) - } + children = append(children, &dtos.NavLink{ + Text: "Notification history", Id: "notifications", Url: hs.Cfg.AppSubURL + "/notifications", Icon: "bell", + }) if setting.AddChangePasswordLink() { children = append(children, &dtos.NavLink{ diff --git a/pkg/services/featuremgmt/registry.go b/pkg/services/featuremgmt/registry.go index e1339fcf635..1cf0cbd1983 100644 --- a/pkg/services/featuremgmt/registry.go +++ b/pkg/services/featuremgmt/registry.go @@ -199,12 +199,6 @@ var ( State: FeatureStateAlpha, FrontendOnly: true, }, - { - Name: "persistNotifications", - Description: "PoC Notifications page", - State: FeatureStateAlpha, - FrontendOnly: true, - }, { Name: "commandPalette", Description: "Enable command palette", diff --git a/pkg/services/featuremgmt/toggles_gen.go b/pkg/services/featuremgmt/toggles_gen.go index 66508a05e7f..c9b410c2b39 100644 --- a/pkg/services/featuremgmt/toggles_gen.go +++ b/pkg/services/featuremgmt/toggles_gen.go @@ -147,10 +147,6 @@ const ( // Adds trace ID to error notifications FlagTracing = "tracing" - // FlagPersistNotifications - // PoC Notifications page - FlagPersistNotifications = "persistNotifications" - // FlagCommandPalette // Enable command palette FlagCommandPalette = "commandPalette" diff --git a/public/app/core/reducers/appNotification.ts b/public/app/core/reducers/appNotification.ts index adea058d646..f87c8d05712 100644 --- a/public/app/core/reducers/appNotification.ts +++ b/public/app/core/reducers/appNotification.ts @@ -1,6 +1,5 @@ import { createSlice, PayloadAction } from '@reduxjs/toolkit'; -import { config } from '@grafana/runtime'; import { AppNotification, AppNotificationSeverity, AppNotificationsState } from 'app/types/'; const MAX_STORED_NOTIFICATIONS = 25; @@ -88,10 +87,6 @@ function isStoredNotification(obj: any): obj is StoredNotification { // (De)serialization export function deserializeNotifications(): Record { - if (!config.featureToggles?.persistNotifications) { - return {}; - } - const storedNotifsRaw = window.localStorage.getItem(STORAGE_KEY); if (!storedNotifsRaw) { return {}; @@ -106,10 +101,6 @@ export function deserializeNotifications(): Record { } function serializeNotifications(notifs: Record) { - if (!config.featureToggles?.persistNotifications) { - return; - } - const reducedNotifs = Object.values(notifs) .filter(isAtLeastWarning) .sort((a, b) => b.timestamp - a.timestamp) diff --git a/public/app/features/notifications/NotificationsPage.tsx b/public/app/features/notifications/NotificationsPage.tsx index e809b8e49fa..04b6b192a23 100644 --- a/public/app/features/notifications/NotificationsPage.tsx +++ b/public/app/features/notifications/NotificationsPage.tsx @@ -1,8 +1,6 @@ import React from 'react'; import { connect, ConnectedProps } from 'react-redux'; -import { config } from '@grafana/runtime'; - import Page from '../../core/components/Page/Page'; import { GrafanaRouteComponentProps } from '../../core/navigation/types'; import { getNavModel } from '../../core/selectors/navModel'; @@ -21,10 +19,6 @@ interface OwnProps extends GrafanaRouteComponentProps {} type Props = OwnProps & ConnectedProps; export const NotificationsPage = ({ navModel }: Props) => { - if (!config.featureToggles.persistNotifications) { - return null; - } - return (