JS code updates

This commit is contained in:
Dane Everitt 2017-03-05 00:04:26 -05:00
parent 349b36d38a
commit 5c32a91200
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 8 additions and 19 deletions

File diff suppressed because one or more lines are too long

View file

@ -17,16 +17,13 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE. // SOFTWARE.
(function updateServerStatus() {
var ServerList = (function () {
var Status = { var Status = {
0: 'Offline', 0: 'Offline',
1: 'Online', 1: 'Online',
2: 'Starting', 2: 'Starting',
3: 'Stopping' 3: 'Stopping'
}; };
$('.dynamic-update').each(function (index, data) { $('.dynamic-update').each(function (index, data) {
var element = $(this); var element = $(this);
var serverShortUUID = $(this).data('server'); var serverShortUUID = $(this).data('server');
@ -81,20 +78,12 @@ var ServerList = (function () {
element.find('[data-action="memory"]').html('--'); element.find('[data-action="memory"]').html('--');
element.find('[data-action="cpu"]').html('--'); element.find('[data-action="cpu"]').html('--');
} }
}
}).fail(function (jqXHR) { }).fail(function (jqXHR) {
console.error(jqXHR); console.error(jqXHR);
element.find('[data-action="status"]').html('<span class="label label-default">Error</span>'); element.find('[data-action="status"]').html('<span class="label label-default">Error</span>');
}); });
}); }).promise().done(function () {
setTimeout(updateServerStatus, 10000); setTimeout(updateServerStatus, 10000);
} });
return {
init: function () {
updateServerStatus();
}
};
})(); })();
ServerList.init();