Discover: Filters Save done.
This commit is contained in:
@@ -68,9 +68,9 @@ export default {
|
||||
const loadingStore = LoadingStore();
|
||||
const allMapDataStore = AllMapDataStore();
|
||||
const { isLoading } = storeToRefs(loadingStore);
|
||||
const { processMap, bpmn, stats, insights, traces, traceTaskSeq, cases, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, temporaryData, isRuleData, ruleData, createFilterId } = storeToRefs(allMapDataStore);
|
||||
const { processMap, bpmn, stats, insights, traces, traceTaskSeq, cases, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, temporaryData, isRuleData, ruleData, logId, createFilterId } = storeToRefs(allMapDataStore);
|
||||
|
||||
return { isLoading, processMap, bpmn, stats, insights, traces, traceTaskSeq, cases, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, createFilterId, temporaryData, isRuleData, ruleData, allMapDataStore}
|
||||
return { isLoading, processMap, bpmn, stats, insights, traces, traceTaskSeq, cases, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, logId, createFilterId, temporaryData, isRuleData, ruleData, allMapDataStore}
|
||||
},
|
||||
components: {
|
||||
SidebarView,
|
||||
@@ -294,15 +294,22 @@ export default {
|
||||
},
|
||||
},
|
||||
async created() {
|
||||
this.allMapDataStore.logId = this.$route.params.logId;
|
||||
// Log 檔前往 DiscoverLog 頁, Filter 檔前往 DiscoverFilter 頁
|
||||
if(this.$route.name === 'DiscoverLog'){
|
||||
this.logId = this.$route.params.logId;
|
||||
}else if(this.$route.name === 'DiscoverFilter') {
|
||||
this.createFilterId = this.$route.params.filterId;
|
||||
// 取得 logID 和上次儲存的 Funnel
|
||||
await this.allMapDataStore.fetchFunnel(this.createFilterId);
|
||||
this.isRuleData = await Array.from(this.temporaryData);
|
||||
this.ruleData = await this.isRuleData.map(e => this.$refs.sidevarFilterRef.setRule(e));
|
||||
}
|
||||
// 取得 logId 後才 call api
|
||||
await this.allMapDataStore.getAllMapData();
|
||||
await this.allMapDataStore.getAllTrace();
|
||||
await this.allMapDataStore.getTraceDetail();
|
||||
this.createCy(this.mapType);
|
||||
await this.allMapDataStore.getFilterParams();
|
||||
await this.allMapDataStore.fetchFunnel(this.createFilterId)
|
||||
this.isRuleData = await Array.from(this.temporaryData);
|
||||
this.ruleData = await this.isRuleData.map(e => this.$refs.sidevarFilterRef.setRule(e));
|
||||
|
||||
this.isLoading = true;
|
||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
||||
|
||||
@@ -133,16 +133,19 @@
|
||||
*/
|
||||
enterDiscover(file){
|
||||
let logId;
|
||||
let filterId;
|
||||
|
||||
if(file.fileType === 'Log'){
|
||||
logId = file.id;
|
||||
this.createFilterId = null;
|
||||
logId = file.id;
|
||||
this.$router.push({name: 'DiscoverLog', params: { logId: logId }})
|
||||
}
|
||||
else if(file.fileType === 'Filter') {
|
||||
this.createFilterId = file.id;
|
||||
logId = file.log.id;
|
||||
filterId = file.id;
|
||||
this.$router.push({name: 'DiscoverFilter', params: { filterId: filterId }})
|
||||
}
|
||||
this.$router.push({ name: 'Discover', params: { logId: logId }});
|
||||
},
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.store.fetchEventLog();
|
||||
|
||||
@@ -33,7 +33,8 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
$route: function(to, from) {
|
||||
if(to.name !== 'Discover') {
|
||||
// 離開 DiscoverLog 頁要將 Funnel 的規則刪除, DiscoverFilter 會帶上次儲存的 Funnel, 所以不用錯做
|
||||
if(to.name !== 'DiscoverLog') {
|
||||
this.tempFilterId = null;
|
||||
this.temporaryData = []
|
||||
this.postRuleData = []
|
||||
@@ -60,7 +61,7 @@ export default {
|
||||
},
|
||||
beforeRouteUpdate(to, from, next) {
|
||||
// 離開 Discover 頁時判斷是否有無資料和需要存檔
|
||||
if (from.name === 'Discover' && this.tempFilterId) {
|
||||
if ((from.name === 'DiscoverLog' || from.name === 'DiscoverFilter') && this.tempFilterId) {
|
||||
leaveFilter(next, this.allMapDataStore.addFilterId)
|
||||
} else {
|
||||
next();
|
||||
|
||||
Reference in New Issue
Block a user