import { defineComponent, ref, reactive, computed, useSSRContext } from 'vue'; import { ssrRenderAttrs, ssrRenderList, ssrRenderClass, ssrInterpolate, ssrIncludeBooleanAttr, ssrLooseContain, ssrLooseEqual, ssrRenderAttr } from 'vue/server-renderer'; import { u as useApi } from './useApi-B-E5eLsI.mjs'; import { u as useToast } from './useToast-CS21XT61.mjs'; import { _ as _export_sfc, b as useRouter } from './server.mjs'; import './useLoading-D4zrSa2m.mjs'; import '../nitro/nitro.mjs'; import 'node:http'; import 'node:https'; import 'node:events'; import 'node:buffer'; import 'node:fs'; import 'node:path'; import 'node:crypto'; import 'node:url'; import '../routes/renderer.mjs'; import 'vue-bundle-renderer/runtime'; import 'unhead/server'; import 'devalue'; import 'unhead/utils'; import 'pinia'; import 'perfect-debounce'; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "index", __ssrInlineRender: true, setup(__props) { useApi(); useToast(); useRouter(); const products = ref([]); const deployments = ref([]); const loading = ref(false); const assignTo = reactive({}); const byApp = computed(() => { const m = /* @__PURE__ */ new Map(); for (const d of deployments.value) { const k = d.app_name || ""; if (!m.has(k)) m.set(k, []); m.get(k).push(d); } return m; }); const productGroups = computed( () => products.value.map((p) => { const deps = byApp.value.get(p.name) || []; return { product: p, deployments: deps, okCount: deps.filter((d) => d.status !== "pending").length, pendingCount: deps.filter((d) => d.status === "pending").length }; }) ); const orphans = computed(() => { const known = new Set(products.value.map((p) => p.name)); return deployments.value.filter((d) => !d.app_name || !known.has(d.app_name)); }); const groups = computed(() => productGroups.value.length + (orphans.value.length ? 1 : 0)); function initial(name) { return (name || "?").charAt(0).toUpperCase(); } ref(null); const pEditing = ref(false); const pForm = reactive({ id: 0, name: "", image_name: "", remark: "", enabled: true }); return (_ctx, _push, _parent, _attrs) => { _push(`

应用中心

一张卡片 = 一个 应用,卡片里是它在各区域的 部署 概况。 点卡片进入应用详情:编辑应用、部署新环境、升级服务、改各项配置。

`); if (loading.value) { _push(`
`); } else if (!groups.value) { _push(`
暂无应用,先「添加应用」
`); } else { _push(`
`); ssrRenderList(productGroups.value, (g) => { _push(`
${ssrInterpolate(g.product.name)}
${ssrInterpolate(g.product.image_name ? "🐳 " + g.product.image_name : "未设置默认镜像")}
`); if (!g.product.enabled) { _push(`停用`); } else { _push(``); } _push(`

${ssrInterpolate(g.product.remark || "—")}

${ssrInterpolate(g.deployments.length)}
部署
${ssrInterpolate(g.okCount)}
已接入
${ssrInterpolate(g.pendingCount)}
待部署
`); if (g.deployments.length) { _push(``); ssrRenderList(g.deployments, (d) => { _push(`${ssrInterpolate(d.region || "未指定")}`); if (d.status === "pending") { _push(` · 待部署`); } else { _push(``); } _push(``); }); _push(``); } else { _push(`还没有任何部署`); } _push(`
`); }); _push(``); if (orphans.value.length) { _push(`
未分组部署
需要归位到某个应用
待归位

未填所属应用名、或应用已被删除的历史部署。选一个应用把它归位,之后就能在该应用详情里管理。

`); ssrRenderList(orphans.value, (d) => { _push(`
${ssrInterpolate(d.name || "部署#" + d.id)}
#${ssrInterpolate(d.id)} · ${ssrInterpolate(d.region || "未指定区域")}
`); }); _push(`
`); } else { _push(``); } _push(`
`); } _push(``); }; } }); const _sfc_setup = _sfc_main.setup; _sfc_main.setup = (props, ctx) => { const ssrContext = useSSRContext(); (ssrContext.modules || (ssrContext.modules = /* @__PURE__ */ new Set())).add("pages/apps/index.vue"); return _sfc_setup ? _sfc_setup(props, ctx) : void 0; }; const index = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-6c9af955"]]); export { index as default }; //# sourceMappingURL=index-DKWThDpn.mjs.map