fix(core,mgmt): list 返回 running+command 字段,命令列不显示为空
原 list 把 check()(命令字符串)放进 status 字段,前端误当状态显示, 命令列取不存在的 command 字段导致显示为空。 修复:list 返回 running(bool) + command(string),前端对应显示状态与命令。
This commit is contained in:
1 parent
43c5821d3d
commit
15f8c9552d
2 files changed
+4
-3
No files matched your search
@@ -34,7 +34,8 @@ auto list() -> std::string {
|
|||||||
processes.push_back({ /* 向json中推入对象 */
|
processes.push_back({ /* 向json中推入对象 */
|
||||||
{"index", i},
|
{"index", i},
|
||||||
{"pid", ppool[i].pid()},
|
{"pid", ppool[i].pid()},
|
||||||
{"status", ppool[i].check()}
|
{"running", ppool[i].isRunning()},
|
||||||
|
{"command", ppool[i].check()}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -100,11 +100,11 @@
|
|||||||
const p = list[i];
|
const p = list[i];
|
||||||
const tr = document.createElement("tr");
|
const tr = document.createElement("tr");
|
||||||
const pid = p.pid;
|
const pid = p.pid;
|
||||||
const status = p.status === true ? "运行中" : (p.status === false ? "已停止" : (p.status || "未知"));
|
const status = p.running === true ? "运行中" : (p.running === false ? "已停止" : "未知");
|
||||||
tr.innerHTML = `
|
tr.innerHTML = `
|
||||||
<td>${pid}</td>
|
<td>${pid}</td>
|
||||||
<td>${status}</td>
|
<td>${status}</td>
|
||||||
<td>${p.command || p.target || "-"}</td>
|
<td>${p.command || "-"}</td>
|
||||||
<td><button class="stopBtn" onclick="stopBtn(${pid})">停止</button></td>
|
<td><button class="stopBtn" onclick="stopBtn(${pid})">停止</button></td>
|
||||||
`;
|
`;
|
||||||
tbody.appendChild(tr);
|
tbody.appendChild(tr);
|
||||||
|
|||||||
Reference in new issue
Block a user