Repository navigation
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review of the diff
The intent (block deletion of admin users) is reasonable, but there are several things worth checking.
1. Correctness of the rule
row.rolea single value or an array? If the backend returnsroles: ['ADMIN', ...]or aroleCode,row.role === ROLE_TYPE.ADMINwill silently befalseand the guard won't work. Verify the actual field name/shape of the user DTO.SUPER_ADMIN,OPERATOR, tenant-owner, etc., they also need protection. Prefer a set-based check:ROLE_TYPE.ADMIN(string vs. number enum) matches the runtime type ofrow.role; a strict===against a mismatched type fails silently.ROLE_TYPEimported? In<script setup>templates this resolves fine only if it's imported / exposed. If it isn't, you'll get a runtime "property of undefined" error rather than a compile error — double-check the import.2. Front-end checks are UX only
Disabling the button does not enforce anything. Anyone can call the delete API directly (devtools, curl). Make sure the same rule is enforced server-side and returns a clear 403/409 error. Ideally also handle that error in
deleteUser()and re-sync the list.3. Readability / maintainability
perm.system.user.delete(), already used inv-if) and business rule (can't delete admins). Consider naming it accordingly (e.g.isProtectedUser(row)).4. UX / accessibility
MkTooltipwrapping it may not show. If users need to understand why it's disabled, wrap the button in a<span>(or useel-tooltipwith a wrapper) and set the tooltip content conditionally:textbuttons can be nearly invisible against the background — verify contrast in both light/dark themes.@click.stopis harmless when disabled, but if you wrap in a span, keep it so clicks don't bubble to the row handler.5. Minor style nits
prettier/eslint-plugin-vue).textbeforetypeonly if your lint order config demands it — otherwise irrelevant.6. Testing
Add a component test asserting the button is disabled for: (a) admin row, (b) the current user's own row, (c) enabled for a normal user. Also add an API-level test that the backend rejects deleting an admin.
Summary
The change is functional for the happy path, but:
row.roleshape/type and thatROLE_TYPEis imported;ADMIN;