Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Fix: column name in result table shows alias if alias exists #75

Merged
merged 2 commits into from
Jun 9, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ export function getQueryResultsForTable(queryResults: ResponseDetail<string>[]):
case 'describe':
case 'default':
for (const [id, field] of schema.entries()) {
fields[id] = _.get(field, 'name');
let alias: any = null;
try {
alias = _.get(field, 'alias');
} catch (e) {
console.log("No alias for field " + field);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Np. I suggest using either single quote or double quote for js, not both. One reason I am more for single quote is

A single quoted string can have double quotes within it without having to escape them

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, thanks for raising it!

} finally {
fields[id] = alias == null ? _.get(field, 'name') : alias;
}
}
databaseFields = fields;
databaseFields.unshift("id");
Expand Down