Skip to content

Fix admin claim action errors and status-based buttons#303

Merged
GsCommand merged 1 commit into
mainfrom
codex/improve-admin-claim-action-ux
May 23, 2026
Merged

Fix admin claim action errors and status-based buttons#303
GsCommand merged 1 commit into
mainfrom
codex/improve-admin-claim-action-ux

Conversation

@GsCommand
Copy link
Copy Markdown
Contributor

Motivation

  • Improve admin claim UX so invalid actions are not offered and the UI surfaces the real API failure reason instead of a generic alert.
  • Prevent confusing approve/reject clicks on already-approved claims by hiding buttons and showing inline errors for expected validation failures.

Description

  • Update API api/admin/claim-action.js to return explicit invalid-transition payloads including status: 'INVALID_STATUS_TRANSITION', error, fromStatus, and action for expected validation failures while keeping ADMIN_CLAIM_ACTION_FAILED for unexpected exceptions.
  • Replace alert() error handling in public/admin/claims.html with an inline error panel rendered in the claim detail area using a claimActionError state and an .error-panel CSS style, and clear the panel after successful actions.
  • Change claim-detail button rendering logic in public/admin/claims.html so actions are shown only when valid for the current status (e.g., hide Approve for approved claims, show Mark failed where allowed, add override flow for rejected).
  • Add/adjust tests in tests/api-admin-claims.test.js to assert that approving an already-approved claim returns INVALID_STATUS_TRANSITION with error, fromStatus, and action fields.

Testing

  • Ran npm test and all tests passed (73 tests, 0 failures), including the new/updated invalid-transition assertions.
  • Ran cd examples/webhook-auto-verify && npm run check and it completed successfully.
  • Verified that claim-detail UI now renders an inline error panel for API validation failures and that successful actions clear the panel and refresh claim detail and list.

Codex Task

@vercel
Copy link
Copy Markdown

vercel Bot commented May 23, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
commandlayer-commandlayer-org Ready Ready Preview, Comment May 23, 2026 8:23pm
commandlayer-org Ready Ready Preview, Comment May 23, 2026 8:23pm
commandlayer-org111 Ready Ready Preview, Comment May 23, 2026 8:23pm

Request Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant