diff options
author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2019-12-04 20:09:36 +0300 |
---|---|---|
committer | Derick Montague <derick.montague@ibm.com> | 2020-01-27 17:29:34 +0300 |
commit | 463a57062a1e1f91743e53acb27e867fc4c7584c (patch) | |
tree | 27945784f430356b1a64de354289e935d7568dfc /src/store/modules | |
parent | 28cb682967ef35b90f295834d2ffb105e1d30e21 (diff) | |
download | webui-vue-463a57062a1e1f91743e53acb27e867fc4c7584c.tar.xz |
Update local user component
- Add, edit, delete user basic functionality complete
- Rename components and creating separate modal components
- Update button styles to match design and included icons
- Update grid layout to use container with max width set
- Add aria labels to table action buttons
- Refactor LocalUserManagementStore
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Signed-off-by: Derick Montague <derick.montague@ibm.com>
Change-Id: Iab31ccabeb5a53ec03dc3ce3949fb20ded1ffbcf
Diffstat (limited to 'src/store/modules')
-rw-r--r-- | src/store/modules/AccessControl/LocalUserMangementStore.js | 44 |
1 files changed, 35 insertions, 9 deletions
diff --git a/src/store/modules/AccessControl/LocalUserMangementStore.js b/src/store/modules/AccessControl/LocalUserMangementStore.js index 41bbe0d8..de79a2d7 100644 --- a/src/store/modules/AccessControl/LocalUserMangementStore.js +++ b/src/store/modules/AccessControl/LocalUserMangementStore.js @@ -19,19 +19,45 @@ const LocalUserManagementStore = { getUsers({ commit }) { api .get("/redfish/v1/AccountService/Accounts") - .then(response => { - return response.data.Members.map(user => user["@odata.id"]); - }) - .then(userIds => { - return api.all(userIds.map(user => api.get(user))); - }) + .then(response => response.data.Members.map(user => user["@odata.id"])) + .then(userIds => api.all(userIds.map(user => api.get(user)))) .then(users => { const userData = users.map(user => user.data); commit("setUsers", userData); }) - .catch(error => { - console.log(error); - }); + .catch(error => console.log(error)); + }, + createUser({ dispatch }, { username, password, privilege, status }) { + const data = { + UserName: username, + Password: password, + RoleId: privilege, + Enabled: status + }; + api + .post("/redfish/v1/AccountService/Accounts", data) + .then(() => dispatch("getUsers")) + .catch(error => console.log(error)); + }, + updateUser( + { dispatch }, + { originalUsername, username, password, privilege, status } + ) { + const data = {}; + if (username) data.UserName = username; + if (password) data.Password = password; + if (privilege) data.RoleId = privilege; + if (status !== undefined) data.Enabled = status; + api + .patch(`/redfish/v1/AccountService/Accounts/${originalUsername}`, data) + .then(() => dispatch("getUsers")) + .catch(error => console.log(error)); + }, + deleteUser({ dispatch }, username) { + api + .delete(`/redfish/v1/AccountService/Accounts/${username}`) + .then(() => dispatch("getUsers")) + .catch(error => console.log(error)); } } }; |