From e8850343bdb1e5e6a1c366aeacdff1f91bfa5daf Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Thu, 17 Nov 2016 22:48:33 +1300 Subject: Add user expiration and device limit --- web/app/Application.js | 2 +- web/app/model/User.js | 10 ++++++++++ web/app/view/UserDialog.js | 24 ++++++++++++++++++++++-- web/app/view/UserDialogController.js | 7 +++++-- web/l10n/en.json | 3 +++ 5 files changed, 41 insertions(+), 5 deletions(-) (limited to 'web') diff --git a/web/app/Application.js b/web/app/Application.js index 702a75a..6f4cb1d 100644 --- a/web/app/Application.js +++ b/web/app/Application.js @@ -130,7 +130,7 @@ Ext.define('Traccar.Application', { if (Ext.isString(response)) { Ext.Msg.alert(Strings.errorTitle, response); } else if (response.responseText) { - Ext.Msg.alert(response.responseText); + Ext.Msg.alert(Strings.errorTitle, response.responseText); } else if (response.statusText) { Ext.Msg.alert(Strings.errorTitle, response.statusText); } else { diff --git a/web/app/model/User.js b/web/app/model/User.js index 56748e4..4891241 100644 --- a/web/app/model/User.js +++ b/web/app/model/User.js @@ -61,6 +61,16 @@ Ext.define('Traccar.model.User', { }, { name: 'coordinateFormat', type: 'string' + }, { + name: 'disabled', + type: 'boolean' + }, { + name: 'expirationTime', + type: 'date', + dateFormat: 'c' + }, { + name: 'deviceLimit', + type: 'int' }, { name: 'attributes' }], diff --git a/web/app/view/UserDialog.js b/web/app/view/UserDialog.js index 479d66d..a54a20c 100644 --- a/web/app/view/UserDialog.js +++ b/web/app/view/UserDialog.js @@ -47,14 +47,14 @@ Ext.define('Traccar.view.UserDialog', { name: 'readonly', fieldLabel: Strings.serverReadonly, allowBlank: false, - disabled: true, + hidden: true, reference: 'readonlyField' }, { xtype: 'checkboxfield', name: 'admin', fieldLabel: Strings.userAdmin, allowBlank: false, - disabled: true, + hidden: true, reference: 'adminField' }, { xtype: 'combobox', @@ -110,6 +110,26 @@ Ext.define('Traccar.view.UserDialog', { displayField: 'name', valueField: 'key', editable: false + }, { + xtype: 'checkboxfield', + name: 'disabled', + fieldLabel: Strings.userDisabled, + hidden: true, + reference: 'disabledField' + }, { + xtype: 'datefield', + name: 'expirationTime', + fieldLabel: Strings.userExpirationTime, + disabled: true, + reference: 'expirationTimeField', + startDay: Traccar.Style.weekStartDay, + format: Traccar.Style.dateFormat + }, { + xtype: 'numberfield', + name: 'deviceLimit', + fieldLabel: Strings.userDeviceLimit, + disabled: true, + reference: 'deviceLimitField' }] }, diff --git a/web/app/view/UserDialogController.js b/web/app/view/UserDialogController.js index 7c5cebd..cd0a951 100644 --- a/web/app/view/UserDialogController.js +++ b/web/app/view/UserDialogController.js @@ -21,8 +21,11 @@ Ext.define('Traccar.view.UserDialogController', { init: function () { if (Traccar.app.getUser().get('admin')) { - this.lookupReference('adminField').setDisabled(false); - this.lookupReference('readonlyField').setDisabled(false); + this.lookupReference('adminField').setHidden(false); + this.lookupReference('readonlyField').setHidden(false); + this.lookupReference('disabledField').setHidden(false); + this.lookupReference('expirationTimeField').setDisabled(false); + this.lookupReference('deviceLimitField').setDisabled(false); } }, diff --git a/web/l10n/en.json b/web/l10n/en.json index ee6bef8..bcbfa16 100644 --- a/web/l10n/en.json +++ b/web/l10n/en.json @@ -47,6 +47,9 @@ "userPassword": "Password", "userAdmin": "Admin", "userRemember": "Remember", + "userDisabled": "Disabled", + "userExpirationTime": "Expiration", + "userDeviceLimit": "Device Limit", "loginTitle": "Login", "loginLanguage": "Language", "loginRegister": "Register", -- cgit v1.2.3