Add runtime version reporting and display
This commit is contained in:
@@ -20,6 +20,7 @@ function App() {
|
||||
const [subscriptionUrl, setSubscriptionUrl] = useState('');
|
||||
const [operations, setOperations] = useState({});
|
||||
const [error, setError] = useState(null);
|
||||
const [versionInfo, setVersionInfo] = useState(null);
|
||||
const pollGeneration = useRef(0);
|
||||
const operationRegistry = useRef(null);
|
||||
if (!operationRegistry.current) {
|
||||
@@ -56,6 +57,17 @@ function App() {
|
||||
return () => clearInterval(timer);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
api.version().then((info) => {
|
||||
if (!cancelled) setVersionInfo(info);
|
||||
}).catch((requestError) => {
|
||||
console.warn(`[version] Не удалось получить runtime-версию: ${requestError.message}`);
|
||||
if (!cancelled) setVersionInfo(null);
|
||||
});
|
||||
return () => { cancelled = true; };
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
if (!state?.mode) return;
|
||||
const isGateway = state.mode === 'gateway';
|
||||
@@ -129,6 +141,7 @@ function App() {
|
||||
<main className="app-main">
|
||||
<ClientOverviewPage
|
||||
state={previewReady ? { ...state, mode: 'client', hasSubscription: true, subscriptionHost: 'harbor.example', selectedTag: 'Amsterdam', proxyPort: 8082 } : state}
|
||||
versionInfo={versionInfo}
|
||||
operations={operations}
|
||||
error={error}
|
||||
subscriptionUrl={subscriptionUrl}
|
||||
|
||||
Reference in New Issue
Block a user