diff --git a/src/renderer/components/ModalNewTable.vue b/src/renderer/components/ModalNewTable.vue index 8f308620..3c1c1ea7 100644 --- a/src/renderer/components/ModalNewTable.vue +++ b/src/renderer/components/ModalNewTable.vue @@ -84,7 +84,6 @@ export default { ConfirmModal }, props: { - table: String, workspace: Object }, data () { diff --git a/src/renderer/components/ModalNewTrigger.vue b/src/renderer/components/ModalNewTrigger.vue new file mode 100644 index 00000000..733388cb --- /dev/null +++ b/src/renderer/components/ModalNewTrigger.vue @@ -0,0 +1,144 @@ + + + diff --git a/src/renderer/components/ModalNewView.vue b/src/renderer/components/ModalNewView.vue index d04c2d16..093df111 100644 --- a/src/renderer/components/ModalNewView.vue +++ b/src/renderer/components/ModalNewView.vue @@ -157,7 +157,6 @@ export default { QueryEditor }, props: { - table: String, workspace: Object }, data () { diff --git a/src/renderer/components/WorkspaceExploreBar.vue b/src/renderer/components/WorkspaceExploreBar.vue index 056a0a8d..9bb214e4 100644 --- a/src/renderer/components/WorkspaceExploreBar.vue +++ b/src/renderer/components/WorkspaceExploreBar.vue @@ -61,6 +61,12 @@ @close="hideCreateViewModal" @open-create-view-editor="openCreateViewEditor" /> + import { mapGetters, mapActions } from 'vuex'; -import _ from 'lodash'; +import _ from 'lodash';// TODO: remove import Tables from '@/ipc-api/Tables'; import Views from '@/ipc-api/Views'; +import Triggers from '@/ipc-api/Triggers'; import WorkspaceConnectPanel from '@/components/WorkspaceConnectPanel'; import WorkspaceExploreBarDatabase from '@/components/WorkspaceExploreBarDatabase'; import DatabaseContext from '@/components/WorkspaceExploreBarDatabaseContext'; @@ -100,6 +108,7 @@ import MiscContext from '@/components/WorkspaceExploreBarMiscContext'; import ModalNewDatabase from '@/components/ModalNewDatabase'; import ModalNewTable from '@/components/ModalNewTable'; import ModalNewView from '@/components/ModalNewView'; +import ModalNewTrigger from '@/components/ModalNewTrigger'; export default { name: 'WorkspaceExploreBar', @@ -111,7 +120,8 @@ export default { MiscContext, ModalNewDatabase, ModalNewTable, - ModalNewView + ModalNewView, + ModalNewTrigger }, props: { connection: Object, @@ -120,16 +130,21 @@ export default { data () { return { isRefreshing: false, + isNewDBModal: false, isNewTableModal: false, isNewViewModal: false, + isNewTriggerModal: false, + localWidth: null, isDatabaseContext: false, isTableContext: false, isMiscContext: false, + databaseContextEvent: null, tableContextEvent: null, miscContextEvent: null, + selectedDatabase: '', selectedTable: null, selectedMisc: null @@ -270,6 +285,29 @@ export default { } else this.addNotification({ status: 'error', message: response }); + }, + showCreateTriggerModal () { + this.closeDatabaseContext(); + this.isNewTriggerModal = true; + }, + hideCreateTriggerModal () { + this.isNewTriggerModal = false; + }, + async openCreateTriggerEditor (payload) { + const params = { + uid: this.connection.uid, + ...payload + }; + + const { status, response } = await Triggers.createTrigger(params); + + if (status === 'success') { + await this.refresh(); + this.changeBreadcrumbs({ schema: this.selectedDatabase, trigger: payload.name }); + this.selectTab({ uid: this.workspace.uid, tab: 'prop' }); + } + else + this.addNotification({ status: 'error', message: response }); } } }; diff --git a/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue b/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue index 91deab1d..1055c7d9 100644 --- a/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue +++ b/src/renderer/components/WorkspaceExploreBarDatabaseContext.vue @@ -13,7 +13,7 @@
{{ $t('word.view') }}
-
+
{{ $tc('word.trigger', 1) }}
@@ -99,6 +99,9 @@ export default { showCreateViewModal () { this.$emit('show-create-view-modal'); }, + showCreateTriggerModal () { + this.$emit('show-create-trigger-modal'); + }, showDeleteModal () { this.isDeleteModal = true; },