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

Instance actions rearranged to reflect disable vm actions on instances list

This commit is contained in:
catborise 2019-07-31 09:59:44 +03:00
parent 15c42ee0f6
commit f3b8b251b5
4 changed files with 87 additions and 80 deletions

View file

@ -71,16 +71,16 @@
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
{% endif %} {% endif %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}" disabled>
<span class="glyphicon glyphicon-pause"></span> <span class="glyphicon glyphicon-pause"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}" disabled>
<span class="glyphicon glyphicon-off"></span> <span class="glyphicon glyphicon-off"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}" disabled>
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}" disabled>
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</button> </button>
{% endifequal %} {% endifequal %}
@ -88,21 +88,21 @@
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}"> <button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}" disabled>
<span class="glyphicon glyphicon-pause"></span> <span class="glyphicon glyphicon-pause"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <button class="btn btn-sm btn-default" type="submit" name="powerforce" title="{% trans "Force Off" %}" onclick="return confirm('Are you sure to force it down?')">
<span class="glyphicon glyphicon-off"></span> <span class="glyphicon glyphicon-off"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}" disabled>
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}" disabled>
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</button> </button>
{% endifequal %} {% endifequal %}
{% ifequal info.status 1 %} {% ifequal info.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}" disabled>
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
<button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}"> <button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
@ -114,9 +114,9 @@
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')"> <button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}"> <button class="btn btn-sm btn-default" type="button" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</a> </button>
{% endifequal %} {% endifequal %}
</form> </form>
</td> </td>

View file

@ -23,67 +23,68 @@
</td> </td>
<td>{{ info.vcpu }}</td> <td>{{ info.vcpu }}</td>
<td>{{ info.memory|filesizeformat }}</td> <td>{{ info.memory|filesizeformat }}</td>
<td><form action="" method="post" role="form">{% csrf_token %} <td>
<input type="hidden" name="name" value="{{ vm }}"/> <form action="" method="post" role="form">{% csrf_token %}
<input type="hidden" name="compute_id" value="{{ host.0 }}"/> <input type="hidden" name="name" value="{{ vm }}"/>
{% ifequal info.status 5 %} <input type="hidden" name="compute_id" value="{{ host.0 }}"/>
{% if info.is_template %} {% ifequal info.status 5 %}
<button class="btn btn-sm btn-default" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ host.0 }}, '{{ vm }}');"> {% if info.is_template %}
<span class="glyphicon glyphicon-duplicate"></span> <button class="btn btn-sm btn-default" type="button" name="clone" title="{% trans "Clone" %}" onclick="goto_instance_clone({{ host.0 }}, '{{ vm }}');">
<span class="glyphicon glyphicon-duplicate"></span>
</button>
{% else %}
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
{% endif %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}" disabled>
<span class="glyphicon glyphicon-pause"></span>
</button> </button>
{% else %} <button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}" disabled>
<button class="btn btn-sm btn-default" type="submit" name="poweron" title="{% trans "Power On" %}"> <span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}" disabled>
<span class="glyphicon glyphicon-refresh"></span>
</button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}" disabled>
<span class="glyphicon glyphicon-eye-open"></span>
</button>
{% endifequal %}
{% ifequal info.status 3 %}
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
{% endif %} <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}" disabled>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> <span class="glyphicon glyphicon-pause"></span>
<span class="glyphicon glyphicon-pause"></span> </button>
</button> <button class="btn btn-sm btn-default" type="submit" name="powerforce" title="{% trans "Force Off" %}" onclick="return confirm('Are you sure to force it down?')">
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <span class="glyphicon glyphicon-off"></span>
<span class="glyphicon glyphicon-off"></span> </button>
</button> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}" disabled>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <span class="glyphicon glyphicon-refresh"></span>
<span class="glyphicon glyphicon-refresh"></span> </button>
</button> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}" disabled>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <span class="glyphicon glyphicon-eye-open"></span>
<span class="glyphicon glyphicon-eye-open"></span> </button>
</button> {% endifequal %}
{% endifequal %} {% ifequal info.status 1 %}
{% ifequal info.status 3 %} <button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}" disabled>
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}"> <span class="glyphicon glyphicon-play"></span>
<span class="glyphicon glyphicon-play"></span> </button>
</button> <button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> <span class="glyphicon glyphicon-pause"></span>
<span class="glyphicon glyphicon-pause"></span> </button>
</button> <button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}" onclick="return confirm('Are you sure?')">
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <span class="glyphicon glyphicon-off"></span>
<span class="glyphicon glyphicon-off"></span> </button>
</button> <button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <span class="glyphicon glyphicon-refresh"></span>
<span class="glyphicon glyphicon-refresh"></span> </button>
</button> <button class="btn btn-sm btn-default" type="button" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <span class="glyphicon glyphicon-eye-open"></span>
<span class="glyphicon glyphicon-eye-open"></span> </button>
</button> {% endifequal %}
{% endifequal %} </form>
{% ifequal info.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}">
<span class="glyphicon glyphicon-play"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
<span class="glyphicon glyphicon-pause"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="poweroff" title="{% trans "Power Off" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-off"></span>
</button>
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-refresh"></span>
</button>
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span>
</a>
{% endifequal %}
</form>
</td> </td>
</tr> </tr>
{% endfor %} {% endfor %}

View file

@ -100,16 +100,16 @@
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
{% endif %} {% endif %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}" disabled>
<span class="glyphicon glyphicon-pause"></span> <span class="glyphicon glyphicon-pause"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}" disabled>
<span class="glyphicon glyphicon-off"></span> <span class="glyphicon glyphicon-off"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}" disabled>
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}" disabled>
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</button> </button>
{% endifequal %} {% endifequal %}
@ -117,21 +117,21 @@
<button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}"> <button class="btn btn-sm btn-default" type="submit" name="resume" title="{% trans "Resume" %}">
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Suspend" %}" disabled>
<span class="glyphicon glyphicon-pause"></span> <span class="glyphicon glyphicon-pause"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Off" %}"> <button class="btn btn-sm btn-default" type="submit" name="powerforce" title="{% trans "Force Off" %}" onclick="return confirm('Are you sure to force it down?')">
<span class="glyphicon glyphicon-off"></span> <span class="glyphicon glyphicon-off"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power Cycle" %}" disabled>
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "VNC Console" %}" disabled>
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</button> </button>
{% endifequal %} {% endifequal %}
{% ifequal info.status 1 %} {% ifequal info.status 1 %}
<button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}"> <button class="btn btn-sm btn-default disabled" title="{% trans "Power On" %}" disabled>
<span class="glyphicon glyphicon-play"></span> <span class="glyphicon glyphicon-play"></span>
</button> </button>
<button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}"> <button class="btn btn-sm btn-default" type="submit" name="suspend" title="{% trans "Suspend" %}">
@ -143,9 +143,9 @@
<button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')"> <button class="btn btn-sm btn-default" type="submit" name="powercycle" title="{% trans "Power Cycle" %}" onclick="return confirm('Are you sure?')">
<span class="glyphicon glyphicon-refresh"></span> <span class="glyphicon glyphicon-refresh"></span>
</button> </button>
<a href="#" class="btn btn-sm btn-default" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}"> <button class="btn btn-sm btn-default" type="button" onclick='open_console("{{ host.0 }}-{{ info.uuid }}")' title="{% trans "Console" %}">
<span class="glyphicon glyphicon-eye-open"></span> <span class="glyphicon glyphicon-eye-open"></span>
</a> </button>
{% endifequal %} {% endifequal %}
</form> </form>
</td> </td>

View file

@ -988,6 +988,12 @@ def instances_actions(request):
conn.shutdown(name) conn.shutdown(name)
return HttpResponseRedirect(request.get_full_path()) return HttpResponseRedirect(request.get_full_path())
if 'powerforce' in request.POST:
conn.force_shutdown()
msg = _("Force Off")
addlogmsg(request.user.username, instance.name, msg)
return HttpResponseRedirect(request.get_full_path())
if 'powercycle' in request.POST: if 'powercycle' in request.POST:
msg = _("Power Cycle") msg = _("Power Cycle")
conn.force_shutdown(name) conn.force_shutdown(name)