1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

fix: table options not loaded on restored setting tabs at startup

This commit is contained in:
2021-08-11 16:16:58 +02:00
parent 71e2c911ae
commit 622b519cbb
6 changed files with 109 additions and 9 deletions

View File

@ -232,6 +232,7 @@ export default {
localKeyUsage: [],
originalIndexes: [],
localIndexes: [],
tableOptions: {},
localOptions: {},
lastTable: null,
newFieldsCounter: 0
@ -249,10 +250,6 @@ export default {
tabUid () {
return this.$vnode.key;
},
tableOptions () {
const db = this.workspace.structure.find(db => db.name === this.schema);
return db && this.table ? db.tables.find(table => table.name === this.table) : {};
},
defaultEngine () {
const engine = this.getDatabaseVariable(this.connection.uid, 'default_storage_engine');
return engine ? engine.value : '';
@ -311,6 +308,20 @@ export default {
renameTabs: 'workspaces/renameTabs',
changeBreadcrumbs: 'workspaces/changeBreadcrumbs'
}),
async getTableOptions (params) {
const db = this.workspace.structure.find(db => db.name === this.schema);
if (db && db.tables.length && this.table)
this.tableOptions = db.tables.find(table => table.name === this.table);
else {
const { status, response } = await Tables.getTableOptions(params);
if (status === 'success')
this.tableOptions = response;
else
this.addNotification({ status: 'error', message: response });
}
},
async getFieldsData () {
if (!this.table) return;
@ -318,10 +329,6 @@ export default {
this.lastTable = this.table;
this.newFieldsCounter = 0;
this.isLoading = true;
try {
this.localOptions = JSON.parse(JSON.stringify(this.tableOptions));
}
catch (err) {}
const params = {
uid: this.connection.uid,
@ -329,6 +336,14 @@ export default {
table: this.table
};
try {
await this.getTableOptions(params);
this.localOptions = JSON.parse(JSON.stringify(this.tableOptions));
}
catch (err) {
console.error(err);
}
try { // Columns data
const { status, response } = await Tables.getTableColumns(params);
if (status === 'success') {

View File

@ -77,7 +77,7 @@
</select>
</div>
</div>
<div class="column col-4">
<div class="column">
<div class="form-group">
<label class="form-label">{{ $t('word.comment') }}</label>
<input