mirror of
https://github.com/unraid/webgui.git
synced 2026-03-11 21:38:50 -05:00
Preserve reboot notices across pages
This commit is contained in:
@@ -283,6 +283,23 @@ function showUpgrade(data,noDismiss=false) {
|
||||
osUpgradeWarning = addBannerWarning(data.replace(/<a>(.*)<\/a>/,"<a href='#' onclick='hideUpgrade();openUpgrade();'>$1</a>"),false,noDismiss);
|
||||
}
|
||||
}
|
||||
|
||||
function addRebootNotice(message="You must reboot for changes to take effect") {
|
||||
addBannerWarning("<i class='fa fa-warning' style='float:initial;'></i> "+message,false,true);
|
||||
|
||||
$.post("/plugins/dynamix.plugin.manager/scripts/PluginAPI.php",{action:'addRebootNotice',message:message});
|
||||
}
|
||||
|
||||
function removeRebootNotice(message="You must reboot for changes to take effect") {
|
||||
var bannerIndex = bannerWarnings.indexOf("<i class='fa fa-warning' style='float:initial;'></i> "+message);
|
||||
if ( bannerIndex < 0 ) {
|
||||
return;
|
||||
}
|
||||
console.log(bannerIndex);
|
||||
removeBannerWarning(bannerIndex);
|
||||
$.post("/plugins/dynamix.plugin.manager/scripts/PluginAPI.php",{action:'removeRebootNotice',message:message});
|
||||
}
|
||||
|
||||
function hideUpgrade(set) {
|
||||
removeBannerWarning(osUpgradeWarning);
|
||||
if (set)
|
||||
@@ -388,6 +405,21 @@ $.ajaxPrefilter(function(s, orig, xhr){
|
||||
s.data += "csrf_token=<?=$var['csrf_token']?>";
|
||||
}
|
||||
});
|
||||
|
||||
// add any pre-existing reboot notices
|
||||
$(function() {
|
||||
<?
|
||||
$rebootNotice = @file("/tmp/reboot_notifications") ?: array();
|
||||
foreach ($rebootNotice as $notice):
|
||||
?>
|
||||
var rebootMessage = "<?=trim($notice)?>";
|
||||
if ( rebootMessage ) {
|
||||
addBannerWarning("<i class='fa fa-warning' style='float:initial;'></i> "+rebootMessage,false,true);
|
||||
}
|
||||
<?
|
||||
endforeach;
|
||||
?>
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
Reference in New Issue
Block a user