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
|
// Convert timestamp to datetime
|
||||||
data.reports[i].time = new Date(data.reports[i].timestamp*1000);
|
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++)
|
for (var j = 0 ; j < data.reports[i].items.length ; j++)
|
||||||
{
|
{
|
||||||
var type_ = data.reports[i].items[j].status;
|
var type_ = data.reports[i].items[j].status;
|
||||||
|
@ -29,16 +31,19 @@
|
||||||
else if (type_ == "warning") {
|
else if (type_ == "warning") {
|
||||||
icon = "warning";
|
icon = "warning";
|
||||||
issue = true;
|
issue = true;
|
||||||
|
data.reports[i].warnings++;
|
||||||
}
|
}
|
||||||
else if (type_ == "error") {
|
else if (type_ == "error") {
|
||||||
type_ = "danger";
|
type_ = "danger";
|
||||||
icon = "times";
|
icon = "times";
|
||||||
issue = true;
|
issue = true;
|
||||||
|
data.reports[i].errors++;
|
||||||
}
|
}
|
||||||
data.reports[i].items[j].status = type_;
|
data.reports[i].items[j].status = type_;
|
||||||
data.reports[i].items[j].icon = icon;
|
data.reports[i].items[j].icon = icon;
|
||||||
data.reports[i].items[j].issue = issue;
|
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() {
|
c.view('diagnosis/diagnosis_show', data, function() {
|
||||||
$(".rerun-diagnosis").click(function() {
|
$(".rerun-diagnosis").click(function() {
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
{{#reports}}
|
{{#reports}}
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
<h2 class="panel-title" style="display: inline-block">{{ description }}</h2>
|
<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>
|
<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>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
|
|
Loading…
Reference in a new issue