From c73f9cea1d6f304fd222cfb669cf89cd2d875f0f Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 13 Oct 2019 18:47:10 +0200 Subject: [PATCH] Handle ignored stuff display + add unignore button --- src/css/style.less | 6 ++++++ src/js/yunohost/controllers/diagnosis.js | 10 ++++++++++ src/locales/en.json | 2 ++ src/views/diagnosis/diagnosis_show.ms | 9 +++++++-- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/css/style.less b/src/css/style.less index e2d846d8..520d2ee5 100644 --- a/src/css/style.less +++ b/src/css/style.less @@ -849,3 +849,9 @@ input[type='radio'].nice-radio { background-color: #d9edf7; border-color: #bce8f1; } + +.alert-ignored-yo { + background-color: ghostwhite; + border-color: lightgrey; + color: grey; +} diff --git a/src/js/yunohost/controllers/diagnosis.js b/src/js/yunohost/controllers/diagnosis.js index 94203674..adecaa97 100644 --- a/src/js/yunohost/controllers/diagnosis.js +++ b/src/js/yunohost/controllers/diagnosis.js @@ -18,16 +18,26 @@ data.reports[i].time = new Date(data.reports[i].timestamp*1000); data.reports[i].warnings = 0; data.reports[i].errors = 0; + data.reports[i].ignored = 0; for (var j = 0 ; j < data.reports[i].items.length ; j++) { var type_ = data.reports[i].items[j].status; type_ = type_.toLowerCase(); + var ignored = data.reports[i].items[j].ignored; var icon = ""; var issue = false; if (type_ == "success") { icon = "check-circle"; } + else if (ignored == true) { + icon = type_; + if (type_ == "error") { + icon = "times" + } + type_ = "ignored"; + data.reports[i].ignored++; + } else if (type_ == "warning") { icon = "warning"; issue = true; diff --git a/src/locales/en.json b/src/locales/en.json index 11accfb9..7f4d3fbb 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -181,6 +181,7 @@ "hostname": "Hostname", "id": "ID", "ignore": "Ignore", + "ignored": "%s ignored", "inactive": "Inactive", "infos": "Info", "install": "Install", @@ -362,6 +363,7 @@ "transmission": "Transmission", "udp": "UDP", "unauthorized": "Unauthorized", + "unignore": "Unignore", "uninstall": "Uninstall", "unknown_action": "Unknown action %s", "unknown_argument": "Unknown argument: %s", diff --git a/src/views/diagnosis/diagnosis_show.ms b/src/views/diagnosis/diagnosis_show.ms index 8cb707b2..aece8b5c 100644 --- a/src/views/diagnosis/diagnosis_show.ms +++ b/src/views/diagnosis/diagnosis_show.ms @@ -20,9 +20,10 @@ {{#if noIssues}}{{t 'everything_good'}}{{/if}} {{#if errors}}{{t 'errors' errors }}{{/if}} {{#if warnings}}{{t 'warnings' warnings }}{{/if}} + {{#if ignored}}{{t 'ignored' ignored }}{{/if}} {{t 'rerun_diagnosis'}} -
+

    {{t 'last_ran' }} {{formatRelative time day="numeric" month="long" year="numeric" hour="numeric" minute="numeric" }}

    {{#items}} @@ -31,8 +32,12 @@ {{/if}} {{summary}} + {{#if ignored}} + {{t 'unignore'}} + {{else}} {{#if issue}} - {{t 'ignore'}} + {{t 'ignore'}} + {{/if}} {{/if}} {{#if details}}