From 2226255832da19c7e8a0efc73b5f72b681cdf19a Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Fri, 6 Jun 2014 12:21:36 -0400 Subject: [PATCH] ui: show isLocked for key --- ui/index.html | 19 ++++++++++++------- ui/javascripts/app/models.js | 9 +++++++++ ui/javascripts/app/routes.js | 6 ++++++ ui/styles/_panels.scss | 26 ++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/ui/index.html b/ui/index.html index 050b2ceb4e..e790335533 100644 --- a/ui/index.html +++ b/ui/index.html @@ -145,7 +145,7 @@
-

+

Create Key

@@ -213,10 +213,15 @@
-
+
-

+

{{model.Key}} + {{#if model.isLocked}} + + KEY LOCKED + + {{/if}}

@@ -226,11 +231,11 @@
- {{ textarea value=model.valueDecoded class="form-control"}} + {{ textarea value=model.valueDecoded class="form-control" disabled=model.isLocked}}
- - - + + +
diff --git a/ui/javascripts/app/models.js b/ui/javascripts/app/models.js index 4ecf38bbf3..84c1f8851d 100644 --- a/ui/javascripts/app/models.js +++ b/ui/javascripts/app/models.js @@ -176,6 +176,15 @@ App.Key = Ember.Object.extend(Ember.Validations.Mixin, { return (this.get('Key').slice(-1) === '/') }.property('Key'), + // Boolean if the key is locked or now + isLocked: function() { + if (!this.get('Session')) { + return false; + } else { + return true; + } + }.property('Session'), + // Determines what route to link to. If it's a folder, // it will link to kv.show. Otherwise, kv.edit linkToRoute: function() { diff --git a/ui/javascripts/app/routes.js b/ui/javascripts/app/routes.js index 220f8c99d9..37f14f0067 100644 --- a/ui/javascripts/app/routes.js +++ b/ui/javascripts/app/routes.js @@ -172,6 +172,12 @@ App.KvEditRoute = App.BaseRoute.extend({ }); return objs; }), + }).then(function(models) { + // If the key is locked, add the session + if (models.key.get('isLocked') == true) { + models.session = Ember.$.getJSON('/v1/session/info/' + key.Session + '/&dc=' + dc) + } + return models }); }, diff --git a/ui/styles/_panels.scss b/ui/styles/_panels.scss index ead5b3749f..3d7f5acd16 100644 --- a/ui/styles/_panels.scss +++ b/ui/styles/_panels.scss @@ -10,6 +10,32 @@ border-color: $gray-background; } + h4.panel-title { + padding: 4px 10px 4px 10px; + font-size: 20px; + color: $gray-light; + color: $gray-darker; + border-radius: 3px; + opacity: 0.8; + + small { + font-size: 14px; + text-transform: uppercase; + font-weight: 700; + margin-left: 5px; + padding-top: 2px; + } + + .panel-note { + margin-top: 5px; + float: right; + font-weight: 600; + color: $gray-light; + font-size: 14px; + } + } + + h3.panel-title { padding: 4px 0px 4px 0px; font-size: 20px;