From 583d8b89bcf599b9a2dbb39286da7a6b17e903f7 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 19 Jul 2015 15:39:22 +0300 Subject: [PATCH] added an ajax timeout for reboot & poweroff commands --- static/js/main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/static/js/main.js b/static/js/main.js index 2aab33f..656951f 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -186,7 +186,7 @@ function isAdmin() { return username === adminUsername; } -function ajax(method, url, data, callback, error) { +function ajax(method, url, data, callback, error, timeout) { var origUrl = url; var origData = data; @@ -224,6 +224,7 @@ function ajax(method, url, data, callback, error) { type: method, url: url, data: data, + timeout: timeout || 300 * 1000, success: function (data) { if (data && data.error == 'unauthorized') { if (data.prompt) { @@ -1950,7 +1951,8 @@ function doShutDown() { setTimeout(function () { $('div.modal-glass').animate({'opacity': '1', 'background-color': '#212121'}, 200); },100); - } + }, + 10000 /* timeout = 10s */ ); } @@ -1982,7 +1984,8 @@ function doReboot() { function () { shutDown = true; /* the first error indicates the system was shut down */ setTimeout(checkServer, 1000); - } + }, + 5 * 1000 /* timeout = 5s */ ); } -- 2.39.5