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.

76 lines
1.7 KiB

  1. <template>
  2. <div>
  3. <action-menu
  4. :items="menuItems"
  5. :text="$t('dataset.actions')"
  6. @create="createDialog=true"
  7. @upload="importDialog=true"
  8. @download="handleDownload"
  9. />
  10. <v-dialog
  11. v-model="createDialog"
  12. width="800"
  13. >
  14. <label-creation-form
  15. :create-label="createLabel"
  16. :keys="shortkeys"
  17. @close="createDialog=false"
  18. />
  19. </v-dialog>
  20. <v-dialog
  21. v-model="importDialog"
  22. width="800"
  23. >
  24. <label-import-form
  25. :upload-label="uploadLabel"
  26. @close="importDialog=false"
  27. />
  28. </v-dialog>
  29. </div>
  30. </template>
  31. <script>
  32. import { mapActions, mapGetters } from 'vuex'
  33. import ActionMenu from '@/components/molecules/ActionMenu'
  34. import LabelCreationForm from '@/components/organisms/labels/LabelCreationForm'
  35. import LabelImportForm from '@/components/organisms/labels/LabelImportForm'
  36. export default {
  37. components: {
  38. ActionMenu,
  39. LabelCreationForm,
  40. LabelImportForm
  41. },
  42. data() {
  43. return {
  44. createDialog: false,
  45. importDialog: false,
  46. menuItems: [
  47. { title: this.$t('labels.createLabel'), icon: 'mdi-pencil', event: 'create' },
  48. { title: this.$t('labels.importLabels'), icon: 'mdi-upload', event: 'upload' },
  49. { title: this.$t('labels.exportLabels'), icon: 'mdi-download', event: 'download' }
  50. ]
  51. }
  52. },
  53. computed: {
  54. ...mapGetters('labels', ['shortkeys'])
  55. },
  56. created() {
  57. this.setCurrentProject(this.$route.params.id)
  58. },
  59. methods: {
  60. ...mapActions('labels', ['createLabel', 'uploadLabel', 'exportLabels']),
  61. ...mapActions('projects', ['setCurrentProject']),
  62. handleDownload() {
  63. this.exportLabels({
  64. projectId: this.$route.params.id
  65. })
  66. }
  67. }
  68. }
  69. </script>