I have a Host
model that is, for the moment, pretty simple:
App.Host = DS.Model.extend
name: DS.attr 'string'
The data adapter is handle by ember-data, my route looks like this:
App.HostsRoute = Ember.Route.extend
init: ->
@_super()
@refresh()
model: ->
@store.find 'host',
problematic: 1
refresh: ->
setTimeout =>
@store.find('host', { problematic: 1 }).then (hosts) =>
@controller.set 'content', hosts
@refresh()
, 10000
My template will show a list of boxes to list and manage nagios alerts:
<h2>Hosts list</h2>
<div class="row">
<div class="col-md-8">
{{#each host in controller}}
<div class="box box-solid box-default collapsed-box">
<div class="box-header">
<h5 class="box-title">
<i class="fa fa-server"></i>
{{ host.name }}
</h5>
<div class="box-tools pull-right">
<button class="btn btn-default btn-sm" data-widget="collapse"><i class="fa fa-plus"></i></button>
</div>
</div>
<div class="box-body no-padding table-responsive" style="display: none">
{{#link-to 'host' host}}{{host.name}}{{/link-to}}
<table class="table table-hover">
<colgroup>
<col/>
<col style="width: 100%"/>
<col/>
<col/>
</colgroup>
<thead>
<tr>
<th>Service</th>
<th>Message</th>
<th>State</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
{{/each}}
</div>
<div class="col-md-4">
{{outlet}}
</div>
</div>
My boxes are collapsed by default and can be uncollapsed by a js trick.
In each refresh, boxes are again collapsed. In fact, all the html is rewritten.
If I try without the problematic: 1
query parameter (calls /hosts
instead of /hosts?problematic=1
) it's works like a charm without rewriting all the html. The boxes stay uncollapsed.
So the problem source seems to be the additional query param but I don't know why.
What is wrong? How can I solve it?
Thanks.
Aucun commentaire:
Enregistrer un commentaire