forms
This commit is contained in:
parent
4a7085d7ec
commit
6ac09081b2
|
@ -47,8 +47,8 @@ public class DsmAjaxController extends AbstractDnetController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/conf")
|
@GetMapping("/conf")
|
||||||
public Map<String, Object> configuration() {
|
public Map<String, Iterable<?>> configuration() {
|
||||||
final Map<String, Object> map = new LinkedHashMap<>();
|
final Map<String, Iterable<?>> map = new LinkedHashMap<>();
|
||||||
map.put("protocols", protocolService.listProtocols());
|
map.put("protocols", protocolService.listProtocols());
|
||||||
map.put("compatibilityLevels", vocabularyTermRepository.findTermsByVocabulary("dnet:compatibilityLevel"));
|
map.put("compatibilityLevels", vocabularyTermRepository.findTermsByVocabulary("dnet:compatibilityLevel"));
|
||||||
map.put("contentDescTypes", vocabularyTermRepository.findTermsByVocabulary("dnet:content_description_typologies"));
|
map.put("contentDescTypes", vocabularyTermRepository.findTermsByVocabulary("dnet:content_description_typologies"));
|
||||||
|
|
|
@ -53,16 +53,11 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-body">
|
<div class="modal-body">
|
||||||
<form>
|
<form>
|
||||||
<div class="form-group">
|
|
||||||
<label>ID</label> <input ng-show="mode == 'new'" type="text" class="form-control" ng-model="tmpCtx.id" /> <input ng-show="mode == 'edit'" type="text" readonly class="form-control-plaintext"
|
<form-textfield label="ID" value="tmpCtx.id" ng-show="mode == 'new'"></form-textfield>
|
||||||
ng-model="tmpCtx.id" />
|
<form-textfield-static label="ID" value="tmpCtx.id" ng-show="mode == 'edit'"></form-textfield-static>
|
||||||
</div>
|
<form-textfield label="Label" value="tmpCtx.label"></form-textfield>
|
||||||
<div class="form-group">
|
<form-textfield label="Type" value="tmpCtx.type"></form-textfield>
|
||||||
<label>Label</label> <input type="text" class="form-control" ng-model="tmpCtx.label" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>Type</label> <input type="text" class="form-control" ng-model="tmpCtx.type" />
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<table class="table table-sm table-striped" style="table-layout: fixed;">
|
<table class="table table-sm table-striped" style="table-layout: fixed;">
|
||||||
<thead>
|
<thead>
|
||||||
|
|
|
@ -14,12 +14,7 @@
|
||||||
<form-textfield label="BaseURL" value="api.baseUrl" regex="^(http|https|ftp|file|sftp|jar|mongodb):\/\/"></form-textfield>
|
<form-textfield label="BaseURL" value="api.baseUrl" regex="^(http|https|ftp|file|sftp|jar|mongodb):\/\/"></form-textfield>
|
||||||
|
|
||||||
<div ng-show="api.protocol" ng-repeat="p in selProtParams">
|
<div ng-show="api.protocol" ng-repeat="p in selProtParams">
|
||||||
<div class="form-group row">
|
<form-textfield label="Parameter: {{p.label}}" value="api.apiParams[p.name]" type="{{p.type}}" optional="{{p.optional}}"></form-textfield>
|
||||||
<label class="col-sm-2 col-form-label col-form-label-sm">Parameter: {{p.label}}</label>
|
|
||||||
<div class="col-sm-10">
|
|
||||||
<input type="text" class="form-control form-control-sm" ng-model="api.apiParams[p.name]"/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{api}}<br />
|
{{api}}<br />
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<select class="custom-select custom-select-sm is-valid"
|
<select class="custom-select custom-select-sm is-valid"
|
||||||
ng-model="value"
|
ng-model="value"
|
||||||
ng-required="required"
|
ng-required="required"
|
||||||
ng-class="{'is-invalid': !value || value.trim() == ''}">
|
ng-class="{'is-invalid': required && (!value || value.trim() == '')}">
|
||||||
<option ng-repeat="t in terms">{{t}}</option>
|
<option ng-repeat="t in terms">{{t}}</option>
|
||||||
</select>
|
</select>
|
||||||
|
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
<div class="form-group row">
|
||||||
|
<label class="col-sm-2 col-form-label col-form-label-sm">{{label}}</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<textarea class="form-control form-control-sm is-valid"
|
||||||
|
ng-required="required"
|
||||||
|
ng-class="{'is-invalid': required && (!value || value.trim() == '')}"
|
||||||
|
ng-model="value"></textarea>
|
||||||
|
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -4,7 +4,8 @@
|
||||||
<input type="text" class="form-control form-control-sm is-valid"
|
<input type="text" class="form-control form-control-sm is-valid"
|
||||||
ng-pattern="mypattern"
|
ng-pattern="mypattern"
|
||||||
ng-required="required"
|
ng-required="required"
|
||||||
ng-class="{'is-invalid': !value || value.trim() == ''}"
|
ng-class="{'is-invalid': required && (!value || value.trim() == '')}"
|
||||||
ng-model="value" />
|
ng-model="value" />
|
||||||
|
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
</div>
|
</div>
|
||||||
<input type="text" class="form-control form-control-sm is-valid"
|
<input type="text" class="form-control form-control-sm is-valid"
|
||||||
ng-required="required"
|
ng-required="required"
|
||||||
ng-class="{'is-invalid': !suffix || suffix.trim() == ''}"
|
ng-class="{'is-invalid': required && (!suffix || suffix.trim() == '')}"
|
||||||
ng-model="suffix" />
|
ng-model="suffix" />
|
||||||
|
<small class="form-text text-muted" ng-if="!required">(Optional)</small>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -96,7 +96,20 @@ app.directive('formSelect', function() {
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.directive('formTextarea', function() {
|
||||||
|
return {
|
||||||
|
restrict: 'E',
|
||||||
|
scope: {
|
||||||
|
'label' : '@',
|
||||||
|
'optional' : '@',
|
||||||
|
'value' : '=',
|
||||||
|
},
|
||||||
|
templateUrl: './html/parts/form_textarea.html',
|
||||||
|
link: function(scope, element, attrs) {
|
||||||
|
scope.required = (scope.optional != 'true');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue