Files
stf/res/app/settings/general/alert-message/alert-message-controller.js
Denis Barbaron 489ba0427e Add maintenance banner on UI (#797)
* fix bug on email separator

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>

* allow group name change

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>

* add maintenance banner on UI

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>

* removes unnecessary comments

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>

---------

Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
2024-07-19 10:33:52 +02:00

42 lines
1.1 KiB
JavaScript

/**
* Copyright © 2024 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
**/
module.exports = function AlertMessageCtrl(
$scope
, SettingsService
) {
$scope.defaultAlertMessage = {
data: '*** This site is currently under maintenance, please wait ***'
, activation: 'False'
, level: 'Critical'
}
SettingsService.bind($scope, {
target: 'alertMessage'
, source: 'alertMessage'
, defaultValue: $scope.defaultAlertMessage
})
$scope.alertMessageActivationOptions = ['True', 'False']
$scope.alertMessageLevelOptions = ['Information', 'Warning', 'Critical']
$scope.$watch(
function() {
return SettingsService.get('alertMessage')
}
, function(newvalue) {
if (typeof newvalue === 'undefined') {
SettingsService.set('alertMessage', $scope.defaultAlertMessage)
}
}
)
$scope.$on('user.menu.users.updated', function(event, message) {
if (message.user.privilege === 'admin') {
$scope.alertMessage = message.user.settings.alertMessage
}
})
}