aboutsummaryrefslogtreecommitdiff
path: root/web/app/view/device
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 22:45:14 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2015-09-16 22:45:14 +1200
commit4154c2cd31f23c5d5fb336dfcd68ba192b297f93 (patch)
treeb1178bbc26479f580606e8a70a1004a8cea46522 /web/app/view/device
parent607522a21625610248db7a586e6285bbb0331391 (diff)
downloadtraccar-server-4154c2cd31f23c5d5fb336dfcd68ba192b297f93.tar.gz
traccar-server-4154c2cd31f23c5d5fb336dfcd68ba192b297f93.tar.bz2
traccar-server-4154c2cd31f23c5d5fb336dfcd68ba192b297f93.zip
More JavaScript code cleanup
Diffstat (limited to 'web/app/view/device')
-rw-r--r--web/app/view/device/Device.js11
-rw-r--r--web/app/view/device/DeviceController.js28
2 files changed, 22 insertions, 17 deletions
diff --git a/web/app/view/device/Device.js b/web/app/view/device/Device.js
index 9cb2123dd..d77f405bd 100644
--- a/web/app/view/device/Device.js
+++ b/web/app/view/device/Device.js
@@ -82,9 +82,12 @@ Ext.define('Traccar.view.device.Device', {
selectionchange: 'onSelectionChange'
},
- columns: [
- { text: strings.deviceName, dataIndex: 'name', flex: 1 },
- { text: strings.deviceIdentifier, dataIndex: 'uniqueId', flex: 1 }
- ]
+ columns: [{
+ text: strings.deviceName,
+ dataIndex: 'name', flex: 1
+ }, {
+ text: strings.deviceIdentifier,
+ dataIndex: 'uniqueId', flex: 1
+ }]
});
diff --git a/web/app/view/device/DeviceController.js b/web/app/view/device/DeviceController.js
index 31caa5147..59b777f8b 100644
--- a/web/app/view/device/DeviceController.js
+++ b/web/app/view/device/DeviceController.js
@@ -37,7 +37,7 @@ Ext.define('Traccar.view.device.DeviceController', {
},
init: function() {
- if (Traccar.getApplication().getUser().get('admin')) {
+ if (Traccar.app.getUser().get('admin')) {
this.lookupReference('settingsServerButton').setHidden(false);
this.lookupReference('settingsUsersButton').setHidden(false);
}
@@ -48,15 +48,17 @@ Ext.define('Traccar.view.device.DeviceController', {
},
onAddClick: function() {
- var device = Ext.create('Traccar.model.Device');
- var dialog = Ext.create('Traccar.view.device.DeviceDialog');
+ var device, dialog;
+ device = Ext.create('Traccar.model.Device');
+ dialog = Ext.create('Traccar.view.device.DeviceDialog');
dialog.down('form').loadRecord(device);
dialog.show();
},
onEditClick: function() {
- var device = this.getView().getSelectionModel().getSelection()[0];
- var dialog = Ext.create('Traccar.view.device.DeviceDialog');
+ var device, dialog;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ dialog = Ext.create('Traccar.view.device.DeviceDialog');
dialog.down('form').loadRecord(device);
dialog.show();
},
@@ -72,8 +74,9 @@ Ext.define('Traccar.view.device.DeviceController', {
no: strings.sharedCancel
},
fn: function(btn) {
+ var store;
if (btn === 'yes') {
- var store = Ext.getStore('Devices');
+ store = Ext.getStore('Devices');
store.remove(device);
store.sync();
}
@@ -82,10 +85,11 @@ Ext.define('Traccar.view.device.DeviceController', {
},
onCommandClick: function() {
- var device = this.getView().getSelectionModel().getSelection()[0];
- var command = Ext.create('Traccar.model.Command');
+ var device, command, dialog;
+ device = this.getView().getSelectionModel().getSelection()[0];
+ command = Ext.create('Traccar.model.Command');
command.set('deviceId', device.get('id'));
- var dialog = Ext.create('Traccar.view.command.CommandDialog');
+ dialog = Ext.create('Traccar.view.command.CommandDialog');
dialog.down('form').loadRecord(command);
dialog.show();
},
@@ -101,16 +105,14 @@ Ext.define('Traccar.view.device.DeviceController', {
},
onUserClick: function() {
- var user = Traccar.getApplication().getUser();
var dialog = Ext.create('Traccar.view.user.UserDialog');
- dialog.down('form').loadRecord(user);
+ dialog.down('form').loadRecord(Traccar.app.getUser());
dialog.show();
},
onServerClick: function() {
- var server = Traccar.getApplication().getServer();
var dialog = Ext.create('Traccar.view.admin.ServerDialog');
- dialog.down('form').loadRecord(server);
+ dialog.down('form').loadRecord(Traccar.app.getServer());
dialog.show();
},