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.

142 lines
3.3 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. <template>
  2. <v-list dense>
  3. <v-btn color="ms-4 my-1 mb-2 primary text-capitalize" nuxt @click="toLabeling">
  4. <v-icon left>
  5. {{ mdiPlayCircleOutline }}
  6. </v-icon>
  7. {{ $t('home.startAnnotation') }}
  8. </v-btn>
  9. <v-list-item-group v-model="selected" mandatory>
  10. <v-list-item
  11. v-for="(item, i) in filteredItems"
  12. :key="i"
  13. @click="$router.push(localePath(`/projects/${$route.params.id}/${item.link}`))"
  14. >
  15. <v-list-item-action>
  16. <v-icon>
  17. {{ item.icon }}
  18. </v-icon>
  19. </v-list-item-action>
  20. <v-list-item-content>
  21. <v-list-item-title>
  22. {{ item.text }}
  23. </v-list-item-title>
  24. </v-list-item-content>
  25. </v-list-item>
  26. </v-list-item-group>
  27. </v-list>
  28. </template>
  29. <script>
  30. import {
  31. mdiAccount,
  32. mdiBookOpenOutline,
  33. mdiChartBar,
  34. mdiCog,
  35. mdiCommentAccountOutline,
  36. mdiDatabase,
  37. mdiHome,
  38. mdiLabel,
  39. mdiPlayCircleOutline
  40. } from '@mdi/js'
  41. import { getLinkToAnnotationPage } from '~/presenter/linkToAnnotationPage'
  42. export default {
  43. props: {
  44. isProjectAdmin: {
  45. type: Boolean,
  46. default: false,
  47. required: true
  48. },
  49. project: {
  50. type: Object,
  51. default: () => {},
  52. required: true
  53. }
  54. },
  55. data() {
  56. return {
  57. selected: 0,
  58. mdiPlayCircleOutline
  59. }
  60. },
  61. computed: {
  62. filteredItems() {
  63. const items = [
  64. {
  65. icon: mdiHome,
  66. text: this.$t('projectHome.home'),
  67. link: '',
  68. isVisible: true
  69. },
  70. {
  71. icon: mdiDatabase,
  72. text: this.$t('dataset.dataset'),
  73. link: 'dataset',
  74. isVisible: true
  75. },
  76. {
  77. icon: mdiLabel,
  78. text: this.$t('labels.labels'),
  79. link: 'labels',
  80. isVisible:
  81. (this.isProjectAdmin || this.project.allowMemberToCreateLabelType) &&
  82. this.project.canDefineLabel
  83. },
  84. {
  85. icon: mdiLabel,
  86. text: 'Relations',
  87. link: 'links',
  88. isVisible:
  89. (this.isProjectAdmin || this.project.allowMemberToCreateLabelType) &&
  90. this.project.canDefineRelation
  91. },
  92. {
  93. icon: mdiAccount,
  94. text: this.$t('members.members'),
  95. link: 'members',
  96. isVisible: this.isProjectAdmin
  97. },
  98. {
  99. icon: mdiCommentAccountOutline,
  100. text: 'Comments',
  101. link: 'comments',
  102. isVisible: this.isProjectAdmin
  103. },
  104. {
  105. icon: mdiBookOpenOutline,
  106. text: this.$t('guideline.guideline'),
  107. link: 'guideline',
  108. isVisible: this.isProjectAdmin
  109. },
  110. {
  111. icon: mdiChartBar,
  112. text: this.$t('statistics.statistics'),
  113. link: 'metrics',
  114. isVisible: this.isProjectAdmin
  115. },
  116. {
  117. icon: mdiCog,
  118. text: this.$t('settings.title'),
  119. link: 'settings',
  120. isVisible: this.isProjectAdmin
  121. }
  122. ]
  123. return items.filter((item) => item.isVisible)
  124. }
  125. },
  126. methods: {
  127. toLabeling() {
  128. const query = this.$services.option.findOption(this.$route.params.id)
  129. const link = getLinkToAnnotationPage(this.$route.params.id, this.project.projectType)
  130. this.$router.push({
  131. path: this.localePath(link),
  132. query
  133. })
  134. }
  135. }
  136. }
  137. </script>