Divyanshu | Widget Improvements#520
Conversation
- Change widget type from Authorization to UserManagement in app component - Update auth token for UserManagement widget - Improve comment clarity for isPreview and isRolePermission config options - Fix user profile update subscription timing using skip(1) operator - Add change detection trigger after successful profile update - Dispatch updateUser action after subscribing to observables - Update baseUrl to localhost for local
- Disable role permissions tab by default in widget config - Replace display:none with Tailwind hidden class for better consistency - Add CSS variables for header and body height management - Fix layout height calculations for proper scrolling behavior - Remove duplicate "Default" badge from role display - Add "Select all" checkboxes for role and user permissions - Fix readonly attribute binding in user form inputs - Remove debug
…n/proxy-ui into divyanshu-dev
There was a problem hiding this comment.
Other comments (8)
-
apps/36-blocks-widget/src/app/otp/user-management/user-management.component.html (773-773)
The `[attr.readonly]` binding has an incorrect pattern. When `isEditUser` is falsy, it will set `readonly="null"` instead of removing the attribute.
[attr.readonly]="isEditUser ? '' : null" -
apps/36-blocks-widget/src/app/otp/user-management/user-management.component.html (836-836)
The `[attr.readonly]` binding has the same issue in the mobile number input field.
[attr.readonly]="isEditUser ? '' : null" - apps/36-blocks-widget/src/app/app.component.ts (10-12) The PR changes the widget type from `Authorization` to `UserManagement` and updates the AUTH_TOKEN. Please confirm that this new token has the appropriate permissions for the UserManagement widget type to avoid runtime authorization issues.
-
apps/36-blocks-widget/src/app/otp/user-management/user-management.component.html (816-816)
The `[attr.readonly]` binding has the same issue in the email input field.
[attr.readonly]="isEditUser ? '' : null" -
apps/36-blocks-widget/src/app/otp/user-management/user-management.component.ts (698-702)
The `allUserPermissionsSelected` method should handle the case where there are no available permissions:
public allUserPermissionsSelected(): boolean { const available = this.getAvailableAdditionalPermissions(); if (available.length === 0) return false; const selected: number[] = this.addUserForm.get('permission')?.value ?? []; return available.every((p) => selected.includes(p.id)); } -
apps/36-blocks-widget/src/assets/scss/widget-ui.scss (247-247)
Adding a fixed `min-width: 500px` to the dialog panel could cause layout issues on mobile devices with smaller screens. Consider using a responsive approach that adapts to different screen sizes, such as:
flex flex-col max-h-[85vh] min-w-[min(500px,95vw)]This ensures the dialog is either 500px or 95% of the viewport width, whichever is smaller.
-
apps/36-blocks-widget/src/app/otp/user-management/user-management.component.ts (381-384)
Consider adding a check to avoid redundant API calls when permissions are already loaded:
if (tab === UserManagementTab.Roles) { this.isRolesLoading = true; this.getRoles(); if (this.permissions.length === 0) { this.getPermissions(); } } -
apps/36-blocks-widget/src/app/otp/user-management/user-management.component.ts (293-302)
The error handling could be improved to better handle network errors or other unexpected error structures:
.subscribe(({ errorResponse }) => { let msg = 'Something went wrong. Please try again.'; if (errorResponse) { if (errorResponse.status === 0) { msg = 'Network error. Please check your connection.'; } else { msg = errorResponse?.error?.errors?.message || errorResponse?.error?.data?.message || errorResponse?.errors?.message || errorResponse?.data?.message || errorResponse?.message || msg; } } this.toastService.error(msg); this.cdr.markForCheck(); });
💡 To request another review, post a new comment with "/windsurf-review".
| env: 'local', | ||
| apiUrl: 'https://apitest.msg91.com/api', | ||
| baseUrl: 'https://test.proxy.msg91.com', | ||
| baseUrl: 'http://localhost:4200', |
There was a problem hiding this comment.
Changing the baseUrl to localhost in the environment.ts file might be helpful for your local development, but committing this change could cause issues for other team members and in deployment environments.
Consider:
- Using environment.local.ts (added to .gitignore) for local overrides
- Reverting this change before merging
- Using environment variables or a configuration service that can be overridden locally without changing the committed files
| // Enables the Role & Permission tab in the User Management widget | ||
| widgetConfig['isRolePermission'] = false; |
There was a problem hiding this comment.
The isRolePermission flag has been changed from true to false, which will disable the Role & Permission tab in the User Management widget. Is this intentional? If so, please document the reason for this change in the PR description.
| <label for="user-name" class="w-label" | ||
| >Full name <span class="text-red-500" aria-hidden="true">*</span></label | ||
| >Full name <span class="text-red-500" aria-hidden="true">*</span> | ||
| {{ isEditUser }}</label |
There was a problem hiding this comment.
There's a debugging expression {{ isEditUser }} in the Full name label that will render 'true' or 'false' in the UI. This should be removed.
No description provided.