Skip to content
This repository was archived by the owner on May 23, 2019. It is now read-only.

Commit 6e82813

Browse files
committed
feat(UI): Add button to close "Server Offline" message box
fixes #104 Signed-off-by: Chris Jackson <chris@cd-jackson.com>
1 parent 3e46f6c commit 6e82813

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

src/app/home/serverMonitor.js

+22-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ angular.module('serverMonitor', [
1616
.service('ServerMonitor',
1717
function ($modal, $rootScope, ChartModel, growl, locale, UserService) {
1818
var modalInstance = null;
19+
var reset = false;
1920

2021
/**
2122
* Listen for the online/offline broadcasts and display a modal
@@ -24,7 +25,15 @@ angular.module('serverMonitor', [
2425
this.monitor = function () {
2526
$rootScope.$on("habminOnline", function (event, status) {
2627
if (status == false) {
27-
if (modalInstance == null) {
28+
if (modalInstance == null && reset == false) {
29+
reset = true;
30+
var scope = $rootScope.$new();
31+
32+
scope.cancel = function () {
33+
modalInstance.dismiss("cancel");
34+
modalInstance = null;
35+
};
36+
2837
modalInstance = $modal.open({
2938
backdrop: 'static',
3039
keyboard: true,
@@ -34,14 +43,21 @@ angular.module('serverMonitor', [
3443
'<span class="fa fa-exclamation-triangle text-danger"></span>' +
3544
'&nbsp;' +
3645
'<span i18n="habmin.StatusOffline"></span>' +
37-
'</h3></div>',
38-
windowClass: UserService.getTheme()
46+
'</h3></div>' +
47+
'<div class="modal-footer">' +
48+
'<button class="btn btn-xs btn-warning" type="button" ng-click="cancel()" i18n="common.close"></button>' +
49+
'</div>',
50+
windowClass: UserService.getTheme(),
51+
scope: scope
3952
});
4053
}
4154
}
42-
else if (modalInstance != null) {
43-
modalInstance.close();
44-
modalInstance = null;
55+
else {
56+
reset = false;
57+
if (modalInstance != null) {
58+
modalInstance.close();
59+
modalInstance = null;
60+
}
4561
}
4662
});
4763
};

0 commit comments

Comments
 (0)