mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 08:33:24 +02:00
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>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* 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
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user