diff options
Diffstat (limited to 'web/app/view')
-rw-r--r-- | web/app/view/Devices.js | 40 | ||||
-rw-r--r-- | web/app/view/DevicesController.js | 17 |
2 files changed, 24 insertions, 33 deletions
diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 70e11aab5..eeaaf901b 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -15,7 +15,7 @@ */ Ext.define('Traccar.view.Devices', { - extend: 'Ext.tree.Panel', + extend: 'Ext.grid.Panel', xtype: 'devicesView', requires: [ @@ -26,7 +26,7 @@ Ext.define('Traccar.view.Devices', { controller: 'devices', rootVisible: false, - store: 'DevicesTree', + store: 'Devices', title: Strings.deviceTitle, selType: 'rowmodel', @@ -80,12 +80,10 @@ Ext.define('Traccar.view.Devices', { }],*/ listeners: { - selectionchange: 'onSelectionChange', - beforeselect: 'onBeforeSelect' + selectionchange: 'onSelectionChange' }, columns: [{ - xtype: 'treecolumn', text: Strings.sharedName, dataIndex: 'name', flex: 1 @@ -94,23 +92,21 @@ Ext.define('Traccar.view.Devices', { dataIndex: 'lastUpdate', flex: 1, renderer: function (value, metaData, record) { - if (record.get('original') instanceof Traccar.model.Device) { - switch (record.get('status')) { - case 'online': - metaData.tdCls = 'status-color-online'; - break; - case 'offline': - metaData.tdCls = 'status-color-offline'; - break; - default: - metaData.tdCls = 'status-color-unknown'; - break; - } - if (Traccar.app.getPreference('twelveHourFormat', false)) { - return Ext.Date.format(value, Traccar.Style.dateTimeFormat12); - } else { - return Ext.Date.format(value, Traccar.Style.dateTimeFormat24); - } + switch (record.get('status')) { + case 'online': + metaData.tdCls = 'status-color-online'; + break; + case 'offline': + metaData.tdCls = 'status-color-offline'; + break; + default: + metaData.tdCls = 'status-color-unknown'; + break; + } + if (Traccar.app.getPreference('twelveHourFormat', false)) { + return Ext.Date.format(value, Traccar.Style.dateTimeFormat12); + } else { + return Ext.Date.format(value, Traccar.Style.dateTimeFormat24); } } }] diff --git a/web/app/view/DevicesController.js b/web/app/view/DevicesController.js index 864e3f2aa..948a5d14e 100644 --- a/web/app/view/DevicesController.js +++ b/web/app/view/DevicesController.js @@ -44,7 +44,7 @@ Ext.define('Traccar.view.DevicesController', { onAddClick: function () { var device, dialog; device = Ext.create('Traccar.model.Device'); - device.store = Ext.getStore('Devices'); + device.store = this.getView().getStore(); dialog = Ext.create('Traccar.view.DeviceDialog'); dialog.down('form').loadRecord(device); dialog.show(); @@ -52,14 +52,14 @@ Ext.define('Traccar.view.DevicesController', { onEditClick: function () { var device, dialog; - device = this.getView().getSelectionModel().getSelection()[0].get('original'); + device = this.getView().getSelectionModel().getSelection()[0]; dialog = Ext.create('Traccar.view.DeviceDialog'); dialog.down('form').loadRecord(device); dialog.show(); }, onRemoveClick: function () { - var device = this.getView().getSelectionModel().getSelection()[0].get('original'); + var device = this.getView().getSelectionModel().getSelection()[0]; Ext.Msg.show({ title: Strings.deviceDialog, message: Strings.sharedRemoveConfirm, @@ -81,7 +81,7 @@ Ext.define('Traccar.view.DevicesController', { onCommandClick: function () { var device, command, dialog; - device = this.getView().getSelectionModel().getSelection()[0].get('original'); + device = this.getView().getSelectionModel().getSelection()[0]; command = Ext.create('Traccar.model.Command'); command.set('deviceId', device.get('id')); dialog = Ext.create('Traccar.view.CommandDialog'); @@ -95,17 +95,12 @@ Ext.define('Traccar.view.DevicesController', { this.lookupReference('toolbarRemoveButton').setDisabled(empty); this.lookupReference('deviceCommandButton').setDisabled(empty); if (!empty) { - this.fireEvent('selectDevice', selected.getLastSelected().get('original'), true); + this.fireEvent('selectDevice', selected.getLastSelected(), true); } }, - onBeforeSelect: function (row, record) { - return record.get('original') instanceof Traccar.model.Device; - }, - selectDevice: function (device, center) { - var node = this.getView().getStore().getNodeById('d' + device.get('id')); - this.getView().getSelectionModel().select([node], false, true); + this.getView().getSelectionModel().select([device], false, true); }, selectReport: function (position) { |