mirror of https://github.com/Fabio286/antares.git
fix: deletion of rows from query results
This commit is contained in:
parent
9f5ec0276c
commit
c20bff7bcb
|
@ -157,9 +157,13 @@ export default (connections) => {
|
||||||
|
|
||||||
ipcMain.handle('delete-table-rows', async (event, params) => {
|
ipcMain.handle('delete-table-rows', async (event, params) => {
|
||||||
if (params.primary) {
|
if (params.primary) {
|
||||||
const idString = params.rows.map(row => typeof row[params.primary] === 'string'
|
const idString = params.rows.map(row => {
|
||||||
? `"${row[params.primary]}"`
|
const fieldName = Object.keys(row)[0].includes('.') ? `${params.table}.${params.primary}` : params.primary;
|
||||||
: row[params.primary]).join(',');
|
|
||||||
|
return typeof row[fieldName] === 'string'
|
||||||
|
? `"${row[fieldName]}"`
|
||||||
|
: row[fieldName];
|
||||||
|
}).join(',');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const result = await connections[params.uid]
|
const result = await connections[params.uid]
|
||||||
|
|
|
@ -42,6 +42,7 @@ export default {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { status, response } = await Tables.deleteTableRows(params);
|
const { status, response } = await Tables.deleteTableRows(params);
|
||||||
|
this.isQuering = false;
|
||||||
|
|
||||||
if (status === 'success')
|
if (status === 'success')
|
||||||
this.reloadTable();
|
this.reloadTable();
|
||||||
|
@ -50,9 +51,8 @@ export default {
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
this.addNotification({ status: 'error', message: err.stack });
|
this.addNotification({ status: 'error', message: err.stack });
|
||||||
|
this.isQuering = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.isQuering = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue