-
Notifications
You must be signed in to change notification settings - Fork 804
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
702 additions
and
725 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
keep-ui/app/(keep)/incidents/[id]/alerts/incident-alert-actions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { Button } from "@/components/ui"; | ||
import { useIncidentActions } from "@/entities/incidents/model/useIncidentActions"; | ||
import { SplitIncidentAlertsModal } from "@/features/split-incident-alerts"; | ||
import { useState } from "react"; | ||
import { LiaUnlinkSolid } from "react-icons/lia"; | ||
|
||
export function IncidentAlertsActions({ | ||
incidentId, | ||
selectedFingerprints, | ||
resetAlertsSelection, | ||
}: { | ||
incidentId: string; | ||
selectedFingerprints: string[]; | ||
resetAlertsSelection: () => void; | ||
}) { | ||
const [isSplitModalOpen, setIsSplitModalOpen] = useState(false); | ||
const { unlinkAlertsFromIncident } = useIncidentActions(); | ||
|
||
return ( | ||
<> | ||
<div className="flex gap-2 justify-end"> | ||
<Button | ||
variant="primary" | ||
onClick={() => setIsSplitModalOpen(true)} | ||
disabled={selectedFingerprints.length === 0} | ||
> | ||
Split | ||
</Button> | ||
<Button | ||
variant="destructive" | ||
icon={LiaUnlinkSolid} | ||
onClick={async () => { | ||
await unlinkAlertsFromIncident(incidentId, selectedFingerprints); | ||
resetAlertsSelection(); | ||
}} | ||
disabled={selectedFingerprints.length === 0} | ||
> | ||
Unlink | ||
</Button> | ||
</div> | ||
{isSplitModalOpen && ( | ||
<SplitIncidentAlertsModal | ||
sourceIncidentId={incidentId} | ||
alertFingerprints={selectedFingerprints} | ||
handleClose={() => setIsSplitModalOpen(false)} | ||
onSuccess={resetAlertsSelection} | ||
/> | ||
)} | ||
</> | ||
); | ||
} |
43 changes: 43 additions & 0 deletions
43
keep-ui/app/(keep)/incidents/[id]/alerts/incident-alert-table-body-skeleton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use client"; | ||
|
||
import { TableBody, TableCell, TableRow } from "@tremor/react"; | ||
import type { Table as ReactTable } from "@tanstack/react-table"; | ||
import { AlertDto } from "@/entities/alerts/model"; | ||
import { getCommonPinningStylesAndClassNames } from "@/shared/ui"; | ||
import Skeleton from "react-loading-skeleton"; | ||
import "react-loading-skeleton/dist/skeleton.css"; | ||
|
||
export function IncidentAlertsTableBodySkeleton({ | ||
table, | ||
pageSize, | ||
}: { | ||
table: ReactTable<AlertDto>; | ||
pageSize: number; | ||
}) { | ||
return ( | ||
<TableBody> | ||
{Array(pageSize) | ||
.fill("") | ||
.map((_, index) => ( | ||
<TableRow key={`row-${index}`}> | ||
{table.getVisibleFlatColumns().map((column) => { | ||
const { style, className } = getCommonPinningStylesAndClassNames( | ||
column, | ||
table.getState().columnPinning.left?.length, | ||
table.getState().columnPinning.right?.length | ||
); | ||
return ( | ||
<TableCell | ||
key={`cell-${column.id}-${index}`} | ||
className={className} | ||
style={style} | ||
> | ||
<Skeleton /> | ||
</TableCell> | ||
); | ||
})} | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
); | ||
} |
Oops, something went wrong.