Commit 302a9fd0 by Kálmán Viktor

dashboard: fix resources slider save button

parent 0f995dc5
...@@ -13,11 +13,11 @@ ...@@ -13,11 +13,11 @@
{% if op.resources_change %} {% if op.resources_change %}
<button type="submit" class="btn btn-success btn-sm change-resources-button" <button type="submit" class="btn btn-success btn-sm change-resources-button"
id="vm-details-resources-save" data-vm="{{ instance.pk }}" id="vm-details-resources-save" data-vm="{{ instance.pk }}"
{% if op.resources_change.disabled %}disabled{% endif %}> {% if not save_resources_enabled %}disabled{% endif %}>
<i class="fa fa-floppy-o"></i> {% trans "Save resources" %} <i class="fa fa-floppy-o"></i> {% trans "Save resources" %}
</button> </button>
<span class="change-resources-help" <span class="change-resources-help"
{% if not op.resources_change.disabled %}style="display: none;"{% endif %}> {% if save_resources_enabled %}style="display: none;"{% endif %}>
{% trans "Stop your VM to change resources." %} {% trans "Stop your VM to change resources." %}
</span> </span>
{% else %} {% else %}
......
...@@ -173,6 +173,10 @@ class VmDetailView(GraphMixin, CheckedDetailView): ...@@ -173,6 +173,10 @@ class VmDetailView(GraphMixin, CheckedDetailView):
context['is_operator'] = is_operator context['is_operator'] = is_operator
context['is_owner'] = is_owner context['is_owner'] = is_owner
# operation also allows RUNNING (if with_shutdown is present)
context['save_resources_enabled'] = instance.status not in ("RUNNING",
"PENDING")
return context return context
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment