Commit fc3d79dd by Kálmán Viktor

dashboard: rewrite with_reload js side

- don't refresh the page immediately when the response
  comes back, wait til all the activity finishes
parent 250c4b3d
...@@ -51,7 +51,8 @@ $(function() { ...@@ -51,7 +51,8 @@ $(function() {
if(data.success) { if(data.success) {
$('a[href="#activity"]').trigger("click"); $('a[href="#activity"]').trigger("click");
if(data.with_reload) { if(data.with_reload) {
location.reload(); // when the activity check stops the page will reload
reload_vm_detail = true;
} }
/* if there are messages display them */ /* if there are messages display them */
......
var show_all = false; var show_all = false;
var in_progress = false; var in_progress = false;
var activity_hash = 5; var activity_hash = 5;
var reload_vm_detail = false;
$(function() { $(function() {
/* do we need to check for new activities */ /* do we need to check for new activities */
...@@ -404,6 +405,7 @@ function checkNewActivity(runs) { ...@@ -404,6 +405,7 @@ function checkNewActivity(runs) {
); );
} else { } else {
in_progress = false; in_progress = false;
if(reload_vm_detail) location.reload();
} }
$('a[href="#activity"] i').removeClass('fa-spin'); $('a[href="#activity"] i').removeClass('fa-spin');
}, },
......
...@@ -374,6 +374,7 @@ class VmDiskResizeView(FormOperationMixin, VmOperationView): ...@@ -374,6 +374,7 @@ class VmDiskResizeView(FormOperationMixin, VmOperationView):
op = 'resize_disk' op = 'resize_disk'
form_class = VmDiskResizeForm form_class = VmDiskResizeForm
show_in_toolbar = False show_in_toolbar = False
with_reload = True
icon = 'arrows-alt' icon = 'arrows-alt'
effect = "success" effect = "success"
...@@ -401,6 +402,7 @@ class VmCreateDiskView(FormOperationMixin, VmOperationView): ...@@ -401,6 +402,7 @@ class VmCreateDiskView(FormOperationMixin, VmOperationView):
icon = 'hdd-o' icon = 'hdd-o'
effect = "success" effect = "success"
is_disk_operation = True is_disk_operation = True
with_reload = True
class VmDownloadDiskView(FormOperationMixin, VmOperationView): class VmDownloadDiskView(FormOperationMixin, VmOperationView):
...@@ -411,6 +413,7 @@ class VmDownloadDiskView(FormOperationMixin, VmOperationView): ...@@ -411,6 +413,7 @@ class VmDownloadDiskView(FormOperationMixin, VmOperationView):
icon = 'download' icon = 'download'
effect = "success" effect = "success"
is_disk_operation = True is_disk_operation = True
with_reload = True
class VmMigrateView(VmOperationView): class VmMigrateView(VmOperationView):
......
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