mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Add a badge summarizing number of issues per category
This commit is contained in:
parent
473a64f33c
commit
142facec09
2 changed files with 10 additions and 2 deletions
|
@ -16,6 +16,8 @@
|
|||
{
|
||||
// Convert timestamp to datetime
|
||||
data.reports[i].time = new Date(data.reports[i].timestamp*1000);
|
||||
data.reports[i].warnings = 0;
|
||||
data.reports[i].errors = 0;
|
||||
for (var j = 0 ; j < data.reports[i].items.length ; j++)
|
||||
{
|
||||
var type_ = data.reports[i].items[j].status;
|
||||
|
@ -29,16 +31,19 @@
|
|||
else if (type_ == "warning") {
|
||||
icon = "warning";
|
||||
issue = true;
|
||||
data.reports[i].warnings++;
|
||||
}
|
||||
else if (type_ == "error") {
|
||||
type_ = "danger";
|
||||
icon = "times";
|
||||
issue = true;
|
||||
data.reports[i].errors++;
|
||||
}
|
||||
data.reports[i].items[j].status = type_;
|
||||
data.reports[i].items[j].icon = icon;
|
||||
data.reports[i].items[j].issue = issue;
|
||||
};
|
||||
data.reports[i].noIssues = data.reports[i].warnings + data.reports[i].errors ? false : true;
|
||||
};
|
||||
c.view('diagnosis/diagnosis_show', data, function() {
|
||||
$(".rerun-diagnosis").click(function() {
|
||||
|
|
|
@ -8,8 +8,11 @@
|
|||
{{#reports}}
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">
|
||||
<h2 class="panel-title" style="display: inline-block">{{ description }}</h2>
|
||||
<a role="button" category="{{ id }}" class="btn btn-sm btn-info pull-right rerun-diagnosis"><span class="fa-fw fa-refresh"></span> {{t 'rerun_diagnosis'}}</a>
|
||||
<h2 class="panel-title" style="display: inline-block; margin-right: 10px;">{{ description }}</h2>
|
||||
{{#if noIssues}}<span class="label label-success">Everything good!</span>{{/if}}
|
||||
{{#if errors}}<span class="label label-danger">{{ errors }} errors</span>{{/if}}
|
||||
{{#if warnings}}<span class="label label-warning">{{ warnings }} warnings</span>{{/if}}
|
||||
<a role="button" category="{{ id }}" class="btn btn-sm btn-info pull-right rerun-diagnosis"><span class="fa-fw fa-refresh"></span> {{t 'rerun_diagnosis'}}</a>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<ul class="list-group">
|
||||
|
|
Loading…
Reference in a new issue