mirror of
https://github.com/unraid/webgui.git
synced 2026-01-25 02:58:58 -06:00
292 lines
15 KiB
Plaintext
292 lines
15 KiB
Plaintext
Menu="UserPreferences"
|
|
Type="xmenu"
|
|
Title="Notification Settings"
|
|
Icon="notifications.png"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2015, Lime Technology
|
|
* Copyright 2015, Bergware International.
|
|
* Copyright 2012, Andrew Hamer-Adams, http://www.pixeleyes.co.nz.
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License version 2,
|
|
* as published by the Free Software Foundation.
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*/
|
|
?>
|
|
|
|
<?
|
|
$events = explode('|', $notify['events']);
|
|
$disabled = $notify['system'] ? '' : 'disabled';
|
|
?>
|
|
<link type="text/css" rel="stylesheet" href="/webGui/styles/jquery.switchbutton.css">
|
|
<style>
|
|
.advanced{display:none;}
|
|
.switch-button-label.off{color:inherit;}
|
|
</style>
|
|
<script src="/webGui/javascript/jquery.switchbutton.js"></script>
|
|
|
|
<script>
|
|
var this_tab = $('input[name$="tabs"]').length;
|
|
|
|
function prepareNotify(form) {
|
|
var events = [];
|
|
form.entity.value = form.normal1.checked | form.warning1.checked | form.alert1.checked;
|
|
form.normal.value = form.normal1.checked*1 + form.normal2.checked*2 + form.normal3.checked*4;
|
|
form.warning.value = form.warning1.checked*1 + form.warning2.checked*2 + form.warning3.checked*4;
|
|
form.alert.value = form.alert1.checked*1 + form.alert2.checked*2 + form.alert3.checked*4;
|
|
form.plugin.value = form.plugin1.checked*1 + form.plugin2.checked*2 + form.plugin3.checked*4;
|
|
form.docker_notify.value = form.docker_notify1.checked*1 + form.docker_notify2.checked*2 + form.docker_notify3.checked*4;
|
|
form.report.value = form.report1.checked*1 + form.report2.checked*2 + form.report3.checked*4;
|
|
form.normal1.disabled = true;
|
|
form.normal2.disabled = true;
|
|
form.normal3.disabled = true;
|
|
form.warning1.disabled = true;
|
|
form.warning2.disabled = true;
|
|
form.warning3.disabled = true;
|
|
form.alert1.disabled = true;
|
|
form.alert2.disabled = true;
|
|
form.alert3.disabled = true;
|
|
form.plugin1.disabled = true;
|
|
form.plugin2.disabled = true;
|
|
form.plugin3.disabled = true;
|
|
form.docker_notify1.disabled = true;
|
|
form.docker_notify2.disabled = true;
|
|
form.docker_notify3.disabled = true;
|
|
form.report1.disabled = true;
|
|
form.report2.disabled = true;
|
|
form.report3.disabled = true;
|
|
for (var i=1; i<=5; i++) {
|
|
if (form.elements['a'+i].checked) events.push(form.elements['a'+i].value);
|
|
form.elements['a'+i].disabled = true;
|
|
}
|
|
if (form.custom.value>0) events.push(form.custom.value);
|
|
form.events.value = events.join('|');
|
|
}
|
|
function prepareCheckbox(index) {
|
|
if (index==0) $('.checkbox').attr('disabled','disabled'); else $('.checkbox').removeAttr('disabled');
|
|
}
|
|
function prepareTitle() {
|
|
var title = 'Available notifications:';
|
|
$('#pluginTitle,#dockerTitle,#reportTitle').html(' ');
|
|
if ($('.plugin').is(':visible')) { $('#pluginTitle').html(title); return; }
|
|
if ($('.docker').is(':visible')) { $('#dockerTitle').html(title); return; }
|
|
if ($('.report').is(':visible')) { $('#reportTitle').html(title); return; }
|
|
}
|
|
function preparePlugin(value) {
|
|
if (value=='') $('.plugin').hide(); else $('.plugin').show();
|
|
prepareTitle();
|
|
}
|
|
function prepareDocker(value) {
|
|
if (value=='') $('.docker').hide(); else $('.docker').show();
|
|
prepareTitle();
|
|
}
|
|
function prepareReport(value) {
|
|
if (value=='') $('.report').hide(); else $('.report').show();
|
|
prepareTitle();
|
|
}
|
|
$(function(){
|
|
var last = $('input[name$="tabs"]').length;
|
|
var elementId = "basicAdvanced";
|
|
$('.tabs').append($('<span id="'+elementId+'" class="status" style="margin-top: 2px;display: none;"><input type="checkbox" class="advancedview"></span>'));
|
|
<?if ($tabbed):?>
|
|
if ($('#tab'+this_tab).is(':checked')) $('#'+elementId).show();
|
|
$('#tab'+this_tab).bind({click:function(){$('#'+elementId).show();}});
|
|
for (var x=1; x<=last; x++) if(x != this_tab) $('#tab'+x).bind({click:function(){$('#'+elementId).hide();}});
|
|
<?else:?>
|
|
$('#'+elementId).show();
|
|
<?endif;?>
|
|
if ($.cookie('notifcations_view_mode') == 'advanced') $('.advanced').show();
|
|
$('.advancedview').switchButton({
|
|
labels_placement: "left",
|
|
on_label: 'Advanced View',
|
|
off_label: 'Basic View',
|
|
checked: $.cookie('notifcations_view_mode') == 'advanced'
|
|
});
|
|
$('.advancedview').change(function() {
|
|
$('.advanced').finish().toggle('fast');
|
|
$.cookie('notifcations_view_mode', $(this).is(':checked') ? 'advanced' : 'basic', {expires:3650});
|
|
});
|
|
preparePlugin(document.notify_settings.version.value);
|
|
prepareDocker(document.notify_settings.docker_update.value);
|
|
prepareReport(document.notify_settings.status.value);
|
|
});
|
|
</script>
|
|
<form markdown="1" name="notify_settings" method="POST" action="/update.php" target="progressFrame" onsubmit="prepareNotify(this)">
|
|
<input type="hidden" name="#file" value="dynamix/dynamix.cfg">
|
|
<input type="hidden" name="#section" value="notify">
|
|
<input type="hidden" name="#command" value="/webGui/scripts/notify">
|
|
<input type="hidden" name="#arg[1]" value="cron-init">
|
|
<input type="hidden" name="entity">
|
|
<input type="hidden" name="normal">
|
|
<input type="hidden" name="warning">
|
|
<input type="hidden" name="alert">
|
|
<input type="hidden" name="plugin">
|
|
<input type="hidden" name="docker_notify">
|
|
<input type="hidden" name="report">
|
|
<input type="hidden" name="events">
|
|
Date format:
|
|
: <select name="date" size="1">
|
|
<?=mk_option($notify['date'], "d-m-Y", "DD-MM-YYYY")?>
|
|
<?=mk_option($notify['date'], "m-d-Y", "MM-DD-YYYY")?>
|
|
<?=mk_option($notify['date'], "Y-m-d", "YYYY-MM-DD")?>
|
|
</select>
|
|
|
|
> Select the desired date format which is used in the notifications archive. Recommended is YYYY-MM-DD, which makes the date/time column sortable in a sensible way.
|
|
|
|
Time format:
|
|
: <select name="time" size="1">
|
|
<?=mk_option($notify['time'], "h:i A", "12 hours")?>
|
|
<?=mk_option($notify['time'], "H:i", "24 hours")?>
|
|
</select>
|
|
|
|
> Select the desired time format which is used in the notifications archive. Recommended is 24 hours, which makes the date/time column sortable in a sensible way.
|
|
|
|
Display position:
|
|
: <select name="position" size="1">
|
|
<?=mk_option($notify['position'], "top-left", "top-left")?>
|
|
<?=mk_option($notify['position'], "top-right", "top-right")?>
|
|
<?=mk_option($notify['position'], "bottom-left", "bottom-left")?>
|
|
<?=mk_option($notify['position'], "bottom-right", "bottom-right")?>
|
|
<?=mk_option($notify['position'], "center", "center")?>
|
|
</select>
|
|
|
|
> Choose the position of where notifications appear on screen. Multiple notifications are stacked, bottom-to-top or top-to-bottom depending on the selected placement.
|
|
|
|
Store notifications to flash:
|
|
: <select name="path" size="1">
|
|
<?=mk_option($notify['path'], "/tmp/notifications", "No")?>
|
|
<?=mk_option($notify['path'], "/boot/config/plugins/dynamix/notifications", "Yes")?>
|
|
</select>
|
|
|
|
> By default notifications are stored on RAM disk, which will get lost upon system reboot.
|
|
> Notifications may be stored permanently on the flash drive under folder '/boot/config/plugins/dynamix' instead.
|
|
|
|
System notifications:
|
|
: <select name="system" size="1" onchange="prepareCheckbox(this.selectedIndex)">
|
|
<?=mk_option($notify['system'], "", "Disabled")?>
|
|
<?=mk_option($notify['system'], "*/1 * * * *", "Enabled")?>
|
|
</select>
|
|
|
|
> By default the notifications system is disabled. Enable it here to start receiving notifications.
|
|
> The following sections give more options about which and what type of notifications will be sent.
|
|
|
|
Plugins version notification:
|
|
: <select name="version" size="1" onchange="preparePlugin(this.value)">
|
|
<?=mk_option($notify['version'], "", "Never check")?>
|
|
<?=mk_option($notify['version'], "10 */6 * * *", "Check four times a day")?>
|
|
<?=mk_option($notify['version'], "10 0,12 * * *", "Check twice a day")?>
|
|
<?=mk_option($notify['version'], "10 0 * * *", "Check once a day")?>
|
|
<?=mk_option($notify['version'], "10 0 * * 1", "Check once a week")?>
|
|
<?=mk_option($notify['version'], "10 0 1 * *", "Check once a month")?>
|
|
</select>
|
|
|
|
> Start a periodic verification and notify the user when a new version of one or more of the installed plugins is detected.
|
|
> Use the checkboxes below to select how notifications need to be given; by browser, by email and/or by custom agent.
|
|
|
|
Docker update notification:
|
|
: <select name="docker_update" size="1" onchange="prepareDocker(this.value)">
|
|
<?=mk_option($notify['docker_update'], "", "Never check")?>
|
|
<?=mk_option($notify['docker_update'], "10 */6 * * *", "Check four times a day")?>
|
|
<?=mk_option($notify['docker_update'], "10 0,12 * * *", "Check twice a day")?>
|
|
<?=mk_option($notify['docker_update'], "10 0 * * *", "Check once a day")?>
|
|
<?=mk_option($notify['docker_update'], "10 0 * * 1", "Check once a week")?>
|
|
<?=mk_option($notify['docker_update'], "10 0 1 * *", "Check once a month")?>
|
|
</select>
|
|
|
|
> Start a periodic verification and notify the user when a new version of one or more of the installed dockers is detected.
|
|
> Use the checkboxes below to select how notifications need to be given; by browser, by email and/or by custom agent.
|
|
|
|
Array status notification:
|
|
: <select name="status" size="1" onchange="prepareReport(this.value)">
|
|
<?=mk_option($notify['status'], "", "Never send")?>
|
|
<?=mk_option($notify['status'], "20 * * * *", "Send every hour")?>
|
|
<?=mk_option($notify['status'], "20 */2 * * *", "Send every two hours")?>
|
|
<?=mk_option($notify['status'], "20 */6 * * *", "Send four times a day")?>
|
|
<?=mk_option($notify['status'], "20 */8 * * *", "Send three times a day")?>
|
|
<?=mk_option($notify['status'], "20 0,12 * * *", "Send twice a day")?>
|
|
<?=mk_option($notify['status'], "20 0 * * *", "Send once a day")?>
|
|
<?=mk_option($notify['status'], "20 0 * * 1", "Send once a week")?>
|
|
<?=mk_option($notify['status'], "20 0 1 * *", "Send once a month")?>
|
|
</select>
|
|
|
|
> Start a periodic array health check (preventive maintenance) and notify the user the result of this check.
|
|
|
|
<span id="pluginTitle" class="plugin" style="display:none"> </span>
|
|
: <span class="plugin" style="display:none"><span style="display:inline-block;width:90px;font-style:italic">Plugins version</span>
|
|
<input type="checkbox" name="plugin1"<?=($notify['plugin'] & 1)==1 ? ' checked' : ''?>>Browser
|
|
<input type="checkbox" name="plugin2"<?=($notify['plugin'] & 2)==2 ? ' checked' : ''?>>Email
|
|
<input type="checkbox" name="plugin3"<?=($notify['plugin'] & 4)==4 ? ' checked' : ''?>>Agents </span>
|
|
|
|
<span id="dockerTitle" class="docker" style="display:none"> </span>
|
|
: <span class="docker" style="display:none"><span style="display:inline-block;width:90px;font-style:italic">Docker update</span>
|
|
<input type="checkbox" name="docker_notify1"<?=($notify['docker_notify'] & 1)==1 ? ' checked' : ''?>>Browser
|
|
<input type="checkbox" name="docker_notify2"<?=($notify['docker_notify'] & 2)==2 ? ' checked' : ''?>>Email
|
|
<input type="checkbox" name="docker_notify3"<?=($notify['docker_notify'] & 4)==4 ? ' checked' : ''?>>Agents </span>
|
|
|
|
<span id="reportTitle" class="report" style="display:none"> </span>
|
|
: <span class="report" style="display:none"><span style="display:inline-block;width:90px;font-style:italic">Array status</span>
|
|
<input type="checkbox" name="report1"<?=($notify['report'] & 1)==1 ? ' checked' : ''?>>Browser
|
|
<input type="checkbox" name="report2"<?=($notify['report'] & 2)==2 ? ' checked' : ''?>>Email
|
|
<input type="checkbox" name="report3"<?=($notify['report'] & 4)==4 ? ' checked' : ''?>>Agents </span>
|
|
|
|
> Use the checkboxes above to select what and how notifications need to be given; by browser, by email and/or by a service.
|
|
> <br><b>Tip:</b> you can use custom notification agents; just add them to "/boot/config/plugins/dynamix/notification/agents" directory and check 'Agents'.
|
|
|
|
Notification entity:
|
|
: <span style="display:inline-block;width:90px;font-style:italic">Notices</span>
|
|
<input type="checkbox" class="checkbox" name="normal1"<?=($notify['normal'] & 1)==1 ? " checked $disabled" : $disabled?>>Browser
|
|
<input type="checkbox" class="checkbox" name="normal2"<?=($notify['normal'] & 2)==2 ? " checked $disabled" : $disabled?>>Email
|
|
<input type="checkbox" class="checkbox" name="normal3"<?=($notify['normal'] & 4)==4 ? " checked $disabled" : $disabled?>>Agents
|
|
|
|
|
|
: <span style="display:inline-block;width:90px;font-style:italic">Warnings</span>
|
|
<input type="checkbox" class="checkbox" name="warning1"<?=($notify['warning'] & 1)==1 ? " checked $disabled" : $disabled?>>Browser
|
|
<input type="checkbox" class="checkbox" name="warning2"<?=($notify['warning'] & 2)==2 ? " checked $disabled" : $disabled?>>Email
|
|
<input type="checkbox" class="checkbox" name="warning3"<?=($notify['warning'] & 4)==4 ? " checked $disabled" : $disabled?>>Agents
|
|
|
|
|
|
: <span style="display:inline-block;width:90px;font-style:italic">Alerts</span>
|
|
<input type="checkbox" class="checkbox" name="alert1"<?=($notify['alert'] & 1)==1 ? " checked $disabled" : $disabled?>>Browser
|
|
<input type="checkbox" class="checkbox" name="alert2"<?=($notify['alert'] & 2)==2 ? " checked $disabled" : $disabled?>>Email
|
|
<input type="checkbox" class="checkbox" name="alert3"<?=($notify['alert'] & 4)==4 ? " checked $disabled" : $disabled?>>Agents
|
|
|
|
> Notifications are classified as:
|
|
>
|
|
> *notice* - these are informative notifications and do not indicate a problem situation, e.g. a new version is available<br>
|
|
> *warning* - these are attentive notifications and may indicate future problems, e.g. a hard disk is hotter than usual<br>
|
|
> *alert* - these are serious notifications and require immediate attention, e.g. a failing hard disk<br>
|
|
>
|
|
> Choose for each classification how you want to be notified.
|
|
|
|
<div class="advanced" markdown="1">
|
|
SMART attribute notifications:
|
|
: <input type="checkbox" name="a1" value="5"<?=in_array(5,$events) ? ' checked' : ''?>><span style="display:inline-block;width:72px">5</span>Reallocated sectors count
|
|
|
|
|
|
: <input type="checkbox" name="a2" value="187"<?=in_array(187,$events) ? ' checked' : ''?>><span style="display:inline-block;width:72px">187</span>Reported uncorrectable errors
|
|
|
|
|
|
: <input type="checkbox" name="a3" value="188"<?=in_array(188,$events) ? ' checked' : ''?>><span style="display:inline-block;width:72px">188</span>Command timeout
|
|
|
|
|
|
: <input type="checkbox" name="a4" value="197"<?=in_array(197,$events) ? ' checked' : ''?>><span style="display:inline-block;width:72px">197</span>Current pending sector count
|
|
|
|
|
|
: <input type="checkbox" name="a5" value="198"<?=in_array(198,$events) ? ' checked' : ''?>><span style="display:inline-block;width:72px">198</span>Uncorrectable sector count
|
|
|
|
|
|
: <input type="text" name="custom" value="<?=$notify['custom']?>" maxlength="3" style="width:25px;margin-right:57px">Custom attribute number</dd>
|
|
</div>
|
|
|
|
<div class="advanced" markdown="1">
|
|
> The user can enable or disable notifications for the given SMART attributes. It is recommended to keep the default, which is ALL selected attributes, but when certain attributes are not present on your hard disk, these may be excluded.
|
|
> In addition a custom SMART attribute number can be given to generate notifications. Be careful in the selection, this may cause an avalance of notifcations if an inappropriate SMART attribute is chosen.
|
|
</div>
|
|
|
|
<input type="submit" name="#default" value="Default">
|
|
: <input type="submit" name="#apply" value="Apply"><input type="button" value="Done" onclick="done()"></td>
|
|
</form>
|