Browse Source

v7.2.0.0

Small bugs fix
pull/375/head
Aidaho 9 months ago
parent
commit
447739c644
  1. 8
      app/modules/db/sql.py
  2. 13
      app/modules/roxywi/common.py
  3. 4
      app/modules/roxywi/metrics.py
  4. 2
      app/modules/roxywi/user.py
  5. 17
      app/modules/server/ssh.py
  6. 3
      app/modules/server/ssh_connection.py
  7. 11
      app/routes/metric/routes.py
  8. 30
      app/routes/server/routes.py
  9. 3
      app/routes/smon/routes.py
  10. 11
      app/static/css/style-6.3.9.css
  11. 2
      app/templates/ajax/new_ssh.html
  12. 6
      app/templates/ajax/smon/smon_dashboard.html
  13. 4
      app/templates/config.html
  14. 3
      app/templates/smon/dashboard.html
  15. 2
      config_other/logrotate/backup
  16. 19
      config_other/logrotate/roxy-wi
  17. 40
      inc/metrics.js
  18. 5
      inc/smon.js

8
app/modules/db/sql.py

@ -962,9 +962,6 @@ def insert_new_ssh(name, enable, group, username, password):
Cred.insert(name=name, enable=enable, groups=group, username=username, password=password).execute() Cred.insert(name=name, enable=enable, groups=group, username=username, password=password).execute()
except Exception as e: except Exception as e:
out_error(e) out_error(e)
return False
else:
return True
def delete_ssh(ssh_id): def delete_ssh(ssh_id):
@ -3027,7 +3024,7 @@ def select_remote_path_from_version(server_ip: str, service: str, local_path: st
def insert_system_info( def insert_system_info(
server_id: int, os_info: str, sys_info: str, cpu: str, ram: str, network: str, disks: str server_id: int, os_info: str, sys_info: dict, cpu: dict, ram: dict, network: dict, disks: dict
): ):
try: try:
SystemInfo.insert( SystemInfo.insert(
@ -3112,9 +3109,6 @@ def insert_user_name(user_name):
UserName.insert(UserName=user_name).execute() UserName.insert(UserName=user_name).execute()
except Exception as e: except Exception as e:
out_error(e) out_error(e)
return False
else:
return True
def select_user_name(): def select_user_name():

13
app/modules/roxywi/common.py

@ -16,7 +16,7 @@ def return_error_message():
return 'error: All fields must be completed' return 'error: All fields must be completed'
def get_user_group(**kwargs) -> str: def get_user_group(**kwargs) -> int:
user_group = '' user_group = ''
try: try:
@ -104,8 +104,6 @@ def get_files(folder, file_format, server_ip=None) -> list:
def logging(server_ip: str, action: str, **kwargs) -> None: def logging(server_ip: str, action: str, **kwargs) -> None:
login = ''
cur_date = get_date.return_date('logs')
cur_date_in_log = get_date.return_date('date_in_log') cur_date_in_log = get_date.return_date('date_in_log')
log_path = get_config_var.get_config_var('main', 'log_path') log_path = get_config_var.get_config_var('main', 'log_path')
@ -126,18 +124,17 @@ def logging(server_ip: str, action: str, **kwargs) -> None:
user_uuid = request.cookies.get('uuid') user_uuid = request.cookies.get('uuid')
login = sql.get_user_name_by_uuid(user_uuid) login = sql.get_user_name_by_uuid(user_uuid)
except Exception: except Exception:
if kwargs.get('login'): login = ''
login = kwargs.get('login')
if kwargs.get('roxywi') == 1: if kwargs.get('roxywi') == 1:
if kwargs.get('login'): if kwargs.get('login'):
mess = f"{cur_date_in_log} from {ip} user: {login}, group: {user_group}, {action} on: {server_ip}\n" mess = f"{cur_date_in_log} from {ip} user: {login}, group: {user_group}, {action} on: {server_ip}\n"
else: else:
mess = f"{cur_date_in_log} {action} from {ip}\n" mess = f"{cur_date_in_log} {action} from {ip}\n"
log_file = f"{log_path}/roxy-wi-{cur_date}.log" log_file = f"{log_path}/roxy-wi.log"
else: else:
mess = f"{cur_date_in_log} from {ip} user: {login}, group: {user_group}, {action} on: {server_ip}\n" mess = f"{cur_date_in_log} from {ip} user: {login}, group: {user_group}, {action} on: {server_ip} {kwargs.get('service')}\n"
log_file = f"{log_path}/config_edit-{cur_date}.log" log_file = f"{log_path}/config_edit.log"
if kwargs.get('keep_history'): if kwargs.get('keep_history'):
try: try:

4
app/modules/roxywi/metrics.py

@ -1,7 +1,7 @@
import psutil import psutil
import modules.db.sql as sql import app.modules.db.sql as sql
import modules.server.server as server_mod import app.modules.server.server as server_mod
def show_ram_metrics(metrics_type: str) -> dict: def show_ram_metrics(metrics_type: str) -> dict:

2
app/modules/roxywi/user.py

@ -28,7 +28,7 @@ def create_user(new_user: str, email: str, password: str, role: str, activeuser:
except Exception as e: except Exception as e:
roxywi_common.logging('error: Cannot send email for a new user', e, roxywi=1, login=1) roxywi_common.logging('error: Cannot send email for a new user', e, roxywi=1, login=1)
except Exception as e: except Exception as e:
roxywi_common.handle_exceptions(e, 'Roxy-WI server', f'Cannot create a new user', roxywi=1, login=1) roxywi_common.handle_exceptions(e, 'Roxy-WI server', 'Cannot create a new user', roxywi=1, login=1)
def delete_user(user_id: int) -> str: def delete_user(user_id: int) -> str:

17
app/modules/server/ssh.py

@ -4,11 +4,11 @@ from cryptography.fernet import Fernet
import paramiko import paramiko
from flask import render_template, request from flask import render_template, request
import modules.db.sql as sql import app.modules.db.sql as sql
import modules.common.common as common import app.modules.common.common as common
from app.modules.server import ssh_connection from app.modules.server import ssh_connection
import modules.roxywi.common as roxywi_common import app.modules.roxywi.common as roxywi_common
import modules.roxy_wi_tools as roxy_wi_tools import app.modules.roxy_wi_tools as roxy_wi_tools
error_mess = common.error_mess error_mess = common.error_mess
get_config = roxy_wi_tools.GetConfigVar() get_config = roxy_wi_tools.GetConfigVar()
@ -82,9 +82,12 @@ def create_ssh_cred() -> str:
if username is None or name is None: if username is None or name is None:
return error_mess return error_mess
else: else:
if sql.insert_new_ssh(name, enable, group, username, password): try:
roxywi_common.logging('Roxy-WI server', f'New SSH credentials {name} has been created', roxywi=1, login=1) sql.insert_new_ssh(name, enable, group, username, password)
return render_template('ajax/new_ssh.html', groups=sql.select_groups(), sshs=sql.select_ssh(name=name), page=page, lang=lang) except Exception as e:
roxywi_common.handle_exceptions(e, 'Roxy-WI server', 'Cannot create new SSH credentials', roxywi=1, login=1)
roxywi_common.logging('Roxy-WI server', f'New SSH credentials {name} has been created', roxywi=1, login=1)
return render_template('ajax/new_ssh.html', groups=sql.select_groups(), sshs=sql.select_ssh(name=name), page=page, lang=lang)
def create_ssh_cread_api(name: str, enable: str, group: str, username: str, password: str) -> bool: def create_ssh_cread_api(name: str, enable: str, group: str, username: str, password: str) -> bool:

3
app/modules/server/ssh_connection.py

@ -16,6 +16,7 @@ class SshConnection:
self.ssh_key_name = ssh_settings['key'] self.ssh_key_name = ssh_settings['key']
self.ssh_passphrase = ssh_settings['passphrase'] self.ssh_passphrase = ssh_settings['passphrase']
# noinspection PyExceptClausesOrder
def __enter__(self): def __enter__(self):
kwargs = { kwargs = {
'hostname': self.server_ip, 'hostname': self.server_ip,
@ -112,7 +113,7 @@ class SshConnection:
yield stdout.channel.recv(len(stdout.channel.in_buffer)) yield stdout.channel.recv(len(stdout.channel.in_buffer))
# chunked read to prevent stalls # chunked read to prevent stalls
while (not channel.closed or channel.recv_ready() or channel.recv_stderr_ready()): while not channel.closed or channel.recv_ready() or channel.recv_stderr_ready():
# stop if channel was closed prematurely, # stop if channel was closed prematurely,
# and there is no data in the buffers. # and there is no data in the buffers.
got_chunk = False got_chunk = False

11
app/routes/metric/routes.py

@ -4,7 +4,7 @@ from flask_login import login_required
from app.routes.metric import bp from app.routes.metric import bp
import app.modules.db.sql as sql import app.modules.db.sql as sql
from middleware import check_services, get_user_params from app.middleware import check_services, get_user_params
import app.modules.common.common as common import app.modules.common.common as common
import app.modules.server.server as server_mod import app.modules.server.server as server_mod
import app.modules.roxywi.metrics as metric import app.modules.roxywi.metrics as metric
@ -14,7 +14,7 @@ import app.modules.roxywi.common as roxywi_common
@bp.before_request @bp.before_request
@login_required @login_required
def before_request(): def before_request():
""" Protect all of the admin endpoints. """ """ Protect all the admin endpoints. """
pass pass
@ -86,15 +86,14 @@ def table_metrics(service):
group_id = roxywi_common.get_user_group(id=1) group_id = roxywi_common.get_user_group(id=1)
if service in ('nginx', 'apache'): if service in ('nginx', 'apache'):
metrics = sql.select_service_table_metrics(service, group_id) table_stat = sql.select_service_table_metrics(service, group_id)
else: else:
metrics = sql.select_table_metrics(group_id) table_stat = sql.select_table_metrics(group_id)
return render_template('ajax/table_metrics.html', table_stat=metrics, service=service, lang=lang) return render_template('ajax/table_metrics.html', table_stat=table_stat, service=service, lang=lang)
@bp.post('/<service>/<server_ip>') @bp.post('/<service>/<server_ip>')
@check_services
def show_metric(service, server_ip): def show_metric(service, server_ip):
server_ip = common.is_ip_or_dns(server_ip) server_ip = common.is_ip_or_dns(server_ip)
hostname = sql.get_hostname_by_server_ip(server_ip) hostname = sql.get_hostname_by_server_ip(server_ip)

30
app/routes/server/routes.py

@ -83,12 +83,32 @@ def create_server():
user_subscription = roxywi_common.return_unsubscribed_user_status() user_subscription = roxywi_common.return_unsubscribed_user_status()
roxywi_common.logging('Roxy-WI server', f'Cannot get a user plan: {e}', roxywi=1) roxywi_common.logging('Roxy-WI server', f'Cannot get a user plan: {e}', roxywi=1)
try: if add_to_smon:
if add_to_smon: try:
user_group = roxywi_common.get_user_group(id=1) user_group = roxywi_common.get_user_group(id=1)
smon_mod.create_smon(hostname, ip, 0, 1, 0, 0, hostname, desc, 0, 0, 0, 56, 'ping', 0, 0, user_group, 0) json_data = {
except Exception as e: "name": hostname,
roxywi_common.logging(ip, f'error: Cannot add server {hostname} to SMON: {e}') "ip": ip,
"port": "0",
"enabled": "1",
"url": "",
"body": "",
"group": hostname,
"desc": f"Ping {hostname}",
"tg": "0",
"slack": "0",
"pd": "0",
"resolver": "",
"record_type": "",
"packet_size": "56",
"http_method": "",
"check_type": "ping",
"agent_id": "1",
"interval": "120",
}
smon_mod.create_smon(json_data, user_group)
except Exception as e:
roxywi_common.logging(ip, f'error: Cannot add server {hostname} to SMON: {e}', roxywi=1)
roxywi_common.logging(ip, f'A new server {hostname} has been created', roxywi=1, login=1, keep_history=1, service='server') roxywi_common.logging(ip, f'A new server {hostname} has been created', roxywi=1, login=1, keep_history=1, service='server')

3
app/routes/smon/routes.py

@ -4,7 +4,7 @@ from flask_login import login_required
from datetime import datetime from datetime import datetime
from app.routes.smon import bp from app.routes.smon import bp
from middleware import get_user_params from app.middleware import get_user_params
from app.modules.db.db_model import conn from app.modules.db.db_model import conn
import app.modules.db.sql as sql import app.modules.db.sql as sql
import app.modules.db.smon as smon_sql import app.modules.db.smon as smon_sql
@ -44,6 +44,7 @@ def smon_main_dashboard():
'telegrams': sql.get_user_telegram_by_group(group_id), 'telegrams': sql.get_user_telegram_by_group(group_id),
'slacks': sql.get_user_pd_by_group(group_id), 'slacks': sql.get_user_pd_by_group(group_id),
'pds': sql.get_user_slack_by_group(group_id), 'pds': sql.get_user_slack_by_group(group_id),
'sort': request.args.get('sort', None)
} }
return render_template('smon/dashboard.html', **kwargs) return render_template('smon/dashboard.html', **kwargs)

11
app/static/css/style-6.3.9.css

@ -63,7 +63,7 @@ ul#browse_history li:before {
ul#browse_history li+li:before { ul#browse_history li+li:before {
content: "->"; content: "->";
color: #767676; color: #767676;
margin: 0 5px 0px 5px; margin: 0 5px 0 5px;
} }
#browse_history a { #browse_history a {
color: #767676; color: #767676;
@ -669,9 +669,6 @@ ul{
.ui-corner-all { .ui-corner-all {
border-radius: 3px !important; border-radius: 3px !important;
} }
/*.ui-visual-focus {*/
/* box-shadow: none !important;*/
/*}*/
.ui-state-focus { .ui-state-focus {
border: none !important; border: none !important;
} }
@ -872,7 +869,7 @@ label {
width: 5px; width: 5px;
height: 5px; height: 5px;
display: inline-block; display: inline-block;
margin-bottom: 0px; margin-bottom: 0;
} }
.server-action { .server-action {
float: right; float: right;
@ -965,6 +962,7 @@ label {
width: 48.8%; width: 48.8%;
float: left; float: left;
margin-left: var(--indent); margin-left: var(--indent);
margin-bottom: var(--indent);
} }
.chart-container_overview { .chart-container_overview {
width: 93.3%; width: 93.3%;
@ -1132,7 +1130,7 @@ label {
} }
#logo_span img { #logo_span img {
width: 250px; width: 250px;
margin: 35px 0px auto 120px; margin: 35px 0 auto 120px;
} }
.wrong-login { .wrong-login {
margin-right: -150px; margin-right: -150px;
@ -1378,7 +1376,6 @@ label {
} }
.portlet-header { .portlet-header {
cursor: move; cursor: move;
margin-right: -10px;
margin-left: 10px; margin-left: 10px;
position: relative; position: relative;
bottom: 3px; bottom: 3px;

2
app/templates/ajax/new_ssh.html

@ -11,7 +11,7 @@
<label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}"> <label for="ssh_enable-{{ssh.id}}">{{lang.words.enable|title()}} SSH {{lang.words.key}}</label><input type="checkbox" id="ssh_enable-{{ssh.id}}">
{% endif %} {% endif %}
</td> </td>
{% if page != "servers.py" %} {% if page != "servers" %}
<td> <td>
<select id="sshgroup-{{ssh.id}}" name="sshgroup-{{ssh.id}}"> <select id="sshgroup-{{ssh.id}}" name="sshgroup-{{ssh.id}}">
{% for group in groups %} {% for group in groups %}

6
app/templates/ajax/smon/smon_dashboard.html

@ -20,9 +20,9 @@
{% endfor %} {% endfor %}
<b>{{lang.smon_page.desc.status_summary}}: {{lang.smon_page.desc.UP}}: {{up|length}}, {{lang.smon_page.desc.DOWN}}: {{down|length}}, {{lang.words.disabled|title()}}: {{dis|length}}</b> <b>{{lang.smon_page.desc.status_summary}}: {{lang.smon_page.desc.UP}}: {{up|length}}, {{lang.smon_page.desc.DOWN}}: {{down|length}}, {{lang.words.disabled|title()}}: {{dis|length}}</b>
</div> </div>
<a title="{{lang.smon_page.desc.do_not_sort_by_status}}" onclick="showSmon('not_sort')">{{lang.smon_page.desc.do_not_sort}}</a> | <a title="{{lang.smon_page.desc.do_not_sort_by_status}}" style="cursor: pointer" onclick="showSmon('not_sort')">{{lang.smon_page.desc.do_not_sort}}</a> |
<a id="sort_by_status" title="{{lang.smon_page.desc.sort_status}}" onclick="sort_by_status()">{{lang.smon_page.desc.sort_status}}</a> | <a id="sort_by_status" title="{{lang.smon_page.desc.sort_status}}" style="cursor: pointer" onclick="sort_by_status()">{{lang.smon_page.desc.sort_status}}</a> |
<a title="SMOM: {{lang.words.dashboard|title()}} - Roxy-WI" onclick="showSmon('refresh');">{{lang.words.refresh|title()}}</a> <a title="SMOM: {{lang.words.dashboard|title()}} - Roxy-WI" style="cursor: pointer" onclick="showSmon('refresh');">{{lang.words.refresh2|title()}}</a>
</div> </div>
{% set group = [] %} {% set group = [] %}
{% set group_prev = [] %} {% set group_prev = [] %}

4
app/templates/config.html

@ -76,12 +76,10 @@
</div> </div>
<p> <p>
<a href="/app/config/{{service}}/{{serv}}/show" class="ui-button ui-widget ui-corner-all" title="{{lang.phrases.return_to_config}}">{{lang.words.back|title()}}</a> <a href="/app/config/{{service}}/{{serv}}/show" class="ui-button ui-widget ui-corner-all" title="{{lang.phrases.return_to_config}}">{{lang.words.back|title()}}</a>
{% if service != 'keepalived' %}
<button type="submit" value="test" name="save" class="btn btn-default" title="{{lang.words.check|title()}} {{lang.words.config}} {{lang.words.without}} {{lang.words.saving}}">{{lang.phrases.check_config}}</button> <button type="submit" value="test" name="save" class="btn btn-default" title="{{lang.words.check|title()}} {{lang.words.config}} {{lang.words.without}} {{lang.words.saving}}">{{lang.phrases.check_config}}</button>
{% endif %}
<button type="submit" value="save" name="save" class="btn btn-default" title="{{lang.phrases.save_title}}">{{lang.words.save|title()}}</button> <button type="submit" value="save" name="save" class="btn btn-default" title="{{lang.phrases.save_title}}">{{lang.words.save|title()}}</button>
{% if is_restart|int == 0 %} {% if is_restart|int == 0 %}
<button type="submit" value="" name="" class="btn btn-default">{{lang.phrases.save_and_restart}}</button> <button type="submit" value="restart" name="" class="btn btn-default">{{lang.phrases.save_and_restart}}</button>
{% endif %} {% endif %}
<button type="submit" value="reload" name="save" class="btn btn-default">{{lang.phrases.save_and_reload}}</button> <button type="submit" value="reload" name="save" class="btn btn-default">{{lang.phrases.save_and_reload}}</button>
{% if service != 'keepalived' %} {% if service != 'keepalived' %}

3
app/templates/smon/dashboard.html

@ -21,9 +21,6 @@
</div> </div>
{% elif smon|length == 0 %} {% elif smon|length == 0 %}
<div style="text-align: center;"> <div style="text-align: center;">
{% if g.user_params['role'] <= 3 %}
<div class="add-button add-button-big" title="{{lang.words.add|title()}} {{ lang.words.check2 }}" onclick="openSmonDialog('http')">+ {{lang.words.add|title()}} {{ lang.words.check2 }}</div>
{% endif %}
<br /> <br />
<h3>{{lang.smon_page.desc.not_added}}</h3> <h3>{{lang.smon_page.desc.not_added}}</h3>
<img src="{{ url_for('static', filename='images/no_servers.png')}}" alt="There is no server"> <img src="{{ url_for('static', filename='images/no_servers.png')}}" alt="There is no server">

2
config_other/logrotate/backup

@ -1,4 +1,4 @@
/var/www/haproxy-wi/log/backup.log { /var/www/roxy-wi/log/backup.log {
daily daily
rotate 10 rotate 10
missingok missingok

19
config_other/logrotate/roxy-wi

@ -0,0 +1,19 @@
/var/www/roxy-wi/log/roxy-wi.log {
daily
rotate 10
missingok
notifempty
create 0644 apache apache
dateext
sharedscripts
}
/var/www/roxy-wi/log/config_edit.log {
daily
rotate 10
missingok
notifempty
create 0644 apache apache
dateext
sharedscripts
}

40
inc/metrics.js

@ -85,10 +85,10 @@ function renderHttpChart(data, labels, server) {
font: { font: {
size: 20, size: 20,
}, },
padding: {
top: 0,
},
}, },
legend: {
position: 'bottom'
}
}, },
scales: { scales: {
y: { y: {
@ -211,9 +211,6 @@ function renderChart(data, labels, server) {
font: { font: {
size: 20, size: 20,
}, },
padding: {
top: 0,
},
}, },
legend: { legend: {
display: true, display: true,
@ -224,6 +221,7 @@ function renderChart(data, labels, server) {
family: 'BlinkMacSystemFont' family: 'BlinkMacSystemFont'
} }
}, },
position: 'bottom'
} }
} }
} }
@ -281,9 +279,9 @@ function renderServiceChart(data, labels, server, service) {
font: { font: {
size: 20 size: 20
}, },
padding: { legend: {
top: 0 position: 'bottom'
} }
}, },
legend: { legend: {
display: true, display: true,
@ -293,7 +291,8 @@ function renderServiceChart(data, labels, server, service) {
size: '10', size: '10',
family: 'BlinkMacSystemFont' family: 'BlinkMacSystemFont'
} }
} },
position: 'bottom'
} }
}, },
scales: { scales: {
@ -341,20 +340,20 @@ function getApacheChartData(server) {
}, },
type: "POST", type: "POST",
success: function (result) { success: function (result) {
var data = []; let data = [];
data.push(result.chartData.curr_con); data.push(result.chartData.curr_con);
data.push(result.chartData.server); data.push(result.chartData.server);
var labels = result.chartData.labels; let labels = result.chartData.labels;
renderServiceChart(data, labels, server, 'apache'); renderServiceChart(data, labels, server, 'apache');
} }
}); });
} }
function loadMetrics() { function loadMetrics() {
var service = $('#service').val(); let service = $('#service').val();
$.ajax({ $.ajax({
url: "/app/metrics/" + service + "/table-metrics", url: "/app/metrics/" + service + "/table-metrics",
beforeSend: function () { beforeSend: function () {
$('#table_metrics').html('<img class="loading_full_page" src="/app/static/images/loading.gif" />') $('#table_metrics').html('<img class="loading_full_page" src="/app/static/images/loading.gif" alt="loading..."/>')
}, },
type: "GET", type: "GET",
success: function (data) { success: function (data) {
@ -375,11 +374,11 @@ function getChartDataHapWiRam(ip) {
token: $('#token').val() token: $('#token').val()
}, },
beforeSend: function() { beforeSend: function() {
$('#ram').html('<img class="loading_hapwi_overview" src="/app/static/images/loading.gif" />') $('#ram').html('<img class="loading_hapwi_overview" src="/app/static/images/loading.gif" alt="loading..." />')
}, },
type: "POST", type: "POST",
success: function (result) { success: function (result) {
var data = []; let data = [];
data.push(result.chartData.rams); data.push(result.chartData.rams);
// Получение значений из строки и разделение их на массив // Получение значений из строки и разделение их на массив
const ramsData = data[0].trim().split(' '); const ramsData = data[0].trim().split(' ');
@ -502,7 +501,6 @@ function renderChartHapWiCpu(data) {
labels: { labels: {
color: 'rgb(255, 99, 132)', color: 'rgb(255, 99, 132)',
font: { size: 10, family: 'BlinkMacSystemFont' }, font: { size: 10, family: 'BlinkMacSystemFont' },
color: 'black',
boxWidth: 13, boxWidth: 13,
padding: 5 padding: 5
}, },
@ -559,7 +557,8 @@ $( function() {
}); });
}); });
function removeData() { function removeData() {
for (i = 0; i < charts.length; i++) { let chart;
for (let i = 0; i < charts.length; i++) {
chart = charts[i]; chart = charts[i];
chart.destroy(); chart.destroy();
} }
@ -571,9 +570,9 @@ function showOverviewHapWI() {
NProgress.configure({showSpinner: false}); NProgress.configure({showSpinner: false});
} }
function updatingCpuRamCharts() { function updatingCpuRamCharts() {
if (cur_url[0] == 'overview.py') { if (cur_url[0] == 'overview') {
showOverviewHapWI(); showOverviewHapWI();
} else if (cur_url[0] == 'hapservers.py' && cur_url[1].split('=')[0] == 'service') { } else if (cur_url[0] == 'service' && cur_url[2]) {
NProgress.configure({showSpinner: false}); NProgress.configure({showSpinner: false});
showOverviewHapWI(); showOverviewHapWI();
getChartData(server_ip); getChartData(server_ip);
@ -644,7 +643,6 @@ function renderSMONChart(data, labels, server) {
labels: { labels: {
color: 'rgb(255, 99, 132)', color: 'rgb(255, 99, 132)',
font: { size: 10, family: 'BlinkMacSystemFont' }, font: { size: 10, family: 'BlinkMacSystemFont' },
color: 'black',
boxWidth: 13, boxWidth: 13,
padding: 5 padding: 5
}, },

5
inc/smon.js

@ -16,7 +16,7 @@ function sort_by_status() {
$(".dis").prependTo("#dis_services"); $(".dis").prependTo("#dis_services");
$('.group').remove(); $('.group').remove();
$('.group_name').detach(); $('.group_name').detach();
window.history.pushState("SMON Dashboard", "SMON Dashboard", cur_url[0]+"?action=view&sort=by_status"); window.history.pushState("SMON Dashboard", "SMON Dashboard", "?sort=by_status");
} }
function showSmon(action) { function showSmon(action) {
let sort = ''; let sort = '';
@ -30,6 +30,9 @@ function showSmon(action) {
sort = ''; sort = '';
} }
} }
if (action === 'not_sort') {
window.history.pushState("SMON Dashboard", "SMON Dashboard", "/app/smon/dashboard");
}
$.ajax({ $.ajax({
url: "/app/smon/refresh", url: "/app/smon/refresh",
data: { data: {

Loading…
Cancel
Save