aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2019-02-27 12:34:24 -0800
committerGitHub <noreply@github.com>2019-02-27 12:34:24 -0800
commitecde88443393ac77b133d2682fef3885f859818e (patch)
tree9edb97a56389614132a645b03220ecdc8b5fa6b4 /web/app
parent05b555c6c8539f35c1caf3b1f4e252146f1e7d38 (diff)
parent6dd4cb71561be3d41da3d10b810fb078f10e79b3 (diff)
downloadtrackermap-web-ecde88443393ac77b133d2682fef3885f859818e.tar.gz
trackermap-web-ecde88443393ac77b133d2682fef3885f859818e.tar.bz2
trackermap-web-ecde88443393ac77b133d2682fef3885f859818e.zip
Merge pull request #730 from iEvgeny/event2pos
Add connection between event and its state
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/EventsController.js15
-rw-r--r--web/app/view/ReportController.js21
-rw-r--r--web/app/view/StateController.js5
-rw-r--r--web/app/view/edit/Devices.js3
-rw-r--r--web/app/view/edit/DevicesController.js15
-rw-r--r--web/app/view/map/MapMarkerController.js6
6 files changed, 38 insertions, 27 deletions
diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js
index 8eb4363f..e11b4ff6 100644
--- a/web/app/view/EventsController.js
+++ b/web/app/view/EventsController.js
@@ -24,7 +24,11 @@ Ext.define('Traccar.view.EventsController', {
listen: {
controller: {
'*': {
- deselectevent: 'deselectEvent'
+ selectdevice: 'deselectEvent',
+ selectreport: 'deselectEvent'
+ },
+ 'map': {
+ deselectfeature: 'deselectFeature'
}
},
store: {
@@ -79,7 +83,14 @@ Ext.define('Traccar.view.EventsController', {
Traccar.app.showEvents(false);
},
- deselectEvent: function () {
+
+ deselectEvent: function (object) {
+ if (object) {
+ this.deselectFeature();
+ }
+ },
+
+ deselectFeature: function () {
this.getView().getSelectionModel().deselectAll();
},
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 5d43007a..2f10cde1 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -32,12 +32,13 @@ Ext.define('Traccar.view.ReportController', {
listen: {
controller: {
'*': {
- selectdevice: 'selectDevice',
- showsingleevent: 'showSingleEvent',
- deselectfeature: 'deselectFeature'
+ selectdevice: 'deselectReport',
+ selectevent: 'deselectReport',
+ showsingleevent: 'showSingleEvent'
},
'map': {
- selectreport: 'selectReport'
+ selectreport: 'selectReport',
+ deselectfeature: 'deselectFeature'
}
},
global: {
@@ -231,12 +232,6 @@ Ext.define('Traccar.view.ReportController', {
}
},
- selectDevice: function (device) {
- if (device) {
- this.getGrid().getSelectionModel().deselectAll();
- }
- },
-
selectReport: function (object) {
var positionRelated, reportType = this.lookupReference('reportTypeField').getValue();
if (object instanceof Traccar.model.Position) {
@@ -251,6 +246,12 @@ Ext.define('Traccar.view.ReportController', {
}
},
+ deselectReport: function (object) {
+ if (object) {
+ this.deselectFeature();
+ }
+ },
+
deselectFeature: function () {
if (this.lookupReference('reportTypeField').getValue() !== 'trips') {
this.getGrid().getSelectionModel().deselectAll();
diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js
index 6363fc9c..1ab1aa2f 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -32,7 +32,8 @@ Ext.define('Traccar.view.StateController', {
controller: {
'*': {
selectdevice: 'selectDevice',
- selectreport: 'selectReport',
+ selectreport: 'selectPosition',
+ selectevent: 'selectPosition',
deselectfeature: 'deselectFeature'
}
},
@@ -167,7 +168,7 @@ Ext.define('Traccar.view.StateController', {
}
},
- selectReport: function (position) {
+ selectPosition: function (position) {
if (position instanceof Traccar.model.Position) {
this.deviceId = null;
this.position = position;
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index dfa855c8..21fdb32a 100644
--- a/web/app/view/edit/Devices.js
+++ b/web/app/view/edit/Devices.js
@@ -75,8 +75,7 @@ Ext.define('Traccar.view.edit.Devices', {
},
listeners: {
- rowclick: 'onSelectionChange',
- itemkeyup: 'onSelectionChange'
+ selectionchange: 'onSelectionChange'
},
viewConfig: {
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 120944b8..16e54b21 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -35,7 +35,8 @@ Ext.define('Traccar.view.edit.DevicesController', {
listen: {
controller: {
'*': {
- selectreport: 'selectReport'
+ selectreport: 'deselectDevice',
+ selectevent: 'deselectDevice'
},
'root': {
selectdevice: 'selectDevice'
@@ -109,10 +110,10 @@ Ext.define('Traccar.view.edit.DevicesController', {
this.lookupReference('deviceCommandButton').setDisabled(empty || readonly);
},
- onSelectionChange: function (el, record) {
- if (record !== undefined) {
- this.updateButtons([record]);
- this.fireEvent('selectdevice', record, true);
+ onSelectionChange: function (el, records) {
+ if (records && records.length) {
+ this.updateButtons(records);
+ this.fireEvent('selectdevice', records[0], true);
}
},
@@ -122,8 +123,8 @@ Ext.define('Traccar.view.edit.DevicesController', {
this.getView().getView().focusRow(device);
},
- selectReport: function (position) {
- if (position !== undefined) {
+ deselectDevice: function (object) {
+ if (object) {
this.deselectFeature();
}
},
diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js
index 28f1226e..295d2f50 100644
--- a/web/app/view/map/MapMarkerController.js
+++ b/web/app/view/map/MapMarkerController.js
@@ -457,9 +457,6 @@ Ext.define('Traccar.view.map.MapMarkerController', {
if (this.selectedMarker) {
if (this.selectedMarker.get('event')) {
this.getView().getMarkersSource().removeFeature(this.selectedMarker);
- if (!marker || !marker.get('event')) {
- this.fireEvent('deselectevent');
- }
} else if (!Ext.getStore('ReportRoute').showMarkers &&
this.selectedMarker.get('record') instanceof Traccar.model.Position) {
this.getView().getMarkersSource().removeFeature(this.selectedMarker);
@@ -496,12 +493,13 @@ Ext.define('Traccar.view.map.MapMarkerController', {
this.reportMarkers[position.get('id')] = this.addReportMarker(position);
}
this.selectMarker(this.reportMarkers[position.get('id')], center);
+ } else if (this.selectedMarker) {
+ this.selectMarker(null, false);
}
},
selectEvent: function (position) {
var marker;
- this.fireEvent('deselectfeature');
if (position) {
marker = this.addReportMarker(position);
marker.set('event', true);