2025-09-09 14:56:29 +07:00
|
|
|
import './CreateAlertV2.styles.scss';
|
|
|
|
|
|
2025-09-10 21:43:54 +07:00
|
|
|
import { initialQueriesMap } from 'constants/queryBuilder';
|
|
|
|
|
import { useShareBuilderUrl } from 'hooks/queryBuilder/useShareBuilderUrl';
|
2025-09-30 00:03:29 +07:00
|
|
|
import { mapQueryDataFromApi } from 'lib/newQueryBuilder/queryBuilderMappers/mapQueryDataFromApi';
|
2025-09-10 21:43:54 +07:00
|
|
|
|
2025-09-15 22:52:07 +07:00
|
|
|
import AlertCondition from './AlertCondition';
|
2025-09-09 14:56:29 +07:00
|
|
|
import { CreateAlertProvider } from './context';
|
2025-09-30 00:03:29 +07:00
|
|
|
import { buildInitialAlertDef } from './context/utils';
|
2025-09-10 21:43:54 +07:00
|
|
|
import CreateAlertHeader from './CreateAlertHeader';
|
2025-09-30 00:03:29 +07:00
|
|
|
import Footer from './Footer';
|
2025-09-24 10:22:05 +07:00
|
|
|
import NotificationSettings from './NotificationSettings';
|
2025-09-10 21:43:54 +07:00
|
|
|
import QuerySection from './QuerySection';
|
2025-09-30 00:03:29 +07:00
|
|
|
import { CreateAlertV2Props } from './types';
|
2025-10-04 23:09:18 +07:00
|
|
|
import { Spinner } from './utils';
|
2025-09-10 21:43:54 +07:00
|
|
|
|
2025-09-30 00:03:29 +07:00
|
|
|
function CreateAlertV2({ alertType }: CreateAlertV2Props): JSX.Element {
|
|
|
|
|
const queryToRedirect = buildInitialAlertDef(alertType);
|
|
|
|
|
const currentQueryToRedirect = mapQueryDataFromApi(
|
|
|
|
|
queryToRedirect.condition.compositeQuery,
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
useShareBuilderUrl({ defaultValue: currentQueryToRedirect });
|
2025-09-09 14:56:29 +07:00
|
|
|
|
|
|
|
|
return (
|
2025-09-30 00:03:29 +07:00
|
|
|
<CreateAlertProvider initialAlertType={alertType}>
|
|
|
|
|
<Spinner />
|
2025-09-23 22:36:40 +07:00
|
|
|
<div className="create-alert-v2-container">
|
2025-09-09 14:56:29 +07:00
|
|
|
<CreateAlertHeader />
|
2025-09-10 21:43:54 +07:00
|
|
|
<QuerySection />
|
2025-09-15 22:52:07 +07:00
|
|
|
<AlertCondition />
|
2025-09-24 10:22:05 +07:00
|
|
|
<NotificationSettings />
|
2025-09-23 22:36:40 +07:00
|
|
|
</div>
|
2025-09-30 00:03:29 +07:00
|
|
|
<Footer />
|
2025-09-23 22:36:40 +07:00
|
|
|
</CreateAlertProvider>
|
2025-09-09 14:56:29 +07:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-10 21:43:54 +07:00
|
|
|
CreateAlertV2.defaultProps = {
|
|
|
|
|
initialQuery: initialQueriesMap.metrics,
|
|
|
|
|
};
|
|
|
|
|
|
2025-09-09 14:56:29 +07:00
|
|
|
export default CreateAlertV2;
|