v8.2: Remove unused intro.js templates and mappings

Deleted the admin introduction script and associated source map since they are no longer required. This cleanup helps to reduce clutter and improve maintainability of the project.
pull/399/head
Aidaho 2024-10-03 14:37:04 +03:00
parent f6298cd911
commit 82662042e3
17 changed files with 121 additions and 569 deletions

View File

@ -1,3 +1,5 @@
import ast
from playhouse.shortcuts import model_to_dict
import app.modules.db.udp as udp_sql
@ -10,7 +12,7 @@ import app.modules.roxywi.common as roxywi_common
def get_listener_config(listener_id: int) -> dict:
listener = udp_sql.get_listener(listener_id)
listener_json = model_to_dict(listener, recurse=False)
listener_json['config'] = eval(listener_json['config'])
listener_json['config'] = ast.literal_eval(listener_json['config'])
return listener_json

View File

@ -39,12 +39,3 @@
dest: "{{ cfg }}"
marker: "# {mark} Roxy-WI MANAGED {{ config.type }} {{ config.name }} do not edit it directly"
when: action == 'delete' and config.name
- name: Delete Global or Defaults
blockinfile:
block: ""
dest: "{{ cfg }}"
marker: "# {mark} Roxy-WI MANAGED {{ config.type }} do not edit it directly"
when:
- action == 'delete'
- config.type == 'global' or config.type == 'defaults

View File

@ -227,6 +227,37 @@ function openSection(section) {
$(section_id + ' select[name="server"]').val(data.server_id).change();
$(section_id + ' select[name="server"]').selectmenu('disable').parent().parent().hide();
$(section_id + ' input[name="name"]').prop("readonly", true).parent().parent().hide();
let buttons = [{
text: edit_word,
click: function () {
editProxy('add-' + section_type, $(this));
}
}, {
text: delete_word,
click: function () {
confirmDeleteSection(section_type, section_name, $('#serv').val(), $(this));
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
$('#edit-' + section_type).hide();
}
}]
if (section_type === 'defaults' || section_type === 'global') {
buttons = [{
text: edit_word,
click: function () {
editProxy('add-' + section_type, $(this));
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
$('#edit-' + section_type).hide();
}
}]
}
$("#edit-section").dialog({
resizable: false,
height: "auto",
@ -236,25 +267,7 @@ function openSection(section) {
close: function () {
$('#edit-' + section_type).hide();
},
buttons: [{
text: edit_word,
click: function () {
editProxy('add-' + section_type, $(this));
}
}, {
text: delete_word,
click: function () {
delete_section(section_type, section_name, $('#serv').val());
$(this).dialog("close");
$('#edit-' + section_type).hide();
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
$('#edit-' + section_type).hide();
}
}]
buttons: buttons
});
}
});
@ -622,3 +635,25 @@ function getFormData($form, form_name) {
}
return indexed_array;
}
function confirmDeleteSection(section_type, section_name, serv_val, dialog_id) {
$( "#dialog-confirm" ).dialog({
resizable: false,
height: "auto",
width: 400,
modal: true,
title: delete_word + " " + section_name + "?",
buttons: [{
text: delete_word,
click: function () {
$(this).dialog("close");
delete_section(section_type, section_name, serv_val);
dialog_id.dialog("close");
}
}, {
text: cancel_word,
click: function () {
$(this).dialog("close");
}
}]
});
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,55 +0,0 @@
.introjs-tooltip {
background-color: var(--menu-color);
color: #fff;
}
.introjs-button,
.introjs-button:hover, .introjs-button:focus, .introjs-button:active,
.introjs-disabled, .introjs-disabled:focus, .introjs-disabled:hover {
outline: none;
background-image: none;
background-color: transparent;
color: #fff;
border: 1px solid transparent;
/*border-radius: 50px;*/
box-shadow: none;
border-shadow: none;
text-shadow: none;
}
.introjs-button:hover, .introjs-button:focus, .introjs-button:active {
border: 1px solid #fff
}
.introjs-disabled, .introjs-disabled:focus, .introjs-disabled:hover {
color: #ccc;
border: 1px solid transparent;
}
.introjs-arrow {
border: 10px solid #fff;
}
.introjs-arrow.top, .introjs-arrow.top-middle, .introjs-arrow.top-right {
border-color: transparent transparent var(--menu-color);
top: -20px;
left: 20px;
}
.introjs-arrow.bottom, .introjs-arrow.bottom-middle, .introjs-arrow.bottom-right {
border-color: rgba(000, 0, 0, 0.5) transparent transparent;
bottom: -20px;
left: 20px;
}
.introjs-arrow.left, .introjs-arrow.right {
top: 20px;
}
.introjs-arrow.left-bottom, .introjs-arrow.right-bottom {
bottom: 20px;
}
.introjs-arrow.left, .introjs-arrow.left-bottom {
left: -20px;
border-color: transparent rgba(000, 0, 0, 0.5) transparent transparent;
}
.introjs-arrow.right, .introjs-arrow.right-bottom {
right: -20px;
border-color: transparent transparent transparent rgba(000, 0, 0, 0.5);
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1198,129 +1198,66 @@ function show_version() {
} );
NProgress.configure({showSpinner: true});
}
// function statAgriment() {
// var cur_url = window.location.href.split('/').pop();
// cur_url = cur_url.split('/');
// if (localStorage.getItem('statistic') == null && cur_url != 'login') {
// var titles = new Map()
// var body = new Map()
// var yes_ans = new Map()
// var no_ans = new Map()
// var ver_question = randomIntFromInterval(1, 2);
// titles.set(1, 'Help us improve Roxy-WI');
// titles.set(2, 'Data collection agreement');
// body.set(1, 'We want to improve the user experience by collecting anonymous statistics. No marketing.');
// body.set(2, 'Wed like to improve your experience in Roxy-WI, so we ask for statistics collection. No personal data is collected.');
// yes_ans.set(1, 'Yes');
// yes_ans.set(2, 'Agree and help the Roxy-WI team');
// no_ans.set(1, 'No');
// no_ans.set(2, 'Disagree');
// $("#statistic").dialog({
// autoOpen: true,
// resizable: false,
// height: "auto",
// width: 600,
// modal: true,
// title: titles.get(ver_question),
// show: {
// effect: "fade",
// duration: 200
// },
// hide: {
// effect: "fade",
// duration: 200
// },
// buttons: [{
// "id": "statYesBut",
// text: "Yes",
// click: function () {
// localStorage.setItem('statistic', '1');
// $(this).dialog("close");
// sendGet('page/ans/1/' + ver_question);
// statAgriment();
// },
// }, {
// "id": "statNoBut",
// text: "No",
// click: function () {
// localStorage.setItem('statistic', '0');
// $(this).dialog("close");
// sendGet('page/ans/0/' + ver_question);
// }
// }]
// });
// $("#statYesBut").html('<span class="ui-button-text">' + yes_ans.get(ver_question) + '</span>');
// $("#statNoBut").html('<span class="ui-button-text">' + no_ans.get(ver_question) + '</span>');
// $("#statistic-body").html(body.get(ver_question));
// }
// if (localStorage.getItem('statistic') == 1) {
// cur_url = btoa(cur_url);
// sendGet('/page/send/'+cur_url);
// }
// }
function startIntro(intro) {
intro = intro.setOptions({'exitOnOverlayClick': false});
var intro_url = cur_url[0].split('#')[0];
var intro_history = {};
intro.onbeforechange(function (targetElement) {
if (intro_url == 'users.py' && this._currentStep == 3) {
$("#tabs").tabs("option", "active", 1);
} else if (intro_url == 'users.py' && this._currentStep == 4) {
$("#tabs").tabs("option", "active", 2);
} else if (intro_url == 'users.py' && this._currentStep == 6) {
$("#tabs").tabs("option", "active", 3);
} else if (intro_url == 'users.py' && this._currentStep == 7) {
$("#tabs").tabs("option", "active", 4);
} else if (intro_url == 'users.py' && this._currentStep == 9) {
$("#tabs").tabs("option", "active", 6);
} else if (intro_url == 'users.py' && this._currentStep == 10) {
$("#tabs").tabs("option", "active", 7);
} else if (intro_url == 'users.py' && this._currentStep == 12) {
$("#tabs").tabs("option", "active", 8);
}
if (intro_url == 'servers.py' && this._currentStep == 5) {
$("#tabs").tabs("option", "active", 1);
} else if (intro_url == 'servers.py' && this._currentStep == 13) {
$("#tabs").tabs("option", "active", 2);
} else if (intro_url == 'servers.py' && this._currentStep == 16) {
$("#tabs").tabs("option", "active", 6);
} else if (intro_url == 'servers.py' && this._currentStep == 18) {
$("#tabs").tabs("option", "active", 7);
}
});
intro.onbeforeexit(function () {
if(localStorage.getItem('intro') === null) {
intro_history[intro_url] = '1';
localStorage.setItem('intro', JSON.stringify(intro_history));
} else {
intro_history = localStorage.getItem('intro');
intro_history = JSON.parse(intro_history);
intro_history[intro_url] = '1';
localStorage.setItem('intro', JSON.stringify(intro_history));
}
});
intro.onexit(function() {
sendGet('intro/' + intro_url + '/' + this._currentStep);
});
if(localStorage.getItem('intro') === null) {
if (intro_url.split('#')[0] == 'users.py' || intro_url.split('#')[0] == 'servers.py') {
$( "#tabs" ).tabs( "option", "active", 0 );
}
intro.start();
} else {
intro_history = localStorage.getItem('intro');
intro_history = JSON.parse(intro_history);
if (intro_history[intro_url] != '1') {
if (intro_url.split('#')[0] == 'users.py' || intro_url.split('#')[0] == 'servers.py') {
$( "#tabs" ).tabs( "option", "active", 0 );
}
intro.start();
}
function statAgriment() {
var cur_url = window.location.href.split('/').pop();
cur_url = cur_url.split('/');
if (localStorage.getItem('statistic') == null && cur_url != 'login') {
var titles = new Map()
var body = new Map()
var yes_ans = new Map()
var no_ans = new Map()
var ver_question = randomIntFromInterval(1, 2);
titles.set(1, 'Help us improve Roxy-WI');
titles.set(2, 'Data collection agreement');
body.set(1, 'We want to improve the user experience by collecting anonymous statistics. No marketing.');
body.set(2, 'Wed like to improve your experience in Roxy-WI, so we ask for statistics collection. No personal data is collected.');
yes_ans.set(1, 'Yes');
yes_ans.set(2, 'Agree and help the Roxy-WI team');
no_ans.set(1, 'No');
no_ans.set(2, 'Disagree');
$("#statistic").dialog({
autoOpen: true,
resizable: false,
height: "auto",
width: 600,
modal: true,
title: titles.get(ver_question),
show: {
effect: "fade",
duration: 200
},
hide: {
effect: "fade",
duration: 200
},
buttons: [{
"id": "statYesBut",
text: "Yes",
click: function () {
localStorage.setItem('statistic', '1');
$(this).dialog("close");
sendGet('page/ans/1/' + ver_question);
statAgriment();
},
}, {
"id": "statNoBut",
text: "No",
click: function () {
localStorage.setItem('statistic', '0');
$(this).dialog("close");
sendGet('page/ans/0/' + ver_question);
}
}]
});
$("#statYesBut").html('<span class="ui-button-text">' + yes_ans.get(ver_question) + '</span>');
$("#statNoBut").html('<span class="ui-button-text">' + no_ans.get(ver_question) + '</span>');
$("#statistic-body").html(body.get(ver_question));
}
if (localStorage.getItem('statistic') == 1) {
cur_url = btoa(cur_url);
sendGet('/page/send/'+cur_url);
}
}
// document.addEventListener("DOMContentLoaded", function(event){
// statAgriment();
// });
function sendGet(page) {
let xmlHttp = new XMLHttpRequest();
let theUrl = 'https://roxy-wi.org/' + page;

View File

@ -180,10 +180,7 @@
});
</script>
<link href="{{ url_for('static', filename='css/servers.css') }}" rel="stylesheet"/>
{% if g.user_params['role'] == 1 %}
{% include 'include/intro/admin.html' %}
{% else %}
{% include 'include/intro/servers.html' %}
{% if g.user_params['role'] != 1 %}
<input id="new-sshgroup" type="hidden" value="{{ g.user_params['group_id'] }}">
{% endif %}
{% include 'include/intro/js_script.html' %}

View File

@ -215,7 +215,7 @@
{% if role %}
{% if service != 'keepalived' %}
<span class="accordion-link" onclick="openSection('{{ line| trim }}')">
{{lang.words.edit|title()}}/{{lang.words.delete|title()}}
{{lang.words.edit|title()}}
</span>
</span>
{% endif %}
@ -227,7 +227,7 @@
</div><span class="param">{{ line }}
{% if role %}
<span class="accordion-link" onclick="openSection('{{ line| trim }}')">
{{lang.words.edit|title()}}/{{lang.words.delete|title()}}
{{lang.words.edit|title()}}
</span>
{% endif %}
</span><div>
@ -412,3 +412,6 @@
}
</script>
<div id="edit-section" style="display: none;"></div>
<div id="dialog-confirm" style="display: none;">
<p><span class="ui-icon ui-icon-alert" style="float:left; margin:3px 12px 20px 0;"></span>Are you sure?</p>
</div>

View File

@ -1,113 +0,0 @@
<script>
function Intro() {
let intro = introJs();
intro.setOptions({
steps: [
{
element: document.querySelector('#admin-area'),
intro: "Only the user with superAdmin role can access the Admin area section",
position: 'right'
},
{
element: document.querySelector('#admin-area-users'),
intro: "Create, edit, lock/unlock users profiles, grant roles, add new users to groups",
position: 'right'
},
{
element: document.querySelector('#add-user-button'),
intro: " Add new objects clicking by this button",
position: 'left'
},
{
element: document.querySelector('#admin-area-groups'),
intro: " Add new groups or edit existing ones",
position: 'right'
},
{
element: document.querySelector('#admin-area-servers'),
intro: "Choose servers to display on the Overview page, manage their settings and restrict access to configuration files",
position: 'right'
},
{
element: document.querySelector('#servers-help-link'),
intro: "Note that some pages have more extended guides for them",
},
{
element: document.querySelector('#admin-area-ssh'),
intro: "Configure a key-based authentication and restrict access to a server for some users",
position: 'right'
},
{
element: document.querySelector('#admin-area-checker'),
intro: "Set up notifications and the way youll get them",
position: 'right'
},
{
element: document.querySelector('#checker-tabs-head'),
intro: "Note that notification channels and settings are in the different tabs",
},
{
element: document.querySelector('#admin-area-settings'),
intro: "Tap a service name to expand its settings",
position: 'right'
},
{
element: document.querySelector('#admin-area-services'),
intro: "Run, stop and restart services by pressing buttons and read their short descriptions",
position: 'right'
},
{
element: document.querySelector('#admin-area-logs'),
intro: "Select one of all internal logs and click the Show button",
position: 'right'
},
{
element: document.querySelector('#admin-area-update'),
intro: "Update services by pressing buttons and check their versions",
position: 'right'
},
{
element: document.querySelector('#admin-tabs'),
intro: "Navigate through Admin area by clicking tabs above as wel",
},
{
element: document.querySelector('#admin-tabs-vpn'),
intro: " You can access some subsections like OpenVPN..."
},
{
element: document.querySelector('#admin-tabs-backup'),
intro: "Git and Backup...",
},
{
element: document.querySelector('#admin-tabs-mon'),
intro: "and Monitoring installation this way",
},
{
element: document.querySelector('.guid_me'),
intro: "Phew...Im a bit tired of chatting. Would you like to take a break before we continue\n" +
"with another section of Roxy?",
}
]
});
return intro;
}
function introHints() {
let intro = introJs();
intro.setOptions({
hints: [
{ hint: 'Looking for Services? They\'re here, now it\'s called Tools', element: '#ui-id-7' },
]
});
intro.onhintclose(function() {
localStorage.setItem('introHintAdminTools', '1');
localStorage.removeItem('introHintAdminRoles');
});
return intro;
}
if (!localStorage.getItem('introHintAdminTools')) {
setTimeout(() => {
var intro_temp = introHints();
intro_temp.addHints();
}, 1000);
}
</script>

View File

@ -1,18 +0,0 @@
<script>
function startIntroAgain() {
var intro = Intro();
var intro_url = cur_url[0].split('#')[0];
var intro_history = {};
if (intro_url.split('#')[0] == 'users.py' || intro_url.split('#')[0] == 'servers.py') {
$("#tabs").tabs("option", "active", 0);
}
if (localStorage.getItem('intro') === null) {
startIntro(intro);
} else {
intro_history = JSON.parse(localStorage.getItem('intro'));
delete intro_history[intro_url];
localStorage.setItem('intro', JSON.stringify(intro_history));
startIntro(intro);
}
}
</script>

View File

@ -1,91 +0,0 @@
<script>
function Intro() {
let intro = introJs();
intro.setOptions({
steps: [
{
element: document.querySelector('#body'),
title: "Welcome to Roxy-WI!",
intro: "We're going to explain some basics...",
},
{
element: document.querySelector('.overview-link'),
intro: "You're here now",
position: 'right'
},
{
element: document.querySelector('#overview-roxy-wi'),
title: "Dashboard #1",
intro: "List of your servers and statuses of services which Roxy-WI manages",
},
{
element: document.querySelector('#overview-load'),
title: "Dashboard #2",
intro: "Roxy-WI server load",
},
{
element: document.querySelector('#overview-services'),
title: "Dashboard #3",
intro: "Roxy-WI services status",
},
{% if role == 1 %}
{
element: document.querySelector('#overview-users'),
title: "Dashboard #4",
intro: "Users info - hold your cursor on a user's name to see more details",
},
{
element: document.querySelector('#overview-groups'),
title: "Dashboard #5",
intro: "Group list",
},
{
element: document.querySelector('#overview-roles'),
title: "Dashboard #6",
intro: "Roles description",
},
{% endif %}
{% if g.user_params['role'] < 3 %}
{% if g.user_params['role'] > 1 %}
{% set board_id = 4 %}
{% else %}
{% set board_id = 7 %}
{% endif %}
{
element: document.querySelector('#overview-logs'),
title: "Dashboard #{{ board_id }}",
intro: "Last log entries",
},
{% endif %}
{% if g.user_params['role'] == 1 %}
{
element: document.querySelector('#overview-subs'),
title: "Dashboard #8",
intro: "Subscription info",
},
{% endif %}
{
element: document.querySelector('#version'),
intro: "Your Roxy-WI version",
},
{
element: document.querySelector('#useful-links'),
intro: "Useful links",
},
{
element: document.querySelector('#show-user-settings-button'),
intro: "Profile settings",
},
{
element: document.querySelector('.guid_me'),
intro: "Guide mode button",
},
{
element: document.querySelector('.menu'),
intro: "9 more sections left to discover. Meet you there :)",
}
]
});
return intro;
}
</script>

View File

@ -1,104 +0,0 @@
<script>
function Intro() {
var intro = introJs();
intro.setOptions({
steps: [
{
element: document.querySelector('#ajax-users'),
intro: "Welcome to Admin Area! On this tab you can manage users!",
},
{
element: document.querySelector('#user-login-th'),
intro: "Login is a name. Quite obvious",
},
{
element: document.querySelector('#user-active-th'),
intro: "Is anyone suspicious? Disable him!",
},
{
element: document.querySelector('#user-role-th'),
intro: "Or change the role, you can make it read only, for example",
},
{
element: document.querySelector('#user-services-th'),
intro: "And if someone does not need access to all services, you can solve it here",
},
{
element: document.querySelector('#server-name-th'),
intro: "A name of servers",
},
{
element: document.querySelector('#server-ip-th'),
intro: "IP or DNS name",
},
{
element: document.querySelector('#server-haproxy-th'),
intro: "Is there HAProxy? If yes press here",
},
{
element: document.querySelector('#server-nginx-th'),
intro: "Same for Nginx",
},
{
element: document.querySelector('#server-apache-th'),
intro: "And for Apache",
},
{
element: document.querySelector('#server-firewalld-th'),
intro: "If there is Firewalld service and you would like to Roxy-WI manage it enable this checkbox",
},
{
element: document.querySelector('#server-protected-th'),
intro: "This checkbox should be enabled if only admin can edit configs",
},
{
element: document.querySelector('#server-slave-th'),
intro: "Is a server secondary in a cluster? Check a Master server for Slave and configs will be automatically synced after editing on Master server",
},
{
element: document.querySelector('#ssh-key-enabled-td'),
intro: "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",
},
{
element: document.querySelector('#ssh-user-name-td'),
intro: "A user name on remote server"
},
{
element: document.querySelector('#ssh_cert'),
intro: "Do not forget upload a SSH key, if you enable it",
},
{
element: document.querySelector('#backup-git-li'),
intro: "Would you like to keep configs in Git? This place for it!",
},
{
element: document.querySelector('#backup-backup-li'),
intro: "Or backup versions of config to a remote server",
},
{
element: document.querySelector('#haproxy-table'),
intro: "Need detailed statistics from HAProxy? You can install an exporter and watch graphs in Grafana",
},
{
element: document.querySelector('#nginx-table'),
intro: "Same for NGINX",
},
{
element: document.querySelector('#apache-table'),
intro: "And Apache",
},
{
element: document.querySelector('#node-table'),
intro: "This exporter provides detailed information about servers. Quite useful",
},
{
element: document.querySelector('.guid_me'),
intro: "Guide mode button",
}
]
});
return intro;
}
// setTimeout(() => { var intro_temp = Intro(); startIntro(intro_temp); }, 3000);
</script>

View File

@ -230,6 +230,4 @@
<script>
showOverview(ip, hostnamea);
</script>
{% include 'include/intro/ovw.html' %}
{% include 'include/intro/js_script.html' %}
{% endblock %}