按参考图分层展示真实构建、紧凑版本条目与分类变更,当前条目默认展开;增加只读刷新,原始提交和权限保持。 验证:构建信息卡、紧凑展开和安全变更分类三组回归分别先红后绿,23项版本相关测试与类型检查通过;完整门禁、候选及上线验收待执行。
This commit is contained in:
@@ -76,6 +76,13 @@
|
||||
> `0.1.12`),由 `scripts/version.py` 从 git **算出来**;开发交付的独立说明写入本文件“开发快照”章节,并打 `snapshot/vX.Y.Z` 注释标签 ⇒ 每次开发交付均可追溯,
|
||||
> 但"发布版本"仍然只能由人定(CI 不会自动升版本、不会打 tag)。
|
||||
|
||||
## 开发快照 snapshot/v0.1.53 - 2026-10-24
|
||||
|
||||
### Changed
|
||||
|
||||
- 版本记录按参考图重排为当前构建信息卡和紧凑折叠列表,当前运行记录默认展开,其他记录收起;变更按新增、调整、修复、安全分类展示,原始说明和提交信息可展开核验。
|
||||
- 增加所有角色可用的只读刷新,保留管理员同步、真实版本身份、筛选及完整历史加载;北京时间、长提交与手机排版统一处理,不增加发布或部署权限。
|
||||
|
||||
## 开发快照 snapshot/v0.1.52 - 2026-10-24
|
||||
|
||||
### Changed
|
||||
|
||||
@@ -89,6 +89,7 @@ const render = (over: Partial<Parameters<typeof VersionHistoryView>[0]> = {}) =>
|
||||
notice={null}
|
||||
expanded={null}
|
||||
canSync={false}
|
||||
onRefresh={vi.fn()}
|
||||
onFilter={vi.fn()}
|
||||
onLoadMore={vi.fn()}
|
||||
onSync={vi.fn()}
|
||||
@@ -98,6 +99,54 @@ const render = (over: Partial<Parameters<typeof VersionHistoryView>[0]> = {}) =>
|
||||
)
|
||||
|
||||
describe('VersionHistoryView', () => {
|
||||
it('renders safe readable change rows while retaining the untouched raw notes', () => {
|
||||
const html = render({
|
||||
expanded: developmentItem.commit_sha,
|
||||
page: {
|
||||
...page,
|
||||
items: [
|
||||
{ ...developmentItem, release_notes: '### Fixed\n\n- **标题**:修复 `字段`\n- <img src=x onerror=alert(1)>' },
|
||||
],
|
||||
},
|
||||
})
|
||||
expect(html).toContain('class="version-history-change-row"')
|
||||
expect(html).toContain('class="version-history-change-tag fixed">修复</span>')
|
||||
expect(html).toContain('<strong>标题</strong>')
|
||||
expect(html).toContain('<code>字段</code>')
|
||||
expect(html).toContain('### Fixed')
|
||||
expect(html).not.toContain('<img src=x')
|
||||
})
|
||||
|
||||
it('uses compact full-width record headers and defaults to the matching running commit', () => {
|
||||
const html = render({ expanded: undefined })
|
||||
expect(html).toContain('data-version-commit="' + releaseItem.commit_sha + '"')
|
||||
expect(html).toContain('is-current')
|
||||
expect(html).toContain('aria-controls="version-detail-' + releaseItem.commit_sha + '"')
|
||||
expect(html.match(/aria-expanded="true"/g)).toHaveLength(1)
|
||||
expect(html).toContain('正文第一行')
|
||||
expect(html).toContain('原始记录与提交信息')
|
||||
expect(render({ expanded: null })).not.toContain('正文第一行')
|
||||
})
|
||||
|
||||
it('separates the actual current build into a readable summary card with a read-only refresh', () => {
|
||||
const html = render({
|
||||
build: {
|
||||
release_version: '0.1.0',
|
||||
build_kind: 'development',
|
||||
commit_sha: releaseItem.commit_sha,
|
||||
display_version: '0.1.0',
|
||||
built_at: '2026-10-13T08:45:56Z',
|
||||
identity_available: true,
|
||||
},
|
||||
})
|
||||
expect(html).toContain('aria-label="当前版本"')
|
||||
expect(html).toContain('运行版本</dt>')
|
||||
expect(html).toContain('构建时间(北京时间)</dt>')
|
||||
expect(html).toContain(releaseItem.commit_sha)
|
||||
expect(html).toContain('刷新</button>')
|
||||
expect(html).toContain('每一版改了什么')
|
||||
})
|
||||
|
||||
it('renders the exact development changelog instead of hiding all non-release notes', () => {
|
||||
const html = render({
|
||||
expanded: developmentItem.commit_sha,
|
||||
@@ -106,7 +155,7 @@ describe('VersionHistoryView', () => {
|
||||
expect(html).toContain('这次开发独有的变更说明')
|
||||
})
|
||||
it('lists commits newest-first with kind badges, short sha, times and links', () => {
|
||||
const html = render()
|
||||
const html = render({ expanded: releaseItem.commit_sha })
|
||||
expect(html).toContain('版本记录')
|
||||
expect(html).toContain('正式版本')
|
||||
expect(html).toContain('开发版本')
|
||||
@@ -194,10 +243,11 @@ describe('VersionHistoryView', () => {
|
||||
})
|
||||
|
||||
it('never renders a tag link without a URL (an empty href looks broken)', () => {
|
||||
const withURL = render()
|
||||
const withURL = render({ expanded: releaseItem.commit_sha })
|
||||
expect(withURL).toContain('查看 tag v0.1.0')
|
||||
expect(withURL).toContain('https://gitea.example/Weknora/knowledge-governance/src/tag/v0.1.0')
|
||||
const withoutURL = render({
|
||||
expanded: releaseItem.commit_sha,
|
||||
page: {
|
||||
...page,
|
||||
items: [{ ...releaseItem, release_tags: [{ name: 'v0.1.0', url: '' }] }],
|
||||
|
||||
+252
-109
@@ -20,7 +20,18 @@ const FILTERS: ReadonlyArray<{ id: string; label: string }> = [
|
||||
{ id: 'historical', label: '历史' },
|
||||
]
|
||||
|
||||
const stamp = (value: string) => (value ? new Date(value).toLocaleString('zh-CN', { hour12: false }) : '—')
|
||||
const stamp = (value: string) =>
|
||||
value && Number.isFinite(new Date(value).getTime())
|
||||
? new Date(value).toLocaleString('zh-CN', {
|
||||
timeZone: 'Asia/Shanghai',
|
||||
year: 'numeric',
|
||||
month: '2-digit',
|
||||
day: '2-digit',
|
||||
hour: '2-digit',
|
||||
minute: '2-digit',
|
||||
hour12: false,
|
||||
})
|
||||
: '—'
|
||||
const kindLabel: Record<string, string> = { release: '正式版本', development: '开发版本', historical: '历史提交' }
|
||||
|
||||
const runningText = (running: VersionHistoryPage['current_running']) => {
|
||||
@@ -53,8 +64,9 @@ interface ViewProps {
|
||||
loadingMore: boolean
|
||||
error: string | null
|
||||
notice: string | null
|
||||
expanded: string | null
|
||||
expanded: string | null | undefined
|
||||
canSync: boolean
|
||||
onRefresh: () => void
|
||||
onFilter: (id: string) => void
|
||||
onLoadMore: () => void
|
||||
onSync: () => void
|
||||
@@ -64,87 +76,196 @@ interface ViewProps {
|
||||
export function VersionHistoryView(props: ViewProps) {
|
||||
const { page, build } = props
|
||||
const items = page?.items ?? []
|
||||
const expandedSHA =
|
||||
props.expanded === undefined
|
||||
? (items.find(
|
||||
(item) =>
|
||||
page?.current_running.state === 'matched' && item.commit_sha === page.current_running.matched_commit_sha
|
||||
)?.commit_sha ??
|
||||
items[0]?.commit_sha ??
|
||||
null)
|
||||
: props.expanded
|
||||
return (
|
||||
<section className="version-history" aria-label="版本记录">
|
||||
<header className="version-history-header">
|
||||
<div>
|
||||
<h2>版本记录</h2>
|
||||
<p>
|
||||
{page
|
||||
? runningText(page.current_running)
|
||||
: build
|
||||
? `当前运行:${build.identity_available ? build.display_version : '未知'}`
|
||||
: '当前运行版本未知'}
|
||||
</p>
|
||||
<p className="version-history-sync-line">
|
||||
{page ? syncText(page.sync) : '正在读取同步状态…'}
|
||||
{page?.sync.status === 'running' || page?.sync.status === 'pending' ? (
|
||||
<span className="version-history-badge pending">同步中</span>
|
||||
) : null}
|
||||
{page && page.sync.status === 'failed' ? (
|
||||
<span className="version-history-badge warn">同步失败</span>
|
||||
) : null}
|
||||
</p>
|
||||
<p>查看当前构建,以及每次更新带来的变化。</p>
|
||||
</div>
|
||||
{props.canSync ? (
|
||||
<button type="button" onClick={props.onSync} disabled={props.loading || !page?.sync.available}>
|
||||
{page?.sync.status === 'running' || page?.sync.status === 'pending' ? '同步进行中…' : '同步记录'}
|
||||
<div className="version-history-actions">
|
||||
<button type="button" onClick={props.onRefresh} disabled={props.loading}>
|
||||
刷新
|
||||
</button>
|
||||
) : null}
|
||||
</header>
|
||||
|
||||
{props.error ? (
|
||||
<div className="error-banner" role="alert">
|
||||
{props.error}
|
||||
{props.canSync ? (
|
||||
<button
|
||||
type="button"
|
||||
onClick={props.onSync}
|
||||
disabled={
|
||||
props.loading ||
|
||||
!page?.sync.available ||
|
||||
page.sync.status === 'running' ||
|
||||
page.sync.status === 'pending'
|
||||
}
|
||||
>
|
||||
{page?.sync.status === 'running' || page?.sync.status === 'pending' ? '同步进行中…' : '同步记录'}
|
||||
</button>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
{props.notice ? <div className="version-history-notice">{props.notice}</div> : null}
|
||||
</header>
|
||||
<section className="version-history-current-card" aria-label="当前版本">
|
||||
<h3>当前版本</h3>
|
||||
<dl className="version-history-build-grid">
|
||||
<div>
|
||||
<dt>运行版本</dt>
|
||||
<dd className="version-history-running-version">
|
||||
{page
|
||||
? page.current_running.state === 'unknown'
|
||||
? '未知'
|
||||
: page.current_running.display_version
|
||||
: build?.identity_available
|
||||
? build.display_version
|
||||
: '未知'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>构建类型</dt>
|
||||
<dd>
|
||||
{build?.build_kind === 'development' ? '开发构建' : build?.build_kind === 'release' ? '正式构建' : '未知'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>提交</dt>
|
||||
<dd className="version-history-sha">
|
||||
{(page ? page.current_running.commit_sha : build?.identity_available ? build.commit_sha : '') || '—'}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>构建时间(北京时间)</dt>
|
||||
<dd>
|
||||
{build && (!page || build.commit_sha === page.current_running.commit_sha) ? stamp(build.built_at) : '—'}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p className="version-history-running-state">{page ? runningText(page.current_running) : '当前运行版本未知'}</p>
|
||||
</section>
|
||||
<section className="version-history-records" aria-label="版本变更列表">
|
||||
<div className="version-history-records-heading">
|
||||
<h3>每一版改了什么</h3>
|
||||
<p>记录来自仓库,只读展示,不执行发布或部署。</p>
|
||||
</div>
|
||||
<p className="version-history-sync-line">
|
||||
{page ? syncText(page.sync) : '正在读取同步状态…'}
|
||||
{page?.sync.status === 'running' || page?.sync.status === 'pending' ? (
|
||||
<span className="version-history-badge pending">同步中</span>
|
||||
) : null}
|
||||
{page?.sync.status === 'failed' ? <span className="version-history-badge warn">同步失败</span> : null}
|
||||
</p>
|
||||
|
||||
<nav className="version-history-filters" aria-label="按记录类型筛选">
|
||||
{FILTERS.map((entry) => (
|
||||
{props.error ? (
|
||||
<div className="error-banner" role="alert">
|
||||
{props.error}
|
||||
</div>
|
||||
) : null}
|
||||
{props.notice ? <div className="version-history-notice">{props.notice}</div> : null}
|
||||
|
||||
<nav className="version-history-filters" aria-label="按记录类型筛选">
|
||||
{FILTERS.map((entry) => (
|
||||
<button
|
||||
type="button"
|
||||
key={entry.id}
|
||||
className={props.filter === entry.id ? 'active' : ''}
|
||||
aria-pressed={props.filter === entry.id}
|
||||
onClick={() => props.onFilter(entry.id)}
|
||||
>
|
||||
{entry.label}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{items.length === 0 && !props.loading ? (
|
||||
<div className="empty-state">
|
||||
{page?.sync.available
|
||||
? '暂无记录(先同步一次,或该筛选下没有条目)'
|
||||
: '版本记录未接线:等待配置只读的仓库来源'}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<ol className="version-history-timeline">
|
||||
{items.map((item) => (
|
||||
<TimelineEntry
|
||||
key={item.commit_sha}
|
||||
item={item}
|
||||
// 「当前运行」以页面级判定为准(同一份事实),条目标志只做兜底
|
||||
currentMatchedSHA={
|
||||
page?.current_running.state === 'matched' ? page.current_running.matched_commit_sha : ''
|
||||
}
|
||||
expanded={expandedSHA === item.commit_sha}
|
||||
onExpand={() => props.onExpand(expandedSHA === item.commit_sha ? null : item.commit_sha)}
|
||||
/>
|
||||
))}
|
||||
</ol>
|
||||
|
||||
{props.loading ? <div className="empty-state">正在读取版本记录…</div> : null}
|
||||
{page?.has_more ? (
|
||||
<button
|
||||
type="button"
|
||||
key={entry.id}
|
||||
className={props.filter === entry.id ? 'active' : ''}
|
||||
aria-pressed={props.filter === entry.id}
|
||||
onClick={() => props.onFilter(entry.id)}
|
||||
className="version-history-more"
|
||||
onClick={props.onLoadMore}
|
||||
disabled={props.loadingMore}
|
||||
>
|
||||
{entry.label}
|
||||
{props.loadingMore ? '正在加载…' : '加载更多'}
|
||||
</button>
|
||||
))}
|
||||
</nav>
|
||||
|
||||
{items.length === 0 && !props.loading ? (
|
||||
<div className="empty-state">
|
||||
{page?.sync.available
|
||||
? '暂无记录(先同步一次,或该筛选下没有条目)'
|
||||
: '版本记录未接线:等待配置只读的仓库来源'}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<ol className="version-history-timeline">
|
||||
{items.map((item) => (
|
||||
<TimelineEntry
|
||||
key={item.commit_sha}
|
||||
item={item}
|
||||
// 「当前运行」以页面级判定为准(同一份事实),条目标志只做兜底
|
||||
currentMatchedSHA={page?.current_running.state === 'matched' ? page.current_running.matched_commit_sha : ''}
|
||||
expanded={props.expanded === item.commit_sha}
|
||||
onExpand={() => props.onExpand(props.expanded === item.commit_sha ? null : item.commit_sha)}
|
||||
/>
|
||||
))}
|
||||
</ol>
|
||||
|
||||
{props.loading ? <div className="empty-state">正在读取版本记录…</div> : null}
|
||||
{page?.has_more ? (
|
||||
<button type="button" className="version-history-more" onClick={props.onLoadMore} disabled={props.loadingMore}>
|
||||
{props.loadingMore ? '正在加载…' : '加载更多'}
|
||||
</button>
|
||||
) : null}
|
||||
) : null}
|
||||
</section>
|
||||
</section>
|
||||
)
|
||||
}
|
||||
|
||||
function ChangeNotes({ text }: { text: string }) {
|
||||
const categories: Record<string, { label: string; tone: string }> = {
|
||||
Added: { label: '新增', tone: 'added' },
|
||||
Changed: { label: '调整', tone: 'changed' },
|
||||
Fixed: { label: '修复', tone: 'fixed' },
|
||||
Security: { label: '安全', tone: 'security' },
|
||||
}
|
||||
let category = { label: '说明', tone: 'note' }
|
||||
return (
|
||||
<div className="version-history-notes">
|
||||
{text.split(/\r?\n/).map((line, index) => {
|
||||
const trimmed = line.trim()
|
||||
if (!trimmed) return null
|
||||
const heading = /^#{1,6}\s+(.+)$/.exec(trimmed)
|
||||
if (heading) {
|
||||
if (categories[heading[1]]) {
|
||||
category = categories[heading[1]]
|
||||
return null
|
||||
}
|
||||
return <h4 key={index}>{heading[1]}</h4>
|
||||
}
|
||||
const content = trimmed.replace(/^[-*]\s+/, '')
|
||||
return (
|
||||
<p className="version-history-change-row" key={index}>
|
||||
<span className={'version-history-change-tag ' + category.tone}>{category.label}</span>
|
||||
<span>
|
||||
{content
|
||||
.split(/(\*\*[^*]+\*\*|`[^`]+`)/g)
|
||||
.map((part, i) =>
|
||||
part.startsWith('**') && part.endsWith('**') ? (
|
||||
<strong key={i}>{part.slice(2, -2)}</strong>
|
||||
) : part.startsWith('`') && part.endsWith('`') ? (
|
||||
<code key={i}>{part.slice(1, -1)}</code>
|
||||
) : (
|
||||
part
|
||||
)
|
||||
)}
|
||||
</span>
|
||||
</p>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function TimelineEntry({
|
||||
item,
|
||||
currentMatchedSHA,
|
||||
@@ -156,56 +277,77 @@ function TimelineEntry({
|
||||
expanded: boolean
|
||||
onExpand: () => void
|
||||
}) {
|
||||
const isRelease = item.record_kind === 'release' && item.version_state === 'verified'
|
||||
const heading = isRelease ? item.version_label : item.version_label || `历史提交 · ${item.short_sha}`
|
||||
const heading = item.version_label || `历史提交 · ${item.short_sha}`
|
||||
const note = item.version_state === 'verified' ? item.release_notes : ''
|
||||
const hasDetail = Boolean(item.body) || Boolean(note)
|
||||
const isCurrent = Boolean(item.commit_sha && item.commit_sha === currentMatchedSHA)
|
||||
const detailID = 'version-detail-' + item.commit_sha
|
||||
return (
|
||||
<li className={`version-history-entry ${item.record_kind}`}>
|
||||
<div className="version-history-entry-head">
|
||||
<strong>{heading}</strong>
|
||||
<span>{stamp(item.committed_at)}</span>
|
||||
</div>
|
||||
<div className="version-history-entry-meta">
|
||||
<li
|
||||
className={`version-history-entry ${item.record_kind}${isCurrent ? ' is-current' : ''}`}
|
||||
data-version-commit={item.commit_sha}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
className="version-history-entry-head"
|
||||
onClick={onExpand}
|
||||
aria-expanded={expanded}
|
||||
aria-controls={detailID}
|
||||
>
|
||||
<strong className={`version-history-version ${item.record_kind}`}>{heading}</strong>
|
||||
<span className={`version-history-badge ${item.record_kind}`}>{kindLabel[item.record_kind] ?? '历史提交'}</span>
|
||||
<span className="version-history-sha">{item.short_sha}</span>
|
||||
{item.commit_sha && item.commit_sha === currentMatchedSHA ? (
|
||||
<span className="version-history-badge current">当前运行</span>
|
||||
) : null}
|
||||
<span className="version-history-author">{item.author_display}</span>
|
||||
</div>
|
||||
<p className="version-history-subject">{item.subject}</p>
|
||||
{isCurrent ? <span className="version-history-badge current">当前运行</span> : null}
|
||||
<span className="version-history-sha" title={item.commit_sha}>
|
||||
{item.short_sha}
|
||||
</span>
|
||||
<time dateTime={item.committed_at}>{stamp(item.committed_at)}</time>
|
||||
<span className="version-history-subject">{item.subject.replace(/^[a-z]+(?:\([^)]+\))?!?:\s*/, '')}</span>
|
||||
<span className="version-history-toggle">{expanded ? '收起详情' : '展开详情'}</span>
|
||||
</button>
|
||||
{!item.version_label && item.record_kind === 'historical' ? (
|
||||
<p className="version-history-reason">版本号未能核验:{reasonLabel(item.version_reason)}</p>
|
||||
) : null}
|
||||
{hasDetail ? (
|
||||
<>
|
||||
<button type="button" className="version-history-toggle" onClick={onExpand} aria-expanded={expanded}>
|
||||
{expanded ? '收起详情' : '展开详情'}
|
||||
</button>
|
||||
{expanded ? (
|
||||
<div className="version-history-detail">
|
||||
{note ? <pre>{note}</pre> : null}
|
||||
{item.body ? <pre>{item.body}</pre> : null}
|
||||
{expanded ? (
|
||||
<div className="version-history-detail" id={detailID}>
|
||||
{note ? (
|
||||
<ChangeNotes text={note} />
|
||||
) : (
|
||||
<p className="version-history-no-notes">此提交未附单独的变更说明,可查看下方原始提交。</p>
|
||||
)}
|
||||
<details className="version-history-technical">
|
||||
<summary>原始记录与提交信息</summary>
|
||||
<dl>
|
||||
<div>
|
||||
<dt>提交</dt>
|
||||
<dd className="version-history-sha">{item.commit_sha}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>作者</dt>
|
||||
<dd>{item.author_display || '—'}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>提交标题</dt>
|
||||
<dd>{item.subject}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
{note ? <pre>{note}</pre> : null}
|
||||
{item.body ? <pre>{item.body}</pre> : null}
|
||||
<div className="version-history-links">
|
||||
{item.commit_url ? (
|
||||
<a href={item.commit_url} target="_blank" rel="noreferrer noopener">
|
||||
查看提交
|
||||
</a>
|
||||
) : null}
|
||||
{item.release_tags
|
||||
.filter((tag) => tag.url)
|
||||
.map((tag) => (
|
||||
<a key={tag.name} href={tag.url} target="_blank" rel="noreferrer noopener">
|
||||
查看 tag {tag.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
</details>
|
||||
</div>
|
||||
) : null}
|
||||
<div className="version-history-links">
|
||||
{item.commit_url ? (
|
||||
<a href={item.commit_url} target="_blank" rel="noreferrer noopener">
|
||||
查看提交
|
||||
</a>
|
||||
) : null}
|
||||
{/* 没有链接就不渲染:空 href 点下去像"没反应/空白",比不显示更糟 */}
|
||||
{item.release_tags
|
||||
.filter((tag) => tag.url)
|
||||
.map((tag) => (
|
||||
<a key={tag.name} href={tag.url} target="_blank" rel="noreferrer noopener">
|
||||
查看 tag {tag.name}
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</li>
|
||||
)
|
||||
}
|
||||
@@ -219,7 +361,7 @@ export function VersionHistory() {
|
||||
const [loadingMore, setLoadingMore] = useState(false)
|
||||
const [error, setError] = useState<string | null>(null)
|
||||
const [notice, setNotice] = useState<string | null>(null)
|
||||
const [expanded, setExpanded] = useState<string | null>(null)
|
||||
const [expanded, setExpanded] = useState<string | null | undefined>(undefined)
|
||||
const cursor = useRef('')
|
||||
|
||||
const load = useCallback(async (kind: string, append: boolean) => {
|
||||
@@ -276,6 +418,7 @@ export function VersionHistory() {
|
||||
notice,
|
||||
expanded,
|
||||
canSync,
|
||||
onRefresh: () => void load(filter, false),
|
||||
onFilter: setFilter,
|
||||
onLoadMore: () => void load(filter, true),
|
||||
onSync: () => void onSync(),
|
||||
|
||||
+317
-78
@@ -1,46 +1,124 @@
|
||||
/* 「版本记录」页:只读时间线。窄屏(≤760px,与工作台既有断点一致)单列、无横向溢出。 */
|
||||
/* Version records: build identity first, then compact commit accordions. */
|
||||
.version-history {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 18px;
|
||||
min-width: 0;
|
||||
padding: 24px;
|
||||
color: var(--ink-base);
|
||||
}
|
||||
.version-history-header,
|
||||
.version-history-current-card,
|
||||
.version-history-records {
|
||||
background: var(--bg-panel, #fff);
|
||||
border: 1px solid var(--border-base, #e2e8f0);
|
||||
border-radius: 10px;
|
||||
padding: 20px;
|
||||
min-width: 0;
|
||||
}
|
||||
.version-history-header {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
}
|
||||
.version-history-header h2 {
|
||||
.version-history h2 {
|
||||
margin: 0 0 4px;
|
||||
font-size: 22px;
|
||||
}
|
||||
.version-history h3 {
|
||||
margin: 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
.version-history-header p {
|
||||
.version-history-header p,
|
||||
.version-history-records-heading p {
|
||||
margin: 0;
|
||||
color: var(--muted, #666);
|
||||
color: var(--ink-mute, #64748b);
|
||||
font-size: 13px;
|
||||
}
|
||||
.version-history-actions {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.version-history-actions button {
|
||||
padding: 7px 14px;
|
||||
}
|
||||
.version-history-build-grid {
|
||||
display: grid;
|
||||
grid-template-columns: 0.8fr 0.8fr 2fr 1.3fr;
|
||||
margin: 16px 0 0;
|
||||
border: 1px solid var(--border-base, #e2e8f0);
|
||||
background: var(--bg-page, #f8fafc);
|
||||
}
|
||||
.version-history-build-grid > div {
|
||||
padding: 12px 14px;
|
||||
min-width: 0;
|
||||
border-right: 1px solid var(--border-base, #e2e8f0);
|
||||
}
|
||||
.version-history-build-grid > div:last-child {
|
||||
border-right: 0;
|
||||
}
|
||||
.version-history dt {
|
||||
color: var(--ink-mute, #64748b);
|
||||
font-size: 12px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.version-history dd {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: 13px;
|
||||
}
|
||||
.version-history-running-version {
|
||||
font-size: 22px !important;
|
||||
font-weight: 650;
|
||||
color: var(--ink-strong);
|
||||
}
|
||||
.version-history-running-state {
|
||||
margin: 12px 0 0;
|
||||
color: var(--ink-mute, #64748b);
|
||||
font-size: 12px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version-history-records-heading {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.version-history-sync-line {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: 8px;
|
||||
margin-top: 4px !important;
|
||||
margin: 10px 0 14px;
|
||||
color: var(--ink-mute, #64748b);
|
||||
font-size: 12px;
|
||||
}
|
||||
.version-history-notice {
|
||||
padding: 8px 10px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 6px;
|
||||
background: rgba(64, 158, 255, 0.12);
|
||||
background: var(--c-run-bg, #eff6ff);
|
||||
font-size: 13px;
|
||||
}
|
||||
.version-history-filters {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
gap: 6px;
|
||||
flex-wrap: wrap;
|
||||
margin: 0 0 16px;
|
||||
}
|
||||
.version-history-filters button {
|
||||
padding: 5px 13px;
|
||||
background: transparent;
|
||||
color: var(--ink-mute);
|
||||
box-shadow: none;
|
||||
}
|
||||
.version-history-filters button.active {
|
||||
font-weight: 600;
|
||||
border-color: currentColor;
|
||||
color: var(--c-run, #2563eb);
|
||||
background: var(--c-run-bg, #eff6ff);
|
||||
border-color: var(--c-run-border, #bfdbfe);
|
||||
}
|
||||
.version-history-timeline {
|
||||
list-style: none;
|
||||
@@ -52,109 +130,270 @@
|
||||
min-width: 0;
|
||||
}
|
||||
.version-history-entry {
|
||||
border-left: 3px solid rgba(127, 127, 127, 0.35);
|
||||
padding: 10px 12px;
|
||||
background: rgba(127, 127, 127, 0.06);
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--border-base, #e2e8f0);
|
||||
border-radius: 8px;
|
||||
background: var(--bg-panel, #fff);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
.version-history-entry.release {
|
||||
border-left-color: #2f9e44;
|
||||
}
|
||||
.version-history-entry.development {
|
||||
border-left-color: #1c7ed6;
|
||||
.version-history-entry.is-current {
|
||||
border-color: #3ba879;
|
||||
}
|
||||
.version-history-entry-head {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.version-history-entry-head strong {
|
||||
font-size: 15px;
|
||||
}
|
||||
.version-history-entry-meta {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 4px;
|
||||
font-size: 12px;
|
||||
color: var(--muted, #666);
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
min-height: 62px;
|
||||
padding: 12px 16px;
|
||||
border: 0;
|
||||
border-radius: 0;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
text-align: left;
|
||||
color: inherit;
|
||||
font-weight: 400;
|
||||
}
|
||||
.version-history-entry-head:hover {
|
||||
background: var(--bg-hover, #f8fafc);
|
||||
}
|
||||
.version-history-entry-head[aria-expanded='true'] {
|
||||
background: var(--bg-page, #f8fafc);
|
||||
border-bottom: 1px solid var(--border-base, #e2e8f0);
|
||||
}
|
||||
.version-history-entry-head:focus-visible {
|
||||
outline: 2px solid var(--c-run, #2563eb);
|
||||
outline-offset: -3px;
|
||||
}
|
||||
.version-history-version {
|
||||
display: inline-block;
|
||||
flex-shrink: 0;
|
||||
font-size: 13px;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--border-strong, #cbd5e1);
|
||||
border-radius: 5px;
|
||||
font-weight: 500;
|
||||
color: var(--ink-mute);
|
||||
}
|
||||
.version-history-version.development {
|
||||
border-color: #b4d1f5;
|
||||
color: #2465aa;
|
||||
}
|
||||
.version-history-version.release {
|
||||
border-color: #b1d7bd;
|
||||
color: #24814e;
|
||||
}
|
||||
.version-history-badge {
|
||||
padding: 1px 6px;
|
||||
border-radius: 999px;
|
||||
border: 1px solid currentColor;
|
||||
font-size: 12px;
|
||||
}
|
||||
.version-history-badge.release {
|
||||
color: #2f9e44;
|
||||
}
|
||||
.version-history-badge.development {
|
||||
color: #1c7ed6;
|
||||
}
|
||||
.version-history-badge.historical {
|
||||
color: #868e96;
|
||||
display: inline-block;
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-size: 11px;
|
||||
white-space: nowrap;
|
||||
flex-shrink: 0;
|
||||
color: var(--ink-mute);
|
||||
background: var(--bg-soft);
|
||||
}
|
||||
.version-history-badge.current {
|
||||
color: #e8590c;
|
||||
color: #177244;
|
||||
background: #eaf7ef;
|
||||
}
|
||||
.version-history-badge.pending {
|
||||
color: #1c7ed6;
|
||||
.version-history-badge.pending,
|
||||
.version-history-badge.development {
|
||||
color: #2465aa;
|
||||
background: #eff6ff;
|
||||
}
|
||||
.version-history-badge.release {
|
||||
color: #24814e;
|
||||
background: #eaf7ef;
|
||||
}
|
||||
.version-history-badge.warn {
|
||||
color: #c92a2a;
|
||||
color: #b42318;
|
||||
background: #fff1ef;
|
||||
}
|
||||
.version-history-sha {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
font-family: var(--font-mono, ui-monospace, monospace);
|
||||
overflow-wrap: anywhere;
|
||||
font-size: 12px;
|
||||
}
|
||||
.version-history-entry-head > .version-history-sha,
|
||||
.version-history-entry-head time {
|
||||
color: var(--ink-faint, #7c8c9f);
|
||||
flex-shrink: 0;
|
||||
font-size: 12px;
|
||||
}
|
||||
.version-history-subject {
|
||||
margin: 6px 0 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version-history-reason {
|
||||
margin: 4px 0 0;
|
||||
font-size: 12px;
|
||||
color: #c92a2a;
|
||||
flex: 1;
|
||||
min-width: 80px;
|
||||
font-size: 14px;
|
||||
line-height: 1.6;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version-history-toggle {
|
||||
margin-top: 6px;
|
||||
flex-shrink: 0;
|
||||
font-size: 13px;
|
||||
color: var(--c-run, #2563eb);
|
||||
}
|
||||
.version-history-detail pre {
|
||||
margin: 6px 0 0;
|
||||
padding: 8px;
|
||||
max-height: 320px;
|
||||
overflow: auto;
|
||||
background: rgba(127, 127, 127, 0.1);
|
||||
border-radius: 6px;
|
||||
.version-history-detail {
|
||||
padding: 16px;
|
||||
min-width: 0;
|
||||
}
|
||||
.version-history-notes h4 {
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
}
|
||||
.version-history-change-row {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
gap: 12px;
|
||||
margin: 0 0 12px;
|
||||
font-size: 14px;
|
||||
line-height: 1.8;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version-history-change-row > span:last-child {
|
||||
min-width: 0;
|
||||
}
|
||||
.version-history-change-tag {
|
||||
flex-shrink: 0;
|
||||
padding: 1px 7px;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 1.6;
|
||||
background: #eef2f6;
|
||||
color: #536275;
|
||||
}
|
||||
.version-history-change-tag.added {
|
||||
background: #eaf7ef;
|
||||
color: #177244;
|
||||
}
|
||||
.version-history-change-tag.fixed {
|
||||
background: #fff3df;
|
||||
color: #986000;
|
||||
}
|
||||
.version-history-change-tag.changed {
|
||||
background: #eff6ff;
|
||||
color: #2465aa;
|
||||
}
|
||||
.version-history-change-tag.security {
|
||||
background: #fff1ef;
|
||||
color: #b42318;
|
||||
}
|
||||
.version-history-notes code {
|
||||
font-size: 12px;
|
||||
background: var(--bg-soft);
|
||||
border-radius: 3px;
|
||||
padding: 1px 4px;
|
||||
}
|
||||
.version-history-reason,
|
||||
.version-history-no-notes {
|
||||
margin: 0;
|
||||
font-size: 12px;
|
||||
color: var(--ink-mute);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version-history-reason {
|
||||
padding: 0 16px 10px;
|
||||
color: #986000;
|
||||
}
|
||||
.version-history-technical {
|
||||
margin-top: 14px;
|
||||
padding-top: 12px;
|
||||
border-top: 1px solid var(--border-base);
|
||||
font-size: 12px;
|
||||
color: var(--ink-mute);
|
||||
}
|
||||
.version-history-technical summary {
|
||||
cursor: pointer;
|
||||
}
|
||||
.version-history-technical dl {
|
||||
display: grid;
|
||||
gap: 10px;
|
||||
margin: 12px 0;
|
||||
}
|
||||
.version-history-technical pre {
|
||||
white-space: pre-wrap;
|
||||
overflow-wrap: anywhere;
|
||||
max-height: 320px;
|
||||
overflow: auto;
|
||||
font-size: 12px;
|
||||
line-height: 1.7;
|
||||
padding: 12px;
|
||||
border: 1px solid var(--border-base);
|
||||
border-radius: 6px;
|
||||
background: var(--bg-page);
|
||||
}
|
||||
.version-history-links {
|
||||
display: flex;
|
||||
gap: 10px;
|
||||
flex-wrap: wrap;
|
||||
margin-top: 6px;
|
||||
font-size: 13px;
|
||||
gap: 12px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
.version-history-more {
|
||||
display: block;
|
||||
margin: 18px auto 0;
|
||||
}
|
||||
@media (max-width: 1100px) {
|
||||
.version-history-entry-head {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.version-history-subject {
|
||||
flex-basis: 55%;
|
||||
}
|
||||
.version-history-build-grid {
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
.version-history-build-grid > div {
|
||||
border-bottom: 1px solid var(--border-base);
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 760px) {
|
||||
.version-history {
|
||||
padding: 12px;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.version-history-header {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
}
|
||||
.version-history-entry {
|
||||
padding: 8px 10px;
|
||||
.version-history-header,
|
||||
.version-history-current-card,
|
||||
.version-history-records {
|
||||
padding: 14px;
|
||||
}
|
||||
.version-history-entry-head {
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
align-items: flex-start;
|
||||
gap: 7px;
|
||||
padding: 12px;
|
||||
}
|
||||
.version-history-entry-head > .version-history-badge {
|
||||
align-self: flex-start;
|
||||
}
|
||||
.version-history-entry-head time {
|
||||
white-space: normal;
|
||||
}
|
||||
.version-history-subject {
|
||||
flex-basis: auto;
|
||||
width: 100%;
|
||||
}
|
||||
.version-history-toggle {
|
||||
align-self: flex-end;
|
||||
}
|
||||
.version-history-build-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
.version-history-build-grid > div {
|
||||
border-right: 0;
|
||||
}
|
||||
.version-history-actions {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
.version-history-detail {
|
||||
padding: 12px;
|
||||
}
|
||||
.version-history-change-row {
|
||||
gap: 8px;
|
||||
}
|
||||
/* 窄屏单列:正文/标题/hash 一律换行,不出现横向滚动 */
|
||||
.version-history,
|
||||
.version-history-timeline,
|
||||
.version-history-entry,
|
||||
@@ -165,7 +404,7 @@
|
||||
overflow-wrap: anywhere;
|
||||
word-break: break-word;
|
||||
}
|
||||
.version-history-detail pre {
|
||||
.version-history-technical pre {
|
||||
max-height: none;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user