diff --git a/src/renderer/components/WorkspaceQueryTab.vue b/src/renderer/components/WorkspaceQueryTab.vue index f55ad710..79160cc6 100644 --- a/src/renderer/components/WorkspaceQueryTab.vue +++ b/src/renderer/components/WorkspaceQueryTab.vue @@ -85,6 +85,8 @@ export default { if (!query) return; this.isQuering = true; this.results = {}; + this.fields = []; + let selectedFields = []; try { const params = { @@ -94,8 +96,10 @@ export default { }; const { status, response } = await Connection.rawQuery(params); - if (status === 'success') + if (status === 'success') { this.results = response; + selectedFields = response.fields.map(field => field.orgName); + } else this.addNotification({ status: 'error', message: response }); } @@ -112,7 +116,7 @@ export default { const { status, response } = await Tables.getTableColumns(params); if (status === 'success') - this.fields = response; + this.fields = response.filter(field => selectedFields.includes(field.name)); else this.addNotification({ status: 'error', message: response }); } diff --git a/src/renderer/components/WorkspaceQueryTable.vue b/src/renderer/components/WorkspaceQueryTable.vue index ff54578f..63f03bdc 100644 --- a/src/renderer/components/WorkspaceQueryTable.vue +++ b/src/renderer/components/WorkspaceQueryTable.vue @@ -97,7 +97,7 @@ export default { }, computed: { primaryField () { - return this.fields.filter(field => field.key === 'pri')[0] || false; + return this.fields.filter(field => ['pri', 'uni'].includes(field.key))[0] || false; }, sortedResults () { if (this.currentSort) {