-
Notifications
You must be signed in to change notification settings - Fork 2
Fix/frontend errors #272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Fix/frontend errors #272
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
0953488
Fix/user menu logout and sso login translations
mateodurante b1ae284
Feature/search inputs clear button
mateodurante a4f0b6e
Style/search clear button inside input
mateodurante 87297b2
Style/keep search input focus border visible
mateodurante d26d04f
Revert "Style/keep search input focus border visible"
mateodurante 8a1a77f
Style/focus ring around search input and button
mateodurante 0e0d323
Revert "Style/focus ring around search input and button"
mateodurante b1dccba
Style/merge search input and button into one group with shared focus
mateodurante 91e6c3c
Style/focus ring on search input only
mateodurante 49d7ff3
Fix/avoid unnecessary search when clearing unsubmitted text
mateodurante c1b6be5
Feature/apply search on input blur without double submit
mateodurante c018759
Feature/filter toolbar on all search list views
mateodurante 7356984
Style/keep list header controls on a single line
mateodurante 11bc3c1
Refactor/unify list view headers with ListViewHeader component
mateodurante 4a68fc9
Style/unify list views card wrapper and full width
mateodurante 5484451
Fix/remove col-sm-auto card wrappers per template docs structure
mateodurante 3506f7f
Style/apply official Row Col Card structure to all admin pages
mateodurante 3b734b5
Feature/login connection status indicator with polling
mateodurante fde5917
Fix/add connection status translations
mateodurante e89a2c2
Style/place connection indicator next to auth lock icon
mateodurante a7becd7
Feature/shared backend health monitoring with leader election
mateodurante 2f684ab
Revert "Feature/shared backend health monitoring with leader election"
mateodurante d321c8d
Refactor/backend health check with tanstack query and leader election
mateodurante 06cd513
Style/red lightning inside login button and logo reload on reconnect
mateodurante aae28d7
Style/tooltip only when disconnected
mateodurante a53e8e0
Style/login validation via is-invalid inputs and button tooltip
mateodurante d4a9d66
Style/remove login button tooltip and persist invalid border in dark …
mateodurante deb8b78
Style/inline validation messages under login inputs and tighter spacing
mateodurante c40223c
copilot reviews
mateodurante File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| const CHANNEL_NAME = "ngen_health"; | ||
| const LOCK_NAME = "ngen_health_leader"; | ||
| const STATUS_KEY = "ngen_health_status"; | ||
|
|
||
| let channel = null; | ||
| try { | ||
| channel = new BroadcastChannel(CHANNEL_NAME); | ||
| } catch (e) { | ||
| channel = null; | ||
| } | ||
|
|
||
| export const readCachedStatus = () => localStorage.getItem(STATUS_KEY); | ||
|
|
||
| export const writeCachedStatus = (status) => { | ||
| localStorage.setItem(STATUS_KEY, status); | ||
| }; | ||
|
|
||
| export const publishHealthStatus = (status) => { | ||
| try { | ||
| channel && channel.postMessage({ status }); | ||
| } catch (e) { | ||
| // ignore | ||
| } | ||
| }; | ||
|
|
||
| export const subscribeHealthStatus = (callback) => { | ||
| if (channel) { | ||
| channel.onmessage = (e) => { | ||
| if (e.data?.status) callback(e.data.status); | ||
| }; | ||
| } | ||
| return () => {}; | ||
| }; | ||
|
|
||
| export const subscribeLeadership = (callback) => { | ||
| if (!navigator.locks || !navigator.locks.request) { | ||
| callback(true); | ||
| return () => {}; | ||
| } | ||
|
|
||
| let cancelled = false; | ||
| let release = null; | ||
|
|
||
| navigator.locks.request(LOCK_NAME, async () => { | ||
| if (cancelled) return; | ||
| callback(true); | ||
| return new Promise((resolve) => { | ||
| release = resolve; | ||
| }); | ||
| }); | ||
|
|
||
| return () => { | ||
| cancelled = true; | ||
| release && release(); | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| import React from "react"; | ||
| import { Col, Row } from "react-bootstrap"; | ||
| import Search from "../Search/Search"; | ||
| import FilterToolbar from "../Button/FilterToolbar"; | ||
|
|
||
| const ListViewHeader = ({ | ||
| open, | ||
| setOpen, | ||
| onReload, | ||
| onClearFilters, | ||
| searchType, | ||
| wordToSearch, | ||
| setWordToSearch, | ||
| setLoading, | ||
| setCurrentPage, | ||
| children | ||
| }) => { | ||
| return ( | ||
| <Row> | ||
| <Col sm="auto"> | ||
| <FilterToolbar open={open} setOpen={setOpen} onReload={onReload} onClearFilters={onClearFilters} /> | ||
| </Col> | ||
| <Col> | ||
| <Search | ||
| type={searchType} | ||
| setWordToSearch={setWordToSearch} | ||
| wordToSearch={wordToSearch} | ||
| setLoading={setLoading} | ||
| setCurrentPage={setCurrentPage} | ||
| /> | ||
| </Col> | ||
| <Col sm="auto" className="d-flex gap-1"> | ||
| {children} | ||
| </Col> | ||
| </Row> | ||
| ); | ||
| }; | ||
|
|
||
| export default ListViewHeader; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { useEffect, useState } from "react"; | ||
| import { useQuery, useQueryClient } from "@tanstack/react-query"; | ||
| import { COMPONENT_URL } from "config/constant"; | ||
| import { | ||
| publishHealthStatus, | ||
| readCachedStatus, | ||
| subscribeHealthStatus, | ||
| subscribeLeadership, | ||
| writeCachedStatus | ||
| } from "api/services/backendHealth"; | ||
|
|
||
| const fetchHealth = async () => { | ||
| const apiServer = localStorage.getItem("API_SERVER"); | ||
| if (!apiServer) { | ||
| throw new Error("API_SERVER is not set"); | ||
| } | ||
| const res = await fetch(apiServer + COMPONENT_URL.health, { cache: "no-store" }); | ||
| if (!res.ok) { | ||
| throw new Error("Backend health check failed"); | ||
| } | ||
| return res.json(); | ||
| }; | ||
|
|
||
| const useBackendHealth = () => { | ||
| const queryClient = useQueryClient(); | ||
| const [isLeader, setIsLeader] = useState(false); | ||
|
|
||
| useEffect(() => subscribeLeadership(setIsLeader), []); | ||
|
|
||
| useEffect( | ||
| () => | ||
| subscribeHealthStatus((status) => { | ||
| writeCachedStatus(status); | ||
| queryClient.setQueryData(["backend-health"], { status }); | ||
| }), | ||
| [queryClient] | ||
| ); | ||
|
|
||
| const query = useQuery({ | ||
| queryKey: ["backend-health"], | ||
| queryFn: fetchHealth, | ||
| refetchInterval: isLeader ? 3000 : false, | ||
| refetchIntervalInBackground: true, | ||
| retry: false, | ||
| staleTime: Infinity, | ||
| initialData: () => { | ||
| const cached = readCachedStatus(); | ||
| return cached ? { status: cached } : undefined; | ||
| } | ||
| }); | ||
|
|
||
| useEffect(() => { | ||
| if (!isLeader) return; | ||
| const status = query.isError ? "down" : query.data?.status; | ||
| if (status) { | ||
| writeCachedStatus(status); | ||
| publishHealthStatus(status); | ||
| } | ||
| }, [isLeader, query.data, query.isError]); | ||
|
|
||
| return !query.isError && query.data?.status === "ok"; | ||
| }; | ||
|
|
||
| export default useBackendHealth; | ||
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.