Skip to content

Commit

Permalink
chore: fix notification rules table
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Nov 15, 2024
1 parent 74bf777 commit 31ccfa7
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions src/components/Notifications/Rules/NotificationsRulesTable.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { NotificationRules } from "@flanksource-ui/api/types/notifications";
import { Modal } from "@flanksource-ui/ui/Modal";
import MRTDataTable from "@flanksource-ui/ui/MRTDataTable/MRTDataTable";
import { useAtom } from "jotai";
import { useCallback } from "react";
import { useSearchParams } from "react-router-dom";
import EditNotificationRules from "./EditNotificationRules";
import {
notificationMostCommonErrorAtom,
notificationsRulesTableColumns
} from "./notificationsRulesTableColumns";
import { notificationsRulesTableColumns } from "./notificationsRulesTableColumns";

type NotificationsTableProps = {
notifications: NotificationRules[];
Expand All @@ -29,14 +24,6 @@ export default function NotificationsRulesTable({

const selectedNotificationId = searchParams.get("id");

const [mostCommonErrorNotification, setMostCommonErrorNotification] = useAtom(
notificationMostCommonErrorAtom
);
const modalTitle =
mostCommonErrorNotification?.title ??
mostCommonErrorNotification?.person?.name ??
mostCommonErrorNotification?.team?.name;

const onSelectNotification = useCallback(
(notification: NotificationRules) => {
const id = notification.id;
Expand All @@ -48,17 +35,6 @@ export default function NotificationsRulesTable({

return (
<>
{mostCommonErrorNotification && (
<Modal
open={mostCommonErrorNotification !== undefined}
onClose={() => setMostCommonErrorNotification(undefined)}
title={`${modalTitle ?? "Most Common Error"}`}
>
<div className="flex flex-col p-4">
{mostCommonErrorNotification.most_common_error}
</div>
</Modal>
)}
<MRTDataTable
data={notifications ?? []}
columns={notificationsRulesTableColumns}
Expand Down

0 comments on commit 31ccfa7

Please sign in to comment.