From 1b6f88f6fdec4939eb62d2ed2117bb21a76b5a76 Mon Sep 17 00:00:00 2001 From: Neil Schelly Date: Wed, 18 Jan 2017 17:20:44 -0500 Subject: [PATCH] Fixing handling of adding custom OIDs in UI (#653) * is_critical wasn't in the schema, so was getting dropped. * isCritical in the Javascript wasn't getting assigned if it was unchecked. Now, it will be assumed false if missing. * The display of critical or not in the list of added custom OIDs was unclear when it was just true/false with no heading. Now it will be displayed as critical or nothing instead. * The namespace for the checkbox for isCritical was wrong, and didn't get processed with the oid/type/value variables. --- lemur/schemas.py | 1 + .../app/angular/authorities/authority/extensions.tpl.html | 4 ++-- lemur/static/app/angular/authorities/services.js | 2 +- .../app/angular/certificates/certificate/options.tpl.html | 4 ++-- lemur/static/app/angular/certificates/services.js | 2 +- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/lemur/schemas.py b/lemur/schemas.py index a9e91e2b..447429d4 100644 --- a/lemur/schemas.py +++ b/lemur/schemas.py @@ -229,6 +229,7 @@ class CustomOIDSchema(BaseExtensionSchema): oid = fields.String() encoding = fields.String(validate=validators.encoding) value = fields.String() + is_critical = fields.Boolean() class ExtensionSchema(BaseExtensionSchema): diff --git a/lemur/static/app/angular/authorities/authority/extensions.tpl.html b/lemur/static/app/angular/authorities/authority/extensions.tpl.html index 1ee70c0b..28496440 100644 --- a/lemur/static/app/angular/authorities/authority/extensions.tpl.html +++ b/lemur/static/app/angular/authorities/authority/extensions.tpl.html @@ -196,7 +196,7 @@
@@ -208,7 +208,7 @@ {{ custom.oid }} {{ custom.encoding }} {{ custom.value }} - {{ custom.isCritical}} + {{ custom.isCritical ? "critical" : "" }} diff --git a/lemur/static/app/angular/authorities/services.js b/lemur/static/app/angular/authorities/services.js index fa976b52..2ecaef8d 100644 --- a/lemur/static/app/angular/authorities/services.js +++ b/lemur/static/app/angular/authorities/services.js @@ -41,7 +41,7 @@ angular.module('lemur') this.extensions.custom.push( { 'oid': this.customOid, - 'isCritical': this.customIsCritical, + 'isCritical': this.customIsCritical || false, 'encoding': this.customEncoding, 'value': this.customValue } diff --git a/lemur/static/app/angular/certificates/certificate/options.tpl.html b/lemur/static/app/angular/certificates/certificate/options.tpl.html index c38eb863..4abe13c5 100644 --- a/lemur/static/app/angular/certificates/certificate/options.tpl.html +++ b/lemur/static/app/angular/certificates/certificate/options.tpl.html @@ -257,7 +257,7 @@
@@ -270,7 +270,7 @@ {{ custom.oid }} {{ custom.encoding }} {{ custom.value }} - {{ custom.isCritical }} + {{ custom.isCritical ? "critical" : "" }}