forked from longtao.wu/droboticflow
♻️ Align acceptance viewing with the quality review workspace
This commit is contained in:
parent
484e5d591b
commit
1dc9710746
58
.scratch/acceptance-quality-alignment/work.md
Normal file
58
.scratch/acceptance-quality-alignment/work.md
Normal file
@ -0,0 +1,58 @@
|
||||
# 验收对齐质检交互(position 592)
|
||||
|
||||
Status: resolved
|
||||
|
||||
授权:2026-11-15 章鸿铭群内方向、程晓明认可;本地分析、实现、验证和提交,不推送、不部署。
|
||||
基线:484e5d59 / unified dev recent-integration;新鲜度检查确认包含远端及线上版本。三个 UI 提交 0a60d803、230491b0、f7e4cb28 均保留;484e5d59 属于其他任务,不改动、不归入本需求成果。共享树其他 AGENTS/docs/领取池 Go 改动保持原样。
|
||||
|
||||
## 只读差距清单(实现前核对)
|
||||
|
||||
| 项目 | 质检 | 验收 | 本次处理 |
|
||||
| --- | --- | --- | --- |
|
||||
| 面板结构 | CaptureAnnotationWorkbench,左动作栏、中视频/轨道、右详情/意见;专注左 150、右 310 | FinalAcceptanceWorkspace 内再次嵌套左栏+mediaOnly 播放器,普通左160/右280、专注左150/右310 | 共用动作栏、统一尺寸和区域分配;验收右栏保留自己的传入内容 |
|
||||
| 左栏内容 | actionJudgment 状态、描述、双时间,另有返工变更/意见徽标;无独立时长行 | acceptanceActionStatus 状态、描述、双时间、三位小数秒数与短区间,加载/失败/空/舍弃独立处理 | 共用同一只读动作列表;加入共同的时长/短区间,质检返工徽标不丢失,不改标注可编辑列表 |
|
||||
| 切片选择 | 视频上方 capture-slice-navigator 下拉,配合下方切片轨道 | 下方切片块为主,视频上方无切片下拉 | 共用切片下拉形态,验收继续由 chooseSlice 提交已验证元数据后切换 |
|
||||
| 双时间 | Capture 时钟减片头得到片内,原视频沿用 Capture;#19 已补列表/详情 | 播放器片内时钟 + 当前来源冻结片头,进度条是跨来源拼接时间 | 保留 #19 原视频映射,不把拼接进度当原视频;统一标签与精度 |
|
||||
| 动作轨道 | 共用标注组件中的只读轨道,无标注编辑 | 独立 AcceptanceActionTimeline,可平移、滚动、定位;#18 已解决比例过窄 | 保留 #18 原语,验收轨道/切片概览位于视频下方;不把标注编辑带入验收 |
|
||||
| 快捷键 | reviewShortcut + ReviewViewingController;复审特有 J/K、1/2 条件启用 | 同一 reviewShortcut + 映射控制器及外层事件分发 | 保留既有键表和输入/弹层/只读保护;不复制第二份键表,不带入质检复审判定 |
|
||||
| 定位与选择 | selectReviewAction/seekSlice/seekTime,Capture 坐标 | chooseSlice 异步加载、slice-seconds 审查身份,经 finalController 映射 | 只替换视觉入口,点击/下拉/键盘都继续使用各自已验证控制器;保留切换失败原状态 |
|
||||
| 状态标识 | 原标注状态 + 返工问题数、改动,当前画面原文 | 原状态 + 短区间、舍弃、只读、文件/映射就绪、导航失败 | 共同列表显示原状态;阶段专属提示保留在既有区域,不伪造“已检查”状态 |
|
||||
| 决定与记录 | 质检通过/退回标注,复审返工判定 | 验收通过/打回质检、只读、旧版确认/评分/姿态、验收记录 | 全部保留,API、保存协议、权限、误报/退回效果均不变 |
|
||||
| 匿名 | 质检按授权可见生产归属 | 最终验收依赖现有匿名追溯/内容投影 | 不将质检任务身份/供应商/人员数据接入验收,共用组件只收动作和切片显示信息 |
|
||||
|
||||
证据入口:CaptureAnnotationWorkbench 的 actionListForRender、reviewControllerCurrent、capture-camera-selection、review-qa-side-panel;FinalAcceptanceWorkspace 的 mapReviewPosition、chooseSlice、finalController、acceptance-player-with-actions、footer;src/lib/review-shortcuts.js;src/styles/review-workspace.css;ADR 0013。
|
||||
|
||||
## 布局与实施顺序
|
||||
|
||||
1. 共用 ReviewActionList:动作状态、描述、双时间、时长/短区间、加载/空/失败/舍弃及选中自动滚动。只用于质检与验收;标注编写流程保留。
|
||||
2. 共用 ReviewSliceNavigator:质检现有视频顶部下拉作为模板,验收使用同入口;验收保留跨来源/异步切换控制器和只读切片概览。
|
||||
3. 对齐左/右栏尺寸、列表密度、当前详情与意见布局;保留验收文件/姿态/记录和固定决定栏。#18 滚动与 #19 时间显示纳入新布局,不改写旧提交。
|
||||
4. 三播放器完整验收浏览器、质检/标注回归、密集动作/普通/专注/窄屏/只读/加载/失败及切换保护;定向类型、架构、前端与工具验证;本地提交。
|
||||
|
||||
保护范围:不修改后台、Mongo、生产数据、任务领取、供应商匿名/记录投影、正式决定处理和会话写锁。正式发布和客户验收另行授权。
|
||||
|
||||
|
||||
## 实现与保留差异
|
||||
|
||||
已实现:ReviewActionList 同时承接质检和验收的左栏,沿用质检已有 actionJudgment,不改写冻结动作;三种状态、描述、双时间、秒数与短区间、选中自动滚动共用实现,质检返工意见数/本轮改动和 data-rework 标记继续保留。ReviewSliceNavigator 将质检视频顶部的切片下拉形态用于两端;验收选择继续委托 chooseSlice,并保留异步加载、失败保留、快速切换和未保存批注保护。验收普通左栏对齐 170px、右栏对齐 310px,专注维持两端既有左150px/右310px;顶部工具栏允许换行,避免窄屏被切片选择挤出。左栏行高与双时间排版、深色选中态共用。
|
||||
|
||||
保留差异具有业务原因:验收仍有跨来源拼接进度和独立文件/姿态核验、验收记录、固定验收通过/打回质检按钮;质检仍有返工基线与复审判定。验收继续用可横向平移/滚动的只读动作时间轴;未把标注可编辑轨道或质检返工判定带入验收,也没有将两端媒体/坐标协议强行合并。验收供应商匿名和正式记录效果沿用现有 API/投影,未新增身份字段的展示或请求。
|
||||
|
||||
三个待推送提交均保留:0a60d803 的时长/短区间移入共用左栏,并给质检同等信息;230491b0 的鼠标平移、可见横向滚动控件和选中自动可见继续保留;f7e4cb28 的原视频时间映射与播放/列表/详情双时间保持。没有重写历史提交。
|
||||
|
||||
## 最终验证
|
||||
|
||||
基线仍为 484e5d59。新鲜度已确认包含 origin/dev 与线上版本;执行 verify:plan,quick 和 task 使用原 scripts/verify-change.py 执行器,仅筛选本需求负责文件,排除共享树他人的文档及领取池 Go 测试。三播放器最终源码上的最新成功证据在 task 中以源码/测试 SHA-256 身份复用;其他任务级项目串行实际执行,无跳过。报告 inputsChangedDuringRun=false。
|
||||
|
||||
- 最终任务报告:local-data/test-results/verify-1794811935943889000/report.json,selected-checks-passed;主日志 local-data/test-results/acceptance-alignment/task-final.log。
|
||||
- 类型/架构检查、180 项定向 Node 前端/工具测试、22 项 Python 验证工具测试、改动格式及 diff 检查通过。
|
||||
- 原生、Movi、Movi 分数偏移三播放器,实际验收整页各 15 次切片变化通过:新切片下拉、点击/键盘、短动作和双时间、倍速保留、舍弃、意见编辑/保存/刷新、只读导航、决定按钮禁用、普通/专注/深色窄屏、24 动作滚动及加载/空/失败。原供应商/标注人员哨兵字段未在验收正文或新导航中出现。证据 acceptance/report.json、acceptance.log 及 screenshots(位于 acceptance/)。
|
||||
- 真实标注/质检共享工作台原视频稳定定位、列表/详情、新共用质检左栏时长和状态及顶部切片选择通过:任务报告 06.log;截图 local-data/test-results/issue19/workbenches/{annotation,quality}.png。
|
||||
- #18 鼠标拖动不误定位、横向滚轮/滚动控件和末条自动可见:normal/focused/focused&readonly 通过。
|
||||
- 字幕加载、解码错误隐藏、恢复、卸载/重挂通过。首次任务级运行在夹具 page.goto 的 load 等待超时,未进入业务断言;将本地浏览器设为无代理并在 DOMContentLoaded 后继续使用原有字幕就绪断言,单独和最终任务级重跑通过。保留失败报告 verify-1794811536011877000,不将它冒充通过。
|
||||
- 隔离内存 HTTP 服务与真实浏览器:标注边界/舍弃/撤销重做/失败与丢响应恢复,意见草稿持久化,正式决定失败/重复提交/确认恢复,以及审查只读/输入保护全部通过,见任务报告 09–12.log。未连接客户 Mongo/公司集群/BOS。
|
||||
- 最终前端构建通过(acceptance-alignment/build.log,既有 chunk 大小提示仍在)。人工查看了质检、验收普通/专注与深色窄屏代表截图;当前业务资料、用户意见、异常和决定入口保留。
|
||||
|
||||
本次只修改前端展示/导航入口、相应测试和验证映射;服务端、权限/匿名投影、审核保存、正式验收记录、返工效果未改。未执行生产容量或生产业务验收,不代表已部署/客户已使用。
|
||||
|
||||
本地提交前使用 lint-staged --no-stash 和等价 lint 检查,避免默认钩子临时 stash 共享树他人工作。提交后运行 agent_status --no-fetch。后续必须由章鸿铭明确授权才可推送;部署仍需另行授权及正式发布流程。
|
||||
@ -150,7 +150,7 @@
|
||||
{
|
||||
"name": "acceptance-playback-and-feedback",
|
||||
"paths": [
|
||||
"^src/components/(FinalAcceptanceWorkspace|AcceptanceActionTimeline)\\.tsx$",
|
||||
"^src/components/(FinalAcceptanceWorkspace|AcceptanceActionTimeline|ReviewActionList|ReviewSliceNavigator)\\.tsx$",
|
||||
"^tests/browser/acceptance-timeline-pan\\.mjs$",
|
||||
"^tests/browser/fixtures/acceptance-timeline-pan\\.tsx$",
|
||||
"^tests/browser/acceptance-playback-rate\\.mjs$",
|
||||
|
||||
@ -1,3 +1,6 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { ReviewActionList } from "./ReviewActionList";
|
||||
import { ReviewSliceNavigator } from "./ReviewSliceNavigator";
|
||||
import type { AnnotationTimelineFailure } from "../lib/annotation-source-validation";
|
||||
// Workbench-only layout rules. Loading them with this component (instead of
|
||||
// the global entry stylesheet) keeps the annotation workspace CSS off the
|
||||
@ -319,6 +322,7 @@ type Props = ReviewViewingProps & {
|
||||
initialSliceId?: string;
|
||||
onReturnToPool?: () => void;
|
||||
mediaOnly?: boolean;
|
||||
reviewSliceNavigator?: ReactNode;
|
||||
onMediaDuration?: (duration: number) => void;
|
||||
browserReadyMedia?: boolean;
|
||||
seekRequest?: { time: number; revision: number } | null;
|
||||
@ -473,6 +477,7 @@ export function CaptureAnnotationWorkbench({
|
||||
initialSliceId = "",
|
||||
onReturnToPool,
|
||||
mediaOnly = false,
|
||||
reviewSliceNavigator,
|
||||
onMediaDuration,
|
||||
browserReadyMedia = false,
|
||||
seekRequest,
|
||||
@ -3582,44 +3587,61 @@ export function CaptureAnnotationWorkbench({
|
||||
{userErrorMessage(operationError || error)}
|
||||
</div>
|
||||
) : null}
|
||||
{continuousActions && phase === "annotate" && (
|
||||
<aside className="capture-action-list" aria-label="当前切片动作列表">
|
||||
<strong>动作 · {actionListForRender.length}</strong>
|
||||
<div ref={actionListRef} role="listbox" aria-label="动作区间" className="capture-action-list-scroll">
|
||||
{actionListForRender.map((action, index) => (
|
||||
<button
|
||||
key={action.id}
|
||||
type="button"
|
||||
role="option"
|
||||
aria-selected={editingAnnotation?.id === action.id}
|
||||
disabled={selectedDiscarded}
|
||||
data-rework-red={(trackActionBuckets.get(action.id)?.red.length || 0) > 0 || undefined}
|
||||
data-rework-changed={changedActionIds.has(action.id) || undefined}
|
||||
onClick={() => seekAnnotation(action, "start")}
|
||||
>
|
||||
<span>
|
||||
#{index + 1} ·{" "}
|
||||
{changedActionIds.has(action.id) && <span className="capture-change-badge">本轮改动</span>}{" "}
|
||||
{(trackActionBuckets.get(action.id)?.red.length || 0) > 0 ? (
|
||||
<span className="font-bold text-rose-600 dark:text-rose-400">
|
||||
意见 {trackActionBuckets.get(action.id)!.red.length} ·{" "}
|
||||
</span>
|
||||
) : null}
|
||||
{actionJudgment(action) === "pending"
|
||||
? "待标注"
|
||||
: actionJudgment(action) === "invalid"
|
||||
? "无效"
|
||||
: "已描述"}
|
||||
</span>
|
||||
<small>
|
||||
片内 {formatTime(action.start - selectedSlice.start)}–{formatTime(action.end - selectedSlice.start)}
|
||||
<span className="block">{formatOriginalVideoTime(action.start, action.end)}</span>
|
||||
</small>
|
||||
<span title={action.description}>{action.description || "待标注"}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</aside>
|
||||
{continuousActions && phase === "annotate" && isQualityReview ? (
|
||||
<ReviewActionList
|
||||
actions={actionListForRender}
|
||||
selectedActionId={editingAnnotation?.id || reviewCaption?.action?.id}
|
||||
sliceStart={selectedSlice.start}
|
||||
originalVideoOffset={0}
|
||||
disabled={saving || !timelineReady}
|
||||
discarded={selectedDiscarded}
|
||||
onSelect={(id) => {
|
||||
selectReviewAction(id);
|
||||
}}
|
||||
changedActionIds={changedActionIds}
|
||||
problemCounts={new Map([...trackActionBuckets].map(([id, bucket]) => [id, bucket.red.length]))}
|
||||
/>
|
||||
) : (
|
||||
continuousActions &&
|
||||
phase === "annotate" && (
|
||||
<aside className="capture-action-list" aria-label="当前切片动作列表">
|
||||
<strong>动作 · {actionListForRender.length}</strong>
|
||||
<div ref={actionListRef} role="listbox" aria-label="动作区间" className="capture-action-list-scroll">
|
||||
{actionListForRender.map((action, index) => (
|
||||
<button
|
||||
key={action.id}
|
||||
type="button"
|
||||
role="option"
|
||||
aria-selected={editingAnnotation?.id === action.id}
|
||||
disabled={selectedDiscarded}
|
||||
data-rework-red={(trackActionBuckets.get(action.id)?.red.length || 0) > 0 || undefined}
|
||||
data-rework-changed={changedActionIds.has(action.id) || undefined}
|
||||
onClick={() => seekAnnotation(action, "start")}
|
||||
>
|
||||
<span>
|
||||
#{index + 1} ·{" "}
|
||||
{changedActionIds.has(action.id) && <span className="capture-change-badge">本轮改动</span>}{" "}
|
||||
{(trackActionBuckets.get(action.id)?.red.length || 0) > 0 ? (
|
||||
<span className="font-bold text-rose-600 dark:text-rose-400">
|
||||
意见 {trackActionBuckets.get(action.id)!.red.length} ·{" "}
|
||||
</span>
|
||||
) : null}
|
||||
{actionJudgment(action) === "pending"
|
||||
? "待标注"
|
||||
: actionJudgment(action) === "invalid"
|
||||
? "无效"
|
||||
: "已描述"}
|
||||
</span>
|
||||
<small>
|
||||
片内 {formatTime(action.start - selectedSlice.start)}–{formatTime(action.end - selectedSlice.start)}
|
||||
<span className="block">{formatOriginalVideoTime(action.start, action.end)}</span>
|
||||
</small>
|
||||
<span title={action.description}>{action.description || "待标注"}</span>
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
</aside>
|
||||
)
|
||||
)}
|
||||
<dialog
|
||||
ref={stageDialogRef}
|
||||
@ -4021,30 +4043,43 @@ export function CaptureAnnotationWorkbench({
|
||||
data-testid="capture-video-panel"
|
||||
>
|
||||
<div className="capture-camera-selection mb-2 flex gap-4 text-sm font-medium text-[color:var(--app-text)]">
|
||||
{reviewSliceNavigator}
|
||||
{!mediaOnly && (
|
||||
<>
|
||||
<label className="capture-slice-navigator">
|
||||
<span className="sr-only">切片列表</span>
|
||||
<select
|
||||
aria-label="切片列表"
|
||||
value={selectedSlice.id}
|
||||
{isQualityReview ? (
|
||||
<ReviewSliceNavigator
|
||||
slices={slices}
|
||||
selectedId={selectedSlice.id}
|
||||
disabled={saving || !timelineReady}
|
||||
onChange={(event) => {
|
||||
const slice = slices.find((item) => item.id === event.target.value);
|
||||
onSelect={(id) => {
|
||||
const slice = slices.find((item) => item.id === id);
|
||||
if (slice) selectSlice(slice);
|
||||
}}
|
||||
>
|
||||
{slices.map((slice, index) => (
|
||||
<option key={slice.id} value={slice.id}>
|
||||
{String(index + 1).padStart(3, "0")} ·{" "}
|
||||
{slice.deliveryDisposition === "discard"
|
||||
? `舍弃:${slice.discardReason || "未记录原因"}`
|
||||
: `保留:${slice.name || "未命名"}`}{" "}
|
||||
· {formatTime(slice.start)}–{formatTime(slice.end)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
/>
|
||||
) : (
|
||||
<label className="capture-slice-navigator">
|
||||
<span className="sr-only">切片列表</span>
|
||||
<select
|
||||
aria-label="切片列表"
|
||||
value={selectedSlice.id}
|
||||
disabled={saving || !timelineReady}
|
||||
onChange={(event) => {
|
||||
const slice = slices.find((item) => item.id === event.target.value);
|
||||
if (slice) selectSlice(slice);
|
||||
}}
|
||||
>
|
||||
{slices.map((slice, index) => (
|
||||
<option key={slice.id} value={slice.id}>
|
||||
{String(index + 1).padStart(3, "0")} ·{" "}
|
||||
{slice.deliveryDisposition === "discard"
|
||||
? `舍弃:${slice.discardReason || "未记录原因"}`
|
||||
: `保留:${slice.name || "未命名"}`}{" "}
|
||||
· {formatTime(slice.start)}–{formatTime(slice.end)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
)}
|
||||
<button
|
||||
type="button"
|
||||
className="capture-slice-zoom"
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
import { ReviewActionList } from "./ReviewActionList";
|
||||
import { ReviewSliceNavigator } from "./ReviewSliceNavigator";
|
||||
import { formatOriginalVideoTime } from "../lib/annotation-time.js";
|
||||
import {
|
||||
acceptanceMetadataKey,
|
||||
@ -23,7 +25,6 @@ import { apiFetch } from "../services/api/client";
|
||||
import { buildAPIURL } from "../services/api/base-url.js";
|
||||
import {
|
||||
acceptanceActions,
|
||||
acceptanceActionStatus,
|
||||
acceptanceTimestampOpinions,
|
||||
acceptanceViewStatus,
|
||||
acceptanceSliceCountLabel,
|
||||
@ -386,14 +387,8 @@ export function FinalAcceptanceWorkspace({
|
||||
return [...new Set([0, ...values, duration])].sort((a, b) => a - b);
|
||||
}, [currentMetadata?.frames, duration]);
|
||||
const actions = currentMetadata?.actions || [];
|
||||
const actionListRef = useRef<HTMLDivElement>(null);
|
||||
const highlightedActionId =
|
||||
selectedActionId || actions.find((action) => currentTime >= action.start && currentTime < action.end)?.id;
|
||||
useEffect(() => {
|
||||
const list = actionListRef.current;
|
||||
const row = list?.querySelector<HTMLElement>("[aria-selected='true']");
|
||||
if (list && row) list.scrollTo({ top: Math.max(0, row.offsetTop - list.clientHeight * 0.4) });
|
||||
}, [activeKey, highlightedActionId]);
|
||||
const reviewCaption = reviewCaptionAtTime({
|
||||
time: currentTime,
|
||||
slice: active
|
||||
@ -759,66 +754,40 @@ export function FinalAcceptanceWorkspace({
|
||||
right &&
|
||||
(!active.sourceIndex || (currentMetadata && !currentMetadata.loading && !currentMetadata.error)) ? (
|
||||
<div className="acceptance-player-with-actions">
|
||||
<aside className="capture-action-list acceptance-action-list" aria-label="当前切片动作列表">
|
||||
<strong>
|
||||
动作
|
||||
{currentMetadata &&
|
||||
!currentMetadata.loading &&
|
||||
!currentMetadata.error &&
|
||||
` · ${active.deliveryDisposition === "discard" ? 0 : actions.length}`}
|
||||
</strong>
|
||||
<div
|
||||
ref={actionListRef}
|
||||
role="listbox"
|
||||
aria-label="动作区间"
|
||||
className="capture-action-list-scroll"
|
||||
>
|
||||
{currentMetadata?.error ? (
|
||||
<p role="alert">{userErrorMessage(currentMetadata.error)}</p>
|
||||
) : !currentMetadata || currentMetadata.loading ? (
|
||||
<p role="status">加载中…</p>
|
||||
) : active.deliveryDisposition === "discard" ? (
|
||||
<p>已舍弃</p>
|
||||
) : !actions.length ? (
|
||||
<p>暂无动作区间</p>
|
||||
) : (
|
||||
actions.map((action, index) => {
|
||||
const status = acceptanceActionStatus(action);
|
||||
return (
|
||||
<button
|
||||
key={action.id}
|
||||
type="button"
|
||||
role="option"
|
||||
aria-selected={highlightedActionId === action.id}
|
||||
disabled={saving || navigating}
|
||||
data-short-action={status.short || undefined}
|
||||
onClick={() => mediaControllerRef.current?.seekAction(action.id)}
|
||||
>
|
||||
<span>
|
||||
#{index + 1} · {status.label}
|
||||
</span>
|
||||
<small>
|
||||
片内 {time(action.start)}–{time(action.end)}
|
||||
<span className="block">
|
||||
{formatOriginalVideoTime(action.start, action.end, originalVideoStart)}
|
||||
</span>
|
||||
</small>
|
||||
<span className="acceptance-action-duration">
|
||||
{status.duration.toFixed(3)} 秒{status.short && <b> · 短区间</b>}
|
||||
</span>
|
||||
<span title={action.description}>{action.description}</span>
|
||||
</button>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</aside>
|
||||
<ReviewActionList
|
||||
key={activeKey}
|
||||
actions={active.deliveryDisposition === "discard" ? [] : actions}
|
||||
selectedActionId={highlightedActionId}
|
||||
sliceStart={0}
|
||||
originalVideoOffset={originalVideoStart}
|
||||
loading={!currentMetadata || currentMetadata.loading}
|
||||
error={currentMetadata?.error || ""}
|
||||
discarded={active.deliveryDisposition === "discard"}
|
||||
disabled={saving || navigating}
|
||||
onSelect={(id) => {
|
||||
mediaControllerRef.current?.seekAction(id);
|
||||
}}
|
||||
/>
|
||||
<CaptureAnnotationWorkbench
|
||||
key={`media:${mediaKey}`}
|
||||
playbackRate={playbackRate}
|
||||
onPlaybackRateChange={setPlaybackRate}
|
||||
taskId={mediaKey}
|
||||
mediaOnly
|
||||
reviewSliceNavigator={
|
||||
<ReviewSliceNavigator
|
||||
slices={groups.map((group) => ({
|
||||
...group,
|
||||
start: group.entry.finalSlices?.[group.index - 1]?.start ?? NaN,
|
||||
end: group.entry.finalSlices?.[group.index - 1]?.end ?? NaN,
|
||||
}))}
|
||||
selectedId={active.id}
|
||||
disabled={saving || actionNoteDirty}
|
||||
onSelect={(id) => {
|
||||
if (chooseSlice(id)) workspaceRef.current?.focus({ preventScroll: true });
|
||||
}}
|
||||
/>
|
||||
}
|
||||
originalVideoOffset={originalVideoStart}
|
||||
focusedLayout={focusedLayout}
|
||||
cameraPreferenceKey={cameraPreferenceKey}
|
||||
|
||||
101
src/components/ReviewActionList.tsx
Normal file
101
src/components/ReviewActionList.tsx
Normal file
@ -0,0 +1,101 @@
|
||||
import { useEffect, useRef } from "react";
|
||||
import { formatAnnotationTime, formatOriginalVideoTime } from "../lib/annotation-time.js";
|
||||
import { userErrorMessage } from "../lib/user-error-message.js";
|
||||
import { actionJudgment } from "../lib/continuous-actions.js";
|
||||
import type { ReviewAction } from "./review-viewing";
|
||||
|
||||
type Action = ReviewAction & { status?: string };
|
||||
|
||||
/** Shared viewing rail; selection delegates to the role's existing controller. */
|
||||
export function ReviewActionList({
|
||||
actions,
|
||||
selectedActionId,
|
||||
sliceStart,
|
||||
originalVideoOffset,
|
||||
onSelect,
|
||||
disabled = false,
|
||||
loading = false,
|
||||
error = "",
|
||||
discarded = false,
|
||||
changedActionIds,
|
||||
problemCounts,
|
||||
}: {
|
||||
key?: string;
|
||||
actions: Action[];
|
||||
selectedActionId?: string | null;
|
||||
sliceStart: number;
|
||||
originalVideoOffset: number;
|
||||
onSelect: (id: string) => void;
|
||||
disabled?: boolean;
|
||||
loading?: boolean;
|
||||
error?: string;
|
||||
discarded?: boolean;
|
||||
changedActionIds?: ReadonlySet<string>;
|
||||
problemCounts?: ReadonlyMap<string, number>;
|
||||
}) {
|
||||
const listRef = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
const list = listRef.current;
|
||||
const row = list?.querySelector<HTMLElement>("[aria-selected='true']");
|
||||
if (list && row) list.scrollTo({ top: Math.max(0, row.offsetTop - list.clientHeight * 0.4) });
|
||||
}, [selectedActionId, loading, actions.length]);
|
||||
return (
|
||||
<aside className="capture-action-list review-action-list acceptance-action-list" aria-label="当前切片动作列表">
|
||||
<strong>动作{!loading && !error && ` · ${actions.length}`}</strong>
|
||||
<div ref={listRef} role="listbox" aria-label="动作区间" className="capture-action-list-scroll">
|
||||
{error ? (
|
||||
<p role="alert">{userErrorMessage(error)}</p>
|
||||
) : loading ? (
|
||||
<p role="status">加载中…</p>
|
||||
) : !actions.length ? (
|
||||
<p>{discarded ? "已舍弃" : "暂无动作区间"}</p>
|
||||
) : (
|
||||
actions.map((action, index) => {
|
||||
const judgment = actionJudgment(action);
|
||||
const duration = action.end - action.start;
|
||||
const status = {
|
||||
duration,
|
||||
label: judgment === "pending" ? "待标注" : judgment === "invalid" ? "无效" : "已描述",
|
||||
short: judgment !== "invalid" && Number.isFinite(duration) && duration > 0 && duration < 3,
|
||||
};
|
||||
return (
|
||||
<button
|
||||
key={action.id}
|
||||
type="button"
|
||||
role="option"
|
||||
aria-selected={selectedActionId === action.id}
|
||||
disabled={disabled || discarded}
|
||||
data-short-action={status.short || undefined}
|
||||
data-action-status={status.label}
|
||||
data-rework-red={(problemCounts?.get(action.id) || 0) > 0 || undefined}
|
||||
data-rework-changed={changedActionIds?.has(action.id) || undefined}
|
||||
onClick={() => onSelect(action.id)}
|
||||
>
|
||||
<span>
|
||||
#{index + 1} ·{" "}
|
||||
{changedActionIds?.has(action.id) && <span className="capture-change-badge">本轮改动</span>}
|
||||
{(problemCounts?.get(action.id) || 0) > 0 && (
|
||||
<span className="font-bold text-rose-600 dark:text-rose-400">
|
||||
意见 {problemCounts!.get(action.id)} ·{" "}
|
||||
</span>
|
||||
)}
|
||||
{status.label}
|
||||
</span>
|
||||
<small>
|
||||
片内 {formatAnnotationTime(action.start - sliceStart)}–{formatAnnotationTime(action.end - sliceStart)}
|
||||
<span className="block">
|
||||
{formatOriginalVideoTime(action.start, action.end, originalVideoOffset)}
|
||||
</span>
|
||||
</small>
|
||||
<span className="acceptance-action-duration">
|
||||
{status.duration.toFixed(3)} 秒{status.short && <b> · 短区间</b>}
|
||||
</span>
|
||||
<span title={action.description}>{action.description || "待标注"}</span>
|
||||
</button>
|
||||
);
|
||||
})
|
||||
)}
|
||||
</div>
|
||||
</aside>
|
||||
);
|
||||
}
|
||||
43
src/components/ReviewSliceNavigator.tsx
Normal file
43
src/components/ReviewSliceNavigator.tsx
Normal file
@ -0,0 +1,43 @@
|
||||
import { formatOriginalVideoTime } from "../lib/annotation-time.js";
|
||||
|
||||
/** Viewing-only selection. Caller retains role-specific navigation and async guards. */
|
||||
export function ReviewSliceNavigator({
|
||||
slices,
|
||||
selectedId,
|
||||
disabled,
|
||||
onSelect,
|
||||
}: {
|
||||
slices: {
|
||||
id: string;
|
||||
name?: string;
|
||||
start: number;
|
||||
end: number;
|
||||
deliveryDisposition?: string;
|
||||
discardReason?: string;
|
||||
}[];
|
||||
selectedId: string;
|
||||
disabled: boolean;
|
||||
onSelect: (id: string) => void;
|
||||
}) {
|
||||
return (
|
||||
<label className="capture-slice-navigator">
|
||||
<span className="sr-only">切片列表</span>
|
||||
<select
|
||||
aria-label="切片列表"
|
||||
value={selectedId}
|
||||
disabled={disabled}
|
||||
onChange={(event) => onSelect(event.target.value)}
|
||||
>
|
||||
{slices.map((slice, index) => (
|
||||
<option key={slice.id} value={slice.id}>
|
||||
{String(index + 1).padStart(3, "0")} ·{" "}
|
||||
{slice.deliveryDisposition === "discard"
|
||||
? `舍弃:${slice.discardReason || "未记录原因"}`
|
||||
: `保留:${slice.name || "未命名"}`}{" "}
|
||||
· {formatOriginalVideoTime(slice.start, slice.end)}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
</label>
|
||||
);
|
||||
}
|
||||
@ -622,3 +622,61 @@ html.dark .review-focus-heading > button:hover:not(:disabled) {
|
||||
cursor: pointer;
|
||||
accent-color: #64748b;
|
||||
}
|
||||
|
||||
/* Quality review is the viewing template for both roles. */
|
||||
.capture-action-list.review-action-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
min-width: 0;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
padding: 6px;
|
||||
}
|
||||
.review-action-list .capture-action-list-scroll {
|
||||
min-height: 0;
|
||||
flex: 1;
|
||||
}
|
||||
.review-action-list .capture-action-list-scroll button {
|
||||
min-height: 82px;
|
||||
flex-shrink: 0;
|
||||
gap: 2px;
|
||||
font-size: 11px;
|
||||
}
|
||||
.review-action-list button[data-short-action] {
|
||||
border-left: 3px solid #d97706;
|
||||
}
|
||||
.review-action-list .capture-action-list-scroll button > small {
|
||||
font-size: 10px;
|
||||
line-height: 1.4;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
html.dark .review-action-list button[aria-selected="true"] {
|
||||
background: #431407;
|
||||
color: #ffedd5;
|
||||
}
|
||||
.acceptance-player-with-actions {
|
||||
grid-template-columns: 170px minmax(0, 1fr);
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"] > div.grid {
|
||||
--review-inspector-width: 310px;
|
||||
}
|
||||
@container (min-width: 980px) {
|
||||
[data-testid="final-acceptance-workspace"] > div.grid {
|
||||
grid-template-columns: minmax(0, 1fr) var(--review-inspector-width);
|
||||
}
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"] .capture-camera-selection {
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 4px 8px;
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"] .capture-slice-navigator {
|
||||
min-width: 0;
|
||||
max-width: 100%;
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"] .capture-slice-navigator select {
|
||||
max-width: min(100%, 420px);
|
||||
}
|
||||
[data-testid="final-acceptance-workspace"][data-review-focused] [data-testid="capture-video-panel"] {
|
||||
grid-template-rows: minmax(26px, max-content) minmax(0, 1fr) minmax(50px, max-content);
|
||||
}
|
||||
|
||||
@ -227,12 +227,23 @@ try {
|
||||
);
|
||||
await page.goto(`${base}/__acceptance_playback_rate`);
|
||||
await page.getByLabel("播放速度").waitFor();
|
||||
assert(
|
||||
!/SUPPLIER_IDENTITY_MUST_STAY_HIDDEN|ANNOTATOR_IDENTITY_MUST_STAY_HIDDEN/.test(
|
||||
await page.locator("body").innerText(),
|
||||
),
|
||||
"acceptance does not import quality personnel identities",
|
||||
);
|
||||
const actionList = page.getByRole("listbox", { name: "动作区间", exact: true });
|
||||
await actionList.getByRole("option").nth(3).waitFor();
|
||||
assert.match(
|
||||
await actionList.getByRole("option").first().innerText(),
|
||||
/片内 00:00.000–00:02.000.*原视频 00:00.000–00:02.000/s,
|
||||
);
|
||||
assert(
|
||||
await actionList.locator("..").evaluate((el) => el.classList.contains("review-action-list")),
|
||||
"acceptance uses the quality review action rail",
|
||||
);
|
||||
assert.equal(await page.getByRole("combobox", { name: "切片列表", exact: true }).locator("option").count(), 3);
|
||||
const brief = actionList.getByRole("option").nth(1);
|
||||
assert.match(await brief.innerText(), /0.500 秒.*短区间/s);
|
||||
assert.match(await actionList.getByRole("option").nth(3).innerText(), /待标注/);
|
||||
@ -292,7 +303,7 @@ try {
|
||||
const p = document.querySelector('[data-camera="left"]');
|
||||
return p?.readyState >= 2 && !p.seeking;
|
||||
});
|
||||
await sliceChoices.getByRole("button", { name: /第二片/ }).click();
|
||||
await page.getByRole("combobox", { name: "切片列表", exact: true }).selectOption("0:2");
|
||||
await page.waitForFunction(
|
||||
() => document.querySelector('[data-testid="review-current-slice"]')?.textContent === "第二片",
|
||||
);
|
||||
@ -490,6 +501,12 @@ try {
|
||||
await page.goto(`${base}/__acceptance_playback_rate?readonly=1`);
|
||||
await sliceCard.waitFor();
|
||||
assert(await sliceCard.isDisabled(), "read-only viewers cannot enter edit mode");
|
||||
assert(
|
||||
!(await page.getByRole("combobox", { name: "切片列表", exact: true }).isDisabled()),
|
||||
"read-only slice navigation remains available",
|
||||
);
|
||||
assert(await page.getByRole("button", { name: "验收通过", exact: true }).isDisabled());
|
||||
assert(await page.getByRole("button", { name: "打回质检", exact: true }).isDisabled());
|
||||
await brief.click();
|
||||
await assertActionTime(2);
|
||||
await page.keyboard.press("ArrowDown");
|
||||
|
||||
@ -26,6 +26,8 @@ const item = {
|
||||
items: [
|
||||
{
|
||||
taskId: "synthetic-task",
|
||||
supplierName: "SUPPLIER_IDENTITY_MUST_STAY_HIDDEN",
|
||||
annotatorName: "ANNOTATOR_IDENTITY_MUST_STAY_HIDDEN",
|
||||
sourceHumanItemId: "synthetic-source",
|
||||
materialization: {
|
||||
artifactId: "synthetic-materialization",
|
||||
@ -74,6 +76,7 @@ function App() {
|
||||
}
|
||||
item={item}
|
||||
mine
|
||||
writeLocked={readOnly}
|
||||
saving={false}
|
||||
focusedLayout={!new URLSearchParams(location.search).has("normal")}
|
||||
draft={{ headpose: "include", handpose: "include", exclusionReason: "" }}
|
||||
|
||||
@ -62,6 +62,14 @@ try {
|
||||
await page.goto(`${server.resolvedUrls.local[0]}__original_time?${role}`);
|
||||
const row = page.getByRole("option").filter({ hasText: "核对动作" });
|
||||
await row.waitFor();
|
||||
if (role === "quality") {
|
||||
assert(
|
||||
await row.locator("../..").evaluate((el) => el.classList.contains("review-action-list")),
|
||||
"quality and acceptance use one action rail",
|
||||
);
|
||||
assert.match(await row.innerText(), /1.000 秒.*短区间/s);
|
||||
assert.equal(await page.getByRole("combobox", { name: "切片列表", exact: true }).locator("option").count(), 2);
|
||||
}
|
||||
assert.match(await row.innerText(), /片内 00:01.000–00:02.000.*原视频 00:06.000–00:07.000/s);
|
||||
await page.waitForFunction(() => {
|
||||
const video = document.querySelector('[data-camera="left"]');
|
||||
|
||||
@ -31,10 +31,10 @@ function App(){const [shown,setShown]=React.useState(true);window.setShown=setSh
|
||||
let browser, owner;
|
||||
try {
|
||||
await server.listen();
|
||||
owner = await chromium.launchServer({ ...browserExecutableOptions(), headless: true });
|
||||
owner = await chromium.launchServer({ ...browserExecutableOptions(), headless: true, args: ["--no-proxy-server"] });
|
||||
browser = await chromium.connect(owner.wsEndpoint());
|
||||
const page = await browser.newPage();
|
||||
await page.goto(server.resolvedUrls.local[0] + "caption-lifecycle");
|
||||
await page.goto(server.resolvedUrls.local[0] + "caption-lifecycle", { waitUntil: "domcontentloaded" });
|
||||
await page.locator("[data-camera-caption]").waitFor();
|
||||
assert.equal(await page.locator("[data-camera-caption]").count(), 1);
|
||||
await page.evaluate(() => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user