mirror of https://github.com/Aidaho12/haproxy-wi
parent
c4dac4d3ad
commit
cc0edee75a
|
@ -668,7 +668,7 @@ def update_db_v_6_3_18():
|
||||||
|
|
||||||
def update_ver():
|
def update_ver():
|
||||||
try:
|
try:
|
||||||
Version.update(version='7.0.3.0').execute()
|
Version.update(version='7.0.4.0').execute()
|
||||||
except Exception:
|
except Exception:
|
||||||
print('Cannot update version')
|
print('Cannot update version')
|
||||||
|
|
||||||
|
|
|
@ -184,14 +184,27 @@ def show_status_page(slug: str) -> str:
|
||||||
check_type = ''
|
check_type = ''
|
||||||
check_id = str(check.check_id)
|
check_id = str(check.check_id)
|
||||||
smon = sql.select_smon_by_id(check_id)
|
smon = sql.select_smon_by_id(check_id)
|
||||||
|
uptime = check_uptime(check_id)
|
||||||
|
en = ''
|
||||||
for s in smon:
|
for s in smon:
|
||||||
name = s.name
|
name = s.name
|
||||||
desc = s.desc
|
desc = s.desc
|
||||||
group = s.group
|
|
||||||
check_type = s.check_type
|
check_type = s.check_type
|
||||||
en = s.en
|
en = s.en
|
||||||
uptime = check_uptime(check_id)
|
group = s.group if s.group else 'No group'
|
||||||
|
|
||||||
checks_status[check_id] = {'uptime': uptime, 'name': name, 'desc': desc, 'group': group, 'check_type': check_type, 'en': en}
|
checks_status[check_id] = {'uptime': uptime, 'name': name, 'desc': desc, 'group': group, 'check_type': check_type, 'en': en}
|
||||||
|
|
||||||
return render_template('smon/status_page.html', page=page, checks_status=checks_status)
|
return render_template('smon/status_page.html', page=page, checks_status=checks_status)
|
||||||
|
|
||||||
|
|
||||||
|
def avg_status_page_status(page_id: int) -> str:
|
||||||
|
page_id = int(page_id)
|
||||||
|
checks = sql.select_status_page_checks(page_id)
|
||||||
|
|
||||||
|
for check in checks:
|
||||||
|
check_id = str(check.check_id)
|
||||||
|
if not sql.get_last_smon_status_by_check(check_id):
|
||||||
|
return '0'
|
||||||
|
|
||||||
|
return '1'
|
||||||
|
|
|
@ -149,6 +149,11 @@ def show_smon_status_page(slug):
|
||||||
return smon_mod.show_status_page(slug)
|
return smon_mod.show_status_page(slug)
|
||||||
|
|
||||||
|
|
||||||
|
@bp.route('/status/avg/<int:page_id>')
|
||||||
|
def smon_history_statuses_avg(page_id):
|
||||||
|
return smon_mod.avg_status_page_status(page_id)
|
||||||
|
|
||||||
|
|
||||||
@bp.route('/history')
|
@bp.route('/history')
|
||||||
@login_required
|
@login_required
|
||||||
@get_user_params()
|
@get_user_params()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{% for page in pages %}
|
{% for page in pages %}
|
||||||
<div id="page_{{page}}" class="page_div">
|
<div id="page_{{page}}" class="page_div">
|
||||||
<a href="/app/smon/status/{{page.slug}}" class="page_link" target="_blank" title="Open status page">
|
<a href="/app/smon/status/{{page.slug}}" class="page_link" target="_blank" title="Open status page">
|
||||||
<i class="far fa-check-circle status-page-icon"></i>
|
<span id="page_status-{{page}}"><i class="far fa-check-circle status-page-icon"></i></span>
|
||||||
<div>
|
<div>
|
||||||
<span class="page_name" id="page_name-{{page}}">{{page.name}}</span>
|
<span class="page_name" id="page_name-{{page}}">{{page.name}}</span>
|
||||||
{% if page.desc %}
|
{% if page.desc %}
|
||||||
|
@ -13,4 +13,5 @@
|
||||||
<div class="edit status_page-edit" onclick="createStatusPageStep1('true', '{{page}}')"></div>
|
<div class="edit status_page-edit" onclick="createStatusPageStep1('true', '{{page}}')"></div>
|
||||||
<div class="delete" onclick="confirmDeleteStatusPage('{{page}}')"></div>
|
<div class="delete" onclick="confirmDeleteStatusPage('{{page}}')"></div>
|
||||||
</div>
|
</div>
|
||||||
|
<script>smon_manage_status_page_avg_status('{{page}}')</script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
<meta name="msapplication-TileColor" content="#ffffff">
|
<meta name="msapplication-TileColor" content="#ffffff">
|
||||||
<meta name="msapplication-TileImage" content="{{ url_for('static', filename='images/favicon/ms-icon-144x144.png') }}">
|
<meta name="msapplication-TileImage" content="{{ url_for('static', filename='images/favicon/ms-icon-144x144.png') }}">
|
||||||
<meta name="theme-color" content="#ffffff">
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
<script src="https://use.fontawesome.com/releases/v5.15.4/js/all.js" data-auto-replace-svg="nest"></script>
|
||||||
<link href="/inc/css/jquery-ui.min.css" rel="stylesheet">
|
<link href="/inc/css/jquery-ui.min.css" rel="stylesheet">
|
||||||
<link href="/inc/css/jquery-ui.structure.min.css" rel="stylesheet">
|
<link href="/inc/css/jquery-ui.structure.min.css" rel="stylesheet">
|
||||||
<link href="/inc/css/style-6.3.9.css" rel="stylesheet">
|
<link href="/inc/css/style-6.3.9.css" rel="stylesheet">
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
<body>
|
<body>
|
||||||
<h2>Status page - {{p.name}}</h2>
|
<h2>Status page - {{p.name}}</h2>
|
||||||
<h3>{{p.desc|replace("'", "")}}</h3>
|
<h3>{{p.desc|replace("'", "")}}</h3>
|
||||||
|
<div id="page_status" class="page_cur_status"></div>
|
||||||
{% for check, value in checks_status.items() %}
|
{% for check, value in checks_status.items() %}
|
||||||
{% if value.uptime|int() > 50 and value.uptime|int() < 90 %}
|
{% if value.uptime|int() > 50 and value.uptime|int() < 90 %}
|
||||||
{% set add_class = 'serverWarn' %}
|
{% set add_class = 'serverWarn' %}
|
||||||
|
@ -53,9 +55,12 @@
|
||||||
<span class="check_name">{{value.name|replace("'", "")}}</span>
|
<span class="check_name">{{value.name|replace("'", "")}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="history_statuses" id="history-{{check}}"></div>
|
<div class="history_statuses" id="history-{{check}}"></div>
|
||||||
|
<div class="tooltip check_tooltip">Group: {{value.group}}, check type: {{value.check_type}}</div>
|
||||||
|
<div class="tooltip check_tooltip check_last_check">last check</div>
|
||||||
</div>
|
</div>
|
||||||
<script>show_smon_history_statuses('{{check}}', '#history-{{check}}');</script>
|
<script>show_smon_history_statuses('{{check}}', '#history-{{check}}');</script>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<script>smon_status_page_avg_status('{{p.id}}');</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -280,7 +280,7 @@
|
||||||
}
|
}
|
||||||
.menu-bar::before {
|
.menu-bar::before {
|
||||||
display: none;
|
display: none;
|
||||||
font-family: "Font Awesome 5 Regular";
|
font-family: "Font Awesome 5 Solid";
|
||||||
content: "\f0c9";
|
content: "\f0c9";
|
||||||
}
|
}
|
||||||
.menu-bar > .fa-bars {
|
.menu-bar > .fa-bars {
|
||||||
|
|
|
@ -125,15 +125,41 @@ h4 {
|
||||||
.page_slug {
|
.page_slug {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
}
|
}
|
||||||
|
.page_cur_status {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 25px;
|
||||||
|
font-weight: 700;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
|
.page_icon {
|
||||||
|
font-size: 25px;
|
||||||
|
margin: 0 10px 10px 0;
|
||||||
|
}
|
||||||
|
.page_icon_all_ok {
|
||||||
|
color: var(--green-color);
|
||||||
|
}
|
||||||
|
.page_icon_not_ok {
|
||||||
|
color: var(--red-color);
|
||||||
|
}
|
||||||
.status-page-icon {
|
.status-page-icon {
|
||||||
float: left;
|
float: left;
|
||||||
margin: 10px;
|
|
||||||
margin-top: 0px;
|
|
||||||
font-size: 50px;
|
font-size: 50px;
|
||||||
margin-right: 25px;
|
margin: 0 25px 10px 0;
|
||||||
margin-left: 0;
|
}
|
||||||
|
.status-page-icon-ok {
|
||||||
color: var(--green-color);
|
color: var(--green-color);
|
||||||
}
|
}
|
||||||
|
.status-page-icon-not-ok {
|
||||||
|
color: var(--red-color);
|
||||||
|
}
|
||||||
|
.status_page-edit {
|
||||||
|
float: right;
|
||||||
|
margin-right: 1.5%;
|
||||||
|
margin-top: -28px;
|
||||||
|
font-size: 19;
|
||||||
|
color: var(--blue-color);
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
.delete {
|
.delete {
|
||||||
float: left;
|
float: left;
|
||||||
margin-left: 99%;
|
margin-left: 99%;
|
||||||
|
@ -144,7 +170,7 @@ h4 {
|
||||||
.check_div {
|
.check_div {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
padding: 20px 30px 20px 30px;
|
padding: 20px 30px 20px 30px;
|
||||||
margin-left: 20%;
|
margin-left: 25%;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
}
|
}
|
||||||
|
@ -161,6 +187,16 @@ h4 {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
font-weight: 550;
|
font-weight: 550;
|
||||||
}
|
}
|
||||||
|
.check_tooltip {
|
||||||
|
height: 10px;
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-left: 5px;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
.check_last_check {
|
||||||
|
float: right;
|
||||||
|
margin-top: -15px;
|
||||||
|
}
|
||||||
.history_statuses {
|
.history_statuses {
|
||||||
float: right;
|
float: right;
|
||||||
margin-top: -20px;
|
margin-top: -20px;
|
||||||
|
|
36
inc/smon.js
36
inc/smon.js
|
@ -403,6 +403,42 @@ function show_smon_history_statuses(dashboard_id, id_for_history_replace) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function smon_status_page_avg_status(page_id) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/smon/status/avg/" + page_id,
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
if (data == '1') {
|
||||||
|
$('#page_status').html('<i class="far fa-check-circle page_icon page_icon_all_ok"></i><span>All Systems Operational</span>');
|
||||||
|
} else {
|
||||||
|
$('#page_status').html('<i class="far fa-times-circle page_icon page_icon_not_ok"></i><span>Not all Systems Operational</span>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function smon_manage_status_page_avg_status(page_id) {
|
||||||
|
$.ajax({
|
||||||
|
url: "/app/smon/status/avg/" + page_id,
|
||||||
|
success: function (data) {
|
||||||
|
data = data.replace(/\s+/g, ' ');
|
||||||
|
if (data.indexOf('error:') != '-1' || data.indexOf('unique') != '-1') {
|
||||||
|
toastr.error(data);
|
||||||
|
} else {
|
||||||
|
toastr.clear();
|
||||||
|
if (data == '1') {
|
||||||
|
$('#page_status-'+page_id).html('<i class="far fa-check-circle status-page-icon status-page-icon-ok"></i>');
|
||||||
|
} else {
|
||||||
|
$('#page_status-'+page_id).html('<i class="far fa-times-circle status-page-icon status-page-icon-not-ok"></i>')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
function createStatusPageStep1(edited=false, page_id=0) {
|
function createStatusPageStep1(edited=false, page_id=0) {
|
||||||
var add_word = $('#translate').attr('data-next');
|
var add_word = $('#translate').attr('data-next');
|
||||||
var cancel_word = $('#translate').attr('data-cancel');
|
var cancel_word = $('#translate').attr('data-cancel');
|
||||||
|
|
Loading…
Reference in New Issue