From 67b23774ae7adadc24ba0775ad54966ba6a84ba6 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 16 Jul 2025 14:32:43 +0530 Subject: [PATCH 01/13] change: [DI-26188] - Hide manage alerts button for undefined entity id --- .../AlertReusableComponent.test.tsx | 9 ++++++- .../ContextualView/AlertReusableComponent.tsx | 27 ++++++++++--------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx index 6799845c82d..eac8129be9d 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx @@ -1,4 +1,4 @@ -import { waitFor } from '@testing-library/react'; +import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; @@ -98,4 +98,11 @@ describe('Alert Resuable Component for contextual view', () => { const alert = alerts[alerts.length - 1]; expect(getByText(alert.label)).toBeInTheDocument(); }); + + it('Should hide manage alerts button for undefined entityId', () => { + renderWithTheme(); + + const manageAlerts = screen.queryByTestId('manage-alerts'); + expect(manageAlerts).not.toBeInTheDocument(); + }); }); diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx index 9840478ee92..a1ed49bc1ff 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx @@ -82,19 +82,22 @@ export const AlertReusableComponent = (props: AlertReusableComponentProps) => { return ( - - - Alerts - + {entityId && ( + + + Alerts + + + - - + )} Date: Wed, 16 Jul 2025 16:24:50 +0530 Subject: [PATCH 02/13] change: [DI-26188] - Updated scope tooltip message --- .../manager/src/features/CloudPulse/Alerts/constants.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/constants.ts b/packages/manager/src/features/CloudPulse/Alerts/constants.ts index 17630884a99..34aef1e600a 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/constants.ts +++ b/packages/manager/src/features/CloudPulse/Alerts/constants.ts @@ -190,12 +190,12 @@ export const CREATE_ALERT_SUCCESS_MESSAGE = export const UPDATE_ALERT_SUCCESS_MESSAGE = 'Alert successfully updated. It may take a few minutes for your changes to take effect.'; -export const ALERT_SCOPE_TOOLTIP_CONTEXTUAL = - 'Indicates whether the alert applies to all Linodes in the account, Linodes in specific regions, or just this Linode (entity).'; - export const ALERT_SCOPE_TOOLTIP_TEXT = 'The set of entities to which the alert applies: account-wide, specific regions, or individual entities.'; +export const ALERT_SCOPE_TOOLTIP_CONTEXTUAL = + 'Indicates whether the alert applies to all entities in the account, entities in specific regions, or just this entity.'; + export type AlertFormMode = 'create' | 'edit' | 'view'; export const DELETE_ALERT_SUCCESS_MESSAGE = 'Alert successfully deleted.'; From cdb62a81df51c9e8f04dd854fb23bec2c0b2af94 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 16 Jul 2025 16:26:28 +0530 Subject: [PATCH 03/13] change: [DI-26188] - Added isLegacyAvailable prop to reusable component --- .../AlertInformationActionTable.tsx | 16 +++++++++++----- .../ContextualView/AlertReusableComponent.tsx | 6 ++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx index 48f58e8d6de..1bb8e004e04 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx @@ -68,6 +68,11 @@ export interface AlertInformationActionTableProps { * Service type of the selected entity */ serviceType: string; + + /** + * Flag to determine if confirmation dialog should be displayed + */ + showConfirmationDialog?: boolean; } export interface TableColumnHeader { @@ -113,6 +118,7 @@ export const AlertInformationActionTable = ( orderByColumn, serviceType, onToggleAlert, + showConfirmationDialog, } = props; const alertsTableRef = React.useRef(null); @@ -314,11 +320,11 @@ export const AlertInformationActionTable = ( data-testid="save-alerts" disabled={!hasUnsavedChanges} onClick={() => { - window.scrollTo({ - behavior: 'instant', - top: 0, - }); - setIsDialogOpen(true); + if (showConfirmationDialog) { + setIsDialogOpen(true); + } else { + handleConfirm(enabledAlerts); + } }} > Save diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx index a1ed49bc1ff..34dcc88e8de 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx @@ -38,6 +38,11 @@ interface AlertReusableComponentProps { */ entityName?: string; + /** + * Whether the legacy alert is available for the entity + */ + isLegacyAlertAvailable?: boolean; + /** * Called when an alert is toggled on or off. * Only use in create flow. @@ -136,6 +141,7 @@ export const AlertReusableComponent = (props: AlertReusableComponentProps) => { onToggleAlert={onToggleAlert} orderByColumn="Alert Name" serviceType={serviceType} + showConfirmationDialog={isLegacyAlertAvailable} /> From 193269a04874c890db47548e617e902069bac682 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 16 Jul 2025 16:29:05 +0530 Subject: [PATCH 04/13] change: [DI-26188] - Added regionId props to filter region scope alert --- .../AlertInformationActionTable.tsx | 5 --- .../ContextualView/AlertReusableComponent.tsx | 23 ++++++++---- .../CloudPulse/Alerts/Utils/utils.test.ts | 35 ++++++++++++++----- .../features/CloudPulse/Alerts/Utils/utils.ts | 32 +++++++++++++---- .../src/features/CloudPulse/Utils/utils.ts | 27 +++++++------- 5 files changed, 82 insertions(+), 40 deletions(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx index 1bb8e004e04..c9d1a7cfdcf 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx @@ -280,11 +280,6 @@ export const AlertInformationActionTable = ( return null; } - // TODO: Remove this once we have a way to toggle ACCOUNT and REGION level alerts - if (!isEditMode && alert.scope !== 'entity') { - return null; - } - const status = enabledAlerts[alert.type]?.includes( alert.id ); diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx index 34dcc88e8de..44069e9d30c 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx @@ -16,10 +16,7 @@ import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextFiel import { useAlertDefinitionByServiceTypeQuery } from 'src/queries/cloudpulse/alerts'; import { AlertContextualViewTableHeaderMap } from '../AlertsListing/constants'; -import { - convertAlertsToTypeSet, - filterAlertsByStatusAndType, -} from '../Utils/utils'; +import { convertAlertsToTypeSet, filterAlerts } from '../Utils/utils'; import { AlertInformationActionTable } from './AlertInformationActionTable'; import type { @@ -50,6 +47,11 @@ interface AlertReusableComponentProps { */ onToggleAlert?: (payload: CloudPulseAlertsPayload) => void; + /** + * Region ID for the selected entity + */ + regionId?: string; + /** * Service type of selected entity */ @@ -57,7 +59,14 @@ interface AlertReusableComponentProps { } export const AlertReusableComponent = (props: AlertReusableComponentProps) => { - const { entityId, entityName, onToggleAlert, serviceType } = props; + const { + entityId, + entityName, + onToggleAlert, + serviceType, + regionId, + isLegacyAlertAvailable, + } = props; const { data: alerts, error, @@ -71,8 +80,8 @@ export const AlertReusableComponent = (props: AlertReusableComponentProps) => { // Filter alerts based on status, search text & selected type const filteredAlerts = React.useMemo( - () => filterAlertsByStatusAndType(alerts, searchText, selectedType), - [alerts, searchText, selectedType] + () => filterAlerts({ alerts, searchText, selectedType, regionId }), + [alerts, regionId, searchText, selectedType] ); const history = useHistory(); diff --git a/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.test.ts b/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.test.ts index 8418fd4e21e..a80eff55fdd 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.test.ts +++ b/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.test.ts @@ -9,7 +9,7 @@ import { convertAlertsToTypeSet, convertSecondsToMinutes, convertSecondsToOptions, - filterAlertsByStatusAndType, + filterAlerts, getSchemaWithEntityIdValidation, getServiceTypeLabel, handleMultipleError, @@ -50,13 +50,32 @@ it('test convertSecondsToOptions method', () => { expect(convertSecondsToOptions(900)).toEqual('15 min'); }); -it('test filterAlertsByStatusAndType method', () => { - const alerts = alertFactory.buildList(12, { created_by: 'system' }); - expect(filterAlertsByStatusAndType(alerts, '', 'system')).toHaveLength(12); - expect(filterAlertsByStatusAndType(alerts, '', 'user')).toHaveLength(0); - expect(filterAlertsByStatusAndType(alerts, 'Alert-1', 'system')).toHaveLength( - 4 - ); +it('test filterAlerts method', () => { + const alerts = [ + ...alertFactory.buildList(12, { created_by: 'system' }), + alertFactory.build({ + label: 'Alert-14', + scope: 'region', + regions: ['us-east'], + }), + ]; + expect( + filterAlerts({ alerts, searchText: '', selectedType: 'system' }) + ).toHaveLength(12); + expect( + filterAlerts({ alerts, searchText: '', selectedType: 'user' }) + ).toHaveLength(0); + expect( + filterAlerts({ alerts, searchText: 'Alert-1', selectedType: 'system' }) + ).toHaveLength(4); + expect( + filterAlerts({ + alerts, + searchText: '', + selectedType: 'system', + regionId: 'us-east', + }) + ).toHaveLength(13); }); it('test convertAlertsToTypeSet method', () => { diff --git a/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts b/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts index b3a18689fa6..1e8c353e1ed 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts +++ b/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts @@ -127,6 +127,25 @@ interface SupportedRegionsProps { serviceType: AlertServiceType | null; } +interface FilterAlertsProps { + /** + * The list of alerts to be filtered + */ + alerts: Alert[] | undefined; + /** + * The region ID to filter the alerts + */ + regionId?: string; + /** + * The search text to filter the alerts + */ + searchText: string; + /** + * The selected alert type to filter the alerts + */ + selectedType: AlertDefinitionType | undefined; +} + /** * @param serviceType Service type for which the label needs to be displayed * @param serviceTypeList List of available service types in Cloud Pulse @@ -231,17 +250,16 @@ export const getChipLabels = ( * @param selectedType selecte alert type * @returns list of filtered alerts based on searchText & selectedType */ -export const filterAlertsByStatusAndType = ( - alerts: Alert[] | undefined, - searchText: string, - selectedType: string | undefined -): Alert[] => { +export const filterAlerts = (props: FilterAlertsProps): Alert[] => { + const { alerts, regionId, searchText, selectedType } = props; return ( - alerts?.filter(({ label, status, type }) => { + alerts?.filter(({ label, status, type, scope, regions }) => { return ( (status === 'enabled' || status === 'in progress') && (!selectedType || type === selectedType) && - (!searchText || label.toLowerCase().includes(searchText.toLowerCase())) + (!searchText || + label.toLowerCase().includes(searchText.toLowerCase())) && + (scope !== 'region' || (regionId && regions?.includes(regionId))) ); }) ?? [] ); diff --git a/packages/manager/src/features/CloudPulse/Utils/utils.ts b/packages/manager/src/features/CloudPulse/Utils/utils.ts index 2a46110e0ff..0979fa7a269 100644 --- a/packages/manager/src/features/CloudPulse/Utils/utils.ts +++ b/packages/manager/src/features/CloudPulse/Utils/utils.ts @@ -89,19 +89,20 @@ export const useContextualAlertsState = ( user: [], }; - if (entityId) { - alerts.forEach((alert) => { - const isAccountOrRegion = - alert.scope === 'region' || alert.scope === 'account'; - const shouldInclude = entityId - ? isAccountOrRegion || alert.entity_ids.includes(entityId) - : false; - - if (shouldInclude) { - initialStates[alert.type]?.push(alert.id); - } - }); - } + alerts.forEach((alert) => { + const isAccountOrRegion = + alert.scope === 'region' || alert.scope === 'account'; + + // include alerts which has either account or region level scope or entityId is present in the alert's entity_ids + const shouldInclude = entityId + ? isAccountOrRegion || alert.entity_ids.includes(entityId) + : isAccountOrRegion; + + if (shouldInclude) { + initialStates[alert.type]?.push(alert.id); + } + }); + return initialStates; }, [] From 450ed8cc38844be0cd138c1dcc3c5a2759e96cda Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 16 Jul 2025 16:30:04 +0530 Subject: [PATCH 05/13] change: [DI-26188] - Added loading state to save button --- .../Alerts/ContextualView/AlertInformationActionTable.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx index c9d1a7cfdcf..66a37473c2b 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx @@ -313,7 +313,8 @@ export const AlertInformationActionTable = ( buttonType="primary" data-qa-buttons="true" data-testid="save-alerts" - disabled={!hasUnsavedChanges} + disabled={!hasUnsavedChanges || isLoading} + loading={isLoading} onClick={() => { if (showConfirmationDialog) { setIsDialogOpen(true); From e165d8975f6d0d66cbacaa074214d10077952f22 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 16 Jul 2025 16:33:48 +0530 Subject: [PATCH 06/13] test: [DI-26188] - Updated test cases --- .../AlertInformationActionTable.test.tsx | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.test.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.test.tsx index 4de285d50fd..e1191701576 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.test.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.test.tsx @@ -69,7 +69,9 @@ describe('Alert Listing Reusable Table for contextual view', () => { }); it('Should show confirm dialog on save button click when changes are made', async () => { - renderWithTheme(); + renderWithTheme( + + ); // First toggle an alert to make changes const alert = alerts[0]; @@ -86,6 +88,24 @@ describe('Alert Listing Reusable Table for contextual view', () => { expect(screen.getByTestId('confirmation-dialog')).toBeVisible(); }); + it('Should hide confirm dialog on save button click when changes are made', async () => { + renderWithTheme(); + + // First toggle an alert to make changes + const alert = alerts[0]; + const row = await screen.findByTestId(alert.id); + const toggle = await within(row).findByRole('checkbox'); + await userEvent.click(toggle); + + // Now the save button should be enabled + const saveButton = screen.getByTestId('save-alerts'); + expect(saveButton).not.toBeDisabled(); + + // Click save and verify dialog appears + await userEvent.click(saveButton); + expect(screen.queryByTestId('confirmation-dialog')).not.toBeInTheDocument(); + }); + it('Should have save button in disabled form when no changes are made', () => { renderWithTheme(); From 4e8316340f635f8b6bc305c42300e46d37dbb349 Mon Sep 17 00:00:00 2001 From: ankitaakamai Date: Mon, 21 Jul 2025 16:54:18 +0530 Subject: [PATCH 07/13] [DI-26293] - Make alert header conditional, filter alerts by region, give outline to cancel button --- .../AlertsLanding/AlertConfirmationDialog.tsx | 1 + .../AlertInformationActionTable.tsx | 2 +- .../AlertReusableComponent.test.tsx | 28 ++++++++++++++++++- .../ContextualView/AlertReusableComponent.tsx | 3 +- .../features/CloudPulse/Alerts/Utils/utils.ts | 3 +- packages/manager/src/mocks/serverHandlers.ts | 1 + 6 files changed, 33 insertions(+), 5 deletions(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/AlertsLanding/AlertConfirmationDialog.tsx b/packages/manager/src/features/CloudPulse/Alerts/AlertsLanding/AlertConfirmationDialog.tsx index cf89aad0c2c..7cfa437fe4b 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/AlertsLanding/AlertConfirmationDialog.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/AlertsLanding/AlertConfirmationDialog.tsx @@ -63,6 +63,7 @@ export const AlertConfirmationDialog = React.memo( disabled: isLoading, label: 'Cancel', onClick: handleCancel, + buttonType: 'outlined', }} /> ); diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx index 66a37473c2b..06a46081d79 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx @@ -131,7 +131,7 @@ export const AlertInformationActionTable = ( const [isLoading, setIsLoading] = React.useState(false); const isEditMode = !!entityId; - const isCreateMode = !!onToggleAlert; + const isCreateMode = !isEditMode; const { enabledAlerts, setEnabledAlerts, hasUnsavedChanges } = useContextualAlertsState(alerts, entityId); diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx index eac8129be9d..2f8e251a68a 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.test.tsx @@ -24,8 +24,18 @@ vi.mock('src/queries/cloudpulse/alerts', async () => { const serviceType = 'linode'; const entityId = '123'; const entityName = 'test-instance'; +const region = 'us-ord'; +const onToggleAlert = vi.fn(); const alerts = [ - ...alertFactory.buildList(3, { service_type: serviceType }), + ...alertFactory.buildList(3, { + service_type: serviceType, + regions: ['us-ord'], + }), + alertFactory.build({ + label: 'test-alert', + service_type: serviceType, + regions: ['us-ord'], + }), ...alertFactory.buildList(7, { entity_ids: [entityId], service_type: serviceType, @@ -33,6 +43,7 @@ const alerts = [ ...alertFactory.buildList(1, { entity_ids: [entityId], service_type: serviceType, + regions: ['us-ord'], status: 'enabled', type: 'system', }), @@ -48,6 +59,8 @@ const component = ( ); @@ -104,5 +117,18 @@ describe('Alert Resuable Component for contextual view', () => { const manageAlerts = screen.queryByTestId('manage-alerts'); expect(manageAlerts).not.toBeInTheDocument(); + expect(screen.queryByText('Alerts')).not.toBeInTheDocument(); + }); + + it('Should filter alerts based on region', async () => { + renderWithTheme(component); + await userEvent.click(screen.getByRole('button', { name: 'Open' })); + expect(screen.getByText('test-alert')).toBeVisible(); + }); + + it('Should show header for edit mode', async () => { + renderWithTheme(component); + await userEvent.click(screen.getByText('Manage Alerts')); + expect(screen.getByText('Alerts')).toBeVisible(); }); }); diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx index 44069e9d30c..dbe6adc5f68 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx @@ -42,7 +42,6 @@ interface AlertReusableComponentProps { /** * Called when an alert is toggled on or off. - * Only use in create flow. * @param payload enabled alerts ids */ onToggleAlert?: (payload: CloudPulseAlertsPayload) => void; @@ -78,7 +77,7 @@ export const AlertReusableComponent = (props: AlertReusableComponentProps) => { AlertDefinitionType | undefined >(); - // Filter alerts based on status, search text & selected type + // Filter alerts based on status, search text, selected type, and region const filteredAlerts = React.useMemo( () => filterAlerts({ alerts, searchText, selectedType, regionId }), [alerts, regionId, searchText, selectedType] diff --git a/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts b/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts index 1e8c353e1ed..b86d15beb5d 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts +++ b/packages/manager/src/features/CloudPulse/Alerts/Utils/utils.ts @@ -248,7 +248,8 @@ export const getChipLabels = ( * @param alerts list of alerts to be filtered * @param searchText text to be searched in alert name * @param selectedType selecte alert type - * @returns list of filtered alerts based on searchText & selectedType + * @param region region of the entity + * @returns list of filtered alerts based on searchText, selectedType, and region */ export const filterAlerts = (props: FilterAlertsProps): Alert[] => { const { alerts, regionId, searchText, selectedType } = props; diff --git a/packages/manager/src/mocks/serverHandlers.ts b/packages/manager/src/mocks/serverHandlers.ts index e092fc57e07..de73aa53641 100644 --- a/packages/manager/src/mocks/serverHandlers.ts +++ b/packages/manager/src/mocks/serverHandlers.ts @@ -2690,6 +2690,7 @@ export const handlers = [ ...alertFactory.buildList(6, { service_type: serviceType === 'dbaas' ? 'dbaas' : 'linode', type: 'user', + regions: ['us-ord'], scope: 'account', }), ...alertFactory.buildList(6, { From 796310e65bf78d9ef26a6d8059925f343ee3b7c9 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Tue, 22 Jul 2025 17:00:33 +0530 Subject: [PATCH 08/13] updated mock data --- packages/manager/src/mocks/serverHandlers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/manager/src/mocks/serverHandlers.ts b/packages/manager/src/mocks/serverHandlers.ts index de73aa53641..15f26dbef01 100644 --- a/packages/manager/src/mocks/serverHandlers.ts +++ b/packages/manager/src/mocks/serverHandlers.ts @@ -2690,13 +2690,13 @@ export const handlers = [ ...alertFactory.buildList(6, { service_type: serviceType === 'dbaas' ? 'dbaas' : 'linode', type: 'user', - regions: ['us-ord'], scope: 'account', }), ...alertFactory.buildList(6, { service_type: serviceType === 'dbaas' ? 'dbaas' : 'linode', type: 'user', scope: 'region', + regions: ['us-east'], }), ], }); From 9f64f379e022121d2ec39acd8f53f13af8832af1 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 23 Jul 2025 12:06:40 +0530 Subject: [PATCH 09/13] upcoming: [DI-26188] - Updated confirmation dialog text --- .../ContextualView/AlertInformationActionTable.tsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx index 06a46081d79..0ee94071636 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertInformationActionTable.tsx @@ -113,7 +113,6 @@ export const AlertInformationActionTable = ( alerts, columns, entityId, - entityName, error, orderByColumn, serviceType, @@ -339,13 +338,12 @@ export const AlertInformationActionTable = ( isOpen={isDialogOpen} message={ <> - Are you sure you want to save these settings for {entityName}? All - legacy alert settings will be disabled and replaced by the new{' '} - Alerts(Beta) settings. + Are you sure you want to save (Beta) Alerts? Legacy settings + will be disabled and replaced by (Beta) Alerts settings. } - primaryButtonLabel="Save" - title="Save Alerts?" + primaryButtonLabel="Confirm" + title="Are you sure you want to save (Beta) Alerts? " /> ); From d33d48beb941cba0849723394840f06edac8c9b2 Mon Sep 17 00:00:00 2001 From: pmakode-akamai Date: Wed, 23 Jul 2025 12:30:58 +0530 Subject: [PATCH 10/13] Pass `isLegacyAlertAvailable value to `AclpReusableComponent` --- .../Linodes/LinodesDetail/LinodeAlerts/LinodeAlerts.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/manager/src/features/Linodes/LinodesDetail/LinodeAlerts/LinodeAlerts.tsx b/packages/manager/src/features/Linodes/LinodesDetail/LinodeAlerts/LinodeAlerts.tsx index 7edbfaa1a6a..fa7370800ec 100644 --- a/packages/manager/src/features/Linodes/LinodesDetail/LinodeAlerts/LinodeAlerts.tsx +++ b/packages/manager/src/features/Linodes/LinodesDetail/LinodeAlerts/LinodeAlerts.tsx @@ -1,4 +1,5 @@ import { useLinodeQuery } from '@linode/queries'; +import { useIsLinodeAclpSubscribed } from '@linode/shared'; import { Box } from '@linode/ui'; import { useParams } from '@tanstack/react-router'; import * as React from 'react'; @@ -27,6 +28,7 @@ const LinodeAlerts = () => { regionId: linode?.region, type: 'alerts', }); + const isLinodeAclpSubscribed = useIsLinodeAclpSubscribed(id, 'beta'); return ( @@ -45,6 +47,7 @@ const LinodeAlerts = () => { ) : ( From 8766a0cd5b8341531a74799f19ee02abd71f9560 Mon Sep 17 00:00:00 2001 From: nikhagra-akamai Date: Wed, 23 Jul 2025 13:25:05 +0530 Subject: [PATCH 11/13] upcoming: [DI-26188] - Updated logic to show beta chip based on flags --- .../Alerts/ContextualView/AlertReusableComponent.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx index dbe6adc5f68..332c3024d59 100644 --- a/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx +++ b/packages/manager/src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent.tsx @@ -13,6 +13,7 @@ import React from 'react'; import { useHistory } from 'react-router-dom'; import { DebouncedSearchTextField } from 'src/components/DebouncedSearchTextField'; +import { useFlags } from 'src/hooks/useFlags'; import { useAlertDefinitionByServiceTypeQuery } from 'src/queries/cloudpulse/alerts'; import { AlertContextualViewTableHeaderMap } from '../AlertsListing/constants'; @@ -83,6 +84,8 @@ export const AlertReusableComponent = (props: AlertReusableComponentProps) => { [alerts, regionId, searchText, selectedType] ); + const { aclpBetaServices } = useFlags(); + const history = useHistory(); // Filter unique alert types from alerts list @@ -99,7 +102,7 @@ export const AlertReusableComponent = (props: AlertReusableComponentProps) => { Alerts - + {aclpBetaServices?.[serviceType]?.alerts && }