mirror of https://github.com/Aidaho12/haproxy-wi
parent
aa802f1038
commit
31c4d6975f
|
@ -206,12 +206,12 @@ if form.getvalue('table_serv_select') is not None:
|
|||
if form.getvalue('table_select') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True,
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True,
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'], trim_blocks=True, lstrip_blocks=True)
|
||||
table = form.getvalue('table_select')
|
||||
|
||||
if table == 'All':
|
||||
template = env.get_template('/stick_tables.html')
|
||||
template = env.get_template('ajax/stick_tables.html')
|
||||
tables = funct.get_all_stick_table()
|
||||
table = []
|
||||
for t in tables.split(','):
|
||||
|
@ -225,7 +225,7 @@ if form.getvalue('table_select') is not None:
|
|||
|
||||
template = template.render(table=table)
|
||||
else:
|
||||
template = env.get_template('/stick_table.html')
|
||||
template = env.get_template('ajax/stick_table.html')
|
||||
tables_head, table = funct.get_stick_table(table)
|
||||
template = template.render(tables_head=tables_head, table=table)
|
||||
|
||||
|
@ -328,7 +328,7 @@ if form.getvalue('list_ip_for_add') is not None:
|
|||
if form.getvalue('sessions_select') is not None:
|
||||
from jinja2 import Environment, FileSystemLoader
|
||||
|
||||
env = Environment(loader=FileSystemLoader('templates/ajax'), autoescape=True,
|
||||
env = Environment(loader=FileSystemLoader('templates'), autoescape=True,
|
||||
extensions=['jinja2.ext.loopcontrols', 'jinja2.ext.do'], trim_blocks=True, lstrip_blocks=True)
|
||||
serv = form.getvalue('sessions_select')
|
||||
haproxy_sock_port = sql.get_setting('haproxy_sock_port')
|
||||
|
@ -336,7 +336,7 @@ if form.getvalue('sessions_select') is not None:
|
|||
cmd = 'echo "show sess" |nc %s %s' % (serv, haproxy_sock_port)
|
||||
output, stderr = funct.subprocess_execute(cmd)
|
||||
|
||||
template = env.get_template('/sessions_table.html')
|
||||
template = env.get_template('ajax/sessions_table.html')
|
||||
template = template.render(sessions=output)
|
||||
|
||||
print(template)
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<thead>
|
||||
<tr class="overviewHead">
|
||||
<td class="padding10 first-collumn" style="width: 25%;">Service</td>
|
||||
<td>Currnet version</td>
|
||||
<td>Current version</td>
|
||||
<td class="padding10">Last version</td>
|
||||
<td></td>
|
||||
<td>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{% from 'include/input_macros.html' import input, checkbox %}
|
||||
{% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#{{list_id}}').on( 'page.dt', function () { $.getScript("/inc/fontawesome.min.js"); } )
|
||||
|
@ -42,7 +42,7 @@
|
|||
{{ loop.index }}
|
||||
</td>
|
||||
<td style="width: 85%">
|
||||
{{l.split(' ')[1]}}
|
||||
{{ copy_to_clipboard(value=l.split(' ')[1]) }}
|
||||
</td>
|
||||
<td>
|
||||
<a class="delete" title="Delete this IP" style="cursor: pointer;" onclick="deleteListIp(this, '{{list_id}}', '{{l.split(' ')[0]}}', '{{l.split(' ')[1]}}')"></a>
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{% from 'include/provisioning/variables.html' import gcore_regions, do_regions, aws_regions %}
|
||||
{% from 'include/input_macros.html' import copy_to_clipboard %}
|
||||
{% for s in servers %}
|
||||
{% set region_name = [] %}
|
||||
{% if s.3 == 'do' %}
|
||||
|
@ -68,13 +69,16 @@
|
|||
{{region_name.0}}
|
||||
</td>
|
||||
<td style="width: 10%">
|
||||
<span id="sever-os-{{s.0}}">{{s.9}}</span>
|
||||
{% set id = "server-os-" + s.0|string() %}
|
||||
{{ copy_to_clipboard(id=id, value=s.9) }}
|
||||
</td>
|
||||
<td style="width: 15%">
|
||||
<span id="sever-ip-{{s.0}}">{{s.10}}</span>
|
||||
{% set id = "server-ip-" + s.0|string() %}
|
||||
{{ copy_to_clipboard(id=id, value=s.10) }}
|
||||
</td>
|
||||
<td style="width: 10%">
|
||||
<span id="sever-size-{{s.0}}">{{s.5}}</span>
|
||||
{% set id = "server-size-" + s.0|string() %}
|
||||
{{ copy_to_clipboard(id=id, value=s.5) }}
|
||||
</td>
|
||||
<td style="width: 5%">
|
||||
{% if s.6 == 'Created' %}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{% from 'include/input_macros.html' import copy_to_clipboard %}
|
||||
<script>
|
||||
$(document).ready(function() {
|
||||
$('#sessions_table').on( 'page.dt', function () { $.getScript("/inc/fontawesome.min.js"); } )
|
||||
|
@ -38,7 +39,7 @@
|
|||
{{session.1.split('=')[1]}}
|
||||
</td>
|
||||
<td style="width: 20%">
|
||||
{{session.2.split('=')[1]}}
|
||||
{{ copy_to_clipboard(value=session.2.split('=')[1]) }}
|
||||
</td>
|
||||
<td style="width: 10%">
|
||||
{{session.3.split('=')[1]}}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{% from 'include/input_macros.html' import copy_to_clipboard %}
|
||||
{% if table[0] != '' %}
|
||||
{% set headers = table[0].split(':')[1] %}
|
||||
{% set headers = headers.split(' ') %}
|
||||
|
@ -90,8 +91,8 @@
|
|||
{% set body = t.split(':')[1] %}
|
||||
{% set body = t.split(' ') %}
|
||||
<tr>
|
||||
<td class="padding10" style="width: 10%; padding-left: 10px;">
|
||||
{{body.1.split('=')[1]}}
|
||||
<td class="padding10" style="width: 10%; padding-left: 10px;">
|
||||
{{ copy_to_clipboard(value=body.1.split('=')[1]) }}
|
||||
</td>
|
||||
<td>
|
||||
{{body.2.split('=')[1]}}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{% from 'include/input_macros.html' import copy_to_clipboard %}
|
||||
{%- for t in table %}
|
||||
{%- if t.1.0 != '' -%}
|
||||
{% set headers = t.1.0.split(':')[1] %}
|
||||
|
@ -90,7 +91,7 @@
|
|||
{% if body.0 != '' %}
|
||||
<tr>
|
||||
<td class="padding10" style="width: 10%; padding-left: 10px;">
|
||||
{{body.1.split('=')[1]}}
|
||||
{{ copy_to_clipboard(value=body.1.split('=')[1]) }}
|
||||
</td>
|
||||
<td>
|
||||
{{body.2.split('=')[1]}}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
{% from 'include/input_macros.html' import input, checkbox, select %}
|
||||
{% from 'include/input_macros.html' import input, checkbox, select, copy_to_clipboard %}
|
||||
<script src="/inc/overview.js"></script>
|
||||
{% if serv %}
|
||||
<style>
|
||||
|
@ -220,7 +220,7 @@
|
|||
<span id="edit_date_{{s.2}}"></span>
|
||||
</span>
|
||||
<br />
|
||||
IP: <b>{{s.2}}</b>
|
||||
IP: {{ copy_to_clipboard(value=s.2, style='font-weight: bold') }}
|
||||
{% if s.7.0.0 != None %}
|
||||
Master for: <b>{{ s.7.0.1 }}</b>
|
||||
{% endif %}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{% from 'include/input_macros.html' import input, checkbox %}
|
||||
{% from 'include/input_macros.html' import input, checkbox, copy_to_clipboard %}
|
||||
{% if not adding %}
|
||||
<table class="overview" id="ajax-servers">
|
||||
<thead>
|
||||
<tr class="overviewHead">
|
||||
<th class="padding10 first-collumn">Hostname</th>
|
||||
<th class="ip-field" style="width: 5%">IP</th>
|
||||
<th class="ip-field" style="width: 10%">IP</th>
|
||||
<th class="checkbox-head" style="width: 5%" class="help_cursor"><span title="SSH port">Port</span></th>
|
||||
{% if page != "servers.py" %}
|
||||
<th style="width: 10%">Group</th>
|
||||
|
@ -39,7 +39,8 @@
|
|||
{{ input(id, value=server.1, size='15') }}
|
||||
</td>
|
||||
<td>
|
||||
<span id="ip-{{server.0}}" style="margin-right: 6px;">{{server.2}}</span>
|
||||
{% set id = 'ip-' + server.0|string() %}
|
||||
{{ copy_to_clipboard(id=id, value=server.2, style='margin-right: 6px;') }}
|
||||
</td>
|
||||
<td>
|
||||
{% set id = 'port-' + server.0|string() %}
|
||||
|
|
|
@ -39,4 +39,8 @@
|
|||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro copy_to_clipboard(id='', value='', style='', class='') -%}
|
||||
<span id="{{id}}" style="{{style}}" class="copyToClipboard {{class}}" data-copy="{{value}}" title="Copy {{value}} to clipboard">{{value}}</span>
|
||||
{%- endmacro %}
|
|
@ -359,4 +359,13 @@
|
|||
}
|
||||
.server-name .red .fa-shield-alt {
|
||||
color: var(--red-color);
|
||||
}
|
||||
.copyToClipboard:hover::after {
|
||||
display: none;
|
||||
font-family: "Font Awesome 5 Solid";
|
||||
content: "\f0c5";
|
||||
}
|
||||
.copyToClipboard .fa-copy {
|
||||
margin-left: 5px;
|
||||
content: "\f0c5";
|
||||
}
|
|
@ -217,7 +217,7 @@ $( function() {
|
|||
}
|
||||
}
|
||||
$('#table_select').selectmenu("refresh");
|
||||
}
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
|
@ -327,6 +327,7 @@ function getTable() {
|
|||
} else {
|
||||
$("#ajaxtable").html(data);
|
||||
$( "input[type=submit], button" ).button();
|
||||
$.getScript("/inc/script.js");
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
FontAwesomeConfig = { searchPseudoElements: true, observeMutations: false };
|
||||
}
|
||||
|
@ -349,6 +350,7 @@ function getList() {
|
|||
} else {
|
||||
$("#ajaxlist").html(data);
|
||||
$( "input[type=submit], button" ).button();
|
||||
$.getScript("/inc/script.js");
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
FontAwesomeConfig = { searchPseudoElements: true, observeMutations: false };
|
||||
}
|
||||
|
@ -426,6 +428,7 @@ function getSessions() {
|
|||
} else {
|
||||
$("#ajaxsessions").html(data);
|
||||
$( "input[type=submit], button" ).button();
|
||||
$.getScript("/inc/script.js");
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
FontAwesomeConfig = { searchPseudoElements: true, observeMutations: false };
|
||||
}
|
||||
|
@ -485,4 +488,4 @@ function deleteSession(id, sess_id) {
|
|||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -241,8 +241,8 @@ function setRefreshInterval(interval) {
|
|||
$('#1').text('Auto-refresh');
|
||||
$('.auto-refresh-pause').css('display', 'none');
|
||||
$('.auto-refresh-resume').css('display', 'none');
|
||||
$.getScript("/inc/fontawesome.min.js")
|
||||
$.getScript("/inc/scripts.js")
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
$.getScript("/inc/scripts.js");
|
||||
}
|
||||
hideAutoRefreshDiv();
|
||||
} else {
|
||||
|
@ -694,7 +694,7 @@ $( function() {
|
|||
$( "#tabs" ).tabs();
|
||||
$( "select" ).selectmenu();
|
||||
|
||||
// var tooltips = $( "[title]" ).tooltip();
|
||||
//$( "[title]" ).tooltip();
|
||||
$( "input[type=submit], button" ).button();
|
||||
$( "input[type=checkbox]" ).checkboxradio();
|
||||
$( ".controlgroup" ).controlgroup();
|
||||
|
@ -1026,6 +1026,21 @@ $( function() {
|
|||
} );
|
||||
}
|
||||
}
|
||||
$('.copyToClipboard').hover(function (){
|
||||
$.getScript("/inc/fontawesome.min.js");
|
||||
});
|
||||
$('.copyToClipboard').click(function () {
|
||||
let str = $(this).attr('data-copy');
|
||||
const el = document.createElement('textarea');
|
||||
el.value = str;
|
||||
el.setAttribute('readonly', '');
|
||||
el.style.position = 'absolute';
|
||||
el.style.left = '-9999px';
|
||||
document.body.appendChild(el);
|
||||
el.select();
|
||||
document.execCommand('copy');
|
||||
document.body.removeChild(el);
|
||||
})
|
||||
});
|
||||
function saveUserSettings(){
|
||||
if ($('#disable_alert_for_tab').is(':checked')) {
|
||||
|
|
|
@ -1215,4 +1215,16 @@ label {
|
|||
}
|
||||
.help_cursor {
|
||||
cursor: help;
|
||||
}
|
||||
.copyToClipboard {
|
||||
cursor: pointer;
|
||||
transition: .3s;
|
||||
}
|
||||
.copyToClipboard:hover {
|
||||
color: var(--blue-color);
|
||||
content: "\f0c5";
|
||||
}
|
||||
.copyToClipboard:active {
|
||||
transition: .3s;
|
||||
color: var(--link-dark-blue);
|
||||
}
|
Loading…
Reference in New Issue