haproxy-wi/app/templates/ajax/channels.html

239 lines
12 KiB
HTML

{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% from 'include/input_macros.html' import input, select, checkbox %}
{% if user_subscription['user_status'] == 0 %}
{% include 'include/no_sub.html' %}
{% else %}
<table id="checker_telegram_table" class="overview-overflow">
<caption><i class="fab fa-telegram caption-icon"></i><h3>Telegram {{lang.words.channels}}</h3></caption>
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
{{lang.words.token|title()}}
</td>
<td style="width: 20%;">{{lang.words.channel|title()}}</td>
{% if user_params['role']|int() == 1 %}
<td style="width: 25%;">{{lang.words.group|title()}}</td>
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td><span onclick="loadChannel()" class="refresh" title="{{lang.words.refresh2|title()}} Telegram {{lang.words.channels}}"></span></td>
</tr>
{% for telegram in telegrams %}
<tr id="telegram-table-{{telegram.id}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% set id = 'telegram-token-' + telegram.id|string() %}
{{ input(id, value=telegram.token, size='30') }}
</td>
<td>
{% set id = 'telegram-chanel-' + telegram.id|string() %}
{{ input(id, value=telegram.chanel_name, size='30') }}
</td>
{% if user_params['role']|int() == 1 %}
<td>
<select id="telegramgroup-{{telegram.id}}" name="telegramgroup-{{telegram.id}}">
<option disabled selected>------</option>
{% for group in groups %}
{% if telegram.groups|string() == group.group_id|string() %}
<option value="{{ group.group_id }}" selected>{{ group.name }}</option>
{% else %}
<option value="{{ group.group_id }}">{{ group.name }}</option>
{% endif %}
{% endfor %}
</select>
</td>
{% endif %}
<td>
<button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{telegram.id}}, 'telegram')">{{lang.words.test|title()}}</button>
</td>
<td>
<a class="add" onclick="cloneReceiver({{telegram.id}}, 'telegram')" id="clone-{{telegram.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{telegram.chanel_name}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteReceiver({{telegram.id}}, 'telegram')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{telegram.chanel_name}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="{{lang.words.add|title()}} Telegram {{lang.words.channel}}" id="add-telegram-button">+ {{lang.words.add|title()}}</span>
<br /><br />
<table id="checker_slack_table" class="overview-overflow">
<caption><i class="fab fa-slack caption-icon"></i><h3>Slack {{lang.words.channels|title()}}</h3></caption>
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
<span title="Token that has given with APP registration">{{lang.words.token|title()}}</span>
</td>
<td style="width: 20%;">{{lang.words.channel|title()}}</td>
{% if user_params['role']|int() == 1 %}
<td style="width: 25%;">{{lang.words.group|title()}}</td>
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td><span onclick="loadChannel()" class="refresh" title="{{lang.words.refresh2|title()}} Slack {{lang.words.channels}}"></span></td>
</tr>
{% for slack in slacks %}
<tr id="slack-table-{{slack.id}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% set id = 'slack-token-' + slack.id|string() %}
{{ input(id, value=slack.token, size='30') }}
</td>
<td>
{% set id = 'slack-chanel-' + slack.id|string() %}
{{ input(id, value=slack.chanel_name, size='30') }}
</td>
{% if user_params['role']|int() == 1 %}
<td>
<select id="slackgroup-{{slack.id}}" name="slackgroup-{{slack.id}}">
<option disabled selected>------</option>
{% for group in groups %}
{% if slack.groups|string() == group.group_id|string() %}
<option value="{{ group.group_id }}" selected>{{ group.name }}</option>
{% else %}
<option value="{{ group.group_id }}">{{ group.name }}</option>
{% endif %}
{% endfor %}
</select>
</td>
{% endif %}
<td>
<button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{slack.id}}, 'slack')">{{lang.words.test|title()}}</button>
</td>
<td>
<a class="add" onclick="cloneReceiver({{slack.id}}, 'slack')" id="clone-{{slack.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{slack.chanel_name}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteReceiver({{slack.id}}, 'slack')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{slack.chanel_name}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="{{lang.words.add|title()}} Slack {{lang.words.channel|title()}}" id="add-slack-button">+ {{lang.words.add|title()}}</span>
<br /><br />
<table id="checker_pd_table" class="overview-overflow">
<caption><i class="fas fa-pager caption-icon"></i><h3>PagerDuty {{lang.words.channels|title()}}</h3></caption>
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
{{lang.words.key|title()}}
</td>
<td style="width: 20%;">{{lang.words.name|title()}}</td>
{% if user_params['role']|int() == 1 %}
<td style="width: 25%;">{{lang.words.group|title()}}</td>
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td><span onclick="loadChannel()" class="refresh" title="{{lang.words.refresh2|title()}} Slack {{lang.words.channels}}"></span></td>
</tr>
{% for pd in pds %}
<tr id="pd-table-{{pd.id}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% set id = 'pd-token-' + pd.id|string() %}
{{ input(id, value=pd.token, size='30') }}
</td>
<td>
{% set id = 'pd-chanel-' + pd.id|string() %}
{{ input(id, value=pd.chanel_name, size='30') }}
</td>
{% if user_params['role']|int() == 1 %}
<td>
<select id="pdgroup-{{pd.id}}" name="pdgroup-{{pd.id}}">
<option disabled selected>------</option>
{% for group in groups %}
{% if pd.groups|string() == group.group_id|string() %}
<option value="{{ group.group_id }}" selected>{{ group.name }}</option>
{% else %}
<option value="{{ group.group_id }}">{{ group.name }}</option>
{% endif %}
{% endfor %}
</select>
</td>
{% endif %}
<td>
<button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{pd.id}}, 'pd')">{{lang.words.test|title()}}</button>
</td>
<td>
<a class="add" onclick="cloneReceiver({{pd.id}}, 'pd')" id="clone-{{pd.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{pd.chanel_name}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteReceiver({{pd.id}}, 'pd')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{pd.chanel_name}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="{{lang.words.add|title()}} PagerDuty {{lang.words.channel}}" id="add-pd-button">+ {{lang.words.add|title()}}</span>
<br /><br />
<table id="checker_mm_table" class="overview-overflow">
<caption><i class="fas fa-power-off caption-icon"></i><h3>Mattermost {{lang.words.channels|title()}}</h3></caption>
<tr class="overviewHead" style="width: 50%;">
<td class="padding10 first-collumn" style="width: 25%;">
{{lang.words.key|title()}}
</td>
<td style="width: 20%;">{{lang.words.name|title()}}</td>
{% if user_params['role']|int() == 1 %}
<td style="width: 25%;">{{lang.words.group|title()}}</td>
{% endif %}
<td style="width: 100%;"></td>
<td></td>
<td><span onclick="loadChannel()" class="refresh" title="{{lang.words.refresh2|title()}} Mattermost {{lang.words.channels}}"></span></td>
</tr>
{% for mm in mms %}
<tr id="mm-table-{{mm.id}}" class="{{ loop.cycle('odd', 'even') }}">
<td class="padding10 first-collumn">
{% set id = 'mm-token-' + mm.id|string() %}
{{ input(id, value=mm.token, size='30') }}
</td>
<td>
{% set id = 'mm-chanel-' + mm.id|string() %}
{{ input(id, value=mm.chanel_name, size='30') }}
</td>
{% if user_params['role']|int() == 1 %}
<td>
<select id="pdgroup-{{mm.id}}" name="pdgroup-{{mm.id}}">
<option disabled selected>------</option>
{% for group in groups %}
{% if mm.groups|string() == group.group_id|string() %}
<option value="{{ group.group_id }}" selected>{{ group.name }}</option>
{% else %}
<option value="{{ group.group_id }}">{{ group.name }}</option>
{% endif %}
{% endfor %}
</select>
</td>
{% endif %}
<td>
<button title="{{lang.phrases.send_test_mes}}" onclick="checkReceiver({{mm.id}}, 'mm')">{{lang.words.test|title()}}</button>
</td>
<td>
<a class="add" onclick="cloneReceiver({{mm.id}}, 'mm')" id="clone-{{mm.id}}" title="{{lang.words.w_copy|title()}} {{lang.words.the}} {{lang.words.settings}} {{mm.chanel_name}}" style="cursor: pointer;"></a>
</td>
<td>
<a class="delete" onclick="confirmDeleteReceiver({{mm.id}}, 'mm')" title="{{lang.words.delete|title()}} {{lang.words.channel}} {{mm.chanel_name}}" style="cursor: pointer;"></a>
</td>
</tr>
{% endfor %}
</table>
<br /><span class="add-button" title="{{lang.words.add|title()}} Mattermost {{lang.words.channel}}" id="add-mm-button">+ {{lang.words.add|title()}}</span>
<br /><br />
<table class="overflow">
<caption><i class="fas fa-envelope-open-text caption-icon"></i><h3>{{lang.words.test2|title()}} {{lang.words.message}}</h3></caption>
<tr class="overviewHead">
<td class="padding10 first-collumn" style="width: 45%">{{lang.words.email|title()}}</td>
<td style="width: 100%">{{lang.words.web_panel|title()}}</td>
</tr>
<tr>
<td class="padding10 first-collumn">
<button title="{{lang.phrases.send_test_mes}} {{lang.words.via}} {{lang.words.email}}" onclick="checkEmail()">{{lang.words.test|title()}}</button>
</td>
<td>
<button title="{{lang.phrases.send_test_mes}} {{lang.words.via}} {{lang.words.web_panel}}" onclick="checkWebPanel()">{{lang.words.test|title()}}</button>
</td>
</tr>
</table>
<br /><br />
<div id="ajax-telegram"></div>
<div class="add-note alert addName alert-info" style="width: inherit; margin-right: 15px;">
{{lang.phrases.read_about_parameters}} <a href="https://roxy-wi.org/description/checker" title="Servers description" target="_blank">{{lang.words.here}}</a>,
<a href="https://roxy-wi.org/howto/create-telegram-bot" title="How to create Telegram bot and use it with Roxy-WI" target="_blank">{{lang.phrases.howto_user}} Telegram bot</a>,
<a href="https://roxy-wi.org/howto/create-slack-app" title="How to create Slack APP and use it with Roxy-WI" target="_blank">{{lang.phrases.howto_user}} Slack APP</a>,
<a href="https://roxy-wi.org/howto/create-pd-integration" title="How to create PagerDuty integration and use it with Roxy-WI" target="_blank">{{lang.phrases.howto_user}} PagerDuty</a>.
</div>
{% endif %}
{% include 'include/admins_dialogs.html' %}