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.

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