Skip to content

Commit d67d7ed

Browse files
authored
Merge pull request #215 from cBioPortal/feature/backend-info-display
feat: add backend info display
2 parents 081eb7a + 8e8bfb2 commit d67d7ed

4 files changed

Lines changed: 73 additions & 3 deletions

File tree

.changeset/backend-info-display.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@cbioportal-cell-explorer/highperformer": patch
3+
---
4+
5+
Add backend detection via /api/info probe and display version info in branding header popover

packages/highperformer/src/App.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,20 @@
1+
import { useEffect } from 'react'
12
import { Layout } from 'antd'
23
import { BrowserRouter, Routes, Route } from 'react-router-dom'
34
import { ProfilePage } from '@cbioportal-cell-explorer/profiler'
45
import Home from './pages/Home'
56
import View from './pages/View'
67
import ZarrView from './pages/ZarrView'
8+
import useAppStore from './store/useAppStore'
79

810
const { Content } = Layout
911

1012
const ENABLE_PROFILER = import.meta.env.VITE_ENABLE_PROFILER === 'true'
1113
const ENABLE_ZARR_VIEW = import.meta.env.VITE_ENABLE_ZARR_VIEW === 'true'
1214

1315
function App() {
16+
const probeBackend = useAppStore((s) => s.probeBackend)
17+
useEffect(() => { probeBackend() }, [probeBackend])
1418
return (
1519
<BrowserRouter basename={import.meta.env.BASE_URL}>
1620
<Routes>

packages/highperformer/src/pages/View.tsx

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react'
22
import { useSearchParams, useNavigate, Link } from 'react-router-dom'
33
import { Collapse, InputNumber, Layout, Popover, Switch, Typography, Select, Spin, message } from 'antd'
4-
import { BgColorsOutlined, DatabaseOutlined, DotChartOutlined, HolderOutlined, LeftOutlined, LinkOutlined, RightOutlined, SettingOutlined } from '@ant-design/icons'
4+
import { BgColorsOutlined, DatabaseOutlined, DotChartOutlined, HolderOutlined, InfoCircleOutlined, LeftOutlined, LinkOutlined, RightOutlined, SettingOutlined } from '@ant-design/icons'
55
import { DeckGL } from '@deck.gl/react'
66
import { OrthographicView } from '@deck.gl/core'
77
import { PolygonLayer, ScatterplotLayer } from '@deck.gl/layers'
@@ -19,7 +19,6 @@ import ColorBySection from '../components/ColorBySection'
1919
import SelectionOverlay from '../components/SelectionOverlay'
2020
import SelectionToolbar from '../components/SelectionToolbar'
2121
import SummaryPanel from '../components/SummaryPanel'
22-
import { VersionTag } from '../components/VersionTag'
2322
import { loadDatasets, saveDatasets } from '../utils/datasets'
2423

2524
const { Sider, Content } = Layout
@@ -175,15 +174,55 @@ function CollapsedSidebar({ onExpand }: { onExpand: () => void }) {
175174
)
176175
}
177176

177+
const infoRowStyle: React.CSSProperties = { display: 'flex', justifyContent: 'space-between', gap: 16, fontSize: 12 }
178+
179+
function InfoPopoverContent() {
180+
const backendInfo = useAppStore((s) => s.backendInfo)
181+
182+
return (
183+
<div style={{ display: 'flex', flexDirection: 'column', gap: 4 }}>
184+
<div style={infoRowStyle}>
185+
<Typography.Text type="secondary">Version</Typography.Text>
186+
<Typography.Text>v{__APP_VERSION__}</Typography.Text>
187+
</div>
188+
<div style={infoRowStyle}>
189+
<Typography.Text type="secondary">SHA</Typography.Text>
190+
<Typography.Text code style={{ fontSize: 11 }}>{__COMMIT_HASH__}</Typography.Text>
191+
</div>
192+
{backendInfo && (
193+
<>
194+
<div style={infoRowStyle}>
195+
<Typography.Text type="secondary">API version</Typography.Text>
196+
<Typography.Text>v{backendInfo.version}</Typography.Text>
197+
</div>
198+
<div style={infoRowStyle}>
199+
<Typography.Text type="secondary">API environment</Typography.Text>
200+
<Typography.Text>{backendInfo.environment}</Typography.Text>
201+
</div>
202+
{backendInfo.git_sha && (
203+
<div style={infoRowStyle}>
204+
<Typography.Text type="secondary">API SHA</Typography.Text>
205+
<Typography.Text code style={{ fontSize: 11 }}>{backendInfo.git_sha}</Typography.Text>
206+
</div>
207+
)}
208+
</>
209+
)}
210+
</div>
211+
)
212+
}
213+
178214
function BrandingHeader() {
179215
return (
180216
<div style={{ padding: '12px 16px', borderBottom: '1px solid #f0f0f0', display: 'flex', justifyContent: 'space-between', alignItems: 'center' }}>
181217
<Link to="/" style={{ textDecoration: 'none' }}>
182218
<Typography.Title level={5} style={{ margin: 0 }}>
183219
cBioPortal Cell Explorer{' '}
184-
<VersionTag version={__APP_VERSION__} commitHash={__COMMIT_HASH__} />
220+
<span style={{ fontSize: 12, color: '#999', fontWeight: 'normal' }}>v{__APP_VERSION__}</span>
185221
</Typography.Title>
186222
</Link>
223+
<Popover content={<InfoPopoverContent />} trigger="click" placement="bottomRight">
224+
<InfoCircleOutlined style={{ fontSize: 14, color: '#999', cursor: 'pointer' }} />
225+
</Popover>
187226
</div>
188227
)
189228
}

packages/highperformer/src/store/useAppStore.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ export interface EmbeddingData {
2121
bounds: EmbeddingBounds
2222
}
2323

24+
export interface BackendInfo {
25+
version: string
26+
environment: string
27+
git_sha: string | null
28+
}
29+
2430
export type ColorMode = 'category' | 'gene'
2531

2632
// Selection types
@@ -164,6 +170,10 @@ export interface AppState {
164170
reorderSummaryObsColumns: (reordered: string[]) => void
165171
reorderSummaryGenes: (reordered: string[]) => void
166172

173+
// Backend info (null = no backend detected)
174+
backendInfo: BackendInfo | null
175+
probeBackend: () => Promise<void>
176+
167177
// UI visibility toggles (for embedded mode)
168178
showHeader: boolean
169179
showLeftSidebar: boolean
@@ -344,6 +354,18 @@ const useAppStore = create<AppState>((set, get) => ({
344354
customGroupPreviousEnabledIds: null,
345355

346356
// UI toggles
357+
backendInfo: null,
358+
probeBackend: async () => {
359+
try {
360+
const res = await fetch('/api/info')
361+
if (!res.ok) return
362+
const data = await res.json()
363+
set({ backendInfo: data })
364+
} catch {
365+
// No backend available — frontend-only mode
366+
}
367+
},
368+
347369
showHeader: true,
348370
showLeftSidebar: true,
349371
showRightSidebar: true,

0 commit comments

Comments
 (0)