Skip to content

feat: add raw JSON recovery actions - #29

Merged
jinbagi merged 1 commit into
masterfrom
codex/raw-json-recovery
Jul 3, 2026
Merged

feat: add raw JSON recovery actions#29
jinbagi merged 1 commit into
masterfrom
codex/raw-json-recovery

Conversation

@jinbagi

@jinbagi jinbagi commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Summary

  • add Reset draft and Reload latest actions to Raw JSON editor error states
  • let operators recover after failed raw PATCH saves without leaving the editor
  • cover failed raw save recovery with route Raw JSON E2E coverage

Verification

  • .\node_modules\.bin\tsc.CMD -b --pretty false
  • .\node_modules\.bin\eslint.CMD src/components/page/AdminApiJsonEditor.tsx e2e/tests/routes.edit-payload-preservation.spec.ts --max-warnings=0 --no-warn-ignored
  • E2E_TARGET_URL=http://127.0.0.1:55173/ui/ playwright test e2e/tests/routes.edit-payload-preservation.spec.ts --config=.tmp-playwright-chrome.config.ts --project=chrome --reporter=list --workers=1
  • corepack pnpm lint
  • corepack pnpm build

Copilot AI review requested due to automatic review settings July 3, 2026 11:21
@jinbagi
jinbagi merged commit 49a67aa into master Jul 3, 2026
@jinbagi
jinbagi deleted the codex/raw-json-recovery branch July 3, 2026 11:22

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04f4559f2a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +116 to +118
test('raw JSON save failure offers reset and reload recovery actions', async ({
page,
}) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Mark shared route tests as serial

Because playwright.config.ts enables fullyParallel: true, adding this second test lets the two tests in this file run in separate workers while each worker's file-level setup/teardown still calls deleteAllRoutes. When those workers overlap, this test's setup or teardown can delete the route the other test is currently editing (or vice versa), so the suite becomes flaky outside the single-worker command used in the commit; mark this file/describe as serial or avoid global route cleanup for these shared-resource tests.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Raw JSON editor recovery flow in the APISIX Dashboard by adding explicit “Reset draft” and “Reload latest” actions when a raw PATCH save fails, and extends E2E coverage to validate those recovery controls on the Routes detail page.

Changes:

  • Added “Reset draft” and “Reload latest” actions to the Raw JSON editor error state.
  • Refactored reset behavior into a shared callback and expanded it to clear error/feedback state.
  • Added an E2E spec that simulates a raw PATCH failure and verifies the recovery actions appear and that “Reload latest” refreshes editor content.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/components/page/AdminApiJsonEditor.tsx Adds recovery actions and refactors reset/reload handlers in the Raw JSON editor UI.
e2e/tests/routes.edit-payload-preservation.spec.ts Adds E2E coverage to ensure recovery actions are available after a failed raw save and “Reload latest” updates the editor.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +206 to +210
setSaveFeedback({
type: 'success',
message: 'Reloaded latest APISIX resource state.',
at: new Date().toLocaleTimeString(),
});
Comment on lines 534 to 538
<Button
size="small"
onClick={() => {
userEditedRef.current = false;
setValue(original);
}}
onClick={handleResetDraft}
disabled={!isDirty}
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants