You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
2.1 KiB

3 years ago
  1. <template>
  2. <v-row>
  3. <v-col cols="12">
  4. <member-progress />
  5. </v-col>
  6. <v-col v-if="!!project.hasCategory" cols="12">
  7. <label-distribution
  8. title="Category Distribution"
  9. :distribution="categoryDistribution"
  10. :label-types="categoryTypes"
  11. />
  12. </v-col>
  13. <v-col v-if="!!project.hasSpan" cols="12">
  14. <label-distribution
  15. title="Span Distribution"
  16. :distribution="spanDistribution"
  17. :label-types="spanTypes"
  18. />
  19. </v-col>
  20. <v-col v-if="!!project.useRelation" cols="12">
  21. <label-distribution
  22. title="Relation Distribution"
  23. :distribution="relationDistribution"
  24. :label-types="relationTypes"
  25. />
  26. </v-col>
  27. </v-row>
  28. </template>
  29. <script>
  30. import LabelDistribution from '~/components/metrics/LabelDistribution'
  31. import MemberProgress from '~/components/metrics/MemberProgress'
  32. export default {
  33. components: {
  34. LabelDistribution,
  35. MemberProgress,
  36. },
  37. layout: 'project',
  38. validate({ params }) {
  39. return /^\d+$/.test(params.id)
  40. },
  41. data() {
  42. return {
  43. project: {},
  44. categoryTypes: [],
  45. categoryDistribution: {},
  46. relationTypes: [],
  47. relationDistribution: {},
  48. spanTypes: [],
  49. spanDistribution: {},
  50. }
  51. },
  52. computed: {
  53. projectId() {
  54. return this.$route.params.id
  55. }
  56. },
  57. async created() {
  58. this.project = await this.$services.project.findById(this.projectId)
  59. if (this.project.hasCategory) {
  60. this.categoryTypes = await this.$services.categoryType.list(this.projectId)
  61. this.categoryDistribution = await this.$services.metrics.fetchCategoryDistribution(this.projectId)
  62. }
  63. if (this.project.hasSpan) {
  64. this.spanTypes = await this.$services.spanType.list(this.projectId)
  65. this.spanDistribution = await this.$services.metrics.fetchSpanDistribution(this.projectId)
  66. }
  67. if (this.project.useRelation) {
  68. this.relationTypes = await this.$services.relationType.list(this.projectId)
  69. this.relationDistribution = await this.$services.metrics.fetchRelationDistribution(this.projectId)
  70. }
  71. }
  72. }
  73. </script>