aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
Diffstat (limited to 'web/app')
-rw-r--r--web/app/view/DevicesController.js11
-rw-r--r--web/app/view/MapController.js2
-rw-r--r--web/app/view/ReportController.js34
3 files changed, 30 insertions, 17 deletions
diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js
index 9dee0ff7c..6b79a6804 100644
--- a/web/app/view/DevicesController.js
+++ b/web/app/view/DevicesController.js
@@ -30,6 +30,11 @@ Ext.define('Traccar.view.DevicesController', {
selectDevice: 'selectDevice',
selectReport: 'selectReport'
}
+ },
+ store: {
+ '#Devices': {
+ update: 'onUpdateDevice'
+ }
}
}
},
@@ -103,7 +108,7 @@ Ext.define('Traccar.view.DevicesController', {
var empty = selected.getCount() === 0;
this.lookupReference('toolbarEditButton').setDisabled(empty);
this.lookupReference('toolbarRemoveButton').setDisabled(empty);
- this.lookupReference('deviceCommandButton').setDisabled(empty);
+ this.lookupReference('deviceCommandButton').setDisabled(empty || (selected.getLastSelected().get('status') !== 'online'));
if (!empty) {
this.fireEvent('selectDevice', selected.getLastSelected(), true);
}
@@ -117,5 +122,9 @@ Ext.define('Traccar.view.DevicesController', {
if (position !== undefined) {
this.getView().getSelectionModel().deselectAll();
}
+ },
+
+ onUpdateDevice: function (store, data) {
+ this.onSelectionChange(this.getView().getSelectionModel());
}
});
diff --git a/web/app/view/MapController.js b/web/app/view/MapController.js
index b8b7290b8..eee74099f 100644
--- a/web/app/view/MapController.js
+++ b/web/app/view/MapController.js
@@ -176,6 +176,8 @@ Ext.define('Traccar.view.MapController', {
this.reportRoute.getGeometry().appendCoordinate(point);
}
+
+ this.getView().getMapView().fit(this.reportRoute.getGeometry(), this.getView().getMap().getSize());
},
clearReport: function (store) {
diff --git a/web/app/view/ReportController.js b/web/app/view/ReportController.js
index 9c2abcc71..4fe7c62b8 100644
--- a/web/app/view/ReportController.js
+++ b/web/app/view/ReportController.js
@@ -37,25 +37,27 @@ Ext.define('Traccar.view.ReportController', {
fromDate = this.lookupReference('fromDateField').getValue();
fromTime = this.lookupReference('fromTimeField').getValue();
- from = new Date(
- fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(),
- fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds());
+ if (deviceId) {
+ from = new Date(
+ fromDate.getFullYear(), fromDate.getMonth(), fromDate.getDate(),
+ fromTime.getHours(), fromTime.getMinutes(), fromTime.getSeconds(), fromTime.getMilliseconds());
- toDate = this.lookupReference('toDateField').getValue();
- toTime = this.lookupReference('toTimeField').getValue();
+ toDate = this.lookupReference('toDateField').getValue();
+ toTime = this.lookupReference('toTimeField').getValue();
- to = new Date(
- toDate.getFullYear(), toDate.getMonth(), toDate.getDate(),
- toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds());
+ to = new Date(
+ toDate.getFullYear(), toDate.getMonth(), toDate.getDate(),
+ toTime.getHours(), toTime.getMinutes(), toTime.getSeconds(), toTime.getMilliseconds());
- store = Ext.getStore('Positions');
- store.load({
- params: {
- deviceId: deviceId,
- from: from.toISOString(),
- to: to.toISOString()
- }
- });
+ store = Ext.getStore('Positions');
+ store.load({
+ params: {
+ deviceId: deviceId,
+ from: from.toISOString(),
+ to: to.toISOString()
+ }
+ });
+ }
},
onClearClick: function () {