From 924eaf18bfcf2b88f366a8388470531bf4968d21 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Thu, 3 Mar 2022 09:11:45 +0900 Subject: [PATCH 1/3] Change the props of LabelDistribution.vue from colorMapping to labels --- .../components/metrics/CategoryDistribution.vue | 8 ++++---- frontend/components/metrics/LabelDistribution.vue | 14 ++++++++++---- .../components/metrics/RelationDistribution.vue | 8 ++++---- frontend/components/metrics/SpanDistribution.vue | 8 ++++---- 4 files changed, 22 insertions(+), 16 deletions(-) diff --git a/frontend/components/metrics/CategoryDistribution.vue b/frontend/components/metrics/CategoryDistribution.vue index 36135399..81462285 100644 --- a/frontend/components/metrics/CategoryDistribution.vue +++ b/frontend/components/metrics/CategoryDistribution.vue @@ -2,13 +2,14 @@ diff --git a/frontend/components/metrics/LabelDistribution.vue b/frontend/components/metrics/LabelDistribution.vue index 855c5cf8..e484b69f 100644 --- a/frontend/components/metrics/LabelDistribution.vue +++ b/frontend/components/metrics/LabelDistribution.vue @@ -28,6 +28,7 @@ import Vue, { PropType } from 'vue' import BarChart from '@/components/metrics/ChartBar.vue' import { Distribution } from '~/domain/models/metrics/metrics' +import { LabelDTO } from '~/services/application/label/labelData' export default Vue.extend({ components: { @@ -44,13 +45,18 @@ export default Vue.extend({ type: Object as PropType, required: true }, - colorMapping: { - type: Object, - default: () => {}, - } + labels: { + type: Array as PropType, + default: () => [], + required: true, + }, }, computed: { + colorMapping(): {[text: string]: string} { + return Object.fromEntries(this.labels.map((label) => [label.text, label.backgroundColor])) + }, + chartJSFormat(): any { const data: {[user: string]: {labels: string[], datasets: any[]}} = {} for (const user in this.distribution) { diff --git a/frontend/components/metrics/RelationDistribution.vue b/frontend/components/metrics/RelationDistribution.vue index c334b40e..a124bace 100644 --- a/frontend/components/metrics/RelationDistribution.vue +++ b/frontend/components/metrics/RelationDistribution.vue @@ -2,13 +2,14 @@ diff --git a/frontend/components/metrics/SpanDistribution.vue b/frontend/components/metrics/SpanDistribution.vue index ef34a328..e2fa4876 100644 --- a/frontend/components/metrics/SpanDistribution.vue +++ b/frontend/components/metrics/SpanDistribution.vue @@ -2,13 +2,14 @@ From 025283ffdac39ff2fe452f28b39bbab03e6df234 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Thu, 3 Mar 2022 09:30:16 +0900 Subject: [PATCH 2/3] Replace each distribution component with LabelDistribution.vue --- frontend/pages/projects/_id/metrics/index.vue | 54 +++++++++++++++---- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/frontend/pages/projects/_id/metrics/index.vue b/frontend/pages/projects/_id/metrics/index.vue index 901d7a2c..e6f71fe2 100644 --- a/frontend/pages/projects/_id/metrics/index.vue +++ b/frontend/pages/projects/_id/metrics/index.vue @@ -4,29 +4,37 @@ - + - + - + From c47eeba67e0bfe4a652155f2235bafa0affcbabb Mon Sep 17 00:00:00 2001 From: Hironsan Date: Thu, 3 Mar 2022 09:33:59 +0900 Subject: [PATCH 3/3] Change the prop name from labels to labelTypes --- .../metrics/CategoryDistribution.vue | 31 ------------------- .../components/metrics/LabelDistribution.vue | 4 +-- .../metrics/RelationDistribution.vue | 31 ------------------- .../components/metrics/SpanDistribution.vue | 31 ------------------- frontend/pages/projects/_id/metrics/index.vue | 6 ++-- 5 files changed, 5 insertions(+), 98 deletions(-) delete mode 100644 frontend/components/metrics/CategoryDistribution.vue delete mode 100644 frontend/components/metrics/RelationDistribution.vue delete mode 100644 frontend/components/metrics/SpanDistribution.vue diff --git a/frontend/components/metrics/CategoryDistribution.vue b/frontend/components/metrics/CategoryDistribution.vue deleted file mode 100644 index 81462285..00000000 --- a/frontend/components/metrics/CategoryDistribution.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/frontend/components/metrics/LabelDistribution.vue b/frontend/components/metrics/LabelDistribution.vue index e484b69f..965a7217 100644 --- a/frontend/components/metrics/LabelDistribution.vue +++ b/frontend/components/metrics/LabelDistribution.vue @@ -45,7 +45,7 @@ export default Vue.extend({ type: Object as PropType, required: true }, - labels: { + labelTypes: { type: Array as PropType, default: () => [], required: true, @@ -54,7 +54,7 @@ export default Vue.extend({ computed: { colorMapping(): {[text: string]: string} { - return Object.fromEntries(this.labels.map((label) => [label.text, label.backgroundColor])) + return Object.fromEntries(this.labelTypes.map((labelType) => [labelType.text, labelType.backgroundColor])) }, chartJSFormat(): any { diff --git a/frontend/components/metrics/RelationDistribution.vue b/frontend/components/metrics/RelationDistribution.vue deleted file mode 100644 index a124bace..00000000 --- a/frontend/components/metrics/RelationDistribution.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/frontend/components/metrics/SpanDistribution.vue b/frontend/components/metrics/SpanDistribution.vue deleted file mode 100644 index e2fa4876..00000000 --- a/frontend/components/metrics/SpanDistribution.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/frontend/pages/projects/_id/metrics/index.vue b/frontend/pages/projects/_id/metrics/index.vue index e6f71fe2..3e5aaeff 100644 --- a/frontend/pages/projects/_id/metrics/index.vue +++ b/frontend/pages/projects/_id/metrics/index.vue @@ -7,21 +7,21 @@