1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-02-17 12:10:39 +01:00

fix: query result table header didn't show just selected fields

This commit is contained in:
Fabio 2020-08-13 13:24:03 +02:00
parent eb348b3095
commit 7bc10092fe
2 changed files with 7 additions and 3 deletions

View File

@ -85,6 +85,8 @@ export default {
if (!query) return; if (!query) return;
this.isQuering = true; this.isQuering = true;
this.results = {}; this.results = {};
this.fields = [];
let selectedFields = [];
try { try {
const params = { const params = {
@ -94,8 +96,10 @@ export default {
}; };
const { status, response } = await Connection.rawQuery(params); const { status, response } = await Connection.rawQuery(params);
if (status === 'success') if (status === 'success') {
this.results = response; this.results = response;
selectedFields = response.fields.map(field => field.orgName);
}
else else
this.addNotification({ status: 'error', message: response }); this.addNotification({ status: 'error', message: response });
} }
@ -112,7 +116,7 @@ export default {
const { status, response } = await Tables.getTableColumns(params); const { status, response } = await Tables.getTableColumns(params);
if (status === 'success') if (status === 'success')
this.fields = response; this.fields = response.filter(field => selectedFields.includes(field.name));
else else
this.addNotification({ status: 'error', message: response }); this.addNotification({ status: 'error', message: response });
} }

View File

@ -97,7 +97,7 @@ export default {
}, },
computed: { computed: {
primaryField () { primaryField () {
return this.fields.filter(field => field.key === 'pri')[0] || false; return this.fields.filter(field => ['pri', 'uni'].includes(field.key))[0] || false;
}, },
sortedResults () { sortedResults () {
if (this.currentSort) { if (this.currentSort) {