Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.d/issue-463-card-pill.change.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
卡片视图不再显示开机中等状态标签,开机失败时点画面区查看原因
Cards no longer show a status label; for a failed boot, click the screen for the reason
2 changes: 1 addition & 1 deletion internal/ui/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ GET `/api/keymap/vendor-sources?vendor=ldplayer` 列出安装,带 `sourceInsta
- `progress.step`:开机用 emu 的 `launch` / `boot` / `tune` / `ime` / `first_boot` / `vulkan_fix` / `done`;关机(含等被取消的开机停下)是 `stop`,安装是 `install`,这两种做完是 `done`;整理磁盘进行中是 `disk_compact`、做完是 `done`;复制实例是 `copy`(`done` / `total` 按复制的字节折成千分比)(进行中没有百分比,`total` 为 0,页面显示不定长进度条;做完 `done` = `total` = 1000);装执行桥的每一轮是 `bridge`;商店的装、卸进行中是 `playstore-install` / `playstore-uninstall`(没有百分比)、做完是 `done`;导入时核对文件是 `verifying`、解压镜像是 `extracting`(`done` / `total` 是字节);新建是 `create`、其中几次开机的上述各步(开机做完是 `setup`)、`create_stop`、`done`,几次开机合成一条不回退的进度。`total` 一律 1000。
- 安装任务的 `result.apk` 是用户上传的文件名,不是服务端的临时路径(临时文件任务结束就删了)。
- `progress` 在没有进度时为 `null`;`result` 是 `StartResult` / `StopResult` / `InstallResult` / `DiskCompactResult` / `InstanceInfo`(新建)/ `PlayStoreResult` / `PlayStoreImportResult` / `GLES32Result`,没完成时为 `null`;`error` 失败时是错误对象,否则 `null`。
- 页面怎么提示失败:卡片下面不放失败提示框。有任务失败(`state` 为 `failed`,什么种类都算;`canceled` 不算),或有实例是 `create_failed` 而管理器里没有它的新建任务(比如命令行建的),而这一条还没在「问题反馈」里看过时,顶栏的「问题反馈」入口和不能开机时的「组件」一样变红、一明一暗地闪,悬停和读屏说是哪几条。点开直接定位到最新的那条(在「最近任务和消息」里,带原因、建议,内存不够的带「调小内存」);没有任务的 `create_failed` 实例按任务的样子列在最上面。卡片上「开机失败」「新建失败」的状态标签悬停是原因和建议,点它(或按 Enter、空格)同样打开「问题反馈」定位到那条任务;没有任务的新建失败定位到最上面那台实例的那一行。抽屉里列出来就算看过,入口变回原样;看过的记在页面的 `localStorage`(`modavd.feedback.seen:<根目录>`,最近 100 条),刷新不会再闪。软件渲染、磁盘空间这类一直在的状态不算。失败时右下角的提示照旧。
- 页面怎么提示失败:卡片下面不放失败提示框。有任务失败(`state` 为 `failed`,什么种类都算;`canceled` 不算),或有实例是 `create_failed` 而管理器里没有它的新建任务(比如命令行建的),而这一条还没在「问题反馈」里看过时,顶栏的「问题反馈」入口和不能开机时的「组件」一样变红、一明一暗地闪,悬停和读屏说是哪几条。点开直接定位到最新的那条(在「最近任务和消息」里,带原因、建议,内存不够的带「调小内存」);没有任务的 `create_failed` 实例按任务的样子列在最上面。卡片视图不显示状态标签(读屏照旧读得到状态名);「开机失败」「新建失败」时画面区写着失败,悬停是原因和建议,点画面区(或按 Enter、空格)打开「问题反馈」定位到那条任务(开机失败的重新开机在「更多」里;列表视图的状态标签照旧);没有任务的新建失败定位到最上面那台实例的那一行。抽屉里列出来就算看过,入口变回原样;看过的记在页面的 `localStorage`(`modavd.feedback.seen:<根目录>`,最近 100 条),刷新不会再闪。软件渲染、磁盘空间这类一直在的状态不算。失败时右下角的提示照旧。

`DiskCompactResult` 保留非负的 `freed_bytes`。`before_on_disk_bytes` 和 `after_on_disk_bytes` 是整理前后宿主实际占用,新增的 `on_disk_delta_bytes` 等于后者减前者,正值表示占用增大。`skipped=true` 表示检查通过、预计收益不足,未重写原盘;此时前后占用相等、变化和释放量均为零。结果还包含 `reclaim_threshold_bytes` 和可省略的 `estimated_reclaimable_bytes`,详见 [整理预算与结果契约](../emu/COMPACT.md)。
- 同一实例同时只能有一个任务在跑;第二个回 409 `busy`。**例外**:开机任务进行中可以发关机(和 emu 一致:开机中照样能关)。
Expand Down
14 changes: 6 additions & 8 deletions internal/ui/web/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ button { -webkit-tap-highlight-color: transparent; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-3); }
.spacer { flex: 1; }
/* .pill-quiet: the card view's status label for 运行中 and 已关机, kept for screen readers (the list view shows it) */
.sr-only, .grid:not(.is-list) .pill-quiet {
/* the card view's status label (.pill) is for screen readers only, in every state: the screen says it (the list view shows it) */
.sr-only, .grid:not(.is-list) .pill {
position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
Expand Down Expand Up @@ -603,9 +603,8 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol
/* the title and, when 按应用走代理 is on, its mark (a button: it opens the dialog) */
.card-tline { display: flex; align-items: center; gap: 6px; min-width: 0; }
.card-tline .card-title { min-width: 0; }
/* Card view: the name takes the rest of the title line, so the marks sit at its right end, where the status label is
(left of the label when it shows: the gap to it is the head's 8px). The head keeps the label's height (22px + the
label's 1px margin) whether or not the label is in the flow, so the card is the same height in every state. The list
/* Card view: the name takes the rest of the title line, so the marks sit at its right end. The status label is out of the
flow in every state; the head keeps a fixed height (23px), so the card is the same height in every state. The list
view's title is a grid cell: its marks follow the name. */
.grid:not(.is-list) .card-head { gap: 8px; min-height: 23px; }
.grid:not(.is-list) .card-tline .card-title { flex: 1; }
Expand All @@ -622,9 +621,8 @@ html.kbd .brand-link:focus-visible { outline: 2px solid var(--accent, currentCol
title and aria-label. Today: cat head = 按应用走代理, G = Google Play 商店,
K = KernelSU, monitor with a slash = 无头 (headless), A = copy the ADB address.
Always-there marks come first, marks that follow the run state come last, so one appearing never pushes the others.
In the card view they are at the right end of the title line. The card view does not write 运行中 or 已关机 (the
screen and the power button say it): the status label shows only for the states in between and the failed ones, and
for the other two it is for screen readers only (.pill-quiet).
In the card view they are at the right end of the title line. The card view shows no status label in any state (the
screen says it: the picture, 未开机, the progress, 开机失败 / 新建失败); the label is for screen readers only (.sr-only).
The card view is the title and one config line: a new state is another single glyph or a hover text, not a word
and not a line. The cat head is the only mark that is a button (it opens the proxy dialog) and the only one that
can have a state colour (--tf from .tone-*; the icon only, never a background), and only when something is wrong (tone-warn, tone-err): while the
Expand Down
57 changes: 32 additions & 25 deletions internal/ui/web/js/cards.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ function makeCard(i) {
// no live region here: a boot reports every 2.5 s; the toast at the end says how it went
// decoration only: the screen itself is the button (a nested button would open the viewer twice)
c.peek = h('span', { class: 'peek', 'aria-hidden': 'true' }, icon('screen'));
// 开机失败 and 新建失败: to the task in 问题反馈, landed on the way a click on the glowing 问题反馈 lands on a failure
const showFailure = () => { if (c.failure) panels.openActivity(c.failure.job, c.failure.inst); };
const activateScreen = () => {
if (!c.inst) return;
// 开机失败 and 新建失败: the screen is the way to 问题反馈 at that task (开机 and 重试初始化 are in 更多)
if (c.failure) return showFailure();
if (c.inst.status === 'online') return openViewer(i);
const mode = c.primary.dataset.mode;
if (mode === 'blocked') panels.openComponents();
Expand All @@ -163,17 +167,16 @@ function makeCard(i) {
// - Order: marks that are always there come first; marks that come and go with the run state come last, so one
// appearing never pushes the others.
// - In the card view the marks sit at the right end of the title line (the name takes the rest of the width), where
// the status label is; when the label is shown the marks are right next to it, on its left. The list view keeps
// them after the name.
// - The card view does not write 运行中 or 已关机: the screen (or the 未开机 placeholder) already says it.
// The status label shows only for the states in between and the failed ones (开机中, 关机中, 新建中,
// 开机失败, 新建失败); for the other two it stays in the DOM for screen readers only (.pill-quiet). The list view
// always shows it (it has a status column). 诊断模式 is on the name's hover text in the card view.
// the status label is in the list view. The list view keeps them after the name.
// - The card view shows no status label in any state (ModAVD/ModAVD#463): the screen already says it (the live picture,
// the 未开机 placeholder, the boot or shutdown progress, 开机失败 / 新建失败). The label stays in the DOM for screen
// readers only (.sr-only in the card view); the list view always shows it (it has a status column).
// 诊断模式 is on the name's hover text in the card view.
// - The card view is the title and one config line. A new state is another single glyph or a hover text, not a
// word and not a line; the label showing or not never changes the card's height.
// - There is no box under the card: nothing is added below the config line, so no state makes a card taller than
// another. The reason of a failure (开机失败, 新建失败) is the status label's hover text, and clicking the label
// opens 问题反馈 at that task; software rendering and a data disk that is nearly full are lines on the name's hover
// another. The reason of a failure (开机失败, 新建失败) is the screen's hover text, and clicking the screen
// (Enter, Space) opens 问题反馈 at that task (the list view's label does the same); software rendering and a data disk that is nearly full are lines on the name's hover
// text, the first start's setup (about 1–2 minutes) is a line on the screen's hover text.
// - The cat head (pmark) is a single glyph too: an icon-only button that opens the 按应用走代理 dialog. It is
// the only mark that is clickable and the only one that can carry a state colour, and only when something is wrong:
Expand All @@ -197,11 +200,9 @@ function makeCard(i) {
c.cfg = h('span', { 'aria-hidden': 'true' });
c.cfgFull = h('span', { class: 'sr-only' });
c.pillText = h('span');
// 开机失败 and 新建失败: the label is the way to the reason (its hover text) and to the task in 问题反馈 (click, Enter,
// Space), landed on the way a click on the glowing 问题反馈 lands on a failure
const showFailure = () => { if (c.failure) panels.openActivity(c.failure.job, c.failure.inst); };
c.pill = h('span', { class: 'pill', onclick: showFailure,
onkeydown: (e) => { if (c.failure && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); showFailure(); } } }, c.pillText);
// the list view's label is the same way in (the card view's is for screen readers only, with no click)
c.pill = h('span', { class: 'pill', onclick: () => { if (getView() === 'list') showFailure(); },
onkeydown: (e) => { if (getView() === 'list' && c.failure && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); showFailure(); } } }, c.pillText);
const copyAdb = () => A.copy(c.inst.adb_address);
c.adbTag = btn('adb-tag tone-idle', 'A', copyAdb);
c.adb = h('span', { class: 'adb-addr' });
Expand Down Expand Up @@ -268,15 +269,18 @@ function updateCard(c, inst) {
if (cp != null) pt = t('新建中 {pct}%', { pct: Math.floor(cp) });
if (v.key === 'error') pt = FAIL[v.failed.kind];
setText(c.pillText, pt);
// the card view leaves 运行中 and 已关机 out (screen and power button say it); the label stays for screen readers
// 开机失败 and 新建失败: the hover text is the reason and the advice, the label opens 问题反馈 at the task
// The card view shows no label (it is sr-only there, with its text for screen readers); the failure's reason is the
// screen's hover text and the screen opens 问题反馈 at the task. The list view's label keeps both.
const failure = failureOf(inst, v);
c.failure = failure;
attr(c.pill, 'class', 'pill tone-' + tone + (v.key === 'online' || v.key === 'offline' ? ' pill-quiet' : '') + (failure ? ' pill-link' : ''));
attr(c.pill, 'title', [failure && (failure.advice ? failure.text + '\n' + failure.advice : failure.text), diag].filter(Boolean).join('\n') || null);
attr(c.pill, 'role', failure ? 'button' : diag ? 'img' : null);
attr(c.pill, 'tabindex', failure ? '0' : null);
attr(c.pill, 'aria-label', diag || failure ? [pt, diag, failure && t('查看详情')].filter(Boolean).join(' · ') : null);
const listed = getView() === 'list';
const failTip = failure && (failure.advice ? failure.text + '\n' + failure.advice : failure.text);
const linked = !!failure && listed;
attr(c.pill, 'class', 'pill tone-' + tone + (linked ? ' pill-link' : ''));
attr(c.pill, 'title', listed ? [failTip, diag].filter(Boolean).join('\n') || null : null);
attr(c.pill, 'role', linked ? 'button' : diag ? 'img' : null);
attr(c.pill, 'tabindex', linked ? '0' : null);
attr(c.pill, 'aria-label', diag || linked ? [pt, diag, linked && t('查看详情')].filter(Boolean).join(' · ') : null);

const address = inst.adb_address || null;
c.adbTag.hidden = c.adbList.hidden = !address;
Expand Down Expand Up @@ -313,7 +317,7 @@ function updateCard(c, inst) {
c.el.classList.toggle('is-busy', busy);
c.screen.classList.toggle('has-shot', live && v.key !== 'stopping' && !!c.url);
c.screen.classList.toggle('busy', busy);
setText(c.phText, v.key === 'error' ? t('上次开机没有成功') : v.key === 'createfail' ? t('新建时的初始化没做完') : live ? t('正在取画面…') : t('未开机'));
setText(c.phText, v.key === 'error' ? t('开机失败') : v.key === 'createfail' ? t('新建失败') : live ? t('正在取画面…') : t('未开机'));
if (busy) {
const p = v.job && v.job.progress;
const msg = (p && stripInst(p.message)) || (store ? store[1] : v.key === 'stopping' ? t('正在关机…') : v.key === 'creating' ? t('正在新建:后台开机做初始化…') : v.kind === 'import-game' ? t('正在导入游戏…') : v.kind === 'install' ? t('正在安装 APK…')
Expand Down Expand Up @@ -349,16 +353,17 @@ function updateCard(c, inst) {
attr(b, 'aria-busy', mode[0] === 'busy');
attr(b, 'aria-disabled', mode[0] === 'busy' || mode[0] === 'blocked');
}
const screenInteractive = live || mode[0] === 'start' || mode[0] === 'blocked' || mode[0] === 'resume';
const screenInteractive = live || !!failure || mode[0] === 'start' || mode[0] === 'blocked' || mode[0] === 'resume';
attr(c.screen, 'tabindex', screenInteractive ? '0' : null);
attr(c.screen, 'aria-disabled', screenInteractive ? null : 'true');
attr(c.screen, 'aria-label', live ? t('打开「{name}」的画面', { name }) : mode[0] === 'blocked' ? t('打开组件') : mode[0] === 'start' ? t('开机') : mode[0] === 'resume' ? t('重试初始化') : null);
// a failed boot or create: the screen opens 问题反馈 at the task (the status for screen readers goes with it)
attr(c.screen, 'aria-label', failure ? [pt, t('查看详情')].join(' · ') : live ? t('打开「{name}」的画面', { name }) : mode[0] === 'blocked' ? t('打开组件') : mode[0] === 'start' ? t('开机') : mode[0] === 'resume' ? t('重试初始化') : null);
// the card view hides the power button: what its hover text says (why a start is not possible, the first start's setup) is the screen's
c.screen.title = mode[0] === 'start' || mode[0] === 'blocked' ? [mode[0] === 'blocked' && BLOCKED, first && FIRST_START].filter(Boolean).join('\n') || null : null;
c.screen.title = failure ? failTip : mode[0] === 'start' || mode[0] === 'blocked' ? [mode[0] === 'blocked' && BLOCKED, first && FIRST_START].filter(Boolean).join('\n') || null : null;
if (live && v.key !== 'stopping' && !c.url) tick();
}

// What the 开机失败 / 新建失败 label says and opens: the reason and the advice (its hover text), and where 问题反馈
// What the 开机失败 / 新建失败 screen says and opens: the reason and the advice (its hover text), and where 问题反馈
// lands in 最近任务和消息: job, the task's row; inst, for a 新建失败 with no 新建 / 重试初始化 task of this manager
// behind it (created from the command line), the instance's own row on top of the list. Nothing else is shown on the
// card about it.
Expand Down Expand Up @@ -392,6 +397,8 @@ function menuItems(c) {
v.key === 'starting' && { label: t('关机'), icon: 'power', run: () => A.stop(i) },
// the card view has no power button (the list view does): the screen starts, and shutting down is here
view !== 'list' && v.key === 'online' && { label: t('关机'), icon: 'power', run: () => A.stop(i) },
// the screen of a failed boot opens 问题反馈, so the retry is here
view !== 'list' && v.key === 'error' && { label: t('开机'), icon: 'power', run: () => (rootBlocked() ? panels.openComponents() : A.start(i)) },
view !== 'list' && v.key === 'createfail' && { label: t('重试初始化'), icon: 'refresh', run: () => A.resumeCreate(i) },
// create's setup: our own create job is cancelled, one of another process (CLI, AUTO-MAS) is ended by a normal
// stop with explicit cancellation; either way it shuts down normally and reads create_failed (resumable)
Expand Down
Loading
Loading