[enh] Adapt log view to the new api, and add paste option

This commit is contained in:
ljf 2018-06-02 13:44:40 +02:00
parent 663cbe84d3
commit a10c6ff33a
2 changed files with 20 additions and 10 deletions

View file

@ -98,8 +98,18 @@
// Display journals list // Display journals list
app.get('#/tools/logs', function (c) { app.get('#/tools/logs', function (c) {
c.api("/logs", function(categories) { c.api("/logs", function(categories) {
data = [];
for (var category in categories) {
if (categories.hasOwnProperty(category)) {
data.push({
key:category,
value:categories[category]
});
}
}
c.view('tools/tools_logs', { c.view('tools/tools_logs', {
"data": categories, "data": data,
formatDate: function() { formatDate: function() {
return this.started_at.getDate(); return this.started_at.getDate();
} }

View file

@ -7,22 +7,22 @@
<div class="separator"></div> <div class="separator"></div>
{{#if data}} {{#if data}}
{{#data}}
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
{{#data}}
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading" role="tab" id="heading-uo"> <div class="panel-heading" role="tab" id="heading-{{key}}">
<h2 class="panel-title"> <h2 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-uo" aria-expanded="true" aria-controls="collapse-uo"> <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapse-{{key}}" aria-expanded="true" aria-controls="collapse-{{key}}">
<span class="fa-fw fa-info-circle"></span>{{t 'unit_operation'}} <span class="fa-fw fa-info-circle"></span>{{t key}}
</a> </a>
</h2> </h2>
</div> </div>
<div id="collapse-uo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-uo"> <div id="collapse-{{key}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="heading-{{key}}">
<div class="list-group">{{#operations}} <div class="list-group">{{#value}}
<a href="#/tools/logs/{{ name }}" class="list-group-item"><small>{{ started_at }}</small> {{ name }}</a> <a href="#/tools/logs/{{ name }}" class="list-group-item"><small>{{ started_at }}</small> {{ description }}</a>
{{/operations}}</div> {{/value}}</div>
</div> </div>
</div> </div>
</div>
{{/data}} {{/data}}
</div>
{{/if}} {{/if}}