ui: add locking session below lock
This commit is contained in:
parent
06f7630e29
commit
23cc6a3a5e
|
@ -203,46 +203,62 @@
|
|||
{{/each}}
|
||||
</div>
|
||||
|
||||
<div class="border-left hidden-xs hidden-sm">
|
||||
</div>
|
||||
<div class="border-left hidden-xs hidden-sm">
|
||||
</div>
|
||||
|
||||
<div class="visible-xs visible-sm">
|
||||
<hr>
|
||||
</div>
|
||||
<div class="visible-xs visible-sm">
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6 col-lg-7 border-left">
|
||||
<div class="padded-border">
|
||||
|
||||
<div class="panel">
|
||||
<div {{ bind-attr class=":panel-bar isLoading:bg-orange:bg-green isLocked:bg-light-gray" }}></div>
|
||||
<div class="panel-heading">
|
||||
<h4 {{bind-attr class=":panel-title isLocked:locked"}}>
|
||||
{{model.Key}}
|
||||
{{#if model.isLocked}}
|
||||
<small class="pull-right">
|
||||
KEY LOCKED
|
||||
</small>
|
||||
{{/if}}
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<div class="panel-body panel-form">
|
||||
<div class="form-group">
|
||||
{{errorMessage}}
|
||||
</div>
|
||||
<form class="form">
|
||||
<div class="form-group">
|
||||
{{ textarea value=model.valueDecoded class="form-control" disabled=model.isLocked}}
|
||||
</div>
|
||||
<button {{action "updateKey"}} {{bind-attr disabled=isLoading}} {{bind-attr class=":btn isLoading:btn-warning:btn-success"}} {{bind-attr disabled=isLocked}}>Update</button>
|
||||
<button {{action "cancelEdit"}} {{bind-attr disabled=isLoading}} {{bind-attr class=":btn isLoading:btn-warning:btn-default"}}>Cancel</button>
|
||||
<button {{action "deleteKey"}} {{bind-attr disabled=isLoading}} {{bind-attr class=":btn :pull-right isLoading:btn-warning:btn-danger"}} {{bind-attr disabled=isLocked}}>Delete key</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="panel-heading">
|
||||
<h4 {{bind-attr class=":panel-title isLocked:locked"}}>
|
||||
{{model.Key}}
|
||||
{{#if model.isLocked}}
|
||||
<small class="pull-right">
|
||||
KEY LOCKED
|
||||
</small>
|
||||
{{/if}}
|
||||
</h4>
|
||||
</div>
|
||||
|
||||
<div class="panel-body panel-form">
|
||||
<div class="form-group">
|
||||
{{errorMessage}}
|
||||
</div>
|
||||
<form class="form">
|
||||
<div class="form-group">
|
||||
{{ textarea value=model.valueDecoded class="form-control" disabled=model.isLocked}}
|
||||
</div>
|
||||
<button {{action "updateKey"}} {{bind-attr disabled=isLoading}} {{bind-attr class=":btn isLoading:btn-warning:btn-success"}} {{bind-attr disabled=isLocked}}>Update</button>
|
||||
<button {{action "cancelEdit"}} {{bind-attr disabled=isLoading}} {{bind-attr class=":btn isLoading:btn-warning:btn-default"}}>Cancel</button>
|
||||
<button {{action "deleteKey"}} {{bind-attr disabled=isLoading}} {{bind-attr class=":btn :pull-right isLoading:btn-warning:btn-danger"}} {{bind-attr disabled=isLocked}}>Delete key</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if model.isLocked}}
|
||||
<h5>Lock Session</h5>
|
||||
|
||||
{{#link-to 'nodes.show' model.session.Node tagName="div" href=false class="list-group-item list-condensed-link" }}
|
||||
<div class="bg-light-gray list-bar-horizontal"></div>
|
||||
<div class="name">
|
||||
{{session.Node}}
|
||||
<small class="pull-right">
|
||||
{{session.ID}}
|
||||
</small>
|
||||
</div>
|
||||
{{/link-to}}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-handlebars" data-template-name="item/loading">
|
||||
|
|
|
@ -161,6 +161,7 @@ App.KvEditRoute = App.BaseRoute.extend({
|
|||
|
||||
// Return a promise hash to get the data for both columns
|
||||
return Ember.RSVP.hash({
|
||||
dc: dc,
|
||||
key: Ember.$.getJSON('/v1/kv/' + key + '?dc=' + dc).then(function(data) {
|
||||
// Convert the returned data to a Key
|
||||
return App.Key.create().setProperties(data[0]);
|
||||
|
@ -172,15 +173,21 @@ 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
|
||||
});
|
||||
},
|
||||
|
||||
// Load the session on the key, if there is one
|
||||
afterModel: function(models) {
|
||||
if (models.key.get('isLocked')) {
|
||||
return Ember.$.getJSON('/v1/session/info/' + models.key.Session + '?dc=' + models.dc).then(function(data) {
|
||||
models.session = data[0]
|
||||
return models
|
||||
});
|
||||
} else {
|
||||
return models
|
||||
}
|
||||
},
|
||||
|
||||
setupController: function(controller, models) {
|
||||
var key = models.key;
|
||||
var parentKeys = this.getParentAndGrandparent(key.get('Key'));
|
||||
|
@ -192,6 +199,7 @@ App.KvEditRoute = App.BaseRoute.extend({
|
|||
controller.set('isRoot', parentKeys.isRoot);
|
||||
controller.set('siblings', models.keys);
|
||||
controller.set('rootKey', this.rootKey);
|
||||
controller.set('session', models.session);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
0
ui/javascripts/app/untitled
Normal file
0
ui/javascripts/app/untitled
Normal file
Loading…
Reference in a new issue