ui: add locking session below lock
This commit is contained in:
parent
06f7630e29
commit
23cc6a3a5e
|
@ -203,46 +203,62 @@
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="border-left hidden-xs hidden-sm">
|
<div class="border-left hidden-xs hidden-sm">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="visible-xs visible-sm">
|
<div class="visible-xs visible-sm">
|
||||||
<hr>
|
<hr>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6 col-lg-7 border-left">
|
<div class="col-md-6 col-lg-7 border-left">
|
||||||
<div class="padded-border">
|
<div class="padded-border">
|
||||||
|
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div {{ bind-attr class=":panel-bar isLoading:bg-orange:bg-green isLocked:bg-light-gray" }}></div>
|
<div {{ bind-attr class=":panel-bar isLoading:bg-orange:bg-green isLocked:bg-light-gray" }}></div>
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h4 {{bind-attr class=":panel-title isLocked:locked"}}>
|
<h4 {{bind-attr class=":panel-title isLocked:locked"}}>
|
||||||
{{model.Key}}
|
{{model.Key}}
|
||||||
{{#if model.isLocked}}
|
{{#if model.isLocked}}
|
||||||
<small class="pull-right">
|
<small class="pull-right">
|
||||||
KEY LOCKED
|
KEY LOCKED
|
||||||
</small>
|
</small>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</h3>
|
</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>
|
</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>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-handlebars" data-template-name="item/loading">
|
<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 a promise hash to get the data for both columns
|
||||||
return Ember.RSVP.hash({
|
return Ember.RSVP.hash({
|
||||||
|
dc: dc,
|
||||||
key: Ember.$.getJSON('/v1/kv/' + key + '?dc=' + dc).then(function(data) {
|
key: Ember.$.getJSON('/v1/kv/' + key + '?dc=' + dc).then(function(data) {
|
||||||
// Convert the returned data to a Key
|
// Convert the returned data to a Key
|
||||||
return App.Key.create().setProperties(data[0]);
|
return App.Key.create().setProperties(data[0]);
|
||||||
|
@ -172,15 +173,21 @@ App.KvEditRoute = App.BaseRoute.extend({
|
||||||
});
|
});
|
||||||
return objs;
|
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) {
|
setupController: function(controller, models) {
|
||||||
var key = models.key;
|
var key = models.key;
|
||||||
var parentKeys = this.getParentAndGrandparent(key.get('Key'));
|
var parentKeys = this.getParentAndGrandparent(key.get('Key'));
|
||||||
|
@ -192,6 +199,7 @@ App.KvEditRoute = App.BaseRoute.extend({
|
||||||
controller.set('isRoot', parentKeys.isRoot);
|
controller.set('isRoot', parentKeys.isRoot);
|
||||||
controller.set('siblings', models.keys);
|
controller.set('siblings', models.keys);
|
||||||
controller.set('rootKey', this.rootKey);
|
controller.set('rootKey', this.rootKey);
|
||||||
|
controller.set('session', models.session);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue