mirror of
https://github.com/Fabio286/antares.git
synced 2025-02-10 16:50:42 +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);
|
return this.getWorkspace(this.connection.uid);
|
||||||
},
|
},
|
||||||
schema () {
|
schema () {
|
||||||
if ('fields' in this.results && this.results.fields.length)
|
if ('fields' in this.results && this.results[this.selectedResultsset].fields.length)
|
||||||
return this.results.fields[0].db;
|
return this.results[this.selectedResultsset].fields[0].db;
|
||||||
return this.workspace.breadcrumbs.schema;
|
return this.workspace.breadcrumbs.schema;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -169,6 +169,9 @@ export default {
|
|||||||
this.setTabKeyUsage({ cUid: this.connection.uid, tUid: this.tabUid, keyUsage: keysArr });
|
this.setTabKeyUsage({ cUid: this.connection.uid, tUid: this.tabUid, keyUsage: keysArr });
|
||||||
this.isQuering = false;
|
this.isQuering = false;
|
||||||
},
|
},
|
||||||
|
getTable () {
|
||||||
|
return this.table;
|
||||||
|
},
|
||||||
reloadTable () {
|
reloadTable () {
|
||||||
this.getTableData();
|
this.getTableData();
|
||||||
},
|
},
|
||||||
|
@ -7,8 +7,8 @@ export default {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
uid: this.connection.uid,
|
uid: this.connection.uid,
|
||||||
schema: this.workspace.breadcrumbs.schema,
|
schema: this.schema,
|
||||||
table: this.table,
|
table: this.getTable(this.selectedResultsset),
|
||||||
...payload
|
...payload
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -34,16 +34,32 @@ export default {
|
|||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
uid: this.connection.uid,
|
uid: this.connection.uid,
|
||||||
schema: this.workspace.breadcrumbs.schema,
|
schema: this.schema,
|
||||||
table: this.workspace.breadcrumbs.table,
|
table: this.getTable(this.selectedResultsset),
|
||||||
...payload
|
...payload
|
||||||
};
|
};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { status, response } = await Tables.deleteTableRows(params);
|
const { status, response } = await Tables.deleteTableRows(params);
|
||||||
|
|
||||||
if (status === 'success') {
|
if (status === 'success') {
|
||||||
const { primary, rows } = params;
|
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
|
this.$refs.queryTable.refreshScroller();// Necessary to re-render virtual scroller
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user