aboutsummaryrefslogtreecommitdiff
path: root/web/app/model
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2017-07-09 10:30:59 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2017-07-09 10:30:59 +1200
commit2b15689bd7353f7bb388950408ddaabaeb0c0b53 (patch)
tree43438d6d311e4638814202a28fd3d0861cbd5b93 /web/app/model
parentbb65b3805a3093a8e08ccec7d0fb0436cddde442 (diff)
downloadetbsa-traccar-web-2b15689bd7353f7bb388950408ddaabaeb0c0b53.tar.gz
etbsa-traccar-web-2b15689bd7353f7bb388950408ddaabaeb0c0b53.tar.bz2
etbsa-traccar-web-2b15689bd7353f7bb388950408ddaabaeb0c0b53.zip
Fix minification problem
Diffstat (limited to 'web/app/model')
-rw-r--r--web/app/model/Event.js24
1 files changed, 13 insertions, 11 deletions
diff --git a/web/app/model/Event.js b/web/app/model/Event.js
index d225402..70fab17 100644
--- a/web/app/model/Event.js
+++ b/web/app/model/Event.js
@@ -41,26 +41,28 @@ Ext.define('Traccar.model.Event', {
type: 'int'
}, {
name: 'text',
- calculate: function (data) {
+ convert: function (v, rec) {
var text, alarmKey, geofence;
- if (data.type === 'commandResult') {
- text = Strings.eventCommandResult + ': ' + data.attributes.result;
- } else if (data.type === 'alarm') {
- alarmKey = 'alarm' + data.attributes.alarm.charAt(0).toUpperCase() + data.attributes.alarm.slice(1);
+ if (rec.get('type') === 'commandResult') {
+ text = Strings.eventCommandResult + ': ' + rec.get('attributes')['result'];
+ } else if (rec.get('type') === 'alarm') {
+ alarmKey = rec.get('attributes')['alarm'];
+ alarmKey = 'alarm' + alarmKey.charAt(0).toUpperCase() + alarmKey.slice(1);
text = Strings[alarmKey] || alarmKey;
- } else if (data.type === 'textMessage') {
- text = Strings.eventTextMessage + ': ' + data.attributes.message;
+ } else if (rec.get('type') === 'textMessage') {
+ text = Strings.eventTextMessage + ': ' + rec.get('attributes')['message'];
} else {
- text = Traccar.app.getEventString(data.type);
+ text = Traccar.app.getEventString(rec.get('type'));
}
- if (data.geofenceId !== 0) {
- geofence = Ext.getStore('Geofences').getById(data.geofenceId);
+ if (rec.get('geofenceId')) {
+ geofence = Ext.getStore('Geofences').getById(rec.get('geofenceId'));
if (geofence) {
text += ' \"' + geofence.get('name') + '"';
}
}
return text;
- }
+ },
+ depends: ['type', 'attributes', 'geofenceId']
}, {
name: 'attributes'
}]