소스 검색

set query gui as default handle old panels gracefully

Sven Klemm 7 년 전
부모
커밋
0e610cad1b
1개의 변경된 파일10개의 추가작업 그리고 4개의 파일을 삭제
  1. 10 4
      public/app/plugins/datasource/postgres/postgres_query.ts

+ 10 - 4
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() {