1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2025-07-31 12:41:08 +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

@ -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')