From 1732550a0e388ed61e968b7330a243659278f696 Mon Sep 17 00:00:00 2001 From: Jay Kumar Date: Wed, 4 Dec 2024 14:52:31 +0000 Subject: [PATCH] feat: mapping sidebar --- .../create-or-update-extraction-rule.tsx | 2 +- .../(keep)/mapping/create-or-edit-mapping.tsx | 34 +++++----- keep-ui/app/(keep)/mapping/layout.tsx | 11 +-- keep-ui/app/(keep)/mapping/mapping.tsx | 68 ++++++++++++++++--- 4 files changed, 75 insertions(+), 40 deletions(-) diff --git a/keep-ui/app/(keep)/extraction/create-or-update-extraction-rule.tsx b/keep-ui/app/(keep)/extraction/create-or-update-extraction-rule.tsx index a6077e551..0e12afe75 100644 --- a/keep-ui/app/(keep)/extraction/create-or-update-extraction-rule.tsx +++ b/keep-ui/app/(keep)/extraction/create-or-update-extraction-rule.tsx @@ -131,7 +131,7 @@ export default function CreateOrUpdateExtractionRule({ return (
Extraction Metadata diff --git a/keep-ui/app/(keep)/mapping/create-or-edit-mapping.tsx b/keep-ui/app/(keep)/mapping/create-or-edit-mapping.tsx index 7d56e29dc..307a2b4e8 100644 --- a/keep-ui/app/(keep)/mapping/create-or-edit-mapping.tsx +++ b/keep-ui/app/(keep)/mapping/create-or-edit-mapping.tsx @@ -143,7 +143,7 @@ export default function CreateOrEditMapping({ editRule, editCallback }: Props) { matchers: selectedLookupAttributes.map((attr) => attr.trim()), rows: mappingType === "csv" ? parsedData : null, }); - clearForm(); + exitEditOrCreateMode(); mutate(); toast.success("Mapping created successfully"); } catch (error) { @@ -165,7 +165,7 @@ export default function CreateOrEditMapping({ editRule, editCallback }: Props) { matchers: selectedLookupAttributes.map((attr) => attr.trim()), rows: mappingType === "csv" ? parsedData : null, }); - exitEditMode(); + exitEditOrCreateMode(); mutate(); toast.success("Mapping updated successfully"); } catch (error) { @@ -173,8 +173,7 @@ export default function CreateOrEditMapping({ editRule, editCallback }: Props) { } }; - // If the mapping is successfully updated or the user cancels the update we exit the editMode and set the editRule in the mapping.tsx to null. - const exitEditMode = async () => { + const exitEditOrCreateMode = () => { editCallback(null); clearForm(); }; @@ -191,7 +190,10 @@ export default function CreateOrEditMapping({ editRule, editCallback }: Props) { }; return ( - + Mapping Metadata
@@ -326,19 +328,15 @@ export default function CreateOrEditMapping({ editRule, editCallback }: Props) {
- {/*If we are in the editMode we need an extra cancel button option for the user*/} - {editMode ? ( - - ) : ( - <> - )} + + +
+ + + handleSidePanelExit(null)} + >

Configure

Add dynamic context to your alerts with mapping rules

- - + +
-
+
{isLoading ? ( ) : mappings && mappings.length > 0 ? ( - + ) : ( )}
-
-
+ + ); }