Add a maintenance notification kind and make it of the level warning.

This commit is contained in:
Jake Moshenko 2014-06-27 19:18:27 -04:00
parent b47742b011
commit 4e5e8a08de
5 changed files with 69 additions and 9 deletions

View file

@ -919,6 +919,12 @@ quayApp = angular.module('quay', quayDependencies, function($provide, cfpLoading
'message': 'Your license will expire at: {expires_at} ' +
'<br><br>Please contact Quay.io support to purchase a new license.',
'page': '/contact/'
},
'maintenance': {
'level': 'warning',
'message': 'We will be down for schedule maintenance from {from_date} to {to_date} ' +
'for {reason}. We are sorry about any inconvenience.',
'page': 'http://status.quay.io/'
}
};
@ -4335,7 +4341,11 @@ quayApp.directive('notificationView', function () {
'notification': '=notification',
'parent': '=parent'
},
controller: function($scope, $element, $location, UserService, NotificationService) {
controller: function($scope, $element, $window, $location, UserService, NotificationService) {
var stringStartsWith = function (str, prefix) {
return str.slice(0, prefix.length) == prefix;
};
$scope.getMessage = function(notification) {
return NotificationService.getMessage(notification);
};
@ -4352,14 +4362,18 @@ quayApp.directive('notificationView', function () {
$scope.showNotification = function() {
var url = NotificationService.getPage($scope.notification);
if (url) {
var parts = url.split('?')
$location.path(parts[0]);
if (parts.length > 1) {
$location.search(parts[1]);
}
if (stringStartsWith(url, 'http://') || stringStartsWith(url, 'https://')) {
$window.location.href = url;
} else {
var parts = url.split('?')
$location.path(parts[0]);
if (parts.length > 1) {
$location.search(parts[1]);
}
$scope.parent.$hide();
$scope.parent.$hide();
}
}
};