mirror of
https://github.com/SigNoz/signoz.git
synced 2025-12-17 15:36:48 +00:00
chore: remove routing policies feature flag (#9249)
This commit is contained in:
parent
101b3668b5
commit
c770a1a4e1
@ -13,14 +13,12 @@ import APIError from 'types/api/error';
|
|||||||
import { useCreateAlertState } from '../context';
|
import { useCreateAlertState } from '../context';
|
||||||
import AdvancedOptions from '../EvaluationSettings/AdvancedOptions';
|
import AdvancedOptions from '../EvaluationSettings/AdvancedOptions';
|
||||||
import Stepper from '../Stepper';
|
import Stepper from '../Stepper';
|
||||||
import { showCondensedLayout } from '../utils';
|
|
||||||
import AlertThreshold from './AlertThreshold';
|
import AlertThreshold from './AlertThreshold';
|
||||||
import AnomalyThreshold from './AnomalyThreshold';
|
import AnomalyThreshold from './AnomalyThreshold';
|
||||||
import { ANOMALY_TAB_TOOLTIP, THRESHOLD_TAB_TOOLTIP } from './constants';
|
import { ANOMALY_TAB_TOOLTIP, THRESHOLD_TAB_TOOLTIP } from './constants';
|
||||||
|
|
||||||
function AlertCondition(): JSX.Element {
|
function AlertCondition(): JSX.Element {
|
||||||
const { alertType, setAlertType } = useCreateAlertState();
|
const { alertType, setAlertType } = useCreateAlertState();
|
||||||
const showCondensedLayoutFlag = showCondensedLayout();
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
data,
|
data,
|
||||||
@ -108,11 +106,9 @@ function AlertCondition(): JSX.Element {
|
|||||||
refreshChannels={refreshChannels}
|
refreshChannels={refreshChannels}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{showCondensedLayoutFlag ? (
|
|
||||||
<div className="condensed-advanced-options-container">
|
<div className="condensed-advanced-options-container">
|
||||||
<AdvancedOptions />
|
<AdvancedOptions />
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,6 @@ import {
|
|||||||
THRESHOLD_OPERATOR_OPTIONS,
|
THRESHOLD_OPERATOR_OPTIONS,
|
||||||
} from '../context/constants';
|
} from '../context/constants';
|
||||||
import EvaluationSettings from '../EvaluationSettings/EvaluationSettings';
|
import EvaluationSettings from '../EvaluationSettings/EvaluationSettings';
|
||||||
import { showCondensedLayout } from '../utils';
|
|
||||||
import ThresholdItem from './ThresholdItem';
|
import ThresholdItem from './ThresholdItem';
|
||||||
import { AnomalyAndThresholdProps, UpdateThreshold } from './types';
|
import { AnomalyAndThresholdProps, UpdateThreshold } from './types';
|
||||||
import {
|
import {
|
||||||
@ -43,8 +42,6 @@ function AlertThreshold({
|
|||||||
setNotificationSettings,
|
setNotificationSettings,
|
||||||
} = useCreateAlertState();
|
} = useCreateAlertState();
|
||||||
|
|
||||||
const showCondensedLayoutFlag = showCondensedLayout();
|
|
||||||
|
|
||||||
const { currentQuery } = useQueryBuilder();
|
const { currentQuery } = useQueryBuilder();
|
||||||
|
|
||||||
const queryNames = getQueryNames(currentQuery);
|
const queryNames = getQueryNames(currentQuery);
|
||||||
@ -163,17 +160,12 @@ function AlertThreshold({
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const evaluationWindowContext = showCondensedLayoutFlag ? (
|
|
||||||
<EvaluationSettings />
|
|
||||||
) : (
|
|
||||||
<strong>Evaluation Window.</strong>
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classNames('alert-threshold-container', {
|
className={classNames(
|
||||||
'condensed-alert-threshold-container': showCondensedLayoutFlag,
|
'alert-threshold-container',
|
||||||
})}
|
'condensed-alert-threshold-container',
|
||||||
|
)}
|
||||||
>
|
>
|
||||||
{/* Main condition sentence */}
|
{/* Main condition sentence */}
|
||||||
<div className="alert-condition-sentences">
|
<div className="alert-condition-sentences">
|
||||||
@ -219,7 +211,7 @@ function AlertThreshold({
|
|||||||
options={matchTypeOptionsWithTooltips}
|
options={matchTypeOptionsWithTooltips}
|
||||||
/>
|
/>
|
||||||
<Typography.Text className="sentence-text">
|
<Typography.Text className="sentence-text">
|
||||||
during the {evaluationWindowContext}
|
during the <EvaluationSettings />
|
||||||
</Typography.Text>
|
</Typography.Text>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -110,7 +110,6 @@ jest.mock('container/NewWidget/RightContainer/alertFomatCategories', () => ({
|
|||||||
|
|
||||||
jest.mock('container/CreateAlertV2/utils', () => ({
|
jest.mock('container/CreateAlertV2/utils', () => ({
|
||||||
...jest.requireActual('container/CreateAlertV2/utils'),
|
...jest.requireActual('container/CreateAlertV2/utils'),
|
||||||
showCondensedLayout: jest.fn().mockReturnValue(false),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const TEST_STRINGS = {
|
const TEST_STRINGS = {
|
||||||
@ -159,7 +158,9 @@ describe('AlertThreshold', () => {
|
|||||||
expect(screen.getByText('Send a notification when')).toBeInTheDocument();
|
expect(screen.getByText('Send a notification when')).toBeInTheDocument();
|
||||||
expect(screen.getByText('the threshold(s)')).toBeInTheDocument();
|
expect(screen.getByText('the threshold(s)')).toBeInTheDocument();
|
||||||
expect(screen.getByText('during the')).toBeInTheDocument();
|
expect(screen.getByText('during the')).toBeInTheDocument();
|
||||||
expect(screen.getByText('Evaluation Window.')).toBeInTheDocument();
|
expect(
|
||||||
|
screen.getByTestId('condensed-evaluation-settings-container'),
|
||||||
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders query selection dropdown', async () => {
|
it('renders query selection dropdown', async () => {
|
||||||
|
|||||||
@ -8,12 +8,11 @@ import AlertCondition from './AlertCondition';
|
|||||||
import { CreateAlertProvider } from './context';
|
import { CreateAlertProvider } from './context';
|
||||||
import { buildInitialAlertDef } from './context/utils';
|
import { buildInitialAlertDef } from './context/utils';
|
||||||
import CreateAlertHeader from './CreateAlertHeader';
|
import CreateAlertHeader from './CreateAlertHeader';
|
||||||
import EvaluationSettings from './EvaluationSettings';
|
|
||||||
import Footer from './Footer';
|
import Footer from './Footer';
|
||||||
import NotificationSettings from './NotificationSettings';
|
import NotificationSettings from './NotificationSettings';
|
||||||
import QuerySection from './QuerySection';
|
import QuerySection from './QuerySection';
|
||||||
import { CreateAlertV2Props } from './types';
|
import { CreateAlertV2Props } from './types';
|
||||||
import { showCondensedLayout, Spinner } from './utils';
|
import { Spinner } from './utils';
|
||||||
|
|
||||||
function CreateAlertV2({ alertType }: CreateAlertV2Props): JSX.Element {
|
function CreateAlertV2({ alertType }: CreateAlertV2Props): JSX.Element {
|
||||||
const queryToRedirect = buildInitialAlertDef(alertType);
|
const queryToRedirect = buildInitialAlertDef(alertType);
|
||||||
@ -23,8 +22,6 @@ function CreateAlertV2({ alertType }: CreateAlertV2Props): JSX.Element {
|
|||||||
|
|
||||||
useShareBuilderUrl({ defaultValue: currentQueryToRedirect });
|
useShareBuilderUrl({ defaultValue: currentQueryToRedirect });
|
||||||
|
|
||||||
const showCondensedLayoutFlag = showCondensedLayout();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<CreateAlertProvider initialAlertType={alertType}>
|
<CreateAlertProvider initialAlertType={alertType}>
|
||||||
<Spinner />
|
<Spinner />
|
||||||
@ -32,7 +29,6 @@ function CreateAlertV2({ alertType }: CreateAlertV2Props): JSX.Element {
|
|||||||
<CreateAlertHeader />
|
<CreateAlertHeader />
|
||||||
<QuerySection />
|
<QuerySection />
|
||||||
<AlertCondition />
|
<AlertCondition />
|
||||||
{!showCondensedLayoutFlag ? <EvaluationSettings /> : null}
|
|
||||||
<NotificationSettings />
|
<NotificationSettings />
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
@ -1,28 +1,19 @@
|
|||||||
import './styles.scss';
|
import './styles.scss';
|
||||||
|
|
||||||
import { Button, Popover, Typography } from 'antd';
|
import { Button, Popover } from 'antd';
|
||||||
import { ChevronDown, ChevronUp } from 'lucide-react';
|
import { ChevronDown, ChevronUp } from 'lucide-react';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { AlertTypes } from 'types/api/alerts/alertTypes';
|
|
||||||
|
|
||||||
import { useCreateAlertState } from '../context';
|
import { useCreateAlertState } from '../context';
|
||||||
import Stepper from '../Stepper';
|
|
||||||
import { showCondensedLayout } from '../utils';
|
|
||||||
import AdvancedOptions from './AdvancedOptions';
|
|
||||||
import EvaluationWindowPopover from './EvaluationWindowPopover';
|
import EvaluationWindowPopover from './EvaluationWindowPopover';
|
||||||
import { getEvaluationWindowTypeText, getTimeframeText } from './utils';
|
import { getEvaluationWindowTypeText, getTimeframeText } from './utils';
|
||||||
|
|
||||||
function EvaluationSettings(): JSX.Element {
|
function EvaluationSettings(): JSX.Element {
|
||||||
const {
|
const { evaluationWindow, setEvaluationWindow } = useCreateAlertState();
|
||||||
alertType,
|
|
||||||
evaluationWindow,
|
|
||||||
setEvaluationWindow,
|
|
||||||
} = useCreateAlertState();
|
|
||||||
const [
|
const [
|
||||||
isEvaluationWindowPopoverOpen,
|
isEvaluationWindowPopoverOpen,
|
||||||
setIsEvaluationWindowPopoverOpen,
|
setIsEvaluationWindowPopoverOpen,
|
||||||
] = useState(false);
|
] = useState(false);
|
||||||
const showCondensedLayoutFlag = showCondensedLayout();
|
|
||||||
|
|
||||||
const popoverContent = (
|
const popoverContent = (
|
||||||
<Popover
|
<Popover
|
||||||
@ -57,8 +48,6 @@ function EvaluationSettings(): JSX.Element {
|
|||||||
</Popover>
|
</Popover>
|
||||||
);
|
);
|
||||||
|
|
||||||
// Layout consists of only the evaluation window popover
|
|
||||||
if (showCondensedLayoutFlag) {
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className="condensed-evaluation-settings-container"
|
className="condensed-evaluation-settings-container"
|
||||||
@ -69,23 +58,4 @@ function EvaluationSettings(): JSX.Element {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Layout consists of
|
|
||||||
// - Stepper header
|
|
||||||
// - Evaluation window popover
|
|
||||||
// - Advanced options
|
|
||||||
return (
|
|
||||||
<div className="evaluation-settings-container">
|
|
||||||
<Stepper stepNumber={3} label="Evaluation settings" />
|
|
||||||
{alertType !== AlertTypes.ANOMALY_BASED_ALERT && (
|
|
||||||
<div className="evaluate-alert-conditions-container">
|
|
||||||
<Typography.Text>Check conditions using data from</Typography.Text>
|
|
||||||
<div className="evaluate-alert-conditions-separator" />
|
|
||||||
{popoverContent}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<AdvancedOptions />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default EvaluationSettings;
|
export default EvaluationSettings;
|
||||||
|
|||||||
@ -1,14 +1,11 @@
|
|||||||
import { render, screen } from '@testing-library/react';
|
import { render, screen } from '@testing-library/react';
|
||||||
import * as alertState from 'container/CreateAlertV2/context';
|
import * as alertState from 'container/CreateAlertV2/context';
|
||||||
import * as utils from 'container/CreateAlertV2/utils';
|
|
||||||
import { AlertTypes } from 'types/api/alerts/alertTypes';
|
|
||||||
|
|
||||||
import EvaluationSettings from '../EvaluationSettings';
|
import EvaluationSettings from '../EvaluationSettings';
|
||||||
import { createMockAlertContextState } from './testUtils';
|
import { createMockAlertContextState } from './testUtils';
|
||||||
|
|
||||||
jest.mock('container/CreateAlertV2/utils', () => ({
|
jest.mock('container/CreateAlertV2/utils', () => ({
|
||||||
...jest.requireActual('container/CreateAlertV2/utils'),
|
...jest.requireActual('container/CreateAlertV2/utils'),
|
||||||
showCondensedLayout: jest.fn().mockReturnValue(false),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const mockSetEvaluationWindow = jest.fn();
|
const mockSetEvaluationWindow = jest.fn();
|
||||||
@ -18,52 +15,14 @@ jest.spyOn(alertState, 'useCreateAlertState').mockReturnValue(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
jest.mock('../AdvancedOptions', () => ({
|
|
||||||
__esModule: true,
|
|
||||||
default: (): JSX.Element => (
|
|
||||||
<div data-testid="advanced-options">AdvancedOptions</div>
|
|
||||||
),
|
|
||||||
}));
|
|
||||||
|
|
||||||
const EVALUATION_SETTINGS_TEXT = 'Evaluation settings';
|
|
||||||
const CHECK_CONDITIONS_USING_DATA_FROM_TEXT =
|
|
||||||
'Check conditions using data from';
|
|
||||||
|
|
||||||
describe('EvaluationSettings', () => {
|
describe('EvaluationSettings', () => {
|
||||||
it('should render the default evaluation settings layout', () => {
|
|
||||||
render(<EvaluationSettings />);
|
|
||||||
expect(screen.getByText(EVALUATION_SETTINGS_TEXT)).toBeInTheDocument();
|
|
||||||
expect(
|
|
||||||
screen.getByText(CHECK_CONDITIONS_USING_DATA_FROM_TEXT),
|
|
||||||
).toBeInTheDocument();
|
|
||||||
expect(screen.getByTestId('advanced-options')).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not render evaluation window for anomaly based alert', () => {
|
|
||||||
jest.spyOn(alertState, 'useCreateAlertState').mockReturnValueOnce(
|
|
||||||
createMockAlertContextState({
|
|
||||||
alertType: AlertTypes.ANOMALY_BASED_ALERT,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
render(<EvaluationSettings />);
|
|
||||||
expect(screen.getByText(EVALUATION_SETTINGS_TEXT)).toBeInTheDocument();
|
|
||||||
expect(
|
|
||||||
screen.queryByText(CHECK_CONDITIONS_USING_DATA_FROM_TEXT),
|
|
||||||
).not.toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should render the condensed evaluation settings layout', () => {
|
it('should render the condensed evaluation settings layout', () => {
|
||||||
jest.spyOn(utils, 'showCondensedLayout').mockReturnValueOnce(true);
|
|
||||||
render(<EvaluationSettings />);
|
render(<EvaluationSettings />);
|
||||||
// Header, check conditions using data from and advanced options should be hidden
|
|
||||||
expect(screen.queryByText(EVALUATION_SETTINGS_TEXT)).not.toBeInTheDocument();
|
|
||||||
expect(
|
|
||||||
screen.queryByText(CHECK_CONDITIONS_USING_DATA_FROM_TEXT),
|
|
||||||
).not.toBeInTheDocument();
|
|
||||||
expect(screen.queryByTestId('advanced-options')).not.toBeInTheDocument();
|
|
||||||
// Only evaluation window popover should be visible
|
|
||||||
expect(
|
expect(
|
||||||
screen.getByTestId('condensed-evaluation-settings-container'),
|
screen.getByTestId('condensed-evaluation-settings-container'),
|
||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
|
// Verify that default option is selected
|
||||||
|
expect(screen.getByText('Rolling')).toBeInTheDocument();
|
||||||
|
expect(screen.getByText('Last 5 minutes')).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -9,13 +9,10 @@ import {
|
|||||||
} from '../context/constants';
|
} from '../context/constants';
|
||||||
import AdvancedOptionItem from '../EvaluationSettings/AdvancedOptionItem';
|
import AdvancedOptionItem from '../EvaluationSettings/AdvancedOptionItem';
|
||||||
import Stepper from '../Stepper';
|
import Stepper from '../Stepper';
|
||||||
import { showCondensedLayout } from '../utils';
|
|
||||||
import MultipleNotifications from './MultipleNotifications';
|
import MultipleNotifications from './MultipleNotifications';
|
||||||
import NotificationMessage from './NotificationMessage';
|
import NotificationMessage from './NotificationMessage';
|
||||||
|
|
||||||
function NotificationSettings(): JSX.Element {
|
function NotificationSettings(): JSX.Element {
|
||||||
const showCondensedLayoutFlag = showCondensedLayout();
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
notificationSettings,
|
notificationSettings,
|
||||||
setNotificationSettings,
|
setNotificationSettings,
|
||||||
@ -82,10 +79,7 @@ function NotificationSettings(): JSX.Element {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="notification-settings-container">
|
<div className="notification-settings-container">
|
||||||
<Stepper
|
<Stepper stepNumber={3} label="Notification settings" />
|
||||||
stepNumber={showCondensedLayoutFlag ? 3 : 4}
|
|
||||||
label="Notification settings"
|
|
||||||
/>
|
|
||||||
<NotificationMessage />
|
<NotificationMessage />
|
||||||
<div className="notification-settings-content">
|
<div className="notification-settings-content">
|
||||||
<MultipleNotifications />
|
<MultipleNotifications />
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import { fireEvent, render, screen } from '@testing-library/react';
|
import { fireEvent, render, screen } from '@testing-library/react';
|
||||||
import * as createAlertContext from 'container/CreateAlertV2/context';
|
import * as createAlertContext from 'container/CreateAlertV2/context';
|
||||||
import { createMockAlertContextState } from 'container/CreateAlertV2/EvaluationSettings/__tests__/testUtils';
|
import { createMockAlertContextState } from 'container/CreateAlertV2/EvaluationSettings/__tests__/testUtils';
|
||||||
import * as utils from 'container/CreateAlertV2/utils';
|
|
||||||
|
|
||||||
import NotificationSettings from '../NotificationSettings';
|
import NotificationSettings from '../NotificationSettings';
|
||||||
|
|
||||||
@ -26,7 +25,6 @@ jest.mock(
|
|||||||
|
|
||||||
jest.mock('container/CreateAlertV2/utils', () => ({
|
jest.mock('container/CreateAlertV2/utils', () => ({
|
||||||
...jest.requireActual('container/CreateAlertV2/utils'),
|
...jest.requireActual('container/CreateAlertV2/utils'),
|
||||||
showCondensedLayout: jest.fn().mockReturnValue(false),
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
const initialNotificationSettings = createMockAlertContextState()
|
const initialNotificationSettings = createMockAlertContextState()
|
||||||
@ -42,10 +40,10 @@ const REPEAT_NOTIFICATIONS_TEXT = 'Repeat notifications';
|
|||||||
const ENTER_TIME_INTERVAL_TEXT = 'Enter time interval...';
|
const ENTER_TIME_INTERVAL_TEXT = 'Enter time interval...';
|
||||||
|
|
||||||
describe('NotificationSettings', () => {
|
describe('NotificationSettings', () => {
|
||||||
it('renders the notification settings tab with step number 4 and default values', () => {
|
it('renders the notification settings tab with step number 3 and default values', () => {
|
||||||
render(<NotificationSettings />);
|
render(<NotificationSettings />);
|
||||||
expect(screen.getByText('Notification settings')).toBeInTheDocument();
|
expect(screen.getByText('Notification settings')).toBeInTheDocument();
|
||||||
expect(screen.getByText('4')).toBeInTheDocument();
|
expect(screen.getByText('3')).toBeInTheDocument();
|
||||||
expect(screen.getByTestId('multiple-notifications')).toBeInTheDocument();
|
expect(screen.getByTestId('multiple-notifications')).toBeInTheDocument();
|
||||||
expect(screen.getByTestId('notification-message')).toBeInTheDocument();
|
expect(screen.getByTestId('notification-message')).toBeInTheDocument();
|
||||||
expect(screen.getByText(REPEAT_NOTIFICATIONS_TEXT)).toBeInTheDocument();
|
expect(screen.getByText(REPEAT_NOTIFICATIONS_TEXT)).toBeInTheDocument();
|
||||||
@ -56,15 +54,6 @@ describe('NotificationSettings', () => {
|
|||||||
).toBeInTheDocument();
|
).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('renders the notification settings tab with step number 3 in condensed layout', () => {
|
|
||||||
jest.spyOn(utils, 'showCondensedLayout').mockReturnValueOnce(true);
|
|
||||||
render(<NotificationSettings />);
|
|
||||||
expect(screen.getByText('Notification settings')).toBeInTheDocument();
|
|
||||||
expect(screen.getByText('3')).toBeInTheDocument();
|
|
||||||
expect(screen.getByTestId('multiple-notifications')).toBeInTheDocument();
|
|
||||||
expect(screen.getByTestId('notification-message')).toBeInTheDocument();
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Repeat notifications', () => {
|
describe('Repeat notifications', () => {
|
||||||
it('renders the repeat notifications with inputs hidden when the repeat notifications switch is off', () => {
|
it('renders the repeat notifications with inputs hidden when the repeat notifications switch is off', () => {
|
||||||
render(<NotificationSettings />);
|
render(<NotificationSettings />);
|
||||||
|
|||||||
@ -27,16 +27,6 @@ import {
|
|||||||
import { EVALUATION_WINDOW_TIMEFRAME } from './EvaluationSettings/constants';
|
import { EVALUATION_WINDOW_TIMEFRAME } from './EvaluationSettings/constants';
|
||||||
import { GetCreateAlertLocalStateFromAlertDefReturn } from './types';
|
import { GetCreateAlertLocalStateFromAlertDefReturn } from './types';
|
||||||
|
|
||||||
// UI side feature flag
|
|
||||||
export const showNewCreateAlertsPage = (): boolean =>
|
|
||||||
localStorage.getItem('showNewCreateAlertsPage') === 'true';
|
|
||||||
|
|
||||||
// UI side FF to switch between the 2 layouts of the create alert page
|
|
||||||
// Layout 1 - Default layout
|
|
||||||
// Layout 2 - Condensed layout
|
|
||||||
export const showCondensedLayout = (): boolean =>
|
|
||||||
localStorage.getItem('hideCondensedLayout') !== 'true';
|
|
||||||
|
|
||||||
export function Spinner(): JSX.Element | null {
|
export function Spinner(): JSX.Element | null {
|
||||||
const { isCreatingAlertRule, isUpdatingAlertRule } = useCreateAlertState();
|
const { isCreatingAlertRule, isUpdatingAlertRule } = useCreateAlertState();
|
||||||
|
|
||||||
|
|||||||
@ -8,11 +8,10 @@ import { PostableAlertRuleV2 } from 'types/api/alerts/alertTypesV2';
|
|||||||
|
|
||||||
import AlertCondition from '../CreateAlertV2/AlertCondition';
|
import AlertCondition from '../CreateAlertV2/AlertCondition';
|
||||||
import { buildInitialAlertDef } from '../CreateAlertV2/context/utils';
|
import { buildInitialAlertDef } from '../CreateAlertV2/context/utils';
|
||||||
import EvaluationSettings from '../CreateAlertV2/EvaluationSettings';
|
|
||||||
import Footer from '../CreateAlertV2/Footer';
|
import Footer from '../CreateAlertV2/Footer';
|
||||||
import NotificationSettings from '../CreateAlertV2/NotificationSettings';
|
import NotificationSettings from '../CreateAlertV2/NotificationSettings';
|
||||||
import QuerySection from '../CreateAlertV2/QuerySection';
|
import QuerySection from '../CreateAlertV2/QuerySection';
|
||||||
import { showCondensedLayout, Spinner } from '../CreateAlertV2/utils';
|
import { Spinner } from '../CreateAlertV2/utils';
|
||||||
|
|
||||||
interface EditAlertV2Props {
|
interface EditAlertV2Props {
|
||||||
alertType?: AlertTypes;
|
alertType?: AlertTypes;
|
||||||
@ -33,15 +32,12 @@ function EditAlertV2({
|
|||||||
|
|
||||||
useShareBuilderUrl({ defaultValue: currentQueryToRedirect });
|
useShareBuilderUrl({ defaultValue: currentQueryToRedirect });
|
||||||
|
|
||||||
const showCondensedLayoutFlag = showCondensedLayout();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Spinner />
|
<Spinner />
|
||||||
<div className="create-alert-v2-container">
|
<div className="create-alert-v2-container">
|
||||||
<QuerySection />
|
<QuerySection />
|
||||||
<AlertCondition />
|
<AlertCondition />
|
||||||
{!showCondensedLayoutFlag ? <EvaluationSettings /> : null}
|
|
||||||
<NotificationSettings />
|
<NotificationSettings />
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
|
|||||||
@ -5,10 +5,6 @@ import { SuccessResponseV2 } from 'types/api';
|
|||||||
|
|
||||||
import { RoutingPolicy } from './types';
|
import { RoutingPolicy } from './types';
|
||||||
|
|
||||||
export function showRoutingPoliciesPage(): boolean {
|
|
||||||
return localStorage.getItem('showRoutingPoliciesPage') === 'true';
|
|
||||||
}
|
|
||||||
|
|
||||||
export function mapApiResponseToRoutingPolicies(
|
export function mapApiResponseToRoutingPolicies(
|
||||||
response: SuccessResponseV2<GetRoutingPoliciesResponse>,
|
response: SuccessResponseV2<GetRoutingPoliciesResponse>,
|
||||||
): RoutingPolicy[] {
|
): RoutingPolicy[] {
|
||||||
|
|||||||
@ -8,7 +8,6 @@ import ROUTES from 'constants/routes';
|
|||||||
import AllAlertRules from 'container/ListAlertRules';
|
import AllAlertRules from 'container/ListAlertRules';
|
||||||
import { PlannedDowntime } from 'container/PlannedDowntime/PlannedDowntime';
|
import { PlannedDowntime } from 'container/PlannedDowntime/PlannedDowntime';
|
||||||
import RoutingPolicies from 'container/RoutingPolicies';
|
import RoutingPolicies from 'container/RoutingPolicies';
|
||||||
import { showRoutingPoliciesPage } from 'container/RoutingPolicies/utils';
|
|
||||||
import TriggeredAlerts from 'container/TriggeredAlerts';
|
import TriggeredAlerts from 'container/TriggeredAlerts';
|
||||||
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
import { useSafeNavigate } from 'hooks/useSafeNavigate';
|
||||||
import useUrlQuery from 'hooks/useUrlQuery';
|
import useUrlQuery from 'hooks/useUrlQuery';
|
||||||
@ -28,10 +27,7 @@ function AllAlertList(): JSX.Element {
|
|||||||
|
|
||||||
const search = urlQuery.get('search');
|
const search = urlQuery.get('search');
|
||||||
|
|
||||||
const showRoutingPoliciesPageFlag = showRoutingPoliciesPage();
|
|
||||||
|
|
||||||
const configurationTab = useMemo(() => {
|
const configurationTab = useMemo(() => {
|
||||||
if (showRoutingPoliciesPageFlag) {
|
|
||||||
const tabs = [
|
const tabs = [
|
||||||
{
|
{
|
||||||
label: 'Planned Downtime',
|
label: 'Planned Downtime',
|
||||||
@ -51,13 +47,7 @@ function AllAlertList(): JSX.Element {
|
|||||||
items={tabs}
|
items={tabs}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}, []);
|
||||||
return (
|
|
||||||
<div className="planned-downtime-container">
|
|
||||||
<PlannedDowntime />
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}, [showRoutingPoliciesPageFlag]);
|
|
||||||
|
|
||||||
const items: TabsProps['items'] = [
|
const items: TabsProps['items'] = [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user