diff options
Diffstat (limited to 'web/app')
-rw-r--r-- | web/app/view/DeviceDialog.js | 2 | ||||
-rw-r--r-- | web/app/view/Devices.js | 2 | ||||
-rw-r--r-- | web/app/view/Groups.js | 44 | ||||
-rw-r--r-- | web/app/view/GroupsController.js | 67 | ||||
-rw-r--r-- | web/app/view/Register.js | 2 | ||||
-rw-r--r-- | web/app/view/SettingsMenu.js | 3 | ||||
-rw-r--r-- | web/app/view/SettingsMenuController.js | 11 | ||||
-rw-r--r-- | web/app/view/UserDevices.js | 2 | ||||
-rw-r--r-- | web/app/view/UserDialog.js | 2 | ||||
-rw-r--r-- | web/app/view/Users.js | 2 |
10 files changed, 131 insertions, 6 deletions
diff --git a/web/app/view/DeviceDialog.js b/web/app/view/DeviceDialog.js index c42af95d0..318ac4ffe 100644 --- a/web/app/view/DeviceDialog.js +++ b/web/app/view/DeviceDialog.js @@ -29,7 +29,7 @@ Ext.define('Traccar.view.DeviceDialog', { items: [{ xtype: 'textfield', name: 'name', - fieldLabel: Strings.deviceName, + fieldLabel: Strings.sharedName, allowBlank: false }, { xtype: 'textfield', diff --git a/web/app/view/Devices.js b/web/app/view/Devices.js index 66c4e813b..5712feb81 100644 --- a/web/app/view/Devices.js +++ b/web/app/view/Devices.js @@ -57,7 +57,7 @@ Ext.define('Traccar.view.Devices', { }, columns: [{ - text: Strings.deviceName, + text: Strings.sharedName, dataIndex: 'name', flex: 1 }, { diff --git a/web/app/view/Groups.js b/web/app/view/Groups.js new file mode 100644 index 000000000..8404c59a9 --- /dev/null +++ b/web/app/view/Groups.js @@ -0,0 +1,44 @@ +/* + * Copyright 2016 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.Groups', { + extend: 'Ext.grid.Panel', + xtype: 'groupsView', + + requires: [ + 'Traccar.view.GroupsController', + 'Traccar.view.EditToolbar' + ], + + controller: 'groups', + store: 'Groups', + + selType: 'rowmodel', + + tbar: { + xtype: 'editToolbar' + }, + + listeners: { + selectionchange: 'onSelectionChange' + }, + + columns: [{ + text: Strings.sharedName, + dataIndex: 'name', + flex: 1 + }] +}); diff --git a/web/app/view/GroupsController.js b/web/app/view/GroupsController.js new file mode 100644 index 000000000..619e0c50e --- /dev/null +++ b/web/app/view/GroupsController.js @@ -0,0 +1,67 @@ +/* + * Copyright 2016 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.GroupsController', { + extend: 'Ext.app.ViewController', + alias: 'controller.groups', + + init: function () { + Ext.getStore('Groups').load(); + }, + + onAddClick: function () { + /*var user, dialog; + user = Ext.create('Traccar.model.User'); + dialog = Ext.create('Traccar.view.UserDialog'); + dialog.down('form').loadRecord(user); + dialog.show();*/ + }, + + onEditClick: function () { + /*var user, dialog; + user = this.getView().getSelectionModel().getSelection()[0]; + dialog = Ext.create('Traccar.view.UserDialog'); + dialog.down('form').loadRecord(user); + dialog.show();*/ + }, + + onRemoveClick: function () { + /*var user = this.getView().getSelectionModel().getSelection()[0]; + Ext.Msg.show({ + title: Strings.settingsUser, + message: Strings.sharedRemoveConfirm, + buttons: Ext.Msg.YESNO, + buttonText: { + yes: Strings.sharedRemove, + no: Strings.sharedCancel + }, + fn: function (btn) { + var store = Ext.getStore('Users'); + if (btn === 'yes') { + store.remove(user); + store.sync(); + } + } + });*/ + }, + + 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/Register.js b/web/app/view/Register.js index 7c2881d62..198e10b8f 100644 --- a/web/app/view/Register.js +++ b/web/app/view/Register.js @@ -33,7 +33,7 @@ Ext.define('Traccar.view.Register', { items: [{ xtype: 'textfield', name: 'name', - fieldLabel: Strings.userName, + fieldLabel: Strings.sharedName, allowBlank: false }, { xtype: 'textfield', diff --git a/web/app/view/SettingsMenu.js b/web/app/view/SettingsMenu.js index c828b37af..1ada94359 100644 --- a/web/app/view/SettingsMenu.js +++ b/web/app/view/SettingsMenu.js @@ -32,6 +32,9 @@ Ext.define('Traccar.view.SettingsMenu', { text: Strings.settingsUser, handler: 'onUserClick' }, { + text: Strings.settingsGroups, + handler: 'onGroupsClick' + }, { text: Strings.settingsServer, hidden: true, handler: 'onServerClick', diff --git a/web/app/view/SettingsMenuController.js b/web/app/view/SettingsMenuController.js index c52f0a75e..6d767e3a9 100644 --- a/web/app/view/SettingsMenuController.js +++ b/web/app/view/SettingsMenuController.js @@ -23,6 +23,7 @@ Ext.define('Traccar.view.SettingsMenuController', { 'Traccar.view.UserDialog', 'Traccar.view.ServerDialog', 'Traccar.view.Users', + 'Traccar.view.Groups', 'Traccar.view.BaseWindow' ], @@ -39,6 +40,16 @@ Ext.define('Traccar.view.SettingsMenuController', { dialog.show(); }, + onGroupsClick: function () { + Ext.create('Traccar.view.BaseWindow', { + title: Strings.settingsGroups, + modal: false, + items: { + xtype: 'groupsView' + } + }).show(); + }, + onServerClick: function () { var dialog = Ext.create('Traccar.view.ServerDialog'); dialog.down('form').loadRecord(Traccar.app.getServer()); diff --git a/web/app/view/UserDevices.js b/web/app/view/UserDevices.js index f9ab48266..f42f7c1bb 100644 --- a/web/app/view/UserDevices.js +++ b/web/app/view/UserDevices.js @@ -37,7 +37,7 @@ Ext.define('Traccar.view.UserDevices', { }, columns: [{ - text: Strings.deviceName, + text: Strings.sharedName, dataIndex: 'name', flex: 1 }, { text: Strings.deviceIdentifier, diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 783ddd159..c1ed2fece 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -30,7 +30,7 @@ Ext.define('Traccar.view.UserDialog', { items: [{ xtype: 'textfield', name: 'name', - fieldLabel: Strings.userName + fieldLabel: Strings.sharedName }, { xtype: 'textfield', name: 'email', diff --git a/web/app/view/Users.js b/web/app/view/Users.js index f4ef332b4..684931559 100644 --- a/web/app/view/Users.js +++ b/web/app/view/Users.js @@ -43,7 +43,7 @@ Ext.define('Traccar.view.Users', { }, columns: [{ - text: Strings.userName, + text: Strings.sharedName, dataIndex: 'name', flex: 1 }, { |