generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: show real version in console nav (#2526)
Fixes #2488 ![Screenshot 2024-08-28 at 12 14 03 PM](https://github.com/user-attachments/assets/b9fe7e81-5b8d-4fab-98ae-79007b992550)
- Loading branch information
1 parent
bf5adf5
commit 0106f6c
Showing
6 changed files
with
47 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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 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,32 @@ | ||
import { Code, ConnectError } from '@connectrpc/connect' | ||
import { useQuery } from '@tanstack/react-query' | ||
import { useClient } from '../../hooks/use-client' | ||
import { ControllerService } from '../../protos/xyz/block/ftl/v1/ftl_connect' | ||
|
||
const useStatusKey = 'status' | ||
|
||
export const useStatus = () => { | ||
const client = useClient(ControllerService) | ||
|
||
const fetchStatus = async (signal: AbortSignal) => { | ||
try { | ||
console.debug('fetching status from FTL') | ||
const status = await client.status({}, { signal }) | ||
return status | ||
} catch (error) { | ||
if (error instanceof ConnectError) { | ||
if (error.code !== Code.Canceled) { | ||
console.error('fetchStatus - Connect error:', error) | ||
} | ||
} else { | ||
console.error('fetchStatus:', error) | ||
} | ||
throw error | ||
} | ||
} | ||
|
||
return useQuery({ | ||
queryKey: [useStatusKey], | ||
queryFn: async ({ signal }) => fetchStatus(signal), | ||
}) | ||
} |
This file contains 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 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 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 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
export const Version = ({ version }: { version: string }) => { | ||
export const Version = ({ version }: { version?: string }) => { | ||
return <span className='text-xs font-roboto-mono text-gray-300'>{version}</span> | ||
} |