Aidaho 2024-05-03 15:22:58 +03:00
parent bd5af37255
commit b66c4d0793
23 changed files with 390 additions and 394 deletions

View File

@ -755,7 +755,7 @@ def update_db_v_7_2_3():
def update_ver():
try:
Version.update(version='7.2.4.0').execute()
Version.update(version='7.2.5.0').execute()
except Exception:
print('Cannot update version')

View File

@ -174,6 +174,8 @@ def select_metrics(serv, service, **kwargs):
date_from = "and date > CONVERT_TZ(NOW(),'SYSTEM','+0:00') - INTERVAL 360 minute group by `date` div 300"
elif kwargs.get('time_range') == '720':
date_from = "and date > CONVERT_TZ(NOW(),'SYSTEM','+0:00') - INTERVAL 720 minute group by `date` div 500"
elif kwargs.get('time_range') == '1':
date_from = "and date > CONVERT_TZ(NOW(),'SYSTEM','+0:00') - INTERVAL 1 minute"
else:
date_from = "and date > CONVERT_TZ(NOW(),'SYSTEM','+0:00') - INTERVAL 30 minute"
sql = """ select * from {metrics_table} where serv = '{serv}' {date_from} order by `date` asc """.format(
@ -188,6 +190,8 @@ def select_metrics(serv, service, **kwargs):
date_from = "and date > datetime('now', '-360 minutes', 'UTC') and rowid % 7 = 0"
elif kwargs.get('time_range') == '720':
date_from = "and date > datetime('now', '-720 minutes', 'UTC') and rowid % 9 = 0"
elif kwargs.get('time_range') == '1':
date_from = "and date > datetime('now', '-1 minutes', 'UTC')"
else:
date_from = "and date > datetime('now', '-30 minutes', 'UTC')"

View File

@ -61,7 +61,7 @@ def is_admin(level=1, **kwargs):
def page_for_admin(level=1) -> None:
if not is_admin(level=level):
return abort(400, 'bad permission')
return abort(404, 'Not found')
def check_in_ldap(user, password):

View File

@ -11,14 +11,14 @@ def show_ram_metrics(metrics_type: str) -> dict:
if metrics_type == '1':
rams_list = psutil.virtual_memory()
rams += str(round(rams_list.total / 1048576, 2)) + ' '
rams += str(round(rams_list.used / 1048576, 2)) + ' '
rams += str(round(rams_list.free / 1048576, 2)) + ' '
rams += str(round(rams_list.shared / 1048576, 2)) + ' '
rams += str(round(rams_list.cached / 1048576, 2)) + ' '
rams += str(round(rams_list.available / 1048576, 2)) + ' '
rams += str(round(rams_list.total / 1048576, 2)) + ' '
else:
commands = ["free -m |grep Mem |awk '{print $2,$3,$4,$5,$6,$7}'"]
commands = ["free -m |grep Mem |awk '{print $3,$4,$5,$6,$7,$2}'"]
metric, error = server_mod.subprocess_execute(commands[0])
for i in metric:
@ -34,7 +34,8 @@ def show_cpu_metrics(metrics_type: str) -> dict:
cpus = ''
if metrics_type == '1':
cpus_list = psutil.cpu_times_percent(interval=1, percpu=False)
total = psutil.cpu_percent(0.5)
cpus_list = psutil.cpu_times_percent(interval=0.5, percpu=False)
cpus += str(cpus_list.user) + ' '
cpus += str(cpus_list.system) + ' '
cpus += str(cpus_list.nice) + ' '
@ -43,13 +44,15 @@ def show_cpu_metrics(metrics_type: str) -> dict:
cpus += str(cpus_list.irq) + ' '
cpus += str(cpus_list.softirq) + ' '
cpus += str(cpus_list.steal) + ' '
cpus += str(total) + ' '
else:
commands = [
"top -b -n 1 |grep Cpu |awk -F':' '{print $2}'|awk -F' ' 'BEGIN{ORS=\" \";} { for (i=1;i<=NF;i+=2) print $i}'"]
metric, error = server_mod.subprocess_execute(commands[0])
cmd = "top -d 0.5 -b -n2 | grep 'Cpu(s)'|tail -n 1 | awk '{print $2 + $4}'"
total, error = server_mod.subprocess_execute(cmd)
cmd = "top -b -n 1 |grep Cpu |awk -F':' '{print $2}'|awk -F' ' 'BEGIN{ORS=\" \";} { for (i=1;i<=NF;i+=2) print $i}'"
metric, error = server_mod.subprocess_execute(cmd)
for i in metric:
cpus = i
cpus += f'{total[0]}'
metrics['chartData']['cpus'] = cpus

View File

@ -2,6 +2,7 @@ import os
from cryptography.fernet import Fernet
import paramiko
from paramiko import RSAKey, DSSKey, ECDSAKey, Ed25519Key, PKey
from flask import render_template, request
import app.modules.db.cred as cred_sql
@ -117,7 +118,36 @@ def create_ssh_cread_api(name: str, enable: str, group: str, username: str, pass
roxywi_common.handle_exceptions(e, 'Roxy-WI server', f'Cannot create SSH credentials {name}', roxywi=1)
def get_key_class_name(uploaded_key, passphrase):
for pkey_class in (ECDSAKey, RSAKey, DSSKey, Ed25519Key):
try:
key = pkey_class.from_private_key(uploaded_key, passphrase)
class_name = str(pkey_class).split('.')[-1].rstrip(">'")
print(class_name)
# return class_name
return key
except Exception as e:
print("An exception occurred: {}".format(e))
pass
def proper_method_call(filepath, passphrase):
key_class_name = get_key_class_name(filepath, passphrase)
print('key_class_name',key_class_name)
key_class = getattr(paramiko, key_class_name)
key_method = getattr(key_class, "from_private_key")
print('filepath',filepath)
try:
key = key_method(filepath, passphrase)
except Exception as e:
raise Exception(f'something went wrong: {e}')
return key
def upload_ssh_key(name: str, user_group: str, key: str, passphrase: str) -> str:
import io
if '..' in name:
raise Exception('error: nice try')
@ -125,9 +155,15 @@ def upload_ssh_key(name: str, user_group: str, key: str, passphrase: str) -> str
raise Exception('error: please select credentials first')
try:
key = paramiko.pkey.load_private_key(key, password=passphrase)
print('key1',key)
key = io.StringIO(key)
print('key2',key)
# key = paramiko.pkey.load_private_key(key, password=passphrase)
key = paramiko.Ed25519Key.from_private_key(key, password=passphrase)
# key = get_key_class_name(key, passphrase)
# key = proper_method_call(key, passphrase)
except Exception as e:
raise Exception(f'error: Cannot save SSH key file: {e}')
raise Exception(f'error: Cannot read SSH key: {e}')
lib_path = get_config.get_config_var('main', 'lib_path')
full_dir = f'{lib_path}/keys/'

View File

@ -33,22 +33,35 @@ def before_request():
@bp.route('')
@get_user_params()
def admin():
roxywi_auth.page_for_admin()
roxywi_auth.page_for_admin(level=2)
user_group = roxywi_common.get_user_group(id=1)
if g.user_params['role'] == 1:
users = user_sql.select_users()
servers = server_sql.select_servers(full=1)
masters = server_sql.select_servers(get_master_servers=1)
sshs = cred_sql.select_ssh()
else:
users = user_sql.select_users(group=user_group)
servers = roxywi_common.get_dick_permit(virt=1, disable=0, only_group=1)
masters = server_sql.select_servers(get_master_servers=1, uuid=g.user_params['user_uuid'])
sshs = cred_sql.select_ssh(group=user_group)
kwargs = {
'lang': g.user_params['lang'],
'users': user_sql.select_users(),
'users': users,
'groups': group_sql.select_groups(),
'sshs': cred_sql.select_ssh(),
'servers': server_sql.select_servers(full=1),
'group': roxywi_common.get_user_group(id=1),
'sshs': sshs,
'servers': servers,
'roles': sql.select_roles(),
'timezones': pytz.all_timezones,
'settings': sql.get_setting('', all=1),
'ldap_enable': sql.get_setting('ldap_enable'),
'services': service_sql.select_services(),
'masters': server_sql.select_servers(get_master_servers=1),
'masters': masters,
'guide_me': 1,
'user_subscription': roxywi_common.return_user_subscription()
'user_subscription': roxywi_common.return_user_subscription(),
'user_roles': user_sql.select_user_roles_by_group(user_group),
}
return render_template('admin.html', **kwargs)
@ -203,6 +216,16 @@ def action_openvpn(action, openvpn):
return f'error: Cannot {action} OpenVPN: {e}'
@bp.get('/settings')
@get_user_params()
def get_settings():
kwargs = {
'settings': sql.get_setting('', all=1),
'timezones': pytz.all_timezones,
}
return render_template('include/admin_settings.html', **kwargs)
@bp.post('/setting/<param>')
def update_settings(param):
roxywi_auth.page_for_admin(level=2)

View File

@ -1,6 +1,5 @@
import os
import sys
import pytz
from flask import render_template, request, session, g, abort, jsonify
from flask_login import login_required
@ -9,10 +8,7 @@ sys.path.append(os.path.join(sys.path[0], '/var/www/haproxy-wi/app'))
from app import app, cache
from app.routes.main import bp
import app.modules.db.sql as sql
import app.modules.db.cred as cred_sql
import app.modules.db.user as user_sql
import app.modules.db.group as group_sql
import app.modules.db.server as server_sql
import app.modules.db.service as service_sql
import app.modules.db.history as history_sql
@ -174,37 +170,6 @@ def service_history(service, server_ip):
return render_template('history.html', **kwargs)
@bp.route('/servers')
@login_required
@get_user_params()
def servers():
roxywi_auth.page_for_admin(level=2)
user_group = roxywi_common.get_user_group(id=1)
kwargs = {
'h2': 1,
'users': user_sql.select_users(group=user_group),
'groups': group_sql.select_groups(),
'servers': roxywi_common.get_dick_permit(virt=1, disable=0, only_group=1),
'roles': sql.select_roles(),
'sshs': cred_sql.select_ssh(group=user_group),
'masters': server_sql.select_servers(get_master_servers=1, uuid=g.user_params['user_uuid']),
'group': roxywi_common.get_user_group(id=1),
'services': service_sql.select_services(),
'timezones': pytz.all_timezones,
'guide_me': 1,
'settings': sql.get_setting('', all=1),
'page': 'servers.py',
'ldap_enable': sql.get_setting('ldap_enable'),
'user_roles': user_sql.select_user_roles_by_group(user_group),
'user_subscription': roxywi_common.return_user_subscription(),
'lang': g.user_params['lang']
}
return render_template('servers.html', **kwargs)
@bp.route('/internal/show_version')
@cache.cached()
def show_roxywi_version():

View File

@ -1,5 +1,8 @@
import json
import time
import distro
from flask import render_template, request, jsonify, g
from flask import render_template, request, jsonify, g, Response, stream_with_context
from flask_login import login_required
from app.routes.metric import bp
@ -120,3 +123,38 @@ def show_http_metric(service, server_ip):
return jsonify(metric.haproxy_http_metrics(server_ip, hostname, time_range))
return 'error: Wrong service'
@bp.route('/<service>/<server_ip>/<is_http>/chart-stream')
@check_services
def chart_data(service, server_ip, is_http):
def get_chart_data():
while True:
json_metric = {}
if service in ('nginx', 'apache', 'waf'):
chart_metrics = metric_sql.select_metrics(server_ip, service, time_range=1)
for i in chart_metrics:
json_metric['time'] = common.get_time_zoned_date(i[2], '%H:%M:%S')
json_metric['value'] = str(i[1])
elif service == 'haproxy' and not is_http:
chart_metrics = metric_sql.select_metrics(server_ip, 'haproxy', time_range=1)
for i in chart_metrics:
json_metric['time'] = common.get_time_zoned_date(i[5], '%H:%M:%S')
json_metric['value'] = str(i[1])
json_metric['value1'] = str(i[2])
json_metric['value2'] = str(i[3])
else:
chart_metrics = metric_sql.select_metrics(server_ip, 'http_metrics', time_range=1)
for i in chart_metrics:
json_metric['time'] = common.get_time_zoned_date(i[5], '%H:%M:%S')
json_metric['value'] = str(i[1])
json_metric['value1'] = str(i[2])
json_metric['value2'] = str(i[3])
json_metric['value3'] = str(i[4])
yield f"data:{json.dumps(json_metric)}\n\n"
time.sleep(60)
response = Response(stream_with_context(get_chart_data()), mimetype="text/event-stream")
response.headers["Cache-Control"] = "no-cache"
response.headers["X-Accel-Buffering"] = "no"
return response

View File

@ -1373,12 +1373,12 @@ label {
margin-top: var(--indent);
margin-left: var(--indent);
}
.metrics-refresh {
text-align: right;
margin-top: -25px;
margin-right: 10px;
margin-bottom: 20px;
}
/*.metrics-refresh {*/
/* text-align: right;*/
/* margin-top: -25px;*/
/* margin-right: 10px;*/
/* margin-bottom: 20px;*/
/*}*/
.ajaxwafstatus {
padding-top: 2px;
padding-left: 10px;

View File

@ -1,10 +1,97 @@
function return_service_chart_config() {
var config = {
type: 'line',
data: {
labels: [],
datasets: [
{
normalized: true,
label: 'Connections',
data: [],
borderColor: 'rgba(75, 192, 192, 1)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
fill: true
}
]
},
options: {
animation: false,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
text: '',
font: {
size: 20
},
legend: {
position: 'bottom'
}
},
legend: {
display: true,
labels: {
color: 'rgb(255, 99, 132)',
font: {
size: '10',
family: 'BlinkMacSystemFont'
}
},
position: 'bottom'
}
},
scales: {
y: {
beginAtZero: true
},
x: {
ticks: {
major: {
enabled: true,
fontStyle: 'bold'
},
source: 'data',
autoSkip: true,
autoSkipPadding: 45,
maxRotation: 0
}
}
}
}
}
return config;
}
function stream_chart(chart_id, service, service_ip, is_http=0) {
let random_sleep = getRandomArbitrary(500, 2000);
console.log(`stream_chart ${random_sleep}`);
sleep(random_sleep);
console.log('stop sleep')
const source = new EventSource(`/app/metrics/${service}/${service_ip}/${is_http}/chart-stream`);
source.onmessage = function (event) {
const data = JSON.parse(event.data);
if (chart_id.data.labels.length >= 30) {
chart_id.data.labels.shift();
chart_id.data.datasets[0].data.shift();
}
chart_id.data.labels.push(data.time);
chart_id.data.datasets[0].data.push(data.value);
if (service == 'haproxy') {
chart_id.data.datasets[1].data.push(data.value1);
chart_id.data.datasets[2].data.push(data.value2);
}
if (is_http) {
chart_id.data.datasets[3].data.push(data.value3);
}
chart_id.update();
}
}
function getHttpChartData(server) {
var hide_http_metrics = localStorage.getItem('hide_http_metrics');
if (hide_http_metrics == 'disabled') {
return false;
}
$.ajax({
url: "/app/metrics/haproxy/" + server + "/http",
url: `/app/metrics/haproxy/${server}/http`,
data: {
time_range: $( "#time-range option:selected" ).val(),
},
@ -122,7 +209,7 @@ function renderHttpChart(data, labels, server) {
},
},
});
charts.push(myChart);
stream_chart(myChart, 'haproxy', server, 1);
}
function getChartData(server) {
$.ajax({
@ -226,7 +313,7 @@ function renderChart(data, labels, server) {
}
}
});
charts.push(myChart);
stream_chart(myChart, 'haproxy', server);
}
function getWafChartData(server) {
$.ajax({
@ -249,72 +336,24 @@ function renderServiceChart(data, labels, server, service) {
// Удаление последнего пустого элемента в каждом массиве
dataArray.pop();
dataArray.pop();
var label = labels.split(',');
label.pop();
label.pop();
var ctx = document.getElementById(service + '_' + server).getContext('2d');
var additional_title = '';
if (service === 'waf') {
additional_title = 'WAF ';
}
var myChart = new Chart(ctx, {
type: 'line',
data: {
labels: labels.split(','),
datasets: [
{
normalized: true,
label: 'Connections',
data: dataArray,
borderColor: 'rgba(75, 192, 192, 1)',
backgroundColor: 'rgba(75, 192, 192, 0.2)',
fill: true
config = return_service_chart_config();
for (var i=0; i<label.length; i++) {
config.data.labels.push(label[i])
config.data.datasets[0].data.push(dataArray[i])
}
]
},
options: {
animation: false,
maintainAspectRatio: false,
plugins: {
title: {
display: true,
text: additional_title + data[1],
font: {
size: 20
},
legend: {
position: 'bottom'
}
},
legend: {
display: true,
labels: {
color: 'rgb(255, 99, 132)',
font: {
size: '10',
family: 'BlinkMacSystemFont'
}
},
position: 'bottom'
}
},
scales: {
y: {
beginAtZero: true
},
x: {
ticks: {
major: {
enabled: true,
fontStyle: 'bold'
},
source: 'data',
autoSkip: true,
autoSkipPadding: 45,
maxRotation: 0
}
}
}
}
});
charts.push(myChart);
config.options.plugins.title.text = data[1] + ' ' + additional_title;
var myChart = new Chart(ctx, config);
myChart.update();
stream_chart(myChart, service, server);
}
function getNginxChartData(server) {
$.ajax({
@ -394,18 +433,18 @@ function renderChartHapWiRam(data) {
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['total','used','free','shared','buff','available'],
labels: ['used','free','shared','buff','available','total'],
datasets: [
{
normalized: true,
data: data,
backgroundColor: [
'#36a2eb',
'#ff6384',
'#33ff26',
'#ff9f40',
'#ffcd56',
'#4bc0c0',
'#36a2eb',
]
}
]
@ -467,7 +506,7 @@ function renderChartHapWiCpu(data) {
var myChart = new Chart(ctx, {
type: 'bar',
data: {
labels: ['user','sys','nice','idle','wait','hi','si','steal'],
labels: ['user','sys','nice','idle','wait','hi','si','steal', 'total'],
datasets: [
{
normalized: true,
@ -480,6 +519,7 @@ function renderChartHapWiCpu(data) {
'#4bc0c0',
'#5d9ceb',
'#2c6969',
'#5e1313',
]
}
]
@ -568,9 +608,6 @@ function updatingCpuRamCharts() {
} else if (cur_url[0] == 'service' && cur_url[2]) {
NProgress.configure({showSpinner: false});
showOverviewHapWI();
getChartData(server_ip);
getHttpChartData(server_ip);
getWafChartData(server_ip);
} else {
removeData();
}

View File

@ -189,10 +189,6 @@ $( function() {
if (valid) {
$.ajax({
url: "/app/user/ldap/" + $('#new-username').val(),
// data: {
// token: $('#token').val()
// },
// type: "POST",
success: function (data) {
data = data.replace(/\s+/g, ' ');
if (data.indexOf('error:') != '-1') {
@ -217,6 +213,7 @@ $( function() {
});
$("#tabs ul li").click(function() {
var activeTab = $(this).find("a").attr("href");
console.log(activeTab);
var activeTabClass = activeTab.replace('#', '');
$('.menu li ul li').each(function () {
$(this).find('a').css('border-left', '0px solid var(--right-menu-blue-rolor)');
@ -228,6 +225,8 @@ $( function() {
});
if (activeTab == '#tools') {
loadServices();
} else if (activeTab == '#settings') {
loadSettings();
} else if (activeTab == '#updatehapwi') {
loadupdatehapwi();
} else if (activeTab == '#openvpn'){
@ -243,17 +242,15 @@ window.onload = function() {
if (cur_url[0].split('#')[0] == 'admin') {
if (activeTabIdx == 6) {
loadServices();
} else if (activeTabIdx == 3) {
loadSettings();
} else if (activeTabIdx == 4) {
loadBackup();
} else if (activeTabIdx == 7) {
loadupdatehapwi();
} else if (activeTabIdx == 8) {
loadBackup();
} else if (activeTabIdx == 4) {
loadopenvpn();
}
} else if (cur_url[0].split('#')[0] == 'servers') {
if (activeTabIdx == 4) {
loadBackup();
}
}
}
function addUser(dialog_id) {
@ -1322,6 +1319,22 @@ function viewFirewallRules(ip) {
}
} );
}
function loadSettings() {
$.ajax({
url: "/app/admin/settings",
success: function (data) {
data = data.replace(/\s+/g, ' ');
if (data.indexOf('error:') != '-1') {
toastr.error(data);
} else {
$('#settings').html(data);
$.getScript(awesome);
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
}
}
} );
}
function loadServices() {
$.ajax({
url: "/app/admin/tools",

View File

@ -10,19 +10,21 @@
<div id="tabs">
<ul id="admin-tabs">
<li><a href="#users" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.users}} - Roxy-WI">{{lang.words.users|title()}}</a></li>
<li><a href="#groups" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.groups}} - Roxy-WI">{{lang.words.groups|title()}}</a></li>
<li><a href="#servers" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.servers}} - Roxy-WI">{{lang.words.servers|title()}}</a></li>
<li><a href="#ssh" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} SSH {{lang.words.creds}} - Roxy-WI">SSH {{lang.words.creds}}</a></li>
<li><a href="#openvpn" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} OpenVPN - Roxy-WI" id="admin-tabs-vpn">OpenVPN</a></li>
<li><a href="#settings" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.settings}} - Roxy-WI">{{lang.words.settings|title()}}</a></li>
<li><a href="#backup" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.backup|title()}} {{lang.words.configs}} - Roxy-WI" id="admin-tabs-backup">{{lang.words.backup|title()}}</a></li>
{% if g.user_params['role'] == 1 %}
<li><a href="#groups" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.groups}} - Roxy-WI">{{lang.words.groups|title()}}</a></li>
<li><a href="#tools" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.tools}} - Roxy-WI">{{lang.words.tools|title()}}</a></li>
<li><a href="#updatehapwi" title="{{lang.words.admin_area|title()}}: {{lang.words.w_update|title()}} Roxy-WI - Roxy-WI">{{lang.words.w_update|title()}}</a></li>
<li><a href="#backup" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.backup|title()}} {{lang.words.configs}} - Roxy-WI" id="admin-tabs-backup">{{lang.words.backup|title()}}</a></li>
<li><a href="#openvpn" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} OpenVPN - Roxy-WI" id="admin-tabs-vpn">OpenVPN</a></li>
{% endif %}
</ul>
<div id="users">
{% include 'include/admin_users.html' %}
</div>
{% if g.user_params['role'] == 1 %}
<div id="groups">
<table class="overview" id="ajax-group">
<thead>
@ -68,6 +70,7 @@
{{lang.words.and}} {{lang.words.this2}} <a href="https://roxy-wi.org/howto/setup" title="How to setup servers, group and SSH credentials" target="_blank">{{lang.words.article}}</a>
</div>
</div>
{% endif %}
<div id="servers">
{% include 'include/admin_servers.html' %}
</div>
@ -76,12 +79,10 @@
{% include 'include/admin_ssh.html' %}
</div>
<div id="openvpn"></div>
<div id="settings">
{% include 'include/admin_settings.html' %}
</div>
<div id="settings"></div>
<div id="backup"></div>
{% if g.user_params['role'] == 1 %}
<div id="tools">
<table id="services_table" class="overview">
<thead>
@ -132,7 +133,8 @@
<div id="ajax-update"></div>
</div>
<div id="backup"></div>
<div id="openvpn"></div>
{% endif %}
</div>
{% include 'include/admins_dialogs.html' %}
<script>
@ -143,9 +145,11 @@
});
{% endfor %}
{% for server in servers %}
{% if g.user_params['role'] == 1 %}
$("#servergroup-{{ server.0}}" ).selectmenu({
width: 100
});
{% endif %}
$("#slavefor-{{server.0}}" ).selectmenu({
width: 115
});
@ -174,6 +178,10 @@
});
</script>
<link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/>
{% include 'include/intro/admin.html' %}
{% if g.user_params['role'] == 1 %}
{% include 'include/intro/admin.html' %}
{% else %}
{% include 'include/intro/servers.html' %}
{% endif %}
{% include 'include/intro/js_script.html' %}
{% endblock %}

View File

@ -6,7 +6,7 @@
<th class="padding10 first-collumn" id="server-name-th">{{lang.words.name|title()}}</th>
<th class="ip-field" style="width: 10% " id="server-ip-th">IP</th>
<th style="width: 5%" class="help_cursor"><span title="SSH port">{{lang.words.port|title()}}</span></th>
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<th style="width: 10%">{{lang.words.group|title()}}</th>
{% endif %}
<th class="checkbox-head" style="min-width: 70px;">{{lang.words.enabled|title()}}</th>
@ -48,7 +48,7 @@
{% set id = 'port-' + server.0|string() %}
{{ input(id, value=server.10, type='number', style='width: 50px;') }}
</td>
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<td>
<select id="servergroup-{{server.0}}" name="servergroup-{{server.0}}">
<option disabled selected>------</option>

View File

@ -1,3 +1,5 @@
{% from 'include/input_macros.html' import input, checkbox %}
{% import 'languages/'+lang|default('en')+'.html' as lang %}
{% set sections_name = {
'rabbitmq': 'RabbitMQ',
'nginx': 'NGINX',
@ -17,7 +19,7 @@
<tbody>
{% set section = namespace(section='') %}
{% for set in settings %}
{% if page == "servers.py" and (set.section in ('monitoring', 'rabbitmq', 'mail', 'smon')) %}
{% if g.user_params['role'] == 2 and (set.section in ('monitoring', 'rabbitmq', 'mail', 'smon')) %}
<!-- continue -->
{% else %}
{% if section.section|string() != set.section|string() %}
@ -33,7 +35,7 @@
</tr>
{% endif %}
{% set section.section = set.section %}
{% if page == "servers.py" and (set.param == 'proxy') %}
{% if g.user_params['role'] == 2 and (set.param == 'proxy') %}
<!-- continue -->
{% else %}
<tr class="{{ loop.cycle('odd', 'even') }} {{set.section}}-section" style="display: none">

View File

@ -6,7 +6,7 @@
<td class="first-collumn" style="width: 25%;" class="help_cursor" id="ssh-key-enabled-td">
<span title="If it is enabled, the key will be used, if turned off - the password. Do not forget to download the keys to all servers or install the sudo without a password">SSH {{lang.words.key}}</span>
</td>
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<td style="width: 25%;">{{lang.words.group|title()}}</td>
{% endif %}
<td style="width: 100%;" class="help_cursor" id="ssh-user-name-td">
@ -27,7 +27,7 @@
<label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}">
{% endif %}
</td>
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<td>
<select id="sshgroup-{{ssh.id}}" name="sshgroup-{{ssh.id}}">
{% for group in groups %}

View File

@ -7,7 +7,7 @@
<th style="width: 10%">{{lang.words.password|title()}}</th>
<th style="width: 10%" class="checkbox-head" id="user-active-th">{{lang.words.active|title()}}</th>
<th style="width: 20%">{{lang.words.email|title()}}</th>
{% if page == "servers.py" %}
{% if g.user_params['role'] == 2 %}
<th style="width: 10%" id="user-role-th">{{lang.words.role|title()}}</th>
{% else %}
<th style="width: 10%" id="user-group-role-th">{{lang.words.groups|title()}} {{lang.words.and}} {{lang.words.roles|title()}}</th>
@ -20,7 +20,7 @@
<tbody>
{% endif %}
{% for user in users %}
{% if user.role == '1' and page == "servers.py" %}
{% if user.role == '1' and g.user_params['role'] == 2 %}
{% set disable_superAdmin = "disabled" %}
{% endif %}
<tr id="user-{{user.user_id}}" class="{{ loop.cycle('odd', 'even') }} {% if adding %}newuser{% endif %}">
@ -55,13 +55,13 @@
{% endif %}
</td>
<td>
{% if page == "servers.py" %}
{% if g.user_params['role'] == 2 %}
<select id="role-{{user.user_id}}" name="role-{{user.user_id}}" {{disable_superAdmin}}>
<option disabled selected>Select a role</option>
{% for r in roles %}
{% for user_role in user_roles %}
{% if r.role_id|int() != 1 and user.user_id == user_role.user_id %}
{% if user_role.user_role_id == r.role_id %}
{% if r.role_id|int() != 1 and user.user_id|string() == user_role.user_id|string() %}
{% if user_role.user_role_id|string() == r.role_id|string() %}
<option value="{{ r.role_id }}" selected>{{ r.name }}</option>
{% else %}
<option value="{{ r.role_id }}">{{ r.name }}</option>

View File

@ -1,4 +1,4 @@
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<div id="user-add-table" style="display: none;">
<table class="overview" id="user-add-table-overview" title="{{lang.words.add|title()}} {{lang.words.w_a}} {{lang.words.new2}} {{lang.words.user2}}">
{% include 'include/tr_validate_tips.html' %}
@ -91,7 +91,7 @@
</select>
</td>
</tr>
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<tr>
<td class="padding20">
{{lang.words.group|title()}}
@ -127,7 +127,7 @@
<label for="new-ssh_enable">{{lang.words.enabled|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="new-ssh_enable" checked>
</td>
</tr>
{% if page != "servers.py" %}
{% if g.user_params['role'] == 1 %}
<tr>
<td class="padding20">{{lang.words.group|title()}}</td>
<td>

View File

@ -107,30 +107,22 @@
<li><a href="{{ url_for('install.install_monitoring') }}#geolite2" title="{{lang.words.installation|title()}} GeoLite2" class="hap-menu geolite2 installgeo head-submenu">GeoLite2</a> </li>
</ul>
</li>
<li class="p_menu">
<a href="{{ url_for('main.servers') }}#users" title="{{lang.menu_links.servers.title}}" class="runtime">{{lang.menu_links.servers.link}}</a>
<ul class="v_menu">
<li><a href="{{ url_for('main.servers') }}#users" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} {{lang.words.users2}}" class="users head-submenu">{{lang.words.users|title()}}</a></li>
<li><a href="{{ url_for('main.servers') }}#servers" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} {{lang.words.servers2}}" class="runtime servers head-submenu">{{lang.words.servers|title()}}</a></li>
<li><a href="{{ url_for('main.servers') }}#ssh" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} SSH {{lang.words.creds2}}" class="admin ssh head-submenu">SSH {{lang.words.creds|title()}}</a></li>
<li><a href="{{ url_for('main.servers') }}#settings" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.settings2}}" class="settings head-submenu">{{lang.words.settings|title()}}</a></li>
<li><a href="{{ url_for('main.servers') }}#backup" title="{{lang.words.servers|title()}}: {{lang.words.backup|title()}} {{lang.words.configs2}}" class="backup head-submenu">{{lang.words.backup|title()}}</a> </li>
<li><a href="{{ url_for('logs.logs_internal') }}?type=2" title="{{lang.words.servers|title()}}: {{lang.words.view|title()}} {{lang.words.internal2}} {{lang.words.logs2}}" class="logs head-submenu">{{lang.words.internal|title()}} {{lang.words.logs}}</a></li>
</ul>
</li>
{% endif %}
{% if g.user_params['role'] <= 1 %}
{% if g.user_params['role'] <= 2 %}
<li class="p_menu" id="admin-area">
<a href="{{ url_for('admin.admin') }}#users" title="{{lang.menu_links.admin_area.title}}" class="admin">{{lang.menu_links.admin_area.link}}</a>
<ul class="v_menu">
<li><a href="{{ url_for('admin.admin') }}#users" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.users2}}" class="users head-submenu" id="admin-area-users">{{lang.words.users|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#groups" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.groups3}}" class="group groups head-submenu" id="admin-area-groups">{{lang.words.groups|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#servers" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.servers2}}" class="runtime servers head-submenu" id="admin-area-servers">{{lang.words.servers|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#ssh" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} SSH {{lang.words.creds2}}" class="admin ssh head-submenu" id="admin-area-ssh">SSH {{lang.words.creds|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#settings" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.settings2}}" class="settings head-submenu" id="admin-area-settings">{{lang.words.settings|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#tools" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.tools}}" class="tools head-submenu" id="admin-area-services">{{lang.words.tools|title()}}</a></li>
<li><a href="{{ url_for('logs.logs_internal') }}" title="{{lang.words.admin_area|title()}}: {{lang.words.view|title()}} {{lang.words.internal2}} {{lang.words.logs2}}" class="logs head-submenu" id="admin-area-logs">{{lang.words.internal|title()}} {{lang.words.logs}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#backup" title="{{lang.words.servers|title()}}: {{lang.words.backup|title()}} {{lang.words.configs2}}" class="backup head-submenu">{{lang.words.backup|title()}}</a> </li>
{% if g.user_params['role'] <= 1 %}
<li><a href="{{ url_for('admin.admin') }}#groups" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} {{lang.words.groups3}}" class="group groups head-submenu" id="admin-area-groups">{{lang.words.groups|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#tools" title="{{lang.words.admin_area|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.tools}}" class="tools head-submenu" id="admin-area-services">{{lang.words.tools|title()}}</a></li>
<li><a href="{{ url_for('admin.admin') }}#updatehapwi" title="{{lang.words.admin_area|title()}}: {{lang.words.w_update|title()}} Roxy-WI" class="upload updatehapwi head-submenu" id="admin-area-update">{{lang.words.w_update|title()}}</a></li>
{% endif %}
</ul>
</li>
{% endif %}

View File

@ -59,9 +59,6 @@
</div>
{% endif %}
<div style="clear: both;"></div>
<div id="refresh" class="metrics-refresh" title="{{lang.words.refresh|title}} {{lang.words.metrics}}" onclick="showMetrics()">
<span class="refresh"></span>
</div>
{% for s in servers %}
{% if service == 'haproxy' %}
<div class="chart-container">

View File

@ -1,80 +0,0 @@
{% extends "base.html" %}
{% block title %}{{lang.menu_links.servers.title}}{% endblock %}
{% block h2 %}{{lang.menu_links.servers.title}}{% endblock %}
{% block content %}
{% from 'include/input_macros.html' import input, checkbox, select, copy_to_clipboard %}
<script src="/app/static/js/users.js"></script>
<script src="{{ url_for('static', filename='js/backup.js') }}"></script>
{% include 'include/del_confirm.html' %}
<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-sshgroup" name="new-sshgroup" value="{{ group }}" >
{{ input('new-telegram-group-add', type='hidden', value=group) }}
{{ input('new-slack-group-add', type='hidden', value=group) }}
{{ input('new-pd-group-add', type='hidden', value=group) }}
<div id="tabs">
<ul>
<li><a href="#users" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} {{lang.words.users}} - Roxy-WI">{{lang.words.users|title()}}</a></li>
<li><a href="#servers" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} {{lang.words.servers}} - Roxy-WI">{{lang.words.servers|title()}}</a></li>
<li><a href="#ssh" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} SSH {{lang.words.creds}} - Roxy-WI">SSH {{lang.words.creds}}</a></li>
<li><a href="#settings" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} Roxy-WI {{lang.words.settings}} - Roxy-WI">{{lang.words.settings|title()}}</a></li>
<li><a href="#backup" title="{{lang.words.servers|title()}}: {{lang.words.manage|title()}} {{lang.words.backup|title()}} configs - Roxy-WI" id="admin-tabs-backup">{{lang.words.backup|title()}}</a></li>
</ul>
<div id="users">
{% include 'include/admin_users.html' %}
</div>
<div id="servers">
{% include 'include/admin_servers.html' %}
</div>
<div id="ssh">
{% include 'include/admin_ssh.html' %}
</div>
<div id="settings">
{% include 'include/admin_settings.html' %}
</div>
<div id="backup"></div>
</div>
{% include 'include/admins_dialogs.html' %}
{% include 'include/change_pass_form.html' %}
<script>
$( function() {
{% for user in users %}
$("#role-{{user.0}}" ).selectmenu({
width: 100
});
{% endfor %}
{% for server in servers %}
$("#slavefor-{{server.0}}" ).selectmenu({
width: 100
});
$("#credentials-{{server.0}}" ).selectmenu({
width: 150
});
{% endfor %}
{% for ssh in sshs %}
$("#sshgroup-{{ ssh.0}}" ).selectmenu({
width: 150
});
{% endfor %}
{% for server in backups %}
$("#backup-time-{{ server.id}}" ).selectmenu({
width: 100
});
$("#backup-type-{{server.id}}" ).selectmenu({
width: 130
});
$("#backup-credentials-{{server.id}}" ).selectmenu({
width: 150
});
{% endfor %}
});
</script>
<link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/>
{% include 'include/intro/servers.html' %}
{% include 'include/intro/js_script.html' %}
{% endblock %}

View File

@ -406,14 +406,10 @@
<option value="720">12 {{lang.words.hours2}}</option>
</select>
</div>
<div style="clear: both;"></div>
<div id="refresh" class="metrics-refresh" style="margin-right: 140px;" title="{{lang.words.refresh|title()}}" onclick="showMetrics()">
<span class="refresh"></span>
</div>
{% endif %}
{% endif %}
{% if service == 'haproxy' and s.7.0.9 %}
<div id="server_metrics_div" class="chart-container_overview">
<div id="server_metrics_div" class="chart-container_overview" style="margin-top: -35px;">
<canvas id="{{s.2}}" role="img"></canvas>
</div>
<div class="chart-container_overview http_metrics_div">
@ -425,11 +421,11 @@
</div>
{% endif %}
{% elif service == 'nginx' and s.7.0.21 %}
<div id="nginx_metrics_div" class="chart-container" style="display: block; width: 90%; height: 300px;">
<div id="nginx_metrics_div" class="chart-container_overview" style="margin-top: -35px;">
<canvas id="nginx_{{s.2}}" role="img"></canvas>
</div>
{% elif service == 'apache' and s.7.0.27 %}
<div id="apache_metrics_div" class="chart-container" style="display: block; width: 90%; height: 300px;">
<div id="apache_metrics_div" class="chart-container_overview" style="margin-top: -35px;">
<canvas id="apache_{{s.2}}" role="img"></canvas>
</div>
{% endif %}

View File

@ -192,9 +192,6 @@
</select>
</div>
<div style="clear: both;"></div>
<div id="refresh" class="metrics-refresh" title="{{lang.words.refresh|title()}}" onclick="showWafMetrics()">
<span class="refresh"></span>
</div>
{% for s in servers %}
<div class="chart-container">
<canvas id="waf_{{s.server.ip}}" role="img"></canvas>

View File

@ -74,6 +74,8 @@ $( function() {
show_current_page($(this))
} else if (full_uri == 'logs/apache' && full_uri1 == 'logs/apache') {
show_current_page($(this))
} else if (full_uri == 'logs/internal' && full_uri1 == 'logs/internal') {
show_current_page($(this))
} else if (full_uri == 'service/haproxy' && full_uri1 == 'service/haproxy') {
show_current_page($(this))
} else if (full_uri == 'service/nginx' && full_uri1 == 'service/nginx') {
@ -693,8 +695,7 @@ $( function() {
try {
var cur_path = window.location.pathname;
var attr = $(this).attr('href');
if (cur_path == '/app/add/haproxy' || cur_path == '/app/add/nginx' || cur_path == '/app/servers' ||
cur_path == '/app/admin' || cur_path == '/app/install' || cur_path == '/app/runtimeapi') {
if (cur_path == '/app/add/haproxy' || cur_path == '/app/add/nginx' || cur_path == '/app/admin' || cur_path == '/app/install' || cur_path == '/app/runtimeapi') {
if (typeof attr !== typeof undefined && attr !== false) {
$('title').text($(this).attr('title'));
history.pushState({}, '', $(this).attr('href'));
@ -941,10 +942,6 @@ $( function() {
}
$.ajax({
url: "/app/user/group/current",
// data: {
// token: $('#token').val()
// },
// type: "POST",
success: function (data) {
if (data.indexOf('danger') != '-1') {
$("#ajax").html(data);
@ -993,7 +990,7 @@ $( function() {
$("#tabs").tabs("option", "active", 2);
});
}
if (cur_url[0].indexOf('admin') != '-1' || cur_url[0].indexOf('servers') != '-1') {
if (cur_url[0].indexOf('admin') != '-1') {
$(".users").on("click", function () {
$('.menu li ul li').each(function () {
$(this).find('a').css('padding-left', '20px')
@ -1005,18 +1002,6 @@ $( function() {
});
$("#tabs").tabs("option", "active", 0);
});
if (cur_url[0].indexOf('admin') != '-1') {
$(".group").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(".group").css('padding-left', '30px');
$(this).children(".group").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".group").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 1);
});
$(".runtime").on("click", function () {
$('.menu li ul li').each(function () {
$(this).find('a').css('border-left', '0px solid var(--right-menu-blue-rolor)');
@ -1026,7 +1011,7 @@ $( function() {
$(this).children(".runtime").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".runtime").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 2);
$("#tabs").tabs("option", "active", 1);
});
$(".admin").on("click", function () {
$('.menu li ul li').each(function () {
@ -1037,7 +1022,7 @@ $( function() {
$(this).children(".admin").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".admin").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 3);
$("#tabs").tabs("option", "active", 2);
});
$(".settings").on("click", function () {
$('.menu li ul li').each(function () {
@ -1048,16 +1033,40 @@ $( function() {
$(this).children(".settings").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".settings").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 3);
loadSettings();
});
$(".backup").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(".backup").css('padding-left', '30px');
$(this).children(".backup").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".backup").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 4);
loadBackup();
});
$(".group").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(".group").css('padding-left', '30px');
$(this).children(".group").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".group").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 5);
});
$(".services").on("click", function () {
$(".tools").on("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).find('a').css('background-color', '#48505A');
$(this).children(".services").css('padding-left', '30px');
$(this).children(".services").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".services").css('background-color', 'var(--right-menu-blue-rolor)');
$(this).children(".tools").css('padding-left', '30px');
$(this).children(".tools").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".tools").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 6);
loadServices();
@ -1074,53 +1083,6 @@ $( function() {
$("#tabs").tabs("option", "active", 7);
loadupdatehapwi();
});
} else {
$(".runtime").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(".runtime").css('padding-left', '30px');
$(this).children(".runtime").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".runtime").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 1);
});
$(".admin").on("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).find('a').css('background-color', '#48505A');
$(this).children(".admin").css('padding-left', '30px');
$(this).children(".admin").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".admin").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 2);
});
$(".settings").on("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).find('a').css('background-color', '#48505A');
$(this).children(".settings").css('padding-left', '30px');
$(this).children(".settings").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".settings").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 3);
});
$(".backup").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(".backup").css('padding-left', '30px');
$(this).children(".backup").css('border-left', '4px solid var(--right-menu-blue-rolor)');
$(this).children(".backup").css('background-color', 'var(--right-menu-blue-rolor)');
});
$("#tabs").tabs("option", "active", 4);
loadBackup();
});
}
}
$('.copyToClipboard').hover(function (){
$.getScript("/app/static/js/overview.js");
@ -1150,6 +1112,9 @@ function saveUserSettings(){
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function getRandomArbitrary(min, max) {
return Math.random() * (max - min) + min;
}
async function ban() {
$( '#login').attr('disabled', 'disabled');
$( '#pass').attr('disabled', 'disabled');