Added the ability to find an authority even if a user only types the name in and does not select it.
This commit is contained in:
@ -29,7 +29,7 @@
|
||||
<div class="input-group col-sm-12">
|
||||
<input name="selectedAuthority" tooltip="If you are unsure which authority you need; you most likely want to use 'verisign'" type="text" ng-model="certificate.selectedAuthority" placeholder="Authority Name" typeahead-on-select="certificate.attachAuthority($item)"
|
||||
typeahead="authority.name for authority in authorityService.findActiveAuthorityByName($viewValue)" typeahead-loading="loadingAuthorities"
|
||||
class="form-control" typeahead-wait-ms="100" typeahead-template-url="angular/authorities/authority/select.tpl.html" required>
|
||||
class="form-control" typeahead-wait-ms="1000" typeahead-template-url="angular/authorities/authority/select.tpl.html" required>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -89,7 +89,7 @@ angular.module('lemur')
|
||||
});
|
||||
return LemurRestangular.all('certificates');
|
||||
})
|
||||
.service('CertificateService', function ($location, CertificateApi, LemurRestangular, DefaultService) {
|
||||
.service('CertificateService', function ($location, CertificateApi, AuthorityService, LemurRestangular, DefaultService) {
|
||||
var CertificateService = this;
|
||||
CertificateService.findCertificatesByName = function (filterValue) {
|
||||
return CertificateApi.getList({'filter[name]': filterValue})
|
||||
@ -100,6 +100,14 @@ angular.module('lemur')
|
||||
|
||||
CertificateService.create = function (certificate) {
|
||||
certificate.attachSubAltName();
|
||||
// Help users who may have just typed in their authority
|
||||
if (!certificate.authority) {
|
||||
AuthorityService.findActiveAuthorityByName(certificate.selectedAuthority).then(function (authorities) {
|
||||
if (authorities.length > 0) {
|
||||
certificate.authority = authorities[0];
|
||||
}
|
||||
});
|
||||
}
|
||||
return CertificateApi.post(certificate);
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user