aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/edit/DevicesController.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/app/view/edit/DevicesController.js')
-rw-r--r--web/app/view/edit/DevicesController.js59
1 files changed, 7 insertions, 52 deletions
diff --git a/web/app/view/edit/DevicesController.js b/web/app/view/edit/DevicesController.js
index 915f724a..a4bbd4ba 100644
--- a/web/app/view/edit/DevicesController.js
+++ b/web/app/view/edit/DevicesController.js
@@ -62,58 +62,13 @@ Ext.define('Traccar.view.edit.DevicesController', {
deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin');
readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
this.lookupReference('toolbarAddButton').setDisabled(readonly || deviceReadonly);
- this.lookupReference('toolbarDriversButton').setHidden(
- Traccar.app.getVehicleFeaturesDisabled() || Traccar.app.getBooleanAttributePreference('ui.disableDrivers'));
- this.lookupReference('toolbarAttributesButton').setHidden(
- Traccar.app.getBooleanAttributePreference('ui.disableComputedAttributes'));
+ this.lookupReference('toolbarDeviceMenu').setHidden(readonly || deviceReadonly);
setInterval(function () {
self.getView().getView().refresh();
}, Traccar.Style.refreshPeriod);
},
- onGeofencesClick: function () {
- var device = this.getView().getSelectionModel().getSelection()[0];
- Ext.create('Traccar.view.BaseWindow', {
- title: Strings.sharedGeofences,
- items: {
- xtype: 'linkGeofencesView',
- baseObjectName: 'deviceId',
- linkObjectName: 'geofenceId',
- storeName: 'Geofences',
- baseObject: device.getId()
- }
- }).show();
- },
-
- onAttributesClick: function () {
- var device = this.getView().getSelectionModel().getSelection()[0];
- Ext.create('Traccar.view.BaseWindow', {
- title: Strings.sharedComputedAttributes,
- items: {
- xtype: 'linkComputedAttributesView',
- baseObjectName: 'deviceId',
- linkObjectName: 'attributeId',
- storeName: 'ComputedAttributes',
- baseObject: device.getId()
- }
- }).show();
- },
-
- onDriversClick: function () {
- var device = this.getView().getSelectionModel().getSelection()[0];
- Ext.create('Traccar.view.BaseWindow', {
- title: Strings.sharedDrivers,
- items: {
- xtype: 'linkDriversView',
- baseObjectName: 'deviceId',
- linkObjectName: 'driverId',
- storeName: 'Drivers',
- baseObject: device.getId()
- }
- }).show();
- },
-
onCommandClick: function () {
var device, deviceId, dialog, typesStore, online, commandsStore;
device = this.getView().getSelectionModel().getSelection()[0];
@@ -143,15 +98,15 @@ Ext.define('Traccar.view.edit.DevicesController', {
},
updateButtons: function (selected) {
- var readonly, deviceReadonly, empty;
+ var readonly, deviceReadonly, empty, deviceMenu;
deviceReadonly = Traccar.app.getPreference('deviceReadonly', false) && !Traccar.app.getUser().get('admin');
readonly = Traccar.app.getPreference('readonly', false) && !Traccar.app.getUser().get('admin');
empty = selected.length === 0;
this.lookupReference('toolbarEditButton').setDisabled(empty || readonly || deviceReadonly);
this.lookupReference('toolbarRemoveButton').setDisabled(empty || readonly || deviceReadonly);
- this.lookupReference('toolbarGeofencesButton').setDisabled(empty || readonly);
- this.lookupReference('toolbarAttributesButton').setDisabled(empty || readonly);
- this.lookupReference('toolbarDriversButton').setDisabled(empty || readonly);
+ deviceMenu = this.lookupReference('toolbarDeviceMenu');
+ deviceMenu.device = empty ? null : selected[0];
+ deviceMenu.setDisabled(empty);
this.lookupReference('deviceCommandButton').setDisabled(empty || readonly);
},
@@ -166,7 +121,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
selectDevice: function (device) {
this.getView().getSelectionModel().select([device], false, true);
- this.updateButtons(this.getView().getSelectionModel());
+ this.updateButtons(this.getView().getSelectionModel().getSelected().items);
this.getView().getView().focusRow(device);
},
@@ -177,7 +132,7 @@ Ext.define('Traccar.view.edit.DevicesController', {
},
onUpdateDevice: function () {
- this.updateButtons(this.getView().getSelectionModel());
+ this.updateButtons(this.getView().getSelectionModel().getSelected().items);
},
deselectFeature: function () {