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.

87 lines
2.2 KiB

  1. <template>
  2. <v-list dense>
  3. <v-btn
  4. color="ms-4 my-1 mb-2 primary text-capitalize"
  5. nuxt
  6. @click="toLabeling"
  7. >
  8. <v-icon left>
  9. mdi-play-circle-outline
  10. </v-icon>
  11. {{ $t('home.startAnnotation') }}
  12. </v-btn>
  13. <v-list-item-group
  14. v-model="selected"
  15. mandatory
  16. >
  17. <v-list-item
  18. v-for="(item, i) in filteredItems"
  19. :key="i"
  20. @click="$router.push(localePath(`/projects/${$route.params.id}/${item.link}`))"
  21. >
  22. <v-list-item-action>
  23. <v-icon>
  24. {{ item.icon }}
  25. </v-icon>
  26. </v-list-item-action>
  27. <v-list-item-content>
  28. <v-list-item-title>
  29. {{ item.text }}
  30. </v-list-item-title>
  31. </v-list-item-content>
  32. </v-list-item>
  33. </v-list-item-group>
  34. </v-list>
  35. </template>
  36. <script>
  37. import { mapGetters } from 'vuex'
  38. export default {
  39. props: {
  40. link: {
  41. type: String,
  42. default: '',
  43. required: true
  44. },
  45. role: {
  46. type: Object,
  47. default: () => {},
  48. required: true
  49. }
  50. },
  51. data() {
  52. return {
  53. selected: 0
  54. }
  55. },
  56. computed: {
  57. ...mapGetters('projects', ['loadSearchOptions']),
  58. filteredItems() {
  59. const items = [
  60. { icon: 'mdi-home', text: this.$t('projectHome.home'), link: '', adminOnly: false },
  61. { icon: 'mdi-database', text: this.$t('dataset.dataset'), link: 'dataset', adminOnly: true },
  62. { icon: 'label', text: this.$t('labels.labels'), link: 'labels', adminOnly: true },
  63. { icon: 'person', text: this.$t('members.members'), link: 'members', adminOnly: true },
  64. { icon: 'mdi-book-open-outline', text: this.$t('guideline.guideline'), link: 'guideline', adminOnly: true },
  65. { icon: 'mdi-chart-bar', text: this.$t('statistics.statistics'), link: 'statistics', adminOnly: true }
  66. ]
  67. return items.filter(item => this.isVisible(item))
  68. }
  69. },
  70. methods: {
  71. isVisible(item) {
  72. return !item.adminOnly || this.role.is_project_admin
  73. },
  74. toLabeling() {
  75. this.$router.push({
  76. path: this.localePath(`/projects/${this.$route.params.id}/${this.link}`),
  77. query: this.loadSearchOptions
  78. })
  79. }
  80. }
  81. }
  82. </script>