1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 07:35:22 +00:00

replace deprecated ifequal/ifnotequal with if

This commit is contained in:
catborise 2020-06-04 15:40:57 +03:00
parent e46bb99b3b
commit 6a0d04d300
14 changed files with 74 additions and 74 deletions

View file

@ -59,7 +59,7 @@
<h5 class="modal-title">{% trans "Edit connection" %}</h5>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
</div>
{% ifequal compute.type 1 %}
{% if compute.type == 1 %}
<form method="post" role="form" aria-label="Edit tcp host form">{% csrf_token %}
<div class="modal-body">
<div class="form-group row">
@ -105,8 +105,8 @@
</button>
</div>
</form>
{% endifequal %}
{% ifequal compute.type 2 %}
{% endif %}
{% if compute.type == 2 %}
<form method="post" role="form" aria-label="Edit ssh host form">{% csrf_token %}
<div class="modal-body">
<p class="modal-body">{% trans "Need create ssh <a href='https://github.com/retspen/webvirtmgr/wiki/Setup-SSH-Authorization'>authorization key</a>. If you have another SSH port on your server, you can add IP:PORT like '192.168.1.1:2222'." %}</p>
@ -149,8 +149,8 @@
</button>
</div>
</form>
{% endifequal %}
{% ifequal compute.type 3 %}
{% endif %}
{% if compute.type == 3 %}
<form method="post" role="form" aria-label="Edit tls host form">{% csrf_token %}
<div class="modal-body">
<div class="form-group row">
@ -197,8 +197,8 @@
</button>
</div>
</form>
{% endifequal %}
{% ifequal compute.type 4 %}
{% endif %}
{% if compute.type == 4 %}
<form method="post" role="form" aria-label="Edit/delete host form">{% csrf_token %}
<div class="modal-body">
<div class="form-group row">
@ -226,7 +226,7 @@
</button>
</div>
</form>
{% endifequal %}
{% endif %}
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->

View file

@ -140,7 +140,7 @@
{% endfor %}
</optgroup>
{% else %}
<option value="{{ mode }}" {% ifequal mode default_cpu_mode %}selected {% endifequal %}>
<option value="{{ mode }}" {% if mode == default_cpu_mode %}selected {% endif %}>
{% trans mode %}
</option>
{% endif %}
@ -343,7 +343,7 @@
{% endfor %}
</optgroup>
{% else %}
<option value="{{ mode }}" {% ifequal mode default_cpu_mode %}selected {% endifequal %}>
<option value="{{ mode }}" {% if mode == default_cpu_mode %}selected {% endif %}>
{% trans mode %}
</option>
{% endif %}
@ -555,7 +555,7 @@
{% endfor %}
</optgroup>
{% else %}
<option value="{{ mode }}" {% ifequal mode default_cpu_mode %}selected {% endifequal %}>
<option value="{{ mode }}" {% if mode == default_cpu_mode %}selected{% endif %}>
{% trans mode %}
</option>
{% endif %}

View file

@ -34,12 +34,12 @@
</div>
</div>
{% else %}
{% ifequal view_style "nongrouped" %}
{% if view_style == "nongrouped" %}
{% include 'allinstances_index_nongrouped.html' %}
{% endifequal %}
{% ifequal view_style "grouped" %}
{% endif %}
{% if view_style == "grouped" %}
{% include 'allinstances_index_grouped.html' %}
{% endifequal %}
{% endif %}
{% endif %}
{% else %}
{% if not all_user_vms %}
@ -64,15 +64,15 @@
{% for inst, vm in all_user_vms.items %}
<tr>
<td><a href="{% url 'instance' vm.compute_id vm.name %}">{{ vm.name }}</a><br><small><em>{{ vm.title }}</em></small></td>
<td>{% ifequal vm.status 1 %}
<td>{% if vm.status == 1 %}
<span class="text-success">{% trans "Active" %}</span>
{% endifequal %}
{% ifequal vm.status 5 %}
{% endif %}
{% if vm.status == 5 %}
<span class="text-danger">{% trans "Off" %}</span>
{% endifequal %}
{% ifequal vm.status 3 %}
{% endif %}
{% if vm.status == 3 %}
<span class="text-warning">{% trans "Suspend" %}</span>
{% endifequal %}
{% endif %}
</td>
<td>{{ vm.vcpu }}</td>
<td>{{ vm.memory }} {% trans "MB" %}</td>

View file

@ -23,9 +23,9 @@
</td>
<td class="d-none d-sm-table-cell"></td>
<td>
{% 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 %}
{% if host.2 == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
{% if host.2 == 2 %}<span class="text-warning">{% trans "Not Active" %}</span>{% endif %}
{% if host.2 == 3 %}<span class="text-danger">{% trans "Connection Failed" %}</span>{% endif %}
</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>
@ -53,9 +53,9 @@
</span>
</td>
<td>
{% ifequal vm.status 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
{% ifequal vm.status 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endifequal %}
{% ifequal vm.status 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endifequal %}
{% if vm.status == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
{% if vm.status == 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endif %}
{% if vm.status == 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endif %}
</td>
<td class="d-none d-sm-table-cell text-center">{{ vm.vcpu }}</td>
<td class="d-none d-sm-table-cell text-right">{{ vm.memory |filesizeformat }}</td>

View file

@ -17,9 +17,9 @@
<td><a href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ info.title }}</em></small></td>
<td><a href="{% url 'overview' host.0 %}">{{ host.1 }}</a><br><small><em>{% if info.userinstances.count > 0 %}{{ info.userinstances.first_user.user.username }}{% if info.userinstances.count > 1 %} (+{{ info.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td>
<td>
{% ifequal vm.status 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
{% ifequal vm.status 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endifequal %}
{% ifequal vm.status 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endifequal %}
{% if vm.status == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
{% if vm.status == 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endif %}
{% if vm.status == 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endif %}
</td>
<td>{{ vm.vcpu }}</td>
<td>{{ vm.memory|filesizeformat }}</td>

View file

@ -2,7 +2,7 @@
<form action="" method="post" role="form" aria-label="Shortcut instance action form">{% csrf_token %}
<input type="hidden" name="name" value="{{ inst }}"/>
<input type="hidden" name="compute_id" value="{{ host.0 }}"/>
{% ifequal vm.status 5 %}
{% if vm.status == 5 %}
{% if vm.is_template %}
<button class="btn btn-sm btn-secondary" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ host.0 }}, '{{ inst }}');">
<span class="fa fa-clone"></span>
@ -24,8 +24,8 @@
<button class="btn btn-sm btn-secondary disabled" title="{% trans "VNC Console" %}" disabled>
<span class="fa fa-eye"></span>
</button>
{% endifequal %}
{% ifequal vm.status 3 %}
{% endif %}
{% if vm.status == 3 %}
<button class="btn btn-sm btn-secondary" type="submit" name="resume" title="{% trans "Resume" %}">
<span class="fa fa-play"></span>
</button>
@ -41,8 +41,8 @@
<button class="btn btn-sm btn-secondary disabled" title="{% trans "VNC Console" %}" disabled>
<span class="fa fa-eye"></span>
</button>
{% endifequal %}
{% ifequal vm.status 1 %}
{% endif %}
{% if vm.status == 1 %}
<button class="btn btn-sm btn-secondary disabled" title="{% trans "Power On" %}" disabled>
<span class="fa fa-play"></span>
</button>
@ -58,5 +58,5 @@
<button class="btn btn-sm btn-secondary" type="button" onclick='open_console("{{ host.0 }}-{{ vm.uuid }}")' title="{% trans "Console" %}">
<span class="fa fa-eye"></span>
</button>
{% endifequal %}
{% endif %}
</form>

View file

@ -82,9 +82,9 @@
<td><a class="text-secondary" href="{% url 'instance' host.0 inst %}">{{ inst }}</a><br><small><em>{{ vm.title }}</em></small></td>
<td class="d-none d-md-table-cell"><small><em>{% if vm.userinstances.count > 0 %}{{ vm.userinstances.first_user.user.username }}{% if vm.userinstances.count > 1 %} (+{{ vm.userinstances.count|add:"-1" }}){% endif %}{% endif %}</em></small></td>
<td>
{% ifequal vm.status 1 %}<span class="text-success">{% trans "Active" %}</span>{% endifequal %}
{% ifequal vm.status 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endifequal %}
{% ifequal vm.status 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endifequal %}
{% if vm.status == 1 %}<span class="text-success">{% trans "Active" %}</span>{% endif %}
{% if vm.status == 5 %}<span class="text-danger">{% trans "Off" %}</span>{% endif %}
{% if vm.status == 3 %}<span class="text-warning">{% trans "Suspend" %}</span>{% endif %}
</td>
<td>{{ vm.vcpu }}</td>
<td>{{ vm.memory|filesizeformat }}</td>

View file

@ -39,36 +39,36 @@
<dl class="ml-3 row">
<dt class="col-4">{% trans "Interface" %}</dt>
<dd class="col-8"><strong>{{ iface }}</strong></dd>
<dt class="col-4">{% trans "IPv4" %} ({% ifequal ipv4 None %}{% trans 'None' %}{% else %}{{ ipv4_type }}{% endifequal %})</dt>
<dt class="col-4">{% trans "IPv4" %} ({% if ipv4 == None %}{% trans 'None' %}{% else %}{{ ipv4_type }}{% endif %})</dt>
<dd class="col-8">{{ ipv4 }}</dd>
<dt class="col-4">{% trans "IPv6" %} ({% ifequal ipv6 None %}{% trans 'None' %}{% else %}{{ ipv6_type }}{% endifequal %})</dt>
<dt class="col-4">{% trans "IPv6" %} ({% if ipv6 == None %}{% trans 'None' %}{% else %}{{ ipv6_type }}{% endif %})</dt>
<dd class="col-8">{{ ipv6 }}</dd>
<dt class="col-4">{% trans "MAC" %}</dt>
<dd class="col-8">{{ mac }}</dd>
<dt class="col-4">{% trans "Interface Type" %}</dt>
<dd class="col-8">{{ itype }}</dd>
{% ifequal itype 'bridge' %}
{% if itype == 'bridge' %}
<dt class="col-4">{% trans "Bridge Device" %}</dt>
<dd class="col-8">{{ bridge }}</dd>
{% endifequal %}
{% endif %}
<dt class="col-4">{% trans "Boot Mode" %}</dt>
<dd class="col-8">{{ start_mode }}</dd>
<dt class="col-4">{% trans "State" %}</dt>
<dd class="col-8">
<form action="" method="post" role="form" aria-label="Interface start/stop/delete form">{% csrf_token %}
{% ifequal state 0 %}
{% if state == 0 %}
<input type="submit" class="btn btn-sm btn-primary" name="start" value="{% trans "Start" %}">
<input type="submit" class="btn btn-sm btn-danger" name="delete" value="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="stop" value="{% trans "Stop" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
{% endifequal %}
{% endif %}
</form>
</dd>
</dl>
<div class="col-sm-12">
<h5>{% trans 'Slaves' %}</h5>
{% ifequal itype 'bridge' %}
{% if itype == 'bridge' %}
<table class="table table-bordered">
<thead>
<tr>
@ -91,7 +91,7 @@
{% endfor %}
</tbody>
</table>
{% endifequal %}
{% endif %}
</div>
</div>

View file

@ -50,8 +50,8 @@
{% else %}
{% for iface in ifaces_all %}
<div class="col-12 col-sm-4">
<div class="mb-3 card {% ifequal iface.state 1 %}border-success{% else %}border-danger{% endifequal %} shadow-sm">
<div class="card-header {% ifequal iface.state 1 %}bg-success{% else %}bg-danger{% endifequal %}">
<div class="mb-3 card {% if iface.state == 1 %}border-success{% else %}border-danger{% endif %} shadow-sm">
<div class="card-header {% if iface.state == 1 %}bg-success{% else %}bg-danger{% endif %}">
<h6 class="my-0 card-title">
<a class="card-link text-light" href="{% url 'interface' compute.id iface.name %}">{{ iface.name }}</a>
</h6>

View file

@ -1,10 +1,10 @@
from django.shortcuts import render, get_object_or_404
from django.http import HttpResponseRedirect
from django.urls import reverse
from libvirt import libvirtError
from computes.models import Compute
from interfaces.forms import AddInterface
from vrtManager.interface import wvmInterface, wvmInterfaces
from libvirt import libvirtError
from admin.decorators import superuser_only

View file

@ -48,22 +48,22 @@
<dt class="col-6">{% trans "State" %}</dt>
<dd class="col-6">
<form action="" method="post" role="form" aria-label="Network start/stop/delete form">{% csrf_token %}
{% ifequal state 0 %}
{% if state == 0 %}
<input type="submit" class="btn btn-sm btn-success" name="start" value="{% trans "Start" %}">
<input type="submit" class="btn btn-sm btn-danger" name="delete" value="{% trans "Delete" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="stop" value="{% trans "Stop" %}" onclick="return confirm('{% trans "Are you sure?" %}')">
{% endifequal %}
{% endif %}
</form>
</dd>
<dt class="col-6">{% trans "Autostart" %}</dt>
<dd class="col-6">
<form action="" method="post" role="form" aria-label="Network enable/disable autostart form">{% csrf_token %}
{% ifequal autostart 0 %}
{% if autostart == 0 %}
<input type="submit" class="btn btn-sm btn-success" name="set_autostart" value="{% trans "Enable" %}">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="unset_autostart" onclick="return confirm('{% trans "Are you sure?" %}')" value="{% trans "Disable" %}">
{% endifequal %}
{% endif %}
</form>
</dd>
</dl>
@ -94,15 +94,15 @@
<dl class="ml-3 row">
<dt class="col-6">{% trans "IPv4 Forwarding" %}</dt>
<dd class="col-6">
{% ifequal net_forward.0 'nat' %}
{% if net_forward.0 == 'nat' %}
{% trans "NAT" %}
{% endifequal %}
{% ifequal net_forward.0 'route' %}
{% endif %}
{% if net_forward.0 == 'route' %}
{% trans "ROUTE" %}
{% endifequal %}
{% ifequal net_forward.0 'bridge' %}
{% endif %}
{% if net_forward.0 == 'bridge' %}
{% trans "BRIDGE" %}
{% endifequal %}
{% endif %}
{% if not net_forward.0 %}
{% trans "ISOLATE" %}
{% endif %}

View file

@ -66,15 +66,15 @@
{% for secret in secrets_all %}
<tr>
<th scope="row">{{ secret.uuid }}</th>
<td>{% ifequal secret.usageType 0 %}
<td>{% if secret.usageType == 0 %}
{% trans "volume" %}
{% endifequal %}
{% ifequal secret.usageType 1 %}
{% endif %}
{% if secret.usageType == 1 %}
{% trans "iscsi" %}
{% endifequal %}
{% ifequal secret.usageType 2 %}
{% endif %}
{% if secret.usageType 2 %}
{% trans "ceph" %}
{% endifequal %}
{% endif %}
</td>
<td>{{ secret.usage }}</td>
<td>

View file

@ -1,7 +1,7 @@
{% load i18n %}
{% if request.user.is_superuser %}
{% ifnotequal state 0 %}
{% ifequal pool "iso" %}
{% if state != 0 %}
{% if pool == "iso" %}
<a href="#IsoUpload" class="btn btn-success float-right" data-toggle="modal">
<span class="fa fa-plus" aria-hidden="true"></span>
</a>
@ -85,6 +85,6 @@
</div> <!-- /.modal-content -->
</div> <!-- /.modal-dialog -->
</div> <!-- /.modal -->
{% endifequal %}
{% endifnotequal %}
{% endif %}
{% endif %}
{% endif %}

View file

@ -58,26 +58,26 @@
<dt class="col-6">{% trans "State" %}</dt>
<dd class="col-6">
<form action="" method="post" role="form" aria-label="Storage start/stop form">{% csrf_token %}
{% ifequal state 0 %}
{% if state == 0 %}
<input type="submit" class="btn btn-sm btn-secondary" name="start" value="{% trans "Start" %}">
<input type="submit" class="btn btn-sm btn-danger" name="delete" value="{% trans "Delete" %}"
onclick="return confirm('{% trans "Are you sure?" %}')">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="stop" value="{% trans "Stop" %}"
onclick="return confirm('{% trans "Are you sure?" %}')">
{% endifequal %}
{% endif %}
</form>
</dd>
<dt class="col-6">{% trans "Autostart" %}</dt>
<dd class="col-6">
<form action="" method="post" role="form" aria-label="Storage disable/enable autostart form">{% csrf_token %}
{% ifequal autostart 0 %}
{% if autostart == 0 %}
<input type="submit" class="btn btn-sm btn-secondary" name="set_autostart"
value="{% trans "Enable" %}">
{% else %}
<input type="submit" class="btn btn-sm btn-secondary" name="unset_autostart"
onclick="return confirm('{% trans "Are you sure?" %}')" value="{% trans "Disable" %}">
{% endifequal %}
{% endif %}
</form>
</dd>
</dl>