fix first index of mapGraphPathToInsight nested object
This commit is contained in:
@@ -273,7 +273,7 @@ export default {
|
|||||||
|
|
||||||
const activeTrace = ref(0);
|
const activeTrace = ref(0);
|
||||||
const currentMapFile = computed(() => pageAdmin.currentMapFile);
|
const currentMapFile = computed(() => pageAdmin.currentMapFile);
|
||||||
const clickedPathListIndex = ref(undefined);
|
const clickedPathListIndex = ref(0);
|
||||||
const isBPMNOn = computed(() => mapPathStore.isBPMNOn);
|
const isBPMNOn = computed(() => mapPathStore.isBPMNOn);
|
||||||
|
|
||||||
const onActiveTraceClick = (clickedActiveTraceIndex) => {
|
const onActiveTraceClick = (clickedActiveTraceIndex) => {
|
||||||
@@ -284,7 +284,7 @@ export default {
|
|||||||
|
|
||||||
const onPathOptionClick = (clickedPath) => {
|
const onPathOptionClick = (clickedPath) => {
|
||||||
clickedPathListIndex.value = clickedPath;
|
clickedPathListIndex.value = clickedPath;
|
||||||
mapPathStore.highlightClickedPath(activeTrace.value, clickedPathListIndex.value);
|
mapPathStore.highlightClickedPath(activeTrace.value, clickedPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
const onResetTraceBtnClick = () => {
|
const onResetTraceBtnClick = () => {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ export default defineStore('useMapPathStore', {
|
|||||||
this.cytoscape = cytoscape;
|
this.cytoscape = cytoscape;
|
||||||
},
|
},
|
||||||
async createPaths() {
|
async createPaths() {
|
||||||
this.startNode = this.cytoscape.nodes().filter(function(elem) {
|
this.startNode = this.cytoscape?.nodes().filter(function(elem) {
|
||||||
return elem.data('label').toLocaleLowerCase() === 'start';
|
return elem.data('label').toLocaleLowerCase() === 'start';
|
||||||
});
|
});
|
||||||
// Depth First Search from the starting node
|
// Depth First Search from the starting node
|
||||||
@@ -85,7 +85,7 @@ export default defineStore('useMapPathStore', {
|
|||||||
// 從 1 開始而不是從 0 開始是因為 0 的label是start字串
|
// 從 1 開始而不是從 0 開始是因為 0 的label是start字串
|
||||||
const matchResult = this.depthFirstSearchMatchTwoPaths(curPath, 1, curButton, listIndex, nodeIndex)
|
const matchResult = this.depthFirstSearchMatchTwoPaths(curPath, 1, curButton, listIndex, nodeIndex)
|
||||||
if(matchResult){
|
if(matchResult){
|
||||||
this.mapGraphPathToInsight[whichPath] = {
|
this.mapGraphPathToInsight[i] = {
|
||||||
[listIndex] : {
|
[listIndex] : {
|
||||||
pathByNode: [...curPath],
|
pathByNode: [...curPath],
|
||||||
pathByEdge: [...curPathByEdge],
|
pathByEdge: [...curPathByEdge],
|
||||||
@@ -175,20 +175,19 @@ export default defineStore('useMapPathStore', {
|
|||||||
|
|
||||||
clickedEdge.addClass('highlight-edge');
|
clickedEdge.addClass('highlight-edge');
|
||||||
},
|
},
|
||||||
highlightMostFrequentPath() {
|
async highlightMostFrequentPath() {
|
||||||
for(let whichPath = 0; whichPath < this.allPaths.length; whichPath++) {
|
for(let buttonIter = 0; buttonIter < INSIGHTS_FIELDS_AND_LABELS.length; buttonIter++) {
|
||||||
// 有可能遇到兩個以上的most frequent paths,然而我們只取一個path點亮
|
// 有可能遇到兩個以上的most frequent paths,然而我們只取一個path點亮
|
||||||
if (this.mapGraphPathToInsight[whichPath]) {
|
if (this.mapGraphPathToInsight[buttonIter]) {
|
||||||
const keyLength = Object.keys(this.mapGraphPathToInsight[whichPath]).length;
|
const keyLength = Object.keys(this.mapGraphPathToInsight[buttonIter]).length;
|
||||||
for(let i = 0; i < keyLength; i++) {
|
for(let i = 0; i < keyLength; i++) {
|
||||||
if(this.mapGraphPathToInsight[whichPath][i]?.pathType === 'most_freq_traces'){
|
if(this.mapGraphPathToInsight[buttonIter][i]?.pathType === 'most_freq_traces'){
|
||||||
console.log('found', );
|
await this.mapGraphPathToInsight[buttonIter][i].pathByNode.map(async(nodeToHighlight) => {
|
||||||
this.mapGraphPathToInsight[whichPath][i].pathByNode.map(nodeToHighlight => {
|
await nodeToHighlight.data('nodeImageUrl', ImgCapsulesGlow[nodeToHighlight.data('level')]);
|
||||||
nodeToHighlight.data('nodeImageUrl', ImgCapsulesGlow[nodeToHighlight.data('level')]);
|
|
||||||
});
|
});
|
||||||
this.mapGraphPathToInsight[whichPath][i].pathByEdge.map(
|
await this.mapGraphPathToInsight[buttonIter][i].pathByEdge.map(
|
||||||
edgeToHighlight => {
|
async(edgeToHighlight) => {
|
||||||
edgeToHighlight.addClass('highlight-edge');
|
await edgeToHighlight.addClass('highlight-edge');
|
||||||
});
|
});
|
||||||
return; // 之所以要此時就立刻return是因為要避免第二個以上的most freq path也被點亮
|
return; // 之所以要此時就立刻return是因為要避免第二個以上的most freq path也被點亮
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -402,7 +402,7 @@ export default {
|
|||||||
* create cytoscape's map
|
* create cytoscape's map
|
||||||
* @param {string} type this.mapType 'processMap' | 'bpmn',可傳入以上任一。
|
* @param {string} type this.mapType 'processMap' | 'bpmn',可傳入以上任一。
|
||||||
*/
|
*/
|
||||||
createCy(type) {
|
async createCy(type) {
|
||||||
let graphId = document.getElementById('cy');
|
let graphId = document.getElementById('cy');
|
||||||
let mapData = type === 'processMap'? this.processMapData: this.bpmnData;
|
let mapData = type === 'processMap'? this.processMapData: this.bpmnData;
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ export default {
|
|||||||
this.setNodesData(mapData);
|
this.setNodesData(mapData);
|
||||||
this.setEdgesData(mapData);
|
this.setEdgesData(mapData);
|
||||||
this.setActivityBgImage(mapData);
|
this.setActivityBgImage(mapData);
|
||||||
this.cytoscapeGraph = cytoscapeMap(mapData, this.dataLayerType, this.dataLayerOption, this.curveStyle, this.rank, graphId);
|
this.cytoscapeGraph = await cytoscapeMap(mapData, this.dataLayerType, this.dataLayerOption, this.curveStyle, this.rank, graphId);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
setActivityBgImage(mapData) {
|
setActivityBgImage(mapData) {
|
||||||
@@ -484,7 +484,7 @@ export default {
|
|||||||
// log、filter 檔切換過程中, trace id 不同,將初始 trace id 設定為該檔案的 trace 幣一筆資料的 id。
|
// log、filter 檔切換過程中, trace id 不同,將初始 trace id 設定為該檔案的 trace 幣一筆資料的 id。
|
||||||
this.traceId = await this.traces[0]?.id;
|
this.traceId = await this.traces[0]?.id;
|
||||||
this.baseTraceId = await this.baseTraces[0]?.id;
|
this.baseTraceId = await this.baseTraces[0]?.id;
|
||||||
this.createCy(this.mapType);
|
await this.createCy(this.mapType);
|
||||||
await mapPathStore.setCytoscape(this.cytoscapeGraph);
|
await mapPathStore.setCytoscape(this.cytoscapeGraph);
|
||||||
await mapPathStore.createPaths();
|
await mapPathStore.createPaths();
|
||||||
await mapPathStore.highlightMostFrequentPath();
|
await mapPathStore.highlightMostFrequentPath();
|
||||||
|
|||||||
Reference in New Issue
Block a user