ui: refresh node list after create

This commit is contained in:
Jack Pearkes 2014-04-30 22:16:12 -04:00
parent 32d0374a5a
commit ec86d0fdc3
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"> <script type="text/x-handlebars" data-template-name="kv/show">
<div class="row"> <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>
<div class="row"> <div class="row">
@ -140,7 +140,11 @@
<script type="text/x-handlebars" data-template-name="kv/edit"> <script type="text/x-handlebars" data-template-name="kv/edit">
<div class="row"> <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>
<div class="row"> <div class="row">
@ -210,7 +214,7 @@
</h4> </h4>
<ul class="list-inline"> <ul class="list-inline">
{{#each node in service.Nodes }} {{#each node in service.Nodes }}
<li>{{node}}</li> <li class="bold">{{node}}</li>
{{/each}} {{/each}}
</ul> </ul>
{{/link-to}} {{/link-to}}
@ -283,7 +287,7 @@
</h4> </h4>
<ul class="list-inline"> <ul class="list-inline">
{{#each service in node.Services }} {{#each service in node.Services }}
<li>{{service.Service}}</li> <li class="bold">{{service.Service}}</li>
{{/each}} {{/each}}
</ul> </ul>
</div> </div>

View File

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

View File

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