From d3ca7de349f1d8ab0d02bf783a2c7627af44c6fd Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 15 Oct 2015 15:12:46 +1300 Subject: Change user devices window --- web/app/view/BaseWindow.js | 24 +++++++++++++++++++++++ web/app/view/SettingsMenuController.js | 10 ++++------ web/app/view/UserDevices.js | 35 +++++++++++----------------------- web/app/view/UserDevicesController.js | 31 ++++++++++++++++++++++++++++++ web/app/view/UsersController.js | 12 +++++++++--- 5 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 web/app/view/BaseWindow.js create mode 100644 web/app/view/UserDevicesController.js (limited to 'web') diff --git a/web/app/view/BaseWindow.js b/web/app/view/BaseWindow.js new file mode 100644 index 000000000..b6c777d1d --- /dev/null +++ b/web/app/view/BaseWindow.js @@ -0,0 +1,24 @@ +/* + * 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.BaseWindow', { + extend: 'Ext.window.Window', + + width: Traccar.Style.windowWidth, + height: Traccar.Style.windowHeight, + layout: 'fit', + modal: true +}); diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index 920356010..c52f0a75e 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -22,7 +22,8 @@ Ext.define('Traccar.view.SettingsMenuController', { 'Traccar.view.LoginController', 'Traccar.view.UserDialog', 'Traccar.view.ServerDialog', - 'Traccar.view.Users' + 'Traccar.view.Users', + 'Traccar.view.BaseWindow' ], init: function () { @@ -45,12 +46,9 @@ Ext.define('Traccar.view.SettingsMenuController', { }, onUsersClick: function () { - Ext.create('Ext.window.Window', { + Ext.create('Traccar.view.BaseWindow', { title: Strings.settingsUsers, - width: Traccar.Style.windowWidth, - height: Traccar.Style.windowHeight, - layout: 'fit', - modal: true, + modal: false, items: { xtype: 'usersView' } diff --git a/web/app/view/UserDevices.js b/web/app/view/UserDevices.js index 5eeaac39b..256168946 100644 --- a/web/app/view/UserDevices.js +++ b/web/app/view/UserDevices.js @@ -19,23 +19,16 @@ Ext.define('Traccar.view.UserDevices', { xtype: 'userDevicesView', requires: [ - 'Traccar.view.UsersController', - 'Traccar.view.EditToolbar' + 'Traccar.view.UserDevicesController' ], - controller: 'users', - store: 'Users', + controller: 'userDevices', + store: 'Devices', - selType: 'rowmodel', - - tbar: { - xtype: 'editToolbar', - items: [{ - text: Strings.deviceTitle, - disabled: true, - handler: 'onDevicesClick', - reference: 'userDevicesButton' - }] + selModel: { + selType: 'checkboxmodel', + checkOnly: true, + showHeaderCheckbox: false }, listeners: { @@ -43,16 +36,10 @@ Ext.define('Traccar.view.UserDevices', { }, columns: [{ - text: Strings.userName, - dataIndex: 'name', - flex: 1 - }, { - text: Strings.userEmail, - dataIndex: 'email', - flex: 1 + text: Strings.deviceName, + dataIndex: 'name', flex: 1 }, { - text: Strings.userAdmin, - dataIndex: 'admin', - flex: 1 + text: Strings.deviceIdentifier, + dataIndex: 'uniqueId', flex: 1 }] }); diff --git a/web/app/view/UserDevicesController.js b/web/app/view/UserDevicesController.js new file mode 100644 index 000000000..ec40fec02 --- /dev/null +++ b/web/app/view/UserDevicesController.js @@ -0,0 +1,31 @@ +/* + * 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.UserDevicesController', { + extend: 'Ext.app.ViewController', + alias: 'controller.userDevices', + + init: function () { + //Ext.getStore('Users').load(); + }, + + onSelectionChange: function (selected) { + /*var disabled = selected.length > 0; + this.lookupReference('toolbarEditButton').setDisabled(disabled); + this.lookupReference('toolbarRemoveButton').setDisabled(disabled); + this.lookupReference('userDevicesButton').setDisabled(disabled);*/ + } +}); diff --git a/web/app/view/UsersController.js b/web/app/view/UsersController.js index c8fd137ed..cfcf17fe1 100644 --- a/web/app/view/UsersController.js +++ b/web/app/view/UsersController.js @@ -19,7 +19,9 @@ Ext.define('Traccar.view.UsersController', { alias: 'controller.users', requires: [ - 'Traccar.view.UserDialog' + 'Traccar.view.UserDialog', + 'Traccar.view.UserDevices', + 'Traccar.view.BaseWindow' ], init: function () { @@ -63,8 +65,12 @@ Ext.define('Traccar.view.UsersController', { }, onDevicesClick: function () { - //var dialog = Ext.create('Traccar.view.UserDeviceDialog'); - //dialog.show(); + Ext.create('Traccar.view.BaseWindow', { + title: Strings.deviceTitle, + items: { + xtype: 'userDevicesView' + } + }).show(); }, onSelectionChange: function (selected) { -- cgit v1.2.3