Skip to content

Commit

Permalink
chore(ui): refactor flow Edit
Browse files Browse the repository at this point in the history
  • Loading branch information
tchiotludo committed Feb 18, 2022
1 parent cd45aa0 commit 3b83ef7
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 13 deletions.
2 changes: 1 addition & 1 deletion ui/src/components/flows/FlowSource.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>
<script>
import {mapGetters} from "vuex";
import FlowEdit from "./FlowEdit";
import FlowEdit from "override/components/flows/FlowEdit";
export default {
name: "FlowSource",
components: {FlowEdit},
Expand Down
33 changes: 21 additions & 12 deletions ui/src/mixins/flowTemplateEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,21 +100,30 @@ export default {
};
}
},
deleteConfirmMessage() {
return new Promise((resolve) => {
resolve(this.$t("delete confirm", {name: this.item.id}));
});
},
deleteFile() {
if (this.item) {
const item = this.item;
this.$toast()
.confirm(this.$t("delete confirm", {name: item.id}), () => {
return this.$store
.dispatch(`${this.dataType}/delete${this.dataType.capitalize()}`, item)
.then(() => {
return this.$router.push({
name: this.dataType + "s/list"
});
})
.then(() => {
this.$toast().deleted(item.id);
})

this.deleteConfirmMessage()
.then(message => {
this.$toast()
.confirm(message, () => {
return this.$store
.dispatch(`${this.dataType}/delete${this.dataType.capitalize()}`, item)
.then(() => {
return this.$router.push({
name: this.dataType + "s/list"
});
})
.then(() => {
this.$toast().deleted(item.id);
})
});
});
}
},
Expand Down
6 changes: 6 additions & 0 deletions ui/src/override/components/flows/FlowEdit.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
import FlowEdit from "../../../components/flows/FlowEdit";
export default {
extends: FlowEdit,
};
</script>

0 comments on commit 3b83ef7

Please sign in to comment.