Add dirty configuration flag

This commit is contained in:
D. Berge
2023-11-15 20:04:25 +01:00
parent 62ab06b4a7
commit 9785f4541b

View File

@@ -440,6 +440,8 @@ export default {
}
],
dirty: false,
fileLoadDialog: false,
viewMode: 0,
@@ -451,6 +453,18 @@ export default {
},
watch: {
configuration: {
handler (cur, prev) {
if (cur && prev) {
this.dirty = true;
} else {
this.dirty = false;
}
},
deep: true
},
active (cur, prev) {
if (cur == prev) {
return;
@@ -548,6 +562,7 @@ export default {
}
};
this.configuration = await this.api([url, init]);
this.dirty = false;
},
makeTree (obj, id=0) {
@@ -605,7 +620,12 @@ export default {
if (res && res.id == this.configuration.id) {
// In case the server decided to apply any changes
this.showSnack(["Configuration uploaded to server", "success"]);
this.$nextTick( () => this.configuration = res );
this.$nextTick( () => {
this.configuration = res;
this.$nextTick( () => {
this.dirty = false;
});
});
}
},