diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-15 14:49:15 +1300 |
---|---|---|
committer | Anton Tananaev <anton.tananaev@gmail.com> | 2015-10-15 14:49:15 +1300 |
commit | 7925028c138228f369180adbd857f4cd986a6346 (patch) | |
tree | 650b95f4b1bfa21ff122ed7bd852fd02c68ca051 | |
parent | d9f6e0fa8ae131574436cf4375d7feb2d7ff76a7 (diff) | |
download | traccar-server-7925028c138228f369180adbd857f4cd986a6346.tar.gz traccar-server-7925028c138228f369180adbd857f4cd986a6346.tar.bz2 traccar-server-7925028c138228f369180adbd857f4cd986a6346.zip |
Refactor some web interface classes
-rw-r--r-- | web/app/view/Devices.js (renamed from web/app/view/Device.js) | 8 | ||||
-rw-r--r-- | web/app/view/DevicesController.js (renamed from web/app/view/DeviceController.js) | 8 | ||||
-rw-r--r-- | web/app/view/Main.js | 4 | ||||
-rw-r--r-- | web/app/view/MainMobile.js | 4 | ||||
-rw-r--r-- | web/app/view/SettingsMenuController.js | 7 | ||||
-rw-r--r-- | web/app/view/UserDeviceDialog.js | 42 | ||||
-rw-r--r-- | web/app/view/UserDevices.js | 58 | ||||
-rw-r--r-- | web/app/view/Users.js (renamed from web/app/view/User.js) | 8 | ||||
-rw-r--r-- | web/app/view/UsersController.js (renamed from web/app/view/UserController.js) | 12 |
9 files changed, 83 insertions, 68 deletions
diff --git a/web/app/view/Device.js b/web/app/view/Devices.js index e23151100..9dcd76a55 100644 --- a/web/app/view/Device.js +++ b/web/app/view/Devices.js @@ -14,17 +14,17 @@ * limitations under the License. */ -Ext.define('Traccar.view.Device', { +Ext.define('Traccar.view.Devices', { extend: 'Ext.grid.Panel', - xtype: 'deviceView', + xtype: 'devicesView', requires: [ - 'Traccar.view.DeviceController', + 'Traccar.view.DevicesController', 'Traccar.view.EditToolbar', 'Traccar.view.SettingsMenu' ], - controller: 'device', + controller: 'devices', store: 'Devices', title: Strings.deviceTitle, diff --git a/web/app/view/DeviceController.js b/web/app/view/DevicesController.js index a7e90da40..dd3ca5a05 100644 --- a/web/app/view/DeviceController.js +++ b/web/app/view/DevicesController.js @@ -14,15 +14,13 @@ * limitations under the License. */ -Ext.define('Traccar.view.DeviceController', { +Ext.define('Traccar.view.DevicesController', { extend: 'Ext.app.ViewController', - alias: 'controller.device', + alias: 'controller.devices', requires: [ 'Traccar.view.CommandDialog', - 'Traccar.view.DeviceDialog', - 'Traccar.view.UserDialog', - 'Traccar.view.User' + 'Traccar.view.DeviceDialog' ], config: { diff --git a/web/app/view/Main.js b/web/app/view/Main.js index fc29d43aa..156e0b970 100644 --- a/web/app/view/Main.js +++ b/web/app/view/Main.js @@ -19,7 +19,7 @@ Ext.define('Traccar.view.Main', { alias: 'widget.main', requires: [ - 'Traccar.view.Device', + 'Traccar.view.Devices', 'Traccar.view.State', 'Traccar.view.Report', 'Traccar.view.Map' @@ -45,7 +45,7 @@ Ext.define('Traccar.view.Main', { items: [{ region: 'center', - xtype: 'deviceView' + xtype: 'devicesView' }, { region: 'south', xtype: 'stateView' diff --git a/web/app/view/MainMobile.js b/web/app/view/MainMobile.js index e42fc7f7f..f3d0b6339 100644 --- a/web/app/view/MainMobile.js +++ b/web/app/view/MainMobile.js @@ -19,7 +19,7 @@ Ext.define('Traccar.view.MainMobile', { alias: 'widget.mainMobile', requires: [ - 'Traccar.view.Device', + 'Traccar.view.Devices', 'Traccar.view.State', 'Traccar.view.Map' ], @@ -43,7 +43,7 @@ Ext.define('Traccar.view.MainMobile', { flex: 2 }, { region: 'south', - xtype: 'deviceView', + xtype: 'devicesView', flex: 1 }] }); diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index b63cf42f8..920356010 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -19,7 +19,10 @@ Ext.define('Traccar.view.SettingsMenuController', { alias: 'controller.settings', requires: [ - 'Traccar.view.LoginController' + 'Traccar.view.LoginController', + 'Traccar.view.UserDialog', + 'Traccar.view.ServerDialog', + 'Traccar.view.Users' ], init: function () { @@ -49,7 +52,7 @@ Ext.define('Traccar.view.SettingsMenuController', { layout: 'fit', modal: true, items: { - xtype: 'userView' + xtype: 'usersView' } }).show(); }, diff --git a/web/app/view/UserDeviceDialog.js b/web/app/view/UserDeviceDialog.js deleted file mode 100644 index 7e0b1eb88..000000000 --- a/web/app/view/UserDeviceDialog.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -Ext.define('Traccar.view.UserDeviceDialog', { - extend: 'Traccar.view.BaseEditDialog', - - requires: [ - 'Traccar.view.BaseEditDialogController' - ], - - controller: 'baseEditDialog', - title: Strings.deviceTitle, - - width: Traccar.Style.windowWidth, - - items: { - xtype: 'form', - items: [{ - xtype: 'itemselectorfield', - anchor: '100%', - store: 'Languages', - displayField: 'name', - valueField: 'id', - fromTitle: 'Available', - toTitle: 'Selected', - maxHeight: Traccar.Style.windowHeight - }] - } -}); diff --git a/web/app/view/UserDevices.js b/web/app/view/UserDevices.js new file mode 100644 index 000000000..5eeaac39b --- /dev/null +++ b/web/app/view/UserDevices.js @@ -0,0 +1,58 @@ +/* + * Copyright 2015 Anton Tananaev (anton.tananaev@gmail.com) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +Ext.define('Traccar.view.UserDevices', { + extend: 'Ext.grid.Panel', + xtype: 'userDevicesView', + + requires: [ + 'Traccar.view.UsersController', + 'Traccar.view.EditToolbar' + ], + + controller: 'users', + store: 'Users', + + selType: 'rowmodel', + + tbar: { + xtype: 'editToolbar', + items: [{ + text: Strings.deviceTitle, + disabled: true, + handler: 'onDevicesClick', + reference: 'userDevicesButton' + }] + }, + + listeners: { + selectionchange: 'onSelectionChange' + }, + + columns: [{ + text: Strings.userName, + dataIndex: 'name', + flex: 1 + }, { + text: Strings.userEmail, + dataIndex: 'email', + flex: 1 + }, { + text: Strings.userAdmin, + dataIndex: 'admin', + flex: 1 + }] +}); diff --git a/web/app/view/User.js b/web/app/view/Users.js index 67a290f73..f4ef332b4 100644 --- a/web/app/view/User.js +++ b/web/app/view/Users.js @@ -14,16 +14,16 @@ * limitations under the License. */ -Ext.define('Traccar.view.User', { +Ext.define('Traccar.view.Users', { extend: 'Ext.grid.Panel', - xtype: 'userView', + xtype: 'usersView', requires: [ - 'Traccar.view.UserController', + 'Traccar.view.UsersController', 'Traccar.view.EditToolbar' ], - controller: 'user', + controller: 'users', store: 'Users', selType: 'rowmodel', diff --git a/web/app/view/UserController.js b/web/app/view/UsersController.js index 4ebc0d27c..c8fd137ed 100644 --- a/web/app/view/UserController.js +++ b/web/app/view/UsersController.js @@ -14,13 +14,12 @@ * limitations under the License. */ -Ext.define('Traccar.view.UserController', { +Ext.define('Traccar.view.UsersController', { extend: 'Ext.app.ViewController', - alias: 'controller.user', + alias: 'controller.users', requires: [ - 'Traccar.view.UserDialog', - 'Traccar.view.UserDeviceDialog' + 'Traccar.view.UserDialog' ], init: function () { @@ -64,8 +63,8 @@ Ext.define('Traccar.view.UserController', { }, onDevicesClick: function () { - var dialog = Ext.create('Traccar.view.UserDeviceDialog'); - dialog.show(); + //var dialog = Ext.create('Traccar.view.UserDeviceDialog'); + //dialog.show(); }, onSelectionChange: function (selected) { @@ -74,5 +73,4 @@ Ext.define('Traccar.view.UserController', { this.lookupReference('toolbarRemoveButton').setDisabled(disabled); this.lookupReference('userDevicesButton').setDisabled(disabled); } - }); |