This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(DataMapper): Show a confirmation dialog when DataMapper step is t…
…o be deleted, with also offering an option to delete associated mapping file (XSLT) Fixes: https://github.com/KaotoIO/kaoto-datamapper-integration/issues/97
- Loading branch information
1 parent
9365cea
commit 0cd189e
Showing
16 changed files
with
147 additions
and
33 deletions.
There are no files selected for viewing
14 changes: 10 additions & 4 deletions
14
packages/ui/src/components/DataMapper/on-delete-datamapper.ts
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
import { DataMapperMetadataService } from '../../services/datamapper-metadata.service'; | ||
import { IMetadataApi } from '../../providers'; | ||
import { ACTION_INDEX_DELETE_STEP_AND_FILE, IMetadataApi } from '../../providers'; | ||
import { IVisualizationNode } from '../../models'; | ||
|
||
export const onDeleteDataMapper = (api: IMetadataApi, vizNode: IVisualizationNode) => { | ||
export const onDeleteDataMapper = async ( | ||
api: IMetadataApi, | ||
vizNode: IVisualizationNode, | ||
modalAnswer: number | undefined, | ||
) => { | ||
const metadataId = DataMapperMetadataService.getDataMapperMetadataId(vizNode); | ||
DataMapperMetadataService.deleteMetadata(api, metadataId); | ||
// TODO DataMapperMetadataService.deleteXsltFile(api, metadataId); | ||
if (modalAnswer === ACTION_INDEX_DELETE_STEP_AND_FILE) { | ||
await DataMapperMetadataService.deleteXsltFile(api, metadataId); | ||
} | ||
await DataMapperMetadataService.deleteMetadata(api, metadataId); | ||
}; |
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
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
31 changes: 28 additions & 3 deletions
31
packages/ui/src/components/Visualization/Custom/ContextMenu/item-delete-helper.ts
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 |
---|---|---|
@@ -1,14 +1,39 @@ | ||
import { IVisualizationNode } from '../../../../models'; | ||
import { IRegisteredInteractionAddon } from '../../../registers/interactions/node-interaction-addon.model'; | ||
import { | ||
IModalCustomization, | ||
IRegisteredInteractionAddon, | ||
} from '../../../registers/interactions/node-interaction-addon.model'; | ||
|
||
export const processNodeInteractionAddonRecursively = ( | ||
parentVizNode: IVisualizationNode, | ||
modalAnswer: number | undefined, | ||
getAddons: (vizNode: IVisualizationNode) => IRegisteredInteractionAddon[], | ||
) => { | ||
parentVizNode.getChildren()?.forEach((child) => { | ||
processNodeInteractionAddonRecursively(child, getAddons); | ||
processNodeInteractionAddonRecursively(child, modalAnswer, getAddons); | ||
}); | ||
getAddons(parentVizNode).forEach((addon) => { | ||
addon.callback(parentVizNode); | ||
addon.callback(parentVizNode, modalAnswer); | ||
}); | ||
}; | ||
|
||
export const findModalCustomizationRecursively = ( | ||
parentVizNode: IVisualizationNode, | ||
getAddons: (vizNode: IVisualizationNode) => IRegisteredInteractionAddon[], | ||
) => { | ||
const modalCustomizations: IModalCustomization[] = []; | ||
// going breadth-first while addon processes depth-first... do we want? | ||
getAddons(parentVizNode).forEach((addon) => { | ||
if (addon.modalCustomization && !modalCustomizations.includes(addon.modalCustomization)) { | ||
modalCustomizations.push(addon.modalCustomization); | ||
} | ||
}); | ||
parentVizNode.getChildren()?.forEach((child) => { | ||
findModalCustomizationRecursively(child, getAddons).forEach((custom) => { | ||
if (!modalCustomizations.includes(custom)) { | ||
modalCustomizations.push(custom); | ||
} | ||
}); | ||
}); | ||
return modalCustomizations; | ||
}; |
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
9 changes: 8 additions & 1 deletion
9
packages/ui/src/components/registers/interactions/node-interaction-addon.model.ts
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