webui: user management bug fixes
Bug fixes in user management
- Removed granular error messages which is causing
issues in non-redfish (rest api) case.
- Set default password show button state.
- Delete button missing in table issue fix.
- Role dropdown not proper issue fix.
- Associating label element with 'for' attributes.
Change-Id: I6c5bb25837bb2fcbcb131a88060e6acf603ca5a2
Signed-off-by: AppaRao Puli <apparao.puli@linux.intel.com>
diff --git a/app/users/controllers/user-accounts-controller.html b/app/users/controllers/user-accounts-controller.html
index d37c5e1..fd9d7cf 100644
--- a/app/users/controllers/user-accounts-controller.html
+++ b/app/users/controllers/user-accounts-controller.html
@@ -3,7 +3,7 @@
<div class="row column">
<h1>User account information</h1>
</div>
- <div class="table row column" ng-show="users.length != 0">
+ <div class="table row column user-list__tbl" ng-show="users.length != 0">
<div class="table__head">
<div class="table__row">
<div class="table__cell"> Username </div>
@@ -20,8 +20,8 @@
<div class="table__cell"> {{user.RoleId}} </div>
<div class="table__cell"> {{user.Locked}} </div>
<div class="table__cell">
- <button type="button" class="btn-primary inline" ng-disabled="isUserSelected" ng-click="setSelectedUser(user)">Edit</button>
- <button type="button" class="btn-primary inline" ng-disabled="isUserSelected" ng-click="deleteUser(user.UserName)">Delete</button>
+ <button type="button" class="btn-edit inline" ng-disabled="isUserSelected" ng-click="setSelectedUser(user)">Edit</button>
+ <button type="button" class="btn-delete inline" ng-disabled="isUserSelected" ng-click="deleteUser(user.UserName)">Delete</button>
</div>
</div>
</div>
@@ -36,15 +36,15 @@
<h2 class="inline h4">User account settings</h2>
</div>
<div class='col-sm-12'>
- <label class="col-md-1 control-label">UserName</label>
+ <label class="col-md-1 control-label" for="user-manage__username">UserName</label>
<div class="col-md-3">
- <input type="text" class="form-control" name="UserName" ng-model="selectedUser.UserName" />
+ <input type="text" name="UserName" id="user-manage__username" ng-model="selectedUser.UserName" />
</div>
</div>
<div class='col-sm-12 inline'>
- <label class="col-md-1 control-label">Password</label>
+ <label class="col-md-1 control-label" for="user-manage__passwd">Password</label>
<div class="col-md-3 user-manage__input-wrapper inline">
- <input type="{{showpassword ? 'text' : 'password'}}" class="form-control user-manage__new-password inline" name="Password" ng-model="selectedUser.Password" autocomplete="off"/>
+ <input type="{{showpassword ? 'text' : 'password'}}" class="user-manage__new-password inline" name="Password" id="user-manage__passwd" ng-model="selectedUser.Password" autocomplete="off"/>
<button ng-model="showpassword" ng-click="togglePassword = !togglePassword; showpassword = !showpassword;" class="password-toggle">
<span ng-hide="togglePassword">Show</span>
<span ng-show="togglePassword">Hide</span>
@@ -52,9 +52,9 @@
</div>
</div>
<div class='col-sm-12'>
- <label class="col-md-1 control-label">Retype Password</label>
+ <label class="col-md-1 control-label" for="user-manage__verifypasswd">Retype Password</label>
<div class="col-md-3 user-manage__input-wrapper inline">
- <input type="{{showpasswordVerify ? 'text' : 'password'}}" class="form-control user-manage__verify-password inline" name="VerifyPassword" ng-model="selectedUser.VerifyPassword" autocomplete="off">
+ <input type="{{showpasswordVerify ? 'text' : 'password'}}" class="user-manage__verify-password inline" name="VerifyPassword" id="user-manage__verifypasswd" ng-model="selectedUser.VerifyPassword" autocomplete="off">
<button ng-model="showpasswordVerify" ng-click="toggleVerify = !toggleVerify; showpasswordVerify = !showpasswordVerify;" class="password-toggle">
<span ng-hide="toggleVerify">Show</span>
<span ng-show="toggleVerify">Hide</span>
@@ -62,18 +62,18 @@
</div>
</div>
<div class='col-sm-12'>
- <label class="col-md-1 control-label">Role</label>
+ <label class="col-md-1 control-label" for="user-manage__role">Role</label>
<div class="col-md-3 user-manage__input-wrapper inline">
- <select ng-model="selectedUser.RoleId" class="form-control inline">
+ <select ng-model="selectedUser.RoleId" id="user-manage__role" class="inline">
<option ng-repeat="role in roles" class="inline">{{role}}</option>
</select>
</div>
</div>
<div class='col-sm-12'>
- <label class="col-md-1 control-label">Enabled</label>
+ <label class="col-md-1 control-label" for="user-manage__enabled">Enabled</label>
<div class="col-md-3 user-manage__input-wrapper inline">
<label class="control-check">
- <input type="checkbox" name="Enabled" ng-model="selectedUser.Enabled"/>
+ <input type="checkbox" name="Enabled" id="user-manage__enabled" ng-model="selectedUser.Enabled"/>
<span class="control__indicator"></span>
</label>
</div>
diff --git a/app/users/controllers/user-accounts-controller.js b/app/users/controllers/user-accounts-controller.js
index 4148f54..b76d812 100644
--- a/app/users/controllers/user-accounts-controller.js
+++ b/app/users/controllers/user-accounts-controller.js
@@ -22,6 +22,9 @@
$scope.loading = true;
$scope.isUserSelected = false;
$scope.selectedUser = null;
+ $scope.togglePassword = false;
+ $scope.toggleVerify = false;
+
$q.all([
APIUtils.getAllUserAccounts().then(
function(res) {
@@ -89,14 +92,7 @@
},
function(error) {
$scope.state = 'error';
- if ((error.data.error['@Message.ExtendedInfo'] !=
- undefined) &&
- (error.data.error['@Message.ExtendedInfo'].length != 0)) {
- $scope.outMsg =
- error.data.error['@Message.ExtendedInfo'][0].Message;
- } else {
- $scope.outMsg = 'Failed to create new user.';
- }
+ $scope.outMsg = 'Failed to create new user';
})
.finally(function() {
loadUserInfo();
@@ -136,14 +132,7 @@
},
function(error) {
$scope.state = 'error';
- if ((error.data.error['@Message.ExtendedInfo'] !=
- undefined) &&
- (error.data.error['@Message.ExtendedInfo'].length != 0)) {
- $scope.outMsg =
- error.data.error['@Message.ExtendedInfo'][0].Message;
- } else {
- $scope.outMsg = 'Updating user failed.';
- }
+ $scope.outMsg = 'Updating user failed';
})
.finally(function() {
loadUserInfo();
@@ -163,14 +152,7 @@
},
function(error) {
$scope.state = 'error';
- if ((error.data.error['@Message.ExtendedInfo'] !=
- undefined) &&
- (error.data.error['@Message.ExtendedInfo'].length != 0)) {
- $scope.outMsg =
- error.data.error['@Message.ExtendedInfo'][0].Message;
- } else {
- $scope.outMsg = 'Deleting user failed.';
- }
+ $scope.outMsg = 'Deleting user failed';
})
.finally(function() {
loadUserInfo();
diff --git a/app/users/styles/user-accounts.scss b/app/users/styles/user-accounts.scss
index fb6d162..3093546 100644
--- a/app/users/styles/user-accounts.scss
+++ b/app/users/styles/user-accounts.scss
@@ -1,5 +1,24 @@
$userInputHeight: 40px;
+.user-list__tbl {
+ .btn-edit,
+ .btn-delete {
+ padding: .5em 1em;
+ min-height: 2em;
+ color: $primebtn__text;
+ background: $primebtn__bg;
+ &:hover {
+ background: rgba($primebtn__bg, .8);
+ @include fastTransition-all;
+ }
+ &:disabled {
+ background: $btn__disabled-bg;
+ color: $btn__disabled-txt;
+ @include fastTransition-all;
+ cursor: default;
+ }
+ }
+}
.user-manage__form {
width: 100%;
.dropdown__button {