@samyx/preview-stacks-ui 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActionButton.vue_vue_type_script_setup_true_lang-DxV7T6dV.js → ActionButton.vue_vue_type_script_setup_true_lang-DjO5RzbR.js} +2 -2
- package/dist/assets/{ActionButton.vue_vue_type_script_setup_true_lang-DxV7T6dV.js.map → ActionButton.vue_vue_type_script_setup_true_lang-DjO5RzbR.js.map} +1 -1
- package/dist/assets/AxesTab-BZZXKEC0.js +2 -0
- package/dist/assets/{AxesTab-DkF15gUV.js.map → AxesTab-BZZXKEC0.js.map} +1 -1
- package/dist/assets/ConfigTab-CFbS48D0.js +2 -0
- package/dist/assets/ConfigTab-CFbS48D0.js.map +1 -0
- package/dist/assets/{DangerTab-BOrQMzL3.js → DangerTab-Nyebdr6k.js} +2 -2
- package/dist/assets/{DangerTab-BOrQMzL3.js.map → DangerTab-Nyebdr6k.js.map} +1 -1
- package/dist/assets/DashboardView-CFwb63EX.js +2 -0
- package/dist/assets/DashboardView-CFwb63EX.js.map +1 -0
- package/dist/assets/DeploymentDetailView-DKCUbiGG.js +2 -0
- package/dist/assets/{DeploymentDetailView-D23-qn3Z.js.map → DeploymentDetailView-DKCUbiGG.js.map} +1 -1
- package/dist/assets/DeploymentsView-BX4GOb2A.js +2 -0
- package/dist/assets/DeploymentsView-BX4GOb2A.js.map +1 -0
- package/dist/assets/EquivalentCommand-BFnZRfDg.css +1 -0
- package/dist/assets/EquivalentCommand-w1nGowVi.js +3 -0
- package/dist/assets/EquivalentCommand-w1nGowVi.js.map +1 -0
- package/dist/assets/{ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js → ErrorNote.vue_vue_type_script_setup_true_lang-D28UQmNR.js} +2 -2
- package/dist/assets/{ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js.map → ErrorNote.vue_vue_type_script_setup_true_lang-D28UQmNR.js.map} +1 -1
- package/dist/assets/HelpModal.vue_vue_type_script_setup_true_lang-TcgJr2CB.js +2 -0
- package/dist/assets/HelpModal.vue_vue_type_script_setup_true_lang-TcgJr2CB.js.map +1 -0
- package/dist/assets/JobDetailView-ow1_d8lc.js +2 -0
- package/dist/assets/{JobDetailView-ByaH2ylY.js.map → JobDetailView-ow1_d8lc.js.map} +1 -1
- package/dist/assets/JobsView-Boi9Cmdc.js +2 -0
- package/dist/assets/JobsView-Boi9Cmdc.js.map +1 -0
- package/dist/assets/LoginView-1ZpxP8a9.js +2 -0
- package/dist/assets/LoginView-1ZpxP8a9.js.map +1 -0
- package/dist/assets/LoginView-BFIG7vGw.css +1 -0
- package/dist/assets/LogsTab-Bgev0F7g.js +4 -0
- package/dist/assets/LogsTab-Bgev0F7g.js.map +1 -0
- package/dist/assets/{NotFoundView-BN-7ZNip.js → NotFoundView-BhCKBrlY.js} +2 -2
- package/dist/assets/{NotFoundView-BN-7ZNip.js.map → NotFoundView-BhCKBrlY.js.map} +1 -1
- package/dist/assets/NotifiersView-DN9UiqDs.js +2 -0
- package/dist/assets/NotifiersView-DN9UiqDs.js.map +1 -0
- package/dist/assets/{OverviewTab-BI1DZZxS.js → OverviewTab-DzZG0moV.js} +2 -2
- package/dist/assets/{OverviewTab-BI1DZZxS.js.map → OverviewTab-DzZG0moV.js.map} +1 -1
- package/dist/assets/RegistriesView-CPyfKKWJ.js +2 -0
- package/dist/assets/RegistriesView-CPyfKKWJ.js.map +1 -0
- package/dist/assets/RelativeTime.vue_vue_type_script_setup_true_lang-mzHGsi43.js +2 -0
- package/dist/assets/{RelativeTime.vue_vue_type_script_setup_true_lang-lQaz4t05.js.map → RelativeTime.vue_vue_type_script_setup_true_lang-mzHGsi43.js.map} +1 -1
- package/dist/assets/{RequiresTab-B9YauFIz.js → RequiresTab-CjNRorI5.js} +2 -2
- package/dist/assets/{RequiresTab-B9YauFIz.js.map → RequiresTab-CjNRorI5.js.map} +1 -1
- package/dist/assets/RoutingView-Br16pPwF.js +9 -0
- package/dist/assets/RoutingView-Br16pPwF.js.map +1 -0
- package/dist/assets/RuntimeTab-BssqRUYz.js +2 -0
- package/dist/assets/{RuntimeTab-DvrQFekD.js.map → RuntimeTab-BssqRUYz.js.map} +1 -1
- package/dist/assets/SelectMenu.vue_vue_type_script_setup_true_lang-CLqZAezG.js +2 -0
- package/dist/assets/SelectMenu.vue_vue_type_script_setup_true_lang-CLqZAezG.js.map +1 -0
- package/dist/assets/SettingsView-Cqsv0chw.js +2 -0
- package/dist/assets/SettingsView-Cqsv0chw.js.map +1 -0
- package/dist/assets/{SkeletonList.vue_vue_type_script_setup_true_lang-SxitAmDb.js → SkeletonList.vue_vue_type_script_setup_true_lang-CIiWzcE5.js} +2 -2
- package/dist/assets/{SkeletonList.vue_vue_type_script_setup_true_lang-SxitAmDb.js.map → SkeletonList.vue_vue_type_script_setup_true_lang-CIiWzcE5.js.map} +1 -1
- package/dist/assets/SpecDetailView-P6Kk7cwx.js +2 -0
- package/dist/assets/{SpecDetailView-CViJ8WG_.js.map → SpecDetailView-P6Kk7cwx.js.map} +1 -1
- package/dist/assets/SpecsView-DogEWlyZ.js +2 -0
- package/dist/assets/SpecsView-DogEWlyZ.js.map +1 -0
- package/dist/assets/StateBadge.vue_vue_type_script_setup_true_lang-B5C48Wlo.js +2 -0
- package/dist/assets/{StateBadge.vue_vue_type_script_setup_true_lang-CgDXVhMF.js.map → StateBadge.vue_vue_type_script_setup_true_lang-B5C48Wlo.js.map} +1 -1
- package/dist/assets/SubmitView-CufYXtWD.js +45 -0
- package/dist/assets/SubmitView-CufYXtWD.js.map +1 -0
- package/dist/assets/Teleport-0BmaJsBF.js +4 -0
- package/dist/assets/Teleport-0BmaJsBF.js.map +1 -0
- package/dist/assets/{TerminalTab-Bqulz6Eb.css → TerminalTab-4vbfGB2S.css} +1 -1
- package/dist/assets/TerminalTab-DndloIiD.js +3 -0
- package/dist/assets/TerminalTab-DndloIiD.js.map +1 -0
- package/dist/assets/UsersView-DZhhpsnX.css +1 -0
- package/dist/assets/UsersView-KHRd16sV.js +2 -0
- package/dist/assets/UsersView-KHRd16sV.js.map +1 -0
- package/dist/assets/{VarEditor.vue_vue_type_script_setup_true_lang-CZcKBdbw.js → VarEditor.vue_vue_type_script_setup_true_lang-FaBOeld_.js} +2 -2
- package/dist/assets/{VarEditor.vue_vue_type_script_setup_true_lang-CZcKBdbw.js.map → VarEditor.vue_vue_type_script_setup_true_lang-FaBOeld_.js.map} +1 -1
- package/dist/assets/index-BnwKLRM7.css +1 -0
- package/dist/assets/index-D8OAewba.js +134 -0
- package/dist/assets/index-D8OAewba.js.map +1 -0
- package/dist/assets/{useDeployment-C4MdUG63.js → useDeployment-DplTFu7s.js} +2 -2
- package/dist/assets/{useDeployment-C4MdUG63.js.map → useDeployment-DplTFu7s.js.map} +1 -1
- package/dist/index.html +2 -2
- package/package.json +2 -1
- package/dist/assets/AxesTab-DkF15gUV.js +0 -2
- package/dist/assets/ConfigTab-DIfAtFKC.js +0 -2
- package/dist/assets/ConfigTab-DIfAtFKC.js.map +0 -1
- package/dist/assets/DashboardView-Cr6Nnj3O.js +0 -2
- package/dist/assets/DashboardView-Cr6Nnj3O.js.map +0 -1
- package/dist/assets/DeploymentDetailView-D23-qn3Z.js +0 -2
- package/dist/assets/DeploymentsView-BMD-3aeS.js +0 -2
- package/dist/assets/DeploymentsView-BMD-3aeS.js.map +0 -1
- package/dist/assets/JobDetailView-ByaH2ylY.js +0 -2
- package/dist/assets/JobsView-h_BUWgIG.js +0 -2
- package/dist/assets/JobsView-h_BUWgIG.js.map +0 -1
- package/dist/assets/LoginView-BstzTLQc.js +0 -5
- package/dist/assets/LoginView-BstzTLQc.js.map +0 -1
- package/dist/assets/LoginView-CAyD1E0h.css +0 -1
- package/dist/assets/LogsTab-B_NVnnVo.js +0 -4
- package/dist/assets/LogsTab-B_NVnnVo.js.map +0 -1
- package/dist/assets/NotifiersView-CsAmv8wB.js +0 -2
- package/dist/assets/NotifiersView-CsAmv8wB.js.map +0 -1
- package/dist/assets/RegistriesView-CEE730kV.js +0 -2
- package/dist/assets/RegistriesView-CEE730kV.js.map +0 -1
- package/dist/assets/RelativeTime.vue_vue_type_script_setup_true_lang-lQaz4t05.js +0 -2
- package/dist/assets/RoutingView-DXCaRJek.js +0 -9
- package/dist/assets/RoutingView-DXCaRJek.js.map +0 -1
- package/dist/assets/RuntimeTab-DvrQFekD.js +0 -2
- package/dist/assets/SettingsView-B7_zHjVP.js +0 -2
- package/dist/assets/SettingsView-B7_zHjVP.js.map +0 -1
- package/dist/assets/SpecDetailView-CViJ8WG_.js +0 -2
- package/dist/assets/SpecsView-BpG2OWMm.js +0 -2
- package/dist/assets/SpecsView-BpG2OWMm.js.map +0 -1
- package/dist/assets/StateBadge.vue_vue_type_script_setup_true_lang-CgDXVhMF.js +0 -2
- package/dist/assets/SubmitView-CwdWrsVS.js +0 -45
- package/dist/assets/SubmitView-CwdWrsVS.js.map +0 -1
- package/dist/assets/TerminalTab-C6gRXura.js +0 -3
- package/dist/assets/TerminalTab-C6gRXura.js.map +0 -1
- package/dist/assets/index-Bygbts8t.js +0 -129
- package/dist/assets/index-Bygbts8t.js.map +0 -1
- package/dist/assets/index-DOv3m8-x.css +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RegistriesView-CEE730kV.js","sources":["../../src/views/RegistriesView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Private registry credentials.\n *\n * WHY THIS PAGE EXISTS. An image pull is authenticated by the **client**, not the daemon: `docker pull`\n * reads its own `config.json` and hands the credential to the daemon. pstack shells out to compose from\n * inside the control container, so a `docker login` on the host writes a file that client cannot see —\n * and a private image fails with `pull access denied` on a host that is demonstrably logged in.\n *\n * WRITE-ONLY, DELIBERATELY. A `config.json` entry is `base64(\"user:password\")` — reversible, not\n * encrypted. So there is no read path for it anywhere in the API, and this page shows hostnames and\n * usernames only. No reveal control, because the plaintext was never sent here; the same reasoning as\n * the masked variables. Re-entering a credential replaces it.\n *\n * The credential applies to the **next pull** — the CLI re-reads the file on every invocation, so\n * nothing needs restarting and there is no cache to bust. That is the property that makes \"add creds on\n * demand\" work at all, and it is stated on the page because otherwise the natural assumption is that a\n * redeploy is needed.\n */\nimport { computed, ref } from 'vue';\nimport { api, problem } from '../api/client';\nimport type { RegistriesResponse, RegistryEntry } from '../api/types';\nimport { settings } from '../composables/useSettings';\nimport { toast } from '../composables/useToasts';\nimport ActionButton from '../components/ActionButton.vue';\nimport ErrorNote from '../components/ErrorNote.vue';\nimport InfoHint from '../components/InfoHint.vue';\nimport SkeletonList from '../components/SkeletonList.vue';\n\nconst entries = ref<RegistryEntry[]>([]);\nconst helpers = ref<string[]>([]);\nconst dir = ref('');\nconst writable = ref<boolean | null>(null);\nconst loaded = ref(false);\nconst listError = ref('');\n\nconst host = ref('');\nconst username = ref('');\nconst password = ref('');\nconst saving = ref(false);\nconst formError = ref('');\n\nconst canSave = computed(\n () => !!settings.token && !saving.value && !!host.value && !!username.value && !!password.value,\n);\n\nasync function load(): Promise<void> {\n const r = await api.get<RegistriesResponse>('/api/registries');\n loaded.value = true;\n if (!r.ok) {\n listError.value = problem(r, 'load the registry credentials');\n return;\n }\n listError.value = '';\n entries.value = r.body.entries ?? [];\n helpers.value = r.body.helpers ?? [];\n dir.value = r.body.dir ?? '';\n writable.value = r.body.writable ?? false;\n}\n\nvoid load();\n\nasync function save(): Promise<void> {\n saving.value = true;\n formError.value = '';\n const r = await api.put<{ registry: string }>(\n `/api/registries/${encodeURIComponent(host.value)}`,\n { username: username.value, password: password.value },\n );\n saving.value = false;\n if (!r.ok) {\n formError.value = problem(r, 'store this credential');\n return;\n }\n // Cleared immediately: there is no reason for a password to stay in a form field after it is stored,\n // and the page cannot read it back to re-populate one.\n password.value = '';\n const stored = r.body.registry;\n if (stored && stored !== host.value) {\n // Docker Hub's canonical key differs from what anyone types; saying so avoids \"I stored it and it\n // still is not used\".\n toast('ok', `Stored for ${stored} — Docker Hub's canonical key.`);\n } else {\n toast('ok', `Stored for ${stored || host.value}. It applies to the next pull.`);\n }\n host.value = '';\n username.value = '';\n void load();\n}\n\nasync function forget(registry: string): Promise<void> {\n const r = await api.del(`/api/registries/${encodeURIComponent(registry)}`);\n if (!r.ok) {\n listError.value = problem(r, 'forget this credential');\n return;\n }\n toast('ok', `Forgot ${registry}.`);\n void load();\n}\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>Registries</h1>\n <div class=\"sub\">\n Credentials for pulling private images\n <InfoHint label=\"why a host login is not enough\">\n A pull is authenticated by the docker <em>client</em>, not the daemon: it reads its own\n <code>config.json</code> and hands the credential over. pstack's client runs inside the\n control container, so a <code>docker login</code> on the host writes a file it cannot see —\n and the pull fails on a host that is logged in.\n </InfoHint>\n </div>\n </div>\n </div>\n\n <ErrorNote v-if=\"listError\" :text=\"listError\" title=\"Could not load the registry credentials.\" />\n\n <div v-if=\"writable === false\" class=\"banner failed\">\n <b>Read-only: the API cannot write the credential file.</b>\n <p>\n The control stack mounts a <code>DOCKER_CONFIG</code> directory into the API from 0.7.0 onward.\n Re-run <code>pstack init</code> on the host — it is idempotent, and it recreates the control\n containers.\n </p>\n </div>\n\n <!--\n The trap worth naming: a config.json copied from a laptop usually has credsStore and NO auths,\n because the secrets are in the OS keychain. Inside the container that helper does not exist, so\n every pull fails and an empty list looks like the reason.\n -->\n <div v-if=\"helpers.length\" class=\"banner warn\">\n <b>This file uses a credential helper, which will not work here.</b>\n <p>\n Found: <span class=\"mono\">{{ helpers.join(', ') }}</span>. A helper keeps the secret outside the\n file — in an OS keychain, usually — and the helper binary does not exist in this container, so\n pulls fail with <code>error getting credentials</code>. Add the credential below instead, which\n stores it in the file.\n </p>\n </div>\n\n <section class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Stored</h2>\n <span class=\"grow\" />\n <span v-if=\"dir\" class=\"mute break\" style=\"font-size: var(--t-sm)\"><code>{{ dir }}</code></span>\n </div>\n\n <SkeletonList v-if=\"!loaded\" :rows=\"2\" />\n <ul v-else-if=\"entries.length\" class=\"kvlist\">\n <li v-for=\"e in entries\" :key=\"e.registry\">\n <span class=\"k break\" style=\"width: 220px\"><b>{{ e.registry }}</b></span>\n <span class=\"v row\">\n <span>{{ e.username ?? 'unknown user' }}</span>\n <span v-if=\"e.viaHelper\" class=\"badge warn\">via helper</span>\n <span class=\"grow\" />\n <ActionButton :disabled=\"!settings.token\" variant=\"danger\" @click=\"forget(e.registry)\">\n Forget\n </ActionButton>\n </span>\n </li>\n </ul>\n <p v-else class=\"mute\">\n Nothing stored. Public images need no credential — this is only for a private registry.\n </p>\n </section>\n\n <section class=\"panel\">\n <h2 class=\"section\" style=\"margin-bottom: var(--s3)\">Add a credential</h2>\n\n <p class=\"dim\">\n Applies to the <b>next pull</b> — nothing needs restarting.\n <InfoHint label=\"why no restart is needed\">\n The docker client re-reads <code>config.json</code> on every invocation, so there is no cache\n to bust. Storing one now is enough for a deploy started a second later.\n </InfoHint>\n </p>\n\n <div class=\"field\" style=\"max-width: 380px\">\n <label for=\"host\">Registry</label>\n <input\n id=\"host\"\n v-model.trim=\"host\"\n type=\"text\"\n placeholder=\"ghcr.io\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n />\n <div class=\"mute hint\">\n Use <code>docker.io</code> for Docker Hub — it is stored under Docker Hub's canonical key.\n </div>\n </div>\n\n <div class=\"field\" style=\"max-width: 380px\">\n <label for=\"user\">Username</label>\n <input id=\"user\" v-model.trim=\"username\" type=\"text\" spellcheck=\"false\" autocomplete=\"off\" />\n </div>\n\n <div class=\"field\" style=\"max-width: 380px\">\n <label for=\"pass\">Password or token</label>\n <input id=\"pass\" v-model=\"password\" type=\"password\" autocomplete=\"off\" spellcheck=\"false\" />\n <div class=\"mute hint\">\n Prefer a token scoped to reading packages. Stored on the host as reversible base64, exactly as\n <code>docker login</code> stores it — never sent back to this page.\n </div>\n </div>\n\n <ErrorNote v-if=\"formError\" :text=\"formError\" title=\"Could not store this credential.\" />\n\n <div class=\"row\" style=\"margin-top: var(--s4)\">\n <ActionButton variant=\"primary\" :pending=\"saving\" :disabled=\"!canSave\" @click=\"save\">\n {{ saving ? 'Storing…' : 'Store' }}\n </ActionButton>\n <span v-if=\"!settings.token\" class=\"mute\">Storing needs an access token.</span>\n </div>\n\n <p class=\"hint\">\n Or from the host, which writes the same file:\n <span class=\"mono\">docker login --config {{ dir || '<DATA_DIR>/control/docker' }} <registry></span>\n </p>\n </section>\n </div>\n</template>\n"],"names":["entries","ref","helpers","dir","writable","loaded","listError","host","username","password","saving","formError","canSave","computed","settings","load","r","api","problem","save","stored","toast","forget","registry","_createElementBlock","_createElementVNode","_hoisted_1","_cache","_hoisted_2","_createVNode","InfoHint","_createBlock","ErrorNote","_openBlock","_hoisted_3","_hoisted_4","_hoisted_5","_toDisplayString","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_Fragment","_renderList","e","_hoisted_10","_hoisted_11","_hoisted_12","ActionButton","_unref","$event","_hoisted_13","SkeletonList","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22"],"mappings":"ulCA6BA,MAAMA,EAAUC,EAAqB,EAAE,EACjCC,EAAUD,EAAc,EAAE,EAC1BE,EAAMF,EAAI,EAAE,EACZG,EAAWH,EAAoB,IAAI,EACnCI,EAASJ,EAAI,EAAK,EAClBK,EAAYL,EAAI,EAAE,EAElBM,EAAON,EAAI,EAAE,EACbO,EAAWP,EAAI,EAAE,EACjBQ,EAAWR,EAAI,EAAE,EACjBS,EAAST,EAAI,EAAK,EAClBU,EAAYV,EAAI,EAAE,EAElBW,EAAUC,EACd,IAAM,CAAC,CAACC,EAAS,OAAS,CAACJ,EAAO,OAAS,CAAC,CAACH,EAAK,OAAS,CAAC,CAACC,EAAS,OAAS,CAAC,CAACC,EAAS,KAAA,EAG5F,eAAeM,GAAsB,CACnC,MAAMC,EAAI,MAAMC,EAAI,IAAwB,iBAAiB,EA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KAAMrB,EAAA,MAAW,MAAM,kCAAA,6BAEpDc,EAKM,MALNiC,GAKM,CAJJ7B,EAEemB,EAAA,CAFD,QAAQ,UAAW,QAAStC,EAAA,MAAS,UAAWE,EAAA,MAAU,QAAOO,CAAA,aAC7E,IAAmC,KAAhCT,EAAA,MAAM,WAAA,OAAA,EAAA,CAAA,CAAA,kCAEEuC,EAAAnC,CAAA,EAAS,oBAAtBU,EAA+E,OAA/EmC,GAA0C,gCAA8B,KAG1ElC,EAGI,IAHJmC,GAGI,iBAHY,kDAEd,EAAA,GAAAnC,EAAyG,OAAzGoC,GAAmB,yBAAsBxB,EAAGlC,EAAA,oCAAqC,cAAiB,CAAA,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{s as i,b as l}from"./useFormat-CKJxQp_i.js";import{d as r,Y as m,Z as c,o as u,c as d,u as f,t as p,r as v,D}from"./index-Bygbts8t.js";const w=["datetime","title"],I=15e3,h=r({__name:"RelativeTime",props:{at:{}},setup(e){const o=e,n=v(Date.now());let t=null,a=0;m(()=>{a++,t||(t=setInterval(()=>n.value=Date.now(),I))}),c(()=>{a--,a===0&&t&&(clearInterval(t),t=null)});const s=D(()=>(n.value,l(o.at)));return(S,_)=>(u(),d("time",{datetime:e.at?new Date(e.at).toISOString():void 0,title:f(i)(e.at)},p(s.value),9,w))}});export{h as _};
|
|
2
|
-
//# sourceMappingURL=RelativeTime.vue_vue_type_script_setup_true_lang-lQaz4t05.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import{d as oe,c as o,a as t,m as n,h as m,i as f,_ as E,f as v,y as g,t as u,F as w,x as j,u as x,S as $,g as z,v as B,r,D as q,B as _,C as A,j as le,P as J,o as s,E as ne}from"./index-Bygbts8t.js";import{s as ae}from"./useFormat-CKJxQp_i.js";import{_ as K}from"./ActionButton.vue_vue_type_script_setup_true_lang-DxV7T6dV.js";import{_ as O}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js";import{_ as Q}from"./SkeletonList.vue_vue_type_script_setup_true_lang-SxitAmDb.js";const ie={class:"page-head"},re={class:"sub"},ue={key:1,class:"banner info"},de={class:"panel"},ve={class:"phead"},pe={class:"mute",style:{"font-size":"var(--t-sm)"}},fe={key:0,class:"banner warn"},me={key:1,class:"cards"},ce={class:"stagger"},he={"data-label":"url"},ye=["href"],ke={key:1,class:"mono mute"},be={key:0,class:"mute"},ge={"data-label":"forwards to"},we={key:0,class:"mono"},_e={key:1,class:"s-failed"},Ce={"data-label":"deployment"},Te={key:1,class:"mute"},Re={class:"dim","data-label":"router"},xe={key:2,class:"mute"},$e={class:"panel"},Ae={class:"phead"},Ne={key:0,class:"mute",style:{"font-size":"var(--t-sm)"}},Se={class:"banner warn"},Le={key:0,class:"banner failed"},Pe={key:1,class:"banner info"},De={key:3,class:"kvlist"},Ie={class:"k"},Ue=["onClick"],Ve={class:"v mute",style:{"font-size":"var(--t-sm)"}},Ee={key:4,class:"mute"},je={key:2,class:"panel"},ze={class:"phead"},Be={class:"section"},Fe={key:0,class:"badge warn"},Me={key:0,class:"field",style:{"max-width":"340px"}},We={key:2,class:"banner plain"},Ge={class:"field"},He={class:"row",style:{"margin-top":"var(--s4)"}},qe={key:0,class:"mute"},Je={class:"field",style:{"max-width":"340px"}},Ke=["for"],Oe=["id","placeholder"],Qe={class:"row"},Xe=`http:
|
|
2
|
-
middlewares:
|
|
3
|
-
# An example — replace it. Middlewares go UNDER http; at the top level Traefik ignores them.
|
|
4
|
-
ip-allow:
|
|
5
|
-
ipAllowList:
|
|
6
|
-
sourceRange:
|
|
7
|
-
- 203.0.113.0/24
|
|
8
|
-
`,lt=oe({__name:"RoutingView",setup(Ye){const N=r([]),S=r(null),L=r([]),P=r(""),D=r(null),F=r(!1),C=r(""),i=r(null),d=r(""),c=r(""),T=r(!1),I=r(!1),k=r(!1),p=r(""),R=r(""),h=r(null),y=r(""),M=q(()=>i.value!==null&&d.value!==c.value),X=q(()=>!!$.token&&!k.value&&d.value.trim().length>0&&(M.value||i.value===""));async function U(){const l=await _.get("/api/routing");if(F.value=!0,!l.ok){C.value=A(l,"load the routing files");return}C.value="",L.value=l.body.files??[],P.value=l.body.dir??"",D.value=l.body.writable??!1}async function Y(){const l=await _.get("/api/routing/live");if(!l.ok){S.value=!1;return}S.value=l.body.reachable,N.value=l.body.routes??[]}U(),Y();async function Z(l){i.value=l,I.value=!0,p.value="",T.value=!1,y.value="";const e=await _.getAuthed(`/api/routing/${encodeURIComponent(l)}`);if(I.value=!1,!e.ok){p.value=A(e,"open this file");return}if(e.body.sourceWithheld){T.value=!0,d.value="",c.value="";return}d.value=e.body.content??"",c.value=d.value}function ee(){i.value="",R.value="",d.value=Xe,c.value="",T.value=!1,p.value=""}function W(){i.value=null,d.value="",c.value="",p.value=""}async function G(){const l=i.value===""?R.value.trim():i.value;if(!l){p.value="Give the file a name, ending in .yml";return}k.value=!0,p.value="";const e=await _.put(`/api/routing/${encodeURIComponent(l)}`,{content:d.value});if(k.value=!1,!e.ok){p.value=A(e,"save this file");return}e.body.previous&&(h.value={name:l,content:e.body.previous}),c.value=d.value,i.value=l,J("ok",`Saved ${l}. Traefik reloads within a second or two.`),U()}async function te(){const l=h.value;l&&(d.value=l.content,i.value=l.name,await G(),h.value=null)}async function se(){const l=i.value;if(!l||y.value!==l)return;const e=await _.del(`/api/routing/${encodeURIComponent(l)}`);if(!e.ok){p.value=A(e,"delete this file");return}e.body.previous&&(h.value={name:l,content:e.body.previous}),J("ok",`Deleted ${l}.`),W(),U()}return(l,e)=>{const V=le("RouterLink");return s(),o("div",null,[t("div",ie,[t("div",null,[e[5]||(e[5]=t("h1",null,"Routing",-1)),t("div",re,[e[4]||(e[4]=n(" Every route on this host, and the config files behind them ",-1)),m(E,{label:"what belongs in these files"},{default:f(()=>[...e[3]||(e[3]=[n(" Middleware (basic auth, rate limits, IP allow-lists), TLS options, the catch-all fallback router, and routes to anything running outside compose. Per-PR routers are not here — those are labels in each deployment's own compose file. ",-1)])]),_:1})])]),e[6]||(e[6]=t("span",{class:"grow"},null,-1)),D.value?(s(),o("button",{key:0,class:"btn primary",onClick:ee},"New file")):v("",!0)]),C.value?(s(),g(O,{key:0,text:C.value,title:"Could not load the routing files."},null,8,["text"])):v("",!0),h.value?(s(),o("div",ue,[t("b",null,"Replaced "+u(h.value.name)+".",1),t("p",null,[e[7]||(e[7]=n(" The previous contents are still here for this session. ",-1)),t("button",{class:"btn sm",onClick:te},"Put it back")])])):v("",!0),t("section",de,[t("div",ve,[e[10]||(e[10]=t("h2",{class:"section"},"Live routes",-1)),e[11]||(e[11]=t("span",{class:"grow"},null,-1)),t("span",pe,[e[9]||(e[9]=n(" from container labels ",-1)),m(E,{label:"why routes are not in the files below",align:"end"},{default:f(()=>[...e[8]||(e[8]=[n(" Traefik reads two providers. Per-PR routers are ",-1),t("b",null,"labels on containers",-1),n(", written by each deployment's own compose file — so deploying a stack changes this list and never the files. The files are the other provider: middleware, TLS options, the fallback router. ",-1)])]),_:1})])]),S.value===!1?(s(),o("div",fe,[...e[12]||(e[12]=[t("b",null,"Docker did not answer.",-1),t("p",null,"Routes could not be listed — which is not the same as there being none.",-1)])])):N.value.length?(s(),o("table",me,[e[13]||(e[13]=t("thead",null,[t("tr",null,[t("th",null,"url"),t("th",null,"forwards to"),t("th",null,"deployment"),t("th",null,"router")])],-1)),t("tbody",ce,[(s(!0),o(w,null,j(N.value,(a,H)=>(s(),o("tr",{key:`${a.container}-${a.router}`,style:ne({"--i":H})},[t("td",he,[(s(!0),o(w,null,j(a.hosts,b=>(s(),o("div",{key:b},[b.startsWith("(pattern)")?(s(),o("span",ke,u(b),1)):(s(),o("a",{key:0,href:`https://${b}`,target:"_blank",rel:"noreferrer"},u(b),9,ye))]))),128)),a.hosts.length?v("",!0):(s(),o("span",be,"no host in the rule"))]),t("td",ge,[a.target?(s(),o("span",we,u(a.target),1)):(s(),o("span",_e,u(a.port===null?"no port declared":"not on the ingress network"),1))]),t("td",Ce,[a.project?(s(),g(V,{key:0,to:`/deployments/${encodeURIComponent(a.project)}/runtime`},{default:f(()=>[n(u(a.project),1)]),_:2},1032,["to"])):(s(),o("span",Te,"—"))]),t("td",Re,u(a.router),1)],4))),128))])])):(s(),o("p",xe,[...e[14]||(e[14]=[n(" No container on this host declares a Traefik router. A deployment's routes come from labels in its own compose file — open a deployment's ",-1),t("b",null,"Containers & routes",-1),n(" tab to see what is missing. ",-1)])]))]),t("section",$e,[t("div",Ae,[e[15]||(e[15]=t("h2",{class:"section"},"Config files",-1)),e[16]||(e[16]=t("span",{class:"grow"},null,-1)),P.value?(s(),o("span",Ne,[t("code",null,u(P.value),1)])):v("",!0)]),t("div",Se,[e[21]||(e[21]=t("b",null,"A bad file here affects every preview on this host.",-1)),t("p",null,[e[18]||(e[18]=n(" Traefik reads this directory as a whole: one unparseable file and it logs a parse error for the ",-1)),e[19]||(e[19]=t("em",null,"directory",-1)),e[20]||(e[20]=n(", so the symptom is other routes disappearing. Saves are checked before they are written and land atomically, so a rejected file never reaches Traefik. ",-1)),m(E,{label:"what this page cannot break"},{default:f(()=>[...e[17]||(e[17]=[n(" This page and the API are routed by container labels, not by these files — so no save here can lock you out of the page you would use to undo it. ",-1)])]),_:1})])]),D.value===!1?(s(),o("div",Le,[...e[22]||(e[22]=[t("b",null,"Read-only: the API cannot write to this directory.",-1),t("p",null,[n(" The control stack mounts it into the API from 0.4.0 onward. Re-run "),t("code",null,"pstack init"),n(" on the host to pick up the mount — it is idempotent, and it recreates the control containers. ")],-1)])])):x($).token?v("",!0):(s(),o("div",Pe,[e[26]||(e[26]=t("b",null,"Viewing needs a token too.",-1)),t("p",null,[e[24]||(e[24]=n(" These files hold basic-auth hashes and forward-auth URLs, so their contents are not served unauthenticated. ",-1)),m(V,{to:"/settings"},{default:f(()=>[...e[23]||(e[23]=[n("Add your token",-1)])]),_:1}),e[25]||(e[25]=n(". ",-1))])])),F.value?L.value.length?(s(),o("ul",De,[(s(!0),o(w,null,j(L.value,a=>(s(),o("li",{key:a.name},[t("span",Ie,[t("button",{class:"ghost sm",onClick:H=>Z(a.name)},u(a.name),9,Ue)]),t("span",Ve,u(a.size)+" bytes · "+u(x(ae)(a.updatedAt)),1)]))),128))])):(s(),o("p",Ee," No files yet. Everything is routed by container labels, which is a perfectly good place to be. ")):(s(),g(Q,{key:2,rows:3}))]),i.value!==null?(s(),o("section",je,[t("div",ze,[t("h2",Be,u(i.value===""?"New file":i.value),1),M.value?(s(),o("span",Fe,"unsaved")):v("",!0),e[27]||(e[27]=t("span",{class:"grow"},null,-1)),t("button",{class:"ghost sm",onClick:W},"Close")]),i.value===""?(s(),o("div",Me,[e[28]||(e[28]=t("label",{for:"fname"},"File name",-1)),z(t("input",{id:"fname","onUpdate:modelValue":e[0]||(e[0]=a=>R.value=a),type:"text",placeholder:"middleware.yml",spellcheck:"false",autocomplete:"off"},null,512),[[B,R.value,void 0,{trim:!0}]]),e[29]||(e[29]=t("div",{class:"mute hint"},[n("Lower case, ending in "),t("code",null,".yml"),n(".")],-1))])):v("",!0),I.value?(s(),g(Q,{key:1,rows:4})):T.value?(s(),o("div",We,[e[32]||(e[32]=t("b",null,"Hidden without an access token.",-1)),t("p",null,[m(V,{to:"/settings"},{default:f(()=>[...e[30]||(e[30]=[n("Add your token",-1)])]),_:1}),e[31]||(e[31]=n(" to read and edit this file. ",-1))])])):(s(),o(w,{key:3},[t("div",Ge,[e[33]||(e[33]=t("label",{for:"content"},"Contents",-1)),z(t("textarea",{id:"content","onUpdate:modelValue":e[1]||(e[1]=a=>d.value=a),rows:"18",spellcheck:"false"},null,512),[[B,d.value]])]),p.value?(s(),g(O,{key:0,text:p.value,title:"Traefik would not accept this."},null,8,["text"])):v("",!0),t("div",He,[m(K,{variant:"primary",pending:k.value,disabled:!X.value,onClick:G},{default:f(()=>[n(u(k.value?"Saving…":"Save"),1)]),_:1},8,["pending","disabled"]),x($).token?v("",!0):(s(),o("span",qe,"Saving needs a token."))]),i.value?(s(),o(w,{key:1},[e[37]||(e[37]=t("h2",{class:"section",style:{margin:"var(--s5) 0 var(--s3)"}},"Delete this file",-1)),e[38]||(e[38]=t("p",{class:"dim"}," Whatever it configures stops applying as soon as Traefik reloads. If it holds a router, those hostnames stop resolving to anything. ",-1)),t("div",Je,[t("label",{for:`confirm-${i.value}`},[e[34]||(e[34]=n(" Type ",-1)),t("b",null,u(i.value),1),e[35]||(e[35]=n(" to confirm ",-1))],8,Ke),z(t("input",{id:`confirm-${i.value}`,"onUpdate:modelValue":e[2]||(e[2]=a=>y.value=a),type:"text",placeholder:i.value,spellcheck:"false",autocomplete:"off"},null,8,Oe),[[B,y.value,void 0,{trim:!0}]])]),t("div",Qe,[m(K,{variant:"danger",disabled:y.value!==i.value||!x($).token,title:y.value!==i.value?"Type the file name to confirm.":void 0,onClick:se},{default:f(()=>[...e[36]||(e[36]=[n(" Delete ",-1)])]),_:1},8,["disabled","title"])])],64)):v("",!0)],64))])):v("",!0)])}}});export{lt as default};
|
|
9
|
-
//# sourceMappingURL=RoutingView-DXCaRJek.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RoutingView-DXCaRJek.js","sources":["../../src/views/RoutingView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Traefik's dynamic configuration — the file list, and an editor.\n *\n * WHAT LIVES HERE. Traefik reads config from two providers: labels on containers (every per-PR router)\n * and a watched *directory* of files. This page is the directory: middleware (basic auth, rate limits,\n * IP allow-lists), TLS options, the catch-all fallback router, routes to something running outside\n * compose. Several files rather than one is the point of a watched directory — one file per concern.\n *\n * THE WARNING IS NOT DECORATION. Traefik's documented behaviour is that an unparseable file produces\n * a parse error for the whole DIRECTORY, and the rest can be discarded with it — so a careless save\n * here breaks *other people's* routes, not the file being edited. The server validates before writing\n * and renames into place so the watcher never sees a partial file, and every rejection is rendered\n * verbatim because it names the actual problem.\n *\n * What it cannot break: `control.<domain>` and `api.<domain>` are docker labels on the pstack\n * container, not file config. This page cannot lock you out of the page you would use to undo a bad\n * save. That is stated in the UI, because an operator hesitating over a save deserves to know it.\n *\n * `previous` from a save is an in-session undo. There is deliberately no history on disk: the obvious\n * place to keep it is the one directory that must contain nothing but dynamic config.\n */\nimport { computed, ref } from 'vue';\nimport { api, problem } from '../api/client';\nimport type {\n LiveRoutesResponse,\n RoutingFile,\n RoutingListResponse,\n RoutingReadResponse,\n RoutingWriteResponse,\n RuntimeRoute,\n} from '../api/types';\nimport { settings } from '../composables/useSettings';\nimport { stamp } from '../composables/useFormat';\nimport { toast } from '../composables/useToasts';\nimport ActionButton from '../components/ActionButton.vue';\nimport ErrorNote from '../components/ErrorNote.vue';\nimport InfoHint from '../components/InfoHint.vue';\nimport SkeletonList from '../components/SkeletonList.vue';\n\n/**\n * The live routes, from container labels.\n *\n * This page used to show only the file provider, and the reported confusion was exactly right: a\n * deployment goes up, its hostname appears, and nothing here changes — because per-PR routers are\n * DOCKER labels and the files below are Traefik's *other* provider. Showing both is what makes the\n * page match what \"routing\" means to whoever opened it.\n */\nconst live = ref<RuntimeRoute[]>([]);\nconst liveReachable = ref<boolean | null>(null);\n\nconst files = ref<RoutingFile[]>([]);\nconst dir = ref('');\nconst writable = ref<boolean | null>(null);\nconst loaded = ref(false);\nconst listError = ref('');\n\n/** The open file. `null` name means a new one. */\nconst openName = ref<string | null>(null);\nconst draft = ref('');\nconst original = ref('');\nconst withheld = ref(false);\nconst loadingFile = ref(false);\nconst saving = ref(false);\nconst fileError = ref('');\nconst newName = ref('');\n/** Last replaced content, offered as an undo for the rest of the session. */\nconst undo = ref<{ name: string; content: string } | null>(null);\nconst confirmDelete = ref('');\n\nconst dirty = computed(() => openName.value !== null && draft.value !== original.value);\nconst canSave = computed(\n () => !!settings.token && !saving.value && draft.value.trim().length > 0 && (dirty.value || openName.value === ''),\n);\n\nconst STARTER = `http:\n middlewares:\n # An example — replace it. Middlewares go UNDER http; at the top level Traefik ignores them.\n ip-allow:\n ipAllowList:\n sourceRange:\n - 203.0.113.0/24\n`;\n\nasync function loadList(): Promise<void> {\n const r = await api.get<RoutingListResponse>('/api/routing');\n loaded.value = true;\n if (!r.ok) {\n listError.value = problem(r, 'load the routing files');\n return;\n }\n listError.value = '';\n files.value = r.body.files ?? [];\n dir.value = r.body.dir ?? '';\n writable.value = r.body.writable ?? false;\n}\n\nasync function loadLive(): Promise<void> {\n const r = await api.get<LiveRoutesResponse>('/api/routing/live');\n if (!r.ok) {\n liveReachable.value = false;\n return;\n }\n liveReachable.value = r.body.reachable;\n live.value = r.body.routes ?? [];\n}\n\nvoid loadList();\nvoid loadLive();\n\nasync function open(name: string): Promise<void> {\n openName.value = name;\n loadingFile.value = true;\n fileError.value = '';\n withheld.value = false;\n confirmDelete.value = '';\n // Authenticated: dynamic config holds basic-auth hashes and forward-auth URLs.\n const r = await api.getAuthed<RoutingReadResponse>(`/api/routing/${encodeURIComponent(name)}`);\n loadingFile.value = false;\n if (!r.ok) {\n fileError.value = problem(r, 'open this file');\n return;\n }\n if (r.body.sourceWithheld) {\n withheld.value = true;\n draft.value = '';\n original.value = '';\n return;\n }\n draft.value = r.body.content ?? '';\n original.value = draft.value;\n}\n\nfunction startNew(): void {\n openName.value = '';\n newName.value = '';\n draft.value = STARTER;\n original.value = '';\n withheld.value = false;\n fileError.value = '';\n}\n\nfunction close(): void {\n openName.value = null;\n draft.value = '';\n original.value = '';\n fileError.value = '';\n}\n\nasync function save(): Promise<void> {\n const name = openName.value === '' ? newName.value.trim() : openName.value;\n if (!name) {\n fileError.value = 'Give the file a name, ending in .yml';\n return;\n }\n saving.value = true;\n fileError.value = '';\n const r = await api.put<RoutingWriteResponse>(`/api/routing/${encodeURIComponent(name)}`, {\n content: draft.value,\n });\n saving.value = false;\n if (!r.ok) {\n // Rendered verbatim: the server's message names the unknown section or the YAML error, which is\n // the whole diagnosis.\n fileError.value = problem(r, 'save this file');\n return;\n }\n if (r.body.previous) undo.value = { name, content: r.body.previous };\n original.value = draft.value;\n openName.value = name;\n toast('ok', `Saved ${name}. Traefik reloads within a second or two.`);\n void loadList();\n}\n\nasync function revert(): Promise<void> {\n const u = undo.value;\n if (!u) return;\n draft.value = u.content;\n openName.value = u.name;\n await save();\n undo.value = null;\n}\n\nasync function remove(): Promise<void> {\n const name = openName.value;\n if (!name || confirmDelete.value !== name) return;\n const r = await api.del<RoutingWriteResponse>(`/api/routing/${encodeURIComponent(name)}`);\n if (!r.ok) {\n fileError.value = problem(r, 'delete this file');\n return;\n }\n if (r.body.previous) undo.value = { name, content: r.body.previous };\n toast('ok', `Deleted ${name}.`);\n close();\n void loadList();\n}\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>Routing</h1>\n <div class=\"sub\">\n Every route on this host, and the config files behind them\n <InfoHint label=\"what belongs in these files\">\n Middleware (basic auth, rate limits, IP allow-lists), TLS options, the catch-all fallback\n router, and routes to anything running outside compose. Per-PR routers are not here —\n those are labels in each deployment's own compose file.\n </InfoHint>\n </div>\n </div>\n <span class=\"grow\" />\n <button v-if=\"writable\" class=\"btn primary\" @click=\"startNew\">New file</button>\n </div>\n\n <ErrorNote v-if=\"listError\" :text=\"listError\" title=\"Could not load the routing files.\" />\n\n <div v-if=\"undo\" class=\"banner info\">\n <b>Replaced {{ undo.name }}.</b>\n <p>\n The previous contents are still here for this session.\n <button class=\"btn sm\" @click=\"revert\">Put it back</button>\n </p>\n </div>\n\n <!-- ============================ live routes ============================ -->\n <section class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Live routes</h2>\n <span class=\"grow\" />\n <span class=\"mute\" style=\"font-size: var(--t-sm)\">\n from container labels\n <InfoHint label=\"why routes are not in the files below\" align=\"end\">\n Traefik reads two providers. Per-PR routers are <b>labels on containers</b>, written by each\n deployment's own compose file — so deploying a stack changes this list and never the files.\n The files are the other provider: middleware, TLS options, the fallback router.\n </InfoHint>\n </span>\n </div>\n\n <div v-if=\"liveReachable === false\" class=\"banner warn\">\n <b>Docker did not answer.</b>\n <p>Routes could not be listed — which is not the same as there being none.</p>\n </div>\n\n <table v-else-if=\"live.length\" class=\"cards\">\n <thead>\n <tr>\n <th>url</th>\n <th>forwards to</th>\n <th>deployment</th>\n <th>router</th>\n </tr>\n </thead>\n <tbody class=\"stagger\">\n <tr v-for=\"(r, i) in live\" :key=\"`${r.container}-${r.router}`\" :style=\"{ '--i': i }\">\n <td data-label=\"url\">\n <div v-for=\"h in r.hosts\" :key=\"h\">\n <a v-if=\"!h.startsWith('(pattern)')\" :href=\"`https://${h}`\" target=\"_blank\" rel=\"noreferrer\">\n {{ h }}\n </a>\n <span v-else class=\"mono mute\">{{ h }}</span>\n </div>\n <span v-if=\"!r.hosts.length\" class=\"mute\">no host in the rule</span>\n </td>\n <td data-label=\"forwards to\">\n <span v-if=\"r.target\" class=\"mono\">{{ r.target }}</span>\n <span v-else class=\"s-failed\">\n {{ r.port === null ? 'no port declared' : 'not on the ingress network' }}\n </span>\n </td>\n <td data-label=\"deployment\">\n <RouterLink v-if=\"r.project\" :to=\"`/deployments/${encodeURIComponent(r.project)}/runtime`\">\n {{ r.project }}\n </RouterLink>\n <span v-else class=\"mute\">—</span>\n </td>\n <td class=\"dim\" data-label=\"router\">{{ r.router }}</td>\n </tr>\n </tbody>\n </table>\n\n <p v-else class=\"mute\">\n No container on this host declares a Traefik router. A deployment's routes come from labels in\n its own compose file — open a deployment's <b>Containers & routes</b> tab to see what is\n missing.\n </p>\n </section>\n\n <!-- ============================ config files ============================ -->\n <section class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Config files</h2>\n <span class=\"grow\" />\n <span v-if=\"dir\" class=\"mute\" style=\"font-size: var(--t-sm)\">\n <code>{{ dir }}</code>\n </span>\n </div>\n\n <!--\n The blast radius, stated once and up front — and the reassurance alongside it, because \"this can\n break everything\" without \"you will still be able to fix it\" just makes people avoid the page.\n -->\n <div class=\"banner warn\">\n <b>A bad file here affects every preview on this host.</b>\n <p>\n Traefik reads this directory as a whole: one unparseable file and it logs a parse error for the\n <em>directory</em>, so the symptom is other routes disappearing. Saves are checked before they\n are written and land atomically, so a rejected file never reaches Traefik.\n <InfoHint label=\"what this page cannot break\">\n This page and the API are routed by container labels, not by these files — so no save here\n can lock you out of the page you would use to undo it.\n </InfoHint>\n </p>\n </div>\n\n <div v-if=\"writable === false\" class=\"banner failed\">\n <b>Read-only: the API cannot write to this directory.</b>\n <p>\n The control stack mounts it into the API from 0.4.0 onward. Re-run\n <code>pstack init</code> on the host to pick up the mount — it is idempotent, and it recreates\n the control containers.\n </p>\n </div>\n\n <div v-else-if=\"!settings.token\" class=\"banner info\">\n <b>Viewing needs a token too.</b>\n <p>\n These files hold basic-auth hashes and forward-auth URLs, so their contents are not served\n unauthenticated. <RouterLink to=\"/settings\">Add your token</RouterLink>.\n </p>\n </div>\n\n <SkeletonList v-if=\"!loaded\" :rows=\"3\" />\n <ul v-else-if=\"files.length\" class=\"kvlist\">\n <li v-for=\"f in files\" :key=\"f.name\">\n <span class=\"k\">\n <button class=\"ghost sm\" @click=\"open(f.name)\">{{ f.name }}</button>\n </span>\n <span class=\"v mute\" style=\"font-size: var(--t-sm)\">\n {{ f.size }} bytes · {{ stamp(f.updatedAt) }}\n </span>\n </li>\n </ul>\n <p v-else class=\"mute\">\n No files yet. Everything is routed by container labels, which is a perfectly good place to be.\n </p>\n </section>\n\n <section v-if=\"openName !== null\" class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">{{ openName === '' ? 'New file' : openName }}</h2>\n <span v-if=\"dirty\" class=\"badge warn\">unsaved</span>\n <span class=\"grow\" />\n <button class=\"ghost sm\" @click=\"close\">Close</button>\n </div>\n\n <div v-if=\"openName === ''\" class=\"field\" style=\"max-width: 340px\">\n <label for=\"fname\">File name</label>\n <input\n id=\"fname\"\n v-model.trim=\"newName\"\n type=\"text\"\n placeholder=\"middleware.yml\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n />\n <div class=\"mute hint\">Lower case, ending in <code>.yml</code>.</div>\n </div>\n\n <SkeletonList v-if=\"loadingFile\" :rows=\"4\" />\n\n <div v-else-if=\"withheld\" class=\"banner plain\">\n <b>Hidden without an access token.</b>\n <p>\n <RouterLink to=\"/settings\">Add your token</RouterLink> to read and edit this file.\n </p>\n </div>\n\n <template v-else>\n <div class=\"field\">\n <label for=\"content\">Contents</label>\n <textarea id=\"content\" v-model=\"draft\" rows=\"18\" spellcheck=\"false\" />\n </div>\n\n <ErrorNote v-if=\"fileError\" :text=\"fileError\" title=\"Traefik would not accept this.\" />\n\n <div class=\"row\" style=\"margin-top: var(--s4)\">\n <ActionButton variant=\"primary\" :pending=\"saving\" :disabled=\"!canSave\" @click=\"save\">\n {{ saving ? 'Saving…' : 'Save' }}\n </ActionButton>\n <span v-if=\"!settings.token\" class=\"mute\">Saving needs a token.</span>\n </div>\n\n <template v-if=\"openName\">\n <h2 class=\"section\" style=\"margin: var(--s5) 0 var(--s3)\">Delete this file</h2>\n <p class=\"dim\">\n Whatever it configures stops applying as soon as Traefik reloads. If it holds a router,\n those hostnames stop resolving to anything.\n </p>\n <div class=\"field\" style=\"max-width: 340px\">\n <label :for=\"`confirm-${openName}`\">\n Type <b>{{ openName }}</b> to confirm\n </label>\n <input\n :id=\"`confirm-${openName}`\"\n v-model.trim=\"confirmDelete\"\n type=\"text\"\n :placeholder=\"openName\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n />\n </div>\n <div class=\"row\">\n <ActionButton\n variant=\"danger\"\n :disabled=\"confirmDelete !== openName || !settings.token\"\n :title=\"confirmDelete !== openName ? 'Type the file name to confirm.' : undefined\"\n @click=\"remove\"\n >\n Delete\n </ActionButton>\n </div>\n </template>\n </template>\n </section>\n </div>\n</template>\n"],"names":["STARTER","live","ref","liveReachable","files","dir","writable","loaded","listError","openName","draft","original","withheld","loadingFile","saving","fileError","newName","undo","confirmDelete","dirty","computed","canSave","settings","loadList","r","api","problem","loadLive","open","name","startNew","close","save","toast","revert","u","remove","_createElementBlock","_createElementVNode","_hoisted_1","_cache","_hoisted_2","_createVNode","InfoHint","_createBlock","ErrorNote","_openBlock","_hoisted_3","_toDisplayString","_hoisted_4","_hoisted_5","_hoisted_6","_hoisted_7","_hoisted_8","_hoisted_9","_Fragment","_renderList","i","_hoisted_10","h","_hoisted_12","_hoisted_11","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_component_RouterLink","_createTextVNode","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_unref","_hoisted_26","_hoisted_27","f","_hoisted_28","$event","_hoisted_29","_hoisted_30","stamp","_hoisted_31","SkeletonList","_hoisted_32","_hoisted_33","_hoisted_34","_hoisted_35","_hoisted_36","_hoisted_37","_hoisted_38","_hoisted_39","ActionButton","_hoisted_40","_hoisted_41","_hoisted_44"],"mappings":"orDA2EMA,GAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wCA3BhB,MAAMC,EAAOC,EAAoB,EAAE,EAC7BC,EAAgBD,EAAoB,IAAI,EAExCE,EAAQF,EAAmB,EAAE,EAC7BG,EAAMH,EAAI,EAAE,EACZI,EAAWJ,EAAoB,IAAI,EACnCK,EAASL,EAAI,EAAK,EAClBM,EAAYN,EAAI,EAAE,EAGlBO,EAAWP,EAAmB,IAAI,EAClCQ,EAAQR,EAAI,EAAE,EACdS,EAAWT,EAAI,EAAE,EACjBU,EAAWV,EAAI,EAAK,EACpBW,EAAcX,EAAI,EAAK,EACvBY,EAASZ,EAAI,EAAK,EAClBa,EAAYb,EAAI,EAAE,EAClBc,EAAUd,EAAI,EAAE,EAEhBe,EAAOf,EAA8C,IAAI,EACzDgB,EAAgBhB,EAAI,EAAE,EAEtBiB,EAAQC,EAAS,IAAMX,EAAS,QAAU,MAAQC,EAAM,QAAUC,EAAS,KAAK,EAChFU,EAAUD,EACd,IAAM,CAAC,CAACE,EAAS,OAAS,CAACR,EAAO,OAASJ,EAAM,MAAM,OAAO,OAAS,IAAMS,EAAM,OAASV,EAAS,QAAU,GAAA,EAYjH,eAAec,GAA0B,CACvC,MAAMC,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AAA,IAAAA,EAAA,EAAA,EAAA,GAFC,WAED,EAAA,CAAA"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as z,J as I,q as D,c as n,y as w,f as p,F as u,a as e,x as m,m as a,t as r,h as k,i as g,_ as T,r as y,D as c,j as L,o as s,E as $,G as _,B as A,C as B}from"./index-Bygbts8t.js";import{v as E,d as C}from"./useDeployment-C4MdUG63.js";import{_ as V}from"./SkeletonList.vue_vue_type_script_setup_true_lang-SxitAmDb.js";import{_ as K}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js";import"./useVars-VN9gYdR6.js";const U={key:0,class:"banner warn"},W={key:0,class:"banner ok"},F={class:"panel"},H={class:"phead"},j={class:"mute",style:{"font-size":"var(--t-sm)"}},q={key:0,class:"cards"},G={class:"stagger"},J={"data-label":"url"},M=["href"],O={key:1,class:"mono mute"},Q={key:0,class:"mute"},X={"data-label":"forwards to"},Y={key:0,class:"mono"},Z={key:1,class:"s-failed"},ee={class:"mute",style:{"font-size":"var(--t-sm)"}},te={"data-label":"router"},se={key:0,class:"mute",style:{"font-size":"var(--t-sm)"}},ne={"data-label":"tls"},oe={key:0,class:"badge ok"},re={key:1,class:"badge off"},le={key:1,class:"banner warn"},ae={class:"panel"},ie={class:"phead"},de={class:"mute",style:{"font-size":"var(--t-sm)"}},ue={key:0,class:"cards"},he={class:"stagger"},pe={class:"name","data-label":"service"},me={class:"mute",style:{"font-size":"var(--t-sm)"}},ve={"data-label":"state"},ce={"data-label":"ports"},fe={class:"mono"},ke={key:0,class:"mute"},ge={key:0,class:"mute"},ye={"data-label":"networks"},_e={key:0,class:"mute mono",style:{"font-size":"var(--t-sm)"}},be={class:"dim","data-label":"image"},we={key:1,class:"mute"},xe=z({__name:"RuntimeTab",setup(Te){const l=y(null),v=y(""),f=y(!0);async function b(){const i=await A.get(`/api/deployments/${encodeURIComponent(C.id)}/runtime${E.value}`);if(f.value=!1,!i.ok){v.value=B(i,"inspect what is running");return}v.value="",l.value=i.body}I(()=>C.id,()=>{f.value=!0,b()},{immediate:!0}),D(()=>void b(),8e3);const R=c(()=>{var i;return((i=l.value)==null?void 0:i.findings.filter(t=>t.level==="error"))??[]}),P=c(()=>{var i;return((i=l.value)==null?void 0:i.findings.filter(t=>t.level==="warn"))??[]}),S=c(()=>{var i;return((i=l.value)==null?void 0:i.findings.filter(t=>t.level==="info"))??[]}),x=c(()=>{var i;return((i=l.value)==null?void 0:i.containers.filter(t=>t.state==="running").length)??0});return(i,t)=>{const N=L("RouterLink");return s(),n("div",null,[v.value?(s(),w(K,{key:0,text:v.value,title:"Could not inspect this deployment."},null,8,["text"])):p("",!0),f.value&&!l.value?(s(),w(V,{key:1,rows:5})):l.value?(s(),n(u,{key:2},[l.value.reachable?(s(),n(u,{key:1},[(s(!0),n(u,null,m(R.value,(o,h)=>(s(),n("div",{key:`e${h}`,class:"banner failed"},[t[1]||(t[1]=e("b",null,"Blocking",-1)),e("p",null,r(o.message),1)]))),128)),(s(!0),n(u,null,m(P.value,(o,h)=>(s(),n("div",{key:`w${h}`,class:"banner warn"},[t[2]||(t[2]=e("b",null,"Worth checking",-1)),e("p",null,r(o.message),1)]))),128)),(s(!0),n(u,null,m(S.value,(o,h)=>(s(),n("div",{key:`i${h}`,class:"banner plain"},[e("p",null,r(o.message),1)]))),128)),!l.value.findings.length&&l.value.containers.length?(s(),n("div",W,[...t[3]||(t[3]=[e("b",null,"Nothing looks wrong.",-1),e("p",null," Every container is attached to the ingress network and every router has a rule and a port. If a hostname still fails, the next suspects are DNS and the certificate. ",-1)])])):p("",!0),e("section",F,[e("div",H,[t[5]||(t[5]=e("h2",{class:"section"},"Routing",-1)),t[6]||(t[6]=e("span",{class:"grow"},null,-1)),e("span",j,[a(" TLS: "+r(l.value.challenge==="unknown"?"unknown":l.value.challenge)+" ",1),k(T,{label:"why the TLS mode matters here",align:"end"},{default:g(()=>[...t[4]||(t[4]=[a(" Under HTTP-01 every per-PR router needs ",-1),e("code",null,"tls.certresolver=le",-1),a(", because each hostname resolves its own certificate. Under DNS-01 that inverts — one always-on router holds the wildcard, and a per-PR certresolver makes each PR order its own and burn the weekly limit. Read from the running Traefik's own flags, not configured here. ",-1)])]),_:1})])]),l.value.routes.length?(s(),n("table",q,[e("thead",null,[e("tr",null,[t[9]||(t[9]=e("th",null,"url",-1)),e("th",null,[t[8]||(t[8]=a(" forwards to ",-1)),k(T,{label:"how a URL reaches a port"},{default:g(()=>[...t[7]||(t[7]=[a(" Traefik's docker provider resolves the container's IP on ",-1),e("code",null,"preview-ingress",-1),a(" and dials it on the port from ",-1),e("code",null,"loadbalancer.server.port",-1),a(" — it does ",-1),e("em",null,"not",-1),a(" use ",-1),e("code",null,"service:port",-1),a(" DNS. So the port here is the one inside the container, and publishing a host port is unnecessary. ",-1)])]),_:1})]),t[10]||(t[10]=e("th",null,"router",-1)),t[11]||(t[11]=e("th",null,"tls",-1))])]),e("tbody",G,[(s(!0),n(u,null,m(l.value.routes,(o,h)=>(s(),n("tr",{key:o.router,style:$({"--i":h})},[e("td",J,[(s(!0),n(u,null,m(o.hosts,d=>(s(),n("div",{key:d},[d.startsWith("(pattern)")?(s(),n("span",O,r(d),1)):(s(),n("a",{key:0,href:`https://${d}`,target:"_blank",rel:"noreferrer"},r(d),9,M))]))),128)),o.hosts.length?p("",!0):(s(),n("span",Q,"no host in the rule"))]),e("td",X,[o.target?(s(),n("span",Y,r(o.target),1)):(s(),n("span",Z,r(o.port===null?"no port declared":"not on the ingress network"),1)),e("div",ee,r(o.container),1)]),e("td",te,[a(r(o.router)+" ",1),o.priority?(s(),n("div",se," priority "+r(o.priority),1)):p("",!0)]),e("td",ne,[o.tls?(s(),n("span",oe,r(o.certresolver||"inherited"),1)):(s(),n("span",re,"off"))])],4))),128))])])):(s(),n("div",le,[t[17]||(t[17]=e("b",null,"No routes. Traefik has not been told about this deployment.",-1)),e("p",null,[t[13]||(t[13]=a(" Routes come from labels in ",-1)),t[14]||(t[14]=e("em",null,"your",-1)),t[15]||(t[15]=a(" compose file, not from pstack and not from the ",-1)),k(N,{to:"/routing"},{default:g(()=>[...t[12]||(t[12]=[a("Routing",-1)])]),_:1}),t[16]||(t[16]=a(" page (that is Traefik's file provider — middleware and TLS options, not per-PR routers). A reachable service needs four things: ",-1))]),t[18]||(t[18]=e("pre",{class:"code"},"labels:\n - traefik.enable=true # the host runs exposedbydefault=false\n - traefik.docker.network=preview-ingress # which network Traefik should dial\n - traefik.http.routers.<name>-${STACK}.rule=Host(`<name>-${STACK}.${PREVIEW_DOMAIN}`)\n - traefik.http.services.<name>-${STACK}.loadbalancer.server.port=80\nnetworks: [default, preview-ingress] # and preview-ingress: { external: true }",-1)),t[19]||(t[19]=e("p",{class:"mute"},[a(" Put "),e("code",null,"${STACK}"),a(" in the router and service names: Traefik's namespace is global across the host, so two deployments sharing a router name serve each other's containers. ")],-1))]))]),e("section",ae,[e("div",ie,[t[20]||(t[20]=e("h2",{class:"section"},"Containers",-1)),t[21]||(t[21]=e("span",{class:"grow"},null,-1)),e("span",de,r(x.value)+" of "+r(l.value.containers.length)+" running ",1)]),l.value.containers.length?(s(),n("table",ue,[t[22]||(t[22]=e("thead",null,[e("tr",null,[e("th",null,"service"),e("th",null,"state"),e("th",null,"ports"),e("th",null,"networks"),e("th",null,"image")])],-1)),e("tbody",he,[(s(!0),n(u,null,m(l.value.containers,(o,h)=>(s(),n("tr",{key:o.id,style:$({"--i":h})},[e("td",pe,[a(r(o.service??o.name)+" ",1),e("div",me,r(o.name),1)]),e("td",ve,[e("span",{class:_(o.state==="running"?"s-ok":"s-failed")},r(o.state),3),o.health?(s(),n("div",{key:0,class:_(["mute",o.health==="healthy"?"s-ok":"s-failed"]),style:{"font-size":"var(--t-sm)"}},r(o.health),3)):p("",!0)]),e("td",ce,[(s(!0),n(u,null,m(o.ports,d=>(s(),n("div",{key:`${d.containerPort}/${d.protocol}`},[e("span",fe,r(d.containerPort),1),d.hostPort?(s(),n("span",ke," ← host "+r(d.hostPort),1)):p("",!0)]))),128)),o.ports.length?p("",!0):(s(),n("span",ge,"none exposed"))]),e("td",ye,[(s(!0),n(u,null,m(o.networks,d=>(s(),n("div",{key:d},[e("span",{class:_(d==="preview-ingress"?"s-ok":"")},r(d),3)]))),128)),o.ingressIp?(s(),n("div",_e,r(o.ingressIp),1)):p("",!0)]),e("td",be,r(o.image),1)],4))),128))])])):(s(),n("p",we," No containers for this stack. If you expected some, check that their profile is one the spec selects — a service behind a profile that is not enabled is never started. "))])],64)):(s(),n("div",U,[...t[0]||(t[0]=[e("b",null,"Docker did not answer.",-1),e("p",null," Nothing below could be determined — this is not the same as nothing running. Check the daemon and the socket mount, then refresh. ",-1)])]))],64)):p("",!0)])}}});export{xe as default};
|
|
2
|
-
//# sourceMappingURL=RuntimeTab-DvrQFekD.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as w,c as r,a as t,g as d,v as m,u as s,S as o,m as i,h as v,i as f,_ as c,F as C,f as k,t as u,z as n,H as y,r as V,D as E,$ as S,P as x,o as p}from"./index-Bygbts8t.js";const B={class:"panel"},U={class:"field"},D={class:"mute hint"},F={class:"field"},T={class:"mute hint"},A={class:"row",style:{gap:"8px","margin-top":"4px"}},L=["disabled"],N={key:0,class:"mute"},R={key:1,class:"bad"},M={class:"panel"},P={class:"field"},q={class:"field"},$=w({__name:"SettingsView",setup(H){const l=V(!1),g=E(()=>{var h;return((h=n.health)==null?void 0:h.authEnforced)??null});async function b(){l.value=!0;try{await S(),x(n.healthError?"error":"ok",n.healthError||"Control plane reachable")}finally{l.value=!1}}return(h,e)=>(p(),r("div",null,[e[18]||(e[18]=t("div",{class:"page-head"},[t("div",null,[t("h1",null,"Settings"),t("div",{class:"sub"},"Stored in this browser only. Nothing here is sent to the server.")])],-1)),t("section",B,[e[11]||(e[11]=t("h2",{class:"phead-title"},"Connection",-1)),t("div",U,[e[6]||(e[6]=t("label",{for:"apiBase"},"API base URL",-1)),d(t("input",{id:"apiBase","onUpdate:modelValue":e[0]||(e[0]=a=>s(o).apiBase=a),type:"url",spellcheck:"false",placeholder:"(same origin)"},null,512),[[m,s(o).apiBase,void 0,{trim:!0}]]),t("div",D,[e[5]||(e[5]=i(" Leave it empty unless you are pointing this page at another host. ",-1)),v(c,{label:"about the API base URL"},{default:f(()=>[...e[4]||(e[4]=[i(" Empty means same-origin, which is how the control stack serves this page — the browser never makes a cross-origin request, so there is no CORS to configure. Set an absolute URL only for a development session against a remote host. ",-1)])]),_:1})])]),t("div",F,[e[8]||(e[8]=t("label",{for:"token"},"Access token",-1)),d(t("input",{id:"token","onUpdate:modelValue":e[1]||(e[1]=a=>s(o).token=a),type:"password",autocomplete:"off",spellcheck:"false",placeholder:"paste the token from pstack init"},null,512),[[m,s(o).token,void 0,{trim:!0}]]),t("div",T,[e[7]||(e[7]=i(" Authenticates every request — signing in with an account does the same job, so set this only for token-based access (the machine token, or a personal token from your account). ",-1)),g.value===!1?(p(),r(C,{key:0},[i(" This server is not asking for one — it only accepts connections from this machine, so a token here is harmless but unnecessary. ")],64)):k("",!0)])]),t("div",A,[t("button",{class:"btn",disabled:l.value,onClick:b},u(l.value?"Checking…":"Test connection"),9,L),s(n).health?(p(),r("span",N,[i(" Connected to pstack "+u(s(n).health.version)+" ",1),v(c,{label:"where data is stored"},{default:f(()=>[e[9]||(e[9]=i(" Deployment records and stored specs live in ",-1)),t("code",null,u(s(n).health.dataDir),1),e[10]||(e[10]=i(" on the host. ",-1))]),_:1})])):s(n).healthError?(p(),r("span",R,u(s(n).healthError),1)):k("",!0)])]),t("section",M,[e[17]||(e[17]=t("h2",{class:"phead-title"},"Appearance",-1)),t("div",P,[e[13]||(e[13]=t("label",{for:"theme"},"Theme",-1)),d(t("select",{id:"theme","onUpdate:modelValue":e[2]||(e[2]=a=>s(o).theme=a)},[...e[12]||(e[12]=[t("option",{value:"system"},"Follow the system",-1),t("option",{value:"dark"},"Dark",-1),t("option",{value:"light"},"Light",-1)])],512),[[y,s(o).theme]])]),t("div",q,[e[15]||(e[15]=t("label",{for:"motion"},"Motion",-1)),d(t("select",{id:"motion","onUpdate:modelValue":e[3]||(e[3]=a=>s(o).motion=a)},[...e[14]||(e[14]=[t("option",{value:"system"},"Follow the system",-1),t("option",{value:"full"},"Full animation",-1),t("option",{value:"none"},"Reduce motion",-1)])],512),[[y,s(o).motion]]),e[16]||(e[16]=t("div",{class:"mute hint"}," “Follow the system” uses your device's reduce-motion setting. The other two override it, in either direction. ",-1))])])]))}});export{$ as default};
|
|
2
|
-
//# sourceMappingURL=SettingsView-B7_zHjVP.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsView-B7_zHjVP.js","sources":["../../src/views/SettingsView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Settings: where the API is, how to authenticate to it, and how the app looks.\n *\n * Everything here is client-side and persisted to localStorage by `useSettings` — nothing is sent\n * to the server, and there is nothing to save. Bindings write through immediately.\n */\nimport { computed, ref } from 'vue';\nimport { settings } from '../composables/useSettings';\nimport { state, loadHealth } from '../composables/useControlPlane';\nimport { toast } from '../composables/useToasts';\nimport InfoHint from '../components/InfoHint.vue';\n\nconst checking = ref(false);\n\n/**\n * The server tells us whether it enforces auth. When it does not, it is bound to loopback and a\n * token would be pointless — worth saying, so nobody hunts for one that was never issued.\n */\nconst authEnforced = computed(() => state.health?.authEnforced ?? null);\n\nasync function recheck(): Promise<void> {\n checking.value = true;\n try {\n await loadHealth();\n toast(state.healthError ? 'error' : 'ok', state.healthError || 'Control plane reachable');\n } finally {\n checking.value = false;\n }\n}\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>Settings</h1>\n <div class=\"sub\">Stored in this browser only. Nothing here is sent to the server.</div>\n </div>\n </div>\n\n <section class=\"panel\">\n <h2 class=\"phead-title\">Connection</h2>\n\n <div class=\"field\">\n <label for=\"apiBase\">API base URL</label>\n <input\n id=\"apiBase\"\n v-model.trim=\"settings.apiBase\"\n type=\"url\"\n spellcheck=\"false\"\n placeholder=\"(same origin)\"\n />\n <div class=\"mute hint\">\n Leave it empty unless you are pointing this page at another host.\n <InfoHint label=\"about the API base URL\">\n Empty means same-origin, which is how the control stack serves this page — the browser\n never makes a cross-origin request, so there is no CORS to configure. Set an absolute\n URL only for a development session against a remote host.\n </InfoHint>\n </div>\n </div>\n\n <div class=\"field\">\n <label for=\"token\">Access token</label>\n <input\n id=\"token\"\n v-model.trim=\"settings.token\"\n type=\"password\"\n autocomplete=\"off\"\n spellcheck=\"false\"\n placeholder=\"paste the token from pstack init\"\n />\n <div class=\"mute hint\">\n Authenticates every request — signing in with an account does the same job, so set this\n only for token-based access (the machine token, or a personal token from your account).\n <template v-if=\"authEnforced === false\">\n This server is not asking for one — it only accepts connections from this machine, so a\n token here is harmless but unnecessary.\n </template>\n </div>\n </div>\n\n <div class=\"row\" style=\"gap: 8px; margin-top: 4px\">\n <button class=\"btn\" :disabled=\"checking\" @click=\"recheck\">\n {{ checking ? 'Checking…' : 'Test connection' }}\n </button>\n <span v-if=\"state.health\" class=\"mute\">\n Connected to pstack {{ state.health.version }}\n <InfoHint label=\"where data is stored\">\n Deployment records and stored specs live in\n <code>{{ state.health.dataDir }}</code> on the host.\n </InfoHint>\n </span>\n <span v-else-if=\"state.healthError\" class=\"bad\">{{ state.healthError }}</span>\n </div>\n </section>\n\n <section class=\"panel\">\n <h2 class=\"phead-title\">Appearance</h2>\n\n <div class=\"field\">\n <label for=\"theme\">Theme</label>\n <select id=\"theme\" v-model=\"settings.theme\">\n <option value=\"system\">Follow the system</option>\n <option value=\"dark\">Dark</option>\n <option value=\"light\">Light</option>\n </select>\n </div>\n\n <div class=\"field\">\n <label for=\"motion\">Motion</label>\n <select id=\"motion\" v-model=\"settings.motion\">\n <option value=\"system\">Follow the system</option>\n <option value=\"full\">Full animation</option>\n <option value=\"none\">Reduce motion</option>\n </select>\n <div class=\"mute hint\">\n “Follow the system” uses your device's reduce-motion setting. The other two override it,\n in either direction.\n </div>\n </div>\n </section>\n </div>\n</template>\n"],"names":["checking","ref","authEnforced","computed","_a","state","recheck","loadHealth","toast","_createElementBlock","_createElementVNode","_hoisted_1","_cache","_hoisted_2","$event","_unref","settings","_hoisted_3","_createVNode","InfoHint","_hoisted_4","_hoisted_5","_Fragment","_hoisted_6","_hoisted_7","_openBlock","_hoisted_8","_createTextVNode","_toDisplayString","_hoisted_9","_hoisted_10","_hoisted_11","_vModelSelect","_hoisted_12"],"mappings":"ueAaA,MAAMA,EAAWC,EAAI,EAAK,EAMpBC,EAAeC,EAAS,IAAA,OAAM,QAAAC,EAAAC,EAAM,SAAN,YAAAD,EAAc,eAAgB,KAAI,EAEtE,eAAeE,GAAyB,CACtCN,EAAS,MAAQ,GACjB,GAAI,CACF,MAAMO,EAAA,EACNC,EAAMH,EAAM,YAAc,QAAU,KAAMA,EAAM,aAAe,yBAAyB,CAC1F,QAAA,CACEL,EAAS,MAAQ,EACnB,CACF,mBAIES,EA0FM,MAAA,KAAA,eAzFJC,EAKM,MAAA,CALD,MAAM,aAAW,CACpBA,EAGM,MAAA,KAAA,CAFJA,EAAiB,UAAb,UAAQ,EACZA,EAAuF,MAAA,CAAlF,MAAM,KAAA,EAAM,kEAAgE,CAAA,SAIrFA,EAuDU,UAvDVC,EAuDU,CAtDRC,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAF,EAAuC,KAAA,CAAnC,MAAM,aAAA,EAAc,aAAU,EAAA,GAElCA,EAiBM,MAjBNG,EAiBM,CAhBJD,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAF,EAAyC,QAAA,CAAlC,IAAI,SAAA,EAAU,eAAY,EAAA,KACjCA,EAME,QAAA,CALA,GAAG,UACW,sBAAAE,EAAA,CAAA,IAAAA,EAAA,CAAA,EAAAE,GAAAC,EAAAC,CAAA,EAAS,QAAOF,GAC9B,KAAK,MACL,WAAW,QACX,YAAY,eAAA,gBAHEC,EAAAC,CAAA,EAAS,eAAf,CAAA,KAAR,EAAA,CAA+B,IAKjCN,EAOM,MAPNO,E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 -1,2 +0,0 @@
|
|
|
1
|
-
import{d as D,J as C,z as V,Q as $,c as n,a as s,h as c,i as d,t as o,G as z,f as m,y as _,F as b,m as l,_ as A,x as I,u as N,r as v,D as L,j as R,o as t,S,B as j,C as q}from"./index-Bygbts8t.js";import{s as B}from"./useFormat-CKJxQp_i.js";import{_ as E}from"./SkeletonList.vue_vue_type_script_setup_true_lang-SxitAmDb.js";import{_ as F}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js";const T={class:"page-head"},U={class:"mute",style:{"font-size":"var(--t-sm)"}},G={style:{"font-size":"var(--t-xl)"}},H={class:"sub"},J={key:0},P={key:1},Q={key:2},W={key:3,class:"mute"},K={key:1,class:"panel"},M={class:"banner failed"},O={class:"panel"},X={key:1,class:"kvlist"},Y={class:"k"},Z={class:"v"},ee={key:0},se={key:1,class:"mute"},te={class:"v"},ne={key:1,class:"mute"},ae={class:"v"},oe={class:"v"},le={key:0,class:"panel"},ie={key:0,class:"banner plain"},de={key:1,class:"code"},re={key:2,class:"mute"},ve=D({__name:"SpecDetailView",props:{name:{}},setup(y){const f=y,a=v(null),r=v(!0),u=v(""),p=v(!1);async function g(){r.value=!0,p.value=!1;const i=await j.getAuthed(`/api/specs/${encodeURIComponent(f.name)}`);if(r.value=!1,i.status===404){p.value=!0;return}if(!i.ok){u.value=q(i,"load this spec");return}u.value="",a.value=i.body}C(()=>f.name,g,{immediate:!0}),C(()=>S.token,g),V.deploymentsLoaded||$();const w=L(()=>V.deployments.filter(i=>i.specName===f.name));return(i,e)=>{var x;const k=R("RouterLink");return t(),n("div",null,[s("div",T,[s("div",null,[s("div",U,[c(k,{to:"/specs"},{default:d(()=>[...e[0]||(e[0]=[l("← specs",-1)])]),_:1})]),s("h1",G,o(y.name),1),s("div",H,[(x=a.value)!=null&&x.description?(t(),n("span",J,o(a.value.description),1)):p.value?(t(),n("span",P,"not found")):r.value?(t(),n("span",Q,"loading…")):(t(),n("span",W,"no description"))])]),e[1]||(e[1]=s("span",{class:"grow"},null,-1)),a.value?(t(),n("span",{key:0,class:z(["badge",a.value.kind])},o(a.value.kind),3)):m("",!0)]),u.value?(t(),_(F,{key:0,text:u.value,title:"Could not load this spec."},null,8,["text"])):m("",!0),p.value?(t(),n("section",K,[s("div",M,[s("b",null,"No spec named “"+o(y.name)+"”.",1),e[2]||(e[2]=s("p",null,"It may have been deleted, or this is an older link.",-1))])])):(t(),n(b,{key:2},[s("section",O,[r.value?(t(),_(E,{key:0,rows:4})):a.value?(t(),n("ul",X,[s("li",null,[s("span",Y,[e[4]||(e[4]=l(" needs ",-1)),c(A,{label:"what needs means"},{default:d(()=>[...e[3]||(e[3]=[l(" Variables the spec uses but does not set. Every deployment referencing it supplies these, which is how one spec serves many stacks — and a missing one is refused by name rather than filled in blank. ",-1)])]),_:1})]),s("span",Z,[a.value.requiredVars.length?(t(),n("b",ee,o(a.value.requiredVars.join(", ")),1)):(t(),n("span",se,"nothing — every value is fixed by the spec"))])]),s("li",null,[e[6]||(e[6]=s("span",{class:"k"},"used by",-1)),s("span",te,[w.value.length?(t(),n(b,{key:0},[(t(!0),n(b,null,I(w.value,h=>(t(),_(k,{key:h.id,to:`/deployments/${encodeURIComponent(h.id)}`,style:{"margin-right":"10px"}},{default:d(()=>[l(o(h.id),1)]),_:2},1032,["to"]))),128)),c(A,{label:"why this matters"},{default:d(()=>[...e[5]||(e[5]=[l(" Deleting a spec while a deployment still references it is refused: that deployment could no longer be resolved, and one that cannot be resolved can never be torn down. ",-1)])]),_:1})],64)):(t(),n("span",ne,"no deployments reference it"))])]),s("li",null,[e[7]||(e[7]=s("span",{class:"k"},"created",-1)),s("span",ae,o(N(B)(a.value.createdAt)),1)]),s("li",null,[e[8]||(e[8]=s("span",{class:"k"},"updated",-1)),s("span",oe,o(N(B)(a.value.updatedAt)),1)])])):m("",!0)]),a.value?(t(),n("section",le,[e[13]||(e[13]=s("div",{class:"phead"},[s("h2",{class:"section"},"Source")],-1)),a.value.sourceWithheld?(t(),n("div",ie,[e[12]||(e[12]=s("b",null,"Hidden without an access token.",-1)),s("p",null,[e[10]||(e[10]=l(" A spec's hooks are shell commands, and they often carry a password or an API token inline — so the server does not send the file to an unauthenticated reader. ",-1)),c(k,{to:"/settings"},{default:d(()=>[...e[9]||(e[9]=[l("Add your token",-1)])]),_:1}),e[11]||(e[11]=l(" to see it. ",-1))])])):a.value.source?(t(),n("pre",de,o(a.value.source),1)):(t(),n("p",re,"The server returned no source for this spec."))])):m("",!0)],64))])}}});export{ve as default};
|
|
2
|
-
//# sourceMappingURL=SpecDetailView-CViJ8WG_.js.map
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{d as L,z as g,Q as q,c as a,a as t,m as l,h as r,i as y,_ as w,y as x,f,F as C,g as B,v as $,x as z,t as i,r as u,B as D,C as T,D as N,j as U,o as s,E,G as R}from"./index-Bygbts8t.js";import{_ as j}from"./SkeletonList.vue_vue_type_script_setup_true_lang-SxitAmDb.js";import{_ as A}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js";import{_ as F}from"./RelativeTime.vue_vue_type_script_setup_true_lang-lQaz4t05.js";import"./useFormat-CKJxQp_i.js";const I={class:"page-head"},M={class:"sub"},G={key:1,class:"panel"},P={key:2,class:"panel"},Q={class:"field",style:{"max-width":"320px","margin-bottom":"var(--s4)"}},W={class:"cards","data-testid":"specs.list"},H={class:"stagger"},J={class:"name","data-label":"name"},K={key:0,class:"mute",style:{"font-size":"var(--t-sm)"}},O={"data-label":"kind"},X={"data-label":"needs"},Y={key:0},Z={key:1,class:"mute"},ee={"data-label":"used by"},te={key:0},se={key:1,class:"mute"},ne={class:"dim nowrap","data-label":"updated"},oe={key:0},ae={colspan:"5",class:"mute"},le={key:2,class:"banner plain"},ce=L({__name:"SpecsView",setup(ie){const p=u([]),v=u(!1),m=u(""),h=u(!1),c=u("");async function S(){const o=await D.get("/api/specs");if(v.value=!0,o.status===404){h.value=!0;return}if(!o.ok){m.value=T(o,"load specs");return}m.value="",p.value=o.body.specs??[]}S(),g.deploymentsLoaded||q();const _=N(()=>{const o=new Map;for(const e of g.deployments){if(!e.specName)continue;const d=o.get(e.specName)??[];d.push(e.id),o.set(e.specName,d)}return o}),b=N(()=>{const o=c.value.trim().toLowerCase();return o?p.value.filter(e=>e.name.toLowerCase().includes(o)||(e.description??"").toLowerCase().includes(o)):p.value});return(o,e)=>{const d=U("RouterLink");return s(),a("div",null,[t("div",I,[t("div",null,[e[3]||(e[3]=t("h1",null,"Specs",-1)),t("div",M,[e[2]||(e[2]=l(" Stored once, used by any number of deployments ",-1)),r(w,{label:"why store a spec"},{default:y(()=>[...e[1]||(e[1]=[l(" Without this, every deployment carries its own copy — 50 open pull requests meant 50 identical files, and fixing a teardown step meant re-submitting it 50 times. ",-1)])]),_:1})])])]),m.value?(s(),x(A,{key:0,text:m.value,title:"Could not load the specs."},null,8,["text"])):f("",!0),h.value?(s(),a("section",G,[...e[4]||(e[4]=[t("div",{class:"banner plain"},[t("b",null,"This server has no stored specs."),t("p",null," It is an older build of pstack — every deployment carries its own copy of its spec, which still works. Upgrade the host to store specs and reference them by name. ")],-1)])])):(s(),a("section",P,[v.value?p.value.length?(s(),a(C,{key:1},[t("div",Q,[e[5]||(e[5]=t("label",{for:"q"},"Search",-1)),B(t("input",{id:"q","onUpdate:modelValue":e[0]||(e[0]=n=>c.value=n),type:"search",placeholder:"name or description"},null,512),[[$,c.value]])]),t("table",W,[t("thead",null,[t("tr",null,[e[8]||(e[8]=t("th",null,"name",-1)),e[9]||(e[9]=t("th",null,"kind",-1)),t("th",null,[e[7]||(e[7]=l(" needs ",-1)),r(w,{label:"what needs means"},{default:y(()=>[...e[6]||(e[6]=[l(" Variables the spec uses but does not set. Every deployment referencing it must supply these, which is how one spec serves many stacks. ",-1)])]),_:1})]),e[10]||(e[10]=t("th",null,"used by",-1)),e[11]||(e[11]=t("th",null,"updated",-1))])]),t("tbody",H,[(s(!0),a(C,null,z(b.value,(n,V)=>{var k;return s(),a("tr",{key:n.name,style:E({"--i":V})},[t("td",J,[r(d,{to:`/specs/${encodeURIComponent(n.name)}`},{default:y(()=>[l(i(n.name),1)]),_:2},1032,["to"]),n.description?(s(),a("div",K,i(n.description),1)):f("",!0)]),t("td",O,[t("span",{class:R(["badge",n.kind])},i(n.kind),3)]),t("td",X,[n.requiredVars.length?(s(),a("span",Y,i(n.requiredVars.join(", ")),1)):(s(),a("span",Z,"nothing"))]),t("td",ee,[(k=_.value.get(n.name))!=null&&k.length?(s(),a("span",te,i(_.value.get(n.name).length)+" deployment(s) ",1)):(s(),a("span",se,"nothing yet"))]),t("td",ne,[r(F,{at:n.updatedAt},null,8,["at"])])],4)}),128)),b.value.length?f("",!0):(s(),a("tr",oe,[t("td",ae,"No spec matches “"+i(c.value)+"”.",1)]))])])],64)):(s(),a("div",le,[e[15]||(e[15]=t("b",null,"No specs stored yet.",-1)),t("p",null,[e[13]||(e[13]=l(" A deployment can carry its own spec inline — see ",-1)),r(d,{to:"/submit"},{default:y(()=>[...e[12]||(e[12]=[l("Submit",-1)])]),_:1}),e[14]||(e[14]=l(" — and that is all you need for a one-off. Storing one here pays off when several deployments share it. ",-1))]),e[16]||(e[16]=t("p",{class:"mute"},[l(" Storing is not yet possible from this page; send the spec to "),t("code",null,"PUT /api/specs/<name>"),l(" with your token. ")],-1))])):(s(),x(j,{key:0,rows:3}))]))])}}});export{ce as default};
|
|
2
|
-
//# sourceMappingURL=SpecsView-BpG2OWMm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpecsView-BpG2OWMm.js","sources":["../../src/views/SpecsView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Stored specs: what is on this host, and who is using each one.\n *\n * The \"used by\" count is computed from the deployments already in shared state rather than asked\n * for: every row carries `specName`, so the join is free. It matters because deleting a spec that\n * deployments still reference is refused — a deployment that cannot resolve its spec can never be\n * torn down — so knowing the count before you try is the difference between a plan and a 409.\n *\n * A server built before named specs answers 404 here. That is a capability difference, not an\n * error, so it gets its own explanation instead of a red banner.\n */\nimport { computed, ref } from 'vue';\nimport { api, problem } from '../api/client';\nimport type { SpecMeta, SpecsResponse } from '../api/types';\nimport { state, loadDeployments } from '../composables/useControlPlane';\n\nimport SkeletonList from '../components/SkeletonList.vue';\nimport ErrorNote from '../components/ErrorNote.vue';\nimport InfoHint from '../components/InfoHint.vue';\nimport RelativeTime from '../components/RelativeTime.vue';\n\nconst specs = ref<SpecMeta[]>([]);\nconst loaded = ref(false);\nconst error = ref('');\nconst unsupported = ref(false);\nconst needle = ref('');\n\nasync function load(): Promise<void> {\n const r = await api.get<SpecsResponse>('/api/specs');\n loaded.value = true;\n if (r.status === 404) {\n unsupported.value = true;\n return;\n }\n if (!r.ok) {\n error.value = problem(r, 'load specs');\n return;\n }\n error.value = '';\n specs.value = r.body.specs ?? [];\n}\n\nvoid load();\n// The deployment list is what the \"used by\" column joins against; a deep link straight here may\n// arrive before the shell's poll has filled it.\nif (!state.deploymentsLoaded) void loadDeployments();\n\n/** Deployment ids referencing each spec, by spec name. */\nconst users = computed(() => {\n const m = new Map<string, string[]>();\n for (const d of state.deployments) {\n if (!d.specName) continue;\n const list = m.get(d.specName) ?? [];\n list.push(d.id);\n m.set(d.specName, list);\n }\n return m;\n});\n\nconst shown = computed(() => {\n const q = needle.value.trim().toLowerCase();\n if (!q) return specs.value;\n return specs.value.filter(\n (s) => s.name.toLowerCase().includes(q) || (s.description ?? '').toLowerCase().includes(q),\n );\n});\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>Specs</h1>\n <div class=\"sub\">\n Stored once, used by any number of deployments\n <InfoHint label=\"why store a spec\">\n Without this, every deployment carries its own copy — 50 open pull requests meant 50\n identical files, and fixing a teardown step meant re-submitting it 50 times.\n </InfoHint>\n </div>\n </div>\n </div>\n\n <ErrorNote v-if=\"error\" :text=\"error\" title=\"Could not load the specs.\" />\n\n <section v-if=\"unsupported\" class=\"panel\">\n <div class=\"banner plain\">\n <b>This server has no stored specs.</b>\n <p>\n It is an older build of pstack — every deployment carries its own copy of its spec, which\n still works. Upgrade the host to store specs and reference them by name.\n </p>\n </div>\n </section>\n\n <section v-else class=\"panel\">\n <SkeletonList v-if=\"!loaded\" :rows=\"3\" />\n\n <template v-else-if=\"specs.length\">\n <div class=\"field\" style=\"max-width: 320px; margin-bottom: var(--s4)\">\n <label for=\"q\">Search</label>\n <input id=\"q\" v-model=\"needle\" type=\"search\" placeholder=\"name or description\" />\n </div>\n\n <table class=\"cards\" data-testid=\"specs.list\">\n <thead>\n <tr>\n <th>name</th>\n <th>kind</th>\n <th>\n needs\n <InfoHint label=\"what needs means\">\n Variables the spec uses but does not set. Every deployment referencing it must\n supply these, which is how one spec serves many stacks.\n </InfoHint>\n </th>\n <th>used by</th>\n <th>updated</th>\n </tr>\n </thead>\n <tbody class=\"stagger\">\n <tr v-for=\"(s, i) in shown\" :key=\"s.name\" :style=\"{ '--i': i }\">\n <td class=\"name\" data-label=\"name\">\n <RouterLink :to=\"`/specs/${encodeURIComponent(s.name)}`\">{{ s.name }}</RouterLink>\n <div v-if=\"s.description\" class=\"mute\" style=\"font-size: var(--t-sm)\">\n {{ s.description }}\n </div>\n </td>\n <td data-label=\"kind\">\n <span class=\"badge\" :class=\"s.kind\">{{ s.kind }}</span>\n </td>\n <td data-label=\"needs\">\n <span v-if=\"s.requiredVars.length\">{{ s.requiredVars.join(', ') }}</span>\n <span v-else class=\"mute\">nothing</span>\n </td>\n <td data-label=\"used by\">\n <span v-if=\"users.get(s.name)?.length\">\n {{ users.get(s.name)!.length }} deployment(s)\n </span>\n <span v-else class=\"mute\">nothing yet</span>\n </td>\n <td class=\"dim nowrap\" data-label=\"updated\"><RelativeTime :at=\"s.updatedAt\" /></td>\n </tr>\n <tr v-if=\"!shown.length\">\n <td colspan=\"5\" class=\"mute\">No spec matches “{{ needle }}”.</td>\n </tr>\n </tbody>\n </table>\n </template>\n\n <!--\n Honest empty state. This page cannot create a spec yet, so pointing at \"New spec\" would be a\n dead end — it names the way that does work instead.\n -->\n <div v-else class=\"banner plain\">\n <b>No specs stored yet.</b>\n <p>\n A deployment can carry its own spec inline — see\n <RouterLink to=\"/submit\">Submit</RouterLink> — and that is all you need for a one-off.\n Storing one here pays off when several deployments share it.\n </p>\n <p class=\"mute\">\n Storing is not yet possible from this page; send the spec to\n <code>PUT /api/specs/<name></code> with your token.\n </p>\n </div>\n </section>\n </div>\n</template>\n"],"names":["specs","ref","loaded","error","unsupported","needle","load","r","api","problem","state","loadDeployments","users","computed","m","d","list","shown","q","s","_createElementBlock","_createElementVNode","_hoisted_1","_cache","_hoisted_2","_createVNode","InfoHint","_createBlock","ErrorNote","_openBlock","_hoisted_3","_hoisted_4","_Fragment","_hoisted_5","$event","_hoisted_6","_hoisted_7","_renderList","i","_hoisted_8","_component_RouterLink","_createTextVNode","_toDisplayString","_hoisted_9","_hoisted_10","_normalizeClass","_hoisted_11","_hoisted_12","_hoisted_13","_hoisted_14","_a","_hoisted_15","_hoisted_16","_hoisted_17","RelativeTime","_hoisted_18","_hoisted_19","_hoisted_20","SkeletonList"],"mappings":"skCAsBA,MAAMA,EAAQC,EAAgB,EAAE,EAC1BC,EAASD,EAAI,EAAK,EAClBE,EAAQF,EAAI,EAAE,EACdG,EAAcH,EAAI,EAAK,EACvBI,EAASJ,EAAI,EAAE,EAErB,eAAeK,GAAsB,CACnC,MAAMC,EAAI,MAAMC,EAAI,IAAmB,YAAY,EAEnD,GADAN,EAAO,MAAQ,GACXK,EAAE,SAAW,IAAK,CACpBH,EAAY,MAAQ,GACpB,MACF,CACA,GAAI,CAACG,EAAE,GAAI,CACTJ,EAAM,MAAQM,EAAQF,EAAG,YAAY,EACrC,MACF,CACAJ,EAAM,MAAQ,GACdH,EAAM,MAAQO,EAAE,KAAK,OAAS,CAAA,CAChC,CAEKD,EAAA,EAGAI,EAAM,mBAAwBC,EAAA,EAGnC,MAAMC,EAAQC,EAAS,IAAM,CAC3B,MAAMC,MAAQ,IACd,UAAWC,K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 @@
|
|
|
1
|
-
import{d as t,c as s,G as n,a as o,m as r,t as l,o as c}from"./index-Bygbts8t.js";const d=t({__name:"StateBadge",props:{state:{}},setup(a){return(m,e)=>(c(),s("span",{class:n(["badge",a.state])},[e[0]||(e[0]=o("span",{class:"dot"},null,-1)),r(" "+l(a.state),1)],2))}});export{d as _};
|
|
2
|
-
//# sourceMappingURL=StateBadge.vue_vue_type_script_setup_true_lang-CgDXVhMF.js.map
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import{d as X,r as c,B as I,J as j,c as n,a as t,t as p,m as s,h as v,i as m,_ as A,F as w,f as y,G,g as S,v as N,W as D,H as J,x as M,y as Q,D as E,j as Y,o as a,l as Z,Q as _,P as ee,C as te,V as F}from"./index-Bygbts8t.js";import{a as se,w as oe,p as q,r as le}from"./useVars-VN9gYdR6.js";import{_ as ae}from"./ActionButton.vue_vue_type_script_setup_true_lang-DxV7T6dV.js";import{_ as ne}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js";import{_ as ie}from"./VarEditor.vue_vue_type_script_setup_true_lang-CZcKBdbw.js";const re={class:"page-head"},de={class:"sub"},ue={class:"panel"},pe={class:"dim"},ve={key:0,class:"banner warn"},me={key:0},ye={key:1},fe={key:2},ce={key:3},he={key:2,class:"banner warn"},ke={class:"row",style:{"margin-bottom":"var(--s4)"}},be={class:"field",style:{"max-width":"280px"}},ge={class:"mute",style:{"align-self":"end","padding-bottom":"10px"}},we={key:3,class:"row",style:{"margin-bottom":"var(--s4)"}},Se={class:"check"},xe={class:"check"},Ce={class:"field",style:{"max-width":"340px"}},$e=["value"],Ve={key:0,class:"hint"},Re={key:0},Ae={key:1},Te={key:2},Le={class:"field"},Ue={class:"field",style:{"margin-top":"var(--s3)"}},Ee={class:"hint"},Ie={class:"hint"},Ne={class:"row",style:{"margin-top":"var(--s5)"}},Pe={key:0,class:"s-ok"},We={key:6,class:"banner warn"},je={key:0},De=`version: 1
|
|
2
|
-
kind: isolated
|
|
3
|
-
|
|
4
|
-
# The stack identity: the compose project name, and $STACK inside every hook.
|
|
5
|
-
# \${PR} is interpolated ONCE, at resolve time, from the variables sent with the request.
|
|
6
|
-
stack: pr-\${PR}
|
|
7
|
-
|
|
8
|
-
env:
|
|
9
|
-
PREVIEW_DOMAIN: preview.example.com
|
|
10
|
-
|
|
11
|
-
compose:
|
|
12
|
-
file: compose.yml
|
|
13
|
-
# Every service sits behind a profile so a bare \`up\` starts nothing.
|
|
14
|
-
# \`down\` always enables ALL of them — otherwise the unselected profiles' network leaks.
|
|
15
|
-
profiles: [app]
|
|
16
|
-
|
|
17
|
-
requires:
|
|
18
|
-
- name: traefik-network
|
|
19
|
-
assert: docker network inspect traefik >/dev/null 2>&1
|
|
20
|
-
hint: run \`pstack init\` on the host first
|
|
21
|
-
|
|
22
|
-
axes:
|
|
23
|
-
# Hooks run from the deployment directory, which holds only spec.yml and compose.yml —
|
|
24
|
-
# so use inline shell or absolute paths, never ./hooks/foo.sh.
|
|
25
|
-
- name: scratch
|
|
26
|
-
up: mkdir -p /tmp/$STACK
|
|
27
|
-
assert_live: test -d /tmp/$STACK
|
|
28
|
-
down: rm -rf /tmp/$STACK
|
|
29
|
-
# assert_gone MUST FAIL CLOSED. A bare \`! <probe>\` reports "gone" whenever the probe fails
|
|
30
|
-
# for any reason — a missing CLI, an expired token — turning "I could not tell" into
|
|
31
|
-
# "it is gone", a false negative on the one thing this tool exists to catch.
|
|
32
|
-
assert_gone: |
|
|
33
|
-
test -d /tmp || exit 1
|
|
34
|
-
! test -d /tmp/$STACK
|
|
35
|
-
`,Me=`services:
|
|
36
|
-
app:
|
|
37
|
-
image: nginx:alpine
|
|
38
|
-
profiles: [app]
|
|
39
|
-
labels:
|
|
40
|
-
- traefik.enable=true
|
|
41
|
-
`,ze=X({__name:"SubmitView",props:{id:{}},setup(P){const T=P,l=c({id:T.id??"",spec:"",compose:""}),h=c([{k:"",v:""}]),k=c("inline"),x=c(""),C=c(!1),g=c(""),u=c(null),$=c([]);I.get("/api/specs").then(o=>{o.ok&&Array.isArray(o.body.specs)&&($.value=o.body.specs)});const V=E(()=>$.value.find(o=>o.name===x.value)),L=E(()=>!!T.id),O=Z(),R=E(()=>{const o=O.query.from;return typeof o=="string"&&o?o:null}),f=c("idle"),b=c(null);async function W(o){f.value="loading",b.value=null;const e=await I.getAuthed(`/api/deployments/${encodeURIComponent(o)}/source`);if(e.status===404||!e.ok){f.value="failed";return}if(e.body.sourceWithheld){f.value="withheld",e.body.specName&&(b.value=e.body.specName);return}l.value.spec||(l.value.spec=e.body.spec??""),l.value.compose||(l.value.compose=e.body.compose??""),e.body.specName&&(b.value=e.body.specName),f.value="loaded"}j(R,async o=>{var r;if(!o||T.id)return;g.value="",u.value=null,l.value.spec="",l.value.compose="";const e=(r=F(o))==null?void 0:r.vars;e&&(h.value=q(e)),await W(o),l.value.id=""},{immediate:!0}),j(()=>T.id,o=>{var d;if(g.value="",u.value=null,f.value="idle",b.value=null,!o)return;o!==l.value.id&&(l.value.spec="",l.value.compose=""),l.value.id=o;const e=(d=F(o))==null?void 0:d.vars,r=e?q(e):le(o);r.some(U=>U.k)&&(h.value=r),W(o)},{immediate:!0});const B=E(()=>!!l.value.id&&(k.value==="stored"?!!x.value:!!l.value.spec.trim())&&!C.value);async function K(){C.value=!0,g.value="",u.value=null;const o=l.value.id,e=se(h.value),r={vars:e,env:e};k.value==="stored"?r.specName=x.value:(r.spec=l.value.spec,l.value.compose.trim()&&(r.compose=l.value.compose));const d=await I.put(`/api/deployments/${encodeURIComponent(o)}`,r);if(C.value=!1,d.status===200||d.status===201){u.value={id:d.body.id??o,stack:d.body.stack??"?",created:d.status===201,stackSharedWith:d.body.stackSharedWith},oe(o,h.value),_(),ee("ok",`${d.status===201?"Created":"Replaced"} ${o} → ${u.value.stack}`,{to:`/deployments/${encodeURIComponent(o)}`,toLabel:"Open"});return}g.value=te(d,"save this deployment")}function z(){k.value="inline",l.value.spec=De,l.value.compose.trim()||(l.value.compose=Me),l.value.id||(l.value.id="pr-123"),h.value.some(o=>o.k)||(h.value=[{k:"PR",v:"123"}])}return(o,e)=>{var d,U;const r=Y("RouterLink");return a(),n("div",null,[t("div",re,[t("div",null,[t("h1",null,p(L.value?"Edit a deployment":R.value?"Duplicate a deployment":"Submit a deployment"),1),t("div",de,p(L.value?"Loaded from what is stored; saving replaces the record":R.value?`Copied from ${R.value} — give it a new id, then edit`:"Stores a spec so it can be deployed"),1)]),e[7]||(e[7]=t("span",{class:"grow"},null,-1)),t("button",{class:"ghost",onClick:z},"Load example spec")]),t("section",ue,[t("p",pe,[e[9]||(e[9]=s(" Nothing is saved until the spec is valid. ",-1)),v(A,{label:"what happens on a rejected submission"},{default:m(()=>[...e[8]||(e[8]=[s(" The spec is checked before anything is written, so a rejected submission leaves nothing behind — and a replace never destroys a good record over a typo. Whether the deployment is shared or isolated comes from the spec, not from this form. ",-1)])]),_:1})]),R.value&&!L.value?(a(),n("div",ve,[e[22]||(e[22]=t("b",null,"Change the stack, not just the id.",-1)),t("p",null,[e[13]||(e[13]=s(" Two deployments that resolve to the same ",-1)),e[14]||(e[14]=t("code",null,"stack",-1)),e[15]||(e[15]=s(" drive the same compose project — ",-1)),e[16]||(e[16]=t("code",null,"down",-1)),e[17]||(e[17]=s(" on either stops the other's containers. If the stack interpolates a variable (",-1)),e[18]||(e[18]=t("code",null,"pr-${PR}",-1)),e[19]||(e[19]=s(") give it a different value below; if it is a literal, edit the ",-1)),e[20]||(e[20]=t("code",null,"stack:",-1)),e[21]||(e[21]=s(" line. ",-1)),f.value==="withheld"?(a(),n(w,{key:0},[e[11]||(e[11]=s(" The spec could not be copied without an access token — ",-1)),v(r,{to:"/settings"},{default:m(()=>[...e[10]||(e[10]=[s("add yours",-1)])]),_:1}),e[12]||(e[12]=s(". ",-1))],64)):y("",!0)])])):y("",!0),L.value?(a(),n("div",{key:1,class:G(["banner",f.value==="loaded"?"info":"warn"])},[t("b",null,"Replacing "+p(P.id)+".",1),f.value==="loading"?(a(),n("p",me,"Loading what is stored…")):f.value==="loaded"?(a(),n("p",ye," Loaded from the stored record — edit it and save. Saving replaces the record outright, so anything you delete here stops being tracked while whatever it created keeps running. ")):f.value==="withheld"?(a(),n("p",fe,[e[24]||(e[24]=s(" The stored spec was not loaded: reading it needs an access token, because hooks routinely carry a credential inline. ",-1)),v(r,{to:"/settings"},{default:m(()=>[...e[23]||(e[23]=[s("Add your token",-1)])]),_:1}),e[25]||(e[25]=s(" to edit in place — otherwise paste the ",-1)),e[26]||(e[26]=t("b",null,"complete",-1)),e[27]||(e[27]=s(" spec, since anything you leave out stops being tracked. ",-1))])):(a(),n("p",ce,[...e[28]||(e[28]=[s(" The stored spec could not be loaded, so this form is empty. Paste the ",-1),t("b",null,"complete",-1),s(" spec you want stored — anything you leave out stops being tracked while whatever it created keeps running. ",-1)])]))],2)):y("",!0),b.value?(a(),n("div",he,[t("b",null,"This deployment tracks the stored spec “"+p(b.value)+"”.",1),t("p",null,[e[30]||(e[30]=s(" Saving here writes a private copy and stops it following that spec. To change every deployment using it, edit ",-1)),v(r,{to:`/specs/${encodeURIComponent(b.value)}`},{default:m(()=>[...e[29]||(e[29]=[s("the spec",-1)])]),_:1},8,["to"]),e[31]||(e[31]=s(" instead. ",-1))])])):y("",!0),t("div",ke,[t("div",be,[e[32]||(e[32]=t("label",{for:"did"},"Deployment id",-1)),S(t("input",{id:"did","onUpdate:modelValue":e[0]||(e[0]=i=>l.value.id=i),type:"text",placeholder:"pr-123",spellcheck:"false",autocomplete:"off"},null,512),[[N,l.value.id,void 0,{trim:!0}]])]),t("span",ge,[e[34]||(e[34]=s(" Lower case ",-1)),v(A,{label:"allowed characters in a deployment id"},{default:m(()=>[...e[33]||(e[33]=[s(" Starts with a letter or digit, then letters, digits, dot, dash or underscore. Up to 64 characters — ",-1),t("code",null,"[a-z0-9][a-z0-9._-]{0,63}",-1),s(". ",-1)])]),_:1})])]),$.value.length?(a(),n("div",we,[t("label",Se,[S(t("input",{"onUpdate:modelValue":e[1]||(e[1]=i=>k.value=i),type:"radio",value:"inline"},null,512),[[D,k.value]]),e[35]||(e[35]=s(" inline spec ",-1))]),t("label",xe,[S(t("input",{"onUpdate:modelValue":e[2]||(e[2]=i=>k.value=i),type:"radio",value:"stored"},null,512),[[D,k.value]]),e[36]||(e[36]=s(" reference a stored spec ",-1))])])):y("",!0),k.value==="stored"&&$.value.length?(a(),n(w,{key:4},[t("div",Ce,[e[38]||(e[38]=t("label",{for:"sn"},"Stored spec",-1)),S(t("select",{id:"sn","onUpdate:modelValue":e[3]||(e[3]=i=>x.value=i)},[e[37]||(e[37]=t("option",{value:""},"— choose —",-1)),(a(!0),n(w,null,M($.value,i=>(a(),n("option",{key:i.name,value:i.name},p(i.name)+" ("+p(i.kind)+") ",9,$e))),128))],512),[[J,x.value]])]),V.value?(a(),n("p",Ve,[V.value.description?(a(),n("span",Re,p(V.value.description)+" — ",1)):y("",!0),e[40]||(e[40]=s(" needs ",-1)),V.value.requiredVars.length?(a(),n("b",Ae,p(V.value.requiredVars.join(", ")),1)):(a(),n("span",Te,"no variables")),e[41]||(e[41]=s(". ",-1)),v(A,{label:"why variables are required"},{default:m(()=>[...e[39]||(e[39]=[s(" A missing variable is refused by name. It is never filled in with a blank, which would silently give every deployment the same stack name. ",-1)])]),_:1})])):y("",!0)],64)):(a(),n(w,{key:5},[t("div",Le,[e[42]||(e[42]=t("label",{for:"spec"},"spec.yml",-1)),S(t("textarea",{id:"spec","onUpdate:modelValue":e[4]||(e[4]=i=>l.value.spec=i),rows:"18",spellcheck:"false",placeholder:`version: 1
|
|
42
|
-
kind: isolated
|
|
43
|
-
stack: pr-\${PR}
|
|
44
|
-
axes: []`},null,512),[[N,l.value.spec]])]),t("div",Ue,[e[43]||(e[43]=t("label",{for:"compose"},[s("compose.yml "),t("span",{class:"mute"},"(optional)")],-1)),S(t("textarea",{id:"compose","onUpdate:modelValue":e[5]||(e[5]=i=>l.value.compose=i),rows:"8",spellcheck:"false",placeholder:"Written next to spec.yml, so a compose file named compose.yml resolves"},null,512),[[N,l.value.compose]])]),t("p",Ee,[e[45]||(e[45]=s(" Hooks must be inline shell or an absolute path. ",-1)),v(A,{label:"why a relative script path does not work"},{default:m(()=>[...e[44]||(e[44]=[s(" A deployment directory only ever holds ",-1),t("code",null,"spec.yml",-1),s(" and ",-1),t("code",null,"compose.yml",-1),s(", and hooks run from there — so ",-1),t("code",null,"up: ./hooks/db.sh",-1),s(" has nothing to find. ",-1)])]),_:1})])],64)),e[56]||(e[56]=t("h2",{class:"section",style:{margin:"var(--s5) 0 var(--s3)"}},"Variables",-1)),v(ie,{modelValue:h.value,"onUpdate:modelValue":e[6]||(e[6]=i=>h.value=i)},null,8,["modelValue"]),t("p",Ie,[e[47]||(e[47]=s(" Saved with the deployment, so tearing it down later targets the same stack. ",-1)),v(A,{label:"how variables are remembered"},{default:m(()=>[...e[46]||(e[46]=[s(" They are stored on the server where it supports that, and in this browser either way — so the actions on the deployment page send exactly these values. ",-1)])]),_:1})]),t("div",Ne,[v(ae,{variant:"primary",pending:C.value,disabled:!B.value,onClick:K},{default:m(()=>[s(p(C.value?"submitting…":"Submit"),1)]),_:1},8,["pending","disabled"]),u.value?(a(),n("span",Pe,[s(p(u.value.created?"Created":"Replaced")+" — stack ",1),t("b",null,p(u.value.stack),1),v(r,{to:`/deployments/${encodeURIComponent(u.value.id)}`,style:{"margin-left":"8px"}},{default:m(()=>[...e[48]||(e[48]=[s(" open → ",-1)])]),_:1},8,["to"])])):y("",!0)]),(U=(d=u.value)==null?void 0:d.stackSharedWith)!=null&&U.length?(a(),n("div",We,[t("b",null,"Another deployment already resolves to stack “"+p(u.value.stack)+"”.",1),t("p",null,[(a(!0),n(w,null,M(u.value.stackSharedWith,(i,H)=>(a(),n(w,{key:i},[v(r,{to:`/deployments/${encodeURIComponent(i)}`},{default:m(()=>[s(p(i),1)]),_:2},1032,["to"]),H<u.value.stackSharedWith.length-1?(a(),n("span",je,", ")):y("",!0)],64))),128)),e[49]||(e[49]=s("— both records now drive the same compose project, so ",-1)),e[50]||(e[50]=t("code",null,"down",-1)),e[51]||(e[51]=s(" on either stops the other's containers and ",-1)),e[52]||(e[52]=t("code",null,"verify",-1)),e[53]||(e[53]=s(" on either reports the other's leaks. If that was not intended, change this one's ",-1)),e[54]||(e[54]=t("code",null,"stack",-1)),e[55]||(e[55]=s(" and save again. ",-1))])])):y("",!0),g.value?(a(),Q(ne,{key:7,text:g.value,title:"The server rejected this submission."},null,8,["text"])):y("",!0)])])}}});export{ze as default};
|
|
45
|
-
//# sourceMappingURL=SubmitView-CwdWrsVS.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitView-CwdWrsVS.js","sources":["../../src/views/SubmitView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Submit or replace a deployment.\n *\n * The server's 400 is the whole point of this screen. It carries the SpecError verbatim — the key\n * or variable that is wrong, often the corrected form, and the assert-lint warnings about an\n * `assert_gone` that fails open. That text is the tool's main teaching surface, so it is rendered\n * whole, with newlines intact, and never summarised.\n *\n * The spec is parsed BEFORE anything touches disk, so a rejected submission leaves nothing behind\n * and, on a replace, a good record is never destroyed over a typo.\n */\nimport { computed, ref, watch } from 'vue';\nimport { useRoute } from 'vue-router';\nimport { api, problem } from '../api/client';\nimport InfoHint from '../components/InfoHint.vue';\nimport type {\n DeploymentSourceResponse,\n SpecMeta,\n SpecsResponse,\n SubmitResponse,\n VarPair,\n} from '../api/types';\nimport { loadDeployments, rowFor } from '../composables/useControlPlane';\nimport { pairsFromRecord, readVars, recordFromPairs, writeVars } from '../composables/useVars';\nimport { toast } from '../composables/useToasts';\nimport ActionButton from '../components/ActionButton.vue';\nimport ErrorNote from '../components/ErrorNote.vue';\nimport VarEditor from '../components/VarEditor.vue';\n\nconst props = defineProps<{ id?: string }>();\n\nconst form = ref({ id: props.id ?? '', spec: '', compose: '' });\nconst vars = ref<VarPair[]>([{ k: '', v: '' }]);\nconst source = ref<'inline' | 'stored'>('inline');\nconst specName = ref('');\n\nconst submitting = ref(false);\nconst error = ref('');\nconst result = ref<{\n id: string;\n stack: string;\n created: boolean;\n /** Other deployments resolving to the same stack — reported by the server on a new deployment. */\n stackSharedWith?: string[];\n} | null>(null);\n\n/**\n * Stored specs, when this server has them. A build without `/api/specs` answers 404, which is not\n * an error here — the picker simply is not offered and inline stays the only shape.\n */\nconst specs = ref<SpecMeta[]>([]);\nvoid api.get<SpecsResponse>('/api/specs').then((r) => {\n if (r.ok && Array.isArray(r.body.specs)) specs.value = r.body.specs;\n});\n\nconst chosenSpec = computed(() => specs.value.find((s) => s.name === specName.value));\n\nconst replacing = computed(() => !!props.id);\n\n/**\n * Duplicate mode: `/submit?from=<id>` copies an existing deployment's spec, compose and variables into\n * a NEW submission. Distinct from replacing — the id starts empty so you name the new one, and nothing\n * is written over.\n *\n * The `stack:` line is the thing to watch, which is why the banner says so: copy a spec whose stack is a\n * literal and both deployments drive the same compose project, so `down` on either stops the other's\n * containers. A spec whose stack interpolates a variable (`pr-${PR}`) just needs a different value. The\n * server independently reports a collision at submit time — see `stackSharedWith`.\n */\nconst route = useRoute();\nconst copyFrom = computed(() => {\n const v = route.query.from;\n return typeof v === 'string' && v ? v : null;\n});\n\n/**\n * Replacing now PRE-FILLS from what is stored.\n *\n * It used to start empty, because nothing could hand the source back. Replacing is whole-record, so\n * an operator retyping a spec from memory silently dropped whatever they forgot — and a dropped axis\n * stops being tracked while the resources it created keep running. Being unable to read your own\n * submission is what made that a likely mistake rather than a careless one.\n *\n * The body is still cleared FIRST, on every id change. A leftover body from another deployment is the\n * dangerous case: it is perfectly valid YAML, so the PUT would succeed and overwrite the wrong\n * deployment with nothing able to catch it. Clearing first means a failed or withheld fetch leaves the\n * form empty rather than holding someone else's spec.\n */\nconst sourceState = ref<'idle' | 'loading' | 'loaded' | 'withheld' | 'failed'>('idle');\n/** Set when this deployment tracks a stored spec — editing this copy forks it from the original. */\nconst forkWarning = ref<string | null>(null);\n\nasync function loadSource(id: string): Promise<void> {\n sourceState.value = 'loading';\n forkWarning.value = null;\n const r = await api.getAuthed<DeploymentSourceResponse>(\n `/api/deployments/${encodeURIComponent(id)}/source`,\n );\n // A build of the API without the route answers 404; that is a capability difference, not an error,\n // and it must land on the old empty-form behaviour rather than an alarming banner.\n if (r.status === 404 || !r.ok) {\n sourceState.value = 'failed';\n return;\n }\n if (r.body.sourceWithheld) {\n sourceState.value = 'withheld';\n if (r.body.specName) forkWarning.value = r.body.specName;\n return;\n }\n // Only fill if the user has not started typing — a slow fetch must never overwrite their edit.\n if (!form.value.spec) form.value.spec = r.body.spec ?? '';\n if (!form.value.compose) form.value.compose = r.body.compose ?? '';\n if (r.body.specName) forkWarning.value = r.body.specName;\n sourceState.value = 'loaded';\n}\n\n// Duplicate: same fetch, but the id stays empty and the variables come across too, since a copied\n// spec interpolates the same names.\nwatch(\n copyFrom,\n async (from) => {\n if (!from || props.id) return;\n error.value = '';\n result.value = null;\n form.value.spec = '';\n form.value.compose = '';\n const saved = rowFor(from)?.vars;\n if (saved) vars.value = pairsFromRecord(saved);\n await loadSource(from);\n // A copied record's own id is not a name for the new one; the operator picks that.\n form.value.id = '';\n },\n { immediate: true },\n);\n\nwatch(\n () => props.id,\n (id) => {\n error.value = '';\n result.value = null;\n sourceState.value = 'idle';\n forkWarning.value = null;\n if (!id) return;\n if (id !== form.value.id) {\n form.value.spec = '';\n form.value.compose = '';\n }\n form.value.id = id;\n // Seed the variables from what this deployment already uses: replacing a spec usually needs\n // the same ones that resolved it.\n const stored = rowFor(id)?.vars;\n const saved = stored ? pairsFromRecord(stored) : readVars(id);\n if (saved.some((e) => e.k)) vars.value = saved;\n void loadSource(id);\n },\n { immediate: true },\n);\n\nconst canSubmit = computed(\n () =>\n !!form.value.id &&\n (source.value === 'stored' ? !!specName.value : !!form.value.spec.trim()) &&\n !submitting.value,\n);\n\nasync function submit(): Promise<void> {\n submitting.value = true;\n error.value = '';\n result.value = null;\n\n const id = form.value.id;\n const record = recordFromPairs(vars.value);\n /**\n * `vars` are STORED with the deployment on servers that support it, which makes a later `down`\n * resolve the same stack `up` created with no query parameters at all. `env` validates this\n * submission on every server, new or old. Sending both is what keeps this form working against\n * either build — an older server ignores the key it does not know.\n */\n const body: Record<string, unknown> = { vars: record, env: record };\n if (source.value === 'stored') body.specName = specName.value;\n else {\n body.spec = form.value.spec;\n if (form.value.compose.trim()) body.compose = form.value.compose;\n }\n\n const r = await api.put<SubmitResponse>(`/api/deployments/${encodeURIComponent(id)}`, body);\n submitting.value = false;\n\n if (r.status === 200 || r.status === 201) {\n result.value = {\n id: r.body.id ?? id,\n stack: r.body.stack ?? '?',\n created: r.status === 201,\n stackSharedWith: r.body.stackSharedWith,\n };\n // Persist the variables that just validated this spec. On an older server this is the single\n // thing keeping a later `down` pointed at the stack the `up` created.\n writeVars(id, vars.value);\n void loadDeployments();\n toast('ok', `${r.status === 201 ? 'Created' : 'Replaced'} ${id} → ${result.value.stack}`, {\n to: `/deployments/${encodeURIComponent(id)}`,\n toLabel: 'Open',\n });\n return;\n }\n // 400 (SpecError), 409 (a job in flight over this stack), 401, 404 — all rendered verbatim.\n error.value = problem(r, 'save this deployment');\n}\n\nconst EXAMPLE_SPEC = `version: 1\nkind: isolated\n\n# The stack identity: the compose project name, and $STACK inside every hook.\n# \\${PR} is interpolated ONCE, at resolve time, from the variables sent with the request.\nstack: pr-\\${PR}\n\nenv:\n PREVIEW_DOMAIN: preview.example.com\n\ncompose:\n file: compose.yml\n # Every service sits behind a profile so a bare \\`up\\` starts nothing.\n # \\`down\\` always enables ALL of them — otherwise the unselected profiles' network leaks.\n profiles: [app]\n\nrequires:\n - name: traefik-network\n assert: docker network inspect traefik >/dev/null 2>&1\n hint: run \\`pstack init\\` on the host first\n\naxes:\n # Hooks run from the deployment directory, which holds only spec.yml and compose.yml —\n # so use inline shell or absolute paths, never ./hooks/foo.sh.\n - name: scratch\n up: mkdir -p /tmp/$STACK\n assert_live: test -d /tmp/$STACK\n down: rm -rf /tmp/$STACK\n # assert_gone MUST FAIL CLOSED. A bare \\`! <probe>\\` reports \"gone\" whenever the probe fails\n # for any reason — a missing CLI, an expired token — turning \"I could not tell\" into\n # \"it is gone\", a false negative on the one thing this tool exists to catch.\n assert_gone: |\n test -d /tmp || exit 1\n ! test -d /tmp/$STACK\n`;\n\nconst EXAMPLE_COMPOSE = `services:\n app:\n image: nginx:alpine\n profiles: [app]\n labels:\n - traefik.enable=true\n`;\n\nfunction loadExample(): void {\n source.value = 'inline';\n form.value.spec = EXAMPLE_SPEC;\n if (!form.value.compose.trim()) form.value.compose = EXAMPLE_COMPOSE;\n if (!form.value.id) form.value.id = 'pr-123';\n if (!vars.value.some((e) => e.k)) vars.value = [{ k: 'PR', v: '123' }];\n}\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>\n {{ replacing ? 'Edit a deployment' : copyFrom ? 'Duplicate a deployment' : 'Submit a deployment' }}\n </h1>\n <div class=\"sub\">\n {{\n replacing\n ? 'Loaded from what is stored; saving replaces the record'\n : copyFrom\n ? `Copied from ${copyFrom} — give it a new id, then edit`\n : 'Stores a spec so it can be deployed'\n }}\n </div>\n </div>\n <span class=\"grow\" />\n <button class=\"ghost\" @click=\"loadExample\">Load example spec</button>\n </div>\n\n <section class=\"panel\">\n <p class=\"dim\">\n Nothing is saved until the spec is valid.\n <InfoHint label=\"what happens on a rejected submission\">\n The spec is checked before anything is written, so a rejected submission leaves nothing\n behind — and a replace never destroys a good record over a typo. Whether the deployment is\n shared or isolated comes from the spec, not from this form.\n </InfoHint>\n </p>\n\n <!--\n A `PUT` REPLACES the whole record, and this form cannot pre-fill it: the API has no route\n that returns a stored spec. Say that out loud, because a half-remembered spec pasted here\n is still valid YAML — the server will accept it, and the axes the original declared simply\n stop existing as far as the control plane knows, while whatever they created keeps running.\n -->\n <!--\n The one thing that makes duplicating dangerous, said before the form rather than after the\n submission: two records resolving to one stack drive the same compose project.\n -->\n <div v-if=\"copyFrom && !replacing\" class=\"banner warn\">\n <b>Change the stack, not just the id.</b>\n <p>\n Two deployments that resolve to the same <code>stack</code> drive the same compose project —\n <code>down</code> on either stops the other's containers. If the stack interpolates a variable\n (<code>pr-${PR}</code>) give it a different value below; if it is a literal, edit the\n <code>stack:</code> line.\n <template v-if=\"sourceState === 'withheld'\">\n The spec could not be copied without an access token —\n <RouterLink to=\"/settings\">add yours</RouterLink>.\n </template>\n </p>\n </div>\n\n <div v-if=\"replacing\" class=\"banner\" :class=\"sourceState === 'loaded' ? 'info' : 'warn'\">\n <b>Replacing {{ id }}.</b>\n <p v-if=\"sourceState === 'loading'\">Loading what is stored…</p>\n <p v-else-if=\"sourceState === 'loaded'\">\n Loaded from the stored record — edit it and save. Saving replaces the record outright, so\n anything you delete here stops being tracked while whatever it created keeps running.\n </p>\n <p v-else-if=\"sourceState === 'withheld'\">\n The stored spec was not loaded: reading it needs an access token, because hooks routinely\n carry a credential inline. <RouterLink to=\"/settings\">Add your token</RouterLink> to edit\n in place — otherwise paste the <b>complete</b> spec, since anything you leave out stops\n being tracked.\n </p>\n <p v-else>\n The stored spec could not be loaded, so this form is empty. Paste the <b>complete</b> spec\n you want stored — anything you leave out stops being tracked while whatever it created keeps\n running.\n </p>\n </div>\n\n <!--\n A deployment that references a stored spec keeps its own copy of the source. Editing that copy\n forks it: the stored spec every other deployment shares is untouched, and this one stops\n following it. Silent forks are the kind of thing discovered months later.\n -->\n <div v-if=\"forkWarning\" class=\"banner warn\">\n <b>This deployment tracks the stored spec “{{ forkWarning }}”.</b>\n <p>\n Saving here writes a private copy and stops it following that spec. To change every\n deployment using it, edit\n <RouterLink :to=\"`/specs/${encodeURIComponent(forkWarning)}`\">the spec</RouterLink> instead.\n </p>\n </div>\n\n <div class=\"row\" style=\"margin-bottom: var(--s4)\">\n <div class=\"field\" style=\"max-width: 280px\">\n <label for=\"did\">Deployment id</label>\n <input\n id=\"did\"\n v-model.trim=\"form.id\"\n type=\"text\"\n placeholder=\"pr-123\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n />\n </div>\n <span class=\"mute\" style=\"align-self: end; padding-bottom: 10px\">\n Lower case\n <InfoHint label=\"allowed characters in a deployment id\">\n Starts with a letter or digit, then letters, digits, dot, dash or underscore. Up to 64\n characters — <code>[a-z0-9][a-z0-9._-]{0,63}</code>.\n </InfoHint>\n </span>\n </div>\n\n <!-- Offered only when this server actually has stored specs. -->\n <div v-if=\"specs.length\" class=\"row\" style=\"margin-bottom: var(--s4)\">\n <label class=\"check\">\n <input v-model=\"source\" type=\"radio\" value=\"inline\" /> inline spec\n </label>\n <label class=\"check\">\n <input v-model=\"source\" type=\"radio\" value=\"stored\" /> reference a stored spec\n </label>\n </div>\n\n <template v-if=\"source === 'stored' && specs.length\">\n <div class=\"field\" style=\"max-width: 340px\">\n <label for=\"sn\">Stored spec</label>\n <select id=\"sn\" v-model=\"specName\">\n <option value=\"\">— choose —</option>\n <option v-for=\"s in specs\" :key=\"s.name\" :value=\"s.name\">\n {{ s.name }} ({{ s.kind }})\n </option>\n </select>\n </div>\n <p v-if=\"chosenSpec\" class=\"hint\">\n <span v-if=\"chosenSpec.description\">{{ chosenSpec.description }} — </span>\n needs\n <b v-if=\"chosenSpec.requiredVars.length\">{{ chosenSpec.requiredVars.join(', ') }}</b>\n <span v-else>no variables</span>.\n <InfoHint label=\"why variables are required\">\n A missing variable is refused by name. It is never filled in with a blank, which would\n silently give every deployment the same stack name.\n </InfoHint>\n </p>\n </template>\n\n <template v-else>\n <div class=\"field\">\n <label for=\"spec\">spec.yml</label>\n <textarea\n id=\"spec\"\n v-model=\"form.spec\"\n rows=\"18\"\n spellcheck=\"false\"\n placeholder=\"version: 1 kind: isolated stack: pr-${PR} axes: []\"\n />\n </div>\n\n <div class=\"field\" style=\"margin-top: var(--s3)\">\n <label for=\"compose\">compose.yml <span class=\"mute\">(optional)</span></label>\n <textarea\n id=\"compose\"\n v-model=\"form.compose\"\n rows=\"8\"\n spellcheck=\"false\"\n placeholder=\"Written next to spec.yml, so a compose file named compose.yml resolves\"\n />\n </div>\n <p class=\"hint\">\n Hooks must be inline shell or an absolute path.\n <InfoHint label=\"why a relative script path does not work\">\n A deployment directory only ever holds <code>spec.yml</code> and\n <code>compose.yml</code>, and hooks run from there — so\n <code>up: ./hooks/db.sh</code> has nothing to find.\n </InfoHint>\n </p>\n </template>\n\n <h2 class=\"section\" style=\"margin: var(--s5) 0 var(--s3)\">Variables</h2>\n <VarEditor v-model=\"vars\" />\n <p class=\"hint\">\n Saved with the deployment, so tearing it down later targets the same stack.\n <InfoHint label=\"how variables are remembered\">\n They are stored on the server where it supports that, and in this browser either way — so\n the actions on the deployment page send exactly these values.\n </InfoHint>\n </p>\n\n <div class=\"row\" style=\"margin-top: var(--s5)\">\n <ActionButton variant=\"primary\" :pending=\"submitting\" :disabled=\"!canSubmit\" @click=\"submit\">\n {{ submitting ? 'submitting…' : 'Submit' }}\n </ActionButton>\n <span v-if=\"result\" class=\"s-ok\">\n {{ result.created ? 'Created' : 'Replaced' }} — stack\n <b>{{ result.stack }}</b>\n <RouterLink :to=\"`/deployments/${encodeURIComponent(result.id)}`\" style=\"margin-left: 8px\">\n open →\n </RouterLink>\n </span>\n </div>\n\n <!--\n The server's rejection text IS the documentation: it names the key, the variable or the\n assert that is wrong, and often prints the corrected form. Rendered whole, newlines and\n indentation intact. Never truncate it, never collapse it, never say \"invalid spec\".\n -->\n <!--\n Reported by the server, which resolved every other deployment to check. Shown after the fact\n because it can only be known once the spec has resolved — and it is a warning, not a rejection:\n it can be deliberate, and refusing over a guess would be worse than saying so.\n -->\n <div v-if=\"result?.stackSharedWith?.length\" class=\"banner warn\">\n <b>Another deployment already resolves to stack “{{ result.stack }}”.</b>\n <p>\n <template v-for=\"(o, i) in result.stackSharedWith\" :key=\"o\">\n <RouterLink :to=\"`/deployments/${encodeURIComponent(o)}`\">{{ o }}</RouterLink\n ><span v-if=\"i < result.stackSharedWith.length - 1\">, </span> </template\n >— both records now drive the same compose project, so <code>down</code> on either stops the\n other's containers and <code>verify</code> on either reports the other's leaks. If that was not\n intended, change this one's <code>stack</code> and save again.\n </p>\n </div>\n\n <ErrorNote v-if=\"error\" :text=\"error\" title=\"The server rejected this submission.\" />\n </section>\n </div>\n</template>\n"],"names":["EXAMPLE_SPEC","EXAMPLE_COMPOSE","props","__props","form","ref","vars","source","specName","submitting","error","result","specs","api","r","chosenSpec","computed","s","replacing","route","useRoute","copyFrom","v","sourceState","forkWarning","loadSource","id","watch","from","saved","_a","rowFor","pairsFromRecord","stored","readVars","e","canSubmit","submit","record","recordFromPairs","body","writeVars","loadDeployments","toast","problem","loadExample","_createElementBlock","_createElementVNode","_hoisted_1","_toDisplayString","_hoisted_2","_hoisted_3","_hoisted_4","_createVNode","InfoHint","_cache","_openBlock","_hoisted_5","_Fragment","_component_RouterLink","_normalizeClass","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","$event","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","_hoisted_17","_renderList","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_23","_vModelText","_hoisted_24","_hoisted_25","VarEditor","_hoisted_26","_hoisted_27","ActionButton","_hoisted_28","_b","_hoisted_29","o","i","_createBlock","ErrorNote"],"mappings":"ozCAkNMA,GAAe;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAoCfC,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mDAxNxB,MAAMC,EAAQC,EAERC,EAAOC,EAAI,CAAE,GAAIH,EAAM,IAAM,GAAI,KAAM,GAAI,QAAS,EAAA,CAAI,EACxDI,EAAOD,EAAe,CAAC,CAAE,EAAG,GAAI,EAAG,EAAA,CAAI,CAAC,EACxCE,EAASF,EAAyB,QAAQ,EAC1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M,J as $,M as q,c as r,a as n,m as a,h as W,i as J,_ as Y,y as j,f as h,g as A,H as B,F as T,x as D,t as y,r as v,D as O,B as G,C as K,N as E,O as S,o as i,l as Q}from"./index-Bygbts8t.js";import{_ as X}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BlepSrj0.js";import{_ as Z}from"./_plugin-vue_export-helper-DlAUqK2U.js";const ee={class:"stack"},ne={class:"banner warn"},oe={class:"row wrap",style:{gap:"var(--s3)","align-items":"end"}},te={class:"field"},se=["disabled"],le=["value"],ae={class:"field"},ie=["disabled"],re=["value"],ue=["disabled"],de={key:2,class:"badge ok"},ce={key:1,class:"hint"},ve={key:2,class:"hint"},pe=["data-state"],me=M({__name:"TerminalTab",setup(fe){const P=Q(),k=O(()=>String(P.params.id)),U=["sh","bash","ash","zsh","fish"],R=v(null),m=v(""),c=v(""),w=v("sh"),t=v("idle"),f=v(""),p=v(null),_=S(null),I=S(null),g=S(null);let u=null;const C=O(()=>{var s;return((s=R.value)==null?void 0:s.containers.filter(e=>e.state==="running"))??[]});async function x(){var e;const s=await G.get(`/api/deployments/${encodeURIComponent(k.value)}/runtime`);if(!s.ok){m.value=K(s,"list this deployment's containers");return}m.value="",R.value=s.body,c.value||(c.value=((e=C.value[0])==null?void 0:e.name)??"")}x();async function F(){var N;if(t.value==="connecting"||t.value==="open")return;f.value="",t.value="connecting";const[{Terminal:s},{FitAddon:e}]=await Promise.all([E(()=>import("./xterm-D6Mng-DB.js").then(l=>l.x),__vite__mapDeps([0,1])),E(()=>import("./addon-fit-CevVMrUA.js").then(l=>l.a),__vite__mapDeps([2,1]))]);await E(()=>Promise.resolve({}),__vite__mapDeps([3])),(N=_.value)==null||N.dispose();const o=new s({convertEol:!0,fontSize:13,fontFamily:"var(--font-mono, ui-monospace, monospace)",cursorBlink:!0,theme:{background:"#0b0e14"}}),b=new e;o.loadAddon(b),p.value&&(p.value.innerHTML="",o.open(p.value),b.fit()),_.value=o,I.value=b,u==null||u.disconnect(),u=new ResizeObserver(()=>{try{b.fit()}catch{}}),p.value&&u.observe(p.value);const z=location.protocol==="https:"?"wss":"ws",H=new URLSearchParams({container:c.value,shell:w.value}),d=new WebSocket(`${z}://${location.host}/api/deployments/${encodeURIComponent(k.value)}/terminal?${H}`);d.binaryType="arraybuffer",g.value=d,d.onopen=()=>{t.value="open",o.focus()},d.onmessage=l=>o.write(typeof l.data=="string"?l.data:new Uint8Array(l.data)),d.onclose=l=>{t.value="closed",f.value=l.reason||(l.code===1006?"the connection dropped (the upgrade may have been refused)":`code ${l.code}`)},d.onerror=()=>{t.value==="connecting"&&(f.value="could not open the connection")},o.onData(l=>{d.readyState===WebSocket.OPEN&&d.send(l)})}function V(){var s;(s=g.value)==null||s.close(1e3,"closed by the operator")}function L(){var s,e;u==null||u.disconnect(),u=null,(s=g.value)==null||s.close(),g.value=null,(e=_.value)==null||e.dispose(),_.value=null}return $([c,w],()=>{(t.value==="open"||t.value==="connecting")&&V()}),$(k,()=>{L(),t.value="idle",x()}),q(L),(s,e)=>(i(),r("section",ee,[n("div",ne,[e[3]||(e[3]=n("b",null,"No TTY.",-1)),e[4]||(e[4]=a(" The shell runs without a terminal device, so there is no prompt, no ",-1)),e[5]||(e[5]=n("code",null,"Ctrl-C",-1)),e[6]||(e[6]=a(", and no full-screen programs (",-1)),e[7]||(e[7]=n("code",null,"top",-1)),e[8]||(e[8]=a(", ",-1)),e[9]||(e[9]=n("code",null,"vim",-1)),e[10]||(e[10]=a("). Type a command and press Enter. ",-1)),W(Y,{label:"why"},{default:J(()=>[...e[2]||(e[2]=[a(" A pseudo-terminal needs a wrapper (",-1),n("code",null,"script",-1),a(") whose flags differ across distributions, and it was never verified on a real host — so pstack ships the half it can stand behind. Everything an operator usually opens a shell for (",-1),n("code",null,"ls",-1),a(", ",-1),n("code",null,"cat",-1),a(", ",-1),n("code",null,"env",-1),a(", ",-1),n("code",null,"psql",-1),a(", a migration) works. ",-1)])]),_:1})]),m.value?(i(),j(X,{key:0,text:m.value,title:"Could not list this deployment's containers."},null,8,["text"])):h("",!0),n("div",oe,[n("label",te,[e[11]||(e[11]=n("span",null,"Container",-1)),A(n("select",{"onUpdate:modelValue":e[0]||(e[0]=o=>c.value=o),disabled:t.value==="open"||t.value==="connecting"},[(i(!0),r(T,null,D(C.value,o=>(i(),r("option",{key:o.id,value:o.name},[a(y(o.name),1),o.service?(i(),r(T,{key:0},[a(" — "+y(o.service),1)],64)):h("",!0)],8,le))),128))],8,se),[[B,c.value]])]),n("label",ae,[e[12]||(e[12]=n("span",null,"Shell",-1)),A(n("select",{"onUpdate:modelValue":e[1]||(e[1]=o=>w.value=o),disabled:t.value==="open"||t.value==="connecting"},[(i(),r(T,null,D(U,o=>n("option",{key:o,value:o},y(o),9,re)),64))],8,ie),[[B,w.value]])]),t.value!=="open"?(i(),r("button",{key:0,class:"primary",disabled:!c.value||t.value==="connecting",onClick:F},y(t.value==="connecting"?"Connecting…":"Open shell"),9,ue)):(i(),r("button",{key:1,onClick:V},"Close shell")),e[14]||(e[14]=n("span",{class:"grow"},null,-1)),t.value==="open"?(i(),r("span",de,[...e[13]||(e[13]=[n("span",{class:"dot pulse"},null,-1),a("connected",-1)])])):h("",!0)]),!C.value.length&&!m.value?(i(),r("p",ce," Nothing is running for this deployment, so there is nothing to open a shell in. ")):h("",!0),t.value==="closed"&&f.value?(i(),r("p",ve,"Session ended — "+y(f.value)+".",1)):h("",!0),n("div",{ref_key:"host",ref:p,class:"terminal-host","data-state":t.value},null,8,pe),e[15]||(e[15]=n("p",{class:"hint"}," Every session is recorded — who, which container, when — and the record is written when the shell opens, so a session that dies with the process still leaves one. ",-1))]))}}),_e=Z(me,[["__scopeId","data-v-3c081c5e"]]);export{_e as default};
|
|
3
|
-
//# sourceMappingURL=TerminalTab-C6gRXura.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"mappings":";4rBAyBA,MAAMA,EAAQC,EAAA,EACRC,EAAKC,EAAS,IAAM,OAAOH,EAAM,OAAO,EAAE,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M,gBAAiB,aAAYF,EAAA,kBAEnDqC,EAAA,MAAAA,EAAA,IAAAF,EAGI,KAHD,MAAM,QAAO,uKAGhB","names":["route","useRoute","id","computed","SHELLS","rt","ref","loadError","container","shell","state","closeReason","host","term","shallowRef","fit","socket","observer","running","_a","c","loadContainers","r","api","problem","connect","Terminal","FitAddon","__vitePreload","n","t","f","proto","qs","ws","e","d","disconnect","teardown","_b","watch","onBeforeUnmount","_openBlock","_createElementBlock","_hoisted_1","_createElementVNode","_hoisted_2","_cache","_createVNode","InfoHint","_createBlock","ErrorNote","_hoisted_3","_hoisted_4","$event","_Fragment","_renderList","_createTextVNode","_toDisplayString","_hoisted_7","s","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","_hoisted_13"],"ignoreList":[],"sources":["../../src/views/tabs/TerminalTab.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * A shell inside one of this deployment's containers.\n *\n * THE SERVER DECIDES WHICH CONTAINER. This picker is filled from `/runtime`, i.e. the containers the\n * deployment actually owns, and the server checks the name again on upgrade — a hand-typed\n * `?container=pstack-control` is a 404 there, not here. The picker is a convenience, never the\n * boundary.\n *\n * THE COOKIE IS THE CREDENTIAL. A browser cannot set an `Authorization` header on a WebSocket, which\n * is exactly why sessions are cookies (0.10.0) — the handshake is a same-origin GET and carries the\n * session automatically. There is no token in this URL and there must never be one: a URL lands in\n * proxy logs and browser history.\n *\n * NO PTY. The server runs `docker exec -i`, not `-it`, so there is no prompt, no ^C and no `top`.\n * That is stated on the page rather than left for the operator to discover as \"the terminal is\n * broken\" — see the banner below and the comment at the head of `terminal.ts`.\n */\nimport { computed, onBeforeUnmount, ref, shallowRef, watch } from 'vue';\nimport { useRoute } from 'vue-router';\nimport { api, problem } from '../../api/client';\nimport type { RuntimeResponse } from '../../api/types';\nimport ErrorNote from '../../components/ErrorNote.vue';\nimport InfoHint from '../../components/InfoHint.vue';\n\nconst route = useRoute();\nconst id = computed(() => String(route.params.id));\n\nconst SHELLS = ['sh', 'bash', 'ash', 'zsh', 'fish'];\n\nconst rt = ref<RuntimeResponse | null>(null);\nconst loadError = ref('');\nconst container = ref('');\nconst shell = ref('sh');\nconst state = ref<'idle' | 'connecting' | 'open' | 'closed'>('idle');\nconst closeReason = ref('');\n\nconst host = ref<HTMLDivElement | null>(null);\n/** shallowRef: xterm's Terminal is a large mutable object and must not be made reactive. */\nconst term = shallowRef<import('@xterm/xterm').Terminal | null>(null);\nconst fit = shallowRef<import('@xterm/addon-fit').FitAddon | null>(null);\nconst socket = shallowRef<WebSocket | null>(null);\nlet observer: ResizeObserver | null = null;\n\nconst running = computed(() => rt.value?.containers.filter((c) => c.state === 'running') ?? []);\n\nasync function loadContainers() {\n const r = await api.get<RuntimeResponse>(\n `/api/deployments/${encodeURIComponent(id.value)}/runtime`,\n );\n if (!r.ok) {\n loadError.value = problem(r, \"list this deployment's containers\");\n return;\n }\n loadError.value = '';\n rt.value = r.body;\n if (!container.value) container.value = running.value[0]?.name ?? '';\n}\nvoid loadContainers();\n\nasync function connect() {\n if (state.value === 'connecting' || state.value === 'open') return;\n closeReason.value = '';\n state.value = 'connecting';\n\n // Loaded on demand, not in the app shell: xterm is ~250KB and only this tab needs it.\n const [{ Terminal }, { FitAddon }] = await Promise.all([\n import('@xterm/xterm'),\n import('@xterm/addon-fit'),\n ]);\n await import('@xterm/xterm/css/xterm.css');\n\n term.value?.dispose();\n const t = new Terminal({\n // The OUTPUT half of the line discipline the missing pty would have provided. A real terminal\n // converts NL to CR-NL on the way out (ONLCR); without it every `\\n` moves DOWN a row without\n // returning the carriage, and `ls` renders as a staircase marching off the right edge. The input\n // half — CR to NL — is done server-side; see `crToNl` in api.ts.\n convertEol: true,\n fontSize: 13,\n fontFamily: 'var(--font-mono, ui-monospace, monospace)',\n cursorBlink: true,\n theme: { background: '#0b0e14' },\n });\n const f = new FitAddon();\n t.loadAddon(f);\n if (host.value) {\n host.value.innerHTML = '';\n t.open(host.value);\n f.fit();\n }\n term.value = t;\n fit.value = f;\n\n observer?.disconnect();\n observer = new ResizeObserver(() => {\n try {\n f.fit();\n } catch {\n /* the element is detached mid-transition */\n }\n });\n if (host.value) observer.observe(host.value);\n\n const proto = location.protocol === 'https:' ? 'wss' : 'ws';\n const qs = new URLSearchParams({ container: container.value, shell: shell.value });\n const ws = new WebSocket(\n `${proto}://${location.host}/api/deployments/${encodeURIComponent(id.value)}/terminal?${qs}`,\n );\n ws.binaryType = 'arraybuffer';\n socket.value = ws;\n\n ws.onopen = () => {\n state.value = 'open';\n t.focus();\n };\n // Bytes, not text: decoding per frame would corrupt a multi-byte character split across two\n // reads. xterm takes a Uint8Array and handles the boundary itself.\n ws.onmessage = (e) =>\n t.write(typeof e.data === 'string' ? e.data : new Uint8Array(e.data as ArrayBuffer));\n ws.onclose = (e) => {\n state.value = 'closed';\n // A close CODE alone tells an operator nothing. 1006 in particular is the browser's \"it just\n // went away\", which here almost always means the upgrade was refused.\n closeReason.value =\n e.reason || (e.code === 1006 ? 'the connection dropped (the upgrade may have been refused)' : `code ${e.code}`);\n };\n ws.onerror = () => {\n if (state.value === 'connecting') closeReason.value = 'could not open the connection';\n };\n t.onData((d) => {\n if (ws.readyState === WebSocket.OPEN) ws.send(d);\n });\n}\n\nfunction disconnect() {\n socket.value?.close(1000, 'closed by the operator');\n}\n\nfunction teardown() {\n observer?.disconnect();\n observer = null;\n socket.value?.close();\n socket.value = null;\n term.value?.dispose();\n term.value = null;\n}\n\n// Switching container or shell must not leave the old shell running against a dead view.\nwatch([container, shell], () => {\n if (state.value === 'open' || state.value === 'connecting') disconnect();\n});\nwatch(id, () => {\n teardown();\n state.value = 'idle';\n void loadContainers();\n});\nonBeforeUnmount(teardown);\n</script>\n\n<template>\n <section class=\"stack\">\n <div class=\"banner warn\">\n <b>No TTY.</b> The shell runs without a terminal device, so there is no prompt, no\n <code>Ctrl-C</code>, and no full-screen programs (<code>top</code>, <code>vim</code>). Type a\n command and press Enter.\n <InfoHint label=\"why\">\n A pseudo-terminal needs a wrapper (<code>script</code>) whose flags differ across\n distributions, and it was never verified on a real host — so pstack ships the half it can\n stand behind. Everything an operator usually opens a shell for (<code>ls</code>,\n <code>cat</code>, <code>env</code>, <code>psql</code>, a migration) works.\n </InfoHint>\n </div>\n\n <ErrorNote v-if=\"loadError\" :text=\"loadError\" title=\"Could not list this deployment's containers.\" />\n\n <div class=\"row wrap\" style=\"gap: var(--s3); align-items: end\">\n <label class=\"field\">\n <span>Container</span>\n <select v-model=\"container\" :disabled=\"state === 'open' || state === 'connecting'\">\n <option v-for=\"c in running\" :key=\"c.id\" :value=\"c.name\">\n {{ c.name }}<template v-if=\"c.service\"> — {{ c.service }}</template>\n </option>\n </select>\n </label>\n <label class=\"field\">\n <span>Shell</span>\n <select v-model=\"shell\" :disabled=\"state === 'open' || state === 'connecting'\">\n <option v-for=\"s in SHELLS\" :key=\"s\" :value=\"s\">{{ s }}</option>\n </select>\n </label>\n <button\n v-if=\"state !== 'open'\"\n class=\"primary\"\n :disabled=\"!container || state === 'connecting'\"\n @click=\"connect\"\n >\n {{ state === 'connecting' ? 'Connecting…' : 'Open shell' }}\n </button>\n <button v-else @click=\"disconnect\">Close shell</button>\n <span class=\"grow\" />\n <span v-if=\"state === 'open'\" class=\"badge ok\"><span class=\"dot pulse\" />connected</span>\n </div>\n\n <p v-if=\"!running.length && !loadError\" class=\"hint\">\n Nothing is running for this deployment, so there is nothing to open a shell in.\n </p>\n\n <p v-if=\"state === 'closed' && closeReason\" class=\"hint\">Session ended — {{ closeReason }}.</p>\n\n <div ref=\"host\" class=\"terminal-host\" :data-state=\"state\" />\n\n <p class=\"hint\">\n Every session is recorded — who, which container, when — and the record is written when the\n shell opens, so a session that dies with the process still leaves one.\n </p>\n </section>\n</template>\n\n<style scoped>\n.terminal-host {\n min-height: 26rem;\n border: 1px solid var(--border);\n border-radius: var(--r3);\n background: #0b0e14;\n padding: var(--s2);\n overflow: hidden;\n}\n.terminal-host[data-state='idle'] {\n display: none;\n}\n</style>\n"],"file":"assets/TerminalTab-C6gRXura.js"}
|