mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 06:00:51 -07:00
Add settings for notification conditions filterer
This commit is contained in:
parent
565dea5ecf
commit
f3349c64a9
5 changed files with 90 additions and 9 deletions
7
data/interfaces/default/js/filterer.jquery.js
Normal file
7
data/interfaces/default/js/filterer.jquery.js
Normal file
File diff suppressed because one or more lines are too long
|
@ -14,15 +14,10 @@
|
|||
<div class="row">
|
||||
<ul class="nav nav-tabs list-unstyled" role="tablist">
|
||||
<li role="presentation" class="active"><a href="#tabs-config" aria-controls="tabs-config" role="tab" data-toggle="tab">Configuration</a></li>
|
||||
% if notifier['agent_name'] == 'scripts':
|
||||
<li role="presentation"><a href="#tabs-notify_triggers" aria-controls="tabs-notify_triggers" role="tab" data-toggle="tab">Script Triggers</a></li>
|
||||
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">Script Arguments</a></li>
|
||||
<li role="presentation"><a href="#tabs-test_notifications" aria-controls="tabs-test_notifications" role="tab" data-toggle="tab">Test Script</a></li>
|
||||
% else:
|
||||
<li role="presentation"><a href="#tabs-notify_triggers" aria-controls="tabs-notify_triggers" role="tab" data-toggle="tab">Notification Triggers</a></li>
|
||||
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">Notification Text</a></li>
|
||||
<li role="presentation"><a href="#tabs-notify_triggers" aria-controls="tabs-notify_triggers" role="tab" data-toggle="tab">Triggers</a></li>
|
||||
<li role="presentation"><a href="#tabs-notify_conditions" aria-controls="tabs-notify_conditions" role="tab" data-toggle="tab">Conditions</a></li>
|
||||
<li role="presentation"><a href="#tabs-notify_text" aria-controls="tabs-notify_text" role="tab" data-toggle="tab">${'Arguments' if notifier['agent_name'] == 'scripts' else 'Text'}</a></li>
|
||||
<li role="presentation"><a href="#tabs-test_notifications" aria-controls="tabs-test_notifications" role="tab" data-toggle="tab">Test Notifications</a></li>
|
||||
% endif
|
||||
</ul>
|
||||
</div>
|
||||
<form action="set_notifier_config" method="post" class="form" id="set_notifier_config" data-parsley-validate>
|
||||
|
@ -131,6 +126,26 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-notify_conditions">
|
||||
<p class="help-block">
|
||||
Add custom notification conditions.
|
||||
<a href="#notify-text-sub-modal" data-toggle="modal">Click here</a> for a description of all the parameters.
|
||||
</p>
|
||||
<p class="help-block">
|
||||
Note: Conditions are checked after the notification trigger and the notification will only be sent if the condition logic is satisfied.
|
||||
</p>
|
||||
<div id="condition-widget"></div>
|
||||
<input type="text" name="custom_conditions" id="custom_conditions" value="${notifier['custom_conditions']}" />
|
||||
|
||||
<div class="form-group">
|
||||
<label for="custom_condition_logic">Condition Logic</label>
|
||||
<input type="text" class="form-control" name="custom_conditions_logic" id="custom_conditions_logic" value="${notifier['custom_conditions_logic']}" required />
|
||||
<p class="help-block">
|
||||
Enter the logic to use when evaluating the conditions.
|
||||
Only the keywords <span class="inline-pre">and</span>/<span class="inline-pre">or</span> and brackets <span class="inline-pre">()</span> are supported.
|
||||
(e.g. <span class="inline-pre">{1} and ({2} or {3}</span>).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div role="tabpanel" class="tab-pane" id="tabs-notify_text">
|
||||
<p class="help-block">
|
||||
% if notifier['agent_name'] == 'scripts':
|
||||
|
@ -253,10 +268,25 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<script src="${http_root}js/filterer.jquery.js"></script>
|
||||
<script>
|
||||
|
||||
$('#notifier-config-modal').unbind('hidden.bs.modal');
|
||||
|
||||
$('#condition-widget').filterer({
|
||||
coefficients: [
|
||||
{"name": "Title", "type": "string", "value": "title"},
|
||||
{"name": "Year", "type": "number", "value": "year"}
|
||||
],
|
||||
conditions: [
|
||||
{coefficient: "year", operator: "is", value: ""},
|
||||
{coefficient: "title", operator: "begins with", value: ""}
|
||||
],
|
||||
updateConditions: function(newConditions){
|
||||
$('#custom_conditions').val(JSON.stringify(newConditions));
|
||||
}
|
||||
})
|
||||
|
||||
function reloadModal() {
|
||||
$.ajax({
|
||||
url: 'get_notifier_config_modal',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue