aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-06-01 18:40:47 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-06-01 18:40:47 +1200
commitd2c85b59bde4729d027ef1bb6e874d1fd1a02c68 (patch)
tree64f94ac3463b28651ac7114496cb89416884fa3a
parent3db183a5535a986b015566c6df929da8c6ca9630 (diff)
parent0eda3f7a23d491ddaf0a96d8802ac7ccfe38b6dd (diff)
downloadtrackermap-server-d2c85b59bde4729d027ef1bb6e874d1fd1a02c68.tar.gz
trackermap-server-d2c85b59bde4729d027ef1bb6e874d1fd1a02c68.tar.bz2
trackermap-server-d2c85b59bde4729d027ef1bb6e874d1fd1a02c68.zip
Merge pull request #1987 from Abyss777/master
Disable command button if device is not online
-rw-r--r--web/app/view/DevicesController.js11
1 files changed, 10 insertions, 1 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());
}
});