From 2b15689bd7353f7bb388950408ddaabaeb0c0b53 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Sun, 9 Jul 2017 10:30:59 +1200 Subject: Fix minification problem --- web/app/model/Event.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'web/app/model') 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' }] -- cgit v1.2.3