fix #295 include both save and cancel cases of popup modal; however, for cases when conformance page acting as starting point, bugs are still there

This commit is contained in:
Cindy Chang
2024-05-31 16:04:52 +08:00
parent 0a1eefbaa7
commit 2142399f8c
4 changed files with 57 additions and 26 deletions

View File

@@ -199,6 +199,7 @@ export default {
if(this.$route.name === 'NotFound404') {
return;
}
this.navViewName = this.$route.matched[1].name.toUpperCase();
this.store.filesTag = 'ALL';
switch (this.navViewName) {
@@ -230,6 +231,8 @@ export default {
break;
}
// Frontend is not sure which button will the user press on the modal,
// so here we need to save to a pending state
this.setPendingActivePage(valueToSet);
return valueToSet;
@@ -240,7 +243,6 @@ export default {
async saveModal() {
// 協助判斷 MAP, CONFORMANCE 儲存有「送出」或「取消」。
let isSaved;
// 傳給 Map通知 Sidebar 要關閉。
this.$emitter.emit('saveModal', false);
// 判斷在哪個子頁面
@@ -257,6 +259,7 @@ export default {
isSaved = await saveFilter(this.allMapDataStore.addFilterId);
// 存檔後為 filterID換網址不跳頁使用 push 記錄歷史路由
if(isSaved) {
this.setActivePage('MAP');
await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
}
};
@@ -266,8 +269,9 @@ export default {
isSaved = await saveFilter(this.allMapDataStore.addFilterId);
// 存檔後為 filterID換網址不跳頁使用 push 記錄歷史路由
if(isSaved) {
this.setActivePage('MAP');
await this.$router.push(`/discover/filter/${this.createFilterId}/map`);
}
}
break;
case 'Conformance':
case 'CheckConformance':
@@ -283,9 +287,11 @@ export default {
// 存檔後為 checkID換網址不跳頁使用 push 記錄歷史路由
if(isSaved) {
if(this.conformanceLogId) {
this.setActivePage('CONFORMANCE');
await this.$router.push(`/discover/conformance/log/${this.conformanceLogCreateCheckId}/conformance`);
}
else if(this.conformanceFilterId) {
this.setActivePage('CONFORMANCE');
await this.$router.push(`/discover/conformance/filter/${this.conformanceFilterCreateCheckId}/conformance`);
}
}
@@ -293,7 +299,11 @@ export default {
break;
}
},
...mapActions(PageAdminStore, ['setPendingActivePage', 'setPrevioiusPage'],),
...mapActions(PageAdminStore, [
'setPendingActivePage',
'setPrevioiusPage',
'setActivePage'
],),
},
}
</script>