redash/client/app/components/dashboards/add-widget-dialog.html
2017-11-06 21:50:11 +02:00

50 lines
2.4 KiB
HTML

<div class="modal-header">
<button type="button" class="close" ng-disabled="$ctrl.saveInProgress" aria-hidden="true" ng-click="$ctrl.dismiss()">&times;</button>
<h4 class="modal-title">Add Widget</h4>
</div>
<div class="modal-body">
<p class="btn-group">
<button type="button" class="btn btn-default" ng-class="{active: $ctrl.isVisualization()}" ng-click="$ctrl.setType('visualization')">Visualization</button>
<button type="button" class="btn btn-default" ng-class="{active: $ctrl.isTextBox()}" ng-click="$ctrl.setType('textbox')">Text Box</button>
</p>
<div ng-show="$ctrl.isTextBox()">
<div class="form-group">
<textarea class="form-control" ng-model="$ctrl.text" rows="3"></textarea>
</div>
<div ng-show="$ctrl.text">
<strong>Preview:</strong>
<p ng-bind-html="$ctrl.text | markdown"></p>
</div>
</div>
<div ng-show="$ctrl.isVisualization()">
<div class="form-group">
<ui-select ng-model="$ctrl.query.selected" theme="bootstrap" reset-search-input="false" on-select="$ctrl.onQuerySelect($item, $model)">
<ui-select-match placeholder="Search a query by name">{{$select.selected.name}}</ui-select-match>
<ui-select-choices repeat="q in $ctrl.queries"
refresh="$ctrl.searchQueries($select.search)"
refresh-delay="0">
<div ng-bind-html="$ctrl.trustAsHtml(q.name | highlight: $select.search)"></div>
</ui-select-choices>
</ui-select>
</div>
<div ng-show="$ctrl.selected_query">
<div class="form-group">
<label for="">Choose Visualization</label>
<select ng-model="$ctrl.selectedVis" ng-options="vis as vis.name group by vis.type for vis in $ctrl.selected_query.visualizations" class="form-control"></select>
</div>
</div>
</div>
<div class="form-group" ng-if="$ctrl.isTextBox()">
<label><input type="checkbox" ng-model="$ctrl.isHidden">&nbsp;Hidden</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-disabled="$ctrl.saveInProgress" ng-click="$ctrl.dismiss()">Close</button>
<button type="button" class="btn btn-primary" ng-disabled="$ctrl.saveInProgress || !($ctrl.selectedVis || $ctrl.isTextBox())" ng-click="$ctrl.saveWidget()">Add to Dashboard</button>
</div>