mirror of https://github.com/status-im/consul.git
ui: handle empty kv index
This commit is contained in:
parent
11acb28c1f
commit
375febc3b0
|
@ -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' topModel.grandParentKey }}>{{topModel.parentKey}}</a></h5>
|
<h5><a class="subtle" href="" {{action 'linkToKey' grandParentKey }}>{{parentKey}}</a></h5>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -117,7 +117,7 @@
|
||||||
|
|
||||||
<div {{ bind-attr class=":form-group newKey.keyValid:valid" }}>
|
<div {{ bind-attr class=":form-group newKey.keyValid:valid" }}>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-addon">{{topModel.parentKey}}</span>
|
<span class="input-group-addon">{{parentKey}}</span>
|
||||||
{{ input value=newKey.Key class="form-control" required=true }}
|
{{ input value=newKey.Key class="form-control" required=true }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -93,8 +93,19 @@ App.KvShowRoute = App.BaseRoute.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
|
// If we don't have any k/v, we need to set some basic
|
||||||
|
// stuff so we can create them
|
||||||
|
if (model.length == 0) {
|
||||||
|
var parentKey = "/";
|
||||||
|
var grandParentKey = "/";
|
||||||
|
} else {
|
||||||
|
var parentKey = model[0].parentKey;
|
||||||
|
var grandParentKey = model[0].grandParentKey;
|
||||||
|
}
|
||||||
|
|
||||||
controller.set('content', model);
|
controller.set('content', model);
|
||||||
controller.set('topModel', model[0]);
|
controller.set('parentKey', parentKey);
|
||||||
|
controller.set('grandParentKey', grandParentKey);
|
||||||
controller.set('newKey', App.Key.create());
|
controller.set('newKey', App.Key.create());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue