ui: refresh node list after create

This commit is contained in:
Jack Pearkes 2014-04-30 22:16:12 -04:00
parent b3a18fdb4a
commit 0544a7cf76
4 changed files with 23 additions and 18 deletions

View File

@ -73,7 +73,7 @@
<script type="text/x-handlebars" data-template-name="kv/show">
<div class="row">
<h5><a class="subtle" href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h5>
<h4 class="breadcrumbs"><a href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h4>
</div>
<div class="row">
@ -140,7 +140,11 @@
<script type="text/x-handlebars" data-template-name="kv/edit">
<div class="row">
<h5><a class="subtle" href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h5>
<div class="col-md-5">
<div class="row">
<h4 class="breadcrumbs"><a href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h4>
</div>
</div>
</div>
<div class="row">
@ -210,7 +214,7 @@
</h4>
<ul class="list-inline">
{{#each node in service.Nodes }}
<li>{{node}}</li>
<li class="bold">{{node}}</li>
{{/each}}
</ul>
{{/link-to}}
@ -283,7 +287,7 @@
</h4>
<ul class="list-inline">
{{#each service in node.Services }}
<li>{{service.Service}}</li>
<li class="bold">{{service.Service}}</li>
{{/each}}
</ul>
</div>

View File

@ -80,11 +80,12 @@ App.KvShowController.reopen({
var grandParentKey = this.get('grandParentKey');
var controller = this;
var dc = this.get('dc').get('datacenter');
console.log(dc)
// If we don't have a previous model to base
// on our parent, or we're not at the root level,
// strip the leading slash.
if (parentKey != undefined && parentKey != "/") {
if (parentKey != undefined || parentKey != "/") {
newKey.set('Key', (parentKey + newKey.get('Key')));
}
@ -95,16 +96,12 @@ App.KvShowController.reopen({
data: newKey.get('Value')
}).then(function(response) {
controller.set('isLoading', false)
// transition to the right place
if (newKey.get('isFolder') == true) {
controller.transitionToRoute('kv.show', newKey.get('urlSafeKey'));
} else {
controller.transitionToRoute('kv.edit', newKey.get('urlSafeKey'));
}
// Reload the keys in the left column
controller.get('keys').reload()
}).fail(function(response) {
// Render the error message on the form if the request failed
controller.set('errorMessage', 'Received error while processing: ' + response.statusText)

View File

@ -176,15 +176,7 @@ App.KvEditRoute = App.BaseRoute.extend({
controller.set('parentKey', parentKey);
controller.set('grandParentKey', grandParentKey);
// If we don't have the cached model from our
// the kv.show controller, we need to go get it,
// otherwise we just load what we have.
if (this.modelFor('kv.show') == undefined ) {
controller.set('siblings', models.keys);
} else {
controller.set('siblings', this.modelFor('kv.show').keys);
}
controller.set('siblings', models.keys);
}
});

View File

@ -38,8 +38,20 @@ h5 {
color: $gray-light;
}
h4.breadcrumbs {
padding-bottom: 5px;
text-transform: uppercase;
a {
color: $gray-light;
}
}
pre {
background-color: $gray;
color: white;
font-size: 11px;
}
.bold {
font-weight: 700;
}