aboutsummaryrefslogtreecommitdiff
path: root/web/app/model
diff options
context:
space:
mode:
authorAbyss777 <abyss@fox5.ru>2017-05-31 16:55:00 +0500
committerAbyss777 <abyss@fox5.ru>2017-05-31 16:55:08 +0500
commit35e8f4b4974515733737c5cc1dd439ca47860007 (patch)
tree21f5e7cc17e982e2c5b52682dfac29943e39199d /web/app/model
parent0e598a6232e9cd7188916e06077862d6630a255b (diff)
downloadetbsa-traccar-web-35e8f4b4974515733737c5cc1dd439ca47860007.tar.gz
etbsa-traccar-web-35e8f4b4974515733737c5cc1dd439ca47860007.tar.bz2
etbsa-traccar-web-35e8f4b4974515733737c5cc1dd439ca47860007.zip
Implement Events panel
Diffstat (limited to 'web/app/model')
-rw-r--r--web/app/model/Event.js25
1 files changed, 24 insertions, 1 deletions
diff --git a/web/app/model/Event.js b/web/app/model/Event.js
index 7a43086..d225402 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'
}]
});