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.0 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. Start annotation
  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(`/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. items: [
  55. { icon: 'mdi-home', text: 'Home', link: '', adminOnly: false },
  56. { icon: 'mdi-database', text: 'Dataset', link: 'dataset', adminOnly: true },
  57. { icon: 'label', text: 'Labels', link: 'labels', adminOnly: true },
  58. { icon: 'person', text: 'Members', link: 'members', adminOnly: true },
  59. { icon: 'mdi-book-open-outline', text: 'Guideline', link: 'guideline', adminOnly: true },
  60. { icon: 'mdi-chart-bar', text: 'Statistics', link: 'statistics', adminOnly: true }
  61. ]
  62. }
  63. },
  64. computed: {
  65. ...mapGetters('projects', ['loadSearchOptions']),
  66. filteredItems() {
  67. return this.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: `/projects/${this.$route.params.id}/${this.link}`,
  77. query: this.loadSearchOptions
  78. })
  79. }
  80. }
  81. }
  82. </script>