From 3df9db8f0a841e5f1020d6797083c73cc68e512c Mon Sep 17 00:00:00 2001
From: alex-petkevich
Date: Thu, 25 Oct 2018 11:09:23 +0300
Subject: Fix bug with selecting device second times from the devices grid
---
web/app/view/edit/DevicesController.js | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'web/app/view/edit/DevicesController.js')
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 2b4ff14..c1e46b7 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -118,6 +118,13 @@ Ext.define('Traccar.view.edit.DevicesController', {
}
},
+ onClick: function (el, record) {
+ if (record !== undefined) {
+ this.updateButtons([record]);
+ this.fireEvent('selectdevice', record, true);
+ }
+ },
+
selectDevice: function (device) {
this.getView().getSelectionModel().select([device], false, true);
this.updateButtons(this.getView().getSelectionModel().getSelected().items);
--
cgit v1.2.3
From f953873700235a416f69eeed909cd73c59e1f32b Mon Sep 17 00:00:00 2001
From: alex-petkevich
Date: Thu, 25 Oct 2018 16:24:52 +0300
Subject: Fix bug with selecting device second times from the devices grid
---
web/app/view/edit/Devices.js | 4 ++--
web/app/view/edit/DevicesController.js | 11 +----------
2 files changed, 3 insertions(+), 12 deletions(-)
(limited to 'web/app/view/edit/DevicesController.js')
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index 2b2a874..dfa855c 100644
--- a/web/app/view/edit/Devices.js
+++ b/web/app/view/edit/Devices.js
@@ -75,8 +75,8 @@ Ext.define('Traccar.view.edit.Devices', {
},
listeners: {
- selectionchange: 'onSelectionChange',
- rowclick: 'onClick'
+ rowclick: 'onSelectionChange',
+ itemkeyup: 'onSelectionChange'
},
viewConfig: {
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index c1e46b7..120944b 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -109,16 +109,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
this.lookupReference('deviceCommandButton').setDisabled(empty || readonly);
},
- onSelectionChange: function (selection, selected) {
- this.updateButtons(selected);
- if (selected.length > 0) {
- this.fireEvent('selectdevice', selected[0], true);
- } else {
- this.fireEvent('deselectfeature');
- }
- },
-
- onClick: function (el, record) {
+ onSelectionChange: function (el, record) {
if (record !== undefined) {
this.updateButtons([record]);
this.fireEvent('selectdevice', record, true);
--
cgit v1.2.3
From af41d034854a8d267463759a72fe1f610c9d297d Mon Sep 17 00:00:00 2001
From: Evgeny S Maksimov
Date: Tue, 26 Feb 2019 12:21:51 +0300
Subject: Implementation fixes
---
web/app/view/EventsController.js | 15 +++++++++++++--
web/app/view/ReportController.js | 21 +++++++++++----------
web/app/view/StateController.js | 14 +++-----------
web/app/view/edit/DevicesController.js | 7 ++++---
web/app/view/map/MapMarkerController.js | 5 ++---
5 files changed, 33 insertions(+), 29 deletions(-)
(limited to 'web/app/view/edit/DevicesController.js')
diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js
index 8eb4363..9bce2bf 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 5d43007..2ffca96 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 58478d2..1ab1aa2 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 120944b..79cbe2f 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 b7a1e29..295d2f5 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);
}
},
--
cgit v1.2.3
From d80f545048225e4b0d9ab0a60f3bdc74ec997731 Mon Sep 17 00:00:00 2001
From: Evgeny S Maksimov
Date: Wed, 27 Feb 2019 16:12:44 +0300
Subject: Small improvements
---
web/app/view/edit/DevicesController.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'web/app/view/edit/DevicesController.js')
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 79cbe2f..82e471c 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -111,7 +111,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
},
onSelectionChange: function (el, record) {
- if (record !== undefined) {
+ if (record) {
this.updateButtons([record]);
this.fireEvent('selectdevice', record, true);
}
@@ -124,7 +124,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
},
deselectDevice: function (object) {
- if (object !== undefined) {
+ if (object) {
this.deselectFeature();
}
},
--
cgit v1.2.3
From 0c17a3d2a9aad83456b0557cf1b87eaf4ffbb675 Mon Sep 17 00:00:00 2001
From: Evgeny S Maksimov
Date: Wed, 27 Feb 2019 18:35:11 +0300
Subject: Bugfix for marker selfselect
---
web/app/view/edit/Devices.js | 3 +--
web/app/view/edit/DevicesController.js | 6 +++---
2 files changed, 4 insertions(+), 5 deletions(-)
(limited to 'web/app/view/edit/DevicesController.js')
diff --git a/web/app/view/edit/Devices.js b/web/app/view/edit/Devices.js
index dfa855c..21fdb32 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 82e471c..f4e4615 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -111,9 +111,9 @@ Ext.define('Traccar.view.edit.DevicesController', {
},
onSelectionChange: function (el, record) {
- if (record) {
- this.updateButtons([record]);
- this.fireEvent('selectdevice', record, true);
+ if (record && record.length) {
+ this.updateButtons(record);
+ this.fireEvent('selectdevice', record[0], true);
}
},
--
cgit v1.2.3
From 6dd4cb71561be3d41da3d10b810fb078f10e79b3 Mon Sep 17 00:00:00 2001
From: Evgeny S Maksimov
Date: Wed, 27 Feb 2019 21:32:56 +0300
Subject: Code-style fix
---
web/app/view/edit/DevicesController.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'web/app/view/edit/DevicesController.js')
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index f4e4615..16e54b2 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -110,10 +110,10 @@ Ext.define('Traccar.view.edit.DevicesController', {
this.lookupReference('deviceCommandButton').setDisabled(empty || readonly);
},
- onSelectionChange: function (el, record) {
- if (record && record.length) {
- this.updateButtons(record);
- this.fireEvent('selectdevice', record[0], true);
+ onSelectionChange: function (el, records) {
+ if (records && records.length) {
+ this.updateButtons(records);
+ this.fireEvent('selectdevice', records[0], true);
}
},
--
cgit v1.2.3