From 6e828133605650752b8d9192eeef2f927534fd9d Mon Sep 17 00:00:00 2001 From: Chris Jackson Date: Sat, 28 May 2016 19:11:24 +0100 Subject: [PATCH] feat(UI): Add button to close "Server Offline" message box fixes #104 Signed-off-by: Chris Jackson --- src/app/home/serverMonitor.js | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/src/app/home/serverMonitor.js b/src/app/home/serverMonitor.js index 813a1151..014946d1 100644 --- a/src/app/home/serverMonitor.js +++ b/src/app/home/serverMonitor.js @@ -16,6 +16,7 @@ angular.module('serverMonitor', [ .service('ServerMonitor', function ($modal, $rootScope, ChartModel, growl, locale, UserService) { var modalInstance = null; + var reset = false; /** * Listen for the online/offline broadcasts and display a modal @@ -24,7 +25,15 @@ angular.module('serverMonitor', [ this.monitor = function () { $rootScope.$on("habminOnline", function (event, status) { if (status == false) { - if (modalInstance == null) { + if (modalInstance == null && reset == false) { + reset = true; + var scope = $rootScope.$new(); + + scope.cancel = function () { + modalInstance.dismiss("cancel"); + modalInstance = null; + }; + modalInstance = $modal.open({ backdrop: 'static', keyboard: true, @@ -34,14 +43,21 @@ angular.module('serverMonitor', [ '' + ' ' + '' + - '', - windowClass: UserService.getTheme() + '' + + '', + windowClass: UserService.getTheme(), + scope: scope }); } } - else if (modalInstance != null) { - modalInstance.close(); - modalInstance = null; + else { + reset = false; + if (modalInstance != null) { + modalInstance.close(); + modalInstance = null; + } } }); };