Skip to content
Snippets Groups Projects
Commit b109cfc3 authored by Johannes Goslar's avatar Johannes Goslar Committed by Christian Kuhn
Browse files

[TASK] SystemInformationMenu: Automatically refresh counter badge

Automatically reload the SystemInformation every 5 minutes.

Resolves: #68920
Releases: master, 8.7
Change-Id: Ie21d345d6bcbbae30f0fd77f084c22b1b2a0f6f2
Reviewed-on: https://review.typo3.org/53001


Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: default avatarJohannes Goslar <jogo@kronberger-spiele.de>
Reviewed-by: default avatarSascha Egerer <sascha@sascha-egerer.de>
Tested-by: default avatarSascha Egerer <sascha@sascha-egerer.de>
Reviewed-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: default avatarChristian Kuhn <lolli@schwarzbu.ch>
parent 36335463
Branches
Tags
No related merge requests found
......@@ -45,6 +45,11 @@ define([
$(SystemInformationMenu.identifier.moduleLinks).on('click', SystemInformationMenu.openModule);
};
/**
* Timer for auto reloading the SystemInformation
*/
SystemInformationMenu.timer = null;
/**
* Updates the menu
*/
......@@ -53,9 +58,9 @@ define([
$existingIcon = $toolbarItemIcon.clone(),
$menuContainer = $(SystemInformationMenu.identifier.containerSelector).find(SystemInformationMenu.identifier.menuContainerSelector);
// hide the menu if it's active
if ($menuContainer.is(':visible')) {
$menuContainer.click();
if (SystemInformationMenu.timer !== null) {
clearTimeout(SystemInformationMenu.timer);
SystemInformationMenu.timer = null;
}
Icons.getIcon('spinner-circle-light', Icons.sizes.small).done(function(spinner) {
......@@ -64,6 +69,9 @@ define([
$.ajax({
url: TYPO3.settings.ajaxUrls['systeminformation_render'],
data: {
skipSessionUpdate: 1
},
type: 'post',
cache: false,
success: function(data) {
......@@ -73,6 +81,12 @@ define([
SystemInformationMenu.initialize();
}
}).done(function(){
// reload error data every five minutes
SystemInformationMenu.timer = setTimeout(
SystemInformationMenu.updateMenu,
1000 * 300
);
});
};
......@@ -86,10 +100,14 @@ define([
badgeClass = $container.data('severityclass');
$counter.text(count).toggle(parseInt(count) > 0);
$counter.removeClass();
// ensure all default classes are available and previous
// (at this time in processing unknown) class is removed
$counter.removeClass();
$counter.addClass('t3js-systeminformation-counter toolbar-item-badge badge');
// badgeClass e.g. could be 'badge-info', 'badge-danger', ...
if (badgeClass !== '') {
$counter.addClass('toolbar-item-badge badge ' + badgeClass);
$counter.addClass(badgeClass);
}
};
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment