Files
redash/client/app/components/dynamic-form.html
2018-03-23 19:10:26 +03:00

39 lines
2.2 KiB
HTML

<form name="dynamicForm">
<div class="form-group required" ng-class='{"has-error": (dynamicForm.targetName | showError)}'>
<label class="control-label" for="dataSourceName">Name</label>
<input type="string" class="form-control" name="targetName" ng-model="target.name" autofocus required>
<error-messages input="dynamicForm.targetName" form="dynamicForm"></error-messages>
</div>
<hr>
<div class="form-group" ng-class='{"has-error": (inner.input | showError), "required": field.property.required}' ng-form="inner" ng-repeat="field in fields">
<label ng-if="field.property.type !== 'checkbox'" class="control-label">{{field.property.title || field.name | toHuman}}</label>
<input name="input" type="{{field.property.type}}" class="form-control" ng-model="target.options[field.name]" ng-required="field.property.required"
ng-if="field.property.type !== 'file' && field.property.type !== 'checkbox'" accesskey="tab" placeholder="{{field.property.default}}">
<label ng-if="field.property.type=='checkbox'">
<input name="input" type="{{field.property.type}}" ng-model="target.options[field.name]" ng-required="field.property.required"
ng-if="field.property.type !== 'file'" accesskey="tab" placeholder="{{field.property.default}}">
{{field.property.title || field.name | toHuman}}
</label>
<input name="input" type="file" class="form-control" ng-model="files[field.name]" ng-required="field.property.required && !target.options[field.name]"
base-sixty-four-input
ng-if="field.property.type === 'file'">
<error-messages input="inner.input" form="inner"></error-messages>
</div>
<button class="btn btn-block btn-primary m-b-10" ng-disabled="!dynamicForm.$valid" ng-click="saveChanges()">Save</button>
<span ng-repeat="action in actions">
<button class="btn"
ng-class="action.class"
ng-if="target.id"
ng-disabled="(action.disableWhenDirty && dynamicForm.$dirty) || inProgressActions[action.name]"
ng-click="action.callback()" ng-bind-html="action.name"></button>
</span>
<span ng-transclude>
</span>
</form>