aboutsummaryrefslogtreecommitdiff
path: root/web/app/view
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2016-04-10 13:42:47 +1200
committerAnton Tananaev <anton.tananaev@gmail.com>2016-04-10 13:42:47 +1200
commitf5a96bb1547dcfbddf26c05143874195b4a50d0f (patch)
treef7a6ada494a957e61cff83c82b81fa0dc6921285 /web/app/view
parente107563e0b4045c15321ad540983d614531bf6af (diff)
downloadtrackermap-server-f5a96bb1547dcfbddf26c05143874195b4a50d0f.tar.gz
trackermap-server-f5a96bb1547dcfbddf26c05143874195b4a50d0f.tar.bz2
trackermap-server-f5a96bb1547dcfbddf26c05143874195b4a50d0f.zip
Revert device panel back to grid
Diffstat (limited to 'web/app/view')
-rw-r--r--web/app/view/Devices.js40
-rw-r--r--web/app/view/DevicesController.js17
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) {