Improve notifications SPA (#2073)

This commit is contained in:
Christophe Maudoux 2020-01-22 22:43:40 +01:00
parent 3b84d0a003
commit 531dbde604
13 changed files with 114 additions and 55 deletions

View File

@ -142,7 +142,10 @@ llapp.controller 'NotificationsExplorerCtrl', [ '$scope', '$translator', '$locat
$scope.getLanguage = (lang) -> $scope.getLanguage = (lang) ->
$scope.lang = lang $scope.lang = lang
$scope.form = 'white' if $scope.form.date
$scope.form.date = new Date()
else
$scope.form = 'white'
$scope.init() $scope.init()
$scope.showM = false $scope.showM = false
@ -172,22 +175,23 @@ llapp.controller 'NotificationsExplorerCtrl', [ '$scope', '$translator', '$locat
over = 0 over = 0
# Launch HTTP query # Launch HTTP query
$http.get("#{scriptname}notifications/#{$scope.type}?#{query}").then (response) -> if $scope.type == 'done' || $scope.type == 'actives'
data = response.data $http.get("#{scriptname}notifications/#{$scope.type}?#{query}").then (response) ->
if data.result data = response.data
for n in data.values if data.result
autoId++ for n in data.values
n.id = "node#{autoId}" autoId++
if level < scheme.length - 1 n.id = "node#{autoId}"
n.nodes = [] if level < scheme.length - 1
n.level = level + 1 n.nodes = []
n.query = query n.level = level + 1
n.over = over n.query = query
node.push n n.over = over
$scope.total = data.total if value == '' node.push n
$scope.waiting = false $scope.total = data.total if value == ''
, (resp) -> $scope.waiting = false
$scope.waiting = false , (resp) ->
$scope.waiting = false
$scope.displayNotification = (scope) -> $scope.displayNotification = (scope) ->
$scope.waiting = true $scope.waiting = true
@ -202,6 +206,10 @@ llapp.controller 'NotificationsExplorerCtrl', [ '$scope', '$translator', '$locat
reference: node.reference reference: node.reference
condition: node.condition condition: node.condition
if $scope.type == 'actives' if $scope.type == 'actives'
notif = JSON.parse response.data.notifications
$scope.currentNotification.text = notif.text
$scope.currentNotification.title = notif.title
$scope.currentNotification.subtitle = notif.subtitle
$scope.currentNotification.notifications = response.data.notifications $scope.currentNotification.notifications = response.data.notifications
else else
$scope.currentNotification.done = response.data.done $scope.currentNotification.done = response.data.done

View File

@ -159,7 +159,11 @@
}; };
$scope.getLanguage = function(lang) { $scope.getLanguage = function(lang) {
$scope.lang = lang; $scope.lang = lang;
$scope.form = 'white'; if ($scope.form.date) {
$scope.form.date = new Date();
} else {
$scope.form = 'white';
}
$scope.init(); $scope.init();
return $scope.showM = false; return $scope.showM = false;
}; };
@ -190,31 +194,33 @@
} else { } else {
over = 0; over = 0;
} }
return $http.get(scriptname + "notifications/" + $scope.type + "?" + query).then(function(response) { if ($scope.type === 'done' || $scope.type === 'actives') {
var data, i, len, n, ref; return $http.get(scriptname + "notifications/" + $scope.type + "?" + query).then(function(response) {
data = response.data; var data, i, len, n, ref;
if (data.result) { data = response.data;
ref = data.values; if (data.result) {
for (i = 0, len = ref.length; i < len; i++) { ref = data.values;
n = ref[i]; for (i = 0, len = ref.length; i < len; i++) {
autoId++; n = ref[i];
n.id = "node" + autoId; autoId++;
if (level < scheme.length - 1) { n.id = "node" + autoId;
n.nodes = []; if (level < scheme.length - 1) {
n.level = level + 1; n.nodes = [];
n.query = query; n.level = level + 1;
n.over = over; n.query = query;
n.over = over;
}
node.push(n);
}
if (value === '') {
$scope.total = data.total;
} }
node.push(n);
} }
if (value === '') { return $scope.waiting = false;
$scope.total = data.total; }, function(resp) {
} return $scope.waiting = false;
} });
return $scope.waiting = false; }
}, function(resp) {
return $scope.waiting = false;
});
}; };
$scope.displayNotification = function(scope) { $scope.displayNotification = function(scope) {
var node, notificationId; var node, notificationId;
@ -226,12 +232,17 @@
notificationId = node.uid + "_" + node.reference; notificationId = node.uid + "_" + node.reference;
} }
$http.get(scriptname + "notifications/" + $scope.type + "/" + notificationId).then(function(response) { $http.get(scriptname + "notifications/" + $scope.type + "/" + notificationId).then(function(response) {
var notif;
$scope.currentNotification = { $scope.currentNotification = {
uid: node.uid, uid: node.uid,
reference: node.reference, reference: node.reference,
condition: node.condition condition: node.condition
}; };
if ($scope.type === 'actives') { if ($scope.type === 'actives') {
notif = JSON.parse(response.data.notifications);
$scope.currentNotification.text = notif.text;
$scope.currentNotification.title = notif.title;
$scope.currentNotification.subtitle = notif.subtitle;
$scope.currentNotification.notifications = response.data.notifications; $scope.currentNotification.notifications = response.data.notifications;
} else { } else {
$scope.currentNotification.done = response.data.done; $scope.currentNotification.done = response.data.done;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -860,15 +860,18 @@
"stayConnected":"الاتصالات المستمرة", "stayConnected":"الاتصالات المستمرة",
"successfullySaved":"تم الحفظ بنجاح", "successfullySaved":"تم الحفظ بنجاح",
"storePassword":"تخزين كلمة مرور المستخدم في بيانات الجلسة", "storePassword":"تخزين كلمة مرور المستخدم في بيانات الجلسة",
"subtitle":"Subtitle",
"successLoginNumber":"عدد تسجيلات الدخول المسجلة", "successLoginNumber":"عدد تسجيلات الدخول المسجلة",
"sympaHandler":"لطيف", "sympaHandler":"لطيف",
"sympaMailKey":"مفتاح جلسة البريد", "sympaMailKey":"مفتاح جلسة البريد",
"sympaSecret":"سر مشترك", "sympaSecret":"سر مشترك",
"syntaxError":"خطأ في التركيبة", "syntaxError":"خطأ في التركيبة",
"syslog":"سيسلوغ facility", "syslog":"سيسلوغ facility",
"text":"Text",
"timeout":"مهلة الجلسات", "timeout":"مهلة الجلسات",
"timeoutActivity":"مهلة نشاط الجلسات", "timeoutActivity":"مهلة نشاط الجلسات",
"timeoutActivityInterval":"فترة تحديث الجلسات", "timeoutActivityInterval":"فترة تحديث الجلسات",
"title":"Title",
"tokenUseGlobalStorage":"استخدام سعة التخزين العامة", "tokenUseGlobalStorage":"استخدام سعة التخزين العامة",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"تفعيل", "totp2fActivation":"تفعيل",

View File

@ -860,15 +860,18 @@
"stayConnected":"Persistent connections", "stayConnected":"Persistent connections",
"successfullySaved":"Successfully saved", "successfullySaved":"Successfully saved",
"storePassword":"Store user password in session", "storePassword":"Store user password in session",
"subtitle":"Subtitle",
"successLoginNumber":"Number of registered logins", "successLoginNumber":"Number of registered logins",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"Mail session key", "sympaMailKey":"Mail session key",
"sympaSecret":"Shared secret", "sympaSecret":"Shared secret",
"syntaxError":"Syntax Error", "syntaxError":"Syntax Error",
"syslog":"Syslog facility", "syslog":"Syslog facility",
"text":"Text",
"timeout":"Sessions timeout", "timeout":"Sessions timeout",
"timeoutActivity":"Sessions activity timeout", "timeoutActivity":"Sessions activity timeout",
"timeoutActivityInterval":"Sessions update interval", "timeoutActivityInterval":"Sessions update interval",
"title":"Title",
"tokenUseGlobalStorage":"Use global storage", "tokenUseGlobalStorage":"Use global storage",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"Activation", "totp2fActivation":"Activation",

View File

@ -860,15 +860,18 @@
"stayConnected":"Persistent connections", "stayConnected":"Persistent connections",
"successfullySaved":"Successfully saved", "successfullySaved":"Successfully saved",
"storePassword":"Store user password in session", "storePassword":"Store user password in session",
"subtitle":"Subtitle",
"successLoginNumber":"Number of registered logins", "successLoginNumber":"Number of registered logins",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"Mail session key", "sympaMailKey":"Mail session key",
"sympaSecret":"Shared secret", "sympaSecret":"Shared secret",
"syntaxError":"Syntax Error", "syntaxError":"Syntax Error",
"syslog":"Syslog facility", "syslog":"Syslog facility",
"text":"Text",
"timeout":"Sessions timeout", "timeout":"Sessions timeout",
"timeoutActivity":"Sessions activity timeout", "timeoutActivity":"Sessions activity timeout",
"timeoutActivityInterval":"Sessions update interval", "timeoutActivityInterval":"Sessions update interval",
"title":"Title",
"tokenUseGlobalStorage":"Use global storage", "tokenUseGlobalStorage":"Use global storage",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"Activation", "totp2fActivation":"Activation",

View File

@ -860,15 +860,18 @@
"stayConnected":"Connexions persistantes", "stayConnected":"Connexions persistantes",
"successfullySaved":"Sauvegarde effectuée", "successfullySaved":"Sauvegarde effectuée",
"storePassword":"Stocke le mot de passe de l'utilisateur en session", "storePassword":"Stocke le mot de passe de l'utilisateur en session",
"subtitle":"Sous-titre",
"successLoginNumber":"Nombre de connexions mémorisées", "successLoginNumber":"Nombre de connexions mémorisées",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"Clef de session pour le mail", "sympaMailKey":"Clef de session pour le mail",
"sympaSecret":"Secret partagé", "sympaSecret":"Secret partagé",
"syntaxError":"Erreur de syntaxe", "syntaxError":"Erreur de syntaxe",
"syslog":"Facilité syslog", "syslog":"Facilité syslog",
"text":"Texte",
"timeout":"Durée de vie maximale des sessions", "timeout":"Durée de vie maximale des sessions",
"timeoutActivity":"Délai d'expiration des sessions", "timeoutActivity":"Délai d'expiration des sessions",
"timeoutActivityInterval":"Intervalle de mise à jour des sessions", "timeoutActivityInterval":"Intervalle de mise à jour des sessions",
"title":"Titre",
"tokenUseGlobalStorage":"Utiliser le cache global", "tokenUseGlobalStorage":"Utiliser le cache global",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"Activation", "totp2fActivation":"Activation",

View File

@ -860,15 +860,18 @@
"stayConnected":"Connessioni persistenti", "stayConnected":"Connessioni persistenti",
"successfullySaved":"Salvato con successo", "successfullySaved":"Salvato con successo",
"storePassword":"Memorizzare la password dell'utente nei dati di sessione", "storePassword":"Memorizzare la password dell'utente nei dati di sessione",
"subtitle":"Subtitle",
"successLoginNumber":"Numero di login registrati", "successLoginNumber":"Numero di login registrati",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"Chiave della sessione di posta", "sympaMailKey":"Chiave della sessione di posta",
"sympaSecret":"Segreto condiviso", "sympaSecret":"Segreto condiviso",
"syntaxError":"Errore di sintassi", "syntaxError":"Errore di sintassi",
"syslog":"Impianto Syslog", "syslog":"Impianto Syslog",
"text":"Text",
"timeout":"Timeout sessioni", "timeout":"Timeout sessioni",
"timeoutActivity":"Timeout attività di sessioni", "timeoutActivity":"Timeout attività di sessioni",
"timeoutActivityInterval":"Intervallo di aggiornamento delle sessioni", "timeoutActivityInterval":"Intervallo di aggiornamento delle sessioni",
"title":"Title",
"tokenUseGlobalStorage":"Utilizza lo storage globale", "tokenUseGlobalStorage":"Utilizza lo storage globale",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"Attivazione", "totp2fActivation":"Attivazione",

View File

@ -860,15 +860,18 @@
"stayConnected":"Kalıcı bağlantılar", "stayConnected":"Kalıcı bağlantılar",
"successfullySaved":"Başarıyla kaydedildi", "successfullySaved":"Başarıyla kaydedildi",
"storePassword":"Kullanıcı parolasını oturumda sakla", "storePassword":"Kullanıcı parolasını oturumda sakla",
"subtitle":"Subtitle",
"successLoginNumber":"Kayıtlı girişlerin sayısı", "successLoginNumber":"Kayıtlı girişlerin sayısı",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"E-posta oturum anahtarı", "sympaMailKey":"E-posta oturum anahtarı",
"sympaSecret":"Paylaşılan sır", "sympaSecret":"Paylaşılan sır",
"syntaxError":"Söz Dizimi Hatası", "syntaxError":"Söz Dizimi Hatası",
"syslog":"Sistem günlüğü imkanı", "syslog":"Sistem günlüğü imkanı",
"text":"Text",
"timeout":"Oturum zaman aşımı", "timeout":"Oturum zaman aşımı",
"timeoutActivity":"Oturum aktivitesi zaman aşımı", "timeoutActivity":"Oturum aktivitesi zaman aşımı",
"timeoutActivityInterval":"Oturum güncellenme sıklığı", "timeoutActivityInterval":"Oturum güncellenme sıklığı",
"title":"Title",
"tokenUseGlobalStorage":"Global depolamayı kullan", "tokenUseGlobalStorage":"Global depolamayı kullan",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"Aktivasyon", "totp2fActivation":"Aktivasyon",

View File

@ -860,15 +860,18 @@
"stayConnected":"Duy trì kết nối", "stayConnected":"Duy trì kết nối",
"successfullySaved":"Lưu thành công", "successfullySaved":"Lưu thành công",
"storePassword":"Lưu trữ mật khẩu người dùng trong các dữ liệu phiên", "storePassword":"Lưu trữ mật khẩu người dùng trong các dữ liệu phiên",
"subtitle":"Subtitle",
"successLoginNumber":"Số lượng đăng nhập đã đăng ký", "successLoginNumber":"Số lượng đăng nhập đã đăng ký",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"Khóa phiên qua thư", "sympaMailKey":"Khóa phiên qua thư",
"sympaSecret":"Chia sẻ bí mật", "sympaSecret":"Chia sẻ bí mật",
"syntaxError":"Lỗi Cú pháp", "syntaxError":"Lỗi Cú pháp",
"syslog":"Tiện ích Syslog", "syslog":"Tiện ích Syslog",
"text":"Text",
"timeout":"Thời gian chờ của phiên", "timeout":"Thời gian chờ của phiên",
"timeoutActivity":"Thời gian chờ của các hoạt động phiên", "timeoutActivity":"Thời gian chờ của các hoạt động phiên",
"timeoutActivityInterval":"Khoảng thời gian cập nhật phiên", "timeoutActivityInterval":"Khoảng thời gian cập nhật phiên",
"title":"Title",
"tokenUseGlobalStorage":"Sử dụng lưu trữ toàn cục", "tokenUseGlobalStorage":"Sử dụng lưu trữ toàn cục",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"Kích hoạt", "totp2fActivation":"Kích hoạt",

View File

@ -860,15 +860,18 @@
"stayConnected":"Persistent connections", "stayConnected":"Persistent connections",
"successfullySaved":"Successfully saved", "successfullySaved":"Successfully saved",
"storePassword":"Store user password in session", "storePassword":"Store user password in session",
"subtitle":"Subtitle",
"successLoginNumber":"Number of registered logins", "successLoginNumber":"Number of registered logins",
"sympaHandler":"Sympa", "sympaHandler":"Sympa",
"sympaMailKey":"Mail session key", "sympaMailKey":"Mail session key",
"sympaSecret":"Shared secret", "sympaSecret":"Shared secret",
"syntaxError":"Syntax Error", "syntaxError":"Syntax Error",
"syslog":"Syslog facility", "syslog":"Syslog facility",
"text":"Text",
"timeout":"Sessions timeout", "timeout":"Sessions timeout",
"timeoutActivity":"Sessions activity timeout", "timeoutActivity":"Sessions activity timeout",
"timeoutActivityInterval":"Sessions update interval", "timeoutActivityInterval":"Sessions update interval",
"title":"Title",
"tokenUseGlobalStorage":"Use global storage", "tokenUseGlobalStorage":"Use global storage",
"totp2f":"TOTP", "totp2f":"TOTP",
"totp2fActivation":"激活", "totp2fActivation":"激活",

View File

@ -40,7 +40,7 @@
<!-- Right(main) div --> <!-- Right(main) div -->
<div id="right" class="col-lg-8 col-md-8 col-sm-7 col-xs-12 scrollable" ng-class="{'hidden-xs':showT&&!showM}"> <div id="right" class="col-lg-8 col-md-8 col-sm-7 col-xs-12 scrollable" ng-class="{'hidden-xs':showT&&!showM}">
<!-- Menu buttons --> <!-- Menu buttons -->
<div ng-if="type=='new'||currentNotification" class="lmmenu navbar navbar-default" ng-class="{'hidden-xs':!showM}"> <div ng-if="type=='new'|| currentNotification" class="lmmenu navbar navbar-default" ng-class="{'hidden-xs':!showM}">
<div class="navbar-collapse" ng-class="{'collapse':!showM}" id="formmenu"> <div class="navbar-collapse" ng-class="{'collapse':!showM}" id="formmenu">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li ng-repeat="button in menu[type]" ng-include="'menubutton.html'"></li> <li ng-repeat="button in menu[type]" ng-include="'menubutton.html'"></li>
@ -62,20 +62,36 @@
</div> </div>
<table class="table"> <table class="table">
<tr> <tr>
<th><span trspan="uid" /></th> <th>{{translate('uid')}}</th>
<td>{{currentNotification.uid}}</td> <td>{{currentNotification.uid}}</td>
</tr> </tr>
<tr> <tr>
<th><span trspan="reference" /></th> <th>{{translate('reference')}}</th>
<td>{{currentNotification.reference}}</td> <td>{{currentNotification.reference}}</td>
</tr> </tr>
<tr ng-if="currentNotification.condition">
<th>{{translate('condition')}}</th>
<td>{{currentNotification.condition}}</td>
</tr>
<tr ng-if="currentNotification.title">
<th>{{translate('title')}}</th>
<td>{{currentNotification.title}}</td>
</tr>
<tr ng-if="currentNotification.subtitle">
<th>{{translate('subtitle')}}</th>
<td>{{currentNotification.subtitle}}</td>
</tr>
<tr ng-if="currentNotification.text">
<th>{{translate('text')}}</th>
<td><textarea rows=5 class="form-control">{{currentNotification.text}}</textarea></td>
</tr>
<tr ng-if="currentNotification.done"> <tr ng-if="currentNotification.done">
<th><span trspan="internalReference" /></th> <th>{{translate('internalReference')}}</th>
<td>{{currentNotification.done}}</td> <td>{{currentNotification.done}}</td>
</tr> </tr>
<tr ng-if="currentNotification.notifications"> <tr ng-if="currentNotification.notifications">
<th>Notifications</th> <th>{{translate('notification')}}</th>
<td><pre ng-repeat="n in currentNotification.notifications">{{n}}</pre></td> <td><textarea ng-repeat="n in currentNotification.notifications" rows=5 class="form-control">{{n}}</textarea></td>
</tr> </tr>
</table> </table>
</div> </div>
@ -87,11 +103,11 @@
<form> <form>
<table class="table"> <table class="table">
<tr> <tr>
<th><span trspan="uid" /></th> <th>{{translate('uid')}}</th>
<td><input type="text" class="form-control" ng-model="form.uid" /></td> <td><input type="text" class="form-control" ng-model="form.uid" /></td>
</tr> </tr>
<tr> <tr>
<th><span trspan="date" /></th> <th>{{translate('date')}}</th>
<td> <td>
<p class="input-group"> <p class="input-group">
<input type="text" class="form-control" uib-datepicker-popup="yyyy-MM-dd" ng-model="form.date" min-date="minDate" is-open="popup.opened" datepicker-options="dateOptions" popup-placement="auto top-right"/> <input type="text" class="form-control" uib-datepicker-popup="yyyy-MM-dd" ng-model="form.date" min-date="minDate" is-open="popup.opened" datepicker-options="dateOptions" popup-placement="auto top-right"/>
@ -102,15 +118,15 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<th><span trspan="reference" /></th> <th>{{translate('reference')}}</th>
<td><input type="text" class="form-control" ng-model="form.reference" /></td> <td><input type="text" class="form-control" ng-model="form.reference" /></td>
</tr> </tr>
<tr> <tr>
<th><span trspan="condition" /></th> <th>{{translate('condition')}}</th>
<td><input type="text" class="form-control" ng-model="form.condition"/></td> <td><input type="text" class="form-control" ng-model="form.condition"/></td>
</tr> </tr>
<tr> <tr>
<th><span trspan="content" /></th> <th>{{translate('content')}}</th>
<td> <td>
<textarea rows=5 class="form-control" ng-model="form.xml"></textarea> <textarea rows=5 class="form-control" ng-model="form.xml"></textarea>
<div class="alert alert-info"> <div class="alert alert-info">