Add static enum option to redash

This commit is contained in:
Tyler Rockwood
2017-05-09 13:32:12 -07:00
parent 24f3e071e3
commit b675cd19d7
3 changed files with 11 additions and 0 deletions

View File

@@ -13,6 +13,7 @@
<select ng-model="$ctrl.parameter.type" class="form-control">
<option value="text">Text</option>
<option value="number">Number</option>
<option value="enum">Enum</option>
<option value="date">Date</option>
<option value="datetime-local">Date and Time</option>
<option value="datetime-with-seconds">Date and Time (with seconds)</option>
@@ -22,5 +23,9 @@
<label>Global</label>
<input type="checkbox" class="form-inline" ng-model="$ctrl.parameter.global">
</div>
<div class="form-group">
<label>Values (newline delimited)</label>
<textarea class="form-control" rows="3" ng-model="$ctl.parameter.enumOptions">
</div>
</div>
</div>

View File

@@ -6,6 +6,11 @@
<input ng-switch-when="datetime-with-seconds" type="datetime-local" step="1" class="form-control" ng-model="param.ngModel">
<input ng-switch-when="datetime-local" type="datetime-local" class="form-control" ng-model="param.ngModel">
<input ng-switch-when="date" type="date" class="form-control" ng-model="param.ngModel">
<span ns-switch-when="enum">
<select ns-model="param.value" class="form-control">
<option ng-repeat="option in param.enumOptions.split('\n')" value="{{option}}">{{option}}</option>
</select>
</span>
<input ng-switch-default type="{{param.type}}" class="form-control" ng-model="param.ngModel">
</span>
</div>

View File

@@ -50,6 +50,7 @@ class Parameter {
this.type = parameter.type;
this.value = parameter.value;
this.global = parameter.global;
this.enumOptions = parameter.enumOptions;
}
get ngModel() {