make param wrapper configurable

This commit is contained in:
Sven Klemm 2018-05-21 12:52:14 +02:00
parent a5bcd8eac0
commit 067bfa3f72
2 changed files with 17 additions and 2 deletions

View File

@ -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;

View File

@ -5,7 +5,7 @@ import coreModule from 'app/core/core_module';
var template = `
<div class="dropdown cascade-open">
<a ng-click="showActionsMenu()" class="query-part-name pointer dropdown-toggle" data-toggle="dropdown">{{part.def.label}}</a>
<span>(</span><span class="query-part-parameters"></span><span>)</span>
<span>{{part.def.wrapOpen}}</span><span class="query-part-parameters"></span><span>{{part.def.wrapClose}}</span>
<ul class="dropdown-menu">
<li ng-repeat="action in partActions">
<a ng-click="triggerPartAction(action)">{{action.text}}</a>