mirror of
				https://github.com/Fabio286/antares.git
				synced 2025-06-05 21:59:22 +02:00 
			
		
		
		
	feat: new function, procedure and scheduler tabs
This commit is contained in:
		@@ -363,15 +363,14 @@ export class MySQLClient extends AntaresCore {
 | 
			
		||||
 | 
			
		||||
                  const details = fieldArr.slice(2).join(' ');
 | 
			
		||||
                  let defaultValue = null;
 | 
			
		||||
                  if (details.includes('DEFAULT')) {
 | 
			
		||||
                  if (details.includes('DEFAULT'))
 | 
			
		||||
                     defaultValue = details.match(/(?<=DEFAULT ).*?$/gs)[0].split(' COMMENT')[0];
 | 
			
		||||
                     const defaultValueArr = defaultValue.split('');
 | 
			
		||||
                     if (defaultValueArr[0] === '\'') {
 | 
			
		||||
                        defaultValueArr.shift();
 | 
			
		||||
                        defaultValueArr.pop();
 | 
			
		||||
                        defaultValue = defaultValueArr.join('');
 | 
			
		||||
                     }
 | 
			
		||||
                  }
 | 
			
		||||
                     // const defaultValueArr = defaultValue.split('');
 | 
			
		||||
                     // if (defaultValueArr[0] === '\'') {
 | 
			
		||||
                     //    defaultValueArr.shift();
 | 
			
		||||
                     //    defaultValueArr.pop();
 | 
			
		||||
                     //    defaultValue = defaultValueArr.join('');
 | 
			
		||||
                     // }
 | 
			
		||||
 | 
			
		||||
                  const typeAndLength = nameAndType[1].replace(')', '').split('(');
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -97,7 +97,7 @@
 | 
			
		||||
               </a>
 | 
			
		||||
 | 
			
		||||
               <a
 | 
			
		||||
                  v-else-if="tab.type === 'temp-trigger-props'"
 | 
			
		||||
                  v-else-if="tab.type.includes('temp-')"
 | 
			
		||||
                  class="tab-link"
 | 
			
		||||
                  :class="{'badge': tab.isChanged}"
 | 
			
		||||
                  @dblclick="openAsPermanentTab(tab)"
 | 
			
		||||
@@ -114,7 +114,7 @@
 | 
			
		||||
               </a>
 | 
			
		||||
 | 
			
		||||
               <a
 | 
			
		||||
                  v-else-if="tab.type === 'trigger-props'"
 | 
			
		||||
                  v-else
 | 
			
		||||
                  class="tab-link"
 | 
			
		||||
                  :class="{'badge': tab.isChanged}"
 | 
			
		||||
               >
 | 
			
		||||
@@ -129,7 +129,7 @@
 | 
			
		||||
                  </span>
 | 
			
		||||
               </a>
 | 
			
		||||
 | 
			
		||||
               <a
 | 
			
		||||
               <!-- <a
 | 
			
		||||
                  v-else-if="tab.type === 'temp-trigger-function-props'"
 | 
			
		||||
                  class="tab-link"
 | 
			
		||||
                  :class="{'badge': tab.isChanged}"
 | 
			
		||||
@@ -160,7 +160,7 @@
 | 
			
		||||
                        @click.stop="closeTab(tab)"
 | 
			
		||||
                     />
 | 
			
		||||
                  </span>
 | 
			
		||||
               </a>
 | 
			
		||||
               </a> -->
 | 
			
		||||
            </li>
 | 
			
		||||
            <li slot="header" class="tab-item dropdown tools-dropdown">
 | 
			
		||||
               <a
 | 
			
		||||
@@ -209,20 +209,7 @@
 | 
			
		||||
               </a>
 | 
			
		||||
            </li>
 | 
			
		||||
         </Draggable>
 | 
			
		||||
         <!--
 | 
			
		||||
         <WorkspacePropsTabRoutine
 | 
			
		||||
            v-show="selectedTab === 'prop' && workspace.breadcrumbs.procedure"
 | 
			
		||||
            :is-selected="selectedTab === 'prop'"
 | 
			
		||||
            :connection="connection"
 | 
			
		||||
            :routine="workspace.breadcrumbs.procedure"
 | 
			
		||||
         />
 | 
			
		||||
         <WorkspacePropsTabFunction
 | 
			
		||||
            v-show="selectedTab === 'prop' && workspace.breadcrumbs.function"
 | 
			
		||||
            :is-selected="selectedTab === 'prop'"
 | 
			
		||||
            :connection="connection"
 | 
			
		||||
            :function="workspace.breadcrumbs.function"
 | 
			
		||||
         />
 | 
			
		||||
         <WorkspacePropsTabScheduler
 | 
			
		||||
         <!--<WorkspacePropsTabScheduler
 | 
			
		||||
            v-show="selectedTab === 'prop' && workspace.breadcrumbs.scheduler"
 | 
			
		||||
            :is-selected="selectedTab === 'prop'"
 | 
			
		||||
            :connection="connection"
 | 
			
		||||
@@ -278,6 +265,30 @@
 | 
			
		||||
               :function="tab.elementName"
 | 
			
		||||
               :schema="tab.schema"
 | 
			
		||||
            />
 | 
			
		||||
            <WorkspacePropsTabRoutine
 | 
			
		||||
               v-else-if="['temp-routine-props', 'routine-props'].includes(tab.type)"
 | 
			
		||||
               :key="tab.uid"
 | 
			
		||||
               :connection="connection"
 | 
			
		||||
               :is-selected="selectedTab === tab.uid"
 | 
			
		||||
               :routine="tab.elementName"
 | 
			
		||||
               :schema="tab.schema"
 | 
			
		||||
            />
 | 
			
		||||
            <WorkspacePropsTabFunction
 | 
			
		||||
               v-else-if="['temp-function-props', 'function-props'].includes(tab.type)"
 | 
			
		||||
               :key="tab.uid"
 | 
			
		||||
               :connection="connection"
 | 
			
		||||
               :is-selected="selectedTab === tab.uid"
 | 
			
		||||
               :function="tab.elementName"
 | 
			
		||||
               :schema="tab.schema"
 | 
			
		||||
            />
 | 
			
		||||
            <WorkspacePropsTabScheduler
 | 
			
		||||
               v-else-if="['temp-scheduler-props', 'scheduler-props'].includes(tab.type)"
 | 
			
		||||
               :key="tab.uid"
 | 
			
		||||
               :connection="connection"
 | 
			
		||||
               :is-selected="selectedTab === tab.uid"
 | 
			
		||||
               :scheduler="tab.elementName"
 | 
			
		||||
               :schema="tab.schema"
 | 
			
		||||
            />
 | 
			
		||||
         </template>
 | 
			
		||||
      </div>
 | 
			
		||||
      <WorkspaceEditConnectionPanel v-else :connection="connection" />
 | 
			
		||||
@@ -308,9 +319,9 @@ import WorkspacePropsTab from '@/components/WorkspacePropsTab';
 | 
			
		||||
import WorkspacePropsTabView from '@/components/WorkspacePropsTabView';
 | 
			
		||||
import WorkspacePropsTabTrigger from '@/components/WorkspacePropsTabTrigger';
 | 
			
		||||
import WorkspacePropsTabTriggerFunction from '@/components/WorkspacePropsTabTriggerFunction';
 | 
			
		||||
// import WorkspacePropsTabRoutine from '@/components/WorkspacePropsTabRoutine';
 | 
			
		||||
// import WorkspacePropsTabFunction from '@/components/WorkspacePropsTabFunction';
 | 
			
		||||
// import WorkspacePropsTabScheduler from '@/components/WorkspacePropsTabScheduler';
 | 
			
		||||
import WorkspacePropsTabRoutine from '@/components/WorkspacePropsTabRoutine';
 | 
			
		||||
import WorkspacePropsTabFunction from '@/components/WorkspacePropsTabFunction';
 | 
			
		||||
import WorkspacePropsTabScheduler from '@/components/WorkspacePropsTabScheduler';
 | 
			
		||||
import ModalProcessesList from '@/components/ModalProcessesList';
 | 
			
		||||
import ModalDiscardChanges from '@/components/ModalDiscardChanges';
 | 
			
		||||
 | 
			
		||||
@@ -327,9 +338,9 @@ export default {
 | 
			
		||||
      WorkspacePropsTabView,
 | 
			
		||||
      WorkspacePropsTabTrigger,
 | 
			
		||||
      WorkspacePropsTabTriggerFunction,
 | 
			
		||||
      // WorkspacePropsTabRoutine,
 | 
			
		||||
      // WorkspacePropsTabFunction,
 | 
			
		||||
      // WorkspacePropsTabScheduler,
 | 
			
		||||
      WorkspacePropsTabRoutine,
 | 
			
		||||
      WorkspacePropsTabFunction,
 | 
			
		||||
      WorkspacePropsTabScheduler,
 | 
			
		||||
      ModalProcessesList,
 | 
			
		||||
      ModalDiscardChanges
 | 
			
		||||
   },
 | 
			
		||||
 
 | 
			
		||||
@@ -9,17 +9,17 @@
 | 
			
		||||
         <div class="workspace-explorebar-header">
 | 
			
		||||
            <span class="workspace-explorebar-title">{{ connectionName }}</span>
 | 
			
		||||
            <span v-if="workspace.connection_status === 'connected'" class="workspace-explorebar-tools">
 | 
			
		||||
               <i
 | 
			
		||||
                  class="mdi mdi-18px mdi-database-plus c-hand mr-2"
 | 
			
		||||
                  :title="$t('message.createNewSchema')"
 | 
			
		||||
                  @click="showNewDBModal"
 | 
			
		||||
               />
 | 
			
		||||
               <i
 | 
			
		||||
                  class="mdi mdi-18px mdi-refresh c-hand mr-2"
 | 
			
		||||
                  :class="{'rotate':isRefreshing}"
 | 
			
		||||
                  :title="$t('word.refresh')"
 | 
			
		||||
                  @click="refresh"
 | 
			
		||||
               />
 | 
			
		||||
               <i
 | 
			
		||||
                  class="mdi mdi-18px mdi-database-plus c-hand mr-2"
 | 
			
		||||
                  :title="$t('message.createNewSchema')"
 | 
			
		||||
                  @click="showNewDBModal"
 | 
			
		||||
               />
 | 
			
		||||
               <i
 | 
			
		||||
                  class="mdi mdi-18px mdi-power-plug-off c-hand"
 | 
			
		||||
                  :title="$t('word.disconnect')"
 | 
			
		||||
@@ -384,6 +384,7 @@ export default {
 | 
			
		||||
         if (status === 'success') {
 | 
			
		||||
            await this.refresh();
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.selectedSchema, view: payload.name });
 | 
			
		||||
 | 
			
		||||
            this.newTab({
 | 
			
		||||
               uid: this.workspace.uid,
 | 
			
		||||
               schema: this.selectedSchema,
 | 
			
		||||
@@ -445,8 +446,15 @@ export default {
 | 
			
		||||
 | 
			
		||||
         if (status === 'success') {
 | 
			
		||||
            await this.refresh();
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.selectedSchema, procedure: payload.name });
 | 
			
		||||
            this.selectTab({ uid: this.workspace.uid, tab: 'prop' });
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.selectedSchema, routine: payload.name });
 | 
			
		||||
 | 
			
		||||
            this.newTab({
 | 
			
		||||
               uid: this.workspace.uid,
 | 
			
		||||
               schema: this.selectedSchema,
 | 
			
		||||
               elementName: payload.name,
 | 
			
		||||
               elementType: 'procedure',
 | 
			
		||||
               type: 'procedure-props'
 | 
			
		||||
            });
 | 
			
		||||
         }
 | 
			
		||||
         else
 | 
			
		||||
            this.addNotification({ status: 'error', message: response });
 | 
			
		||||
@@ -486,7 +494,14 @@ export default {
 | 
			
		||||
         if (status === 'success') {
 | 
			
		||||
            await this.refresh();
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.selectedSchema, function: payload.name });
 | 
			
		||||
            this.selectTab({ uid: this.workspace.uid, tab: 'prop' });
 | 
			
		||||
 | 
			
		||||
            this.newTab({
 | 
			
		||||
               uid: this.workspace.uid,
 | 
			
		||||
               schema: this.selectedSchema,
 | 
			
		||||
               elementName: payload.name,
 | 
			
		||||
               elementType: 'function',
 | 
			
		||||
               type: 'function-props'
 | 
			
		||||
            });
 | 
			
		||||
         }
 | 
			
		||||
         else
 | 
			
		||||
            this.addNotification({ status: 'error', message: response });
 | 
			
		||||
@@ -502,7 +517,14 @@ export default {
 | 
			
		||||
         if (status === 'success') {
 | 
			
		||||
            await this.refresh();
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.selectedSchema, triggerFunction: payload.name });
 | 
			
		||||
            this.selectTab({ uid: this.workspace.uid, tab: 'prop' });
 | 
			
		||||
 | 
			
		||||
            this.newTab({
 | 
			
		||||
               uid: this.workspace.uid,
 | 
			
		||||
               schema: this.selectedSchema,
 | 
			
		||||
               elementName: payload.name,
 | 
			
		||||
               elementType: 'triggerFunction',
 | 
			
		||||
               type: 'trigger-function-props'
 | 
			
		||||
            });
 | 
			
		||||
         }
 | 
			
		||||
         else
 | 
			
		||||
            this.addNotification({ status: 'error', message: response });
 | 
			
		||||
@@ -518,7 +540,14 @@ export default {
 | 
			
		||||
         if (status === 'success') {
 | 
			
		||||
            await this.refresh();
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.selectedSchema, scheduler: payload.name });
 | 
			
		||||
            this.selectTab({ uid: this.workspace.uid, tab: 'prop' });
 | 
			
		||||
 | 
			
		||||
            this.newTab({
 | 
			
		||||
               uid: this.workspace.uid,
 | 
			
		||||
               schema: this.selectedSchema,
 | 
			
		||||
               elementName: payload.name,
 | 
			
		||||
               elementType: 'scheduler',
 | 
			
		||||
               type: 'scheduler-props'
 | 
			
		||||
            });
 | 
			
		||||
         }
 | 
			
		||||
         else
 | 
			
		||||
            this.addNotification({ status: 'error', message: response });
 | 
			
		||||
 
 | 
			
		||||
@@ -75,7 +75,7 @@
 | 
			
		||||
            <details class="accordion">
 | 
			
		||||
               <summary
 | 
			
		||||
                  class="accordion-header misc-name"
 | 
			
		||||
                  :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.procedure}"
 | 
			
		||||
                  :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.routine}"
 | 
			
		||||
                  @contextmenu.prevent="showMiscFolderContext($event, 'procedure')"
 | 
			
		||||
               >
 | 
			
		||||
                  <i class="misc-icon mdi mdi-18px mdi-folder-sync mr-1" />
 | 
			
		||||
@@ -88,8 +88,9 @@
 | 
			
		||||
                           v-for="(procedure, i) of filteredProcedures"
 | 
			
		||||
                           :key="`${procedure.name}-${i}`"
 | 
			
		||||
                           class="menu-item"
 | 
			
		||||
                           :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.procedure === procedure.name}"
 | 
			
		||||
                           @click="setBreadcrumbs({schema: database.name, procedure: procedure.name})"
 | 
			
		||||
                           :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.routine === procedure.name}"
 | 
			
		||||
                           @click="selectMisc({schema: database.name, misc: procedure, type: 'routine'})"
 | 
			
		||||
                           @dblclick="openMiscPermanentTab({schema: database.name, misc: procedure, type: 'routine'})"
 | 
			
		||||
                           @contextmenu.prevent="showMiscContext($event, {...procedure, type: 'procedure'})"
 | 
			
		||||
                        >
 | 
			
		||||
                           <a class="table-name">
 | 
			
		||||
@@ -154,7 +155,8 @@
 | 
			
		||||
                           :key="`${func.name}-${i}`"
 | 
			
		||||
                           class="menu-item"
 | 
			
		||||
                           :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.function === func.name}"
 | 
			
		||||
                           @click="setBreadcrumbs({schema: database.name, function: func.name})"
 | 
			
		||||
                           @click="selectMisc({schema: database.name, misc: func, type: 'function'})"
 | 
			
		||||
                           @dblclick="openMiscPermanentTab({schema: database.name, misc: func, type: 'function'})"
 | 
			
		||||
                           @contextmenu.prevent="showMiscContext($event, {...func, type: 'function'})"
 | 
			
		||||
                        >
 | 
			
		||||
                           <a class="table-name">
 | 
			
		||||
@@ -186,7 +188,8 @@
 | 
			
		||||
                           :key="scheduler.name"
 | 
			
		||||
                           class="menu-item"
 | 
			
		||||
                           :class="{'text-bold': breadcrumbs.schema === database.name && breadcrumbs.scheduler === scheduler.name}"
 | 
			
		||||
                           @click="setBreadcrumbs({schema: database.name, scheduler: scheduler.name})"
 | 
			
		||||
                           @click="selectMisc({schema: database.name, misc: scheduler, type: 'scheduler'})"
 | 
			
		||||
                           @dblclick="openMiscPermanentTab({schema: database.name, misc: scheduler, type: 'scheduler'})"
 | 
			
		||||
                           @contextmenu.prevent="showMiscContext($event, {...scheduler, type: 'scheduler'})"
 | 
			
		||||
                        >
 | 
			
		||||
                           <a class="table-name">
 | 
			
		||||
@@ -290,7 +293,10 @@ export default {
 | 
			
		||||
      selectMisc ({ schema, misc, type }) {
 | 
			
		||||
         const miscTempTabs = {
 | 
			
		||||
            trigger: 'temp-trigger-props',
 | 
			
		||||
            triggerFunction: 'temp-trigger-function-props'
 | 
			
		||||
            triggerFunction: 'temp-trigger-function-props',
 | 
			
		||||
            function: 'temp-function-props',
 | 
			
		||||
            routine: 'temp-routine-props',
 | 
			
		||||
            scheduler: 'temp-scheduler-props'
 | 
			
		||||
         };
 | 
			
		||||
 | 
			
		||||
         this.newTab({
 | 
			
		||||
@@ -310,7 +316,10 @@ export default {
 | 
			
		||||
      openMiscPermanentTab ({ schema, misc, type }) {
 | 
			
		||||
         const miscTabs = {
 | 
			
		||||
            trigger: 'trigger-props',
 | 
			
		||||
            triggerFunction: 'trigger-function-props'
 | 
			
		||||
            triggerFunction: 'trigger-function-props',
 | 
			
		||||
            function: 'function-props',
 | 
			
		||||
            routine: 'routine-props',
 | 
			
		||||
            scheduler: 'scheduler-props'
 | 
			
		||||
         };
 | 
			
		||||
 | 
			
		||||
         this.newTab({
 | 
			
		||||
@@ -323,19 +332,15 @@ export default {
 | 
			
		||||
         this.setBreadcrumbs({ schema, [type]: misc.name });
 | 
			
		||||
      },
 | 
			
		||||
      showSchemaContext (event, schema) {
 | 
			
		||||
         this.selectSchema(schema);
 | 
			
		||||
         this.$emit('show-schema-context', { event, schema });
 | 
			
		||||
      },
 | 
			
		||||
      showTableContext (event, table) {
 | 
			
		||||
         this.$emit('show-table-context', { event, schema: this.database.name, table });
 | 
			
		||||
      },
 | 
			
		||||
      showMiscContext (event, misc) {
 | 
			
		||||
         this.setBreadcrumbs({ schema: this.database.name, [misc.type]: misc.name });
 | 
			
		||||
         this.$emit('show-misc-context', { event, schema: this.database.name, misc });
 | 
			
		||||
      },
 | 
			
		||||
      showMiscFolderContext (event, type) {
 | 
			
		||||
         this.selectSchema(this.database.name);
 | 
			
		||||
         this.setBreadcrumbs({ schema: this.database.name, type });
 | 
			
		||||
         this.$emit('show-misc-folder-context', { event, schema: this.database.name, type });
 | 
			
		||||
      },
 | 
			
		||||
      piePercentage (val) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <div class="workspace-query-tab column col-12 columns col-gapless">
 | 
			
		||||
   <div v-show="isSelected" class="workspace-query-tab column col-12 columns col-gapless">
 | 
			
		||||
      <div class="workspace-query-runner column col-12">
 | 
			
		||||
         <div class="workspace-query-runner-footer">
 | 
			
		||||
            <div class="workspace-query-buttons">
 | 
			
		||||
@@ -42,6 +42,11 @@
 | 
			
		||||
                  <span>{{ $t('word.options') }}</span>
 | 
			
		||||
               </button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="workspace-query-info">
 | 
			
		||||
               <div class="d-flex" :title="$t('word.schema')">
 | 
			
		||||
                  <i class="mdi mdi-18px mdi-database mr-1" /><b>{{ schema }}</b>
 | 
			
		||||
               </div>
 | 
			
		||||
            </div>
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="workspace-query-results column col-12 mt-2 p-relative">
 | 
			
		||||
@@ -102,11 +107,12 @@ export default {
 | 
			
		||||
   },
 | 
			
		||||
   props: {
 | 
			
		||||
      connection: Object,
 | 
			
		||||
      function: String
 | 
			
		||||
      function: String,
 | 
			
		||||
      isSelected: Boolean,
 | 
			
		||||
      schema: String
 | 
			
		||||
   },
 | 
			
		||||
   data () {
 | 
			
		||||
      return {
 | 
			
		||||
         tabUid: 'prop',
 | 
			
		||||
         isLoading: false,
 | 
			
		||||
         isSaving: false,
 | 
			
		||||
         isOptionsModal: false,
 | 
			
		||||
@@ -127,11 +133,8 @@ export default {
 | 
			
		||||
      workspace () {
 | 
			
		||||
         return this.getWorkspace(this.connection.uid);
 | 
			
		||||
      },
 | 
			
		||||
      isSelected () {
 | 
			
		||||
         return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.function;
 | 
			
		||||
      },
 | 
			
		||||
      schema () {
 | 
			
		||||
         return this.workspace.breadcrumbs.schema;
 | 
			
		||||
      tabUid () {
 | 
			
		||||
         return this.$vnode.key;
 | 
			
		||||
      },
 | 
			
		||||
      isChanged () {
 | 
			
		||||
         return JSON.stringify(this.originalFunction) !== JSON.stringify(this.localFunction);
 | 
			
		||||
@@ -150,6 +153,13 @@ export default {
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   watch: {
 | 
			
		||||
      async schema () {
 | 
			
		||||
         if (this.isSelected) {
 | 
			
		||||
            await this.getFunctionData();
 | 
			
		||||
            this.$refs.queryEditor.editor.session.setValue(this.localFunction.sql);
 | 
			
		||||
            this.lastFunction = this.function;
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      async function () {
 | 
			
		||||
         if (this.isSelected) {
 | 
			
		||||
            await this.getFunctionData();
 | 
			
		||||
@@ -158,26 +168,28 @@ export default {
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      async isSelected (val) {
 | 
			
		||||
         if (val && this.lastFunction !== this.function) {
 | 
			
		||||
            await this.getFunctionData();
 | 
			
		||||
            this.$refs.queryEditor.editor.session.setValue(this.localFunction.sql);
 | 
			
		||||
            this.lastFunction = this.function;
 | 
			
		||||
         if (val) {
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.schema, function: this.function });
 | 
			
		||||
 | 
			
		||||
            if (this.lastFunction !== this.function)
 | 
			
		||||
               this.getRoutineData();
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      isChanged (val) {
 | 
			
		||||
         if (this.isSelected && this.lastFunction === this.function && this.function !== null)
 | 
			
		||||
            this.setUnsavedChanges(val);
 | 
			
		||||
         this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val });
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   async created () {
 | 
			
		||||
      await this.getFunctionData();
 | 
			
		||||
      this.$refs.queryEditor.editor.session.setValue(this.localFunction.sql);
 | 
			
		||||
      window.addEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
   mounted () {
 | 
			
		||||
      window.addEventListener('resize', this.resizeQueryEditor);
 | 
			
		||||
   },
 | 
			
		||||
   destroyed () {
 | 
			
		||||
      window.removeEventListener('resize', this.resizeQueryEditor);
 | 
			
		||||
   },
 | 
			
		||||
   created () {
 | 
			
		||||
      window.addEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
   beforeDestroy () {
 | 
			
		||||
      window.removeEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
@@ -185,20 +197,22 @@ export default {
 | 
			
		||||
      ...mapActions({
 | 
			
		||||
         addNotification: 'notifications/addNotification',
 | 
			
		||||
         refreshStructure: 'workspaces/refreshStructure',
 | 
			
		||||
         setUnsavedChanges: 'workspaces/setUnsavedChanges',
 | 
			
		||||
         renameTabs: 'workspaces/renameTabs',
 | 
			
		||||
         newTab: 'workspaces/newTab',
 | 
			
		||||
         changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
 | 
			
		||||
         newTab: 'workspaces/newTab'
 | 
			
		||||
         setUnsavedChanges: 'workspaces/setUnsavedChanges'
 | 
			
		||||
      }),
 | 
			
		||||
      async getFunctionData () {
 | 
			
		||||
         if (!this.function) return;
 | 
			
		||||
 | 
			
		||||
         this.isLoading = true;
 | 
			
		||||
         this.localFunction = { sql: '' };
 | 
			
		||||
         this.lastFunction = this.function;
 | 
			
		||||
 | 
			
		||||
         const params = {
 | 
			
		||||
            uid: this.connection.uid,
 | 
			
		||||
            schema: this.schema,
 | 
			
		||||
            func: this.workspace.breadcrumbs.function
 | 
			
		||||
            func: this.function
 | 
			
		||||
         };
 | 
			
		||||
 | 
			
		||||
         try {
 | 
			
		||||
@@ -245,7 +259,14 @@ export default {
 | 
			
		||||
               await this.refreshStructure(this.connection.uid);
 | 
			
		||||
 | 
			
		||||
               if (oldName !== this.localFunction.name) {
 | 
			
		||||
                  this.setUnsavedChanges(false);
 | 
			
		||||
                  this.renameTabs({
 | 
			
		||||
                     uid: this.connection.uid,
 | 
			
		||||
                     schema: this.schema,
 | 
			
		||||
                     elementName: oldName,
 | 
			
		||||
                     elementNewName: this.localFunction.name,
 | 
			
		||||
                     elementType: 'function'
 | 
			
		||||
                  });
 | 
			
		||||
 | 
			
		||||
                  this.changeBreadcrumbs({ schema: this.schema, function: this.localFunction.name });
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <div class="workspace-query-tab column col-12 columns col-gapless">
 | 
			
		||||
   <div v-show="isSelected" class="workspace-query-tab column col-12 columns col-gapless">
 | 
			
		||||
      <div class="workspace-query-runner column col-12">
 | 
			
		||||
         <div class="workspace-query-runner-footer">
 | 
			
		||||
            <div class="workspace-query-buttons">
 | 
			
		||||
@@ -42,6 +42,11 @@
 | 
			
		||||
                  <span>{{ $t('word.options') }}</span>
 | 
			
		||||
               </button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="workspace-query-info">
 | 
			
		||||
               <div class="d-flex" :title="$t('word.schema')">
 | 
			
		||||
                  <i class="mdi mdi-18px mdi-database mr-1" /><b>{{ schema }}</b>
 | 
			
		||||
               </div>
 | 
			
		||||
            </div>
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="workspace-query-results column col-12 mt-2 p-relative">
 | 
			
		||||
@@ -103,11 +108,12 @@ export default {
 | 
			
		||||
   },
 | 
			
		||||
   props: {
 | 
			
		||||
      connection: Object,
 | 
			
		||||
      routine: String
 | 
			
		||||
      routine: String,
 | 
			
		||||
      isSelected: Boolean,
 | 
			
		||||
      schema: String
 | 
			
		||||
   },
 | 
			
		||||
   data () {
 | 
			
		||||
      return {
 | 
			
		||||
         tabUid: 'prop',
 | 
			
		||||
         isLoading: false,
 | 
			
		||||
         isSaving: false,
 | 
			
		||||
         isOptionsModal: false,
 | 
			
		||||
@@ -128,11 +134,8 @@ export default {
 | 
			
		||||
      workspace () {
 | 
			
		||||
         return this.getWorkspace(this.connection.uid);
 | 
			
		||||
      },
 | 
			
		||||
      isSelected () {
 | 
			
		||||
         return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.routine;
 | 
			
		||||
      },
 | 
			
		||||
      schema () {
 | 
			
		||||
         return this.workspace.breadcrumbs.schema;
 | 
			
		||||
      tabUid () {
 | 
			
		||||
         return this.$vnode.key;
 | 
			
		||||
      },
 | 
			
		||||
      isChanged () {
 | 
			
		||||
         return JSON.stringify(this.originalRoutine) !== JSON.stringify(this.localRoutine);
 | 
			
		||||
@@ -149,6 +152,13 @@ export default {
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   watch: {
 | 
			
		||||
      async schema () {
 | 
			
		||||
         if (this.isSelected) {
 | 
			
		||||
            await this.getRoutineData();
 | 
			
		||||
            this.$refs.queryEditor.editor.session.setValue(this.localRoutine.sql);
 | 
			
		||||
            this.lastRoutine = this.routine;
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      async routine () {
 | 
			
		||||
         if (this.isSelected) {
 | 
			
		||||
            await this.getRoutineData();
 | 
			
		||||
@@ -157,26 +167,28 @@ export default {
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      async isSelected (val) {
 | 
			
		||||
         if (val && this.lastRoutine !== this.routine) {
 | 
			
		||||
            await this.getRoutineData();
 | 
			
		||||
            this.$refs.queryEditor.editor.session.setValue(this.localRoutine.sql);
 | 
			
		||||
            this.lastRoutine = this.routine;
 | 
			
		||||
         if (val) {
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.schema, routine: this.routine });
 | 
			
		||||
 | 
			
		||||
            if (this.lastRoutine !== this.routine)
 | 
			
		||||
               this.getRoutineData();
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      isChanged (val) {
 | 
			
		||||
         if (this.isSelected && this.lastRoutine === this.routine && this.routine !== null)
 | 
			
		||||
            this.setUnsavedChanges(val);
 | 
			
		||||
         this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val });
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   async created () {
 | 
			
		||||
      await this.getRoutineData();
 | 
			
		||||
      this.$refs.queryEditor.editor.session.setValue(this.localRoutine.sql);
 | 
			
		||||
      window.addEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
   mounted () {
 | 
			
		||||
      window.addEventListener('resize', this.resizeQueryEditor);
 | 
			
		||||
   },
 | 
			
		||||
   destroyed () {
 | 
			
		||||
      window.removeEventListener('resize', this.resizeQueryEditor);
 | 
			
		||||
   },
 | 
			
		||||
   created () {
 | 
			
		||||
      window.addEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
   beforeDestroy () {
 | 
			
		||||
      window.removeEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
@@ -184,19 +196,22 @@ export default {
 | 
			
		||||
      ...mapActions({
 | 
			
		||||
         addNotification: 'notifications/addNotification',
 | 
			
		||||
         refreshStructure: 'workspaces/refreshStructure',
 | 
			
		||||
         setUnsavedChanges: 'workspaces/setUnsavedChanges',
 | 
			
		||||
         renameTabs: 'workspaces/renameTabs',
 | 
			
		||||
         newTab: 'workspaces/newTab',
 | 
			
		||||
         changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
 | 
			
		||||
         newTab: 'workspaces/newTab'
 | 
			
		||||
         setUnsavedChanges: 'workspaces/setUnsavedChanges'
 | 
			
		||||
      }),
 | 
			
		||||
      async getRoutineData () {
 | 
			
		||||
         if (!this.routine) return;
 | 
			
		||||
 | 
			
		||||
         this.localRoutine = { sql: '' };
 | 
			
		||||
         this.isLoading = true;
 | 
			
		||||
         this.lastRoutine = this.routine;
 | 
			
		||||
 | 
			
		||||
         const params = {
 | 
			
		||||
            uid: this.connection.uid,
 | 
			
		||||
            schema: this.schema,
 | 
			
		||||
            routine: this.workspace.breadcrumbs.procedure
 | 
			
		||||
            routine: this.routine
 | 
			
		||||
         };
 | 
			
		||||
 | 
			
		||||
         try {
 | 
			
		||||
@@ -243,7 +258,14 @@ export default {
 | 
			
		||||
               await this.refreshStructure(this.connection.uid);
 | 
			
		||||
 | 
			
		||||
               if (oldName !== this.localRoutine.name) {
 | 
			
		||||
                  this.setUnsavedChanges(false);
 | 
			
		||||
                  this.renameTabs({
 | 
			
		||||
                     uid: this.connection.uid,
 | 
			
		||||
                     schema: this.schema,
 | 
			
		||||
                     elementName: oldName,
 | 
			
		||||
                     elementNewName: this.localRoutine.name,
 | 
			
		||||
                     elementType: 'procedure'
 | 
			
		||||
                  });
 | 
			
		||||
 | 
			
		||||
                  this.changeBreadcrumbs({ schema: this.schema, procedure: this.localRoutine.name });
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
<template>
 | 
			
		||||
   <div class="workspace-query-tab column col-12 columns col-gapless">
 | 
			
		||||
   <div v-show="isSelected" class="workspace-query-tab column col-12 columns col-gapless">
 | 
			
		||||
      <div class="workspace-query-runner column col-12">
 | 
			
		||||
         <div class="workspace-query-runner-footer">
 | 
			
		||||
            <div class="workspace-query-buttons">
 | 
			
		||||
@@ -29,6 +29,11 @@
 | 
			
		||||
                  <span>{{ $t('word.timing') }}</span>
 | 
			
		||||
               </button>
 | 
			
		||||
            </div>
 | 
			
		||||
            <div class="workspace-query-info">
 | 
			
		||||
               <div class="d-flex" :title="$t('word.schema')">
 | 
			
		||||
                  <i class="mdi mdi-18px mdi-database mr-1" /><b>{{ schema }}</b>
 | 
			
		||||
               </div>
 | 
			
		||||
            </div>
 | 
			
		||||
         </div>
 | 
			
		||||
      </div>
 | 
			
		||||
      <div class="container">
 | 
			
		||||
@@ -153,11 +158,12 @@ export default {
 | 
			
		||||
   },
 | 
			
		||||
   props: {
 | 
			
		||||
      connection: Object,
 | 
			
		||||
      scheduler: String
 | 
			
		||||
      scheduler: String,
 | 
			
		||||
      isSelected: Boolean,
 | 
			
		||||
      schema: String
 | 
			
		||||
   },
 | 
			
		||||
   data () {
 | 
			
		||||
      return {
 | 
			
		||||
         tabUid: 'prop',
 | 
			
		||||
         isLoading: false,
 | 
			
		||||
         isSaving: false,
 | 
			
		||||
         isTimingModal: false,
 | 
			
		||||
@@ -176,11 +182,8 @@ export default {
 | 
			
		||||
      workspace () {
 | 
			
		||||
         return this.getWorkspace(this.connection.uid);
 | 
			
		||||
      },
 | 
			
		||||
      isSelected () {
 | 
			
		||||
         return this.workspace.selected_tab === 'prop' && this.selectedWorkspace === this.workspace.uid && this.scheduler;
 | 
			
		||||
      },
 | 
			
		||||
      schema () {
 | 
			
		||||
         return this.workspace.breadcrumbs.schema;
 | 
			
		||||
      tabUid () {
 | 
			
		||||
         return this.$vnode.key;
 | 
			
		||||
      },
 | 
			
		||||
      isChanged () {
 | 
			
		||||
         return JSON.stringify(this.originalScheduler) !== JSON.stringify(this.localScheduler);
 | 
			
		||||
@@ -197,6 +200,13 @@ export default {
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   watch: {
 | 
			
		||||
      async schema () {
 | 
			
		||||
         if (this.isSelected) {
 | 
			
		||||
            await this.getSchedulerData();
 | 
			
		||||
            this.$refs.queryEditor.editor.session.setValue(this.localScheduler.sql);
 | 
			
		||||
            this.lastScheduler = this.scheduler;
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      async scheduler () {
 | 
			
		||||
         if (this.isSelected) {
 | 
			
		||||
            await this.getSchedulerData();
 | 
			
		||||
@@ -205,26 +215,28 @@ export default {
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      async isSelected (val) {
 | 
			
		||||
         if (val && this.lastScheduler !== this.scheduler) {
 | 
			
		||||
            await this.getSchedulerData();
 | 
			
		||||
            this.$refs.queryEditor.editor.session.setValue(this.localScheduler.sql);
 | 
			
		||||
            this.lastScheduler = this.scheduler;
 | 
			
		||||
         if (val) {
 | 
			
		||||
            this.changeBreadcrumbs({ schema: this.schema, scheduler: this.scheduler });
 | 
			
		||||
 | 
			
		||||
            if (this.lastScheduler !== this.scheduler)
 | 
			
		||||
               this.getSchedulerData();
 | 
			
		||||
         }
 | 
			
		||||
      },
 | 
			
		||||
      isChanged (val) {
 | 
			
		||||
         if (this.isSelected && this.lastScheduler === this.scheduler && this.scheduler !== null)
 | 
			
		||||
            this.setUnsavedChanges(val);
 | 
			
		||||
         this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val });
 | 
			
		||||
      }
 | 
			
		||||
   },
 | 
			
		||||
   async created () {
 | 
			
		||||
      await this.getSchedulerData();
 | 
			
		||||
      this.$refs.queryEditor.editor.session.setValue(this.localScheduler.sql);
 | 
			
		||||
      window.addEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
   mounted () {
 | 
			
		||||
      window.addEventListener('resize', this.resizeQueryEditor);
 | 
			
		||||
   },
 | 
			
		||||
   destroyed () {
 | 
			
		||||
      window.removeEventListener('resize', this.resizeQueryEditor);
 | 
			
		||||
   },
 | 
			
		||||
   created () {
 | 
			
		||||
      window.addEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
   beforeDestroy () {
 | 
			
		||||
      window.removeEventListener('keydown', this.onKey);
 | 
			
		||||
   },
 | 
			
		||||
@@ -232,17 +244,21 @@ export default {
 | 
			
		||||
      ...mapActions({
 | 
			
		||||
         addNotification: 'notifications/addNotification',
 | 
			
		||||
         refreshStructure: 'workspaces/refreshStructure',
 | 
			
		||||
         setUnsavedChanges: 'workspaces/setUnsavedChanges',
 | 
			
		||||
         changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
 | 
			
		||||
         renameTabs: 'workspaces/renameTabs',
 | 
			
		||||
         newTab: 'workspaces/newTab',
 | 
			
		||||
         changeBreadcrumbs: 'workspaces/changeBreadcrumbs',
 | 
			
		||||
         setUnsavedChanges: 'workspaces/setUnsavedChanges'
 | 
			
		||||
      }),
 | 
			
		||||
      async getSchedulerData () {
 | 
			
		||||
         if (!this.scheduler) return;
 | 
			
		||||
 | 
			
		||||
         this.isLoading = true;
 | 
			
		||||
         this.lastScheduler = this.scheduler;
 | 
			
		||||
 | 
			
		||||
         const params = {
 | 
			
		||||
            uid: this.connection.uid,
 | 
			
		||||
            schema: this.schema,
 | 
			
		||||
            scheduler: this.workspace.breadcrumbs.scheduler
 | 
			
		||||
            scheduler: this.scheduler
 | 
			
		||||
         };
 | 
			
		||||
 | 
			
		||||
         try {
 | 
			
		||||
@@ -283,7 +299,14 @@ export default {
 | 
			
		||||
               await this.refreshStructure(this.connection.uid);
 | 
			
		||||
 | 
			
		||||
               if (oldName !== this.localScheduler.name) {
 | 
			
		||||
                  this.setUnsavedChanges(false);
 | 
			
		||||
                  this.renameTabs({
 | 
			
		||||
                     uid: this.connection.uid,
 | 
			
		||||
                     schema: this.schema,
 | 
			
		||||
                     elementName: oldName,
 | 
			
		||||
                     elementNewName: this.localScheduler.name,
 | 
			
		||||
                     elementType: 'scheduler'
 | 
			
		||||
                  });
 | 
			
		||||
 | 
			
		||||
                  this.changeBreadcrumbs({ schema: this.schema, scheduler: this.localScheduler.name });
 | 
			
		||||
               }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -597,7 +597,10 @@ export default {
 | 
			
		||||
            }
 | 
			
		||||
               break;
 | 
			
		||||
            case 'temp-trigger-props':
 | 
			
		||||
            case 'temp-trigger-function-props': {
 | 
			
		||||
            case 'temp-trigger-function-props':
 | 
			
		||||
            case 'temp-function-props':
 | 
			
		||||
            case 'temp-routine-props':
 | 
			
		||||
            case 'temp-scheduler-props': {
 | 
			
		||||
               const existentTab = workspaceTabs
 | 
			
		||||
                  ? workspaceTabs.tabs.find(tab =>
 | 
			
		||||
                     tab.schema === schema &&
 | 
			
		||||
@@ -640,7 +643,10 @@ export default {
 | 
			
		||||
            }
 | 
			
		||||
               break;
 | 
			
		||||
            case 'trigger-props':
 | 
			
		||||
            case 'trigger-function-props': {
 | 
			
		||||
            case 'trigger-function-props':
 | 
			
		||||
            case 'function-props':
 | 
			
		||||
            case 'routine-props':
 | 
			
		||||
            case 'scheduler-props': {
 | 
			
		||||
               const existentTab = workspaceTabs
 | 
			
		||||
                  ? workspaceTabs.tabs.find(tab =>
 | 
			
		||||
                     tab.schema === schema &&
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user