From 0e610cad1b7069ac008393dbf36f7f281789c92d Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Tue, 10 Jul 2018 21:40:59 +0200 Subject: [PATCH] set query gui as default handle old panels gracefully --- .../plugins/datasource/postgres/postgres_query.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/public/app/plugins/datasource/postgres/postgres_query.ts b/public/app/plugins/datasource/postgres/postgres_query.ts index 55ef242d1e2..665393c8ac8 100644 --- a/public/app/plugins/datasource/postgres/postgres_query.ts +++ b/public/app/plugins/datasource/postgres/postgres_query.ts @@ -27,7 +27,13 @@ export default class PostgresQuery { // handle pre query gui panels gracefully if (!('rawQuery' in this.target)) { - target.rawQuery = true; + if ('rawSql' in target) { + // pre query gui panel + target.rawQuery = true; + } else { + // new panel + target.rawQuery = false; + } } // give interpolateQueryStr access to this @@ -55,10 +61,10 @@ export default class PostgresQuery { updateProjection() { this.selectModels = _.map(this.target.select, function(parts: any) { - return _.map(parts, sqlPart.create); + return _.map(parts, sqlPart.create).filter(n => n); }); - this.whereParts = _.map(this.target.where, sqlPart.create); - this.groupByParts = _.map(this.target.groupBy, sqlPart.create); + this.whereParts = _.map(this.target.where, sqlPart.create).filter(n => n); + this.groupByParts = _.map(this.target.groupBy, sqlPart.create).filter(n => n); } updatePersistedParts() {