aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
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.js14
-rw-r--r--web/app/view/edit/DevicesController.js7
-rw-r--r--web/app/view/map/MapMarkerController.js5
5 files changed, 33 insertions, 29 deletions
diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js
index 8eb4363f..9bce2bf4 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 !== undefined) {
+ this.deselectFeature();
+ }
+ },
+
+ deselectFeature: function () {
this.getView().getSelectionModel().deselectAll();
},
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 5d43007a..2ffca966 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 !== undefined) {
+ 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 58478d28..1ab1aa2f 100644
--- a/web/app/view/StateController.js
+++ b/web/app/view/StateController.js
@@ -32,8 +32,8 @@ Ext.define('Traccar.view.StateController', {
controller: {
'*': {
selectdevice: 'selectDevice',
- selectreport: 'selectReport',
- selectevent: 'selectEvent',
+ selectreport: 'selectPosition',
+ selectevent: 'selectPosition',
deselectfeature: 'deselectFeature'
}
},
@@ -168,15 +168,7 @@ Ext.define('Traccar.view.StateController', {
}
},
- selectReport: function (position) {
- if (position instanceof Traccar.model.Position) {
- this.deviceId = null;
- this.position = position;
- this.updatePosition();
- }
- },
-
- selectEvent: function (position) {
+ selectPosition: function (position) {
if (position instanceof Traccar.model.Position) {
this.deviceId = null;
this.position = position;
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 120944b8..79cbe2fa 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'
@@ -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 !== undefined) {
this.deselectFeature();
}
},
diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js
index b7a1e296..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,6 +493,8 @@ 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);
}
},