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

Commit

Permalink
feat(UI): Add button to close "Server Offline" message box
Browse files Browse the repository at this point in the history
fixes #104

Signed-off-by: Chris Jackson <chris@cd-jackson.com>
  • Loading branch information
cdjackson committed May 28, 2016
1 parent 3e46f6c commit 6e82813
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/app/home/serverMonitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand All @@ -34,14 +43,21 @@ angular.module('serverMonitor', [
'<span class="fa fa-exclamation-triangle text-danger"></span>' +
'&nbsp;' +
'<span i18n="habmin.StatusOffline"></span>' +
'</h3></div>',
windowClass: UserService.getTheme()
'</h3></div>' +
'<div class="modal-footer">' +
'<button class="btn btn-xs btn-warning" type="button" ng-click="cancel()" i18n="common.close"></button>' +
'</div>',
windowClass: UserService.getTheme(),
scope: scope
});
}
}
else if (modalInstance != null) {
modalInstance.close();
modalInstance = null;
else {
reset = false;
if (modalInstance != null) {
modalInstance.close();
modalInstance = null;
}
}
});
};
Expand Down

0 comments on commit 6e82813

Please sign in to comment.