From 9a14f9599659c587a646ee322db5b65fa65d801d Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Mon, 25 Feb 2019 20:46:48 +0300 Subject: Add connection between event and its state --- web/app/view/StateController.js | 9 +++++++++ web/app/view/map/MapMarkerController.js | 1 - 2 files changed, 9 insertions(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/StateController.js b/web/app/view/StateController.js index 6363fc9c..58478d28 100644 --- a/web/app/view/StateController.js +++ b/web/app/view/StateController.js @@ -33,6 +33,7 @@ Ext.define('Traccar.view.StateController', { '*': { selectdevice: 'selectDevice', selectreport: 'selectReport', + selectevent: 'selectEvent', deselectfeature: 'deselectFeature' } }, @@ -175,6 +176,14 @@ Ext.define('Traccar.view.StateController', { } }, + selectEvent: function (position) { + if (position instanceof Traccar.model.Position) { + this.deviceId = null; + this.position = position; + this.updatePosition(); + } + }, + deselectFeature: function () { this.deviceId = null; this.position = null; diff --git a/web/app/view/map/MapMarkerController.js b/web/app/view/map/MapMarkerController.js index 28f1226e..b7a1e296 100644 --- a/web/app/view/map/MapMarkerController.js +++ b/web/app/view/map/MapMarkerController.js @@ -501,7 +501,6 @@ Ext.define('Traccar.view.map.MapMarkerController', { selectEvent: function (position) { var marker; - this.fireEvent('deselectfeature'); if (position) { marker = this.addReportMarker(position); marker.set('event', 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') 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); } }, -- cgit v1.2.3 From e3e14d53eb06240577600aa6179489e4a3a36957 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Tue, 26 Feb 2019 12:32:39 +0300 Subject: Fix comma error --- web/app/view/EventsController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'web/app/view') diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index 9bce2bf4..d9e0c1ed 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -25,7 +25,7 @@ Ext.define('Traccar.view.EventsController', { controller: { '*': { selectdevice: 'deselectEvent', - selectreport: 'deselectEvent', + selectreport: 'deselectEvent' }, 'map': { deselectfeature: 'deselectFeature' -- cgit v1.2.3 From ff0194c227975faa5e2f1eca3007f82c5eefc620 Mon Sep 17 00:00:00 2001 From: Evgeny S Maksimov Date: Tue, 26 Feb 2019 21:36:43 +0300 Subject: Small improvements --- web/app/view/EventsController.js | 2 +- web/app/view/ReportController.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'web/app/view') diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index d9e0c1ed..e11b4ff6 100644 --- a/web/app/view/EventsController.js +++ b/web/app/view/EventsController.js @@ -85,7 +85,7 @@ Ext.define('Traccar.view.EventsController', { deselectEvent: function (object) { - if (object !== undefined) { + if (object) { this.deselectFeature(); } }, diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js index 2ffca966..2f10cde1 100644 --- a/web/app/view/ReportController.js +++ b/web/app/view/ReportController.js @@ -247,7 +247,7 @@ Ext.define('Traccar.view.ReportController', { }, deselectReport: function (object) { - if (object !== undefined) { + if (object) { this.deselectFeature(); } }, -- 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') diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index 79cbe2fa..82e471c2 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') 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 82e471c2..f4e46153 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') diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js index f4e46153..16e54b21 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