aboutsummaryrefslogtreecommitdiff
path: root/web
diff options
context:
space:
mode:
Diffstat (limited to 'web')
-rw-r--r--web/app/Application.js5
-rw-r--r--web/app/controller/Root.js12
-rw-r--r--web/app/view/Notifications.js3
-rw-r--r--web/app/view/ReportConfigController.js6
-rw-r--r--web/app/view/ReportController.js3
-rw-r--r--web/l10n/en.json1
6 files changed, 14 insertions, 16 deletions
diff --git a/web/app/Application.js b/web/app/Application.js
index 6f4cb1d..8619ba9 100644
--- a/web/app/Application.js
+++ b/web/app/Application.js
@@ -81,6 +81,11 @@ Ext.define('Traccar.Application', {
return window.matchMedia && window.matchMedia('(max-width: 768px)').matches;
},
+ getEventString: function (eventType) {
+ var key = 'event' + eventType.charAt(0).toUpperCase() + eventType.slice(1);
+ return Strings[key] || key;
+ },
+
showReports: function (show) {
var rootPanel = Ext.getCmp('rootPanel');
if (rootPanel) {
diff --git a/web/app/controller/Root.js b/web/app/controller/Root.js
index e30446c..5600d4e 100644
--- a/web/app/controller/Root.js
+++ b/web/app/controller/Root.js
@@ -119,7 +119,7 @@ Ext.define('Traccar.controller.Root', {
};
socket.onmessage = function (event) {
- var i, j, store, data, array, entity, device, typeKey, alarmKey, text, geofence;
+ var i, j, store, data, array, entity, device, alarmKey, text, geofence;
data = Ext.decode(event.data);
@@ -184,20 +184,16 @@ Ext.define('Traccar.controller.Root', {
}
}
} else {
- typeKey = 'event' + array[i].type.charAt(0).toUpperCase() + array[i].type.slice(1);
- text = Strings[typeKey];
- if (!text) {
- text = typeKey;
- }
+ text = Traccar.app.getEventString(array[i].type);
}
if (array[i].geofenceId !== 0) {
geofence = Ext.getStore('Geofences').getById(array[i].geofenceId);
- if (typeof geofence !== 'undefined') {
+ if (geofence) {
text += ' \"' + geofence.get('name') + '"';
}
}
device = Ext.getStore('Devices').getById(array[i].deviceId);
- if (typeof device !== 'undefined') {
+ if (device) {
if (self.mutePressed()) {
self.beep();
}
diff --git a/web/app/view/Notifications.js b/web/app/view/Notifications.js
index 900ebe3..250a6b5 100644
--- a/web/app/view/Notifications.js
+++ b/web/app/view/Notifications.js
@@ -44,8 +44,7 @@ Ext.define('Traccar.view.Notifications', {
text: Strings.notificationType,
dataIndex: 'type',
renderer: function (value) {
- var typeKey = 'event' + value.charAt(0).toUpperCase() + value.slice(1);
- return Strings[typeKey];
+ return Traccar.app.getEventString(value);
}
}, {
text: Strings.notificationWeb,
diff --git a/web/app/view/ReportConfigController.js b/web/app/view/ReportConfigController.js
index c121c65..0ae7c0a 100644
--- a/web/app/view/ReportConfigController.js
+++ b/web/app/view/ReportConfigController.js
@@ -35,13 +35,11 @@ Ext.define('Traccar.view.ReportConfigController', {
Ext.create('Traccar.store.AllNotifications').load({
scope: this,
callback: function (records, operation, success) {
- var i, value, name, typeKey;
+ var i, value;
if (success) {
for (i = 0; i < records.length; i++) {
value = records[i].get('type');
- typeKey = 'event' + value.charAt(0).toUpperCase() + value.slice(1);
- name = Strings[typeKey];
- store.add({type: value, name: name});
+ store.add({type: value, name: Traccar.app.getEventString(value)});
}
}
}
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 775394d..46543ba 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -272,8 +272,7 @@ Ext.define('Traccar.view.ReportController', {
text: Strings.sharedType,
dataIndex: 'type',
renderer: function (value) {
- var typeKey = 'event' + value.charAt(0).toUpperCase() + value.slice(1);
- return Strings[typeKey];
+ return Traccar.app.getEventString(value);
}
}, {
text: Strings.sharedGeofence,
diff --git a/web/l10n/en.json b/web/l10n/en.json
index baff8b0..67ce6d4 100644
--- a/web/l10n/en.json
+++ b/web/l10n/en.json
@@ -146,6 +146,7 @@
"commandMessage": "Message",
"eventAll": "All Events",
"eventDeviceOnline": "Device is online",
+ "eventDeviceUnknown": "Device status is unknown",
"eventDeviceOffline": "Device is offline",
"eventDeviceMoving": "Device is moving",
"eventDeviceStopped": "Device has stopped",