1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-10-31 19:44:16 +00:00

bootstrap 4.5 fixations & Update strings style to f-string

This commit is contained in:
catborise 2020-05-22 01:13:39 +03:00 committed by catborise
parent ccd947a04c
commit 7c93ee1e2f
12 changed files with 60 additions and 61 deletions

View file

@ -16,7 +16,7 @@
<div class="row">
<div class="col-lg-12">
<h3 class="page-header">{% trans "Edit Profile" %}</h3>
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
<form method="post" action="" role="form">{% csrf_token %}
<div class="form-group">
<label class="col-sm-2 col-form-label">{% trans "Login" %}</label>
<div class="col-sm-4">
@ -43,7 +43,7 @@
</form>
{% if perms.accounts.change_password %}
<h3 class="page-header">{% trans "Edit Password" %}</h3>
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
<form method="post" action="" role="form">{% csrf_token %}
<div class="form-group">
<label class="col-sm-2 col-form-label">{% trans "Old" %}</label>
<div class="col-sm-4">
@ -93,7 +93,7 @@
</div>
</div>
{% endif %}
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
<form method="post" action="" role="form">{% csrf_token %}
<div class="form-group bridge_name_form_group_dhcp">
<label class="col-sm-2 col-form-label">{% trans "Key name" %}</label>
<div class="col-sm-4">
@ -114,7 +114,7 @@
</form>
{% if request.user.is_superuser %}
<h3 class="page-header">{% trans "Themes" %}</h3>
<form class="form-horizontal" method="post" action="" role="form">{% csrf_token %}
<form method="post" action="" role="form">{% csrf_token %}
<div class="form-group">
<label class="col-sm-2 col-form-label">{% trans "Themes" %}</label>
<div class="col-sm-4">

View file

@ -1,7 +1,7 @@
{% extends "base.html" %}
{% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Create new instance - Select Type" %}{% endblock %}
{% block title %}{% trans "Create new instanc" %} - {% trans "Select Type" %}{% endblock %}
{% block content %}
<!-- Page Heading -->
@ -84,7 +84,7 @@
</div>
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="addFromXML">
<div class="well">
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<form method="post" role="form">{% csrf_token %}
<div class="col-sm-12" id="xmlheight">
<input type="hidden" name="dom_xml"/>
<textarea id="editor"></textarea>

View file

@ -114,7 +114,7 @@
<input type="hidden" name="hdd_size" value="{{ flavor.disk }}">
</div>
</div>
{% if firmwares %}
{% if firmwares %}
<div class="form-group row">
<label class="col-sm-3 col-form-label">{% trans "Firmware" %}</label>
<div class="col-sm-6">
@ -286,7 +286,7 @@
</a>
</td>
<td style="width:5px;">
<form class="form-horizontal" action="" method="post" role="form">{% csrf_token %}
<form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="flavor" value="{{ flavor.id }}">
<button type="submit" class="btn btn-sm btn-secondary" name="delete_flavor" onclick="return confirm('{% trans "Are you sure?" %}')">
<span class="fa fa-trash"></span>
@ -373,7 +373,7 @@
<div class="col-sm-3">
<select id="storage-control" name="storage-control" class="form-control" onchange="get_cust_vols({{ compute_id }}, value);">
{% if storages %}
<option value disabled selected>{% trans "Select pool..." %}</option>
<option value disabled selected>{% trans "Select pool" %}...</option>
{% for storage in storages %}
<option value="{{ storage }}" >{{ storage }}</option>
{% endfor %}

View file

@ -15,7 +15,7 @@
<div class="modal-body">
<form method="post" action="" role="form">{% csrf_token %}
<div class="form-group row">
<label class="col-sm-4 col-form-label">{% trans "Mac" %}</label>
<label class="col-sm-4 col-form-label">{% trans "MAC" %}</label>
<div class="col-sm-6">
<input type="text" class="form-control" name="add-net-mac">
</div>

View file

@ -100,14 +100,13 @@
<label class="col-sm-3 col-form-label">{% trans "Storage" %}</label>
<div class="col-sm-6">
<div class="dropdown">
<button id="select_storage" class="btn btn-secondary dropdown-toggle form-control" type="button" data-toggle="dropdown">{% trans 'Select Pool...' %}
<span class="caret"></span></button>
<ul class="dropdown-menu">
{% for storage in storages_host %}
<li><a href="#" onclick="get_volumes({{ compute_id }}, '{{ storage }}')">{{ storage }}</a></li>
{% endfor %}
</ul>
<input id="selected_storage" name="selected_storage" hidden/>
<button id="select_storage" class="btn btn-secondary dropdown-toggle form-control" type="button" data-toggle="dropdown">{% trans 'Select Pool' %}...</button>
<div class="dropdown-menu">
{% for storage in storages_host %}
<a class="dropdown-item" href="#" onclick="get_volumes({{ compute_id }}, '{{ storage }}')">{{ storage }}</a>
{% endfor %}
</div>
<input id="selected_storage" name="selected_storage" hidden/>
</div>
</div>
</div>

View file

@ -2,18 +2,18 @@
<table class="table table-hover sortable-theme-bootstrap" data-sortable>
<thead>
<tr style="border: 2px solid transparent; ">
<th><a class="text-secondary" href="#" id="hide_all_instances" onclick="hide_all_host_instances()">#</a></th>
<th data-sortable="false"><a class="text-secondary" href="#" id="hide_all_instances" onclick="hide_all_host_instances()">#</a></th>
<th>{% trans "Name" %}<br>{% trans "Description" %}</th>
<th class="d-none d-sm-table-cell">{% trans "User"%}</th>
<th>{% trans "Status" %}</th>
<th class="d-none d-sm-table-cell">{% trans "VCPU" %}</th>
<th class="d-none d-sm-table-cell">{% trans "Memory" %}</th>
<th style="width:200px;" data-sortable="false">{% trans "Actions & Mem Usage" %}</th>
<th style="width:200px;" data-sortable="false">{% trans "Actions" %} & {% trans "Mem Usage" %}</th>
</tr>
</thead>
<tbody class="searchable">
{% for host, insts in all_host_vms.items %}
<tr class="active font-weight-bold" style="border-bottom: 2px solid darkgray;border-top: 2px solid darkgray;">
<tr class="font-weight-bold active" style="border-bottom: 2px solid darkgray;border-top: 2px solid darkgray;">
<td>
<span id="collapse_host_instances_{{ host.1 }}" class="fa fa-chevron-up" onclick="hide_host_instances('{{ host.1 }}');"></span>
</td>
@ -23,9 +23,9 @@
</td>
<td class="d-none d-sm-table-cell"></td>
<td>
{% ifequal host.2 1 %}<span class="label label-success">{% trans "Active" %}</span>{% endifequal %}
{% ifequal host.2 2 %}<span class="label label-danger">{% trans "Not Active" %}</span>{% endifequal %}
{% ifequal host.2 3 %}<span class="label label-danger">{% trans "Connection Failed" %}</span>{% endifequal %}
{% ifequal host.2 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
{% ifequal host.2 2 %}<span class="text-warning">{% trans "Not Active" %}</span>{% endifequal %}
{% ifequal host.2 3 %}<span class="text-danger">{% trans "Connection Failed" %}</span>{% endifequal %}
</td>
<td class="d-none d-sm-table-cell text-center">{{ host.3 }}</td>
<td class="d-none d-sm-table-cell text-right">{{ host.4|filesizeformat }}</td>
@ -74,14 +74,14 @@ function hide_all_host_instances() {
all_host_rows = rows.filter('[host]');
all_host_rows.toggle();
$('span[id^=collapse_host_instances_]').toggleClass("fa-chevron-down").toggleClass("fa-chevron-up");
$('span[id^=inst_count_badge_]').toggleClass("hidden");
$('span[id^=inst_count_badge_]').toggleClass("d-none");
}
function hide_host_instances(host) {
var rows = $('table tr');
host_rows = rows.filter("[host='"+host+"']");
host_rows.toggle();
$("span[id='collapse_host_instances_"+host+"']").toggleClass("fa-chevron-down").toggleClass("fa-chevron-up");
$("span[id='inst_count_badge_"+host+"']").toggleClass("hidden");
$("span[id='inst_count_badge_"+host+"']").toggleClass("d-none");
}
</script>
{% endblock %}

View file

@ -14,20 +14,20 @@
</div>
<div class="modal-body">
<ul class="nav nav-tabs">
<li class="nav-item">
<ul class="nav nav-tabs mb-3" role="tablist">
<li class="nav-item" role="presentation">
<a class="nav-link active" href="#VirtualDisk{{ id }}" data-toggle="tab">{% trans 'Virtual Disk' %}</a>
</li>
<li class="nav-item">
<li class="nav-item" role="presentation">
<a class="nav-link" href="#PerformanceVolume{{ id }}" data-toggle="tab">{% trans 'Performance' %}</a>
</li>
<li class="nav-item">
<li class="nav-item" role="presentation">
<a class="nav-link" href="#AdvancedVolume{{ id }}" data-toggle="tab">{% trans 'Advanced' %}</a>
</li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="VirtualDisk{{ id }}">
<div class="tab-pane active" role="tabpanel" id="VirtualDisk{{ id }}">
<div class="form-group row">
<label class="col-sm-4 col-form-label">{% trans 'Volume Path' %}</label>
<div class="col-sm-8">
@ -36,19 +36,19 @@
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">{% trans 'Readonly' %}</label>
<div class="col-sm-8">
<input class="form-control-static" type="checkbox" name="vol_readonly" value="True" {% if disk.readonly %}checked{% endif %}/>
<div class="form-check">
<input class="form-check-input position-static" type="checkbox" name="vol_readonly" value="True" {% if disk.readonly %}checked{% endif %}/>
</div>
</div>
<div class="form-group row">
<label class="col-sm-4 col-form-label">{% trans 'Shareable' %}</label>
<div class="col-sm-8">
<input class="form-control-static" type="checkbox" name="vol_shareable" value="True" {% if disk.shareable %}checked{% endif %}/>
<div class="form-check">
<input class="form-check-input position-static" type="checkbox" name="vol_shareable" value="True" {% if disk.shareable %}checked{% endif %}/>
</div>
</div>
</div>
<div class="tab-pane" id="AdvancedVolume{{ id }}">
<div class="tab-pane" role="tabpanel" id="AdvancedVolume{{ id }}">
<div class="form-group row">
<label class="col-sm-4 col-form-label">{% trans 'Bus' %}</label>
<div class="col-sm-8">
@ -73,7 +73,7 @@
</div>
</div>
<div class="tab-pane" id="PerformanceVolume{{ id }}">
<div class="tab-pane" role="tabpanel" id="PerformanceVolume{{ id }}">
<div class="form-group row">
<label class="col-sm-4 col-form-label">{% trans 'Cache mode' %}</label>
<div class="col-sm-8">

View file

@ -287,8 +287,8 @@
<span class="sr-only">{% trans 'Toggle Dropdown' %}</span>
</button>
<div class="dropdown-menu">
<a class="dropdown-item" href="#" title="{% trans "Console port" %}: {{ console_port }}" onclick="open_console('lite')">{% trans "Console - Lite" %}</a>
<a class="dropdown-item" href="#" title="{% trans "Console port" %}: {{ console_port }}" onclick="open_console('full')">{% trans "Console - Full" %}</a>
<a class="dropdown-item" href="#" title="{% trans "Console port" %}: {{ console_port }}" onclick="open_console('lite')">{% trans "Console" %} - {% trans "Lite" %}</a>
<a class="dropdown-item" href="#" title="{% trans "Console port" %}: {{ console_port }}" onclick="open_console('full')">{% trans "Console" %} - {% trans "Full" %}</a>
</div>
</div>
{% else %}
@ -302,7 +302,7 @@
<form class="form-inline" method="post" role="form">{% csrf_token %}
<div class="form-group row">
<div class="col-sm-12">
<input type="text" class="form-control input-lg" name="passwd" placeholder="{% trans "Enter Password" %}" maxlength="24">
<input type="text" class="form-control-lg" name="passwd" placeholder="{% trans "Enter Password" %}" maxlength="24">
</div>
</div>
{% ifequal status 5 %}
@ -1179,7 +1179,7 @@
</div>
<div role="tabpanel" class="tab-pane tab-pane-bordered" id="xmledit">
<p>{% trans "If you need to edit xml please Power Off the instance" %}</p>
<form class="form-horizontal" method="post" role="form">{% csrf_token %}
<form method="post" role="form">{% csrf_token %}
<div class="col-sm-12" id="xmlheight">
<textarea id="editor">{{ inst_xml }}</textarea>
</div>

View file

@ -829,7 +829,7 @@ def instance(request, compute_id, vname):
if status == 'False':
conn.remove_guest_agent()
msg = _("Set Quest Agent {}".format(status))
msg = _(f"Set Quest Agent {status}")
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#options')
@ -901,7 +901,7 @@ def instance(request, compute_id, vname):
state = request.POST.get('set_link_state')
state = 'down' if state == 'up' else 'up'
conn.set_link_state(mac_address, state)
msg = _("Set Link State: {}".format(state))
msg = _(f"Set Link State: {state}")
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#network')
@ -917,11 +917,11 @@ def instance(request, compute_id, vname):
try:
conn.set_qos(mac, qos_dir, average, peak, burst)
if conn.get_status() == 5:
messages.success(request, "{} QoS is set".format(qos_dir.capitalize()))
messages.success(request, _(f"{qos_dir.capitalize()} QoS is set"))
else:
messages.success(request,
"{} QoS is set. Network XML is changed.".format(qos_dir.capitalize()) +
"Stop and start network to activate new config")
_(f"{qos_dir.capitalize()} QoS is set. Network XML is changed.") +
_("Stop and start network to activate new config"))
except libvirtError as le:
messages.error(request, le)
@ -932,10 +932,10 @@ def instance(request, compute_id, vname):
conn.unset_qos(mac, qos_dir)
if conn.get_status() == 5:
messages.success(request, "{} QoS is deleted".format(qos_dir.capitalize()))
messages.success(request, _(f"{qos_dir.capitalize()} QoS is deleted"))
else:
messages.success(request,
"{} QoS is deleted. Network XML is changed. ".format(qos_dir.capitalize()) +
f"{qos_dir.capitalize()} QoS is deleted. Network XML is changed. " +
"Stop and start network to activate new config.")
return HttpResponseRedirect(request.get_full_path() + '#network')
@ -953,7 +953,7 @@ def instance(request, compute_id, vname):
else:
add_user_inst = UserInstance(instance=instance, user_id=user_id)
add_user_inst.save()
msg = _("Added owner %d" % user_id)
msg = _(f"Added owner {user_id}")
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#users')
@ -961,7 +961,7 @@ def instance(request, compute_id, vname):
userinstance_id = int(request.POST.get('userinstance', ''))
userinstance = UserInstance.objects.get(pk=userinstance_id)
userinstance.delete()
msg = _("Deleted owner %d" % userinstance_id)
msg = _(f"Deleted owner {userinstance_id}")
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path() + '#users')

View file

@ -171,7 +171,7 @@ def network(request, compute_id, pool):
try:
ret_val = conn.modify_fixed_address(name, address, mac_duid, family)
messages.success(request, _("{} Fixed Address Operation Completed.").format(family.upper()))
messages.success(request, _(f"{family.upper()} Fixed Address Operation Completed."))
return HttpResponseRedirect(request.get_full_path())
except libvirtError as lib_err:
error_messages.append(lib_err)
@ -181,7 +181,7 @@ def network(request, compute_id, pool):
ip = request.POST.get('address', '')
family = request.POST.get('family', 'ipv4')
conn.delete_fixed_address(ip, family)
messages.success(request, _("{} Fixed Address is Deleted.").format(family.upper()))
messages.success(request, _(f"{family.upper()} Fixed Address is Deleted."))
return HttpResponseRedirect(request.get_full_path())
if 'modify_dhcp_range' in request.POST:
range_start = request.POST.get('range_start', '')
@ -189,7 +189,7 @@ def network(request, compute_id, pool):
family = request.POST.get('family', 'ipv4')
try:
conn.modify_dhcp_range(range_start, range_end, family)
messages.success(request, _("{} DHCP Range is Changed.").format(family.upper()))
messages.success(request, _(f"{family.upper()} DHCP Range is Changed."))
return HttpResponseRedirect(request.get_full_path())
except libvirtError as lib_err:
error_messages.append(lib_err)
@ -212,8 +212,8 @@ def network(request, compute_id, pool):
conn.set_qos(qos_dir, average, peak, burst)
if conn.is_active():
messages.success(
request,
_("{} Qos is set. Network XML is changed.").format(qos_dir.capitalize()) +
request,
_(f"{qos_dir.capitalize()} QoS is set. Network XML is changed.") +
_("Stop and start network to activate new config"))
else:
messages.success(request, _("{} QoS is set").format(qos_dir.capitalize()))
@ -226,11 +226,11 @@ def network(request, compute_id, pool):
if conn.is_active():
messages.success(
request,
_("{} Qos is deleted. Network XML is changed. ").format(qos_dir.capitalize()) +
request,
_(f"{qos_dir.capitalize()} QoS is deleted. Network XML is changed. ") +
_("Stop and start network to activate new config."))
else:
messages.success(request, _("{} QoS is deleted").format(qos_dir.capitalize()))
messages.success(request, _(f"{qos_dir.capitalize()} QoS is deleted"))
return HttpResponseRedirect(request.get_full_path())
conn.close()

View file

@ -56,7 +56,7 @@ def nwfilters(request, compute_id):
if 'del_nwfilter' in request.POST:
name = request.POST.get('nwfiltername', '')
msg = _("Deleting NWFilter: %s" % name)
msg = _(f"Deleting NWFilter: {name}")
in_use = False
nwfilter = conn.get_nwfilter(name)
@ -68,7 +68,7 @@ def nwfilters(request, compute_id):
if name in dom_filterrefs:
in_use = True
msg = _("NWFilter is in use by %s. Cannot be deleted." % inst)
msg = _(f"NWFilter is in use by {inst}. Cannot be deleted.")
error_messages.append(msg)
addlogmsg(request.user.username, compute.hostname, msg)
i_conn.close()

View file

@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="WebVirtCloud panel for manage virtual machine">
<meta name="author" content="anatoliy.guskov@gmail.com">