From 067bfa3f72df1083c7e59524ee04ef7f7e6ad2d8 Mon Sep 17 00:00:00 2001 From: Sven Klemm Date: Mon, 21 May 2018 12:52:14 +0200 Subject: [PATCH] make param wrapper configurable --- public/app/core/components/sql_part/sql_part.ts | 17 ++++++++++++++++- .../core/components/sql_part/sql_part_editor.ts | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/public/app/core/components/sql_part/sql_part.ts b/public/app/core/components/sql_part/sql_part.ts index 94dd0ff6ae8..d7cad643a3e 100644 --- a/public/app/core/components/sql_part/sql_part.ts +++ b/public/app/core/components/sql_part/sql_part.ts @@ -2,16 +2,31 @@ import _ from 'lodash'; export class SqlPartDef { type: string; + style: string; label: string; params: any[]; defaultParams: any[]; + wrapOpen: string; + wrapClose: string; renderer: any; category: any; addStrategy: any; constructor(options: any) { this.type = options.type; - this.label = options.label; + if (options.label) { + this.label = options.label; + } else { + this.label = this.type[0].toUpperCase() + this.type.substring(1) + ':'; + } + this.style = options.style; + if (this.style === "function") { + this.wrapOpen = "("; + this.wrapClose = ")"; + } else { + this.wrapOpen = " "; + this.wrapClose = " "; + } this.params = options.params; this.defaultParams = options.defaultParams; this.renderer = options.renderer; diff --git a/public/app/core/components/sql_part/sql_part_editor.ts b/public/app/core/components/sql_part/sql_part_editor.ts index 2ebeca5753a..43404b41423 100644 --- a/public/app/core/components/sql_part/sql_part_editor.ts +++ b/public/app/core/components/sql_part/sql_part_editor.ts @@ -5,7 +5,7 @@ import coreModule from 'app/core/core_module'; var template = `