Handle ignored stuff display + add unignore button

This commit is contained in:
Alexandre Aubin 2019-10-13 18:47:10 +02:00
parent 0e80393ef4
commit c73f9cea1d
4 changed files with 25 additions and 2 deletions

View file

@ -849,3 +849,9 @@ input[type='radio'].nice-radio {
background-color: #d9edf7; background-color: #d9edf7;
border-color: #bce8f1; border-color: #bce8f1;
} }
.alert-ignored-yo {
background-color: ghostwhite;
border-color: lightgrey;
color: grey;
}

View file

@ -18,16 +18,26 @@
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].warnings = 0;
data.reports[i].errors = 0; data.reports[i].errors = 0;
data.reports[i].ignored = 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;
type_ = type_.toLowerCase(); type_ = type_.toLowerCase();
var ignored = data.reports[i].items[j].ignored;
var icon = ""; var icon = "";
var issue = false; var issue = false;
if (type_ == "success") { if (type_ == "success") {
icon = "check-circle"; icon = "check-circle";
} }
else if (ignored == true) {
icon = type_;
if (type_ == "error") {
icon = "times"
}
type_ = "ignored";
data.reports[i].ignored++;
}
else if (type_ == "warning") { else if (type_ == "warning") {
icon = "warning"; icon = "warning";
issue = true; issue = true;

View file

@ -181,6 +181,7 @@
"hostname": "Hostname", "hostname": "Hostname",
"id": "ID", "id": "ID",
"ignore": "Ignore", "ignore": "Ignore",
"ignored": "%s ignored",
"inactive": "Inactive", "inactive": "Inactive",
"infos": "Info", "infos": "Info",
"install": "Install", "install": "Install",
@ -362,6 +363,7 @@
"transmission": "Transmission", "transmission": "Transmission",
"udp": "UDP", "udp": "UDP",
"unauthorized": "Unauthorized", "unauthorized": "Unauthorized",
"unignore": "Unignore",
"uninstall": "Uninstall", "uninstall": "Uninstall",
"unknown_action": "Unknown action %s", "unknown_action": "Unknown action %s",
"unknown_argument": "Unknown argument: %s", "unknown_argument": "Unknown argument: %s",

View file

@ -20,9 +20,10 @@
{{#if noIssues}}<span class="label label-success">{{t 'everything_good'}}</span>{{/if}} {{#if noIssues}}<span class="label label-success">{{t 'everything_good'}}</span>{{/if}}
{{#if errors}}<span class="label label-danger">{{t 'errors' errors }}</span>{{/if}} {{#if errors}}<span class="label label-danger">{{t 'errors' errors }}</span>{{/if}}
{{#if warnings}}<span class="label label-warning">{{t 'warnings' warnings }}</span>{{/if}} {{#if warnings}}<span class="label label-warning">{{t 'warnings' warnings }}</span>{{/if}}
{{#if ignored}}<span class="label label-default">{{t 'ignored' ignored }}</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 collapse {{#unless noIssues}}in{{/unless}}" id="category-{{id}}"> <div class="panel-body collapse {{#if errors}}in{{/if}}" id="category-{{id}}">
<ul class="list-group" style="margin-bottom: 0px"> <ul class="list-group" style="margin-bottom: 0px">
<p>{{t 'last_ran' }} {{formatRelative time day="numeric" month="long" year="numeric" hour="numeric" minute="numeric" }}</p> <p>{{t 'last_ran' }} {{formatRelative time day="numeric" month="long" year="numeric" hour="numeric" minute="numeric" }}</p>
{{#items}} {{#items}}
@ -31,8 +32,12 @@
<span class="fa-fw fa-{{icon}}"></span> <span class="fa-fw fa-{{icon}}"></span>
{{/if}} {{/if}}
{{summary}} {{summary}}
{{#if ignored}}
<a href="#" role="button" class="btn btn-sm btn-default pull-right"><span class="fa-fw fa-bell"></span> {{t 'unignore'}}</a>
{{else}}
{{#if issue}} {{#if issue}}
<a href="#" role="button" class="btn btn-sm btn-warning pull-right"><span class="fa-fw fa-times"></span> {{t 'ignore'}}</a> <a href="#" role="button" class="btn btn-sm btn-warning pull-right"><span class="fa-fw fa-bell-slash"></span> {{t 'ignore'}}</a>
{{/if}}
{{/if}} {{/if}}
{{#if details}} {{#if details}}
<a role="button" class="btn btn-sm btn-default pull-right" data-toggle="collapse" href="#details-{{../id}}-{{@index}}" aria-expanded="false" aria-controls="details-{{../id}}-{{@index}}"><span class="fa-fw fa-level-down"></span>{{t 'details'}}</a> <a role="button" class="btn btn-sm btn-default pull-right" data-toggle="collapse" href="#details-{{../id}}-{{@index}}" aria-expanded="false" aria-controls="details-{{../id}}-{{@index}}"><span class="fa-fw fa-level-down"></span>{{t 'details'}}</a>