diff --git a/src/orchestrator/lifecycle.rs b/src/orchestrator/lifecycle.rs index 3e5d482..31683b8 100644 --- a/src/orchestrator/lifecycle.rs +++ b/src/orchestrator/lifecycle.rs @@ -26,7 +26,7 @@ impl LifecycleManager { logger.info("Lifecycle", &format!("Iniciando aplicación: {}", app_name)); - let service_name = format!("{}.service", app_name); + let service_name = format!("siax-app-{}.service", app_name); SystemCtl::start(&service_name)?; // Actualizar rate limiter @@ -45,7 +45,7 @@ impl LifecycleManager { logger.info("Lifecycle", &format!("Deteniendo aplicación: {}", app_name)); - let service_name = format!("{}.service", app_name); + let service_name = format!("siax-app-{}.service", app_name); SystemCtl::stop(&service_name)?; // Actualizar rate limiter @@ -64,7 +64,7 @@ impl LifecycleManager { logger.info("Lifecycle", &format!("Reiniciando aplicación: {}", app_name)); - let service_name = format!("{}.service", app_name); + let service_name = format!("siax-app-{}.service", app_name); SystemCtl::restart(&service_name)?; // Actualizar rate limiter diff --git a/web/index.html b/web/index.html index 3f3c7de..59cdc83 100644 --- a/web/index.html +++ b/web/index.html @@ -364,7 +364,7 @@ Mem % Tiempo Activo - Actions + Acciones @@ -557,9 +557,35 @@ - - - +
+ ${ + app.status === "Running" + ? ` + + + ` + : ` + + ` + } + +
`; @@ -579,6 +605,44 @@ `; } + async function controlApp(appName, action) { + const actionNames = { + start: "Iniciar", + stop: "Detener", + restart: "Reiniciar", + }; + + const confirmed = confirm( + `¿Estás seguro de ${actionNames[action]} la aplicación "${appName}"?`, + ); + if (!confirmed) return; + + try { + const response = await fetch( + `/api/apps/${appName}/${action}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + }, + ); + + const result = await response.json(); + + if (result.success) { + alert(`✅ ${result.data.message}`); + // Recargar la lista de apps + loadApps(); + } else { + alert(`❌ Error: ${result.error}`); + } + } catch (error) { + console.error("Error:", error); + alert("❌ Error al ejecutar la acción"); + } + } + function toggleMenu() { const menu = document.getElementById("mobile-menu"); menu.classList.toggle("hidden");