Skip to content

Commit a140661

Browse files
change: [M3-9742] - Add dedicated Alerts tab on Linode details page (#12013)
* Add dedicated Alerts tab on linode details page * Added changeset: Add dedicated `Alerts` tab on Linode details page * Update changeset * Update tests
1 parent 8802863 commit a140661

6 files changed

Lines changed: 37 additions & 10 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@linode/manager': Added
3+
---
4+
5+
Dedicated `Alerts` tab on Linode details page ([#12013](https://github.com/linode/manager/pull/12013))

packages/manager/cypress/e2e/core/linodes/smoke-delete-linode.spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ describe('delete linode', () => {
132132
// Check elements in setting tab
133133
cy.findByText('Linode Label').should('be.visible');
134134
cy.findByText('Reset Root Password').should('be.visible');
135-
cy.findByText('Notification Thresholds').should('be.visible');
136135
cy.findByText('Shutdown Watchdog').should('be.visible');
137136
cy.findByText('Delete Linode').should('be.visible');
138137

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { useGrants } from '@linode/queries';
2+
import * as React from 'react';
3+
import { useParams } from 'react-router-dom';
4+
5+
import { LinodeSettingsAlertsPanel } from '../LinodeSettings/LinodeSettingsAlertsPanel';
6+
7+
const LinodeAlerts = () => {
8+
const { linodeId } = useParams<{ linodeId: string }>();
9+
const id = Number(linodeId);
10+
const { data: grants } = useGrants();
11+
12+
const isReadOnly =
13+
grants !== undefined &&
14+
grants?.linode.find((grant) => grant.id === id)?.permissions ===
15+
'read_only';
16+
17+
return <LinodeSettingsAlertsPanel isReadOnly={isReadOnly} linodeId={id} />;
18+
};
19+
20+
export default LinodeAlerts;

packages/manager/src/features/Linodes/LinodesDetail/LinodeSettings/LinodeSettings.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1+
import { useGrants } from '@linode/queries';
12
import * as React from 'react';
23
import { useParams } from 'react-router-dom';
34

4-
import { useGrants } from '@linode/queries';
5-
6-
import { LinodeSettingsAlertsPanel } from './LinodeSettingsAlertsPanel';
75
import { LinodeSettingsDeletePanel } from './LinodeSettingsDeletePanel';
86
import { LinodeSettingsLabelPanel } from './LinodeSettingsLabelPanel';
97
import { LinodeSettingsPasswordPanel } from './LinodeSettingsPasswordPanel';
@@ -24,7 +22,6 @@ const LinodeSettings = () => {
2422
<>
2523
<LinodeSettingsLabelPanel isReadOnly={isReadOnly} linodeId={id} />
2624
<LinodeSettingsPasswordPanel isReadOnly={isReadOnly} linodeId={id} />
27-
<LinodeSettingsAlertsPanel isReadOnly={isReadOnly} linodeId={id} />
2825
<LinodeWatchdogPanel isReadOnly={isReadOnly} linodeId={id} />
2926
<LinodeSettingsDeletePanel isReadOnly={isReadOnly} linodeId={id} />
3027
</>

packages/manager/src/features/Linodes/LinodesDetail/LinodeSettings/LinodeSettingsAlertsPanel.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ export const LinodeSettingsAlertsPanel = (props: Props) => {
7676

7777
const alertSections = [
7878
{
79-
copy:
80-
'Average CPU usage over 2 hours exceeding this value triggers this alert.',
79+
copy: 'Average CPU usage over 2 hours exceeding this value triggers this alert.',
8180
endAdornment: '%',
8281
error: hasErrorFor('alerts.cpu'),
8382
hidden: isBareMetalInstance,
@@ -103,8 +102,7 @@ export const LinodeSettingsAlertsPanel = (props: Props) => {
103102
value: formik.values.cpu,
104103
},
105104
{
106-
copy:
107-
'Average Disk I/O ops/sec over 2 hours exceeding this value triggers this alert.',
105+
copy: 'Average Disk I/O ops/sec over 2 hours exceeding this value triggers this alert.',
108106
endAdornment: 'IOPS',
109107
error: hasErrorFor('alerts.io'),
110108
hidden: isBareMetalInstance,
@@ -225,7 +223,7 @@ export const LinodeSettingsAlertsPanel = (props: Props) => {
225223
<Accordion
226224
actions={renderExpansionActions}
227225
defaultExpanded
228-
heading="Notification Thresholds"
226+
heading="Alerts"
229227
>
230228
{generalError && <Notice variant="error">{generalError}</Notice>}
231229
{alertSections.map((p, idx) => (

packages/manager/src/features/Linodes/LinodesDetail/LinodesDetailNavigation.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const LinodeBackup = React.lazy(() => import('./LinodeBackup/LinodeBackups'));
3333
const LinodeActivity = React.lazy(
3434
() => import('./LinodeActivity/LinodeActivity')
3535
);
36+
const LinodeAlerts = React.lazy(() => import('./LinodeAlerts/LinodeAlerts'));
3637
const LinodeSettings = React.lazy(
3738
() => import('./LinodeSettings/LinodeSettings')
3839
);
@@ -80,6 +81,10 @@ const LinodesDetailNavigation = () => {
8081
routeName: `${url}/activity`,
8182
title: 'Activity Feed',
8283
},
84+
{
85+
routeName: `${url}/alerts`,
86+
title: 'Alerts',
87+
},
8388
{
8489
routeName: `${url}/settings`,
8590
title: 'Settings',
@@ -165,6 +170,9 @@ const LinodesDetailNavigation = () => {
165170
<SafeTabPanel index={idx++}>
166171
<LinodeActivity />
167172
</SafeTabPanel>
173+
<SafeTabPanel index={idx++}>
174+
<LinodeAlerts />
175+
</SafeTabPanel>
168176
<SafeTabPanel index={idx++}>
169177
<LinodeSettings />
170178
</SafeTabPanel>

0 commit comments

Comments
 (0)