mirror of https://github.com/doccano/doccano.git
Browse Source
Merge pull request #1713 from doccano/enhancement/removeDuplicationOnDistributionComponent
Merge pull request #1713 from doccano/enhancement/removeDuplicationOnDistributionComponent
[Enhancement] Remove duplication on distribution componentpull/1714/head
Hiroki Nakayama
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 53 additions and 108 deletions
Unified View
Diff Options
-
31frontend/components/metrics/CategoryDistribution.vue
-
14frontend/components/metrics/LabelDistribution.vue
-
31frontend/components/metrics/RelationDistribution.vue
-
31frontend/components/metrics/SpanDistribution.vue
-
54frontend/pages/projects/_id/metrics/index.vue
@ -1,31 +0,0 @@ |
|||||
<template> |
|
||||
<label-distribution |
|
||||
title="Category Distribution" |
|
||||
:distribution="distribution" |
|
||||
:color-mapping="colorMapping" |
|
||||
/> |
|
||||
</template> |
|
||||
|
|
||||
<script lang="ts"> |
|
||||
import Vue from 'vue' |
|
||||
import LabelDistribution from './LabelDistribution.vue' |
|
||||
|
|
||||
export default Vue.extend({ |
|
||||
components: { |
|
||||
LabelDistribution |
|
||||
}, |
|
||||
|
|
||||
data() { |
|
||||
return { |
|
||||
distribution: {}, |
|
||||
colorMapping: {}, |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
async created() { |
|
||||
this.distribution = await this.$services.metrics.fetchCategoryDistribution(this.$route.params.id) |
|
||||
const labels = await this.$services.categoryType.list(this.$route.params.id) |
|
||||
this.colorMapping = Object.fromEntries(labels.map((label) => [label.text, label.backgroundColor])) |
|
||||
} |
|
||||
}) |
|
||||
</script> |
|
@ -1,31 +0,0 @@ |
|||||
<template> |
|
||||
<label-distribution |
|
||||
title="Relation Distribution" |
|
||||
:distribution="distribution" |
|
||||
:color-mapping="colorMapping" |
|
||||
/> |
|
||||
</template> |
|
||||
|
|
||||
<script lang="ts"> |
|
||||
import Vue from 'vue' |
|
||||
import LabelDistribution from './LabelDistribution.vue' |
|
||||
|
|
||||
export default Vue.extend({ |
|
||||
components: { |
|
||||
LabelDistribution |
|
||||
}, |
|
||||
|
|
||||
data() { |
|
||||
return { |
|
||||
distribution: {}, |
|
||||
colorMapping: {}, |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
async created() { |
|
||||
this.distribution = await this.$services.metrics.fetchRelationDistribution(this.$route.params.id) |
|
||||
const labels = await this.$services.relationType.list(this.$route.params.id) |
|
||||
this.colorMapping = Object.fromEntries(labels.map((label) => [label.text, label.backgroundColor])) |
|
||||
} |
|
||||
}) |
|
||||
</script> |
|
@ -1,31 +0,0 @@ |
|||||
<template> |
|
||||
<label-distribution |
|
||||
title="Span Distribution" |
|
||||
:distribution="distribution" |
|
||||
:color-mapping="colorMapping" |
|
||||
/> |
|
||||
</template> |
|
||||
|
|
||||
<script lang="ts"> |
|
||||
import Vue from 'vue' |
|
||||
import LabelDistribution from './LabelDistribution.vue' |
|
||||
|
|
||||
export default Vue.extend({ |
|
||||
components: { |
|
||||
LabelDistribution |
|
||||
}, |
|
||||
|
|
||||
data() { |
|
||||
return { |
|
||||
distribution: {}, |
|
||||
colorMapping: {}, |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
async created() { |
|
||||
this.distribution = await this.$services.metrics.fetchSpanDistribution(this.$route.params.id) |
|
||||
const labels = await this.$services.spanType.list(this.$route.params.id) |
|
||||
this.colorMapping = Object.fromEntries(labels.map((label) => [label.text, label.backgroundColor])) |
|
||||
} |
|
||||
}) |
|
||||
</script> |
|
Write
Preview
Loading…
Cancel
Save