cellpose-web/frontend/preview.html
ClovertaTheTrilobita 0349c190d4 feature(redis): 引入redis作为缓存机制
fix(cp_run): 修复存储时间戳
feature(preview): preview 施工中
2025-09-17 22:43:36 +03:00

37 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<meta charset="UTF-8" />
<h1>This is preview</h1>
<p id="none-exist" hidden>id not exists</p>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script type="module">
const API_BASE = "http://10.147.18.141:5000/status/";
const params = new URLSearchParams(window.location.search);
const ID = params.get("id");
const msg = document.getElementById("none-exist");
// 没有 id直接提示
if (!ID) {
msg.textContent = "missing id in URL";
msg.hidden = false;
} else {
try {
const res = await axios.get(API_BASE + "?id=" + encodeURIComponent(ID));
const { exists, status } = res.data; // exists: boolean, status: "running" | "success" | "failed"...
// 只在“不存在”时显示这条消息
if (!exists) {
msg.textContent = `id "${ID}" not exists`;
msg.hidden = false;
} else {
msg.hidden = true; // 存在就隐藏这条“not exists”的提示
}
} catch (e) {
msg.textContent = "request failed";
msg.hidden = false;
console.error(e);
}
}
</script>