Commit 8a7407ff by Kálmán Viktor

dashboard: add icon to vm state after ajax activity refresh

parent 327ada45
...@@ -214,7 +214,8 @@ function checkNewActivity(only_state, runs) { ...@@ -214,7 +214,8 @@ function checkNewActivity(only_state, runs) {
$("[title]").tooltip(); $("[title]").tooltip();
} }
$("#vm-details-state").html(data['state']); $("#vm-details-state i").prop("class", data['icon']);
$("#vm-details-state span").html(data['state']);
if(data['state'] == "RUNNING") { if(data['state'] == "RUNNING") {
$("[data-target=#_console]").attr("data-toggle", "pill").attr("href", "#console").parent("li").removeClass("disabled"); $("[data-target=#_console]").attr("data-toggle", "pill").attr("href", "#console").parent("li").removeClass("disabled");
} else { } else {
......
...@@ -111,7 +111,10 @@ ...@@ -111,7 +111,10 @@
<div class="row"> <div class="row">
<div class="col-md-4" id="vm-info-pane"> <div class="col-md-4" id="vm-info-pane">
<div class="big"> <div class="big">
<span id="vm-details-state" class="label label-success"><i class="{{ instance.get_status_icon }}"></i> {{ instance.get_status_display|upper }}</span> <span id="vm-details-state" class="label label-success">
<i class="{{ instance.get_status_icon }}"></i>
<span>{{ instance.get_status_display|upper }}</span>
</span>
</div> </div>
<h3>{% trans "Connection" %}</h3> <h3>{% trans "Connection" %}</h3>
<input type="text" value="{{ instance.get_connect_command }}" class="form-control" readonly /> <input type="text" value="{{ instance.get_connect_command }}" class="form-control" readonly />
......
...@@ -1598,6 +1598,7 @@ def vm_activity(request, pk): ...@@ -1598,6 +1598,7 @@ def vm_activity(request, pk):
only_state = request.GET.get("only_state") only_state = request.GET.get("only_state")
response['state'] = instance.state response['state'] = instance.state
response['icon'] = instance.get_status_icon()
if only_state is not None and only_state == "false": # instance activity if only_state is not None and only_state == "false": # instance activity
context = { context = {
'activities': InstanceActivity.objects.filter( 'activities': InstanceActivity.objects.filter(
......
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