Skip to content
Permalink
Browse files

webui: re-implement notification if free nvram < 3000 bytes

This feature was lost at some point when the notification code
was moved out of state.js and into notification.js.
  • Loading branch information...
RMerl committed Aug 13, 2019
1 parent c5f5f07 commit 5ab95cc2eb64d573871ee8c462d4d5bca61a1d6b
Showing with 15 additions and 4 deletions.
  1. +15 −4 release/src/router/www/notification.js
@@ -104,6 +104,7 @@ var notification = {
notif_hint: 0,
mobile_traffic: 0,
send_debug_log: 0,
low_nvram: 0,
clicking: 0,
sim_record: 0,
redirectftp:function(){location.href = 'Advanced_AiDisk_ftp.asp';},
@@ -120,7 +121,7 @@ var notification = {
ie_legacy: 0,
notiClick: function(){
// stop flashing after the event is checked.
cookie.set("notification_history", [notification.upgrade, notification.wifi_2g ,notification.wifi_5g ,notification.ftp ,notification.samba ,notification.loss_sync ,notification.experience_FB ,notification.notif_hint, notification.mobile_traffic, notification.send_debug_log, notification.sim_record, notification.pppoe_tw, notification.pppoe_tw_static, notification.ie_legacy].join(), 1000);
cookie.set("notification_history", [notification.upgrade, notification.wifi_2g ,notification.wifi_5g ,notification.ftp ,notification.samba ,notification.loss_sync ,notification.experience_FB ,notification.notif_hint, notification.mobile_traffic, notification.send_debug_log, notification.sim_record, notification.pppoe_tw, notification.pppoe_tw_static, notification.ie_legacy, notification.low_nvram].join(), 1000);
clearInterval(notification.flashTimer);
document.getElementById("notification_status").className = "notification_on";
if(notification.clicking == 0){
@@ -207,7 +208,7 @@ var notification = {
}
else if(notification.stat == "on" && !notification.mobile_traffic && !notification.sim_record && !notification.upgrade && !notification.wifi_2g &&
!notification.wifi_5g && !notification.ftp && !notification.samba && !notification.loss_sync && !notification.experience_FB && !notification.notif_hint && !notification.mobile_traffic &&
!notification.send_debug_log && !notification.pppoe_tw && !notification.pppoe_tw_static && !notification.ie_legacy){
!notification.send_debug_log && !notification.pppoe_tw && !notification.pppoe_tw_static && !notification.ie_legacy && !notification.low_nvram){
cookie.unset("notification_history");
clearInterval(notification.flashTimer);
document.getElementById("notification_status").className = "notification_off";
@@ -386,8 +387,17 @@ var notification = {
notification.action_desc[15] = '<#CHT_ppp_notice_2#>';
notification.clickCallBack[15] = "location.href = 'Advanced_WAN_Content.asp?af=wan_proto'";
}
// Low NVRAM
if((<% sysinfo("nvram.total"); %> - <% sysinfo("nvram.used"); %>) < 3000){
notification.array[17] = 'noti_low_nvram';
notification.low_nvram = 1;
notification.desc[17] = "Your router is running low on free NVRAM, which might affect its stability.<br>Review long parameter lists (like DHCP reservations), or consider doing a factory default reset and reconfiguring.";
notification.action_desc[17] = "Review System Information now";
notification.clickCallBack[17] = "location.href = 'Tools_Sysinfo.asp';"
}else
notification.low_nvram = 0;

if( notification.acpw || notification.upgrade || notification.wifi_2g || notification.wifi_5g || notification.ftp || notification.samba || notification.loss_sync || notification.experience_FB || notification.notif_hint || notification.send_debug_log || notification.mobile_traffic || notification.sim_record || notification.pppoe_tw || notification.pppoe_tw_static || notification.ie_legacy){
if( notification.acpw || notification.upgrade || notification.wifi_2g || notification.wifi_5g || notification.ftp || notification.samba || notification.loss_sync || notification.experience_FB || notification.notif_hint || notification.send_debug_log || notification.mobile_traffic || notification.sim_record || notification.pppoe_tw || notification.pppoe_tw_static || notification.ie_legacy || notification.low_nvram){
notification.stat = "on";
notification.flash = "on";
notification.run_notice();
@@ -408,7 +418,7 @@ var notification = {
tarObj1.className = "notification_on1";
}

if(this.flash == "on" && cookie.get("notification_history") != [notification.upgrade, notification.wifi_2g ,notification.wifi_5g ,notification.ftp ,notification.samba ,notification.loss_sync ,notification.experience_FB ,notification.notif_hint, notification.mobile_traffic, notification.send_debug_log, notification.sim_record, notification.pppoe_tw, notification.pppoe_tw_static, notification.ie_legacy].join()){
if(this.flash == "on" && cookie.get("notification_history") != [notification.upgrade, notification.wifi_2g ,notification.wifi_5g ,notification.ftp ,notification.samba ,notification.loss_sync ,notification.experience_FB ,notification.notif_hint, notification.mobile_traffic, notification.send_debug_log, notification.sim_record, notification.pppoe_tw, notification.pppoe_tw_static, notification.ie_legacy, notification.low_nvram].join()){
notification.flashTimer = setInterval(function(){
tarObj.className = (tarObj.className == "notification_on") ? "notification_off" : "notification_on";
}, 1000);
@@ -431,6 +441,7 @@ var notification = {
this.notif_hint = 0;
this.mobile_traffic = 0;
this.send_debug_log = 0;
this.low_nvram = 0;
this.sim_record = 0;
this.action_desc = [];
this.desc = [];

0 comments on commit 5ab95cc

Please sign in to comment.
You can’t perform that action at this time.