修复中控自更新触发与错误提示;实例页改为表格,带鱼屏宽度锁 1800。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+82
-78
@@ -83,6 +83,20 @@ body.page-desk .main {
|
||||
margin: 0;
|
||||
padding: 10px 12px 14px;
|
||||
}
|
||||
/* 实例页:普通屏用满;带鱼屏锁 1800 */
|
||||
body.page-instances .main {
|
||||
max-width: none;
|
||||
width: 100%;
|
||||
margin: 0 auto;
|
||||
padding: 12px clamp(12px, 2vw, 28px) 20px;
|
||||
}
|
||||
@media (min-aspect-ratio: 21/9) {
|
||||
body.page-instances .main {
|
||||
max-width: 1800px;
|
||||
padding-left: clamp(16px, 3vw, 48px);
|
||||
padding-right: clamp(16px, 3vw, 48px);
|
||||
}
|
||||
}
|
||||
body.page-login {
|
||||
min-height: 100vh;
|
||||
}
|
||||
@@ -373,7 +387,8 @@ button, .btn {
|
||||
height: 0;
|
||||
}
|
||||
.inst-shell {
|
||||
max-width: 920px;
|
||||
max-width: none;
|
||||
width: 100%;
|
||||
}
|
||||
.inst-add-panel {
|
||||
display: none;
|
||||
@@ -385,73 +400,83 @@ button, .btn {
|
||||
.inst-list-head {
|
||||
border-bottom: 1px solid rgba(56, 189, 248, 0.12);
|
||||
}
|
||||
.inst-card-list {
|
||||
padding: 16px 18px 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
.inst-table-wrap {
|
||||
padding: 14px 16px 18px;
|
||||
overflow-x: auto;
|
||||
}
|
||||
.inst-empty {
|
||||
margin: 8px 4px 12px;
|
||||
line-height: 1.5;
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
.inst-card {
|
||||
border: 1px solid rgba(56, 189, 248, 0.16);
|
||||
border-radius: 14px;
|
||||
background: rgba(5, 12, 22, 0.45);
|
||||
.inst-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 0.88rem;
|
||||
}
|
||||
.inst-table th,
|
||||
.inst-table td {
|
||||
padding: 12px 10px;
|
||||
border-bottom: 1px solid rgba(56, 189, 248, 0.12);
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
}
|
||||
.inst-table th {
|
||||
color: var(--accent-2);
|
||||
font-weight: 600;
|
||||
white-space: nowrap;
|
||||
background: rgba(8, 16, 30, 0.7);
|
||||
}
|
||||
.inst-table tr.inst-row:hover td {
|
||||
background: rgba(34, 211, 238, 0.04);
|
||||
}
|
||||
.inst-td-name { min-width: 7rem; }
|
||||
.inst-td-url {
|
||||
max-width: 28rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
.inst-card[open] {
|
||||
border-color: rgba(56, 189, 248, 0.35);
|
||||
box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.08);
|
||||
}
|
||||
.inst-card-summary {
|
||||
list-style: none;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
padding: 14px 16px;
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
}
|
||||
.inst-card-summary::-webkit-details-marker { display: none; }
|
||||
.inst-card-main { flex: 1; min-width: 0; }
|
||||
.inst-card-title-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.inst-card-name {
|
||||
font-size: 1rem;
|
||||
font-weight: 650;
|
||||
letter-spacing: 0.02em;
|
||||
}
|
||||
.inst-card-url {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
font-size: 0.8rem;
|
||||
word-break: break-all;
|
||||
line-height: 1.35;
|
||||
}
|
||||
.inst-card-aside {
|
||||
display: flex;
|
||||
.inst-td-tags {
|
||||
max-width: 10rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.inst-td-ops {
|
||||
white-space: nowrap;
|
||||
}
|
||||
.inst-td-ops .btn,
|
||||
.inst-td-ops .btn-danger,
|
||||
.inst-td-ops label.btn {
|
||||
margin-top: 0;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
flex: 0 0 auto;
|
||||
cursor: pointer;
|
||||
}
|
||||
.inst-card-chevron {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-right: 2px solid var(--muted);
|
||||
border-bottom: 2px solid var(--muted);
|
||||
transform: rotate(45deg);
|
||||
transition: transform 0.15s ease;
|
||||
margin-top: -4px;
|
||||
.inst-inline-del {
|
||||
display: inline;
|
||||
margin: 0;
|
||||
}
|
||||
.inst-card[open] .inst-card-chevron {
|
||||
transform: rotate(225deg);
|
||||
margin-top: 2px;
|
||||
.inst-edit-check {
|
||||
position: absolute;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
.inst-edit-row > td {
|
||||
padding: 0;
|
||||
border-bottom: 1px solid rgba(56, 189, 248, 0.16);
|
||||
background: rgba(5, 12, 22, 0.35);
|
||||
}
|
||||
.inst-edit-panel {
|
||||
display: none;
|
||||
padding: 4px 8px 12px;
|
||||
}
|
||||
.inst-edit-check:checked + .inst-edit-panel {
|
||||
display: block;
|
||||
}
|
||||
.inst-pill {
|
||||
display: inline-flex;
|
||||
@@ -472,23 +497,6 @@ button, .btn {
|
||||
background: rgba(127, 29, 29, 0.35);
|
||||
border: 1px solid rgba(251, 113, 133, 0.35);
|
||||
}
|
||||
.inst-pill--tag {
|
||||
color: #bae6fd;
|
||||
background: rgba(14, 116, 144, 0.28);
|
||||
border: 1px solid rgba(56, 189, 248, 0.28);
|
||||
max-width: 12rem;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.inst-card-body {
|
||||
padding: 0 8px 14px;
|
||||
border-top: 1px solid rgba(56, 189, 248, 0.1);
|
||||
}
|
||||
.inst-card-body .inst-form {
|
||||
padding-top: 14px;
|
||||
padding-bottom: 8px;
|
||||
}
|
||||
.inst-card-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -500,9 +508,6 @@ button, .btn {
|
||||
.inst-card-actions .settings-primary {
|
||||
margin-top: 0;
|
||||
}
|
||||
.inst-delete-form {
|
||||
padding: 0 12px 4px;
|
||||
}
|
||||
.inst-token-wrap {
|
||||
display: flex;
|
||||
gap: 8px;
|
||||
@@ -522,8 +527,7 @@ button, .btn {
|
||||
@media (max-width: 720px) {
|
||||
.inst-page-head { align-items: flex-start; }
|
||||
.settings-row-2 { grid-template-columns: 1fr; }
|
||||
.inst-card-summary { flex-direction: column; align-items: stretch; gap: 8px; }
|
||||
.inst-card-aside { justify-content: space-between; }
|
||||
.inst-td-ops { white-space: normal; }
|
||||
}
|
||||
.overview-table-wrap {
|
||||
overflow-x: auto;
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
return branch + short + (v.dirty ? " (dirty)" : "");
|
||||
}
|
||||
|
||||
async function refreshVersion(card) {
|
||||
const iid = card.getAttribute("data-id");
|
||||
const verEl = card.querySelector("[data-inst-version]");
|
||||
async function refreshVersion(row) {
|
||||
const iid = row.getAttribute("data-id");
|
||||
const verEl = row.querySelector("[data-inst-version]");
|
||||
if (!iid || !verEl) return;
|
||||
verEl.textContent = "…";
|
||||
verEl.className = "update-version muted";
|
||||
@@ -49,13 +49,13 @@
|
||||
|
||||
function boot() {
|
||||
bindTokenToggles(document);
|
||||
document.querySelectorAll(".inst-card[data-id]").forEach(function (card) {
|
||||
refreshVersion(card);
|
||||
const btn = card.querySelector("[data-inst-refresh-ver]");
|
||||
document.querySelectorAll("tr.inst-row[data-id]").forEach(function (row) {
|
||||
refreshVersion(row);
|
||||
const btn = row.querySelector("[data-inst-refresh-ver]");
|
||||
if (btn) {
|
||||
btn.addEventListener("click", function (e) {
|
||||
e.preventDefault();
|
||||
refreshVersion(card);
|
||||
refreshVersion(row);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,14 +6,39 @@
|
||||
}
|
||||
|
||||
async function fetchJson(url, opts) {
|
||||
const r = await fetch(url, Object || {});
|
||||
let data = {};
|
||||
const base = opts || {};
|
||||
const headers = Object.assign({ Accept: "application/json" }, base.headers || {});
|
||||
try {
|
||||
data = await r.json();
|
||||
const r = await fetch(
|
||||
url,
|
||||
Object.assign({}, base, {
|
||||
credentials: "same-origin",
|
||||
headers: headers,
|
||||
})
|
||||
);
|
||||
const text = await r.text();
|
||||
let data = {};
|
||||
try {
|
||||
data = text ? JSON.parse(text) : {};
|
||||
} catch (e) {
|
||||
data = {
|
||||
ok: false,
|
||||
msg: "非 JSON 响应 HTTP " + r.status + (text ? ": " + String(text).slice(0, 120) : ""),
|
||||
};
|
||||
}
|
||||
if (!data || typeof data !== "object") data = {};
|
||||
if (data.ok == null && !r.ok) {
|
||||
data.ok = false;
|
||||
data.msg = data.msg || "请求失败 HTTP " + r.status;
|
||||
}
|
||||
return { httpOk: r.ok, status: r.status, data: data };
|
||||
} catch (e) {
|
||||
data = {};
|
||||
return {
|
||||
httpOk: false,
|
||||
status: 0,
|
||||
data: { ok: false, msg: (e && e.message) || "网络错误" },
|
||||
};
|
||||
}
|
||||
return { httpOk: r.ok, status: r.status, data: data };
|
||||
}
|
||||
|
||||
function escapeHtml(s) {
|
||||
@@ -71,7 +96,7 @@
|
||||
}
|
||||
setStatus(statusEl, "更新中… (" + (i + 1) + "/" + maxTries + ")", "pending");
|
||||
}
|
||||
setStatus(statusEl, "超时未确认上线,请稍后刷新版本或查服务器日志", "err");
|
||||
setStatus(statusEl, "超时未确认上线,请稍后刷新版本或查看 logs/hub_update.log", "err");
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -115,7 +140,10 @@
|
||||
});
|
||||
const data = res.data || {};
|
||||
if (!data.ok) {
|
||||
setStatus(statusEl, data.msg || "更新失败", "err");
|
||||
const detail =
|
||||
data.msg ||
|
||||
(res.status ? "更新失败 HTTP " + res.status : "更新失败(无响应)");
|
||||
setStatus(statusEl, detail, "err");
|
||||
btn.disabled = false;
|
||||
return;
|
||||
}
|
||||
@@ -178,7 +206,11 @@
|
||||
});
|
||||
const data = res.data || {};
|
||||
if (!data.ok) {
|
||||
setStatus(statusEl, data.msg || "更新失败", "err");
|
||||
setStatus(
|
||||
statusEl,
|
||||
data.msg || (res.status ? "更新失败 HTTP " + res.status : "更新失败"),
|
||||
"err"
|
||||
);
|
||||
btn.disabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user