mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
Some checks are pending
ci / build_manifests (push) Blocked by required conditions
ci / build_images (map[arch:amd64 platform:linux]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux]) (push) Waiting to run
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run
40 lines
1,003 B
TypeScript
40 lines
1,003 B
TypeScript
import { useQuery } from 'react-query';
|
|
|
|
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
|
|
|
import { buildUrl } from './build-url';
|
|
import { queryKeys } from './query-keys';
|
|
|
|
export const queryKey = [...queryKeys.base(), 'version'] as const;
|
|
|
|
export interface VersionResponse {
|
|
// Whether portainer has an update available
|
|
UpdateAvailable: boolean;
|
|
// The latest version available
|
|
LatestVersion: string;
|
|
ServerVersion: string;
|
|
DatabaseVersion: string;
|
|
Build: {
|
|
BuildNumber: string;
|
|
ImageTag: string;
|
|
NodejsVersion: string;
|
|
YarnVersion: string;
|
|
WebpackVersion: string;
|
|
GoVersion: string;
|
|
GitCommit: string;
|
|
Env?: string[];
|
|
};
|
|
}
|
|
|
|
export async function getSystemVersion() {
|
|
try {
|
|
const { data } = await axios.get<VersionResponse>(buildUrl('version'));
|
|
return data;
|
|
} catch (error) {
|
|
throw parseAxiosError(error as Error);
|
|
}
|
|
}
|
|
|
|
export function useSystemVersion() {
|
|
return useQuery(queryKey, () => getSystemVersion());
|
|
}
|