diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2017-06-01 16:50:47 +1200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-01 16:50:47 +1200 |
commit | fe99c894c581722ab6aa2b422ed768eb9da19cfb (patch) | |
tree | 21f5e7cc17e982e2c5b52682dfac29943e39199d /web/app/model | |
parent | 0e598a6232e9cd7188916e06077862d6630a255b (diff) | |
parent | 35e8f4b4974515733737c5cc1dd439ca47860007 (diff) | |
download | trackermap-web-fe99c894c581722ab6aa2b422ed768eb9da19cfb.tar.gz trackermap-web-fe99c894c581722ab6aa2b422ed768eb9da19cfb.tar.bz2 trackermap-web-fe99c894c581722ab6aa2b422ed768eb9da19cfb.zip |
Merge pull request #498 from Abyss777/events_panel
Implement Events panel
Diffstat (limited to 'web/app/model')
-rw-r--r-- | web/app/model/Event.js | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/web/app/model/Event.js b/web/app/model/Event.js index 7a43086f..d225402c 100644 --- a/web/app/model/Event.js +++ b/web/app/model/Event.js @@ -1,5 +1,6 @@ /* - * Copyright 2015 Anton Tananaev (anton@traccar.org) + * Copyright 2015 - 2017 Anton Tananaev (anton@traccar.org) + * Copyright 2017 Andrey Kunitsyn (andrey@traccar.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +40,28 @@ Ext.define('Traccar.model.Event', { name: 'geofenceId', type: 'int' }, { + name: 'text', + calculate: function (data) { + 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); + text = Strings[alarmKey] || alarmKey; + } else if (data.type === 'textMessage') { + text = Strings.eventTextMessage + ': ' + data.attributes.message; + } else { + text = Traccar.app.getEventString(data.type); + } + if (data.geofenceId !== 0) { + geofence = Ext.getStore('Geofences').getById(data.geofenceId); + if (geofence) { + text += ' \"' + geofence.get('name') + '"'; + } + } + return text; + } + }, { name: 'attributes' }] }); |