feat: complete TASK-WP0-05 storage capacity
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Dada 容量状态验收探针</title>
|
||||
<style>
|
||||
body { font-family: system-ui, sans-serif; margin: 32px; color: #1f2328; }
|
||||
main { max-width: 720px; }
|
||||
.bar { height: 18px; background: #d0d7de; border-radius: 4px; overflow: hidden; }
|
||||
.bar > span { display: block; height: 100%; background: #cf222e; width: 100%; }
|
||||
table { border-collapse: collapse; margin-top: 24px; width: 100%; }
|
||||
th, td { border-bottom: 1px solid #d8dee4; padding: 8px; text-align: left; }
|
||||
</style>
|
||||
</head>
|
||||
<body><main id="root"></main><script type="module" src="/tests/e2e/fixtures/storage-capacity.ts"></script></body>
|
||||
</html>
|
||||
@@ -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