From c26a1dfee75276f528ab11bdfa1282c365fbb6af Mon Sep 17 00:00:00 2001 From: chiayin Date: Thu, 30 Nov 2023 12:19:46 +0800 Subject: [PATCH] feat: Conformance Save switchNavItem done. --- .../Conformance/ConformanceSidebar.vue | 2 +- src/components/Navbar.vue | 25 +++++++----- src/views/Discover/Conformance/index.vue | 3 +- src/views/Discover/Map/index.vue | 39 ++++++++++++++----- 4 files changed, 48 insertions(+), 21 deletions(-) diff --git a/src/components/Discover/Conformance/ConformanceSidebar.vue b/src/components/Discover/Conformance/ConformanceSidebar.vue index 942ab04..7096e6b 100644 --- a/src/components/Discover/Conformance/ConformanceSidebar.vue +++ b/src/components/Discover/Conformance/ConformanceSidebar.vue @@ -608,7 +608,7 @@ export default { break; } } - }, 200); + }, 300); } } }, diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index 4a373d4..27999bd 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -114,16 +114,21 @@ export default { let type; let fileId; - if(this.navViewName === 'FILES') { - this.store.filesTag = event.target.innerText; - } else if(this.navViewName === 'DISCOVER') { - type = this.$route.params.type; - fileId = this.$route.params.fileId; - if(event.target.innerText === 'MAP') { - this.$router.push({name: 'Map', params: { type: type, fileId: fileId }}) - } else if(event.target.innerText === 'CONFORMANCE') { - this.$router.push({name: 'Conformance', params: { type: type, fileId: fileId }}) - } + switch (this.navViewName) { + case 'FILES': + this.store.filesTag = event.target.innerText; + break; + case 'DISCOVER': + type = this.$route.params.type; + fileId = this.$route.params.fileId; + if(event.target.innerText === 'MAP') { + if(type === 'rule') this.$router.push({name: 'CheckMap'}); + else this.$router.push({name: 'Map', params: { type: type, fileId: fileId }}); + } else if(event.target.innerText === 'CONFORMANCE') { + if(type === 'rule') this.$router.push({name: 'CheckConformance'}); + else this.$router.push({name: 'Conformance', params: { type: type, fileId: fileId }}); + } + break; } }, getNavViewName() { diff --git a/src/views/Discover/Conformance/index.vue b/src/views/Discover/Conformance/index.vue index cfa97eb..5954163 100644 --- a/src/views/Discover/Conformance/index.vue +++ b/src/views/Discover/Conformance/index.vue @@ -70,7 +70,8 @@ export default { break; } await this.conformanceStore.getConformanceParams(); - this.isLoading = false; + // 給 rule 檔取得 ShowBar 一些時間 + setTimeout(() => this.isLoading = false, 500); }, mounted() { this.selectedRuleType = 'Have activity'; diff --git a/src/views/Discover/Map/index.vue b/src/views/Discover/Map/index.vue index d35d6c6..3bf12f1 100644 --- a/src/views/Discover/Map/index.vue +++ b/src/views/Discover/Map/index.vue @@ -71,6 +71,7 @@ export default { return { isLoading, processMap, bpmn, stats, insights, traceId, traces, baseTraces, baseTraceId, filterTasks, filterStartToEnd, filterEndToStart, filterTimeframe, filterTrace, logId, baseLogId, createFilterId, temporaryData, isRuleData, ruleData, allMapDataStore, cases } }, + props:['type', 'checkType', 'checkId', 'checkFileId'], // 來自 router 的 props components: { SidebarView, SidebarState, @@ -327,18 +328,38 @@ export default { }, }, async created() { + const routeParams = this.$route.params; + // 先 loading 再執行以下程式 this.isLoading = true; // Log 檔前往 Map Log 頁, Filter 檔前往 Map Filter 頁 - if(this.$route.params.type === 'log'){ - this.logId = this.$route.params.fileId; - this.baseLogId = this.$route.params.fileId; - }else if(this.$route.params.type === 'filter') { - this.createFilterId = this.$route.params.fileId; - // 取得 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)); + switch (routeParams.type) { + case 'log': + this.logId = routeParams.fileId; + this.baseLogId = routeParams.fileId; + break; + case 'filter': + this.createFilterId = routeParams.fileId; + // 取得 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)); + break; + case 'rule': + switch (this.checkType) { + case 'log': + this.logId = this.checkFileId; + this.baseLogId = this.checkFileId; + break; + case 'filter': + this.createFilterId = this.checkFileId; + // 取得 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)); + break; + } + break; } // 取得 logId 後才 call api await this.allMapDataStore.getAllMapData();