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(-) 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