feat: complete TASK-WP0-05 storage capacity
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import { classifyCapacity, decideStorageAction } from "../../../apps/api/src/storage-policy.js";
|
||||
|
||||
const root = document.querySelector<HTMLElement>("#root");
|
||||
if (!root) throw new Error("Fixture root is missing.");
|
||||
const capacity = classifyCapacity(5_368_709_120, 0);
|
||||
const actions = ["project_json_write", "binary_write", "read", "download", "permanent_delete", "explicit_cleanup"] as const;
|
||||
root.innerHTML = `
|
||||
<h1>本机存储容量</h1>
|
||||
<p data-status>${capacity.storage_status}</p>
|
||||
<div class="bar" role="progressbar" aria-valuemin="0" aria-valuemax="5368709120" aria-valuenow="5368709120"><span></span></div>
|
||||
<table><thead><tr><th>操作</th><th>结果</th></tr></thead><tbody>
|
||||
${actions.map((action) => `<tr><td>${action}</td><td>${decideStorageAction("full", true, action)}</td></tr>`).join("")}
|
||||
</tbody></table>
|
||||
<h2>存储不可用</h2>
|
||||
<table data-unavailable><thead><tr><th>操作</th><th>SQLite 可写</th><th>SQLite 不可写</th></tr></thead><tbody>
|
||||
${actions.map((action) => `<tr><td>${action}</td><td>${decideStorageAction("unavailable", true, action)}</td><td>${decideStorageAction("unavailable", false, action)}</td></tr>`).join("")}
|
||||
</tbody></table>`;
|
||||
Reference in New Issue
Block a user