Skip to content

feat: add close button to app resources - #8137

Merged
grantfitzsimmons merged 2 commits into
mainfrom
issue-8136
Jun 1, 2026
Merged

feat: add close button to app resources#8137
grantfitzsimmons merged 2 commits into
mainfrom
issue-8136

Conversation

@grantfitzsimmons

@grantfitzsimmons grantfitzsimmons commented May 28, 2026

Copy link
Copy Markdown
Member

Fixes #8136

This PR adds a "Close" button to all app resources. This routes the user back to the main app resource page, as if they had not selected anything. If there are unsaved changes, the user will be warned before proceeding.

image

Checklist

  • Self-review the PR after opening it to make sure the changes look good and
    self-explanatory (or properly documented)
  • Add relevant issue to release milestone

Testing instructions

  • Open every type of app resource and form definition
  • Verify that 'Close' closes the resource view
  • Open every type of app resource and form definition and make a change
  • Verify that you see the "Are you sure you want to leave this page?" warning

Summary by CodeRabbit

  • Refactor
    • Improved close button functionality in the AppResources editor for better navigation handling.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c1359d84-b7d7-4d67-b97e-99aaa1d718db

📥 Commits

Reviewing files that changed from the base of the PR and between 9499aa1 and ddc6e95.

📒 Files selected for processing (1)
  • specifyweb/frontend/js_src/lib/components/AppResources/Editor.tsx

📝 Walkthrough

Walkthrough

AppResources/Editor.tsx now integrates React Router's useNavigate hook to implement a close button. The component imports useNavigate, initializes the hook, and updates the footer's close control to navigate back to the resources list view using replace-mode navigation.

Changes

Close Button Navigation

Layer / File(s) Summary
Close button with navigation
specifyweb/frontend/js_src/lib/components/AppResources/Editor.tsx
Adds useNavigate import from react-router-dom, initializes the navigate hook inside AppResourceEditor, and wires the footer close button to navigate to /specify/resources/ with { replace: true }.
🚥 Pre-merge checks | ✅ 5 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Automatic Tests ⚠️ Warning PR adds Close button with navigation functionality to AppResourceEditor but includes no automatic tests. Repository has 49 existing tests in AppResources; new button behavior should be tested. Add tests for the new Close button functionality, including verifying the button renders and calls navigate() with correct parameters when clicked.
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a close button to app resources, matching the core objective from the linked issue.
Linked Issues check ✅ Passed The PR successfully implements the requested feature [#8136]: a Close button that navigates users back to the main app resource page with proper unsaved changes warning.
Out of Scope Changes check ✅ Passed All changes are scoped to adding the Close button functionality to the Editor component, directly addressing the linked issue requirement.
Testing Instructions ✅ Passed Testing instructions are clear and cover affected components. Testing all resource types verifies Close button functionality, and unsaved changes test aligns with SaveButton's unload protection.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-8136

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai

coderabbitai Bot commented May 28, 2026

Copy link
Copy Markdown
Contributor

Actionable comments posted: 0

@grantfitzsimmons grantfitzsimmons added this to the 7.12.1 milestone May 28, 2026
g1rly-c0d3r

This comment was marked as duplicate.

@g1rly-c0d3r g1rly-c0d3r left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Open every type of app resource and form definition
  • Verify that 'Close' closes the resource view
  • Open every type of app resource and form definition and make a change
  • Verify that you see the "Are you sure you want to leave this page?" warning

Looks good! The close button does take you back to *.specifysystems.org/specify/resources.
I did notice that in the form editor, if there is an XML parsing error, the "Are you sure you want to leave this page?" warning does not appear. This seemed to only happen if that was the first edit that I made, though.

@grantfitzsimmons
grantfitzsimmons requested a review from a team June 1, 2026 15:07

@bhumikaguptaa bhumikaguptaa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Open every type of app resource and form definition
  • Verify that 'Close' closes the resource view
  • Open every type of app resource and form definition and make a change
  • Verify that you see the "Are you sure you want to leave this page?" warning

Works as expected, I ran into no errors.

Image

@bhumikaguptaa
bhumikaguptaa requested a review from a team June 1, 2026 15:56

@emenslin emenslin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

  • Open every type of app resource and form definition
  • Verify that 'Close' closes the resource view
  • Open every type of app resource and form definition and make a change
  • Verify that you see the "Are you sure you want to leave this page?" warning

Looks good, I checked every type of resource and all work as expected.

@grantfitzsimmons
grantfitzsimmons merged commit d8bd344 into main Jun 1, 2026
18 checks passed
@grantfitzsimmons
grantfitzsimmons deleted the issue-8136 branch June 1, 2026 17:32
@github-project-automation github-project-automation Bot moved this from 📋Back Log to ✅Done in General Tester Board Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: ✅Done

Development

Successfully merging this pull request may close these issues.

Add a 'Close' button to the app resources viewer

5 participants