Update coolify.html
This commit is contained in:
@@ -307,8 +307,8 @@
|
|||||||
<p class="text-xs text-gray-400 mt-0.5" x-text="proj.description || proj.uuid"></p>
|
<p class="text-xs text-gray-400 mt-0.5" x-text="proj.description || proj.uuid"></p>
|
||||||
</div>
|
</div>
|
||||||
<div x-show="proj.environments && proj.environments.length > 0" class="flex flex-wrap gap-1">
|
<div x-show="proj.environments && proj.environments.length > 0" class="flex flex-wrap gap-1">
|
||||||
<template x-for="env in (proj.environments || [])" :key="env.id">
|
<template x-for="env in (proj.environments || [])" :key="env.id || env.uuid || env.name || env.environment || env">
|
||||||
<span class="text-xs px-2 py-0.5 rounded-full bg-indigo-50 text-indigo-600" x-text="env.name"></span>
|
<span class="text-xs px-2 py-0.5 rounded-full bg-indigo-50 text-indigo-600" x-text="projectEnvLabel(env)"></span>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="pt-1 border-t border-gray-100">
|
<div class="pt-1 border-t border-gray-100">
|
||||||
@@ -630,10 +630,10 @@
|
|||||||
<div class="flex-1 overflow-auto p-5 space-y-2">
|
<div class="flex-1 overflow-auto p-5 space-y-2">
|
||||||
<div x-show="projectEnvsLoading" class="text-sm text-gray-400 text-center py-4">Cargando entornos...</div>
|
<div x-show="projectEnvsLoading" class="text-sm text-gray-400 text-center py-4">Cargando entornos...</div>
|
||||||
<div x-show="!projectEnvsLoading && projectEnvsList.length === 0" class="text-sm text-gray-400 text-center py-4">Sin entornos.</div>
|
<div x-show="!projectEnvsLoading && projectEnvsList.length === 0" class="text-sm text-gray-400 text-center py-4">Sin entornos.</div>
|
||||||
<template x-for="env in projectEnvsList" :key="env.id">
|
<template x-for="env in projectEnvsList" :key="env.id || env.uuid || env.name || env.environment || env">
|
||||||
<div class="bg-gray-50 rounded-lg px-3 py-2 text-sm">
|
<div class="bg-gray-50 rounded-lg px-3 py-2 text-sm">
|
||||||
<p class="font-semibold text-gray-700" x-text="env.name"></p>
|
<p class="font-semibold text-gray-700" x-text="projectEnvLabel(env)"></p>
|
||||||
<p x-show="env.description" class="text-xs text-gray-400 mt-0.5" x-text="env.description"></p>
|
<p x-show="projectEnvDescription(env)" class="text-xs text-gray-400 mt-0.5" x-text="projectEnvDescription(env)"></p>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
@@ -733,6 +733,17 @@ document.addEventListener('alpine:init', () => {
|
|||||||
},
|
},
|
||||||
|
|
||||||
// ─── Helpers ────────────────────────────────────
|
// ─── Helpers ────────────────────────────────────
|
||||||
|
projectEnvLabel(env) {
|
||||||
|
if (!env) return '—';
|
||||||
|
if (typeof env === 'string') return env;
|
||||||
|
return env.name || env.environment || env.slug || env.uuid || env.branch || 'Entorno';
|
||||||
|
},
|
||||||
|
|
||||||
|
projectEnvDescription(env) {
|
||||||
|
if (!env || typeof env === 'string') return '';
|
||||||
|
return env.description || env.branch || env.fqdn || env.url || '';
|
||||||
|
},
|
||||||
|
|
||||||
flash(msg, ok = true) {
|
flash(msg, ok = true) {
|
||||||
this.flashMsg = msg;
|
this.flashMsg = msg;
|
||||||
this.flashOk = ok;
|
this.flashOk = ok;
|
||||||
@@ -1221,14 +1232,14 @@ document.addEventListener('alpine:init', () => {
|
|||||||
// ─── Project envs ────────────────────────────────
|
// ─── Project envs ────────────────────────────────
|
||||||
async openProjectEnvs(proj) {
|
async openProjectEnvs(proj) {
|
||||||
this.projectTarget = proj;
|
this.projectTarget = proj;
|
||||||
this.projectEnvsList = [];
|
this.projectEnvsList = Array.isArray(proj.environments) ? proj.environments : [];
|
||||||
this.projectEnvsModal = true;
|
this.projectEnvsModal = true;
|
||||||
this.projectEnvsLoading = true;
|
this.projectEnvsLoading = true;
|
||||||
try {
|
try {
|
||||||
const r = await fetch(`/app/coolify/projects/${proj.uuid}/environments`);
|
const r = await fetch(`/app/coolify/projects/${proj.uuid}/environments`);
|
||||||
const j = await r.json();
|
const j = await r.json();
|
||||||
this.projectEnvsList = Array.isArray(j) ? j
|
this.projectEnvsList = Array.isArray(j) ? j
|
||||||
: (j.environments || j.data || []);
|
: (j.environments || j.data || j.items || j.projects_environments || []);
|
||||||
} catch(e) { this.flash('Error: ' + e.message, false); }
|
} catch(e) { this.flash('Error: ' + e.message, false); }
|
||||||
finally { this.projectEnvsLoading = false; }
|
finally { this.projectEnvsLoading = false; }
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user