1
0
mirror of https://github.com/sbender9/signalk-raymarine-autopilot.git synced 2020-11-18 19:37:28 -08:00

fix: improved cleaning of notifications (#8)

This commit is contained in:
Christian MOTELET 2019-08-17 16:03:59 +02:00 committed by Scott Bender
parent a3d311161d
commit fcbd729cdf

View File

@ -391,6 +391,9 @@ var setNotificationMessage = function(value) {
value.path = value.path.replace('notifications.', '');
if (typeof value.value !== 'undefined') {
if (value.value.state === 'normal') {
if (bottomBarIconDiv.innerHTML === notificationsArray[value.path]) {
bottomBarIconDiv.innerHTML = '';
}
delete notificationsArray[value.path]
} else {
notificationsArray[value.path] = value.value.message.replace('Pilot', '');
@ -403,9 +406,14 @@ var setNotificationMessage = function(value) {
if (alarmsCount > 0) {
notificationCounterTextDiv.innerHTML = alarmsCount;
notificationCounterDiv.style.visibility = 'visible';
if (bottomBarIconDiv.innerHTML === '') {
bottomBarIconDiv.innerHTML = Object.keys(notificationsArray)[0];
}
} else {
notificationCounterTextDiv.innerHTML = '';
notificationCounterDiv.style.visibility = 'hidden';
bottomBarIconDiv.style.visibility = 'hidden';
bottomBarIconDiv.innerHTML = '';
}
}