mirror of https://github.com/Aidaho12/haproxy-wi
parent
b185ee78c8
commit
c7570ec4bd
|
@ -28,6 +28,7 @@ from app.routes.metric import bp as metric_bp
|
||||||
from app.routes.waf import bp as waf_bp
|
from app.routes.waf import bp as waf_bp
|
||||||
from app.routes.runtime import bp as runtime_bp
|
from app.routes.runtime import bp as runtime_bp
|
||||||
from app.routes.smon import bp as smon_bp
|
from app.routes.smon import bp as smon_bp
|
||||||
|
from app.routes.channel import bp as channel_bp
|
||||||
from app.routes.checker import bp as checker_bp
|
from app.routes.checker import bp as checker_bp
|
||||||
from app.routes.portscanner import bp as portscanner_bp
|
from app.routes.portscanner import bp as portscanner_bp
|
||||||
from app.routes.install import bp as install_bp
|
from app.routes.install import bp as install_bp
|
||||||
|
@ -47,6 +48,7 @@ app.register_blueprint(waf_bp, url_prefix='/waf')
|
||||||
app.register_blueprint(runtime_bp, url_prefix='/runtimeapi')
|
app.register_blueprint(runtime_bp, url_prefix='/runtimeapi')
|
||||||
app.register_blueprint(smon_bp, url_prefix='/smon')
|
app.register_blueprint(smon_bp, url_prefix='/smon')
|
||||||
app.register_blueprint(checker_bp, url_prefix='/checker')
|
app.register_blueprint(checker_bp, url_prefix='/checker')
|
||||||
|
app.register_blueprint(channel_bp, url_prefix='/channel')
|
||||||
app.register_blueprint(portscanner_bp, url_prefix='/portscanner')
|
app.register_blueprint(portscanner_bp, url_prefix='/portscanner')
|
||||||
app.register_blueprint(install_bp, url_prefix='/install')
|
app.register_blueprint(install_bp, url_prefix='/install')
|
||||||
app.register_blueprint(user_bp, url_prefix='/user')
|
app.register_blueprint(user_bp, url_prefix='/user')
|
||||||
|
|
|
@ -59,7 +59,6 @@ def subprocess_execute(cmd):
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, universal_newlines=True)
|
||||||
stdout, stderr = p.communicate()
|
stdout, stderr = p.communicate()
|
||||||
output = stdout.splitlines()
|
output = stdout.splitlines()
|
||||||
|
|
||||||
return output, stderr
|
return output, stderr
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
from flask import render_template
|
from flask import render_template
|
||||||
|
import ansible
|
||||||
import ansible_runner
|
import ansible_runner
|
||||||
|
|
||||||
import app.modules.db.sql as sql
|
import app.modules.db.sql as sql
|
||||||
|
@ -374,6 +376,7 @@ def run_ansible(inv: dict, server_ips: str, ansible_role: str) -> object:
|
||||||
'AWX_DISPLAY': False,
|
'AWX_DISPLAY': False,
|
||||||
'SSH_AUTH_PID': agent_pid['pid'],
|
'SSH_AUTH_PID': agent_pid['pid'],
|
||||||
'SSH_AUTH_SOCK': agent_pid['socket'],
|
'SSH_AUTH_SOCK': agent_pid['socket'],
|
||||||
|
'ANSIBLE_PYTHON_INTERPRETER': '/usr/bin/python3'
|
||||||
}
|
}
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'private_data_dir': '/var/www/haproxy-wi/app/scripts/ansible/',
|
'private_data_dir': '/var/www/haproxy-wi/app/scripts/ansible/',
|
||||||
|
@ -461,12 +464,15 @@ def install_service(service: str, json_data: str) -> object:
|
||||||
|
|
||||||
|
|
||||||
def _install_ansible_collections():
|
def _install_ansible_collections():
|
||||||
|
old_ansible_server = ''
|
||||||
collections = ('community.general', 'ansible.posix', 'community.docker')
|
collections = ('community.general', 'ansible.posix', 'community.docker')
|
||||||
trouble_link = 'Read <a href="https://roxy-wi.org/troubleshooting#ansible_collection" target="_blank" class="link">troubleshooting</a>'
|
trouble_link = 'Read <a href="https://roxy-wi.org/troubleshooting#ansible_collection" target="_blank" class="link">troubleshooting</a>'
|
||||||
for collection in collections:
|
for collection in collections:
|
||||||
if not os.path.isdir(f'/usr/share/httpd/.ansible/collections/ansible_collections/{collection.replace(".", "/")}'):
|
if not os.path.isdir(f'/usr/share/httpd/.ansible/collections/ansible_collections/{collection.replace(".", "/")}'):
|
||||||
try:
|
try:
|
||||||
exit_code = os.system(f'ansible-galaxy collection install {collection}')
|
if version.parse(ansible.__version__) < version.parse('2.13.9'):
|
||||||
|
old_ansible_server = '--server https://old-galaxy.ansible.com/'
|
||||||
|
exit_code = os.system(f'ansible-galaxy collection install {collection} {old_ansible_server}')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
roxywi_common.handle_exceptions(e,
|
roxywi_common.handle_exceptions(e,
|
||||||
'Roxy-WI server',
|
'Roxy-WI server',
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
import pika
|
import pika
|
||||||
from flask import render_template, request
|
from flask import render_template, request, abort
|
||||||
|
|
||||||
import app.modules.db.sql as sql
|
import app.modules.db.sql as sql
|
||||||
import app.modules.db.user as user_sql
|
import app.modules.db.user as user_sql
|
||||||
|
@ -433,3 +433,34 @@ def check_receiver(channel_id: int, receiver_name: str) -> str:
|
||||||
return functions[receiver_name](mess, level, channel_id=channel_id)
|
return functions[receiver_name](mess, level, channel_id=channel_id)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return f'error: Cannot send message: {e}'
|
return f'error: Cannot send message: {e}'
|
||||||
|
|
||||||
|
|
||||||
|
def load_channels():
|
||||||
|
try:
|
||||||
|
user_subscription = roxywi_common.return_user_status()
|
||||||
|
except Exception as e:
|
||||||
|
user_subscription = roxywi_common.return_unsubscribed_user_status()
|
||||||
|
roxywi_common.logging('Roxy-WI server', f'Cannot get a user plan: {e}', roxywi=1)
|
||||||
|
|
||||||
|
try:
|
||||||
|
user_params = roxywi_common.get_users_params()
|
||||||
|
except Exception:
|
||||||
|
abort(403)
|
||||||
|
|
||||||
|
kwargs = {
|
||||||
|
'user_subscription': user_subscription,
|
||||||
|
'user_params': user_params,
|
||||||
|
'lang': user_params['lang']
|
||||||
|
}
|
||||||
|
|
||||||
|
if user_subscription['user_status']:
|
||||||
|
user_group = roxywi_common.get_user_group(id=1)
|
||||||
|
kwargs.setdefault('telegrams', channel_sql.get_user_telegram_by_group(user_group))
|
||||||
|
kwargs.setdefault('pds', channel_sql.get_user_pd_by_group(user_group))
|
||||||
|
kwargs.setdefault('groups', group_sql.select_groups())
|
||||||
|
kwargs.setdefault('slacks', channel_sql.get_user_slack_by_group(user_group))
|
||||||
|
kwargs.setdefault('user_subscription', user_subscription)
|
||||||
|
kwargs.setdefault('user_params', user_params)
|
||||||
|
kwargs.setdefault('lang', user_params['lang'])
|
||||||
|
|
||||||
|
return render_template('ajax/channels.html', **kwargs)
|
||||||
|
|
|
@ -11,7 +11,6 @@ import app.modules.db.sql as sql
|
||||||
import app.modules.db.cred as cred_sql
|
import app.modules.db.cred as cred_sql
|
||||||
import app.modules.db.user as user_sql
|
import app.modules.db.user as user_sql
|
||||||
import app.modules.db.group as group_sql
|
import app.modules.db.group as group_sql
|
||||||
import app.modules.db.backup as backup_sql
|
|
||||||
import app.modules.db.server as server_sql
|
import app.modules.db.server as server_sql
|
||||||
import app.modules.db.service as service_sql
|
import app.modules.db.service as service_sql
|
||||||
from app.middleware import get_user_params
|
from app.middleware import get_user_params
|
||||||
|
@ -34,10 +33,6 @@ def before_request():
|
||||||
@get_user_params()
|
@get_user_params()
|
||||||
def admin():
|
def admin():
|
||||||
roxywi_auth.page_for_admin()
|
roxywi_auth.page_for_admin()
|
||||||
grafana = 0
|
|
||||||
|
|
||||||
if not roxy.is_docker():
|
|
||||||
grafana = tools_common.is_tool_active('grafana-server')
|
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'lang': g.user_params['lang'],
|
'lang': g.user_params['lang'],
|
||||||
|
@ -50,12 +45,7 @@ def admin():
|
||||||
'settings': sql.get_setting('', all=1),
|
'settings': sql.get_setting('', all=1),
|
||||||
'ldap_enable': sql.get_setting('ldap_enable'),
|
'ldap_enable': sql.get_setting('ldap_enable'),
|
||||||
'services': service_sql.select_services(),
|
'services': service_sql.select_services(),
|
||||||
'gits': backup_sql.select_gits(),
|
|
||||||
'masters': server_sql.select_servers(get_master_servers=1),
|
'masters': server_sql.select_servers(get_master_servers=1),
|
||||||
'is_needed_tool': common.is_tool('ansible'),
|
|
||||||
'grafana': grafana,
|
|
||||||
'backups': backup_sql.select_backups(),
|
|
||||||
's3_backups': backup_sql.select_s3_backups(),
|
|
||||||
'guide_me': 1,
|
'guide_me': 1,
|
||||||
'user_subscription': roxywi_common.return_user_subscription()
|
'user_subscription': roxywi_common.return_user_subscription()
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
bp = Blueprint('channel', __name__)
|
||||||
|
|
||||||
|
from app.routes.channel import routes
|
|
@ -0,0 +1,73 @@
|
||||||
|
from flask import request, render_template
|
||||||
|
from flask_login import login_required
|
||||||
|
|
||||||
|
from app.routes.channel import bp
|
||||||
|
from app.middleware import get_user_params
|
||||||
|
import app.modules.common.common as common
|
||||||
|
import app.modules.tools.alerting as alerting
|
||||||
|
import app.modules.roxywi.common as roxywi_common
|
||||||
|
|
||||||
|
|
||||||
|
@bp.before_request
|
||||||
|
@login_required
|
||||||
|
def before_request():
|
||||||
|
""" Protect all the admin endpoints. """
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('')
|
||||||
|
@get_user_params()
|
||||||
|
def channels():
|
||||||
|
roxywi_common.check_user_group_for_flask()
|
||||||
|
|
||||||
|
return render_template('channel.html')
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/load')
|
||||||
|
@get_user_params()
|
||||||
|
def load_channels():
|
||||||
|
try:
|
||||||
|
return alerting.load_channels()
|
||||||
|
except Exception as e:
|
||||||
|
return f'{e}'
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/check/<channel_id>/<receiver_name>')
|
||||||
|
def check_receiver(channel_id, receiver_name):
|
||||||
|
channel_id = common.checkAjaxInput(channel_id)
|
||||||
|
receiver_name = common.checkAjaxInput(receiver_name)
|
||||||
|
|
||||||
|
return alerting.check_receiver(channel_id, receiver_name)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/check/rabbit')
|
||||||
|
def check_rabbit():
|
||||||
|
return alerting.check_rabbit_alert()
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/check/email')
|
||||||
|
def check_email():
|
||||||
|
return alerting.check_email_alert()
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/receiver/<receiver_name>', methods=['PUT', 'POST', 'DELETE'])
|
||||||
|
def receiver(receiver_name):
|
||||||
|
if request.method == 'POST':
|
||||||
|
token = common.checkAjaxInput(request.form.get('receiver'))
|
||||||
|
channel = common.checkAjaxInput(request.form.get('channel'))
|
||||||
|
group = common.checkAjaxInput(request.form.get('group'))
|
||||||
|
page = common.checkAjaxInput(request.form.get('page'))
|
||||||
|
page = page.split("#")[0]
|
||||||
|
|
||||||
|
return alerting.add_receiver_channel(receiver_name, token, channel, group, page)
|
||||||
|
elif request.method == 'PUT':
|
||||||
|
token = common.checkAjaxInput(request.form.get('receiver_token'))
|
||||||
|
channel = common.checkAjaxInput(request.form.get('channel'))
|
||||||
|
group = common.checkAjaxInput(request.form.get('group'))
|
||||||
|
user_id = common.checkAjaxInput(request.form.get('id'))
|
||||||
|
|
||||||
|
return alerting.update_receiver_channel(receiver_name, token, channel, group, user_id)
|
||||||
|
elif request.method == 'DELETE':
|
||||||
|
channel_id = common.checkAjaxInput(request.form.get('channel_id'))
|
||||||
|
|
||||||
|
return alerting.delete_receiver_channel(channel_id, receiver_name)
|
|
@ -3,11 +3,8 @@ from flask_login import login_required
|
||||||
|
|
||||||
from app.routes.checker import bp
|
from app.routes.checker import bp
|
||||||
from app.middleware import get_user_params
|
from app.middleware import get_user_params
|
||||||
import app.modules.db.sql as sql
|
|
||||||
import app.modules.db.history as history_sql
|
import app.modules.db.history as history_sql
|
||||||
import app.modules.common.common as common
|
|
||||||
import app.modules.roxywi.common as roxywi_common
|
import app.modules.roxywi.common as roxywi_common
|
||||||
import app.modules.tools.alerting as alerting
|
|
||||||
import app.modules.tools.checker as checker_mod
|
import app.modules.tools.checker as checker_mod
|
||||||
|
|
||||||
|
|
||||||
|
@ -67,44 +64,3 @@ def checker_history():
|
||||||
}
|
}
|
||||||
|
|
||||||
return render_template('smon/checker_history.html', **kwargs)
|
return render_template('smon/checker_history.html', **kwargs)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/check/<channel_id>/<receiver_name>')
|
|
||||||
def check_receiver(channel_id, receiver_name):
|
|
||||||
channel_id = common.checkAjaxInput(channel_id)
|
|
||||||
receiver_name = common.checkAjaxInput(receiver_name)
|
|
||||||
|
|
||||||
return alerting.check_receiver(channel_id, receiver_name)
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/check/rabbit')
|
|
||||||
def check_rabbit():
|
|
||||||
return alerting.check_rabbit_alert()
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/check/email')
|
|
||||||
def check_email():
|
|
||||||
return alerting.check_email_alert()
|
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/receiver/<receiver_name>', methods=['PUT', 'POST', 'DELETE'])
|
|
||||||
def receiver(receiver_name):
|
|
||||||
if request.method == 'POST':
|
|
||||||
token = common.checkAjaxInput(request.form.get('receiver'))
|
|
||||||
channel = common.checkAjaxInput(request.form.get('channel'))
|
|
||||||
group = common.checkAjaxInput(request.form.get('group'))
|
|
||||||
page = common.checkAjaxInput(request.form.get('page'))
|
|
||||||
page = page.split("#")[0]
|
|
||||||
|
|
||||||
return alerting.add_receiver_channel(receiver_name, token, channel, group, page)
|
|
||||||
elif request.method == 'PUT':
|
|
||||||
token = common.checkAjaxInput(request.form.get('receiver_token'))
|
|
||||||
channel = common.checkAjaxInput(request.form.get('channel'))
|
|
||||||
group = common.checkAjaxInput(request.form.get('group'))
|
|
||||||
user_id = common.checkAjaxInput(request.form.get('id'))
|
|
||||||
|
|
||||||
return alerting.update_receiver_channel(receiver_name, token, channel, group, user_id)
|
|
||||||
elif request.method == 'DELETE':
|
|
||||||
channel_id = common.checkAjaxInput(request.form.get('channel_id'))
|
|
||||||
|
|
||||||
return alerting.delete_receiver_channel(channel_id, receiver_name)
|
|
||||||
|
|
|
@ -13,7 +13,6 @@ import app.modules.db.sql as sql
|
||||||
import app.modules.db.cred as cred_sql
|
import app.modules.db.cred as cred_sql
|
||||||
import app.modules.db.user as user_sql
|
import app.modules.db.user as user_sql
|
||||||
import app.modules.db.group as group_sql
|
import app.modules.db.group as group_sql
|
||||||
import app.modules.db.backup as backup_sql
|
|
||||||
import app.modules.db.server as server_sql
|
import app.modules.db.server as server_sql
|
||||||
import app.modules.db.service as service_sql
|
import app.modules.db.service as service_sql
|
||||||
import app.modules.db.history as history_sql
|
import app.modules.db.history as history_sql
|
||||||
|
@ -188,12 +187,8 @@ def servers():
|
||||||
'timezones': pytz.all_timezones,
|
'timezones': pytz.all_timezones,
|
||||||
'guide_me': 1,
|
'guide_me': 1,
|
||||||
'settings': sql.get_setting('', all=1),
|
'settings': sql.get_setting('', all=1),
|
||||||
'backups': backup_sql.select_backups(),
|
|
||||||
's3_backups': backup_sql.select_s3_backups(),
|
|
||||||
'page': 'servers.py',
|
'page': 'servers.py',
|
||||||
'ldap_enable': sql.get_setting('ldap_enable'),
|
'ldap_enable': sql.get_setting('ldap_enable'),
|
||||||
'gits': backup_sql.select_gits(),
|
|
||||||
'is_needed_tool': common.is_tool('ansible'),
|
|
||||||
'user_roles': user_sql.select_user_roles_by_group(user_group),
|
'user_roles': user_sql.select_user_roles_by_group(user_group),
|
||||||
'user_subscription': roxywi_common.return_user_subscription(),
|
'user_subscription': roxywi_common.return_user_subscription(),
|
||||||
'lang': g.user_params['lang']
|
'lang': g.user_params['lang']
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from flask import render_template, request
|
from flask import render_template, request, g
|
||||||
from flask_login import login_required
|
from flask_login import login_required
|
||||||
|
|
||||||
from app.routes.server import bp
|
from app.routes.server import bp
|
||||||
import app.modules.db.cred as cred_sql
|
import app.modules.db.cred as cred_sql
|
||||||
import app.modules.db.group as group_sql
|
import app.modules.db.group as group_sql
|
||||||
import app.modules.db.server as server_sql
|
import app.modules.db.server as server_sql
|
||||||
|
import app.modules.db.backup as backup_sql
|
||||||
import app.modules.common.common as common
|
import app.modules.common.common as common
|
||||||
import app.modules.roxywi.group as group_mod
|
import app.modules.roxywi.group as group_mod
|
||||||
import app.modules.roxywi.auth as roxywi_auth
|
import app.modules.roxywi.auth as roxywi_auth
|
||||||
|
@ -15,6 +16,7 @@ import app.modules.server.ssh as ssh_mod
|
||||||
import app.modules.server.server as server_mod
|
import app.modules.server.server as server_mod
|
||||||
import app.modules.tools.smon as smon_mod
|
import app.modules.tools.smon as smon_mod
|
||||||
import app.modules.service.backup as backup_mod
|
import app.modules.service.backup as backup_mod
|
||||||
|
from app.middleware import get_user_params
|
||||||
|
|
||||||
error_mess = roxywi_common.return_error_message()
|
error_mess = roxywi_common.return_error_message()
|
||||||
|
|
||||||
|
@ -271,6 +273,22 @@ def show_firewall(server_ip):
|
||||||
return server_mod.show_firewalld_rules(server_ip)
|
return server_mod.show_firewalld_rules(server_ip)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/backup')
|
||||||
|
@get_user_params()
|
||||||
|
def load_backup():
|
||||||
|
user_group = g.user_params['group_id']
|
||||||
|
kwargs = {
|
||||||
|
'sshs': cred_sql.select_ssh(group=user_group),
|
||||||
|
'servers': roxywi_common.get_dick_permit(virt=1, disable=0, only_group=1),
|
||||||
|
'backups': backup_sql.select_backups(),
|
||||||
|
's3_backups': backup_sql.select_s3_backups(),
|
||||||
|
'gits': backup_sql.select_gits(),
|
||||||
|
'lang': g.user_params['lang'],
|
||||||
|
'is_needed_tool': common.is_tool('ansible'),
|
||||||
|
'user_subscription': roxywi_common.return_user_subscription(),
|
||||||
|
}
|
||||||
|
return render_template('include/admin_backup.html', **kwargs)
|
||||||
|
|
||||||
@bp.post('/backup/create')
|
@bp.post('/backup/create')
|
||||||
@bp.post('/backup/delete')
|
@bp.post('/backup/delete')
|
||||||
@bp.post('/backup/update')
|
@bp.post('/backup/update')
|
||||||
|
|
|
@ -347,6 +347,8 @@ def smon_host_history(server_ip):
|
||||||
roxywi_common.check_user_group_for_flask()
|
roxywi_common.check_user_group_for_flask()
|
||||||
|
|
||||||
needed_host = common.checkAjaxInput(server_ip)
|
needed_host = common.checkAjaxInput(server_ip)
|
||||||
|
if ' ' in needed_host:
|
||||||
|
needed_host = f"'{needed_host}'"
|
||||||
smon_status = tools_common.is_tool_active('roxy-wi-smon')
|
smon_status = tools_common.is_tool_active('roxy-wi-smon')
|
||||||
smon = history_sql.alerts_history('SMON', g.user_params['group_id'], host=needed_host)
|
smon = history_sql.alerts_history('SMON', g.user_params['group_id'], host=needed_host)
|
||||||
user_subscription = roxywi_common.return_user_subscription()
|
user_subscription = roxywi_common.return_user_subscription()
|
||||||
|
|
|
@ -466,3 +466,8 @@
|
||||||
margin: 8px 5px 10px var(--indent);
|
margin: 8px 5px 10px var(--indent);
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
.channel::before {
|
||||||
|
display: none;
|
||||||
|
font-family: "Font Awesome 5 Regular";
|
||||||
|
content: "\f086";
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,441 @@
|
||||||
|
$( function() {
|
||||||
|
$("#backup_tabs").tabs();
|
||||||
|
$('#add-backup-button').click(function() {
|
||||||
|
addBackupDialog.dialog('open');
|
||||||
|
});
|
||||||
|
var backup_tabel_title = $( "#backup-add-table-overview" ).attr('title');
|
||||||
|
var addBackupDialog = $( "#backup-add-table" ).dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 600,
|
||||||
|
modal: true,
|
||||||
|
title: backup_tabel_title,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
"Add": function () {
|
||||||
|
addBackup(this);
|
||||||
|
},
|
||||||
|
Cancel: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
clearTips();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#add-backup-s3-button').click(function() {
|
||||||
|
addS3BackupDialog.dialog('open');
|
||||||
|
});
|
||||||
|
var s3_backup_tabel_title = $( "#s3-backup-add-table-overview" ).attr('title');
|
||||||
|
var addS3BackupDialog = $( "#s3-backup-add-table" ).dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 600,
|
||||||
|
modal: true,
|
||||||
|
title: s3_backup_tabel_title,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
"Add": function () {
|
||||||
|
addS3Backup(this);
|
||||||
|
},
|
||||||
|
Cancel: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
clearTips();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#add-git-button').click(function() {
|
||||||
|
addGitDialog.dialog('open');
|
||||||
|
});
|
||||||
|
var git_tabel_title = $( "#git-add-table-overview" ).attr('title');
|
||||||
|
var addGitDialog = $( "#git-add-table" ).dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 600,
|
||||||
|
modal: true,
|
||||||
|
title: git_tabel_title,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
buttons: {
|
||||||
|
"Add": function () {
|
||||||
|
addGit(this);
|
||||||
|
},
|
||||||
|
Cancel: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
clearTips();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('#git-init').click(function() {
|
||||||
|
if ($('#git-init').is(':checked')) {
|
||||||
|
$('.git-init-params').show();
|
||||||
|
} else {
|
||||||
|
$('.git-init-params').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#ajax-backup-table input" ).change(function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateBackup(id[2])
|
||||||
|
});
|
||||||
|
$( "#ajax-backup-table select" ).on('selectmenuchange',function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateBackup(id[2])
|
||||||
|
});
|
||||||
|
$("#backup_tabs ul li").click(function() {
|
||||||
|
$('.menu li ul li').each(function () {
|
||||||
|
$(this).find('a').css('border-left', '0px solid var(--right-menu-blue-rolor)');
|
||||||
|
$(this).find('a').css('padding-left', '20px')
|
||||||
|
$(this).children(".backup").css('padding-left', '30px');
|
||||||
|
$(this).children(".backup").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function loadBackup() {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/backup",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('danger') != '-1' || data.indexOf('unique') != '-1' || data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$('#backup').html(data);
|
||||||
|
$.getScript('/app/static/js/backup.js');
|
||||||
|
$("select").selectmenu();
|
||||||
|
$.getScript(awesome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function addBackup(dialog_id) {
|
||||||
|
var valid = true;
|
||||||
|
toastr.clear();
|
||||||
|
let allFields = $([]).add($('#backup-server')).add($('#rserver')).add($('#rpath')).add($('#backup-time')).add($('#backup-credentials'));
|
||||||
|
allFields.removeClass("ui-state-error");
|
||||||
|
valid = valid && checkLength($('#backup-server'), "backup server ", 1);
|
||||||
|
valid = valid && checkLength($('#rserver'), "remote server", 1);
|
||||||
|
valid = valid && checkLength($('#rpath'), "remote path", 1);
|
||||||
|
valid = valid && checkLength($('#backup-time'), "backup time", 1);
|
||||||
|
valid = valid && checkLength($('#backup-credentials'), "backup credentials", 1);
|
||||||
|
if (valid) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/backup/create",
|
||||||
|
data: {
|
||||||
|
server: $('#backup-server').val(),
|
||||||
|
rserver: $('#rserver').val(),
|
||||||
|
rpath: $('#rpath').val(),
|
||||||
|
type: $('#backup-type').val(),
|
||||||
|
time: $('#backup-time').val(),
|
||||||
|
cred: $('#backup-credentials').val(),
|
||||||
|
description: $('#backup-description').val(),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else if (data.indexOf('info: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
} else if (data.indexOf('warning: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.warning(data);
|
||||||
|
} else {
|
||||||
|
common_ajax_action_after_success(dialog_id, 'newbackup', 'ajax-backup-table', data);
|
||||||
|
$("select").selectmenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function addS3Backup(dialog_id) {
|
||||||
|
var valid = true;
|
||||||
|
toastr.clear();
|
||||||
|
allFields = $([]).add($('#s3-backup-server')).add($('#s3_server')).add($('#s3_bucket')).add($('#s3_secret_key')).add($('#s3_access_key'))
|
||||||
|
allFields.removeClass("ui-state-error");
|
||||||
|
valid = valid && checkLength($('#s3-backup-server'), "backup server ", 1);
|
||||||
|
valid = valid && checkLength($('#s3_server'), "S3 server", 1);
|
||||||
|
valid = valid && checkLength($('#s3_bucket'), "S3 bucket", 1);
|
||||||
|
valid = valid && checkLength($('#s3_secret_key'), "S3 secret key", 1);
|
||||||
|
valid = valid && checkLength($('#s3_access_key'), "S3 access key", 1);
|
||||||
|
if (valid) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/s3backup/create",
|
||||||
|
data: {
|
||||||
|
s3_backup_server: $('#s3-backup-server').val(),
|
||||||
|
s3_server: $('#s3_server').val(),
|
||||||
|
s3_bucket: $('#s3_bucket').val(),
|
||||||
|
s3_secret_key: $('#s3_secret_key').val(),
|
||||||
|
s3_access_key: $('#s3_access_key').val(),
|
||||||
|
time: $('#s3-backup-time').val(),
|
||||||
|
description: $('#s3-backup-description').val(),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else if (data.indexOf('info: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
} else if (data.indexOf('warning: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.warning(data);
|
||||||
|
} else if (data.indexOf('error: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
common_ajax_action_after_success(dialog_id, 'newbackup', 'ajax-backup-s3-table', data);
|
||||||
|
$("select").selectmenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function addGit(dialog_id) {
|
||||||
|
var valid = true;
|
||||||
|
toastr.clear();
|
||||||
|
allFields = $([]).add($('#git-server')).add($('#git-service')).add($('#git-time')).add($('#git-credentials')).add($('#git-branch'))
|
||||||
|
allFields.removeClass("ui-state-error");
|
||||||
|
valid = valid && checkLength($('#git-server'), "Server ", 1);
|
||||||
|
valid = valid && checkLength($('#git-service'), "Service", 1);
|
||||||
|
valid = valid && checkLength($('#git-credentials'), "Credentials", 1);
|
||||||
|
valid = valid && checkLength($('#git-branch'), "Branch name", 1);
|
||||||
|
var git_init = 0;
|
||||||
|
if ($('#git-init').is(':checked')) {
|
||||||
|
git_init = '1';
|
||||||
|
}
|
||||||
|
if (valid) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/git/create",
|
||||||
|
data: {
|
||||||
|
server: $('#git-server').val(),
|
||||||
|
git_service: $('#git-service').val(),
|
||||||
|
git_init: git_init,
|
||||||
|
git_repo: $('#git-repo').val(),
|
||||||
|
git_branch: $('#git-branch').val(),
|
||||||
|
time: $('#git-time').val(),
|
||||||
|
cred: $('#git-credentials').val(),
|
||||||
|
description: $('#git-description').val(),
|
||||||
|
git_deljob: 0,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else if (data.indexOf('success: ') != '-1') {
|
||||||
|
common_ajax_action_after_success(dialog_id, 'newgit', 'ajax-git-table', data);
|
||||||
|
$("select").selectmenu();
|
||||||
|
} else if (data.indexOf('info: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
} else if (data.indexOf('warning: ') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.warning(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function confirmDeleteBackup(id) {
|
||||||
|
$("#dialog-confirm").dialog({
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 400,
|
||||||
|
modal: true,
|
||||||
|
title: delete_word + " " + $('#backup-server-' + id).val() + "?",
|
||||||
|
buttons: [{
|
||||||
|
text: delete_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
removeBackup(id);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function confirmDeleteS3Backup(id) {
|
||||||
|
$("#dialog-confirm").dialog({
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 400,
|
||||||
|
modal: true,
|
||||||
|
title: delete_word + " " + $('#backup-s3-server-' + id).val() + "?",
|
||||||
|
buttons: [{
|
||||||
|
text: delete_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
removeS3Backup(id);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function confirmDeleteGit(id) {
|
||||||
|
$("#dialog-confirm").dialog({
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 400,
|
||||||
|
modal: true,
|
||||||
|
title: delete_word + " " + $('#git-server-' + id).text() + "?",
|
||||||
|
buttons: [{
|
||||||
|
text: delete_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
removeGit(id);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function cloneBackup(id) {
|
||||||
|
$( "#add-backup-button" ).trigger( "click" );
|
||||||
|
$('#rserver').val($('#backup-rserver-'+id).val())
|
||||||
|
$('#rpath').val($('#backup-rpath-'+id).val())
|
||||||
|
$('#backup-type').val($('#backup-type-'+id+' option:selected').val()).change()
|
||||||
|
$('#backup-type').selectmenu("refresh");
|
||||||
|
$('#backup-time').val($('#backup-time-'+id+' option:selected').val()).change()
|
||||||
|
$('#backup-time').selectmenu("refresh");
|
||||||
|
$('#backup-credentials').val($('#backup-credentials-'+id+' option:selected').val()).change()
|
||||||
|
$('#backup-credentials').selectmenu("refresh");
|
||||||
|
}
|
||||||
|
function removeBackup(id) {
|
||||||
|
$("#backup-table-" + id).css("background-color", "#f2dede");
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/backup/delete",
|
||||||
|
data: {
|
||||||
|
deljob: id,
|
||||||
|
cred: $('#backup-credentials-' + id).val(),
|
||||||
|
server: $('#backup-server-' + id).text(),
|
||||||
|
rserver: $('#backup-rserver-' + id).val(),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('ok') != '-1') {
|
||||||
|
$("#backup-table-" + id).remove();
|
||||||
|
} else if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function removeS3Backup(id) {
|
||||||
|
$("#backup-table-s3-" + id).css("background-color", "#f2dede");
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/s3backup/delete",
|
||||||
|
data: {
|
||||||
|
dels3job: id,
|
||||||
|
s3_bucket: $('#bucket-' + id).text(),
|
||||||
|
s3_backup_server: $('#backup-s3-server-' + id).text(),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('ok') != '-1') {
|
||||||
|
$("#s3-backup-table-" + id).remove();
|
||||||
|
} else if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function removeGit(id) {
|
||||||
|
$("#git-table-" + id).css("background-color", "#f2dede");
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/git/delete",
|
||||||
|
data: {
|
||||||
|
git_backup: id,
|
||||||
|
git_deljob: 1,
|
||||||
|
git_init: 0,
|
||||||
|
repo: 0,
|
||||||
|
branch: 0,
|
||||||
|
time: 0,
|
||||||
|
cred: $('#git-credentials-id-' + id).text(),
|
||||||
|
server: $('#git-server-id-' + id).text(),
|
||||||
|
git_service: $('#git-service-id-' + id).text(),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('ok') != '-1') {
|
||||||
|
$("#git-table-" + id).remove();
|
||||||
|
} else if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function updateBackup(id) {
|
||||||
|
toastr.clear();
|
||||||
|
if ($("#backup-type-" + id + " option:selected").val() == "-------" || $('#backup-rserver-' + id).val() == '' || $('#backup-rpath-' + id).val() == '') {
|
||||||
|
toastr.error('All fields must be completed');
|
||||||
|
} else {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/server/backup/update",
|
||||||
|
data: {
|
||||||
|
backupupdate: id,
|
||||||
|
server: $('#backup-server-' + id).text(),
|
||||||
|
rserver: $('#backup-rserver-' + id).val(),
|
||||||
|
rpath: $('#backup-rpath-' + id).val(),
|
||||||
|
type: $('#backup-type-' + id).val(),
|
||||||
|
time: $('#backup-time-' + id).val(),
|
||||||
|
cred: $('#backup-credentials-' + id).val(),
|
||||||
|
description: $('#backup-description-' + id).val(),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#backup-table-" + id).addClass("update", 1000);
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#backup-table-" + id).removeClass("update");
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,310 @@
|
||||||
|
var awesome = "/inc/fontawesome.min.js";
|
||||||
|
var add_word = $('#translate').attr('data-add');
|
||||||
|
var delete_word = $('#translate').attr('data-delete');
|
||||||
|
var cancel_word = $('#translate').attr('data-cancel');
|
||||||
|
var cur_url = window.location.href.split('/app/').pop();
|
||||||
|
cur_url = cur_url.split('/');
|
||||||
|
$( function() {
|
||||||
|
$('#add-telegram-button').click(function() {
|
||||||
|
addTelegramDialog.dialog('open');
|
||||||
|
});
|
||||||
|
$('#add-slack-button').click(function() {
|
||||||
|
addSlackDialog.dialog('open');
|
||||||
|
});
|
||||||
|
$('#add-pd-button').click(function() {
|
||||||
|
addPDDialog.dialog('open');
|
||||||
|
});
|
||||||
|
var telegram_tabel_title = $( "#telegram-add-table-overview" ).attr('title');
|
||||||
|
var addTelegramDialog = $( "#telegram-add-table" ).dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 600,
|
||||||
|
modal: true,
|
||||||
|
title: telegram_tabel_title,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
buttons: [{
|
||||||
|
text: add_word,
|
||||||
|
click: function () {
|
||||||
|
addRecevier(this, 'telegram');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
clearTips();
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
var slack_tabel_title = $( "#slack-add-table-overview" ).attr('title');
|
||||||
|
var addSlackDialog = $( "#slack-add-table" ).dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 600,
|
||||||
|
modal: true,
|
||||||
|
title: slack_tabel_title,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
buttons: [{
|
||||||
|
text: add_word,
|
||||||
|
click: function () {
|
||||||
|
addRecevier(this, 'slack');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
clearTips();
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
var pd_tabel_title = $( "#pd-add-table-overview" ).attr('title');
|
||||||
|
var addPDDialog = $( "#pd-add-table" ).dialog({
|
||||||
|
autoOpen: false,
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 600,
|
||||||
|
modal: true,
|
||||||
|
title: pd_tabel_title,
|
||||||
|
show: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
hide: {
|
||||||
|
effect: "fade",
|
||||||
|
duration: 200
|
||||||
|
},
|
||||||
|
buttons: [{
|
||||||
|
text: add_word,
|
||||||
|
click: function () {
|
||||||
|
addRecevier(this, 'pd');
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
clearTips();
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
$( "#checker_telegram_table input" ).change(function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateReceiver(id[2], 'telegram')
|
||||||
|
});
|
||||||
|
$( "#checker_telegram_table select" ).on('selectmenuchange',function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateReceiver(id[1], 'telegram')
|
||||||
|
});
|
||||||
|
$( "#checker_slack_table input" ).change(function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateReceiver(id[2], 'slack')
|
||||||
|
});
|
||||||
|
$( "#checker_slack_table select" ).on('selectmenuchange',function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateReceiver(id[1], 'slack')
|
||||||
|
});
|
||||||
|
$( "#checker_pd_table input" ).change(function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateReceiver(id[2], 'pd')
|
||||||
|
});
|
||||||
|
$( "#checker_pd_table select" ).on('selectmenuchange',function() {
|
||||||
|
var id = $(this).attr('id').split('-');
|
||||||
|
updateReceiver(id[1], 'pd')
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function loadChannel() {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/load",
|
||||||
|
type: "GET",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('group_error') == '-1' && data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
$('#checker').html(data);
|
||||||
|
$( "select" ).selectmenu();
|
||||||
|
$("button").button();
|
||||||
|
$( "input[type=checkbox]" ).checkboxradio();
|
||||||
|
$.getScript('/app/static/js/channel.js');
|
||||||
|
$.getScript(awesome);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
function updateReceiver(id, receiver_name) {
|
||||||
|
if (cur_url[0].indexOf('servers') != '-1') {
|
||||||
|
var group = $('#new-group').val();
|
||||||
|
} else {
|
||||||
|
var group = $('#' + receiver_name + 'group-' + id).val();
|
||||||
|
}
|
||||||
|
toastr.clear();
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/receiver/" + receiver_name,
|
||||||
|
data: {
|
||||||
|
receiver_token: $('#' + receiver_name + '-token-' + id).val(),
|
||||||
|
channel: $('#' + receiver_name + '-chanel-' + id).val(),
|
||||||
|
group: group,
|
||||||
|
id: id,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "PUT",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
$("#" + receiver_name + "-table-" + id).addClass("update", 1000);
|
||||||
|
setTimeout(function () {
|
||||||
|
$("#" + receiver_name + "-table-" + id).removeClass("update");
|
||||||
|
}, 2500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function checkReceiver(channel_id, receiver_name) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/check/" + channel_id + "/" + receiver_name,
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('error_code') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.success('Test message has been sent');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function addRecevier(dialog_id, receiver_name) {
|
||||||
|
var valid = true;
|
||||||
|
toastr.clear();
|
||||||
|
let allFields = $([]).add($('#' + receiver_name + '-token-add')).add($('#' + receiver_name + '-chanel-add'));
|
||||||
|
allFields.removeClass("ui-state-error");
|
||||||
|
valid = valid && checkLength($('#' + receiver_name + '-token-add'), "token", 1);
|
||||||
|
valid = valid && checkLength($('#' + receiver_name + '-chanel-add'), "channel name", 1);
|
||||||
|
if (valid) {
|
||||||
|
toastr.clear();
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/receiver/" + receiver_name,
|
||||||
|
data: {
|
||||||
|
receiver: $('#' + receiver_name + '-token-add').val(),
|
||||||
|
channel: $('#' + receiver_name + '-chanel-add').val(),
|
||||||
|
group: $('#new-' + receiver_name + '-group-add').val(),
|
||||||
|
page: cur_url[0].split('#')[0],
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
var getId = new RegExp(receiver_name + '-table-[0-9]+');
|
||||||
|
var id = data.match(getId) + '';
|
||||||
|
id = id.split('-').pop();
|
||||||
|
$('select:regex(id, ' + receiver_name + '_channel)').append('<option value=' + id + '>' + $('#' + receiver_name + '-chanel-add').val() + '</option>').selectmenu("refresh");
|
||||||
|
common_ajax_action_after_success(dialog_id, 'newgroup', 'checker_' + receiver_name + '_table', data);
|
||||||
|
$("input[type=submit], button").button();
|
||||||
|
$("input[type=checkbox]").checkboxradio();
|
||||||
|
$("select").selectmenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function confirmDeleteReceiver(id, receiver_name) {
|
||||||
|
$( "#dialog-confirm-services" ).dialog({
|
||||||
|
resizable: false,
|
||||||
|
height: "auto",
|
||||||
|
width: 400,
|
||||||
|
modal: true,
|
||||||
|
title: delete_word + " " + $('#' + receiver_name + '-chanel-' + id).val() + "?",
|
||||||
|
buttons: [{
|
||||||
|
text: delete_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
removeReceiver(receiver_name, id);
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
text: cancel_word,
|
||||||
|
click: function () {
|
||||||
|
$(this).dialog("close");
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function cloneReceiver(id, receiver_name) {
|
||||||
|
$('#add-'+receiver_name+'-button').trigger( "click" );
|
||||||
|
$('#'+receiver_name+'-token-add').val($('#'+receiver_name+'-token-'+id).val());
|
||||||
|
$('#'+receiver_name+'-chanel-add').val($('#'+receiver_name+'-chanel-'+id).val());
|
||||||
|
}
|
||||||
|
function removeReceiver(receiver_name, receiver_id) {
|
||||||
|
$("#" + receiver_name + "-table-" + receiver_id).css("background-color", "#f2dede");
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/receiver/" + receiver_name,
|
||||||
|
data: {
|
||||||
|
channel_id: receiver_id,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "DELETE",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data == "ok") {
|
||||||
|
$("#" + receiver_name + "-table-" + receiver_id).remove();
|
||||||
|
} else if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function checkWebPanel() {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/check/rabbit",
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('error_code') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.success('Test message has been sent');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function checkEmail() {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/channel/check/email",
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('error_code') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.success('Test message has been sent');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
|
@ -0,0 +1,310 @@
|
||||||
|
$( function() {
|
||||||
|
$('#install').click(function () {
|
||||||
|
installService('haproxy')
|
||||||
|
});
|
||||||
|
$('#nginx_install').click(function () {
|
||||||
|
installService('nginx');
|
||||||
|
});
|
||||||
|
$('#apache_install').click(function () {
|
||||||
|
installService('apache');
|
||||||
|
});
|
||||||
|
$('#grafana_install').click(function () {
|
||||||
|
$("#ajaxmon").html('');
|
||||||
|
$("#ajaxmon").html(wait_mess);
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/install/grafana",
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
$("#ajaxmon").html('');
|
||||||
|
if (data.indexOf('FAILED') != '-1' || data.indexOf('UNREACHABLE') != '-1' || data.indexOf('ERROR') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
var p_err = show_pretty_ansible_error(data);
|
||||||
|
toastr.error(p_err);
|
||||||
|
} else if (data.indexOf('success') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.success(data);
|
||||||
|
} else if (data.indexOf('Info') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
$('#haproxy_exp_install').click(function () {
|
||||||
|
installExporter('haproxy');
|
||||||
|
});
|
||||||
|
$('#nginx_exp_install').click(function () {
|
||||||
|
installExporter('nginx');
|
||||||
|
});
|
||||||
|
$('#apache_exp_install').click(function () {
|
||||||
|
installExporter('apache');
|
||||||
|
});
|
||||||
|
$('#keepalived_exp_install').click(function () {
|
||||||
|
installExporter('keepalived');
|
||||||
|
});
|
||||||
|
$('#node_exp_install').click(function () {
|
||||||
|
installExporter('node');
|
||||||
|
});
|
||||||
|
$("#haproxyaddserv").on('selectmenuchange', function () {
|
||||||
|
showServiceVersion('haproxy');
|
||||||
|
});
|
||||||
|
$("#nginxaddserv").on('selectmenuchange', function () {
|
||||||
|
showServiceVersion('nginx');
|
||||||
|
});
|
||||||
|
$("#apacheaddserv").on('selectmenuchange', function () {
|
||||||
|
showServiceVersion('apache');
|
||||||
|
});
|
||||||
|
$("#haproxy_exp_addserv").on('selectmenuchange', function () {
|
||||||
|
showExporterVersion('haproxy');
|
||||||
|
});
|
||||||
|
$("#nginx_exp_addserv").on('selectmenuchange', function () {
|
||||||
|
showExporterVersion('nginx');
|
||||||
|
});
|
||||||
|
$("#apache_exp_addserv").on('selectmenuchange', function () {
|
||||||
|
showExporterVersion('apache');
|
||||||
|
});
|
||||||
|
$("#keepalived_exp_addserv").on('selectmenuchange', function () {
|
||||||
|
showExporterVersion('keepalived');
|
||||||
|
});
|
||||||
|
$("#node_exp_addserv").on('selectmenuchange', function () {
|
||||||
|
showExporterVersion('node');
|
||||||
|
});
|
||||||
|
$( "#geoipserv" ).on('selectmenuchange',function() {
|
||||||
|
if($('#geoip_service option:selected').val() != '------') {
|
||||||
|
checkGeoipInstallation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#geoip_service" ).on('selectmenuchange',function() {
|
||||||
|
if($('#geoipserv option:selected').val() != '------') {
|
||||||
|
checkGeoipInstallation();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$( "#geoip_install" ).click(function() {
|
||||||
|
var updating_geoip = 0;
|
||||||
|
if ($('#updating_geoip').is(':checked')) {
|
||||||
|
updating_geoip = '1';
|
||||||
|
}
|
||||||
|
$("#ajax-geoip").html(wait_mess);
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/install/geoip",
|
||||||
|
data: {
|
||||||
|
server_ip: $('#geoipserv option:selected').val(),
|
||||||
|
service: $('#geoip_service option:selected').val(),
|
||||||
|
update: updating_geoip,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/^\s+|\s+$/g, '');
|
||||||
|
$("#ajax-geoip").html('')
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('FAILED') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
var p_err = show_pretty_ansible_error(data);
|
||||||
|
toastr.error(p_err);
|
||||||
|
} else if (data.indexOf('success:') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.success(data);
|
||||||
|
$("#geoip_service").trigger("selectmenuchange");
|
||||||
|
} else if (data.indexOf('Info') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.info(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
function checkGeoipInstallation() {
|
||||||
|
$.ajax( {
|
||||||
|
url: "/app/install/geoip/" + $('#geoip_service option:selected').val() + "/" + $('#geoipserv option:selected').val(),
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function( data ) {
|
||||||
|
data = data.replace(/^\s+|\s+$/g,'');
|
||||||
|
if(data.indexOf('No such file or directory') != '-1' || data.indexOf('cannot access') != '-1') {
|
||||||
|
$('#cur_geoip').html('<b style="color: var(--red-color)">GeoIPLite is not installed</b>');
|
||||||
|
$('#geoip_install').show();
|
||||||
|
} else {
|
||||||
|
$('#cur_geoip').html('<b style="color: var(--green-color)">GeoIPLite is installed<b>');
|
||||||
|
$('#geoip_install').hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
function installService(service) {
|
||||||
|
$("#ajax").html('')
|
||||||
|
var syn_flood = 0;
|
||||||
|
var docker = 0;
|
||||||
|
var select_id = '#' + service + 'addserv';
|
||||||
|
var nice_names = {'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache'};
|
||||||
|
if ($('#' + service + '_syn_flood').is(':checked')) {
|
||||||
|
syn_flood = '1';
|
||||||
|
}
|
||||||
|
if ($('#' + service + '_docker').is(':checked')) {
|
||||||
|
docker = '1';
|
||||||
|
}
|
||||||
|
if ($(select_id).val() == '------' || $(select_id).val() === null) {
|
||||||
|
var select_server = $('#translate').attr('data-select_server');
|
||||||
|
toastr.warning(select_server);
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
var jsonData = {};
|
||||||
|
jsonData['servers'] = {'0': {}}
|
||||||
|
jsonData['services'] = {};
|
||||||
|
jsonData['services'][service] = {};
|
||||||
|
jsonData['syn_flood'] = syn_flood;
|
||||||
|
jsonData['servers']['0']['ip'] = $(select_id).val();
|
||||||
|
jsonData['servers']['0']['master'] = '0';
|
||||||
|
jsonData['servers']['0']['name'] = $(select_id + ' option:selected').text();
|
||||||
|
if (service == 'haproxy') {
|
||||||
|
jsonData['servers']['0']['version'] = $('#hapver option:selected').val();
|
||||||
|
}
|
||||||
|
jsonData['services'][service]['enabled'] = 1;
|
||||||
|
jsonData['services'][service]['docker'] = docker;
|
||||||
|
$("#ajax").html(wait_mess);
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/install/" + service,
|
||||||
|
500: function () {
|
||||||
|
showErrorStatus(nice_names[service], $(select_id + ' option:selected').text());
|
||||||
|
},
|
||||||
|
504: function () {
|
||||||
|
showErrorStatus(nice_names[service], $(select_id + ' option:selected').text());
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
jsonData: JSON.stringify(jsonData),
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
try {
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
parseAnsibleJsonOutput(data, nice_names[service], select_id);
|
||||||
|
$(select_id).trigger("selectmenuchange");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function installExporter(exporter) {
|
||||||
|
$("#ajaxmon").html('');
|
||||||
|
$("#ajaxmon").html(wait_mess);
|
||||||
|
var exporter_id = '#' + exporter + '_exp_addserv';
|
||||||
|
var ext_prom = 0;
|
||||||
|
if ($('#' + exporter + '_ext_prom').is(':checked')) {
|
||||||
|
ext_prom = '1';
|
||||||
|
}
|
||||||
|
var nice_names = {'haproxy': 'HAProxy exporter', 'nginx': 'NGINX exporter', 'apache': 'Apache exporter', 'node': 'Node exporter', 'keepalived': 'Keepalived exporter'};
|
||||||
|
$("#ajax").html(wait_mess);
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/install/exporter/" + exporter,
|
||||||
|
500: function () {
|
||||||
|
showErrorStatus(nice_names[exporter], $(exporter_id + ' option:selected').text());
|
||||||
|
},
|
||||||
|
504: function () {
|
||||||
|
showErrorStatus(nice_names[exporter], $(exporter_id + ' option:selected').text());
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
server_ip: $(exporter_id).val(),
|
||||||
|
exporter_v: $('#' + exporter + 'expver').val(),
|
||||||
|
ext_prom: ext_prom,
|
||||||
|
token: $('#token').val()
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
try {
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
parseAnsibleJsonOutput(data, nice_names[exporter], exporter_id);
|
||||||
|
$(exporter_id).trigger("selectmenuchange");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function showExporterVersion(exporter) {
|
||||||
|
var nice_names = {'haproxy': 'HAProxy', 'nginx': 'NGINX', 'apache': 'Apache', 'node': 'Node', 'keepalived': 'Keepalived'};
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/install/exporter/"+ exporter +"/version/" + $('#' + exporter + '_exp_addserv option:selected').val(),
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/^\s+|\s+$/g, '');
|
||||||
|
if (data.indexOf('error:') != '-1') {
|
||||||
|
toastr.clear();
|
||||||
|
toastr.error(data);
|
||||||
|
} else if (data == 'no' || data.indexOf('command') != '-1' || data.indexOf('_exporter:') != '-1' || data == '') {
|
||||||
|
$('#cur_'+ exporter +'_exp_ver').text(nice_names[exporter]+' exporter has not been installed');
|
||||||
|
} else {
|
||||||
|
$('#cur_'+ exporter +'_exp_ver').text(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function showServiceVersion(service) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/install/" + service + "/version/" + $('#' + service + 'addserv option:selected').val(),
|
||||||
|
// data: {
|
||||||
|
// token: $('#token').val()
|
||||||
|
// },
|
||||||
|
// type: "POST",
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/^\s+|\s+$/g, '');
|
||||||
|
if (data.indexOf('error: ') != '-1') {
|
||||||
|
toastr.warning(data);
|
||||||
|
$('#cur_' + service + '_ver').text('');
|
||||||
|
} else if(data.indexOf('bash') != '-1' || data.indexOf('such') != '-1' || data.indexOf('command not found') != '-1' || data.indexOf('from') != '-1') {
|
||||||
|
$('#cur_' + service + '_ver').text(service + ' has not installed');
|
||||||
|
$('#' + service + '_install').text('Install');
|
||||||
|
$('#' + service + '_install').attr('title', 'Install');
|
||||||
|
} else if (data.indexOf('warning: ') != '-1') {
|
||||||
|
toastr.warning(data);
|
||||||
|
} else if (data == '') {
|
||||||
|
$('#cur_' + service + '_ver').text(service + ' has not installed');
|
||||||
|
$('#' + service + '_install').text('Install');
|
||||||
|
$('#' + service + '_install').attr('title', 'Install');
|
||||||
|
} else {
|
||||||
|
$('#cur_' + service + '_ver').text(data);
|
||||||
|
$('#cur_' + service + '_ver').css('font-weight', 'bold');
|
||||||
|
$('#' + service + '_install').text('Update');
|
||||||
|
$('#' + service + '_install').attr('title', 'Update');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function showErrorStatus(service_name, server) {
|
||||||
|
var something_wrong = $('#translate').attr('data-something_wrong');
|
||||||
|
toastr.error(something_wrong + ' ' + service_name + ' ' + server);
|
||||||
|
}
|
||||||
|
function parseAnsibleJsonOutput(output, service_name, select_id) {
|
||||||
|
output = JSON.parse(JSON.stringify(output));
|
||||||
|
var check_apache_log = $('#translate').attr('data-check_apache_log');
|
||||||
|
var was_installed = $('#translate').attr('data-was_installed');
|
||||||
|
for (var k in output['ok']) {
|
||||||
|
var server_name = $(select_id + ' option[value="'+k+'"]').text();
|
||||||
|
toastr.success(service_name + ' ' + was_installed +' ' + server_name);
|
||||||
|
}
|
||||||
|
for (var k in output['failures']) {
|
||||||
|
var server_name = $(select_id + ' option[value="'+k+'"]').text();
|
||||||
|
showErrorStatus(service_name, server_name);
|
||||||
|
}
|
||||||
|
for (var k in output['dark']) {
|
||||||
|
var server_name = $(select_id + ' option[value="'+k+'"]').text();
|
||||||
|
showErrorStatus(service_name, server_name);
|
||||||
|
}
|
||||||
|
}
|
|
@ -4,6 +4,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, select, copy_to_clipboard, checkbox %}
|
{% from 'include/input_macros.html' import input, select, copy_to_clipboard, checkbox %}
|
||||||
<script src="/inc/users.js"></script>
|
<script src="/inc/users.js"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/backup.js') }}"></script>
|
||||||
<script src="/inc/fontawesome.min.js"></script>
|
<script src="/inc/fontawesome.min.js"></script>
|
||||||
{% include 'include/del_confirm.html' %}
|
{% include 'include/del_confirm.html' %}
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
|
@ -131,9 +132,7 @@
|
||||||
<div id="ajax-update"></div>
|
<div id="ajax-update"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="backup">
|
<div id="backup"></div>
|
||||||
{% include 'include/admin_backup.html' %}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% include 'include/admins_dialogs.html' %}
|
{% include 'include/admins_dialogs.html' %}
|
||||||
<script>
|
<script>
|
||||||
|
|
|
@ -55,9 +55,9 @@
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
{% if action == 'smon' %}
|
{% if action == 'smon' %}
|
||||||
<a href="/app/smon/history/host/{{t.2}}" title="{{lang.words.open|title()}} {{lang.words.history}} {{lang.words.for}} {{t.2}} {{lang.words.host}}">{{t.2}}</a>
|
<a href="/app/smon/history/host/{{t.2|replace("'","")}}" title="{{lang.words.open|title()}} {{lang.words.history}} {{lang.words.for}} {{t.2}} {{lang.words.host}}">{{t.2|replace("'","")}}</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href="/app/history/server/{{t.2}}" title="{{lang.words.open|title()}} {{lang.words.history}} {{lang.words.for}} {{t.2}} {{lang.words.host}}">{{t.2}}</a>
|
<a href="/app/history/server/{{t.2|replace("'","")}}" title="{{lang.words.open|title()}} {{lang.words.history}} {{lang.words.for}} {{t.2}} {{lang.words.host}}">{{t.2|replace("'","")}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% if action != "checker" %}
|
{% if action != "checker" %}
|
||||||
|
|
|
@ -0,0 +1,186 @@
|
||||||
|
{% 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|title()}}" id="add-pd-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' %}
|
|
@ -21,192 +21,6 @@
|
||||||
{{lang.phrases.how_to_install_checker}}</h3>
|
{{lang.phrases.how_to_install_checker}}</h3>
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div id="checker_tabs">
|
|
||||||
<ul id="checker-tabs-head">
|
|
||||||
<li><a href="#channels" title="Checker {{lang.words.channels}} - Roxy-WI">{{lang.words.channels|title()}}</a></li>
|
|
||||||
<li><a href="#checker_settings" title="Checker {{lang.words.settings}} - Roxy-WI">{{lang.words.settings|title()}}</a></li>
|
|
||||||
</ul>
|
|
||||||
<div id="channels">
|
|
||||||
<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="loadchecker()" 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="loadchecker()" 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="loadchecker()" 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|title()}}" id="add-pd-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>
|
|
||||||
</div>
|
|
||||||
<div id="checker_settings">
|
<div id="checker_settings">
|
||||||
<table class="overview-overflow checker_settings_table" id="checker_haproxy_table">
|
<table class="overview-overflow checker_settings_table" id="checker_haproxy_table">
|
||||||
<caption><i class="fas fa-network-wired caption-icon"></i><h3>HAProxy {{lang.words.servers}}</h3></caption>
|
<caption><i class="fas fa-network-wired caption-icon"></i><h3>HAProxy {{lang.words.servers}}</h3></caption>
|
||||||
|
@ -532,7 +346,6 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
{% block title %} {{ lang.words.channels|title() }} {% endblock %}
|
||||||
|
{% block h2 %} {{ lang.words.channels|title() }} {% endblock %}
|
||||||
|
{% block content %}
|
||||||
|
{% from 'include/input_macros.html' import input, select, copy_to_clipboard, checkbox %}
|
||||||
|
<script src="{{ url_for('static', filename='js/channel.js') }}"></script>
|
||||||
|
<script src="/inc/fontawesome.min.js"></script>
|
||||||
|
<div id="checker"></div>
|
||||||
|
<script>
|
||||||
|
loadChannel();
|
||||||
|
</script>
|
||||||
|
{% endblock %}
|
|
@ -1,3 +1,5 @@
|
||||||
|
{% import 'languages/'+lang|default('en')+'.html' as lang %}
|
||||||
|
{% from 'include/input_macros.html' import input, select, copy_to_clipboard, checkbox %}
|
||||||
{% if not is_needed_tool %}
|
{% if not is_needed_tool %}
|
||||||
<div style="text-align: center;">
|
<div style="text-align: center;">
|
||||||
<h3>{{lang.admin_page.desc.no_ansible}} Ansible</h3>.
|
<h3>{{lang.admin_page.desc.no_ansible}} Ansible</h3>.
|
||||||
|
|
|
@ -174,7 +174,7 @@
|
||||||
{{ input('telegram-chanel-add') }}
|
{{ input('telegram-chanel-add') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if page != "servers.py" %}
|
{% if g.user_params['role'] == 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="padding20">{{lang.words.group|title()}}</td>
|
<td class="padding20">{{lang.words.group|title()}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -210,7 +210,7 @@
|
||||||
{{ input('slack-chanel-add') }}
|
{{ input('slack-chanel-add') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if page != "servers.py" %}
|
{% if g.user_params['role'] == 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="padding20">{{lang.words.group|title()}}</td>
|
<td class="padding20">{{lang.words.group|title()}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -246,7 +246,7 @@
|
||||||
{{ input('pd-chanel-add') }}
|
{{ input('pd-chanel-add') }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% if page != "servers.py" %}
|
{% if g.user_params['role'] == 1 %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="padding20">{{lang.words.group|title()}}</td>
|
<td class="padding20">{{lang.words.group|title()}}</td>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -90,6 +90,7 @@
|
||||||
<li><a href="{{ url_for('smon.smon_history') }}" title="{{lang.menu_links.monitoring.smon.history}}" class="lists head-submenu">{{lang.menu_links.monitoring.smon.history}}</a></li>
|
<li><a href="{{ url_for('smon.smon_history') }}" title="{{lang.menu_links.monitoring.smon.history}}" class="lists head-submenu">{{lang.menu_links.monitoring.smon.history}}</a></li>
|
||||||
{% if g.user_params['role'] <= 3 %}
|
{% if g.user_params['role'] <= 3 %}
|
||||||
<li><a href="{{ url_for('smon.agent') }}" title="{{lang.menu_links.monitoring.smon.agent}}" class="admin head-submenu">{{lang.menu_links.monitoring.smon.agent}}</a></li>
|
<li><a href="{{ url_for('smon.agent') }}" title="{{lang.menu_links.monitoring.smon.agent}}" class="admin head-submenu">{{lang.menu_links.monitoring.smon.agent}}</a></li>
|
||||||
|
<li><a href="{{ url_for('channel.channels') }}" title="{{lang.words.channels|title()}} {{ lang.words.for }} Checker {{ lang.words.and }} SMON" class="channel head-submenu">{{lang.words.channels|title}}</a></li>
|
||||||
<li><a href="{{ url_for('checker.checker_settings') }}" title="Checker: {{lang.words.settings}}" class="checker head-submenu">Checker: {{lang.words.settings|title()}}</a></li>
|
<li><a href="{{ url_for('checker.checker_settings') }}" title="Checker: {{lang.words.settings}}" class="checker head-submenu">Checker: {{lang.words.settings|title()}}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li><a href="{{ url_for('checker.checker_history') }}" title="{{lang.menu_links.monitoring.checker_history}}" class="lists head-submenu">{{lang.menu_links.monitoring.checker_history}}</a></li>
|
<li><a href="{{ url_for('checker.checker_history') }}" title="{{lang.menu_links.monitoring.checker_history}}" class="lists head-submenu">{{lang.menu_links.monitoring.checker_history}}</a></li>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% from 'include/input_macros.html' import select %}
|
{% from 'include/input_macros.html' import select %}
|
||||||
{% block title %}{{ lang.menu_links.history.title }} {{ smon_name }}{% endblock %}
|
{% block title %}{{ lang.menu_links.history.title }} {{ smon_name|replace("'","") }}{% endblock %}
|
||||||
{% block h2 %}{{ lang.menu_links.history.title }} {{ smon_name }}{% endblock %}
|
{% block h2 %}{{ lang.menu_links.history.title }} {{ smon_name|replace("'","") }}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% set checking_types = {'1': 'TCP/UDP', '2': 'HTTP', '4': 'Ping', '5': 'DNS'} %}
|
{% set checking_types = {'1': 'TCP/UDP', '2': 'HTTP', '4': 'Ping', '5': 'DNS'} %}
|
||||||
{% if user_subscription['user_status'] == 0 or user_subscription['user_plan'] == 'user' %}
|
{% if user_subscription['user_status'] == 0 or user_subscription['user_plan'] == 'user' %}
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
{% block h2 %}{{lang.words.admin_area|title()}}{% endblock %}
|
{% block h2 %}{{lang.words.admin_area|title()}}{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import select, checkbox %}
|
{% from 'include/input_macros.html' import select, checkbox %}
|
||||||
<script src="/inc/users.js"></script>
|
<script src="{{ url_for('static', filename='js/install.js') }}"></script>
|
||||||
<script src="/inc/fontawesome.min.js"></script>
|
<script src="/inc/fontawesome.min.js"></script>
|
||||||
<div id="tabs">
|
<div id="tabs">
|
||||||
<ul id="admin-tabs">
|
<ul id="admin-tabs">
|
||||||
|
@ -39,8 +39,8 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10 first-collumn" style="width: 20%;">
|
<td class="padding10 first-collumn" style="width: 20%;">
|
||||||
{% set values = dict() %}
|
{% set values = dict() %}
|
||||||
{% set values = {'2.4.23-1':'2.4.23-1','2.5.14-1':'2.5.14-1', '2.6.14-1':'2.6.14-1','2.7.9-1':'2.7.9-1','2.8.1-1':'2.8.1-1'} %}
|
{% set values = {'2.4.23-1':'2.4.23-1','2.5.14-1':'2.5.14-1', '2.6.14-1':'2.6.14-1','2.7.9-1':'2.7.9-1','2.8.1-1':'2.8.1-1','2.9.5-1':'2.9.5-1'} %}
|
||||||
{{ select('hapver', values=values, selected='2.8.1-1', required='required') }}
|
{{ select('hapver', values=values, selected='2.9.5-1', required='required') }}
|
||||||
</td>
|
</td>
|
||||||
<td class="padding10 first-collumn">
|
<td class="padding10 first-collumn">
|
||||||
<select autofocus required name="haproxyaddserv" id="haproxyaddserv">
|
<select autofocus required name="haproxyaddserv" id="haproxyaddserv">
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% from 'include/input_macros.html' import input, checkbox, select, copy_to_clipboard %}
|
{% from 'include/input_macros.html' import input, checkbox, select, copy_to_clipboard %}
|
||||||
<script src="/inc/users.js"></script>
|
<script src="/inc/users.js"></script>
|
||||||
|
<script src="{{ url_for('static', filename='js/backup.js') }}"></script>
|
||||||
{% include 'include/del_confirm.html' %}
|
{% include 'include/del_confirm.html' %}
|
||||||
<input type="hidden" id="new-group" name="new-group" value="{{ group }}">
|
<input type="hidden" id="new-group" name="new-group" value="{{ group }}">
|
||||||
<input type="hidden" id="new-server-group-add" name="new-server-group-add" value="{{ group }}" >
|
<input type="hidden" id="new-server-group-add" name="new-server-group-add" value="{{ group }}" >
|
||||||
|
@ -35,9 +36,7 @@
|
||||||
{% include 'include/admin_settings.html' %}
|
{% include 'include/admin_settings.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="backup">
|
<div id="backup"></div>
|
||||||
{% include 'include/admin_backup.html' %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% include 'include/admins_dialogs.html' %}
|
{% include 'include/admins_dialogs.html' %}
|
||||||
|
|
|
@ -1106,29 +1106,7 @@ $( function() {
|
||||||
$(this).children(".settings").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
$(this).children(".settings").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
||||||
$(this).children(".settings").css('background-color', 'var(--right-menu-blue-rolor)');
|
$(this).children(".settings").css('background-color', 'var(--right-menu-blue-rolor)');
|
||||||
});
|
});
|
||||||
$("#tabs").tabs("option", "active", 4);
|
$("#tabs").tabs("option", "active", 3);
|
||||||
});
|
|
||||||
$(".installproxy").on("click", function () {
|
|
||||||
$('.menu li ul li').each(function () {
|
|
||||||
$(this).find('a').css('padding-left', '20px');
|
|
||||||
$(this).find('a').css('border-left', '0px solid var(--right-menu-blue-rolor)');
|
|
||||||
$(this).find('a').css('background-color', '#48505A');
|
|
||||||
$(this).children(".installproxy").css('padding-left', '30px');
|
|
||||||
$(this).children(".installproxy").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
|
||||||
$(this).children(".installproxy").css('background-color', 'var(--right-menu-blue-rolor)');
|
|
||||||
});
|
|
||||||
$("#tabs").tabs("option", "active", 5);
|
|
||||||
});
|
|
||||||
$(".installmon").on("click", function () {
|
|
||||||
$('.menu li ul li').each(function () {
|
|
||||||
$(this).find('a').css('padding-left', '20px');
|
|
||||||
$(this).find('a').css('border-left', '0px solid var(--right-menu-blue-rolor)');
|
|
||||||
$(this).find('a').css('background-color', '#48505A');
|
|
||||||
$(this).children(".installmon").css('padding-left', '30px');
|
|
||||||
$(this).children(".installmon").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
|
||||||
$(this).children(".installmon").css('background-color', 'var(--right-menu-blue-rolor)');
|
|
||||||
});
|
|
||||||
$("#tabs").tabs("option", "active", 6);
|
|
||||||
});
|
});
|
||||||
$(".backup").on("click", function () {
|
$(".backup").on("click", function () {
|
||||||
$('.menu li ul li').each(function () {
|
$('.menu li ul li').each(function () {
|
||||||
|
@ -1139,7 +1117,8 @@ $( function() {
|
||||||
$(this).children(".backup").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
$(this).children(".backup").css('border-left', '4px solid var(--right-menu-blue-rolor)');
|
||||||
$(this).children(".backup").css('background-color', 'var(--right-menu-blue-rolor)');
|
$(this).children(".backup").css('background-color', 'var(--right-menu-blue-rolor)');
|
||||||
});
|
});
|
||||||
$("#tabs").tabs("option", "active", 7);
|
$("#tabs").tabs("option", "active", 4);
|
||||||
|
loadBackup();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ function getCheckSettings(smon_id, check_type) {
|
||||||
async: false,
|
async: false,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function( data ) {
|
success: function( data ) {
|
||||||
$('#new-smon-name').val(data['name']);
|
$('#new-smon-name').val(data['name'].replaceAll("'", ""));
|
||||||
$('#new-smon-ip').val(data['server_ip']);
|
$('#new-smon-ip').val(data['server_ip']);
|
||||||
$('#new-smon-port').val(data['port']);
|
$('#new-smon-port').val(data['port']);
|
||||||
$('#new-smon-resolver-server').val(data['resolver']);
|
$('#new-smon-resolver-server').val(data['resolver']);
|
||||||
|
|
1048
inc/users.js
1048
inc/users.js
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue