Router: change /Discover to /Discover/map/type/filterId
This commit is contained in:
@@ -10,7 +10,7 @@ describe('Save Log and Filter', ()=>{
|
|||||||
cy.url().should('include', 'files');
|
cy.url().should('include', 'files');
|
||||||
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
||||||
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
cy.url().should('include', 'discover/logs'); // 斷言在 discover/logs/:id 路徑
|
cy.url().should('include', 'discover/map/log'); // 斷言在 discover/map/log/:id 路徑
|
||||||
cy.wait(3000)
|
cy.wait(3000)
|
||||||
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
cy.get('#iconFilter').click(); // 選取 Filter sidebar
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ describe('Save Log and Filter', ()=>{
|
|||||||
cy.url().should('include', 'files');
|
cy.url().should('include', 'files');
|
||||||
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
||||||
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
cy.url().should('include', 'discover/logs'); // 斷言在 discover/logs/:id 路徑
|
cy.url().should('include', 'discover/map/log'); // 斷言在 discover/map/log/:id 路徑
|
||||||
cy.wait(3000)
|
cy.wait(3000)
|
||||||
|
|
||||||
// select radio
|
// select radio
|
||||||
@@ -55,7 +55,7 @@ describe('Save Log and Filter', ()=>{
|
|||||||
cy.url().should('include', 'files');
|
cy.url().should('include', 'files');
|
||||||
cy.contains('.fileName', 'random-E2Etesting').dblclick(); // 選取 'random' log 檔
|
cy.contains('.fileName', 'random-E2Etesting').dblclick(); // 選取 'random' log 檔
|
||||||
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
cy.url().should('include', 'discover/filters'); // 斷言在 discover/logs/:id 路徑
|
cy.url().should('include', 'discover/map/filter'); // 斷言在 discover/map/filter/:id 路徑
|
||||||
cy.wait(3000)
|
cy.wait(3000)
|
||||||
|
|
||||||
// Delete All
|
// Delete All
|
||||||
@@ -93,7 +93,7 @@ describe('Save Log and Filter', ()=>{
|
|||||||
cy.url().should('include', 'files');
|
cy.url().should('include', 'files');
|
||||||
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
cy.contains('.fileName', 'random').dblclick(); // 選取 'random' log 檔
|
||||||
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
cy.contains('h2', 'DISCOVER'); // 斷言在 Discover 頁
|
||||||
cy.url().should('include', 'discover/logs'); // 斷言在 discover/logs/:id 路徑
|
cy.url().should('include', 'discover/map/log'); // 斷言在 discover/map/log/:id 路徑
|
||||||
cy.wait(3000)
|
cy.wait(3000)
|
||||||
|
|
||||||
// select radio
|
// select radio
|
||||||
|
|||||||
10
src/components/Discover/Conformance/StatusBar.vue
Normal file
10
src/components/Discover/Conformance/StatusBar.vue
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
<template>
|
||||||
|
<h1>Status bar</h1>
|
||||||
|
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -106,12 +106,12 @@
|
|||||||
import { storeToRefs } from 'pinia';
|
import { storeToRefs } from 'pinia';
|
||||||
import LoadingStore from '@/stores/loading.js';
|
import LoadingStore from '@/stores/loading.js';
|
||||||
import AllMapDataStore from '@/stores/allMapData.js';
|
import AllMapDataStore from '@/stores/allMapData.js';
|
||||||
import ActOccCase from '@/components/Discover/Filter/ActOccCase.vue';
|
import ActOccCase from '@/components/Discover/Map/Filter/ActOccCase.vue';
|
||||||
import ActOcc from '@/components/Discover/Filter/ActOcc.vue';
|
import ActOcc from '@/components/Discover/Map/Filter/ActOcc.vue';
|
||||||
import ActAndSeq from '@/components/Discover/Filter/ActAndSeq.vue';
|
import ActAndSeq from '@/components/Discover/Map/Filter/ActAndSeq.vue';
|
||||||
import Funnel from '@/components/Discover/Filter/Funnel.vue';
|
import Funnel from '@/components/Discover/Map/Filter/Funnel.vue';
|
||||||
import Trace from '@/components/Discover/Filter/Trace.vue';
|
import Trace from '@/components/Discover/Map/Filter/Trace.vue';
|
||||||
import Timeframes from '@/components/Discover/Filter/Timeframes.vue';
|
import Timeframes from '@/components/Discover/Map/Filter/Timeframes.vue';
|
||||||
import getMoment from 'moment';
|
import getMoment from 'moment';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@@ -5,13 +5,15 @@
|
|||||||
<div class="flex flex-1 items-center">
|
<div class="flex flex-1 items-center">
|
||||||
<!-- 回 Files 頁 -->
|
<!-- 回 Files 頁 -->
|
||||||
<router-link to class="mr-4" v-if="navViewName !== 'FILES'" id="backPage">
|
<router-link to class="mr-4" v-if="navViewName !== 'FILES'" id="backPage">
|
||||||
<span @click="$router.back(-1)" class="material-symbols-outlined text-neutral-10 leading-loose">
|
<!-- $router.push({ name: 'Files' }) -->
|
||||||
|
<!-- $router.back(-1) -->
|
||||||
|
<span @click="$router.push({ name: 'Files' })" class="material-symbols-outlined text-neutral-10 leading-loose">
|
||||||
arrow_back
|
arrow_back
|
||||||
</span>
|
</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
<h2 class="mr-14 py-3 text-2xl font-black text-neutral-10">{{ navViewName }}</h2>
|
<h2 class="mr-14 py-3 text-2xl font-black text-neutral-10">{{ navViewName }}</h2>
|
||||||
<ul class="flex justify-center items-center space-x-4 text-xl font-semibold text-neutral-300 cursor-pointer">
|
<ul class="flex justify-center items-center space-x-4 text-xl font-semibold text-neutral-300 cursor-pointer">
|
||||||
<li @click="switchNavItem($event)" v-for="(item, index) in navViewData[navViewName]" :key="index">{{ item }}</li>
|
<li @click="switchNavItem($event, index)" v-for="(item, index) in navViewData[navViewName]" :key="index">{{ item }}</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<!-- Files Page: Search and Upload -->
|
<!-- Files Page: Search and Upload -->
|
||||||
@@ -61,7 +63,7 @@ export default {
|
|||||||
// FILES: ['ALL', 'DISCOVER', 'COMPARE', 'DESIGN'],
|
// FILES: ['ALL', 'DISCOVER', 'COMPARE', 'DESIGN'],
|
||||||
FILES: ['ALL', 'DISCOVER'],
|
FILES: ['ALL', 'DISCOVER'],
|
||||||
// DISCOVER: ['MAP', 'CONFORMANCE', 'PERFORMANCE', 'DATA']
|
// DISCOVER: ['MAP', 'CONFORMANCE', 'PERFORMANCE', 'DATA']
|
||||||
DISCOVER: ['MAP']
|
DISCOVER: ['MAP', 'CONFORMANCE']
|
||||||
},
|
},
|
||||||
navViewName: 'FILES',
|
navViewName: 'FILES',
|
||||||
};
|
};
|
||||||
@@ -92,8 +94,7 @@ export default {
|
|||||||
savedSuccessfully
|
savedSuccessfully
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
let filterId = this.$route.params.filterId;
|
if(this.$route.params.type === 'filter') this.createfilterId= this.$route.params.fileId;
|
||||||
this.createfilterId = filterId;
|
|
||||||
this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false;
|
this.showNavbarBreadcrumb = this.$route.matched[0].name !== ('AuthContainer')? true : false;
|
||||||
this.getNavViewName();
|
this.getNavViewName();
|
||||||
},
|
},
|
||||||
@@ -102,12 +103,23 @@ export default {
|
|||||||
* switch navbar item
|
* switch navbar item
|
||||||
*/
|
*/
|
||||||
switchNavItem(event) {
|
switchNavItem(event) {
|
||||||
this.store.filesTag = event.target.innerText;
|
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 }})
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
getNavViewName() {
|
getNavViewName() {
|
||||||
this.navViewName = this.$route.name.toUpperCase();
|
this.navViewName = this.$route.matched[1].name.toUpperCase();
|
||||||
if(this.navViewName === 'DISCOVERLOG' || this.navViewName === 'DISCOVERFILTER') this.navViewName = 'DISCOVER';
|
|
||||||
|
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Save button' modal
|
* Save button' modal
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import Swal from 'sweetalert2'
|
import Swal from 'sweetalert2';
|
||||||
|
import AllMapDataStore from '@/stores/allMapData.js';
|
||||||
|
|
||||||
const customClass = {
|
const customClass = {
|
||||||
htmlContainer: '!w-[564px]',
|
htmlContainer: '!w-[564px]',
|
||||||
@@ -51,7 +52,8 @@ export async function savedSuccessfully(value) {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function leaveFilter(next, addFilterId) {
|
export async function leaveFilter(next, addFilterId, toPath) {
|
||||||
|
const allMapDataStore = AllMapDataStore();
|
||||||
const result = await Swal.fire({
|
const result = await Swal.fire({
|
||||||
title: 'ARE YOU SURE TO LEAVE MAP?',
|
title: 'ARE YOU SURE TO LEAVE MAP?',
|
||||||
html: 'Filter settings have not been saved.</br>Click “Save as” to save filtered results, “OK” to leave map.',
|
html: 'Filter settings have not been saved.</br>Click “Save as” to save filtered results, “OK” to leave map.',
|
||||||
@@ -67,10 +69,11 @@ export async function leaveFilter(next, addFilterId) {
|
|||||||
})
|
})
|
||||||
if(result.isConfirmed) {
|
if(result.isConfirmed) {
|
||||||
await saveFilter(addFilterId)
|
await saveFilter(addFilterId)
|
||||||
next();
|
next(toPath);
|
||||||
}
|
}
|
||||||
else if(result.dismiss === 'cancel') {
|
else if(result.dismiss === 'cancel') {
|
||||||
next();
|
allMapDataStore.tempFilterId = null;
|
||||||
|
next(toPath);
|
||||||
}
|
}
|
||||||
else if(result.dismiss === 'backdrop') {
|
else if(result.dismiss === 'backdrop') {
|
||||||
next(false);
|
next(false);
|
||||||
|
|||||||
@@ -3,7 +3,8 @@ import AuthContainer from '@/views/AuthContainer.vue';
|
|||||||
import MainContainer from '@/views/MainContainer.vue';
|
import MainContainer from '@/views/MainContainer.vue';
|
||||||
import Login from '@/views/Login/index.vue';
|
import Login from '@/views/Login/index.vue';
|
||||||
import Files from '@/views/Files/index.vue';
|
import Files from '@/views/Files/index.vue';
|
||||||
import Discover from '@/views/Discover/index.vue';
|
import Map from '@/views/Discover/Map/index.vue';
|
||||||
|
import Conformance from '@/views/Discover/Conformance/index.vue';
|
||||||
import MemberArea from '@/views/MemberArea/index.vue';
|
import MemberArea from '@/views/MemberArea/index.vue';
|
||||||
import NotFound404 from '@/views/NotFound404.vue';
|
import NotFound404 from '@/views/NotFound404.vue';
|
||||||
|
|
||||||
@@ -40,14 +41,20 @@ const routes = [
|
|||||||
component: Files,
|
component: Files,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: "/discover/logs/:logId",
|
path: "/discover",
|
||||||
name: "DiscoverLog",
|
name: "Discover",
|
||||||
component: Discover,
|
children: [
|
||||||
},
|
{
|
||||||
{
|
path: "/discover/map/:type/:fileId",
|
||||||
path: "/discover/filters/:filterId",
|
name: "Map",
|
||||||
name: "DiscoverFilter",
|
component: Map,
|
||||||
component: Discover,
|
},
|
||||||
|
{
|
||||||
|
path: "/discover/conformance/:type/:fileId",
|
||||||
|
name: "Conformance",
|
||||||
|
component: Conformance,
|
||||||
|
},
|
||||||
|
]
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|||||||
29
src/views/Discover/Conformance/index.vue
Normal file
29
src/views/Discover/Conformance/index.vue
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<template>
|
||||||
|
<StatusBar></StatusBar>
|
||||||
|
<h1>Conformance</h1>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
import { storeToRefs } from 'pinia';
|
||||||
|
import LoadingStore from '@/stores/loading.js';
|
||||||
|
import StatusBar from '@/components/Discover/Conformance/StatusBar.vue';
|
||||||
|
|
||||||
|
export default {
|
||||||
|
setup() {
|
||||||
|
const loadingStore = LoadingStore();
|
||||||
|
const { isLoading } = storeToRefs(loadingStore);
|
||||||
|
|
||||||
|
return { isLoading }
|
||||||
|
},
|
||||||
|
components: {
|
||||||
|
StatusBar,
|
||||||
|
},
|
||||||
|
async created() {
|
||||||
|
let logId;
|
||||||
|
if(this.$route.params.type === 'log') logId = this.$route.params.fileId;
|
||||||
|
console.log(logId);
|
||||||
|
|
||||||
|
// this.isLoading = true;
|
||||||
|
this.isLoading = false;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
@@ -58,10 +58,10 @@ import { storeToRefs } from 'pinia';
|
|||||||
import LoadingStore from '@/stores/loading.js';
|
import LoadingStore from '@/stores/loading.js';
|
||||||
import AllMapDataStore from '@/stores/allMapData.js';
|
import AllMapDataStore from '@/stores/allMapData.js';
|
||||||
import cytoscapeMap from '@/module/cytoscapeMap.js';
|
import cytoscapeMap from '@/module/cytoscapeMap.js';
|
||||||
import SidebarView from '@/components/Discover/SidebarView.vue';
|
import SidebarView from '@/components/Discover/Map/SidebarView.vue';
|
||||||
import SidebarState from '@/components/Discover/SidebarState.vue';
|
import SidebarState from '@/components/Discover/Map/SidebarState.vue';
|
||||||
import SidebarTraces from '@/components/Discover/SidebarTraces.vue';
|
import SidebarTraces from '@/components/Discover/Map/SidebarTraces.vue';
|
||||||
import SidebarFilter from '@/components/Discover/SidebarFilter.vue';
|
import SidebarFilter from '@/components/Discover/Map/SidebarFilter.vue';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
setup() {
|
setup() {
|
||||||
@@ -293,11 +293,13 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
async created() {
|
async created() {
|
||||||
// Log 檔前往 DiscoverLog 頁, Filter 檔前往 DiscoverFilter 頁
|
// 先 loading 再執行以下程式
|
||||||
if(this.$route.name === 'DiscoverLog'){
|
this.isLoading = true;
|
||||||
this.logId = this.$route.params.logId;
|
// Log 檔前往 Map Log 頁, Filter 檔前往 Map Filter 頁
|
||||||
}else if(this.$route.name === 'DiscoverFilter') {
|
if(this.$route.params.type === 'log'){
|
||||||
this.createFilterId = this.$route.params.filterId;
|
this.logId = this.$route.params.fileId;
|
||||||
|
}else if(this.$route.params.type === 'filter') {
|
||||||
|
this.createFilterId = this.$route.params.fileId;
|
||||||
// 取得 logID 和上次儲存的 Funnel
|
// 取得 logID 和上次儲存的 Funnel
|
||||||
await this.allMapDataStore.fetchFunnel(this.createFilterId);
|
await this.allMapDataStore.fetchFunnel(this.createFilterId);
|
||||||
this.isRuleData = await Array.from(this.temporaryData);
|
this.isRuleData = await Array.from(this.temporaryData);
|
||||||
@@ -310,8 +312,7 @@ export default {
|
|||||||
this.createCy(this.mapType);
|
this.createCy(this.mapType);
|
||||||
await this.allMapDataStore.getFilterParams();
|
await this.allMapDataStore.getFilterParams();
|
||||||
|
|
||||||
this.isLoading = true;
|
// 執行完後才取消 loading
|
||||||
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
||||||
this.isLoading = false;
|
this.isLoading = false;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -132,18 +132,20 @@
|
|||||||
* @param {object} file
|
* @param {object} file
|
||||||
*/
|
*/
|
||||||
enterDiscover(file){
|
enterDiscover(file){
|
||||||
let logId;
|
let type;
|
||||||
let filterId;
|
let fileId;
|
||||||
|
|
||||||
if(file.fileType === 'Log'){
|
if(file.fileType === 'Log'){
|
||||||
this.createFilterId = null;
|
this.createFilterId = null;
|
||||||
logId = file.id;
|
fileId = file.id;
|
||||||
this.$router.push({name: 'DiscoverLog', params: { logId: logId }})
|
type = 'log';
|
||||||
|
this.$router.push({name: 'Map', params: { type: type, fileId: fileId }})
|
||||||
}
|
}
|
||||||
else if(file.fileType === 'Filter') {
|
else if(file.fileType === 'Filter') {
|
||||||
this.createFilterId = file.id;
|
this.createFilterId = file.id;
|
||||||
filterId = file.id;
|
fileId = file.id;
|
||||||
this.$router.push({name: 'DiscoverFilter', params: { filterId: filterId }})
|
type = 'filter';
|
||||||
|
this.$router.push({name: 'Map', params: { type: type, fileId: fileId }})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -27,17 +27,17 @@ export default {
|
|||||||
const loadingStore = LoadingStore();
|
const loadingStore = LoadingStore();
|
||||||
const allMapDataStore = AllMapDataStore();
|
const allMapDataStore = AllMapDataStore();
|
||||||
const { checkLogin } = loginStore;
|
const { checkLogin } = loginStore;
|
||||||
const { tempFilterId, createFilterId, temporaryData, postRuleData } = storeToRefs(allMapDataStore);
|
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } = storeToRefs(allMapDataStore);
|
||||||
|
|
||||||
return { checkLogin, loadingStore, temporaryData, tempFilterId, createFilterId, postRuleData, allMapDataStore };
|
return { checkLogin, loadingStore, temporaryData, tempFilterId, createFilterId, postRuleData, ruleData, allMapDataStore };
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
$route: function(to, from) {
|
$route: function(to, from) {
|
||||||
// 離開 DiscoverLog 頁要將 Funnel 的規則刪除, DiscoverFilter 會帶上次儲存的 Funnel, 所以不用錯做
|
// 離開 Map Log 頁要將 Funnel 的規則刪除, Map Filter 會帶上次儲存的 Funnel, 所以不用做
|
||||||
if(to.name !== 'DiscoverLog') {
|
if(from.name === 'Map' && from.params.type === 'log') {
|
||||||
this.tempFilterId = null;
|
this.tempFilterId = null;
|
||||||
this.temporaryData = []
|
this.temporaryData = [];
|
||||||
this.postRuleData = []
|
this.postRuleData = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -61,8 +61,8 @@ export default {
|
|||||||
},
|
},
|
||||||
beforeRouteUpdate(to, from, next) {
|
beforeRouteUpdate(to, from, next) {
|
||||||
// 離開 Discover 頁時判斷是否有無資料和需要存檔
|
// 離開 Discover 頁時判斷是否有無資料和需要存檔
|
||||||
if ((from.name === 'DiscoverLog' || from.name === 'DiscoverFilter') && this.tempFilterId) {
|
if ((from.name === 'Map') && this.tempFilterId) {
|
||||||
leaveFilter(next, this.allMapDataStore.addFilterId)
|
leaveFilter(next, this.allMapDataStore.addFilterId, to.path)
|
||||||
} else {
|
} else {
|
||||||
next();
|
next();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user