mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-24 09:45:14 +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
|
||||
}
|
||||
})
|
||||
}
|
||||
34
res/app/settings/general/alert-message/alert-message.pug
Normal file
34
res/app/settings/general/alert-message/alert-message.pug
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
Copyright © 2024 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
//
|
||||
|
||||
.widget-container.fluid-height(ng-controller='AlertMessageCtrl')
|
||||
.heading
|
||||
i.fa.fa-exclamation-triangle
|
||||
span(translate) Alert Message
|
||||
.widget-content.padded
|
||||
.form-horizontal
|
||||
.form-group.general-item
|
||||
.input-group
|
||||
.input-group-addon.input-sm
|
||||
i.fa.fa-exclamation-triangle(
|
||||
uib-tooltip="{{'Define your own alert message' | translate}}" tooltip-placement='auto top-right' tooltip-popup-delay='500')
|
||||
input.form-control.input-sm(size='20' type='text' placeholder='' ng-model='alertMessage.data')
|
||||
.form-group.general-item
|
||||
label.general-label(
|
||||
translate
|
||||
uib-tooltip="{{'Alert message activation' | translate}}"
|
||||
tooltip-placement='auto top-right'
|
||||
tooltip-popup-delay='500') Activation
|
||||
select(
|
||||
ng-model='alertMessage.activation'
|
||||
ng-options='option for option in alertMessageActivationOptions')
|
||||
.form-group.general-item
|
||||
label.general-label(
|
||||
translate
|
||||
uib-tooltip="{{'Alert message level' | translate}}"
|
||||
tooltip-placement='auto top-right'
|
||||
tooltip-popup-delay='500') Level
|
||||
select(
|
||||
ng-model='alertMessage.level'
|
||||
ng-options='option for option in alertMessageLevelOptions')
|
||||
14
res/app/settings/general/alert-message/index.js
Normal file
14
res/app/settings/general/alert-message/index.js
Normal file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* Copyright © 2024 code initially contributed by Orange SA, authors: Denis Barbaron - Licensed under the Apache license 2.0
|
||||
**/
|
||||
|
||||
module.exports = angular.module('stf.settings.general.alert-message', [
|
||||
require('stf/settings').name
|
||||
])
|
||||
.run(['$templateCache', function($templateCache) {
|
||||
$templateCache.put(
|
||||
'settings/general/alert-message/alert-message.pug'
|
||||
, require('./alert-message.pug')
|
||||
)
|
||||
}])
|
||||
.controller('AlertMessageCtrl', require('./alert-message-controller'))
|
||||
Reference in New Issue
Block a user