mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-05 11:49:35 +01:00
refactor: adaptation of row deletion and modification functions due last commits
This commit is contained in:
parent
023c6a633a
commit
1d87ca959f
@ -80,8 +80,8 @@ export default {
|
||||
return this.getWorkspace(this.connection.uid);
|
||||
},
|
||||
schema () {
|
||||
if ('fields' in this.results && this.results.fields.length)
|
||||
return this.results.fields[0].db;
|
||||
if ('fields' in this.results && this.results[this.selectedResultsset].fields.length)
|
||||
return this.results[this.selectedResultsset].fields[0].db;
|
||||
return this.workspace.breadcrumbs.schema;
|
||||
}
|
||||
},
|
||||
|
@ -169,6 +169,9 @@ export default {
|
||||
this.setTabKeyUsage({ cUid: this.connection.uid, tUid: this.tabUid, keyUsage: keysArr });
|
||||
this.isQuering = false;
|
||||
},
|
||||
getTable () {
|
||||
return this.table;
|
||||
},
|
||||
reloadTable () {
|
||||
this.getTableData();
|
||||
},
|
||||
|
@ -7,8 +7,8 @@ export default {
|
||||
|
||||
const params = {
|
||||
uid: this.connection.uid,
|
||||
schema: this.workspace.breadcrumbs.schema,
|
||||
table: this.table,
|
||||
schema: this.schema,
|
||||
table: this.getTable(this.selectedResultsset),
|
||||
...payload
|
||||
};
|
||||
|
||||
@ -34,16 +34,32 @@ export default {
|
||||
|
||||
const params = {
|
||||
uid: this.connection.uid,
|
||||
schema: this.workspace.breadcrumbs.schema,
|
||||
table: this.workspace.breadcrumbs.table,
|
||||
schema: this.schema,
|
||||
table: this.getTable(this.selectedResultsset),
|
||||
...payload
|
||||
};
|
||||
|
||||
try {
|
||||
const { status, response } = await Tables.deleteTableRows(params);
|
||||
|
||||
if (status === 'success') {
|
||||
const { primary, rows } = params;
|
||||
this.results = { ...this.results, rows: this.results.rows.filter(row => !rows.includes(row[primary])) };
|
||||
|
||||
if (Array.isArray(this.results)) {
|
||||
this.results = this.results.map((result, index) => {
|
||||
if (index === this.selectedResultsset) {
|
||||
return {
|
||||
...result,
|
||||
rows: result.rows.filter(row => !rows.includes(row[primary]))
|
||||
};
|
||||
}
|
||||
else
|
||||
return result;
|
||||
});
|
||||
}
|
||||
else
|
||||
this.results = { ...this.results, rows: this.results.rows.filter(row => !rows.includes(row[primary])) };
|
||||
|
||||
this.$refs.queryTable.refreshScroller();// Necessary to re-render virtual scroller
|
||||
}
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user