mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-17 04:47:11 +00:00
Agent-Logs-Url: https://github.com/fosrl/pangolin/sessions/4337e8e4-2110-45ae-bbf9-63f273d2a9a3 Co-authored-by: oschwartz10612 <4999704+oschwartz10612@users.noreply.github.com>
48 lines
1.5 KiB
TypeScript
48 lines
1.5 KiB
TypeScript
"use client";
|
|
|
|
import AlertRuleGraphEditor from "@app/components/alert-rule-editor/AlertRuleGraphEditor";
|
|
import HeaderTitle from "@app/components/SettingsSectionTitle";
|
|
import { defaultFormValues } from "@app/lib/alertRuleForm";
|
|
import { useEnvContext } from "@app/hooks/useEnvContext";
|
|
import { usePaidStatus } from "@app/hooks/usePaidStatus";
|
|
import { tierMatrix } from "@server/lib/billing/tierMatrix";
|
|
import { useParams, useRouter } from "next/navigation";
|
|
import { useTranslations } from "next-intl";
|
|
import { useEffect } from "react";
|
|
|
|
export default function NewAlertRulePage() {
|
|
const params = useParams();
|
|
const orgId = params.orgId as string;
|
|
const t = useTranslations();
|
|
const { isPaidUser } = usePaidStatus();
|
|
const isPaid = isPaidUser(tierMatrix.alertingRules);
|
|
const { env } = useEnvContext();
|
|
const router = useRouter();
|
|
const disableEnterpriseFeatures = env.flags.disableEnterpriseFeatures;
|
|
|
|
useEffect(() => {
|
|
if (disableEnterpriseFeatures) {
|
|
router.replace(`/${orgId}/settings/alerting/rules`);
|
|
}
|
|
}, [disableEnterpriseFeatures, orgId, router]);
|
|
|
|
if (disableEnterpriseFeatures) {
|
|
return null;
|
|
}
|
|
|
|
return (
|
|
<>
|
|
<HeaderTitle
|
|
title={t("alertingCreateRule")}
|
|
description={t("alertingRuleCredenzaDescription")}
|
|
/>
|
|
<AlertRuleGraphEditor
|
|
orgId={orgId}
|
|
initialValues={defaultFormValues()}
|
|
isNew
|
|
disabled={!isPaid}
|
|
/>
|
|
</>
|
|
);
|
|
}
|