From 672d93b8211bb34f85e23bc814f5270553aac94b Mon Sep 17 00:00:00 2001 From: chiayin Date: Fri, 3 Nov 2023 17:12:57 +0800 Subject: [PATCH] Issues #179: done. --- .../Discover/Conformance/MoreModal.vue | 2 +- src/components/Discover/Map/Filter/Trace.vue | 42 +++++++++++--- src/components/Discover/Map/SidebarTraces.vue | 56 +++++++++++++++---- src/stores/allMapData.js | 4 +- src/views/Discover/Map/index.vue | 6 +- 5 files changed, 86 insertions(+), 24 deletions(-) diff --git a/src/components/Discover/Conformance/MoreModal.vue b/src/components/Discover/Conformance/MoreModal.vue index c6bc60d..28e4bf5 100644 --- a/src/components/Discover/Conformance/MoreModal.vue +++ b/src/components/Discover/Conformance/MoreModal.vue @@ -104,7 +104,7 @@ export default { item.facets.forEach((facet, index) => { item[`fac_${index}`] = facet.value; // 建立新的 key-value pair }); - delete item.facets; // 刪除原本的 attributes 屬性 + delete item.facets; // 刪除原本的 facets 屬性 item.attributes.forEach((attribute, index) => { item[`att_${index}`] = attribute.value; // 建立新的 key-value pair diff --git a/src/components/Discover/Map/Filter/Trace.vue b/src/components/Discover/Map/Filter/Trace.vue index 00cbc16..db6d237 100644 --- a/src/components/Discover/Map/Filter/Trace.vue +++ b/src/components/Discover/Map/Filter/Trace.vue @@ -51,10 +51,10 @@
- - - - + +
+ +
@@ -106,8 +106,7 @@ export default { base_count: trace.count, ratio: this.getPercentLabel(trace.count / this.traceCountTotal), }; - }).sort((x, y) => x.id - y.id) - .slice(this.selectArea[0], this.selectArea[1]); + }).slice(this.selectArea[0], this.selectArea[1]); }, caseTotalPercent: function() { let ratioSum = this.traceList.map(trace => trace.base_count).reduce((acc, cur) => acc + cur, 0) / this.traceCountTotal; @@ -132,7 +131,34 @@ export default { }, ] }; - } + }, + caseData: function() { + const data = JSON.parse(JSON.stringify(this.infiniteData)); // 深拷貝原始 cases 的內容 + data.forEach(item => { + item.attributes.forEach((attribute, index) => { + item[`att_${index}`] = attribute.value; // 建立新的 key-value pair + }); + delete item.attributes; // 刪除原本的 attributes 屬性 + }) + return data; + }, + columnData: function() { + const data = JSON.parse(JSON.stringify(this.baseCases)); // 深拷貝原始 cases 的內容 + let result = [ + { field: 'id', header: 'Case Id' }, + { field: 'started_at', header: 'Start time' }, + { field: 'completed_at', header: 'End time' }, + ]; + if(data.length !== 0){ + result = [ + { field: 'id', header: 'Case Id' }, + { field: 'started_at', header: 'Start time' }, + { field: 'completed_at', header: 'End time' }, + ...data[0]?.attributes.map((att, index) => ({ field: `att_${index}`, header: att.key })), + ]; + } + return result + }, }, watch: { selectArea: function(newValue) { @@ -304,11 +330,13 @@ export default { } }, mounted() { + this.isLoading = true; // createCy 執行完關閉 this.setNodesData(); this.setEdgesData(); this.createCy(); this.chartOptions = this.barOptions(); this.selectArea = [0, this.traceTotal] + this.isLoading = false; }, } diff --git a/src/components/Discover/Map/SidebarTraces.vue b/src/components/Discover/Map/SidebarTraces.vue index 0d4ec57..8e0a751 100644 --- a/src/components/Discover/Map/SidebarTraces.vue +++ b/src/components/Discover/Map/SidebarTraces.vue @@ -42,10 +42,10 @@
- - - - + +
+ +
@@ -54,15 +54,19 @@