2021-07-05 14:51:05 +00:00
{% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %}
2020-09-04 19:12:31 +00:00
{% if not adding %}
2023-04-02 16:58:55 +00:00
< table class = "overview overview-overflow" id = "ajax-servers" >
2020-09-04 19:12:31 +00:00
< thead >
< tr class = "overviewHead" >
2023-02-13 14:45:45 +00:00
< th class = "padding10 first-collumn" id = "server-name-th" > {{lang.words.name|title()}}< / th >
2022-11-28 07:47:18 +00:00
< th class = "ip-field" style = "width: 10% " id = "server-ip-th" > IP< / th >
2023-04-09 13:11:16 +00:00
< th style = "width: 5%" class = "help_cursor" > < span title = "SSH port" > {{lang.words.port|title()}}< / span > < / th >
2020-09-04 19:12:31 +00:00
{% if page != "servers.py" %}
2023-02-13 14:45:45 +00:00
< th style = "width: 10%" > {{lang.words.group|title()}}< / th >
2020-09-04 19:12:31 +00:00
{% endif %}
2023-02-13 14:45:45 +00:00
< th class = "checkbox-head" style = "min-width: 70px;" > {{lang.words.enabled|title()}}< / th >
2023-04-02 16:58:55 +00:00
< th style = "min-width: 60px; padding-left: 17px;" class = "help_cursor" >
2023-02-13 14:45:45 +00:00
< span title = "{{lang.words.virtual|title()}} IP, something like VRRP" > {{lang.words.virt|title()}}< / span >
2020-09-04 19:12:31 +00:00
< / th >
2023-04-02 16:58:55 +00:00
< th class = "checkbox-head" style = "min-width: 75px" id = "server-haproxy-th" > {{lang.words.services|title()}}< / th >
< th style = "min-width: 120px;" class = "help_cursor" id = "server-firewalld-th" >
2020-12-15 06:34:02 +00:00
< span title = "If the server has a firewall enabled, enable this option" > Firewalld< / span >
2020-11-18 04:45:34 +00:00
< / th >
2023-04-02 16:58:55 +00:00
< th class = "checkbox-head help_cursor" style = "min-width: 120px;" class = "help_cursor" id = "server-protected-th" >
2023-02-13 14:45:45 +00:00
< span title = "{{lang.phrases.protected_title}}" > {{lang.words.protected|title()}}< / span >
2021-05-16 05:27:47 +00:00
< / th >
2022-11-28 07:47:18 +00:00
< th style = "width: 10%" class = "help_cursor" id = "server-slave-th" >
2023-02-13 14:45:45 +00:00
< span id = "slavefor-th" title = "{{lang.phrases.slave_for_title}}" > {{lang.words.slave_for}}< / span >
2020-09-04 19:12:31 +00:00
< / th >
2023-02-13 14:45:45 +00:00
< th class = "cred-field" > {{lang.words.creds|title()}}< / th >
< th style = "width: 100%" > {{lang.words.desc|title()}}< / th >
2021-12-03 10:39:15 +00:00
< th style = "min-width: 17px;" > < / th >
2020-09-04 19:12:31 +00:00
< th > < / th >
< th > < / th >
2022-04-06 12:32:04 +00:00
< th > < / th >
2020-09-04 19:12:31 +00:00
< / tr >
< / thead >
< tbody >
{% endif %}
{% for server in servers %}
< tr id = "server-{{server.0}}" class = "{{ loop.cycle('odd', 'even') }} {% if adding %}newserver{% endif %}" >
< td class = "padding10 first-collumn" >
2023-04-02 16:58:55 +00:00
< span class = "serverNone server-status-small" title = "{{lang.phrases.server_unknown}}" id = "server_status-{{server.0}}" > < / span >
2020-09-04 19:12:31 +00:00
{% set id = 'hostname-' + server.0|string() %}
2023-04-02 16:58:55 +00:00
{{ input(id, value=server.1, size='20') }}
2020-09-04 19:12:31 +00:00
< / td >
< td >
2021-07-05 14:51:05 +00:00
{% set id = 'ip-' + server.0|string() %}
{{ copy_to_clipboard(id=id, value=server.2, style='margin-right: 6px;') }}
2020-09-04 19:12:31 +00:00
< / td >
< td >
{% set id = 'port-' + server.0|string() %}
2021-01-12 05:05:53 +00:00
{{ input(id, value=server.10, type='number', style='width: 50px;') }}
2020-09-04 19:12:31 +00:00
< / td >
{% if page != "servers.py" %}
< td >
< select id = "servergroup-{{server.0}}" name = "servergroup-{{server.0}}" >
2021-08-16 09:22:30 +00:00
< option disabled selected > ------< / option >
2020-09-04 19:12:31 +00:00
{% for group in groups %}
2021-08-02 08:19:22 +00:00
{% if server.3 == group.group_id|string() %}
< option value = "{{ group.group_id }}" selected > {{ group.name }}< / option >
2020-09-04 19:12:31 +00:00
{% else %}
2021-08-02 08:19:22 +00:00
< option value = "{{ group.group_id }}" > {{ group.name }}< / option >
2020-09-04 19:12:31 +00:00
{% endif %}
{% endfor %}
< / select >
< / td >
2019-10-25 07:18:57 +00:00
{% else %}
2020-09-04 19:12:31 +00:00
< input type = "hidden" id = "servergroup-{{server.0}}" name = "servergroup-{{server.0}}" value = "{{ group }}" / >
2019-10-25 07:18:57 +00:00
{% endif %}
2020-09-04 19:12:31 +00:00
< td class = "checkbox" >
{% set id = 'enable-' + server.0|string() %}
{% if server.5 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
< / td >
2023-04-02 16:58:55 +00:00
< td class = "checkbox" style = "padding-left: 15px;" >
2020-09-04 19:12:31 +00:00
{% set id = 'typeip-' + server.0|string() %}
{% if server.4 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
< / td >
2023-04-02 16:58:55 +00:00
< td >
< span title = "{{lang.words.change2|title()}} {{lang.words.active}} {{lang.words.services}}" style = "cursor: pointer; margin-left: 15px;" class = "div-pic" onclick = "openChangeServerServiceDialog('{{server.0}}')" > < / span >
2022-04-15 09:49:00 +00:00
< / td >
2021-01-22 04:01:08 +00:00
< td class = "checkbox" style = "padding-left: 0" >
2020-12-15 06:34:02 +00:00
< div class = "controlgroup" >
{% set id = 'firewall-' + server.0|string() %}
{% if server.18 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
2023-02-13 14:45:45 +00:00
< button onclick = "viewFirewallRules('{{server.2}}')" title = "{{lang.words.view|title()}} firewall {{lang.words.rules2}} {{lang.words.on}} {{lang.words.server2}} {{server.1}}" class = "overflow" style = "width: 60px;height: 28px;" > {{lang.words.view}}< / button >
2020-12-15 06:34:02 +00:00
< / div >
2020-11-18 04:45:34 +00:00
< / td >
2021-05-16 05:27:47 +00:00
< td class = "checkbox" style = "padding-left: 15px;" >
{% set id = 'protected-' + server.0|string() %}
{% if server.20 == 1 %}
{{ checkbox(id, checked='checked') }}
{% else %}
{{ checkbox(id) }}
{% endif %}
< / td >
2020-09-04 19:12:31 +00:00
< td >
< select id = "slavefor-{{server.0}}" >
< option value = "0" selected > Not slave< / option >
{% for master in masters %}
2021-01-10 04:48:18 +00:00
{% if master.0 == server.6 %}
2020-09-04 19:12:31 +00:00
< option value = "{{master.0}}" selected > {{master.1}}< / option >
{% else %}
2021-01-10 04:48:18 +00:00
{% if master.0 != server.0 %}
2020-09-04 19:12:31 +00:00
< option value = "{{master.0}}" > {{master.1}}< / option >
2021-01-10 04:48:18 +00:00
{% endif %}
2020-09-04 19:12:31 +00:00
{% endif %}
{% endfor %}
< / select >
< / td >
< td >
< div class = "controlgroup" >
< select id = "credentials-{{server.0}}" >
2021-08-16 09:22:30 +00:00
< option disabled selected > ------< / option >
2020-09-04 19:12:31 +00:00
{% for ssh in sshs %}
2021-08-02 08:19:22 +00:00
{% if ssh.id == server.7 %}
< option value = "{{ssh.id}}" selected > {{ssh.name}}< / option >
2020-09-04 19:12:31 +00:00
{% else %}
2021-08-02 08:19:22 +00:00
< option value = "{{ssh.id}}" > {{ssh.name}}< / option >
2020-09-04 19:12:31 +00:00
{% endif %}
{% endfor %}
< / select >
2023-04-15 07:33:00 +00:00
< button onclick = "checkSshConnect('{{server.2}}')" title = "Check SSH connect to the server {{server.1}}" class = "overflow" style = "width: 70px;height: 25px;" > {{lang.words.check}}< / button >
2020-09-04 19:12:31 +00:00
< / div >
< / td >
< td >
{% set id = 'desc-' + server.0|string() %}
2021-08-02 08:19:22 +00:00
{% if server.11 is not none %}
2020-09-04 19:12:31 +00:00
{{ input(id, value=server.11, size='20') }}
{% else %}
{{ input(id, size='20') }}
{% endif %}
< / td >
2022-04-06 12:32:04 +00:00
< td >
2023-09-17 09:42:39 +00:00
< a href = "/app/history/server/{{server.2}}" title = "{{lang.words.view|title}} {{lang.words.history}} {{lang.words.for}} {{lang.words.this}} {{lang.words.server}}" class = "history" > < / a >
2022-04-06 12:32:04 +00:00
< / td >
2021-12-03 10:39:15 +00:00
< td style = "min-width: 17px;" >
2023-02-13 14:45:45 +00:00
< a class = "info" onclick = "showServerInfo('{{server.0}}', '{{server.2}}')" id = "server_info_link-{{server.0}}" title = "{{lang.words.show|title()}} {{lang.words.server}} {{lang.words.info}}" style = "cursor: pointer; color: var(--green-color)" > < / a >
2021-12-03 10:39:15 +00:00
< / td >
2020-09-04 19:12:31 +00:00
< td >
2023-02-13 14:45:45 +00:00
< a class = "add" onclick = "cloneServer({{server.0}})" id = "clone-{{server.0}}" title = "{{lang.words.copy|title()}} {{lang.words.settings}} {{server.1}}" style = "cursor: pointer;" > < / a >
2020-09-04 19:12:31 +00:00
< / td >
< td >
2023-02-13 14:45:45 +00:00
< a class = "delete" onclick = "confirmDeleteServer({{server.0}})" title = "{{lang.words.delete|title()}} {{lang.words.server}} {{server.1}}" style = "cursor: pointer;" > < / a >
2020-09-04 19:12:31 +00:00
< / td >
< / tr >
{% endfor %}
{% if not adding %}
< / tbody >
< / table >
2023-02-13 14:45:45 +00:00
< br / > < span class = "add-button" title = "{{lang.words.add|title()}} {{lang.words.server}}" id = "add-server-button" > + {{lang.words.add|title()}}< / span >
2020-09-04 19:12:31 +00:00
< br / > < br / >
< div id = "checkSshConnect" > < / div >
2022-11-28 07:47:18 +00:00
< div class = "add-note addName alert alert-info" style = "width: inherit; margin-right: 15px;" id = "servers-help-link" >
2023-02-13 14:45:45 +00:00
{{lang.phrases.read_about_parameters}} < a href = "https://roxy-wi.org/description/servers" title = "{{lang.words.servers|title()}} {{lang.words.desc}}" target = "_blank" > {{lang.words.here}}< / a > , {{lang.phrases.read_howto}} < a href = "https://roxy-wi.org/howto/setup" title = "How to setup servers, group and SSH credentials" target = "_blank" > {{lang.words.article}}< / a >
2020-09-04 19:12:31 +00:00
< / div >
2022-05-07 08:28:38 +00:00
{% endif %}
2024-01-17 06:08:27 +00:00
{% if user_subscription['user_status'] == 0 or user_subscription['user_plan'] == 'user' %}
2022-05-07 08:28:38 +00:00
< script >
$( function() {
$('select:regex(id, slavefor)').selectmenu();
$('select:regex(id, slavefor)').selectmenu("disable");
2024-01-17 06:08:27 +00:00
{% if user_subscription['user_status'] == 0 %}
2023-02-13 14:45:45 +00:00
$('#slavefor-th').attr("title", "{{lang.phrases.slave_for_title}}. {{lang.phrases.no_sub}}. {{lang.phrases.pls_sub}}.");
2024-01-17 06:08:27 +00:00
{% elif user_subscription['user_plan'] == 'user' %}
2023-02-13 14:45:45 +00:00
$('#slavefor-th').attr("title", "{{lang.phrases.slave_for_title}}. {{lang.phrases.no_av_feat}}");
2022-05-07 08:28:38 +00:00
{% endif %}
});
< / script >
2022-05-08 09:19:58 +00:00
{% endif %}
2023-02-13 14:45:45 +00:00
< script >
{%- for server in servers %}
setInterval(serverIsUp, 18000, '{{server.2}}', '{{server.0}}');
serverIsUp('{{server.2}}', '{{server.0}}');
{%- endfor %}
< / script >