Address review nits for restart flow
Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/8e6c98f7-8b24-4ec0-944b-0310e0989495 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
fce4608647
commit
c37816d257
@@ -2978,7 +2978,7 @@ async def api_service_restart(unit: str):
|
|||||||
try:
|
try:
|
||||||
proc = await asyncio.create_subprocess_exec(
|
proc = await asyncio.create_subprocess_exec(
|
||||||
"systemctl", "restart", unit,
|
"systemctl", "restart", unit,
|
||||||
stdout=asyncio.subprocess.PIPE,
|
stdout=asyncio.subprocess.DEVNULL,
|
||||||
stderr=asyncio.subprocess.PIPE,
|
stderr=asyncio.subprocess.PIPE,
|
||||||
)
|
)
|
||||||
_, stderr = await proc.communicate()
|
_, stderr = await proc.communicate()
|
||||||
|
|||||||
@@ -308,6 +308,7 @@ async function openServiceDetailModal(unit, name, icon) {
|
|||||||
var restartBtn = document.getElementById("svc-detail-restart-btn");
|
var restartBtn = document.getElementById("svc-detail-restart-btn");
|
||||||
var restartResult = document.getElementById("svc-detail-restart-result");
|
var restartResult = document.getElementById("svc-detail-restart-result");
|
||||||
if (restartBtn && restartResult) {
|
if (restartBtn && restartResult) {
|
||||||
|
var RESTART_REFRESH_DELAY_MS = 3000;
|
||||||
restartBtn.addEventListener("click", async function() {
|
restartBtn.addEventListener("click", async function() {
|
||||||
restartBtn.disabled = true;
|
restartBtn.disabled = true;
|
||||||
restartBtn.textContent = "Restarting…";
|
restartBtn.textContent = "Restarting…";
|
||||||
@@ -322,7 +323,7 @@ async function openServiceDetailModal(unit, name, icon) {
|
|||||||
restartBtn.textContent = "🔄 Restart Service";
|
restartBtn.textContent = "🔄 Restart Service";
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
openServiceDetailModal(unit, name, icon);
|
openServiceDetailModal(unit, name, icon);
|
||||||
}, 3000);
|
}, RESTART_REFRESH_DELAY_MS);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
restartResult.classList.add("error");
|
restartResult.classList.add("error");
|
||||||
restartResult.textContent = e && e.message ? e.message : "Failed to restart service.";
|
restartResult.textContent = e && e.message ? e.message : "Failed to restart service.";
|
||||||
|
|||||||
Reference in New Issue
Block a user