aboutsummaryrefslogtreecommitdiff
path: root/web/app
diff options
context:
space:
mode:
authordrecchia <danilo@deltatecnologia.com>2016-06-01 21:08:05 -0300
committerdrecchia <danilo@deltatecnologia.com>2016-06-01 21:08:05 -0300
commite4ba1ebf54838041fae352d95e399b1fb3483458 (patch)
tree334626820ff4efa4583bb5257d19a18cd0ebf631 /web/app
parent5df7c128af15e9d1021b7570f081185f14467f09 (diff)
parentd2c85b59bde4729d027ef1bb6e874d1fd1a02c68 (diff)
downloadtrackermap-server-e4ba1ebf54838041fae352d95e399b1fb3483458.tar.gz
trackermap-server-e4ba1ebf54838041fae352d95e399b1fb3483458.tar.bz2
trackermap-server-e4ba1ebf54838041fae352d95e399b1fb3483458.zip
Merge branch 'master' of https://github.com/tananaev/traccar
Conflicts: src/org/traccar/database/DataManager.java
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 () {