diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/EventsController.js | 15 | ||||
-rw-r--r-- | web/app/view/ReportController.js | 21 | ||||
-rw-r--r-- | web/app/view/StateController.js | 5 | ||||
-rw-r--r-- | web/app/view/edit/Devices.js | 3 | ||||
-rw-r--r-- | web/app/view/edit/DevicesController.js | 15 | ||||
-rw-r--r-- | web/app/view/map/MapMarkerController.js | 6 |
6 files changed, 38 insertions, 27 deletions
diff --git a/web/app/view/EventsController.js b/web/app/view/EventsController.js index 8eb4363..e11b4ff 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 5d43007..2f10cde 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 6363fc9..1ab1aa2 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 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 120944b..16e54b2 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 28f1226..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,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); |