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