fix: Cargar correctamente datos de la app en formulario de edición
- Construir script_path completo combinando path + entry_point - Usar valores por defecto cuando campos no existen en JSON - Agregar console.log para debug - El campo user usa 'pablinux' por defecto (no está en JSON) - Ahora los campos se llenan correctamente en lugar de mostrar solo placeholders
This commit is contained in:
@@ -456,15 +456,27 @@
|
||||
|
||||
const app = result.data;
|
||||
|
||||
console.log("App data:", app); // Debug
|
||||
|
||||
// Llenar formulario con datos actuales
|
||||
document.getElementById("app_name").value = app.name;
|
||||
document.getElementById("app_name").value = app.name || "";
|
||||
document.getElementById("app_name").readOnly = true; // No cambiar nombre
|
||||
document.getElementById("script_path").value =
|
||||
app.entry_point;
|
||||
|
||||
// Construir script_path completo
|
||||
const scriptPath =
|
||||
app.path && app.entry_point
|
||||
? `${app.path}/${app.entry_point}`.replace(
|
||||
"//",
|
||||
"/",
|
||||
)
|
||||
: app.entry_point || "";
|
||||
|
||||
document.getElementById("script_path").value = scriptPath;
|
||||
document.getElementById("working_directory").value =
|
||||
app.path;
|
||||
document.getElementById("user").value =
|
||||
app.user || "pablinux";
|
||||
app.path || "";
|
||||
|
||||
// El user no está en el JSON, usar valor por defecto
|
||||
document.getElementById("user").value = "pablinux";
|
||||
document.getElementById("restart_policy").value = "always";
|
||||
document.getElementById("app_type").value = "nodejs";
|
||||
document.getElementById("description").value = "";
|
||||
|
||||
Reference in New Issue
Block a user