Commit 6554ddff by Kálmán Viktor

dashboard: rename state variable names to status in views and js

parent d0f18ec8
...@@ -199,24 +199,24 @@ function decideActivityRefresh() { ...@@ -199,24 +199,24 @@ function decideActivityRefresh() {
return check; return check;
} }
function checkNewActivity(only_state, runs) { function checkNewActivity(only_status, runs) {
// set default only_state to false // set default only_status to false
only_state = typeof only_state !== 'undefined' ? only_state : false; only_status = typeof only_status !== 'undefined' ? only_status : false;
var instance = location.href.split('/'); instance = instance[instance.length - 2]; var instance = location.href.split('/'); instance = instance[instance.length - 2];
$.ajax({ $.ajax({
type: 'GET', type: 'GET',
url: '/dashboard/vm/' + instance + '/activity/', url: '/dashboard/vm/' + instance + '/activity/',
data: {'only_state': only_state}, data: {'only_status': only_status},
success: function(data) { success: function(data) {
if(!only_state) { if(!only_status) {
$("#activity-timeline").html(data['activities']); $("#activity-timeline").html(data['activities']);
$("[title]").tooltip(); $("[title]").tooltip();
} }
$("#vm-details-state i").prop("class", data['icon']); $("#vm-details-state i").prop("class", data['icon']);
$("#vm-details-state span").html(data['human_readable_state'].toUpperCase()); $("#vm-details-state span").html(data['human_readable_status'].toUpperCase());
if(data['state'] == "RUNNING") { if(data['status'] == "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 {
$("[data-target=#_console]").attr("data-toggle", "_pill").attr("href", "#").parent("li").addClass("disabled"); $("[data-target=#_console]").attr("data-toggle", "_pill").attr("href", "#").parent("li").addClass("disabled");
...@@ -224,7 +224,7 @@ function checkNewActivity(only_state, runs) { ...@@ -224,7 +224,7 @@ function checkNewActivity(only_state, runs) {
if(runs > 0 && decideActivityRefresh()) { if(runs > 0 && decideActivityRefresh()) {
setTimeout( setTimeout(
function() {checkNewActivity(only_state, runs + 1)}, function() {checkNewActivity(only_status, runs + 1)},
1000 + Math.exp(runs * 0.05) 1000 + Math.exp(runs * 0.05)
); );
} }
......
...@@ -1613,12 +1613,12 @@ def vm_activity(request, pk): ...@@ -1613,12 +1613,12 @@ def vm_activity(request, pk):
raise PermissionDenied() raise PermissionDenied()
response = {} response = {}
only_state = request.GET.get("only_state") only_status = request.GET.get("only_status")
response['human_readable_state'] = instance.get_status_display() response['human_readable_status'] = instance.get_status_display()
response['state'] = instance.state response['status'] = instance.status
response['icon'] = instance.get_status_icon() response['icon'] = instance.get_status_icon()
if only_state is not None and only_state == "false": # instance activity if only_status == "false": # instance activity
context = { context = {
'activities': InstanceActivity.objects.filter( 'activities': InstanceActivity.objects.filter(
instance=instance, parent=None instance=instance, parent=None
......
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