🚧 Added Vuex dirty state flag as central source of truth for if there are unsaved changes

This commit is contained in:
Rupenieks
2020-09-01 16:06:08 +02:00
parent 66b76d16ee
commit 3e1ada7c1a
8 changed files with 92 additions and 49 deletions

View File

@@ -398,7 +398,7 @@ export default mixins(
return;
}
this.$store.commit('setWorkflowName', workflowName);
this.$store.commit('setWorkflowName', {newName: workflowName, setStateDirty: true});
this.$showMessage({
title: 'Workflow renamed',
@@ -440,18 +440,15 @@ export default mixins(
saveAs(blob, workflowName + '.json');
} else if (key === 'workflow-save') {
console.log("saving......");
this.saveCurrentWorkflow();
} else if (key === 'workflow-save-as') {
console.log("saving......");
this.saveCurrentWorkflow(true);
} else if (key === 'help-about') {
this.aboutDialogVisible = true;
} else if (key === 'workflow-settings') {
this.workflowSettingsDialogVisible = true;
} else if (key === 'workflow-new') {
const workflowId = this.$store.getters.workflowId;
const result = await this.dataHasChanged(workflowId);
const result = this.$store.getters.getStateIsDirty;
if(result) {
const importConfirm = await this.confirmMessage(`When you switch workflows your current workflow changes will be lost.`, 'Save your Changes?', 'warning', 'Yes, switch workflows and forget changes');
if (importConfirm === true) {