mirror of
https://github.com/unraid/webgui.git
synced 2026-01-13 21:20:01 -06:00
271 lines
14 KiB
Plaintext
271 lines
14 KiB
Plaintext
Menu="UserPreferences"
|
|
Type="xmenu"
|
|
Title="Notification Settings"
|
|
Icon="icon-notifications"
|
|
Tag="phone-square"
|
|
---
|
|
<?PHP
|
|
/* Copyright 2005-2018, Lime Technology
|
|
* Copyright 2012-2018, 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';
|
|
?>
|
|
<script>
|
|
function prepareNotify(form) {
|
|
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.unraid.value = form.unraid1.checked*1 + form.unraid2.checked*2 + form.unraid3.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.unraid1.disabled = true;
|
|
form.unraid2.disabled = true;
|
|
form.unraid3.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;
|
|
}
|
|
function prepareSystem(index) {
|
|
if (index==0) $('.checkbox').attr('disabled','disabled'); else $('.checkbox').removeAttr('disabled');
|
|
}
|
|
function prepareTitle() {
|
|
var title = 'Available notifications:';
|
|
$('#unraidTitle,#pluginTitle,#dockerTitle,#reportTitle').html(' ');
|
|
if ($('.unraid').is(':visible')) { $('#unraidTitle').html(title); return; }
|
|
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 prepareUnraid(value) {
|
|
if (value=='') $('.unraid').hide(); else $('.unraid').show();
|
|
prepareTitle();
|
|
}
|
|
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(){
|
|
prepareUnraid(document.notify_settings.unraidos.value);
|
|
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="unraid">
|
|
<input type="hidden" name="plugin">
|
|
<input type="hidden" name="docker_notify">
|
|
<input type="hidden" name="report">
|
|
Notifications display:
|
|
: <select name="display" size="1">
|
|
<?=mk_option($notify['display'], "0", "Detailed")?>
|
|
<?=mk_option($notify['display'], "1", "Summarized")?>
|
|
</select>
|
|
|
|
> In *Detailed* view all notifications will be displayed on screen as soon as they arrive.<br>
|
|
> Notifications can be acknowledged individually or all in once.
|
|
>
|
|
> In *Summarized* view notifications will be counted only and the number of unread notifications is shown in the menu header per category.<br>
|
|
> Click on the counters to either acknowledge or view the unread notifications.
|
|
|
|
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="prepareSystem(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.
|
|
|
|
Unraid OS update notification:
|
|
: <select name="unraidos" size="1" onchange="prepareUnraid(this.value)">
|
|
<?=mk_option($notify['unraidos'], "", "Never check")?>
|
|
<?=mk_option($notify['unraidos'], "11 */6 * * *", "Check four times a day")?>
|
|
<?=mk_option($notify['unraidos'], "11 0,12 * * *", "Check twice a day")?>
|
|
<?=mk_option($notify['unraidos'], "11 0 * * *", "Check once a day")?>
|
|
<?=mk_option($notify['unraidos'], "11 0 * * 1", "Check once a week")?>
|
|
<?=mk_option($notify['unraidos'], "11 0 1 * *", "Check once a month")?>
|
|
</select>
|
|
|
|
> Start a periodic verification and notify the user when a new version of the Unraid OS system is detected.
|
|
> Use the checkboxes below to select how notifications need to be given; by browser, by email and/or by custom agent.
|
|
|
|
Plugins update 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="unraidTitle" class="unraid" style="display:none"> </span>
|
|
: <span class="unraid" style="display:none"><span style="display:inline-block;width:130px;font-style:italic">Unraid OS update</span>
|
|
<input type="checkbox" name="unraid1"<?=($notify['unraid'] & 1)==1 ? ' checked' : ''?>>Browser
|
|
<input type="checkbox" name="unraid2"<?=($notify['unraid'] & 2)==2 ? ' checked' : ''?>>Email
|
|
<input type="checkbox" name="unraid3"<?=($notify['unraid'] & 4)==4 ? ' checked' : ''?>>Agents </span>
|
|
|
|
<span id="pluginTitle" class="plugin" style="display:none"> </span>
|
|
: <span class="plugin" style="display:none"><span style="display:inline-block;width:130px;font-style:italic">Plugins update</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:130px;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:130px;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:130px;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:130px;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:130px;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.
|
|
|
|
<input type="submit" name="#default" value="Default">
|
|
: <input type="submit" name="#apply" value="Apply" disabled><input type="button" value="Done" onclick="done()"></td>
|
|
</form>
|