diff --git a/src/renderer/components/WorkspacePropsTab.vue b/src/renderer/components/WorkspacePropsTab.vue index ae098166..84a27068 100644 --- a/src/renderer/components/WorkspacePropsTab.vue +++ b/src/renderer/components/WorkspacePropsTab.vue @@ -7,6 +7,7 @@ class="btn btn-primary btn-sm" :disabled="!isChanged" :class="{'loading':isSaving}" + title="CTRL+S" @click="saveChanges" > {{ $t('word.save') }} @@ -150,6 +151,7 @@ export default { computed: { ...mapGetters({ getWorkspace: 'workspaces/getWorkspace', + selectedWorkspace: 'workspaces/getSelected', getDatabaseVariable: 'workspaces/getDatabaseVariable' }), workspace () { @@ -163,7 +165,7 @@ export default { return this.getDatabaseVariable(this.connection.uid, 'default_storage_engine').value || ''; }, isSelected () { - return this.workspace.selected_tab === 'prop'; + return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.table; }, schema () { return this.workspace.breadcrumbs.schema; @@ -200,6 +202,12 @@ export default { this.setUnsavedChanges(val); } }, + created () { + window.addEventListener('keydown', this.onKey); + }, + beforeDestroy () { + window.removeEventListener('keydown', this.onKey); + }, methods: { ...mapActions({ addNotification: 'notifications/addNotification', @@ -519,6 +527,15 @@ export default { }, foreignsUpdate (foreigns) { this.localKeyUsage = foreigns; + }, + onKey (e) { + if (this.isSelected) { + e.stopPropagation(); + if (e.ctrlKey && e.keyCode === 83) { // CTRL + S + if (this.isChanged) + this.saveChanges(); + } + } } } }; diff --git a/src/renderer/components/WorkspacePropsTabFunction.vue b/src/renderer/components/WorkspacePropsTabFunction.vue index e3dbd0fa..528b8a90 100644 --- a/src/renderer/components/WorkspacePropsTabFunction.vue +++ b/src/renderer/components/WorkspacePropsTabFunction.vue @@ -7,6 +7,7 @@ class="btn btn-primary btn-sm" :disabled="!isChanged" :class="{'loading':isSaving}" + title="CTRL+S" @click="saveChanges" > {{ $t('word.save') }} @@ -120,13 +121,14 @@ export default { }, computed: { ...mapGetters({ + selectedWorkspace: 'workspaces/getSelected', getWorkspace: 'workspaces/getWorkspace' }), workspace () { return this.getWorkspace(this.connection.uid); }, isSelected () { - return this.workspace.selected_tab === 'prop'; + return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.function; }, schema () { return this.workspace.breadcrumbs.schema; @@ -171,6 +173,12 @@ export default { destroyed () { window.removeEventListener('resize', this.resizeQueryEditor); }, + created () { + window.addEventListener('keydown', this.onKey); + }, + beforeDestroy () { + window.removeEventListener('keydown', this.onKey); + }, methods: { ...mapActions({ addNotification: 'notifications/addNotification', @@ -312,6 +320,15 @@ export default { }, hideAskParamsModal () { this.isAskingParameters = false; + }, + onKey (e) { + if (this.isSelected) { + e.stopPropagation(); + if (e.ctrlKey && e.keyCode === 83) { // CTRL + S + if (this.isChanged) + this.saveChanges(); + } + } } } }; diff --git a/src/renderer/components/WorkspacePropsTabRoutine.vue b/src/renderer/components/WorkspacePropsTabRoutine.vue index 2197bd75..804184b7 100644 --- a/src/renderer/components/WorkspacePropsTabRoutine.vue +++ b/src/renderer/components/WorkspacePropsTabRoutine.vue @@ -7,6 +7,7 @@ class="btn btn-primary btn-sm" :disabled="!isChanged" :class="{'loading':isSaving}" + title="CTRL+S" @click="saveChanges" > {{ $t('word.save') }} @@ -121,13 +122,14 @@ export default { }, computed: { ...mapGetters({ + selectedWorkspace: 'workspaces/getSelected', getWorkspace: 'workspaces/getWorkspace' }), workspace () { return this.getWorkspace(this.connection.uid); }, isSelected () { - return this.workspace.selected_tab === 'prop'; + return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.routine; }, schema () { return this.workspace.breadcrumbs.schema; @@ -172,6 +174,12 @@ export default { destroyed () { window.removeEventListener('resize', this.resizeQueryEditor); }, + created () { + window.addEventListener('keydown', this.onKey); + }, + beforeDestroy () { + window.removeEventListener('keydown', this.onKey); + }, methods: { ...mapActions({ addNotification: 'notifications/addNotification', @@ -310,6 +318,15 @@ export default { }, hideAskParamsModal () { this.isAskingParameters = false; + }, + onKey (e) { + if (this.isSelected) { + e.stopPropagation(); + if (e.ctrlKey && e.keyCode === 83) { // CTRL + S + if (this.isChanged) + this.saveChanges(); + } + } } } }; diff --git a/src/renderer/components/WorkspacePropsTabScheduler.vue b/src/renderer/components/WorkspacePropsTabScheduler.vue index 696527bc..46e325c9 100644 --- a/src/renderer/components/WorkspacePropsTabScheduler.vue +++ b/src/renderer/components/WorkspacePropsTabScheduler.vue @@ -7,6 +7,7 @@ class="btn btn-primary btn-sm" :disabled="!isChanged" :class="{'loading':isSaving}" + title="CTRL+S" @click="saveChanges" > {{ $t('word.save') }} @@ -169,13 +170,14 @@ export default { }, computed: { ...mapGetters({ + selectedWorkspace: 'workspaces/getSelected', getWorkspace: 'workspaces/getWorkspace' }), workspace () { return this.getWorkspace(this.connection.uid); }, isSelected () { - return this.workspace.selected_tab === 'prop'; + return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.scheduler; }, schema () { return this.workspace.breadcrumbs.schema; @@ -220,6 +222,12 @@ export default { destroyed () { window.removeEventListener('resize', this.resizeQueryEditor); }, + created () { + window.addEventListener('keydown', this.onKey); + }, + beforeDestroy () { + window.removeEventListener('keydown', this.onKey); + }, methods: { ...mapActions({ addNotification: 'notifications/addNotification', @@ -310,6 +318,15 @@ export default { }, timingUpdate (options) { this.localScheduler = options; + }, + onKey (e) { + if (this.isSelected) { + e.stopPropagation(); + if (e.ctrlKey && e.keyCode === 83) { // CTRL + S + if (this.isChanged) + this.saveChanges(); + } + } } } }; diff --git a/src/renderer/components/WorkspacePropsTabTrigger.vue b/src/renderer/components/WorkspacePropsTabTrigger.vue index c8274d3a..64564497 100644 --- a/src/renderer/components/WorkspacePropsTabTrigger.vue +++ b/src/renderer/components/WorkspacePropsTabTrigger.vue @@ -7,6 +7,7 @@ class="btn btn-primary btn-sm" :disabled="!isChanged" :class="{'loading':isSaving}" + title="CTRL+S" @click="saveChanges" > {{ $t('word.save') }} @@ -140,13 +141,14 @@ export default { }, computed: { ...mapGetters({ + selectedWorkspace: 'workspaces/getSelected', getWorkspace: 'workspaces/getWorkspace' }), workspace () { return this.getWorkspace(this.connection.uid); }, isSelected () { - return this.workspace.selected_tab === 'prop'; + return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.trigger; }, schema () { return this.workspace.breadcrumbs.schema; @@ -191,6 +193,12 @@ export default { destroyed () { window.removeEventListener('resize', this.resizeQueryEditor); }, + created () { + window.addEventListener('keydown', this.onKey); + }, + beforeDestroy () { + window.removeEventListener('keydown', this.onKey); + }, methods: { ...mapActions({ addNotification: 'notifications/addNotification', @@ -274,6 +282,15 @@ export default { this.editorHeight = size; this.$refs.queryEditor.editor.resize(); } + }, + onKey (e) { + if (this.isSelected) { + e.stopPropagation(); + if (e.ctrlKey && e.keyCode === 83) { // CTRL + S + if (this.isChanged) + this.saveChanges(); + } + } } } }; diff --git a/src/renderer/components/WorkspacePropsTabView.vue b/src/renderer/components/WorkspacePropsTabView.vue index 85359357..4ea5c9f7 100644 --- a/src/renderer/components/WorkspacePropsTabView.vue +++ b/src/renderer/components/WorkspacePropsTabView.vue @@ -7,6 +7,7 @@ class="btn btn-primary btn-sm" :disabled="!isChanged" :class="{'loading':isSaving}" + title="CTRL+S" @click="saveChanges" > {{ $t('word.save') }} @@ -201,13 +202,14 @@ export default { }, computed: { ...mapGetters({ + selectedWorkspace: 'workspaces/getSelected', getWorkspace: 'workspaces/getWorkspace' }), workspace () { return this.getWorkspace(this.connection.uid); }, isSelected () { - return this.workspace.selected_tab === 'prop'; + return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.view; }, schema () { return this.workspace.breadcrumbs.schema; @@ -245,6 +247,12 @@ export default { destroyed () { window.removeEventListener('resize', this.resizeQueryEditor); }, + created () { + window.addEventListener('keydown', this.onKey); + }, + beforeDestroy () { + window.removeEventListener('keydown', this.onKey); + }, methods: { ...mapActions({ addNotification: 'notifications/addNotification', @@ -327,6 +335,15 @@ export default { this.editorHeight = size; this.$refs.queryEditor.editor.resize(); } + }, + onKey (e) { + if (this.isSelected) { + e.stopPropagation(); + if (e.ctrlKey && e.keyCode === 83) { // CTRL + S + if (this.isChanged) + this.saveChanges(); + } + } } } };