From 729f34a34c4b3f857823293c8a46661f606cb03b Mon Sep 17 00:00:00 2001 From: ninioe Date: Sun, 24 Jul 2016 08:53:00 +0300 Subject: more fixes --- src/org/traccar/Main.java | 2 +- web/app/controller/Root.js | 20 ++++++++++---------- web/app/view/Devices.js | 4 ++-- web/l10n/en.json | 1 + 4 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/org/traccar/Main.java b/src/org/traccar/Main.java index 454124fbf..570becc2d 100644 --- a/src/org/traccar/Main.java +++ b/src/org/traccar/Main.java @@ -23,7 +23,7 @@ import java.util.TimerTask; import java.util.Locale; public final class Main { - static final long CLEAN_DELAY = 10 * 1000; + static final long CLEAN_DELAY = 500; static final long CLEAN_PERIOD = 24 * 60 * 60 * 1000; private Main() { diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js index fd30fe7c9..367b98d88 100644 --- a/web/app/controller/Root.js +++ b/web/app/controller/Root.js @@ -90,14 +90,14 @@ Ext.define('Traccar.controller.Root', { }, beep: function () { - if (this.snd === null) { - this.snd = new Audio('beep.wav'); + if (this.beepSound === null) { + this.beepSound = new Audio('beep.wav'); } - this.snd.play(); + this.beepSound.play(); }, - showAlarmSelected: function () { - return Ext.getCmp('showAlarmButton') && Ext.getCmp('showAlarmButton').pressed; + showNotificationsSelected: function () { + return Ext.getCmp('showNotificationsButton') && Ext.getCmp('showNotificationsButton').pressed; }, asyncUpdate: function (first) { @@ -159,7 +159,7 @@ Ext.define('Traccar.controller.Root', { } else if (array[i].type === 'alarm' && data.positions) { alarmKey = 'alarm'; text = Strings[alarmKey]; - if (typeof text === 'undefined') { + if (!text) { text = alarmKey; } for (j = 0; j < data.positions.length; j++) { @@ -167,7 +167,7 @@ Ext.define('Traccar.controller.Root', { if (typeof data.positions[j].attributes.alarm === 'string' && data.positions[j].attributes.alarm.length >= 2) { alarmKey = 'alarm' + data.positions[j].attributes.alarm.charAt(0).toUpperCase() + data.positions[j].attributes.alarm.slice(1); text = Strings[alarmKey]; - if (typeof text === 'undefined') { + if (!text) { text = alarmKey; } } @@ -177,7 +177,7 @@ Ext.define('Traccar.controller.Root', { } else { typeKey = 'event' + array[i].type.charAt(0).toUpperCase() + array[i].type.slice(1); text = Strings[typeKey]; - if (typeof text === 'undefined') { + if (!text) { text = typeKey; } } @@ -189,9 +189,9 @@ Ext.define('Traccar.controller.Root', { } device = Ext.getStore('Devices').getById(array[i].deviceId); if (typeof device !== 'undefined') { - if (self.showAlarmSelected()) { + if (self.showNotificationsSelected()) { self.beep(); - Ext.toast(text, device.getData().name); + Ext.toast(text, device.get('name')); } } } diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 31d22ed2a..212aa7f96 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -58,9 +58,9 @@ Ext.define('Traccar.view.Devices', { }, { xtype: 'tbfill' },{ - id: 'showAlarmButton', + id: 'showNotificationsButton', glyph: 'xf0a2@FontAwesome', - tooltip: 'Show Alarms', + tooltip: Strings.showNotifications, tooltipType: 'title', pressed : true, enableToggle: true, diff --git a/web/l10n/en.json b/web/l10n/en.json index c5d67e8c1..d8dd016b5 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -19,6 +19,7 @@ "sharedSearch": "Search", "sharedGeofence": "Geofence", "sharedGeofences": "Geofences", + "showNotifications": "Show Notifications", "sharedNotifications": "Notifications", "sharedAttributes": "Attributes", "sharedAttribute": "Attribute", -- cgit v1.2.3