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.

75 lines
1.7 KiB

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