Skip to content

Commit

Permalink
feat: new create trigger function tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Sep 11, 2021
1 parent 3c5a69a commit 09c07ac
Show file tree
Hide file tree
Showing 11 changed files with 323 additions and 157 deletions.
132 changes: 0 additions & 132 deletions src/renderer/components/ModalNewTriggerFunction.vue

This file was deleted.

28 changes: 28 additions & 0 deletions src/renderer/components/Workspace.vue
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,23 @@
</span>
</a>

<a
v-else-if="tab.type === 'new-trigger-function'"
class="tab-link"
:class="{'badge': tab.isChanged}"
>
<i class="mdi mdi-shape-square-plus mdi-18px mr-1" />
<span :title="`${$t('word.new').toUpperCase()}: ${$tc(`word.${tab.elementType}`)}`">
{{ $t('message.newTriggerFunction') }}
<span
class="btn btn-clear"
:title="$t('word.close')"
@mousedown.left.stop
@click.stop="closeTab(tab)"
/>
</span>
</a>

<a
v-else-if="tab.type === 'new-scheduler'"
class="tab-link"
Expand Down Expand Up @@ -353,6 +370,15 @@
:trigger="tab.elementName"
:schema="tab.schema"
/>
<WorkspaceTabNewTriggerFunction
v-else-if="tab.type === 'new-trigger-function'"
:key="tab.uid"
:tab="tab"
:connection="connection"
:is-selected="selectedTab === tab.uid"
:trigger="tab.elementName"
:schema="tab.schema"
/>
<WorkspaceTabPropsTriggerFunction
v-else-if="['temp-trigger-function-props', 'trigger-function-props'].includes(tab.type)"
:key="tab.uid"
Expand Down Expand Up @@ -445,6 +471,7 @@ import WorkspaceTabNewTrigger from '@/components/WorkspaceTabNewTrigger';
import WorkspaceTabNewRoutine from '@/components/WorkspaceTabNewRoutine';
import WorkspaceTabNewFunction from '@/components/WorkspaceTabNewFunction';
import WorkspaceTabNewScheduler from '@/components/WorkspaceTabNewScheduler';
import WorkspaceTabNewTriggerFunction from '@/components/WorkspaceTabNewTriggerFunction';
import WorkspaceTabPropsTable from '@/components/WorkspaceTabPropsTable';
import WorkspaceTabPropsView from '@/components/WorkspaceTabPropsView';
Expand All @@ -471,6 +498,7 @@ export default {
WorkspaceTabPropsView,
WorkspaceTabNewTrigger,
WorkspaceTabPropsTrigger,
WorkspaceTabNewTriggerFunction,
WorkspaceTabPropsTriggerFunction,
WorkspaceTabNewRoutine,
WorkspaceTabNewFunction,
Expand Down
22 changes: 3 additions & 19 deletions src/renderer/components/WorkspaceExploreBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,6 @@
@close="hideNewDBModal"
@reload="refresh"
/>
<ModalNewFunction
v-if="isNewFunctionModal"
:workspace="workspace"
@close="hideCreateFunctionModal"
@open-create-function-editor="openCreateFunctionEditor"
/>
<ModalNewTriggerFunction
v-if="isNewTriggerFunctionModal"
:workspace="workspace"
@close="hideCreateTriggerFunctionModal"
@open-create-function-editor="openCreateTriggerFunctionEditor"
/>
<DatabaseContext
v-if="isDatabaseContext"
:selected-schema="selectedSchema"
Expand All @@ -83,7 +71,7 @@
@open-create-trigger-tab="openCreateElementTab('trigger')"
@open-create-routine-tab="openCreateElementTab('routine')"
@open-create-function-tab="openCreateElementTab('function')"
@show-create-trigger-function-modal="showCreateTriggerFunctionModal"
@open-create-trigger-function-tab="openCreateElementTab('trigger-function')"
@open-create-scheduler-tab="openCreateElementTab('scheduler')"
@reload="refresh"
/>
Expand Down Expand Up @@ -113,7 +101,7 @@
@open-create-trigger-tab="openCreateElementTab('trigger')"
@open-create-routine-tab="openCreateElementTab('routine')"
@open-create-function-tab="openCreateElementTab('function')"
@show-create-trigger-function-modal="showCreateTriggerFunctionModal"
@open-create-trigger-function-tab="openCreateElementTab('trigger-function')"
@open-create-scheduler-tab="openCreateElementTab('scheduler')"
@close-context="closeMiscFolderContext"
@reload="refresh"
Expand All @@ -136,8 +124,6 @@ import MiscContext from '@/components/WorkspaceExploreBarMiscContext';
import MiscFolderContext from '@/components/WorkspaceExploreBarMiscFolderContext';
import ModalNewSchema from '@/components/ModalNewSchema';
import ModalNewTriggerFunction from '@/components/ModalNewTriggerFunction';
export default {
name: 'WorkspaceExploreBar',
components: {
Expand All @@ -146,9 +132,7 @@ export default {
TableContext,
MiscContext,
MiscFolderContext,
ModalNewSchema,
ModalNewTriggerFunction
ModalNewSchema
},
props: {
connection: Object,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<div
v-if="selectedMisc === 'triggerFunction'"
class="context-element"
@click="$emit('show-create-trigger-function-modal')"
@click="$emit('open-create-trigger-function-tab')"
>
<span class="d-flex"><i class="mdi mdi-18px mdi-cog-clockwise text-light pr-1" /> {{ $t('message.createNewFunction') }}</span>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/components/WorkspaceExploreBarSchemaContext.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<div
v-if="workspace.customizations.triggerFunctionAdd"
class="context-element"
@click="showCreateTriggerFunctionModal"
@click="openCreateTriggerFunctionTab"
>
<span class="d-flex"><i class="mdi mdi-18px mdi-cog-clockwise pr-1" /> {{ $tc('word.triggerFunction', 1) }}</span>
</div>
Expand Down Expand Up @@ -147,8 +147,8 @@ export default {
openCreateFunctionTab () {
this.$emit('open-create-function-tab');
},
showCreateTriggerFunctionModal () {
this.$emit('show-create-trigger-function-modal');
openCreateTriggerFunctionTab () {
this.$emit('open-create-trigger-function-tab');
},
openCreateSchedulerTab () {
this.$emit('open-create-scheduler-tab');
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/components/WorkspaceTabNewFunction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export default {
},
created () {
this.originalFunction = {
sql: this.customizations.procedureSql,
sql: this.customizations.functionSql,
language: this.customizations.languages ? this.customizations.languages[0] : null,
name: '',
definer: '',
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/WorkspaceTabNewRoutine.vue
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ export default {
setTimeout(() => {
this.$refs.firstInput.focus();
}, 100);
window.addEventListener('resize', this.resizeQueryEditor);
},
destroyed () {
window.removeEventListener('resize', this.resizeQueryEditor);
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/WorkspaceTabNewScheduler.vue
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,8 @@ export default {
setTimeout(() => {
this.$refs.firstInput.focus();
}, 100);
window.addEventListener('resize', this.resizeQueryEditor);
},
destroyed () {
window.removeEventListener('resize', this.resizeQueryEditor);
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/WorkspaceTabNewTrigger.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ export default {
setTimeout(() => {
this.$refs.firstInput.focus();
}, 100);
window.addEventListener('resize', this.resizeQueryEditor);
},
destroyed () {
window.removeEventListener('resize', this.resizeQueryEditor);
Expand Down
Loading

0 comments on commit 09c07ac

Please sign in to comment.