X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=skyquake%2Fplugins%2Fuser-management%2Fsrc%2Fdashboard%2FuserMgmtStore.js;h=19952fba617458a8d19b23f9169b78ff99241ab0;hb=c637db2bc817cb1cd1a4a20655bf7e01b1c490bd;hp=407d9d2d4b2e95639d7c01629e62b2144fcbce85;hpb=939003042b55d4d24dfbb11daac75821f65c04dc;p=osm%2FUI.git diff --git a/skyquake/plugins/user-management/src/dashboard/userMgmtStore.js b/skyquake/plugins/user-management/src/dashboard/userMgmtStore.js index 407d9d2d4..19952fba6 100644 --- a/skyquake/plugins/user-management/src/dashboard/userMgmtStore.js +++ b/skyquake/plugins/user-management/src/dashboard/userMgmtStore.js @@ -11,7 +11,7 @@ export default class UserManagementStore { this.registerAsync(UserManagementSource); this.users = []; this['user-name'] = ''; - this['user-domain'] = ''; + this['user-domain'] = 'system'; this.disabled = false; this.platformRoles = { super_admin: false, @@ -26,6 +26,7 @@ export default class UserManagementStore { this['confirm-password'] = ''; this.activeIndex = null; + this.isReadOnly = true; this.userOpen = false; this.hideColumns = false; this.isEdit = false; @@ -75,14 +76,21 @@ export default class UserManagementStore { let state = _.merge({ activeIndex: userIndex, userOpen: true, - isEdit: true + isEdit: true, + isReadOnly: true }, ActiveUser); this.setState(state) } + editUser(isEdit) { + this.setState({ + isReadOnly: isEdit + }) + } handleCloseUserPanel() { this.setState({ userOpen: false, - isEdit: false + isEdit: false, + isReadOnly: true }) } handleHideColumns(e) { @@ -112,7 +120,7 @@ export default class UserManagementStore { } resetUser() { let username = ''; - let domain = ''; + let domain = 'system'; let disabled = false; let platformRoles = { super_admin: false, @@ -149,7 +157,14 @@ export default class UserManagementStore { } } handleAddUser() { - this.setState(_.merge( this.resetUser() ,{ isEdit: false, userOpen: true })) + this.setState(_.merge( this.resetUser() , + { + isEdit: false, + userOpen: true, + activeIndex: null, + isReadOnly: false + } + )) } handleCreateUser() { @@ -172,7 +187,11 @@ export default class UserManagementStore { disabled: this.disabled, projectRoles: this.projectRoles } - this.setState({users}) + this.setState({ + users, + isEdit: true, + isReadOnly: true + }) } deleteUserSuccess() { this.alt.actions.global.hideScreenLoader.defer(); @@ -188,9 +207,14 @@ export default class UserManagementStore { 'user-domain': this['user-domain'], platformRoles: this.platformRoles, disabled: this.disabled, - projectRoles: this.projectRoles + projectRoles: this.projectRoles, }); - let newState = {users, isEdit: true}; + let newState = { + users, + isEdit: true, + isReadOnly: true, + activeIndex: users.length - 1 + }; _.merge(newState, this.resetPassword()) this.setState(newState); }