PHRAS-3442_optimize-list-notifications_4.1-bis

WIP
poll only from menubar (Aina)
back : only one method/route to fetch notifs
front : fix exponential pagination
big refacto
todo : mark read notifications (button ? click ?)
This commit is contained in:
jygaulier
2021-06-15 17:46:14 +02:00
parent eec8a92ce9
commit 22c3b273f7
24 changed files with 710 additions and 628 deletions

View File

@@ -201,34 +201,35 @@ function reportDatePicker() {
});
}
// poll only from menu bar
function pollNotifications() {
$.ajax({
type: "POST",
url: "/session/notifications/",
dataType: 'json',
data: {
module: 10,
usr: usrId
},
error: function () {
window.setTimeout("pollNotifications();", 10000);
},
timeout: function () {
window.setTimeout("pollNotifications();", 10000);
},
success: function (data) {
if (data) {
commonModule.manageSession(data);
}
var t = 120000;
if (data.apps && parseInt(data.apps) > 1) {
t = Math.round((Math.sqrt(parseInt(data.apps) - 1) * 1.3 * 120000));
}
window.setTimeout("pollNotifications();", t);
return;
}
});
};
window.setTimeout("pollNotifications();", 10000);
// function pollNotifications() {
// $.ajax({
// type: "POST",
// url: "/session/notifications/",
// dataType: 'json',
// data: {
// module: 10,
// usr: usrId
// },
// error: function () {
// window.setTimeout("pollNotifications();", 10000);
// },
// timeout: function () {
// window.setTimeout("pollNotifications();", 10000);
// },
// success: function (data) {
// if (data) {
// commonModule.manageSession(data);
// }
// var t = 120000;
// if (data.apps && parseInt(data.apps) > 1) {
// t = Math.round((Math.sqrt(parseInt(data.apps) - 1) * 1.3 * 120000));
// }
// window.setTimeout("pollNotifications();", t);
// return;
// }
// });
// };
//
// window.setTimeout("pollNotifications();", 10000);