mirror of
https://github.com/YunoHost/yunohost-admin.git
synced 2024-09-03 20:06:15 +02:00
Implement ignore/unignore buttons
This commit is contained in:
parent
c73f9cea1d
commit
08adb4f9f3
3 changed files with 42 additions and 12 deletions
|
@ -7,10 +7,8 @@
|
|||
// Diagnosis
|
||||
// *********
|
||||
|
||||
// Server monitoring
|
||||
app.get('#/diagnosis', function (c) {
|
||||
|
||||
// Why this method ?
|
||||
c.api('/diagnosis/show?full', function(data) {
|
||||
for (var i = 0 ; i < data.reports.length ; i++)
|
||||
{
|
||||
|
@ -52,6 +50,12 @@
|
|||
data.reports[i].items[j].status = type_;
|
||||
data.reports[i].items[j].icon = icon;
|
||||
data.reports[i].items[j].issue = issue;
|
||||
// We want filter_args to be something like "dnsrecords,domain=yolo.test,category=xmpp"
|
||||
data.reports[i].items[j].filter_args = data.reports[i].id;
|
||||
for (prop in data.reports[i].items[j].meta) {
|
||||
console.log(prop)
|
||||
data.reports[i].items[j].filter_args = data.reports[i].items[j].filter_args + ","+prop+"="+data.reports[i].items[j].meta[prop];
|
||||
}
|
||||
};
|
||||
data.reports[i].noIssues = data.reports[i].warnings + data.reports[i].errors ? false : true;
|
||||
};
|
||||
|
@ -59,14 +63,7 @@
|
|||
$(".rerun-diagnosis").click(function() {
|
||||
var category = $(this).attr("category");
|
||||
c.api('/diagnosis/run?force', function(data) {
|
||||
// This is a copy-pasta of some of the
|
||||
// redirect/refresh code of sammy.js
|
||||
// because for some reason calling the function did not work >.>
|
||||
var to = "#/diagnosis";
|
||||
c.trigger('redirect', {to: to});
|
||||
c.app.last_location = c.path;
|
||||
c.app.setLocation(to);
|
||||
c.app.trigger('location-changed');
|
||||
c.force_redirect("#/diagnosis");
|
||||
}, 'POST', {"categories": [category]});
|
||||
});
|
||||
});
|
||||
|
@ -74,4 +71,25 @@
|
|||
|
||||
});
|
||||
|
||||
diagnosis_add_ignore_filter = function(filter_args) {
|
||||
c.api('/diagnosis/ignore', function(data) {
|
||||
store.clear('slide');
|
||||
c.force_redirect("#/diagnosis");
|
||||
},
|
||||
'POST',
|
||||
{'add_filter': filter_args.split(',') }
|
||||
);
|
||||
};
|
||||
|
||||
diagnosis_remove_ignore_filter = function(filter_args) {
|
||||
c.api('/diagnosis/ignore', function(data) {
|
||||
store.clear('slide');
|
||||
c.force_redirect("#/diagnosis");
|
||||
},
|
||||
'POST',
|
||||
{'remove_filter': filter_args.split(',') }
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
})();
|
||||
|
|
|
@ -480,6 +480,18 @@
|
|||
$('div.loader').remove();
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
force_redirect: function(to) {
|
||||
c = this;
|
||||
// This is a copy-pasta of some of the redirect/refresh code of
|
||||
// sammy.js because for some reason calling the origina
|
||||
// redirect/refresh function in some context does not work >.>
|
||||
// (e.g. if you're already on the page)
|
||||
c.trigger('redirect', {to: to});
|
||||
c.app.last_location = c.path;
|
||||
c.app.setLocation(to);
|
||||
c.app.trigger('location-changed');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -33,10 +33,10 @@
|
|||
{{/if}}
|
||||
{{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>
|
||||
<a href="javascript:void(null);" onclick="diagnosis_remove_ignore_filter('{{ filter_args }}');" role="button" class="btn btn-sm btn-default pull-right"><span class="fa-fw fa-bell"></span> {{t 'unignore'}}</a>
|
||||
{{else}}
|
||||
{{#if issue}}
|
||||
<a href="#" role="button" class="btn btn-sm btn-warning pull-right"><span class="fa-fw fa-bell-slash"></span> {{t 'ignore'}}</a>
|
||||
<a href="javascript:void(null);" onclick="diagnosis_add_ignore_filter('{{ filter_args }}');" role="button" class="btn btn-sm btn-warning pull-right"><span class="fa-fw fa-bell-slash"></span> {{t 'ignore'}}</a>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#if details}}
|
||||
|
|
Loading…
Add table
Reference in a new issue