mirror of
https://github.com/unraid/webgui.git
synced 2026-04-23 02:31:45 -05:00
Merge pull request #590 from Squidly271/reboot
Preserve Reboot Required Notifications Across Pages
This commit is contained in:
@@ -3,8 +3,8 @@ Title="CPU Isolation"
|
||||
Tag="icon-cpu"
|
||||
---
|
||||
<?PHP
|
||||
/* Copyright 2005-2018, Lime Technology
|
||||
* Copyright 2012-2018, Bergware International.
|
||||
/* Copyright 2005-2020, Lime Technology
|
||||
* Copyright 2012-2020, Bergware International.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version 2,
|
||||
@@ -23,7 +23,6 @@ Tag="icon-cpu"
|
||||
<input type="button" value="Apply" onclick="apply(this.form)" disabled><input type="button" value="Done" onclick="done()"><span id="wait-is" class="red-text" style="display:none"><i class="fa fa-spinner fa-spin"></i> Please wait...</span>
|
||||
</form>
|
||||
<?if (!$safemode):?>
|
||||
<div class="notice isol" style="display:none">System must be rebooted for changes to take effect!</div>
|
||||
<?else:?>
|
||||
<div class="notice">CPU isolation is prohibited while system is running in SAFE MODE!</div>
|
||||
<?endif;?>
|
||||
|
||||
@@ -152,8 +152,10 @@ function is() {
|
||||
}
|
||||
function notice() {
|
||||
// notice to reboot system after changes
|
||||
var message = "CPU Isolation: A reboot is required to apply changes";
|
||||
|
||||
$.post('/webGui/include/CPUset.php',{id:'cmd'},function(d){
|
||||
if (d==1) $('div.notice.isol').show(); else $('div.notice.isol').hide();
|
||||
if (d==1) addRebootNotice(message); else removeRebootNotice(message);
|
||||
});
|
||||
}
|
||||
function reset(form) {
|
||||
|
||||
@@ -225,9 +225,12 @@ function addBannerWarning(text,warning=true,noDismiss=false) {
|
||||
var cookieText = text.replace(/[^a-z0-9]/gi,'');
|
||||
if ($.cookie(cookieText) == "true") return false;
|
||||
if (warning) text = "<i class='fa fa-warning' style='float:initial;'></i> "+text;
|
||||
var arrayEntry = bannerWarnings.push("placeholder") - 1;
|
||||
if (!noDismiss) text = text + "<a class='bannerDismiss' onclick='dismissBannerWarning("+arrayEntry+",""+cookieText+"")'></a>";
|
||||
bannerWarnings[arrayEntry] = text;
|
||||
if ( bannerWarnings.indexOf(text) < 0 ) {
|
||||
var arrayEntry = bannerWarnings.push("placeholder") - 1;
|
||||
bannerWarnings[arrayEntry] = text;
|
||||
} else return bannerWarnings.indexOf(text);
|
||||
|
||||
if (!bannerWarningInterval) {
|
||||
showBannerWarnings();
|
||||
bannerWarningInterval = setInterval(showBannerWarnings,10000);
|
||||
@@ -266,6 +269,20 @@ function showBannerWarnings() {
|
||||
currentBannerWarning++;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
removeBannerWarning(bannerIndex);
|
||||
$.post("/plugins/dynamix.plugin.manager/scripts/PluginAPI.php",{action:'removeRebootNotice',message:message});
|
||||
}
|
||||
|
||||
function showUpgrade(text,noDismiss=false) {
|
||||
if ($.cookie('os_upgrade')==null) {
|
||||
if (osUpgradeWarning) removeBannerWarning(osUpgradeWarning);
|
||||
@@ -378,6 +395,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