1
0
mirror of https://github.com/donaldzou/WGDashboard.git synced 2024-11-19 05:50:10 +01:00

Style adjustment

Adjusted style and the status light: Added box-shadow and border for connected peer
This commit is contained in:
Donald Cheng Hong Zou 2021-12-24 00:20:44 -05:00
parent dade9935da
commit 5c588ea01a
4 changed files with 73 additions and 21 deletions

View File

@ -1122,9 +1122,7 @@ Dashboard Tools Related
def get_ping_ip(): def get_ping_ip():
config = request.form['config'] config = request.form['config']
sem.acquire() sem.acquire()
db = TinyDB('db/' + config + '.json')
db = TinyDB('db/' + config_name + '.json')
html = "" html = ""
for i in db.all(): for i in db.all():
html += '<optgroup label="' + i['name'] + ' - ' + i['id'] + '">' html += '<optgroup label="' + i['name'] + ' - ' + i['id'] + '">'
@ -1158,8 +1156,6 @@ def ping_ip():
} }
if returnjson['package_loss'] == 1.0: if returnjson['package_loss'] == 1.0:
returnjson['package_loss'] = returnjson['package_sent'] returnjson['package_loss'] = returnjson['package_sent']
return jsonify(returnjson) return jsonify(returnjson)
except Exception: except Exception:
return "Error" return "Error"

View File

@ -117,22 +117,50 @@ body {
.dot-running{ .dot-running{
background-color: #28a745!important; background-color: #28a745!important;
box-shadow: 0 0 0 0.2rem #28a74545;
}
.h6-dot-running{
margin-left: 0.3rem;
} }
.dot-stopped{ .dot-stopped{
background-color: #6c757d!important; background-color: #6c757d!important;
} }
.card-running{
border-color: #28a745;
}
.info h6{ .info h6{
line-break: anywhere; line-break: anywhere;
} }
.info .row .col-sm{
display: flex;
flex-direction: column;
}
.info .row .col-sm small{
display: flex;
}
.info .row .col-sm small strong:last-child(1){
margin-left: auto !important;
}
.btn-control{ .btn-control{
border: none !important; border: none !important;
padding: 0 1rem 0 0; padding: 0 1rem 0 0;
} }
.btn-control:active, .btn-control:focus{
background-color: transparent !important;
border: none !important;
box-shadow: none;
}
.share_peer_btn_group .btn-control{ .share_peer_btn_group .btn-control{
padding: 0 0 0 1rem; padding: 0 0 0 1rem;
} }
@ -213,7 +241,7 @@ main{
bottom: 3rem; bottom: 3rem;
right: 2rem; right: 2rem;
z-index: 99; z-index: 99;
border-radius: 100px; border-radius: 100px !important;
padding: 10px 20px; padding: 10px 20px;
box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23); box-shadow: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
} }
@ -275,3 +303,23 @@ main{
.key:hover{ .key:hover{
color: #007bff; color: #007bff;
} }
.card{
border-radius: 10px;
}
.peer_list .card .button-group{
height: 22px;
}
.form-control{
border-radius: 10px;
}
.btn{
border-radius: 8px;
}
.modal-content{
border-radius: 10px;
}

View File

@ -109,7 +109,6 @@
<i class="bi bi-plus-circle-fill" style=""></i> Add Peer <i class="bi bi-plus-circle-fill" style=""></i> Add Peer
</button> </button>
</div> </div>
<hr>
</div> </div>
</div> </div>
@ -126,26 +125,35 @@
{% else %} {% else %}
<div class="col-sm-6 col-lg-4"> <div class="col-sm-6 col-lg-4">
{% endif %} {% endif %}
<div class="card mb-3"> <div class="card mb-3 card-{{i['status']}}">
<div class="card-header"> {# <div class="card-header">#}
{# <div class="row">#}
{# <div class="col">#}
{# <div class="card-header-body ">#}
{# {% if not i['name']%}#}
{# {{ "Untitled" }}#}
{# {% else %}#}
{# {{i['name']}}#}
{# {% endif %}#}
{# </div>#}
{# </div>#}
{# </div>#}
{# </div>#}
<div class="card-body">
<div class="row"> <div class="row">
<div class="col"> <div class="col-sm">
<div class="card-header-body "> <h4>
{% if not i['name']%} {% if not i['name']%}
{{ "Untitled" }} {{ "Untitled" }}
{% else %} {% else %}
{{i['name']}} {{i['name']}}
{% endif %} {% endif %}
{# <span class="dot dot-{{i['status']}}"></span>#} </h4>
</div> </div>
</div> <div class="w-100"></div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-6"> <div class="col-6">
<small class="text-muted"><strong>STATUS</strong></small> <small class="text-muted"><strong>STATUS</strong></small>
<h6 style="text-transform: uppercase;" class="mb-2"><span class="dot dot-{{i['status']}}" style="margin-left: 0 !important;margin-top: 5px"></span></h6> <h6 style="text-transform: uppercase;" class="mb-2 h6-dot-{{i['status']}}"><span class="dot dot-{{i['status']}}" style="margin-left: 0 !important;margin-top: 5px"></span></h6>
</div> </div>
<div class="col-6 peer_data_group" style="text-align: right"> <div class="col-6 peer_data_group" style="text-align: right">
<small class="text-muted"><strong>TRANSFER</strong></small> <small class="text-muted"><strong>TRANSFER</strong></small>
@ -162,7 +170,7 @@
<small class="text-muted"><strong>ALLOWED IP</strong></small> <small class="text-muted"><strong>ALLOWED IP</strong></small>
<h6 style="text-transform: uppercase;">{{i['allowed_ip']}}</h6> <h6 style="text-transform: uppercase;">{{i['allowed_ip']}}</h6>
</div> </div>
<div class="w-100"></div> {# <div class="w-100"></div>#}
<div class="col-sm"> <div class="col-sm">
<small class="text-muted"><strong>LATEST HANDSHAKE</strong></small> <small class="text-muted"><strong>LATEST HANDSHAKE</strong></small>

View File

@ -33,9 +33,9 @@ _check_and_set_venv(){
install_wgd(){ install_wgd(){
# Check Python3 version # Check Python3 version
version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 7) else print("0");') version_pass=$(python3 -c 'import sys; print("1") if (sys.version_info.major == 3 and sys.version_info.minor >= 8) else print("0");')
if [ $version_pass == "0" ] if [ $version_pass == "0" ]
then printf "| WGDashboard required Python3.7+ |\n" then printf "| WGDashboard required Python3.8+ |\n"
printf "%s\n" "$dashes" printf "%s\n" "$dashes"
exit 1 exit 1
fi fi