Skip to content

Commit

Permalink
feat(ui): display a warning when deleting flow with dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Feb 22, 2023
1 parent 4919b5a commit a6c00f7
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 15 deletions.
37 changes: 32 additions & 5 deletions ui/src/mixins/flowTemplateEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,38 @@ export default {
}
},
deleteConfirmMessage() {
return new Promise((resolve) => {
resolve(this.$t("delete confirm", {name: this.item.id}));
});
}
,
if (this.dataType === "template") {
return new Promise((resolve) => {
resolve(this.$t("delete confirm", {name: this.item.id}));
});
}

return this.$http
.get(`/api/v1/flows/${this.flow.namespace}/${this.flow.id}/dependencies`, {params: {destinationOnly: true}})
.then(response => {
let warning = "";

if (response.data && response.data.nodes) {
const deps = response.data.nodes
.filter(n => !(n.namespace === this.flow.namespace && n.id === this.flow.id))
.map(n => "<li>" + n.namespace + ".<code>" + n.id + "</code></li>")
.join("\n");

warning = "<div class=\"el-alert el-alert--warning is-light mt-3\" role=\"alert\">\n" +
"<div class=\"el-alert__content\">\n" +
"<p class=\"el-alert__description\">\n" +
this.$t("dependencies delete flow") +
"<ul>\n" +
deps +
"</ul>\n" +
"</p>\n" +
"</div>\n" +
"</div>"
}

return this.$t("delete confirm", {name: this.item.id}) + warning;
})
},
deleteFile() {
if (this.item) {
const item = this.item;
Expand Down
6 changes: 0 additions & 6 deletions ui/src/override/components/flows/FlowEdit.vue

This file was deleted.

21 changes: 18 additions & 3 deletions ui/src/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,12 @@
"templates exported": "Templates exported",
"flow export": "Are you sure you want to export <code>{flowCount}</code> flow(s)?",
"flows exported": "Flows exported",
"import": "Import"
"import": "Import",
"dependencies": "Dependencies",
"see dependencies": "See dependencies",
"dependencies missing acls": "No permissions on this flow",
"dependencies delete flow": "This flow has dependencies. Deleting it will prevent theses dependencies to be executed!<br /><br /> Here is the list of concerned flows:",
"expand dependencies": "Expand dependencies"
},
"fr": {
"id": "Identifiant",
Expand Down Expand Up @@ -556,7 +561,12 @@
"templates exported": "Templates exportés",
"flow export": "Êtes vous sûr de vouloir exporter <code>{flowCount}</code> flow(s)?",
"flows exported": "Flows exportés",
"import": "Importer"
"import": "Importer",
"dependencies": "Dépendances",
"see dependencies": "Voir les dépendances",
"dependencies missing acls": "Aucune permission sur ce flow",
"dependencies delete flow": "Ce flow a des dépendances, effacer celui-ci empêchera les dépendances de s'exécuter !<br /><br /> Voici la liste des flows concernés :",
"expand dependencies": "Voir les dépendances"
},
"de": {
"id": "Id",
Expand Down Expand Up @@ -835,6 +845,11 @@
"templates exported": "Template exportiert",
"flow export": "Sind Sie sicher, dass Sie <code>{flowCount}</code> Flows exportieren möchten?",
"flows exported": "Flows exportiert",
"import": "Importieren"
"import": "Importieren",
"dependencies": "Abhängigkeiten",
"see dependencies": "Siehe Abhängigkeiten",
"dependencies missing acls": "Keinen Zugriff für diesen Flow",
"dependencies delete flow": "Dieser Flow besitzt Abhängigkeiten. Durch Löschen wird verhindert, dass diese Abhängigkeiten ausgeführt werden können!<br /><br /> Hier ist die Liste der betroffenen Flows:",
"expand dependencies": "Abhängigkeiten erweitern"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,6 @@ public FlowTopologyGraph dependencies(
);
}


@ExecuteOn(TaskExecutors.IO)
@Post(uri = "validate", produces = MediaType.TEXT_JSON, consumes = MediaType.APPLICATION_YAML)
@Operation(tags = {"Flows"}, summary = "Validate a list of flows")
Expand Down

0 comments on commit a6c00f7

Please sign in to comment.