Skip to content

upcoming: [M3-9989, M3-9919] - Add beta ACLP contextual alerts to Alerts tab on Linode details page #12236

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Upcoming Features
---

Add beta ACLP contextual alerts to the Alerts tab on the Linode details page ([#12236](https://github.com/linode/manager/pull/12236))
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useGrants, usePreferences } from '@linode/queries';
import { Box, Notice } from '@linode/ui';
import { useGrants, useLinodeQuery, usePreferences } from '@linode/queries';
import { Box } from '@linode/ui';
import * as React from 'react';
import { useParams } from 'react-router-dom';

import { AlertReusableComponent } from 'src/features/CloudPulse/Alerts/ContextualView/AlertReusableComponent';
import { useFlags } from 'src/hooks/useFlags';

import { AclpPreferenceToggle } from '../AclpPreferenceToggle';
Expand All @@ -11,8 +12,10 @@ import { LinodeSettingsAlertsPanel } from '../LinodeSettings/LinodeSettingsAlert
const LinodeAlerts = () => {
const { linodeId } = useParams<{ linodeId: string }>();
const id = Number(linodeId);

const flags = useFlags();
const { data: grants } = useGrants();
const { data: linode } = useLinodeQuery(id);
const { data: isAclpAlertsPreferenceBeta } = usePreferences(
(preferences) => preferences?.isAclpAlertsBeta
);
Expand All @@ -27,7 +30,11 @@ const LinodeAlerts = () => {
{flags.aclpIntegration ? <AclpPreferenceToggle type="alerts" /> : null}
{flags.aclpIntegration && isAclpAlertsPreferenceBeta ? (
// Beta ACLP Alerts View
<Notice variant="info">ACLP Alerts Coming soon...</Notice>
<AlertReusableComponent
entityId={linodeId}
entityName={linode?.label ?? ''}
serviceType="linode"
/>
) : (
// Legacy Alerts View
<LinodeSettingsAlertsPanel isReadOnly={isReadOnly} linodeId={id} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { useFormik } from 'formik';
import { useSnackbar } from 'notistack';
import * as React from 'react';

import { useFlags } from 'src/hooks/useFlags';
import { useTypeQuery } from 'src/queries/types';
import { getAPIErrorFor } from 'src/utilities/getAPIErrorFor';

Expand All @@ -20,6 +21,7 @@ interface Props {
export const LinodeSettingsAlertsPanel = (props: Props) => {
const { isReadOnly, linodeId } = props;
const { enqueueSnackbar } = useSnackbar();
const flags = useFlags();

const { data: linode } = useLinodeQuery(linodeId);

Expand Down Expand Up @@ -219,14 +221,15 @@ export const LinodeSettingsAlertsPanel = (props: Props) => {
].filter((thisAlert) => !thisAlert.hidden);

const generalError = hasErrorFor('none');
const alertsHeading = flags.aclpIntegration ? 'Default Alerts' : 'Alerts';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a new heading for legacy alerts based on the UX mocks.


return (
<Paper sx={(theme) => ({ pb: theme.spacingFunction(16) })}>
<Typography
sx={(theme) => ({ mb: theme.spacingFunction(12) })}
variant="h2"
>
Alerts
{alertsHeading}
</Typography>
{generalError && <Notice variant="error">{generalError}</Notice>}
{alertSections.map((p, idx) => (
Expand Down