mirror of https://github.com/status-im/consul.git
ui: properly nest kv resources
This commit is contained in:
parent
f8ffdee2bd
commit
2c22cb833c
|
@ -65,8 +65,8 @@
|
||||||
<script type="text/x-handlebars" data-template-name="kv/show">
|
<script type="text/x-handlebars" data-template-name="kv/show">
|
||||||
<a {{action 'linkToKey' parent }}>{{parent}}</a>
|
<a {{action 'linkToKey' parent }}>{{parent}}</a>
|
||||||
|
|
||||||
<div class="row">
|
<div class="col-md-5">
|
||||||
<div class="col-md-5">
|
<div class="row">
|
||||||
|
|
||||||
{{#each item in model }}
|
{{#each item in model }}
|
||||||
<div {{action 'linkToKey' item.key }} class="panel panel-link panel-short">
|
<div {{action 'linkToKey' item.key }} class="panel panel-link panel-short">
|
||||||
|
@ -89,20 +89,23 @@
|
||||||
<script type="text/x-handlebars" data-template-name="kv/edit">
|
<script type="text/x-handlebars" data-template-name="kv/edit">
|
||||||
<a {{action 'linkToKey' parent }}>{{parent}}</a>
|
<a {{action 'linkToKey' parent }}>{{parent}}</a>
|
||||||
|
|
||||||
<div class="col-md-5">
|
<div class="col-md-5">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div {{action 'linkToKey' model.key }} class="panel panel-link panel-short">
|
{{#each item in siblings }}
|
||||||
<div {{bind-attr class=":panel-bar model.isFolder:bg-gray:bg-light-gray" }}></div>
|
<div {{action 'linkToKey' item.key }} class="panel panel-link panel-short">
|
||||||
<div class="panel-heading">
|
<div {{bind-attr class=":panel-bar item.isFolder:bg-gray:bg-light-gray" }}></div>
|
||||||
<h3 class="panel-title">
|
<div class="panel-heading">
|
||||||
{{model.key}}
|
<h3 class="panel-title">
|
||||||
</h3>
|
{{item.key}}
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
{{/each}}
|
||||||
</div>
|
|
||||||
|
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div class="col-md-5 col-md-offset-1">
|
<div class="col-md-5 col-md-offset-1">
|
||||||
{{ input value=model.value class="form-control"}}
|
{{ input value=model.value class="form-control"}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -87,9 +87,12 @@ App.Key = Ember.Object.extend({
|
||||||
|
|
||||||
parentKeys: function() {
|
parentKeys: function() {
|
||||||
var parts = this.get('key').split('/')
|
var parts = this.get('key').split('/')
|
||||||
parts.pop()
|
|
||||||
console.log(parts)
|
|
||||||
|
|
||||||
return parts
|
console.log(parts)
|
||||||
|
part = parts.slice(2)
|
||||||
|
|
||||||
|
console.log(part)
|
||||||
|
|
||||||
|
return '/'
|
||||||
}.property('parentKey')
|
}.property('parentKey')
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,9 +12,10 @@ App.Router.map(function() {
|
||||||
this.resource("nodes", { path: "/nodes" }, function() {
|
this.resource("nodes", { path: "/nodes" }, function() {
|
||||||
this.route("show", { path: "/:name" });
|
this.route("show", { path: "/:name" });
|
||||||
});
|
});
|
||||||
this.resource("kv", { path: "/kv" });
|
this.resource("kv", { path: "/kv" }, function(){
|
||||||
this.resource("kv.show", { path: "/kv/:key" });
|
this.route("show", { path: "/:key" });
|
||||||
this.resource("kv.edit", { path: "/kv/:key/edit" });
|
this.route("edit", { path: "/:key/edit" });
|
||||||
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
this.route("index", { path: "/" });
|
this.route("index", { path: "/" });
|
||||||
|
|
|
@ -91,8 +91,11 @@ App.KvEditRoute = App.BaseRoute.extend({
|
||||||
var key = params.key.replace(/-/g, "/")
|
var key = params.key.replace(/-/g, "/")
|
||||||
return App.Key.create().setProperties(window.fixtures.keys_full[key]);
|
return App.Key.create().setProperties(window.fixtures.keys_full[key]);
|
||||||
},
|
},
|
||||||
|
|
||||||
setupController: function(controller, model) {
|
setupController: function(controller, model) {
|
||||||
controller.set('content', model);
|
controller.set('content', model);
|
||||||
|
controller.set('siblings', this.modelFor('kv.show'));
|
||||||
|
console.log(this.modelFor('kv.show'))
|
||||||
controller.set('parent', model.get('parentKeys'));
|
controller.set('parent', model.get('parentKeys'));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -303,10 +303,15 @@ fixtures.keys_full = {
|
||||||
'key': 'web/foo/bar',
|
'key': 'web/foo/bar',
|
||||||
'value': 'baz'
|
'value': 'baz'
|
||||||
},
|
},
|
||||||
|
"web/foo/baz": {
|
||||||
|
'key': 'web/foo/baz',
|
||||||
|
'value': 'test'
|
||||||
|
},
|
||||||
"web/": [
|
"web/": [
|
||||||
"web/foo/"
|
"web/foo/"
|
||||||
],
|
],
|
||||||
"web/foo/": [
|
"web/foo/": [
|
||||||
"web/foo/bar"
|
"web/foo/bar",
|
||||||
|
"web/foo/baz"
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue