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

View File

@ -159,7 +159,11 @@
};
$scope.getLanguage = function(lang) {
$scope.lang = lang;
$scope.form = 'white';
if ($scope.form.date) {
$scope.form.date = new Date();
} else {
$scope.form = 'white';
}
$scope.init();
return $scope.showM = false;
};
@ -190,31 +194,33 @@
} else {
over = 0;
}
return $http.get(scriptname + "notifications/" + $scope.type + "?" + query).then(function(response) {
var data, i, len, n, ref;
data = response.data;
if (data.result) {
ref = data.values;
for (i = 0, len = ref.length; i < len; i++) {
n = ref[i];
autoId++;
n.id = "node" + autoId;
if (level < scheme.length - 1) {
n.nodes = [];
n.level = level + 1;
n.query = query;
n.over = over;
if ($scope.type === 'done' || $scope.type === 'actives') {
return $http.get(scriptname + "notifications/" + $scope.type + "?" + query).then(function(response) {
var data, i, len, n, ref;
data = response.data;
if (data.result) {
ref = data.values;
for (i = 0, len = ref.length; i < len; i++) {
n = ref[i];
autoId++;
n.id = "node" + autoId;
if (level < scheme.length - 1) {
n.nodes = [];
n.level = level + 1;
n.query = query;
n.over = over;
}
node.push(n);
}
if (value === '') {
$scope.total = data.total;
}
node.push(n);
}
if (value === '') {
$scope.total = data.total;
}
}
return $scope.waiting = false;
}, function(resp) {
return $scope.waiting = false;
});
return $scope.waiting = false;
}, function(resp) {
return $scope.waiting = false;
});
}
};
$scope.displayNotification = function(scope) {
var node, notificationId;
@ -226,12 +232,17 @@
notificationId = node.uid + "_" + node.reference;
}
$http.get(scriptname + "notifications/" + $scope.type + "/" + notificationId).then(function(response) {
var notif;
$scope.currentNotification = {
uid: node.uid,
reference: node.reference,
condition: node.condition
};
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;
} else {
$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":"الاتصالات المستمرة",
"successfullySaved":"تم الحفظ بنجاح",
"storePassword":"تخزين كلمة مرور المستخدم في بيانات الجلسة",
"subtitle":"Subtitle",
"successLoginNumber":"عدد تسجيلات الدخول المسجلة",
"sympaHandler":"لطيف",
"sympaMailKey":"مفتاح جلسة البريد",
"sympaSecret":"سر مشترك",
"syntaxError":"خطأ في التركيبة",
"syslog":"سيسلوغ facility",
"text":"Text",
"timeout":"مهلة الجلسات",
"timeoutActivity":"مهلة نشاط الجلسات",
"timeoutActivityInterval":"فترة تحديث الجلسات",
"title":"Title",
"tokenUseGlobalStorage":"استخدام سعة التخزين العامة",
"totp2f":"TOTP",
"totp2fActivation":"تفعيل",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -40,7 +40,7 @@
<!-- 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}">
<!-- 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">
<ul class="nav navbar-nav">
<li ng-repeat="button in menu[type]" ng-include="'menubutton.html'"></li>
@ -62,20 +62,36 @@
</div>
<table class="table">
<tr>
<th><span trspan="uid" /></th>
<th>{{translate('uid')}}</th>
<td>{{currentNotification.uid}}</td>
</tr>
<tr>
<th><span trspan="reference" /></th>
<th>{{translate('reference')}}</th>
<td>{{currentNotification.reference}}</td>
</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">
<th><span trspan="internalReference" /></th>
<th>{{translate('internalReference')}}</th>
<td>{{currentNotification.done}}</td>
</tr>
<tr ng-if="currentNotification.notifications">
<th>Notifications</th>
<td><pre ng-repeat="n in currentNotification.notifications">{{n}}</pre></td>
<th>{{translate('notification')}}</th>
<td><textarea ng-repeat="n in currentNotification.notifications" rows=5 class="form-control">{{n}}</textarea></td>
</tr>
</table>
</div>
@ -87,11 +103,11 @@
<form>
<table class="table">
<tr>
<th><span trspan="uid" /></th>
<th>{{translate('uid')}}</th>
<td><input type="text" class="form-control" ng-model="form.uid" /></td>
</tr>
<tr>
<th><span trspan="date" /></th>
<th>{{translate('date')}}</th>
<td>
<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"/>
@ -102,15 +118,15 @@
</td>
</tr>
<tr>
<th><span trspan="reference" /></th>
<th>{{translate('reference')}}</th>
<td><input type="text" class="form-control" ng-model="form.reference" /></td>
</tr>
<tr>
<th><span trspan="condition" /></th>
<th>{{translate('condition')}}</th>
<td><input type="text" class="form-control" ng-model="form.condition"/></td>
</tr>
<tr>
<th><span trspan="content" /></th>
<th>{{translate('content')}}</th>
<td>
<textarea rows=5 class="form-control" ng-model="form.xml"></textarea>
<div class="alert alert-info">