From e14eefdc31059be3dd91b84e2ff42262698dc9f1 Mon Sep 17 00:00:00 2001 From: kevgliss Date: Mon, 23 Nov 2015 16:35:46 -0800 Subject: [PATCH] Added the ability to find an authority even if a user only types the name in and does not select it. --- .../static/app/angular/authorities/view/view.tpl.html | 4 +--- .../angular/certificates/certificate/tracking.tpl.html | 2 +- lemur/static/app/angular/certificates/services.js | 10 +++++++++- lemur/static/app/angular/wizard.html | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lemur/static/app/angular/authorities/view/view.tpl.html b/lemur/static/app/angular/authorities/view/view.tpl.html index 65a4c524..9d64f174 100644 --- a/lemur/static/app/angular/authorities/view/view.tpl.html +++ b/lemur/static/app/angular/authorities/view/view.tpl.html @@ -34,11 +34,9 @@ - - Permalink -
+ Permalink diff --git a/lemur/static/app/angular/certificates/certificate/tracking.tpl.html b/lemur/static/app/angular/certificates/certificate/tracking.tpl.html index 11553ffe..cf337f0f 100644 --- a/lemur/static/app/angular/certificates/certificate/tracking.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/tracking.tpl.html @@ -29,7 +29,7 @@
+ class="form-control" typeahead-wait-ms="1000" typeahead-template-url="angular/authorities/authority/select.tpl.html" required>
diff --git a/lemur/static/app/angular/certificates/services.js b/lemur/static/app/angular/certificates/services.js index 89e68125..47faf9cb 100644 --- a/lemur/static/app/angular/certificates/services.js +++ b/lemur/static/app/angular/certificates/services.js @@ -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); }; diff --git a/lemur/static/app/angular/wizard.html b/lemur/static/app/angular/wizard.html index 1ff4b641..56918b2f 100644 --- a/lemur/static/app/angular/wizard.html +++ b/lemur/static/app/angular/wizard.html @@ -5,7 +5,7 @@