mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
feat: new create table tabs
This commit is contained in:
@ -31,7 +31,11 @@
|
||||
class="form-input"
|
||||
type="text"
|
||||
>
|
||||
<span class="input-group-addon field-type" :class="typeClass(parameter.type)">
|
||||
<span
|
||||
:title="`${parameter.type} ${parameter.length}`"
|
||||
class="input-group-addon field-type cut-text"
|
||||
:class="typeClass(parameter.type)"
|
||||
>
|
||||
{{ parameter.type }} {{ parameter.length | wrapNumber }}
|
||||
</span>
|
||||
</div>
|
||||
@ -127,4 +131,8 @@ export default {
|
||||
.field-type {
|
||||
font-size: 0.6rem;
|
||||
}
|
||||
|
||||
.input-group-addon {
|
||||
max-width: 100px;
|
||||
}
|
||||
</style>
|
||||
|
@ -68,6 +68,23 @@
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
v-else-if="tab.type === 'new-table'"
|
||||
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.newTable') }}
|
||||
<span
|
||||
class="btn btn-clear"
|
||||
:title="$t('word.close')"
|
||||
@mousedown.left.stop
|
||||
@click.stop="closeTab(tab)"
|
||||
/>
|
||||
</span>
|
||||
</a>
|
||||
|
||||
<a
|
||||
v-else-if="tab.type === 'table-props'"
|
||||
class="tab-link"
|
||||
@ -202,6 +219,15 @@
|
||||
:schema="tab.schema"
|
||||
:element-type="tab.elementType"
|
||||
/>
|
||||
<WorkspaceTabNewTable
|
||||
v-else-if="tab.type === 'new-table'"
|
||||
:key="tab.uid"
|
||||
:tab="tab"
|
||||
:connection="connection"
|
||||
:is-selected="selectedTab === tab.uid"
|
||||
:table="tab.elementName"
|
||||
:schema="tab.schema"
|
||||
/>
|
||||
<WorkspaceTabPropsTable
|
||||
v-else-if="tab.type === 'table-props'"
|
||||
:key="tab.uid"
|
||||
@ -284,6 +310,9 @@ import WorkspaceExploreBar from '@/components/WorkspaceExploreBar';
|
||||
import WorkspaceEditConnectionPanel from '@/components/WorkspaceEditConnectionPanel';
|
||||
import WorkspaceTabQuery from '@/components/WorkspaceTabQuery';
|
||||
import WorkspaceTabTable from '@/components/WorkspaceTabTable';
|
||||
|
||||
import WorkspaceTabNewTable from '@/components/WorkspaceTabNewTable';
|
||||
|
||||
import WorkspaceTabPropsTable from '@/components/WorkspaceTabPropsTable';
|
||||
import WorkspaceTabPropsView from '@/components/WorkspaceTabPropsView';
|
||||
import WorkspaceTabPropsTrigger from '@/components/WorkspaceTabPropsTrigger';
|
||||
@ -303,6 +332,7 @@ export default {
|
||||
WorkspaceEditConnectionPanel,
|
||||
WorkspaceTabQuery,
|
||||
WorkspaceTabTable,
|
||||
WorkspaceTabNewTable,
|
||||
WorkspaceTabPropsTable,
|
||||
WorkspaceTabPropsView,
|
||||
WorkspaceTabPropsTrigger,
|
||||
|
@ -61,12 +61,6 @@
|
||||
@close="hideNewDBModal"
|
||||
@reload="refresh"
|
||||
/>
|
||||
<ModalNewTable
|
||||
v-if="isNewTableModal"
|
||||
:workspace="workspace"
|
||||
@close="hideCreateTableModal"
|
||||
@open-create-table-editor="openCreateTableEditor"
|
||||
/>
|
||||
<ModalNewView
|
||||
v-if="isNewViewModal"
|
||||
:workspace="workspace"
|
||||
@ -108,7 +102,7 @@
|
||||
:selected-schema="selectedSchema"
|
||||
:context-event="databaseContextEvent"
|
||||
@close-context="closeDatabaseContext"
|
||||
@show-create-table-modal="showCreateTableModal"
|
||||
@open-create-table-tab="openCreateTableTab"
|
||||
@show-create-view-modal="showCreateViewModal"
|
||||
@show-create-trigger-modal="showCreateTriggerModal"
|
||||
@show-create-routine-modal="showCreateRoutineModal"
|
||||
@ -165,7 +159,6 @@ import TableContext from '@/components/WorkspaceExploreBarTableContext';
|
||||
import MiscContext from '@/components/WorkspaceExploreBarMiscContext';
|
||||
import MiscFolderContext from '@/components/WorkspaceExploreBarMiscFolderContext';
|
||||
import ModalNewSchema from '@/components/ModalNewSchema';
|
||||
import ModalNewTable from '@/components/ModalNewTable';
|
||||
import ModalNewView from '@/components/ModalNewView';
|
||||
import ModalNewTrigger from '@/components/ModalNewTrigger';
|
||||
import ModalNewRoutine from '@/components/ModalNewRoutine';
|
||||
@ -182,7 +175,6 @@ export default {
|
||||
MiscContext,
|
||||
MiscFolderContext,
|
||||
ModalNewSchema,
|
||||
ModalNewTable,
|
||||
ModalNewView,
|
||||
ModalNewTrigger,
|
||||
ModalNewRoutine,
|
||||
@ -199,7 +191,6 @@ export default {
|
||||
isRefreshing: false,
|
||||
|
||||
isNewDBModal: false,
|
||||
isNewTableModal: false,
|
||||
isNewViewModal: false,
|
||||
isNewTriggerModal: false,
|
||||
isNewRoutineModal: false,
|
||||
@ -307,9 +298,16 @@ export default {
|
||||
hideNewDBModal () {
|
||||
this.isNewDBModal = false;
|
||||
},
|
||||
showCreateTableModal () {
|
||||
openCreateTableTab () {
|
||||
this.closeDatabaseContext();
|
||||
this.isNewTableModal = true;
|
||||
|
||||
this.newTab({
|
||||
uid: this.workspace.uid,
|
||||
schema: this.selectedSchema,
|
||||
elementName: '',
|
||||
elementType: 'table',
|
||||
type: 'new-table'
|
||||
});
|
||||
},
|
||||
hideCreateTableModal () {
|
||||
this.isNewTableModal = false;
|
||||
|
@ -101,9 +101,6 @@ export default {
|
||||
removeTabs: 'workspaces/removeTabs',
|
||||
newTab: 'workspaces/newTab'
|
||||
}),
|
||||
showCreateTableModal () {
|
||||
this.$emit('show-create-table-modal');
|
||||
},
|
||||
showDeleteModal () {
|
||||
this.isDeleteModal = true;
|
||||
},
|
||||
|
@ -74,9 +74,6 @@ export default {
|
||||
addNotification: 'notifications/addNotification',
|
||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
||||
}),
|
||||
showCreateTableModal () {
|
||||
this.$emit('show-create-table-modal');
|
||||
},
|
||||
showDeleteModal () {
|
||||
this.isDeleteModal = true;
|
||||
},
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div
|
||||
v-if="workspace.customizations.tableAdd"
|
||||
class="context-element"
|
||||
@click="showCreateTableModal"
|
||||
@click="openCreateTableTab"
|
||||
>
|
||||
<span class="d-flex"><i class="mdi mdi-18px mdi-table text-light pr-1" /> {{ $t('word.table') }}</span>
|
||||
</div>
|
||||
@ -132,8 +132,8 @@ export default {
|
||||
addNotification: 'notifications/addNotification',
|
||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
||||
}),
|
||||
showCreateTableModal () {
|
||||
this.$emit('show-create-table-modal');
|
||||
openCreateTableTab () {
|
||||
this.$emit('open-create-table-tab');
|
||||
},
|
||||
showCreateViewModal () {
|
||||
this.$emit('show-create-view-modal');
|
||||
|
@ -116,9 +116,6 @@ export default {
|
||||
removeLoadingElement: 'workspaces/removeLoadingElement',
|
||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
||||
}),
|
||||
showCreateTableModal () {
|
||||
this.$emit('show-create-table-modal');
|
||||
},
|
||||
showDeleteModal () {
|
||||
this.isDeleteModal = true;
|
||||
},
|
||||
|
458
src/renderer/components/WorkspaceTabNewTable.vue
Normal file
458
src/renderer/components/WorkspaceTabNewTable.vue
Normal file
@ -0,0 +1,458 @@
|
||||
<template>
|
||||
<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">
|
||||
<button
|
||||
class="btn btn-primary btn-sm"
|
||||
:disabled="!isChanged"
|
||||
:class="{'loading':isSaving}"
|
||||
title="CTRL+S"
|
||||
@click="saveChanges"
|
||||
>
|
||||
<i class="mdi mdi-24px mdi-content-save mr-1" />
|
||||
<span>{{ $t('word.save') }}</span>
|
||||
</button>
|
||||
<button
|
||||
:disabled="!isChanged || isSaving"
|
||||
class="btn btn-link btn-sm mr-0"
|
||||
:title="$t('message.clearChanges')"
|
||||
@click="clearChanges"
|
||||
>
|
||||
<i class="mdi mdi-24px mdi-delete-sweep mr-1" />
|
||||
<span>{{ $t('word.clear') }}</span>
|
||||
</button>
|
||||
|
||||
<div class="divider-vert py-3" />
|
||||
|
||||
<button
|
||||
:disabled="isSaving"
|
||||
class="btn btn-dark btn-sm"
|
||||
:title="$t('message.addNewField')"
|
||||
@click="addField"
|
||||
>
|
||||
<i class="mdi mdi-24px mdi-playlist-plus mr-1" />
|
||||
<span>{{ $t('word.add') }}</span>
|
||||
</button>
|
||||
<button
|
||||
:disabled="isSaving || !localFields.length"
|
||||
class="btn btn-dark btn-sm"
|
||||
:title="$t('message.manageIndexes')"
|
||||
@click="showIntdexesModal"
|
||||
>
|
||||
<i class="mdi mdi-24px mdi-key mdi-rotate-45 mr-1" />
|
||||
<span>{{ $t('word.indexes') }}</span>
|
||||
</button>
|
||||
<button
|
||||
class="btn btn-dark btn-sm"
|
||||
:disabled="isSaving || !localFields.length"
|
||||
@click="showForeignModal"
|
||||
>
|
||||
<i class="mdi mdi-24px mdi-key-link mr-1" />
|
||||
<span>{{ $t('word.foreignKeys') }}</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">
|
||||
<div class="columns mb-4">
|
||||
<div class="column col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ $t('word.name') }}</label>
|
||||
<input
|
||||
ref="firstInput"
|
||||
v-model="localOptions.name"
|
||||
class="form-input"
|
||||
type="text"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="workspace.customizations.comment" class="column">
|
||||
<div class="form-group">
|
||||
<label class="form-label">{{ $t('word.comment') }}</label>
|
||||
<input
|
||||
v-model="localOptions.comment"
|
||||
class="form-input"
|
||||
type="text"
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-if="workspace.customizations.collations" class="column col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label">
|
||||
{{ $t('word.collation') }}
|
||||
</label>
|
||||
<select v-model="localOptions.collation" class="form-select">
|
||||
<option
|
||||
v-for="collation in workspace.collations"
|
||||
:key="collation.id"
|
||||
:value="collation.collation"
|
||||
>
|
||||
{{ collation.collation }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="workspace.customizations.engines" class="column col-auto">
|
||||
<div class="form-group">
|
||||
<label class="form-label">
|
||||
{{ $t('word.engine') }}
|
||||
</label>
|
||||
<select v-model="localOptions.engine" class="form-select">
|
||||
<option
|
||||
v-for="engine in workspace.engines"
|
||||
:key="engine.name"
|
||||
:value="engine.name"
|
||||
>
|
||||
{{ engine.name }}
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="workspace-query-results column col-12 p-relative">
|
||||
<BaseLoader v-if="isLoading" />
|
||||
<WorkspaceTabPropsTableFIelds
|
||||
v-if="localFields"
|
||||
ref="indexTable"
|
||||
:fields="localFields"
|
||||
:indexes="localIndexes"
|
||||
:foreigns="localKeyUsage"
|
||||
:tab-uid="tabUid"
|
||||
:conn-uid="connection.uid"
|
||||
:index-types="workspace.indexTypes"
|
||||
:table="table"
|
||||
:schema="schema"
|
||||
mode="table"
|
||||
@duplicate-field="duplicateField"
|
||||
@remove-field="removeField"
|
||||
@add-new-index="addNewIndex"
|
||||
@add-to-index="addToIndex"
|
||||
@rename-field="renameField"
|
||||
/>
|
||||
</div>
|
||||
<WorkspaceTabPropsTableIndexesModal
|
||||
v-if="isIndexesModal"
|
||||
:local-indexes="localIndexes"
|
||||
:table="table"
|
||||
:fields="localFields"
|
||||
:index-types="workspace.indexTypes"
|
||||
:workspace="workspace"
|
||||
@hide="hideIndexesModal"
|
||||
@indexes-update="indexesUpdate"
|
||||
/>
|
||||
<WorkspaceTabPropsTableForeignModal
|
||||
v-if="isForeignModal"
|
||||
:local-key-usage="localKeyUsage"
|
||||
:connection="connection"
|
||||
table="new"
|
||||
:schema="schema"
|
||||
:schema-tables="schemaTables"
|
||||
:fields="localFields"
|
||||
:workspace="workspace"
|
||||
@hide="hideForeignModal"
|
||||
@foreigns-update="foreignsUpdate"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapGetters, mapActions } from 'vuex';
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
import Tables from '@/ipc-api/Tables';
|
||||
import BaseLoader from '@/components/BaseLoader';
|
||||
import WorkspaceTabPropsTableFIelds from '@/components/WorkspaceTabPropsTableFIelds';
|
||||
import WorkspaceTabPropsTableIndexesModal from '@/components/WorkspaceTabPropsTableIndexesModal';
|
||||
import WorkspaceTabPropsTableForeignModal from '@/components/WorkspaceTabPropsTableForeignModal';
|
||||
|
||||
export default {
|
||||
name: 'WorkspaceTabNewTable',
|
||||
components: {
|
||||
BaseLoader,
|
||||
WorkspaceTabPropsTableFIelds,
|
||||
WorkspaceTabPropsTableIndexesModal,
|
||||
WorkspaceTabPropsTableForeignModal
|
||||
},
|
||||
props: {
|
||||
connection: Object,
|
||||
tab: Object,
|
||||
isSelected: Boolean,
|
||||
table: String,
|
||||
schema: String
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
isLoading: false,
|
||||
isSaving: false,
|
||||
isIndexesModal: false,
|
||||
isForeignModal: false,
|
||||
isOptionsChanging: false,
|
||||
originalFields: [],
|
||||
localFields: [],
|
||||
originalKeyUsage: [],
|
||||
localKeyUsage: [],
|
||||
originalIndexes: [],
|
||||
localIndexes: [],
|
||||
tableOptions: {},
|
||||
localOptions: {},
|
||||
lastTable: null,
|
||||
newFieldsCounter: 0
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
...mapGetters({
|
||||
getWorkspace: 'workspaces/getWorkspace',
|
||||
selectedWorkspace: 'workspaces/getSelected',
|
||||
getDatabaseVariable: 'workspaces/getDatabaseVariable'
|
||||
}),
|
||||
workspace () {
|
||||
return this.getWorkspace(this.connection.uid);
|
||||
},
|
||||
tabUid () {
|
||||
return this.$vnode.key;
|
||||
},
|
||||
defaultCollation () {
|
||||
if (this.workspace.customizations.collations)
|
||||
return this.getDatabaseVariable(this.selectedWorkspace, 'collation_server').value || '';
|
||||
return '';
|
||||
},
|
||||
defaultEngine () {
|
||||
if (this.workspace.customizations.engines)
|
||||
return this.workspace.engines.find(engine => engine.isDefault).name;
|
||||
return '';
|
||||
},
|
||||
schemaTables () {
|
||||
const schemaTables = this.workspace.structure
|
||||
.filter(schema => schema.name === this.schema)
|
||||
.map(schema => schema.tables);
|
||||
|
||||
return schemaTables.length ? schemaTables[0].filter(table => table.type === 'table') : [];
|
||||
},
|
||||
isChanged () {
|
||||
return JSON.stringify(this.originalFields) !== JSON.stringify(this.localFields) ||
|
||||
JSON.stringify(this.originalKeyUsage) !== JSON.stringify(this.localKeyUsage) ||
|
||||
JSON.stringify(this.originalIndexes) !== JSON.stringify(this.localIndexes) ||
|
||||
JSON.stringify(this.tableOptions) !== JSON.stringify(this.localOptions);
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
schema () {
|
||||
if (this.isSelected)
|
||||
this.lastTable = this.table;
|
||||
},
|
||||
table () {
|
||||
if (this.isSelected)
|
||||
this.lastTable = this.table;
|
||||
},
|
||||
isSelected (val) {
|
||||
if (val)
|
||||
this.changeBreadcrumbs({ schema: this.schema });
|
||||
},
|
||||
isChanged (val) {
|
||||
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: val });
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.tableOptions = {
|
||||
name: '',
|
||||
type: 'table',
|
||||
engine: this.defaultEngine,
|
||||
comment: '',
|
||||
collation: this.defaultCollation
|
||||
};
|
||||
|
||||
this.localOptions = JSON.parse(JSON.stringify(this.tableOptions));
|
||||
window.addEventListener('keydown', this.onKey);
|
||||
},
|
||||
mounted () {
|
||||
if (this.isSelected)
|
||||
this.changeBreadcrumbs({ schema: this.schema });
|
||||
|
||||
setTimeout(() => {
|
||||
this.$refs.firstInput.focus();
|
||||
}, 100);
|
||||
},
|
||||
beforeDestroy () {
|
||||
window.removeEventListener('keydown', this.onKey);
|
||||
},
|
||||
methods: {
|
||||
...mapActions({
|
||||
addNotification: 'notifications/addNotification',
|
||||
refreshStructure: 'workspaces/refreshStructure',
|
||||
setUnsavedChanges: 'workspaces/setUnsavedChanges',
|
||||
newTab: 'workspaces/newTab',
|
||||
renameTabs: 'workspaces/renameTabs',
|
||||
removeTab: 'workspaces/removeTab',
|
||||
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
|
||||
}),
|
||||
async saveChanges () {
|
||||
if (this.isSaving) return;
|
||||
this.isSaving = true;
|
||||
|
||||
const params = {
|
||||
uid: this.connection.uid,
|
||||
schema: this.schema,
|
||||
fields: this.localFields,
|
||||
foreigns: this.localKeyUsage,
|
||||
indexes: this.localIndexes,
|
||||
options: this.localOptions
|
||||
};
|
||||
|
||||
try {
|
||||
const { status, response } = await Tables.createTable(params);
|
||||
|
||||
if (status === 'success') {
|
||||
await this.refreshStructure(this.connection.uid);
|
||||
|
||||
this.newTab({
|
||||
uid: this.connection.uid,
|
||||
schema: this.schema,
|
||||
elementName: this.localOptions.name,
|
||||
elementType: 'table',
|
||||
type: 'table-props'
|
||||
});
|
||||
|
||||
this.removeTab({ uid: this.connection.uid, tab: this.tab.uid });
|
||||
}
|
||||
else
|
||||
this.addNotification({ status: 'error', message: response });
|
||||
}
|
||||
catch (err) {
|
||||
this.addNotification({ status: 'error', message: err.stack });
|
||||
}
|
||||
|
||||
this.isSaving = false;
|
||||
this.newFieldsCounter = 0;
|
||||
},
|
||||
clearChanges () {
|
||||
this.localFields = JSON.parse(JSON.stringify(this.originalFields));
|
||||
this.localIndexes = JSON.parse(JSON.stringify(this.originalIndexes));
|
||||
this.localKeyUsage = JSON.parse(JSON.stringify(this.originalKeyUsage));
|
||||
|
||||
this.tableOptions = {
|
||||
name: '',
|
||||
type: 'table',
|
||||
engine: this.defaultEngine,
|
||||
comment: '',
|
||||
collation: this.defaultCollation
|
||||
};
|
||||
|
||||
this.localOptions = JSON.parse(JSON.stringify(this.tableOptions));
|
||||
this.newFieldsCounter = 0;
|
||||
},
|
||||
addField () {
|
||||
this.localFields.push({
|
||||
_id: uidGen(),
|
||||
name: `${this.$tc('word.field', 1)}_${++this.newFieldsCounter}`,
|
||||
key: '',
|
||||
type: this.workspace.dataTypes[0].types[0].name,
|
||||
schema: this.schema,
|
||||
table: this.table,
|
||||
numPrecision: null,
|
||||
numLength: this.workspace.dataTypes[0].types[0].length,
|
||||
datePrecision: null,
|
||||
charLength: null,
|
||||
nullable: false,
|
||||
unsigned: false,
|
||||
zerofill: false,
|
||||
order: this.localFields.length + 1,
|
||||
default: null,
|
||||
charset: null,
|
||||
collation: null,
|
||||
autoIncrement: false,
|
||||
onUpdate: '',
|
||||
comment: ''
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
const scrollable = this.$refs.indexTable.$refs.tableWrapper;
|
||||
scrollable.scrollTop = scrollable.scrollHeight + 30;
|
||||
}, 20);
|
||||
},
|
||||
renameField (payload) {
|
||||
this.localIndexes = this.localIndexes.map(index => {
|
||||
const fi = index.fields.findIndex(field => field === payload.old);
|
||||
if (fi !== -1)
|
||||
index.fields[fi] = payload.new;
|
||||
return index;
|
||||
});
|
||||
|
||||
this.localKeyUsage = this.localKeyUsage.map(key => {
|
||||
if (key.field === payload.old)
|
||||
key.field = payload.new;
|
||||
return key;
|
||||
});
|
||||
},
|
||||
duplicateField (uid) {
|
||||
const fieldToClone = Object.assign({}, this.localFields.find(field => field._id === uid));
|
||||
fieldToClone._id = uidGen();
|
||||
fieldToClone.name = `${fieldToClone.name}_copy`;
|
||||
fieldToClone.order = this.localFields.length + 1;
|
||||
this.localFields = [...this.localFields, fieldToClone];
|
||||
|
||||
setTimeout(() => {
|
||||
const scrollable = this.$refs.indexTable.$refs.tableWrapper;
|
||||
scrollable.scrollTop = scrollable.scrollHeight + 30;
|
||||
}, 20);
|
||||
},
|
||||
removeField (uid) {
|
||||
this.localFields = this.localFields.filter(field => field._id !== uid);
|
||||
},
|
||||
addNewIndex (payload) {
|
||||
this.localIndexes = [...this.localIndexes, {
|
||||
_id: uidGen(),
|
||||
name: payload.index === 'PRIMARY' ? 'PRIMARY' : payload.field,
|
||||
fields: [payload.field],
|
||||
type: payload.index,
|
||||
comment: '',
|
||||
indexType: 'BTREE',
|
||||
indexComment: '',
|
||||
cardinality: 0
|
||||
}];
|
||||
},
|
||||
addToIndex (payload) {
|
||||
this.localIndexes = this.localIndexes.map(index => {
|
||||
if (index._id === payload.index) index.fields.push(payload.field);
|
||||
return index;
|
||||
});
|
||||
},
|
||||
optionsUpdate (options) {
|
||||
this.localOptions = options;
|
||||
},
|
||||
showIntdexesModal () {
|
||||
this.isIndexesModal = true;
|
||||
},
|
||||
hideIndexesModal () {
|
||||
this.isIndexesModal = false;
|
||||
},
|
||||
indexesUpdate (indexes) {
|
||||
this.localIndexes = indexes;
|
||||
},
|
||||
showForeignModal () {
|
||||
this.isForeignModal = true;
|
||||
},
|
||||
hideForeignModal () {
|
||||
this.isForeignModal = false;
|
||||
},
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
@ -37,10 +37,6 @@
|
||||
<i class="mdi mdi-24px mdi-dots-horizontal mr-1" />
|
||||
<span>{{ $t('word.parameters') }}</span>
|
||||
</button>
|
||||
<!-- <button class="btn btn-dark btn-sm" @click="showOptionsModal">
|
||||
<i class="mdi mdi-24px mdi-cogs mr-1" />
|
||||
<span>{{ $t('word.options') }}</span>
|
||||
</button> -->
|
||||
</div>
|
||||
<div class="workspace-query-info">
|
||||
<div class="d-flex" :title="$t('word.schema')">
|
||||
@ -207,13 +203,6 @@
|
||||
:height="editorHeight"
|
||||
/>
|
||||
</div>
|
||||
<!-- <WorkspaceTabPropsFunctionOptionsModal
|
||||
v-if="isOptionsModal"
|
||||
:local-options="localFunction"
|
||||
:workspace="workspace"
|
||||
@hide="hideOptionsModal"
|
||||
@options-update="optionsUpdate"
|
||||
/> -->
|
||||
<WorkspaceTabPropsFunctionParamsModal
|
||||
v-if="isParamsModal"
|
||||
:local-parameters="localFunction.parameters"
|
||||
@ -237,7 +226,6 @@ import { mapGetters, mapActions } from 'vuex';
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
import BaseLoader from '@/components/BaseLoader';
|
||||
import QueryEditor from '@/components/QueryEditor';
|
||||
// import WorkspaceTabPropsFunctionOptionsModal from '@/components/WorkspaceTabPropsFunctionOptionsModal';
|
||||
import WorkspaceTabPropsFunctionParamsModal from '@/components/WorkspaceTabPropsFunctionParamsModal';
|
||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||
import Functions from '@/ipc-api/Functions';
|
||||
@ -247,7 +235,6 @@ export default {
|
||||
components: {
|
||||
BaseLoader,
|
||||
QueryEditor,
|
||||
// WorkspaceTabPropsFunctionOptionsModal,
|
||||
WorkspaceTabPropsFunctionParamsModal,
|
||||
ModalAskParameters
|
||||
},
|
||||
@ -261,7 +248,6 @@ export default {
|
||||
return {
|
||||
isLoading: false,
|
||||
isSaving: false,
|
||||
isOptionsModal: false,
|
||||
isParamsModal: false,
|
||||
isAskingParameters: false,
|
||||
originalFunction: null,
|
||||
@ -492,12 +478,6 @@ export default {
|
||||
|
||||
this.newTab({ uid: this.connection.uid, content: sql, type: 'query', autorun: true });
|
||||
},
|
||||
showOptionsModal () {
|
||||
this.isOptionsModal = true;
|
||||
},
|
||||
hideOptionsModal () {
|
||||
this.isOptionsModal = false;
|
||||
},
|
||||
showParamsModal () {
|
||||
this.isParamsModal = true;
|
||||
},
|
||||
|
@ -37,10 +37,6 @@
|
||||
<i class="mdi mdi-24px mdi-dots-horizontal mr-1" />
|
||||
<span>{{ $t('word.parameters') }}</span>
|
||||
</button>
|
||||
<!-- <button class="btn btn-dark btn-sm" @click="showOptionsModal">
|
||||
<i class="mdi mdi-24px mdi-cogs mr-1" />
|
||||
<span>{{ $t('word.options') }}</span>
|
||||
</button> -->
|
||||
</div>
|
||||
<div class="workspace-query-info">
|
||||
<div class="d-flex" :title="$t('word.schema')">
|
||||
@ -164,13 +160,6 @@
|
||||
:height="editorHeight"
|
||||
/>
|
||||
</div>
|
||||
<!-- <WorkspaceTabPropsRoutineOptionsModal
|
||||
v-if="isOptionsModal"
|
||||
:local-options="localRoutine"
|
||||
:workspace="workspace"
|
||||
@hide="hideOptionsModal"
|
||||
@options-update="optionsUpdate"
|
||||
/> -->
|
||||
<WorkspaceTabPropsRoutineParamsModal
|
||||
v-if="isParamsModal"
|
||||
:local-parameters="localRoutine.parameters"
|
||||
@ -194,7 +183,6 @@ import { mapGetters, mapActions } from 'vuex';
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
import QueryEditor from '@/components/QueryEditor';
|
||||
import BaseLoader from '@/components/BaseLoader';
|
||||
// import WorkspaceTabPropsRoutineOptionsModal from '@/components/WorkspaceTabPropsRoutineOptionsModal';
|
||||
import WorkspaceTabPropsRoutineParamsModal from '@/components/WorkspaceTabPropsRoutineParamsModal';
|
||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||
import Routines from '@/ipc-api/Routines';
|
||||
@ -204,7 +192,6 @@ export default {
|
||||
components: {
|
||||
QueryEditor,
|
||||
BaseLoader,
|
||||
// WorkspaceTabPropsRoutineOptionsModal,
|
||||
WorkspaceTabPropsRoutineParamsModal,
|
||||
ModalAskParameters
|
||||
},
|
||||
@ -218,7 +205,6 @@ export default {
|
||||
return {
|
||||
isLoading: false,
|
||||
isSaving: false,
|
||||
isOptionsModal: false,
|
||||
isParamsModal: false,
|
||||
isAskingParameters: false,
|
||||
originalRoutine: null,
|
||||
@ -435,12 +421,6 @@ export default {
|
||||
|
||||
this.newTab({ uid: this.connection.uid, content: sql, type: 'query', autorun: true });
|
||||
},
|
||||
showOptionsModal () {
|
||||
this.isOptionsModal = true;
|
||||
},
|
||||
hideOptionsModal () {
|
||||
this.isOptionsModal = false;
|
||||
},
|
||||
showParamsModal () {
|
||||
this.isParamsModal = true;
|
||||
},
|
||||
|
@ -51,15 +51,6 @@
|
||||
<i class="mdi mdi-24px mdi-key-link mr-1" />
|
||||
<span>{{ $t('word.foreignKeys') }}</span>
|
||||
</button>
|
||||
<!-- <button
|
||||
v-if="workspace.customizations.tableOptions"
|
||||
class="btn btn-dark btn-sm"
|
||||
:disabled="isSaving"
|
||||
@click="showOptionsModal"
|
||||
>
|
||||
<i class="mdi mdi-24px mdi-cogs mr-1" />
|
||||
<span>{{ $t('word.options') }}</span>
|
||||
</button> -->
|
||||
</div>
|
||||
<div class="workspace-query-info">
|
||||
<div class="d-flex" :title="$t('word.schema')">
|
||||
@ -160,14 +151,6 @@
|
||||
@rename-field="renameField"
|
||||
/>
|
||||
</div>
|
||||
<!-- <WorkspaceTabPropsTableOptionsModal
|
||||
v-if="isOptionsModal"
|
||||
:local-options="localOptions"
|
||||
:table="table"
|
||||
:workspace="workspace"
|
||||
@hide="hideOptionsModal"
|
||||
@options-update="optionsUpdate"
|
||||
/> -->
|
||||
<WorkspaceTabPropsTableIndexesModal
|
||||
v-if="isIndexesModal"
|
||||
:local-indexes="localIndexes"
|
||||
@ -199,7 +182,6 @@ import { uidGen } from 'common/libs/uidGen';
|
||||
import Tables from '@/ipc-api/Tables';
|
||||
import BaseLoader from '@/components/BaseLoader';
|
||||
import WorkspaceTabPropsTableFIelds from '@/components/WorkspaceTabPropsTableFIelds';
|
||||
// import WorkspaceTabPropsTableOptionsModal from '@/components/WorkspaceTabPropsTableOptionsModal';
|
||||
import WorkspaceTabPropsTableIndexesModal from '@/components/WorkspaceTabPropsTableIndexesModal';
|
||||
import WorkspaceTabPropsTableForeignModal from '@/components/WorkspaceTabPropsTableForeignModal';
|
||||
|
||||
@ -208,7 +190,6 @@ export default {
|
||||
components: {
|
||||
BaseLoader,
|
||||
WorkspaceTabPropsTableFIelds,
|
||||
// WorkspaceTabPropsTableOptionsModal,
|
||||
WorkspaceTabPropsTableIndexesModal,
|
||||
WorkspaceTabPropsTableForeignModal
|
||||
},
|
||||
@ -222,7 +203,6 @@ export default {
|
||||
return {
|
||||
isLoading: false,
|
||||
isSaving: false,
|
||||
isOptionsModal: false,
|
||||
isIndexesModal: false,
|
||||
isForeignModal: false,
|
||||
isOptionsChanging: false,
|
||||
@ -649,12 +629,6 @@ export default {
|
||||
return index;
|
||||
});
|
||||
},
|
||||
showOptionsModal () {
|
||||
this.isOptionsModal = true;
|
||||
},
|
||||
hideOptionsModal () {
|
||||
this.isOptionsModal = false;
|
||||
},
|
||||
optionsUpdate (options) {
|
||||
this.localOptions = options;
|
||||
},
|
||||
|
@ -22,13 +22,6 @@
|
||||
<i class="mdi mdi-24px mdi-delete-sweep mr-1" />
|
||||
<span>{{ $t('word.clear') }}</span>
|
||||
</button>
|
||||
|
||||
<div class="divider-vert py-3" />
|
||||
|
||||
<!-- <button class="btn btn-dark btn-sm" @click="showOptionsModal">
|
||||
<i class="mdi mdi-24px mdi-cogs mr-1" />
|
||||
<span>{{ $t('word.options') }}</span>
|
||||
</button> -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -98,13 +91,6 @@
|
||||
:height="editorHeight"
|
||||
/>
|
||||
</div>
|
||||
<!-- <WorkspaceTabPropsTriggerFunctionOptionsModal
|
||||
v-if="isOptionsModal"
|
||||
:local-options="localFunction"
|
||||
:workspace="workspace"
|
||||
@hide="hideOptionsModal"
|
||||
@options-update="optionsUpdate"
|
||||
/> -->
|
||||
<ModalAskParameters
|
||||
v-if="isAskingParameters"
|
||||
:local-routine="localFunction"
|
||||
@ -120,7 +106,6 @@ import { mapGetters, mapActions } from 'vuex';
|
||||
import { uidGen } from 'common/libs/uidGen';
|
||||
import BaseLoader from '@/components/BaseLoader';
|
||||
import QueryEditor from '@/components/QueryEditor';
|
||||
// import WorkspaceTabPropsTriggerFunctionOptionsModal from '@/components/WorkspaceTabPropsTriggerFunctionOptionsModal';
|
||||
import ModalAskParameters from '@/components/ModalAskParameters';
|
||||
import Functions from '@/ipc-api/Functions';
|
||||
|
||||
@ -129,7 +114,6 @@ export default {
|
||||
components: {
|
||||
BaseLoader,
|
||||
QueryEditor,
|
||||
// WorkspaceTabPropsTriggerFunctionOptionsModal,
|
||||
ModalAskParameters
|
||||
},
|
||||
props: {
|
||||
@ -142,7 +126,6 @@ export default {
|
||||
return {
|
||||
isLoading: false,
|
||||
isSaving: false,
|
||||
isOptionsModal: false,
|
||||
isParamsModal: false,
|
||||
isAskingParameters: false,
|
||||
originalFunction: null,
|
||||
@ -360,12 +343,6 @@ export default {
|
||||
|
||||
this.newTab({ uid: this.connection.uid, content: sql, type: 'query', autorun: true });
|
||||
},
|
||||
showOptionsModal () {
|
||||
this.isOptionsModal = true;
|
||||
},
|
||||
hideOptionsModal () {
|
||||
this.isOptionsModal = false;
|
||||
},
|
||||
showParamsModal () {
|
||||
this.isParamsModal = true;
|
||||
},
|
||||
|
Reference in New Issue
Block a user