mirror of https://github.com/Aidaho12/haproxy-wi
v8.0: Add new icons and update HA view validation
Added new icons for Keepalived and Roxy services in the static images and integrated them into the main menu. Updated HA view validation to use `eth` instead of `ip` and changed certain property types from string to integer. Enhanced error handling and data processing for the configuration routes and improved JSON data handling in the script.js file.pull/399/head
parent
bf7469cc3f
commit
4e5f4b2bd1
|
@ -477,9 +477,12 @@ def show_config(server_ip: str, service: str, config_file_name: str, configver:
|
|||
configs_dir = config_common.get_config_dir(service)
|
||||
server = server_sql.get_server_by_ip(server_ip)
|
||||
|
||||
try:
|
||||
config_file_name = config_file_name.replace('/', '92')
|
||||
except Exception:
|
||||
if config_file_name != 'undefined':
|
||||
try:
|
||||
config_file_name = config_file_name.replace('/', '92')
|
||||
except Exception:
|
||||
config_file_name = ''
|
||||
else:
|
||||
config_file_name = ''
|
||||
|
||||
if '..' in configs_dir:
|
||||
|
|
|
@ -34,12 +34,16 @@ def before_request():
|
|||
@bp.route('/<service>/show', methods=['POST'])
|
||||
@check_services
|
||||
def show_config(service):
|
||||
config_file_name = request.form.get('config_file_name')
|
||||
configver = request.form.get('configver')
|
||||
server_ip = request.form.get('serv')
|
||||
config_file_name = request.json.get('config_file_name')
|
||||
configver = request.json.get('configver')
|
||||
server_ip = request.json.get('serv')
|
||||
claims = get_jwt()
|
||||
|
||||
return config_mod.show_config(server_ip, service, config_file_name, configver, claims)
|
||||
try:
|
||||
data = config_mod.show_config(server_ip, service, config_file_name, configver, claims)
|
||||
return DataStrResponse(data=data).model_dump(mode='json'), 200
|
||||
except Exception as e:
|
||||
return roxywi_common.handler_exceptions_for_json_data(e, '')
|
||||
|
||||
|
||||
@bp.route('/<service>/show-files', methods=['POST'])
|
||||
|
@ -48,7 +52,10 @@ def show_config_files(service):
|
|||
server_ip = request.form.get('serv')
|
||||
config_file_name = request.form.get('config_file_name')
|
||||
|
||||
return config_mod.show_config_files(server_ip, service, config_file_name)
|
||||
try:
|
||||
return config_mod.show_config_files(server_ip, service, config_file_name)
|
||||
except Exception as e:
|
||||
return f'error: {e}'
|
||||
|
||||
|
||||
@bp.route('/<service>/find-in-config', methods=['POST'])
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f04b";
|
||||
}
|
||||
.overview-link::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f21e";
|
||||
}
|
||||
/*.overview-link::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f21e";*/
|
||||
/*}*/
|
||||
.stats::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Regular";
|
||||
|
@ -35,11 +35,6 @@
|
|||
font-family: "Font Awesome 5 Regular";
|
||||
content: "\f080";
|
||||
}
|
||||
/*.logs::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f02d";*/
|
||||
/*}*/
|
||||
.map::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
|
@ -50,16 +45,6 @@
|
|||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f233";
|
||||
}
|
||||
/*.metrics::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f1fe";*/
|
||||
/*}*/
|
||||
/*.config-show::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f6ff";*/
|
||||
/*}*/
|
||||
.compare::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Regular";
|
||||
|
@ -76,16 +61,6 @@
|
|||
.plus-after > .fa-plus, .minus-after > .fa-minus, .minus > .fa-minus, .plus > .fa-plus {
|
||||
color: var(--blue-color);
|
||||
}
|
||||
/*.add-proxy::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f067";*/
|
||||
/*}*/
|
||||
/*.cert::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f0a3";*/
|
||||
/*}*/
|
||||
.option::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Regular";
|
||||
|
@ -101,11 +76,6 @@
|
|||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f0cb";
|
||||
}
|
||||
/*.waf-menu::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f06d";*/
|
||||
/*}*/
|
||||
.hap-menu::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
|
@ -116,26 +86,16 @@
|
|||
font-family: "Font Awesome 5 Regular";
|
||||
content: "\f074";
|
||||
}
|
||||
/*.backup::before {*/
|
||||
/*.ha::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Regular";*/
|
||||
/* content: "\f24d";*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f0c2";*/
|
||||
/*}*/
|
||||
.ha::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f0c2";
|
||||
}
|
||||
.keepalived::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f126";
|
||||
}
|
||||
/*.nginx-menu::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f0e8";*/
|
||||
/*}*/
|
||||
.apache-menu::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
|
@ -185,11 +145,6 @@
|
|||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f21b";
|
||||
}
|
||||
/*.users::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f234";*/
|
||||
/*}*/
|
||||
.group::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
|
@ -200,11 +155,6 @@
|
|||
font-family: "Font Awesome 5 Regular";
|
||||
content: "\f2b9";
|
||||
}
|
||||
/*.settings::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f0ad";*/
|
||||
/*}*/
|
||||
.add-admin::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
|
@ -362,16 +312,6 @@
|
|||
.note-symbol .question-circle {
|
||||
padding-left: 5px;
|
||||
}
|
||||
/*.port-scanner::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f796";*/
|
||||
/*}*/
|
||||
/*.net-tools::before {*/
|
||||
/* display: none;*/
|
||||
/* font-family: "Font Awesome 5 Solid";*/
|
||||
/* content: "\f7d9";*/
|
||||
/*}*/
|
||||
.shield::before {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 4.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
|
@ -338,20 +338,22 @@ function showConfig() {
|
|||
}
|
||||
}
|
||||
clearAllAjaxFields();
|
||||
let json_data = {
|
||||
"serv": $("#serv").val(),
|
||||
"service": service,
|
||||
"config_file_name": config_file_name
|
||||
}
|
||||
$.ajax( {
|
||||
url: "/config/" + service + "/show",
|
||||
data: {
|
||||
serv: $("#serv").val(),
|
||||
service: service,
|
||||
config_file_name: config_file_name
|
||||
},
|
||||
data: JSON.stringify(json_data),
|
||||
type: "POST",
|
||||
contentType: "application/json; charset=utf-8",
|
||||
success: function( data ) {
|
||||
if (data.indexOf('error:') != '-1') {
|
||||
if (data.status === 'failed') {
|
||||
toastr.error(data);
|
||||
} else {
|
||||
toastr.clear();
|
||||
$("#ajax").html(data);
|
||||
$("#ajax").html(data.data);
|
||||
$.getScript(configShow);
|
||||
window.history.pushState("Show config", "Show config", "/config/" + service + "/" + $("#serv").val() + "/show/" + config_file_name);
|
||||
}
|
||||
|
|
|
@ -9,7 +9,12 @@
|
|||
<div id="top-link" class="top-link">
|
||||
<nav id="menu">
|
||||
<ul class="menu">
|
||||
<li><a href="{{ url_for('overview.index') }}" title="{{lang.menu_links.overview.title}}" class="overview-link {% if request.url_rule.endpoint == 'overview.index' %} menu-active{% endif %}">{{lang.menu_links.overview.link}}</a></li>
|
||||
<li>
|
||||
<a href="{{ url_for('overview.index') }}" title="{{lang.menu_links.overview.title}}" class="{% if request.url_rule.endpoint == 'overview.index' %} menu-active{% endif %}">
|
||||
<img src="{{ url_for('static', filename='images/roxy_icon.png') }}" class="menu-vendor-logo" style="width: 19px;">
|
||||
{{lang.menu_links.overview.link}}
|
||||
</a>
|
||||
</li>
|
||||
{% if '5' in g.user_params['user_services'] %}
|
||||
{% if g.user_params['role'] <= 3 %}
|
||||
{% endif %}
|
||||
|
@ -83,7 +88,10 @@
|
|||
{% if '3' in g.user_params['user_services'] %}
|
||||
{% if g.user_params['role'] <= 2 %}
|
||||
<li class="p_menu">
|
||||
<a href="{{ url_for('service.services', service='keepalived') }}" title="{{lang.menu_links.hapservers.keepalived.title}}" class="ha">Keepalived</a>
|
||||
<a href="{{ url_for('service.services', service='keepalived') }}" title="{{lang.menu_links.hapservers.keepalived.title}}">
|
||||
<img src="{{ url_for('static', filename='images/keepalived_icon.png') }}" class="menu-vendor-logo" style="margin: 0 5px 0 0;">
|
||||
Keepalived
|
||||
</a>
|
||||
<ul class="v_menu">
|
||||
<li><a href="{{ url_for('service.services', service='keepalived') }}" title="{{lang.menu_links.hapservers.keepalived.title}}" class="head-submenu">{{lang.menu_links.hapservers.link}}</a> </li>
|
||||
<li><a href="{{ url_for('config.config', service='keepalived') }}" title="{{lang.menu_links.config.keepalived.title}}" class="head-submenu">{{lang.menu_links.config.link}}</a></li>
|
||||
|
|
|
@ -137,8 +137,9 @@ class HAView(MethodView):
|
|||
items:
|
||||
type: 'object'
|
||||
properties:
|
||||
ip:
|
||||
eth:
|
||||
type: 'string'
|
||||
description: Ethernet interface to bind VIP address
|
||||
master:
|
||||
type: 'integer'
|
||||
id:
|
||||
|
@ -163,11 +164,11 @@ class HAView(MethodView):
|
|||
type: object
|
||||
properties:
|
||||
enabled:
|
||||
type: string
|
||||
type: integer
|
||||
docker:
|
||||
type: integer
|
||||
router_id:
|
||||
type: string
|
||||
type: integer
|
||||
responses:
|
||||
201:
|
||||
description: HA cluster created successfully
|
||||
|
@ -215,8 +216,9 @@ class HAView(MethodView):
|
|||
items:
|
||||
type: 'object'
|
||||
properties:
|
||||
ip:
|
||||
eth:
|
||||
type: 'string'
|
||||
description: Ethernet interface to bind VIP address
|
||||
master:
|
||||
type: 'integer'
|
||||
id:
|
||||
|
@ -241,7 +243,7 @@ class HAView(MethodView):
|
|||
type: object
|
||||
properties:
|
||||
enabled:
|
||||
type: string
|
||||
type: integer
|
||||
docker:
|
||||
type: integer
|
||||
responses:
|
||||
|
|
|
@ -13,6 +13,7 @@ from app.modules.roxywi.exception import RoxywiGroupMismatch, RoxywiResourceNotF
|
|||
from app.modules.roxywi.class_models import BaseResponse, GroupQuery, CredRequest, CredUploadRequest
|
||||
from app.modules.common.common_classes import SupportClass
|
||||
|
||||
|
||||
class CredView(MethodView):
|
||||
methods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH']
|
||||
decorators = [jwt_required(), get_user_params(), page_for_admin(level=2), check_group()]
|
||||
|
|
Loading…
Reference in New Issue