1
0
mirror of https://github.com/quay/quay.git synced 2026-01-26 06:21:37 +03:00
OpenShift Cherrypick Robot 32602f5c32 [redhat-3.16] chore: migrate SidebarState and AlertState from Recoil to React Context (#4481)
* chore: migrate SidebarState and AlertState from Recoil to React Context

Migrates UI state management from Recoil atoms to a centralized
UIContext using pure React Context API. This is part of the broader
effort to simplify state management and reduce dependencies.

Changes:
- Create UIContext with sidebar and alert state management
- Migrate SidebarState: isSidebarOpen with localStorage persistence
- Migrate AlertState: alerts array with add/remove/clear operations
- Move AlertVariant enum and AlertDetails interface to UIContext
- Remove UseAlerts hook (now redundant - consumers use useUI directly)
- Update Alerts component to use removeAlert from context
- Update QuayHeader and QuaySidebar to use useUI hook
- Update 128 files to import types/hooks from UIContext
- Delete AlertState.ts, SidebarState.ts, and UseAlerts.ts

Benefits:
- Zero runtime logic changes for consumers
- Centralized UI state in single context
- Reduced Recoil surface area (2 fewer atoms)
- Simpler architecture (removed unnecessary hook wrapper)
- Future-proof for additional UI state (theme, plugin mode)
- Pure React with no external dependencies for UI state

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Brady Pratt <bpratt@redhat.com>

* fix(ui): add toast alerts for create organization, repository, and application token operations

Adds success and failure toast alerts to create operations that previously
only showed inline error messages. This provides consistent feedback across
all CRUD operations and ensures users receive confirmation after modals close.

Also fixes browser compatibility issue in UIContext by replacing
crypto.randomUUID() with Math.random().toString(36) for alert key generation,
maintaining compatibility with the original UseAlerts implementation.

Changes:
- Add toast alerts to CreateOrganizationModal for create org operations
- Add toast alerts to CreateRepoModalTemplate for create repo operations
- Add toast alerts to CreateApplicationTokenModal for token creation
- Fix UIContext to use Math.random() instead of crypto.randomUUID()
- Maintain existing inline error displays for immediate validation feedback

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>

* fix(ui): clear alerts on route navigation to prevent stale alerts from persisting

Adds route-level alert cleanup to StandaloneMain to clear all alerts when
navigating between routes. This prevents old alerts from accumulating and
reappearing when users return to previously visited pages.

Previously, alerts (especially failure alerts which don't auto-dismiss) would
persist in UIContext state and re-render when navigating back to a page. Now
alerts are automatically cleared whenever the route pathname changes.

Changes:
- Add useLocation hook to track route changes
- Add clearAllAlerts from UIContext
- Add useEffect to clear alerts on location.pathname change
- Ensures fresh alert state for each route

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude <noreply@anthropic.com>
Signed-off-by: Brady Pratt <bpratt@redhat.com>

* chore: address coderabbit feedback

- fix early return, initialize the useEffect first
- call props.toggleModal()
- fix entityType shadowing
- improve grammar in alerts for ToggleUserStatusModal

Signed-off-by: Brady Pratt <bpratt@redhat.com>

* fix(ui): wait for collaborator deletion before closing modal

The CollaboratorsDeleteModal was closing immediately after clicking delete,
causing it to unmount before the async deletion completed. This prevented
the success alert from appearing because the useEffect hook that adds the
alert never fired after component unmount.

Fixed by moving the toggleModal() call from the delete button's onClick
handler into the success and error useEffect hooks, ensuring the modal
stays open until the mutation completes and the alert is displayed.

Co-authored-by: Claude <noreply@anthropic.com>

---------

Signed-off-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Brady Pratt <bpratt@redhat.com>
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-06 23:00:08 +00:00
2022-06-16 16:52:52 +02:00
2019-11-12 11:09:47 -05:00
2022-07-22 13:11:39 -04:00
2019-11-12 11:09:47 -05:00
2019-11-12 11:09:47 -05:00
2019-11-12 11:09:47 -05:00
2024-08-21 15:42:08 -04:00
2025-01-14 18:33:02 +00:00
2019-11-12 11:09:47 -05:00
2019-11-12 11:09:47 -05:00
2019-11-12 11:09:47 -05:00

Project Quay

CI Container Repository on Quay

⚠️ The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order to get stable software.

Project Quay Logo

Project Quay builds, stores, and distributes your container images.

High-level features include:

Getting Started

  • Explore a live instance of Project Quay hosted at Quay.io
  • Watch talks given about Project Quay
  • Review the documentation for Red Hat Quay
  • Get up and running with our getting started guide for developing or deploying Quay
  • Deploy on Kubernetes using the Quay Operator

Community

License

Project Quay is under the Apache 2.0 license. See the LICENSE file for details.

Description
Создавайте, храните и распространяйте свои приложения и контейнеры
https://www.projectquay.io
Readme Apache-2.0 246 MiB
Languages
Python 54.8%
TypeScript 25.1%
JavaScript 8.8%
HTML 5.5%
CSS 2.8%
Other 2.8%