@samyx/preview-stacks-ui 0.8.0 → 0.15.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/README.md +29 -0
- package/dist/assets/{ActionButton.vue_vue_type_script_setup_true_lang-B1iO-Hbs.js → ActionButton.vue_vue_type_script_setup_true_lang-Cd_ENfdu.js} +2 -2
- package/dist/assets/{ActionButton.vue_vue_type_script_setup_true_lang-B1iO-Hbs.js.map → ActionButton.vue_vue_type_script_setup_true_lang-Cd_ENfdu.js.map} +1 -1
- package/dist/assets/AxesTab-PIPODUl8.js +2 -0
- package/dist/assets/{AxesTab-Cxy76M1f.js.map → AxesTab-PIPODUl8.js.map} +1 -1
- package/dist/assets/ConfigTab-YvlHNuMd.js +2 -0
- package/dist/assets/ConfigTab-YvlHNuMd.js.map +1 -0
- package/dist/assets/DangerTab-DTiS6xB0.js +2 -0
- package/dist/assets/{DangerTab-Cnr_8-Ba.js.map → DangerTab-DTiS6xB0.js.map} +1 -1
- package/dist/assets/DashboardView-Bss76wHt.js +2 -0
- package/dist/assets/DashboardView-Bss76wHt.js.map +1 -0
- package/dist/assets/DeploymentDetailView-kyClP0y4.js +2 -0
- package/dist/assets/DeploymentDetailView-kyClP0y4.js.map +1 -0
- package/dist/assets/DeploymentsView-C2H6D6of.js +2 -0
- package/dist/assets/DeploymentsView-C2H6D6of.js.map +1 -0
- package/dist/assets/EquivalentCommand-BFnZRfDg.css +1 -0
- package/dist/assets/EquivalentCommand-DRkXOe18.js +3 -0
- package/dist/assets/EquivalentCommand-DRkXOe18.js.map +1 -0
- package/dist/assets/{ErrorNote.vue_vue_type_script_setup_true_lang-BJpi4S3s.js → ErrorNote.vue_vue_type_script_setup_true_lang-BZ9OIXGB.js} +2 -2
- package/dist/assets/{ErrorNote.vue_vue_type_script_setup_true_lang-BJpi4S3s.js.map → ErrorNote.vue_vue_type_script_setup_true_lang-BZ9OIXGB.js.map} +1 -1
- package/dist/assets/{JobDetailView-DB6cP2ka.js → JobDetailView-C8y-1Gk0.js} +2 -2
- package/dist/assets/{JobDetailView-DB6cP2ka.js.map → JobDetailView-C8y-1Gk0.js.map} +1 -1
- package/dist/assets/JobsView-Wa28PKmj.js +2 -0
- package/dist/assets/JobsView-Wa28PKmj.js.map +1 -0
- package/dist/assets/LoginView-DhMeluqJ.css +1 -0
- package/dist/assets/LoginView-w9pB4KOG.js +2 -0
- package/dist/assets/LoginView-w9pB4KOG.js.map +1 -0
- package/dist/assets/{LogsTab-BHYDWsWb.js → LogsTab-BA-imxfQ.js} +3 -3
- package/dist/assets/{LogsTab-BHYDWsWb.js.map → LogsTab-BA-imxfQ.js.map} +1 -1
- package/dist/assets/NotFoundView-B01q_-mC.js +2 -0
- package/dist/assets/{NotFoundView-ROlvmBTU.js.map → NotFoundView-B01q_-mC.js.map} +1 -1
- package/dist/assets/NotifiersView-DuvX0P6t.js +2 -0
- package/dist/assets/NotifiersView-DuvX0P6t.js.map +1 -0
- package/dist/assets/{OverviewTab-LKcYN5mk.js → OverviewTab-Blf-Az3p.js} +2 -2
- package/dist/assets/{OverviewTab-LKcYN5mk.js.map → OverviewTab-Blf-Az3p.js.map} +1 -1
- package/dist/assets/RegistriesView-Cnlw2YCk.js +2 -0
- package/dist/assets/RegistriesView-Cnlw2YCk.js.map +1 -0
- package/dist/assets/RelativeTime.vue_vue_type_script_setup_true_lang-DHneomCg.js +2 -0
- package/dist/assets/RelativeTime.vue_vue_type_script_setup_true_lang-DHneomCg.js.map +1 -0
- package/dist/assets/{RequiresTab-BeZeFQdv.js → RequiresTab-DQg43NYf.js} +2 -2
- package/dist/assets/{RequiresTab-BeZeFQdv.js.map → RequiresTab-DQg43NYf.js.map} +1 -1
- package/dist/assets/RoutingView-DSkMdPwp.js +9 -0
- package/dist/assets/RoutingView-DSkMdPwp.js.map +1 -0
- package/dist/assets/RuntimeTab-DDOtdkb1.js +2 -0
- package/dist/assets/{RuntimeTab-CWjyUEnD.js.map → RuntimeTab-DDOtdkb1.js.map} +1 -1
- package/dist/assets/SettingsView-DKeXVJ5c.js +2 -0
- package/dist/assets/SettingsView-DKeXVJ5c.js.map +1 -0
- package/dist/assets/SkeletonList.vue_vue_type_script_setup_true_lang-Bko4Bp5e.js +2 -0
- package/dist/assets/{SkeletonList.vue_vue_type_script_setup_true_lang-B4p28Paq.js.map → SkeletonList.vue_vue_type_script_setup_true_lang-Bko4Bp5e.js.map} +1 -1
- package/dist/assets/{SpecDetailView-CDXuYT7k.js → SpecDetailView-DItY-dvv.js} +2 -2
- package/dist/assets/{SpecDetailView-CDXuYT7k.js.map → SpecDetailView-DItY-dvv.js.map} +1 -1
- package/dist/assets/SpecsView-BOyfeFiw.js +2 -0
- package/dist/assets/SpecsView-BOyfeFiw.js.map +1 -0
- package/dist/assets/StateBadge.vue_vue_type_script_setup_true_lang-C0jjaI2w.js +2 -0
- package/dist/assets/{StateBadge.vue_vue_type_script_setup_true_lang-BBoSnS4z.js.map → StateBadge.vue_vue_type_script_setup_true_lang-C0jjaI2w.js.map} +1 -1
- package/dist/assets/{SubmitView-DoVltkUx.js → SubmitView-DJHNoMy8.js} +4 -4
- package/dist/assets/{SubmitView-DoVltkUx.js.map → SubmitView-DJHNoMy8.js.map} +1 -1
- package/dist/assets/TerminalTab-BAzAYOEa.js +3 -0
- package/dist/assets/TerminalTab-BAzAYOEa.js.map +1 -0
- package/dist/assets/TerminalTab-Bqulz6Eb.css +1 -0
- package/dist/assets/UsersView-DZhhpsnX.css +1 -0
- package/dist/assets/UsersView-DyqtgK5V.js +2 -0
- package/dist/assets/UsersView-DyqtgK5V.js.map +1 -0
- package/dist/assets/{VarEditor.vue_vue_type_script_setup_true_lang-CjFu7uoM.js → VarEditor.vue_vue_type_script_setup_true_lang-CDXij21z.js} +2 -2
- package/dist/assets/{VarEditor.vue_vue_type_script_setup_true_lang-CjFu7uoM.js.map → VarEditor.vue_vue_type_script_setup_true_lang-CDXij21z.js.map} +1 -1
- package/dist/assets/_commonjsHelpers-CqkleIqs.js +2 -0
- package/dist/assets/_commonjsHelpers-CqkleIqs.js.map +1 -0
- package/dist/assets/_plugin-vue_export-helper-DlAUqK2U.js +2 -0
- package/dist/assets/_plugin-vue_export-helper-DlAUqK2U.js.map +1 -0
- package/dist/assets/addon-fit-CevVMrUA.js +2 -0
- package/dist/assets/addon-fit-CevVMrUA.js.map +1 -0
- package/dist/assets/index-I3zdQqtI.css +1 -0
- package/dist/assets/index-zMwxPFi6.js +134 -0
- package/dist/assets/index-zMwxPFi6.js.map +1 -0
- package/dist/assets/{useDeployment-DKKVYXcr.js → useDeployment-Cm0bIOKD.js} +2 -2
- package/dist/assets/{useDeployment-DKKVYXcr.js.map → useDeployment-Cm0bIOKD.js.map} +1 -1
- package/dist/assets/xterm-D6Mng-DB.js +10 -0
- package/dist/assets/xterm-D6Mng-DB.js.map +1 -0
- package/dist/assets/xterm-DYP7pi_n.css +32 -0
- package/dist/index.html +2 -2
- package/nginx.conf +17 -1
- package/package.json +3 -1
- package/dist/assets/AxesTab-Cxy76M1f.js +0 -2
- package/dist/assets/ConfigTab-ezI-u-MN.js +0 -2
- package/dist/assets/ConfigTab-ezI-u-MN.js.map +0 -1
- package/dist/assets/DangerTab-Cnr_8-Ba.js +0 -2
- package/dist/assets/DashboardView-Dgqzqr0u.js +0 -2
- package/dist/assets/DashboardView-Dgqzqr0u.js.map +0 -1
- package/dist/assets/DeploymentDetailView-CzNOnaAb.js +0 -2
- package/dist/assets/DeploymentDetailView-CzNOnaAb.js.map +0 -1
- package/dist/assets/DeploymentsView-CDNBJ7JQ.js +0 -2
- package/dist/assets/DeploymentsView-CDNBJ7JQ.js.map +0 -1
- package/dist/assets/JobsView-DeAdOUVq.js +0 -2
- package/dist/assets/JobsView-DeAdOUVq.js.map +0 -1
- package/dist/assets/NotFoundView-ROlvmBTU.js +0 -2
- package/dist/assets/RegistriesView-Bvnq_VSn.js +0 -2
- package/dist/assets/RegistriesView-Bvnq_VSn.js.map +0 -1
- package/dist/assets/RoutingView-BjBTNG-z.js +0 -9
- package/dist/assets/RoutingView-BjBTNG-z.js.map +0 -1
- package/dist/assets/RuntimeTab-CWjyUEnD.js +0 -2
- package/dist/assets/SettingsView-D_roVhhz.js +0 -2
- package/dist/assets/SettingsView-D_roVhhz.js.map +0 -1
- package/dist/assets/SkeletonList.vue_vue_type_script_setup_true_lang-B4p28Paq.js +0 -2
- package/dist/assets/SpecsView-Bib418qu.js +0 -2
- package/dist/assets/SpecsView-Bib418qu.js.map +0 -1
- package/dist/assets/StateBadge.vue_vue_type_script_setup_true_lang-BBoSnS4z.js +0 -2
- package/dist/assets/index-B4C7uKN0.js +0 -124
- package/dist/assets/index-B4C7uKN0.js.map +0 -1
- package/dist/assets/index-Ca3L5StC.css +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SpecsView-BOyfeFiw.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';\nimport EquivalentCommand from '../components/EquivalentCommand.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\">This page cannot store one yet — the command below does.</p>\n <EquivalentCommand\n what=\"storing a spec\"\n method=\"PUT\"\n path=\"/api/specs/my-spec\"\n :body=\"{ spec: '…the contents of your preview.yml…' }\"\n cli=\"pstack validate -f preview.yml # then PUT it with the curl above\"\n />\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","EquivalentCommand","SkeletonList"],"mappings":"qrCAuBA,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,KAAKL,EAAM,YAAa,CACjC,GAAI,CAACK,EAAE,SAAU,SACjB,MAAMC,EAAOF,EAAE,IAAIC,EAAE,QAAQ,GAAK,CAAA,EAClCC,EAAK,KAAKD,EAAE,EAAE,EACdD,EAAE,IAAIC,EAAE,SAAUC,CAAI,CACxB,CACA,OAAOF,CACT,CAAC,EAEKG,EAAQJ,EAAS,IAAM,CAC3B,MAAMK,EAAIb,EAAO,MAAM,KAAA,EAAO,YAAA,E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AA,GAEnC3B,EAKK,KALL4B,GAKK,EAJSC,EAAAtC,EAAA,MAAM,IAAIO,EAAE,IAAI,IAAhB,MAAA+B,EAAmB,YAA/B9B,EAEO,OAAA+B,GAAAT,EADF9B,EAAA,MAAM,IAAIO,EAAE,IAAI,EAAG,MAAM,EAAG,kBACjC,CAAA,QACAC,EAA4C,OAA5CgC,GAA0B,aAAW,EAAA,GAEvC/B,EAAmF,KAAnFgC,GAAmF,CAAvC5B,EAAkC6B,EAAA,CAAnB,GAAInC,EAAE,SAAA,+BAExDF,EAAA,MAAM,qBAAjBG,EAEK,KAAAmC,GAAA,CADHlC,EAAiE,KAAjEmC,GAA6B,oBAAiBd,EAAGrC,EAAA,KAAM,EAAG,KAAE,CAAA,CAAA,eAUpEwB,IAAAT,EAeM,MAfNqC,GAeM,CAdJlC,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAF,EAA2B,SAAxB,uBAAoB,EAAA,GACvBA,EAII,IAAA,KAAA,iBAJD,qDAED,EAAA,GAAAI,EAA4Ce,EAAA,CAAhC,GAAG,WAAS,WAAC,IAAM,CAAA,GAAAjB,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAA,GAAN,SAAM,EAAA,CAAA,2BAAa,2GAE9C,EAAA,EAAA,GACAA,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAF,EAA4E,IAAA,CAAzE,MAAM,MAAA,EAAO,2DAAwD,EAAA,GACxEI,EAMEiC,EAAA,CALA,KAAK,iBACL,OAAO,MACP,KAAK,qBACJ,KAAM,CAAA,KAAA,oCAAA,EACP,IAAI,oEAAA,WAvER/B,EAAyCgC,EAAA,OAAX,KAAM,CAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as t,c as s,E as n,a as o,f as r,t as l,o as c}from"./index-zMwxPFi6.js";const m=t({__name:"StateBadge",props:{state:{}},setup(a){return(p,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{m as _};
|
|
2
|
+
//# sourceMappingURL=StateBadge.vue_vue_type_script_setup_true_lang-C0jjaI2w.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StateBadge.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
{"version":3,"file":"StateBadge.vue_vue_type_script_setup_true_lang-C0jjaI2w.js","sources":["../../src/components/StateBadge.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The four job states, and only the four. Kept in one component so the colour of `leaked` can\n * never drift from the colour of `failed` in one view and not another:\n *\n * ok green · failed red · leaked AMBER · running blue, pulsing\n *\n * `leaked` must be unmistakably distinct from `failed`. They are different problems with different\n * owners — \"teardown errored\" versus \"teardown ran and something survived\" — which is why the CLI\n * gives leaked its own exit code, and why this app never renders them in the same colour.\n */\nimport type { JobState } from '../api/types';\n\ndefineProps<{ state: JobState }>();\n</script>\n\n<template>\n <span class=\"badge\" :class=\"state\">\n <span class=\"dot\" />\n {{ state }}\n </span>\n</template>\n"],"names":["_createElementBlock","_normalizeClass","__props","_createElementVNode","_createTextVNode"],"mappings":"6JAiBEA,EAGO,OAAA,CAHD,MAAKC,EAAA,CAAC,QAAgBC,EAAA,KAAK,CAAA,CAAA,eAC/BC,EAAoB,OAAA,CAAd,MAAM,KAAA,EAAK,KAAA,EAAA,GAAGC,EAAA,MACjBF,EAAA,KAAK,EAAA,CAAA,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{d as X,
|
|
1
|
+
import{d as X,r as c,A as I,I as j,c as n,a as t,t as p,f as s,e as v,w as m,_ as A,F as w,g as y,E as G,i as S,v as N,V as M,G as J,s as D,x as Q,C as E,j as Y,o as a,l as Z,P as _,O as ee,B as te,U as F}from"./index-zMwxPFi6.js";import{a as se,w as oe,p as O,r as le}from"./useVars-VN9gYdR6.js";import{_ as ae}from"./ActionButton.vue_vue_type_script_setup_true_lang-Cd_ENfdu.js";import{_ as ne}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BZ9OIXGB.js";import{_ as ie}from"./VarEditor.vue_vue_type_script_setup_true_lang-CDXij21z.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},Me=`version: 1
|
|
2
2
|
kind: isolated
|
|
3
3
|
|
|
4
4
|
# The stack identity: the compose project name, and $STACK inside every hook.
|
|
@@ -38,8 +38,8 @@ axes:
|
|
|
38
38
|
profiles: [app]
|
|
39
39
|
labels:
|
|
40
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([]);
|
|
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),q=Z(),R=E(()=>{const o=q.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=O(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?O(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=Me,l.value.compose.trim()||(l.value.compose=De),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),[[M,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),[[M,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,D($.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
42
|
kind: isolated
|
|
43
43
|
stack: pr-\${PR}
|
|
44
|
-
axes: []`},null,512),[[N,l.value.spec]])]),t("div",
|
|
45
|
-
//# sourceMappingURL=SubmitView-
|
|
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,D(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-DJHNoMy8.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitView-DoVltkUx.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":"yzCAkNMA,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,EAC1CG,EAAWH,EAAI,EAAE,EAEjBI,EAAaJ,EAAI,EAAK,EACtBK,EAAQL,EAAI,EAAE,EACdM,EAASN,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,EAAA,EAAA,GAF2F,WAE3F,EAAA,CAAA,mCAcO+B,GAAAxD,EAAAnB,EAAA,QAAA,YAAAmB,EAAQ,kBAAR,MAAAwD,EAAyB,QAApC9B,IAAAV,EAUM,MAVNyC,GAUM,CATJxC,EAAyE,SAAtE,iDAA8CE,EAAGtC,QAAO,KAAK,EAAG,KAAE,CAAA,EACrEoC,EAOI,IAAA,KAAA,EANFS,EAAA,EAAA,EAAAV,EAGCY,SAH0B/C,EAAA,MAAO,gBAAe,CAA/B6E,EAAGC,kBAAoCD,GAAC,CACxDnC,EACCM,EAAA,CADY,GAAE,gBAAkB,mBAAmB6B,CAAC,CAAA,EAAA,aAAK,IAAO,KAAJA,CAAC,EAAA,CAAA,CAAA,qBACjDC,EAAI9E,EAAA,MAAO,gBAAgB,OAAM,GAA7C6C,EAAA,EAAAV,EAA4D,UAAT,IAAE,yCACvD,yDAAsD,EAAA,GAAAS,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAR,EAAiB,YAAX,OAAI,EAAA,mBAAO,+CACjD,EAAA,GAAAQ,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAR,EAAmB,YAAb,SAAM,EAAA,mBAAO,qFACd,EAAA,GAAAQ,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAR,EAAkB,YAAZ,QAAK,EAAA,mBAAO,oBAChD,EAAA,EAAA,eAGerC,EAAA,WAAjBgF,EAAqFC,GAAA,OAA5D,KAAMjF,EAAA,MAAO,MAAM,sCAAA"}
|
|
1
|
+
{"version":3,"file":"SubmitView-DJHNoMy8.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_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AAAR,EAAiB,YAAX,OAAI,EAAA,mBAAO,+CACjD,EAAA,GAAAQ,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAR,EAAmB,YAAb,SAAM,EAAA,mBAAO,qFACd,EAAA,GAAAQ,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAR,EAAkB,YAAZ,QAAK,EAAA,mBAAO,oBAChD,EAAA,EAAA,eAGerC,EAAA,WAAjBgF,EAAqFC,GAAA,OAA5D,KAAMjF,EAAA,MAAO,MAAM,sCAAA"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/xterm-D6Mng-DB.js","assets/_commonjsHelpers-CqkleIqs.js","assets/addon-fit-CevVMrUA.js","assets/xterm-DYP7pi_n.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{d as q,I as N,L as H,c as r,a as n,f as a,e as W,w as G,_ as Y,x as j,g as h,i as $,G as B,F as T,s as I,t as y,r as v,C as P,A as J,B as K,M as E,N as S,o as i,l as Q}from"./index-zMwxPFi6.js";import{_ as X}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BZ9OIXGB.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=q({__name:"TerminalTab",setup(fe){const U=Q(),k=P(()=>String(U.params.id)),D=["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),O=S(null),g=S(null);let u=null;const C=P(()=>{var s;return((s=R.value)==null?void 0:s.containers.filter(e=>e.state==="running"))??[]});async function x(){var e;const s=await J.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 A;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])),(A=_.value)==null||A.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,O.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",M=new URLSearchParams({container:c.value,shell:w.value}),d=new WebSocket(`${z}://${location.host}/api/deployments/${encodeURIComponent(k.value)}/terminal?${M}`);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 L(){var s;(s=g.value)==null||s.close(1e3,"closed by the operator")}function V(){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 N([c,w],()=>{(t.value==="open"||t.value==="connecting")&&L()}),N(k,()=>{V(),t.value="idle",x()}),H(V),(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:G(()=>[...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)),$(n("select",{"onUpdate:modelValue":e[0]||(e[0]=o=>c.value=o),disabled:t.value==="open"||t.value==="connecting"},[(i(!0),r(T,null,I(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)),$(n("select",{"onUpdate:modelValue":e[1]||(e[1]=o=>w.value=o),disabled:t.value==="open"||t.value==="connecting"},[(i(),r(T,null,I(D,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:L},"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-BAzAYOEa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"mappings":";4rBAyBA,MAAMA,EAAQC,EAAA,EACRC,EAAKC,EAAS,IAAM,OAAOH,EAAM,OAAO,EAAE,CAAC,EAE3CI,EAAS,CAAC,KAAM,OAAQ,MAAO,MAAO,MAAM,EAE5CC,EAAKC,EAA4B,IAAI,EACrCC,EAAYD,EAAI,EAAE,EAClBE,EAAYF,EAAI,EAAE,EAClBG,EAAQH,EAAI,IAAI,EAChBI,EAAQJ,EAA+C,MAAM,EAC7DK,EAAcL,EAAI,EAAE,EAEpBM,EAAON,EAA2B,IAAI,EAEtCO,EAAOC,EAAmD,IAAI,EAC9DC,EAAMD,EAAuD,IAAI,EACjEE,EAASF,EAA6B,IAAI,EAChD,IAAIG,EAAkC,KAEtC,MAAMC,EAAUf,EAAS,WAAM,QAAAgB,EAAAd,EAAG,QAAH,YAAAc,EAAU,WAAW,OAAQC,GAAMA,EAAE,QAAU,aAAc,GAAE,EAE9F,eAAeC,GAAiB,OAC9B,MAAMC,EAAI,MAAMC,EAAI,IAClB,oBAAoB,mBAAmBrB,EAAG,KAAK,CAAC,YAElD,GAAI,CAACoB,EAAE,GAAI,CACTf,EAAU,MAAQiB,EAAQF,EAAG,mCAAmC,EAChE,MACF,CACAf,EAAU,MAAQ,GAClBF,EA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OAAaE,EAAA,QAAK,aAC7B,QAAOe,CAAA,IAELf,EAAA,QAAK,2CAAAoD,EAAA,QAEVnB,EAAuD,gBAAvC,QAAON,CAAA,EAAY,aAAW,iBAC9CQ,EAAqB,QAAf,MAAM,QAAM,UACNnC,EAAA,QAAK,QAAjBgC,EAAA,EAAAC,EAAyF,OAAzFoB,GAAyF,IAAAhB,EAAA,MAAAA,EAAA,KAA1CF,EAA0B,QAApB,MAAM,aAAW,WAAG,YAAS,qBAG1E3B,EAAA,MAAQ,QAAM,CAAKX,EAAA,WAA7BoC,EAEI,IAFJqB,GAAqD,mFAErD,YAEStD,EAAA,kBAAsBC,EAAA,OAA/B+B,EAAA,EAAAC,EAA+F,IAA/FsB,GAAyD,mBAAgBP,EAAG/C,EAAA,KAAW,EAAG,IAAC,aAE3FkC,EAA4D,eAAnD,OAAJ,IAAIjC,EAAO,MAAM,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-BAzAYOEa.js"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.terminal-host[data-v-3c081c5e]{min-height:26rem;border:1px solid var(--border);border-radius:var(--r3);background:#0b0e14;padding:var(--s2);overflow:hidden}.terminal-host[data-state=idle][data-v-3c081c5e]{display:none}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.stack-form[data-v-09c4a1c4]{margin-top:var(--s5);padding-top:var(--s4);border-top:1px solid var(--line-soft);display:flex;flex-direction:column;gap:var(--s3)}.stack-form h3[data-v-09c4a1c4]{font-size:var(--t-sm);color:var(--fg-dim)}td.right[data-v-09c4a1c4]{text-align:end}.two-up>.field[data-v-09c4a1c4]{flex:1 1 200px}td.right button[data-v-09c4a1c4]{margin-inline-start:var(--s2)}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as z,c as n,a as e,f as y,e as c,w as b,_ as S,x as C,g as _,t as i,F as R,s as I,h as P,i as A,v as T,u as U,b as g,T as G,r as d,C as H,A as m,B as f,o as a,O as x}from"./index-zMwxPFi6.js";import{_ as B}from"./ActionButton.vue_vue_type_script_setup_true_lang-Cd_ENfdu.js";import{E as D}from"./EquivalentCommand-DRkXOe18.js";import{_ as J}from"./ErrorNote.vue_vue_type_script_setup_true_lang-BZ9OIXGB.js";import{_ as E}from"./RelativeTime.vue_vue_type_script_setup_true_lang-DHneomCg.js";import{_ as F}from"./SkeletonList.vue_vue_type_script_setup_true_lang-Bko4Bp5e.js";import{_ as K}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./useFormat-CKJxQp_i.js";const Q={class:"page-head"},X={class:"sub"},Z={key:1,class:"banner ok"},ee={class:"code"},se={class:"row"},te={class:"grid-2"},oe={class:"panel"},ae={class:"phead"},ne={class:"mute",style:{"font-size":"var(--t-xs)"}},le={key:1,class:"cards"},re={class:"name","data-label":"user"},ie={key:0,class:"badge info"},de={class:"dim nowrap","data-label":"added"},ue={class:"right nowrap","data-label":""},ce=["onClick"],pe={key:2,class:"hint"},ve={class:"row wrap two-up"},me={class:"field grow"},he={class:"field grow"},we={class:"row"},ke=["disabled"],fe={class:"panel"},ye={class:"phead"},be={key:1,class:"cards"},_e={class:"name","data-label":"name"},ge={class:"dim nowrap","data-label":"last used"},$e={key:1,class:"mute"},Ce={class:"right nowrap","data-label":""},Ae={key:2,class:"hint"},Te={class:"field"},Ue={class:"row"},xe=["disabled"],Ve={class:"sheet",role:"dialog","aria-modal":"true","aria-label":"Change password"},Ne={class:"hint"},Pe={class:"field"},Se={class:"row"},Re=["disabled"],Ie=z({__name:"UsersView",setup(Be){const $=d([]),V=d([]),N=d(!1),r=d(""),l=d({username:"",password:""}),p=d(""),u=d(null),h=d(""),w=d(null),O=H(()=>l.value.username.trim().length>0&&l.value.password.length>=8);async function k(){const[o,s]=await Promise.all([m.get("/api/users"),m.get("/api/tokens")]);if(N.value=!0,!o.ok){r.value=f(o,"load the accounts");return}r.value="",$.value=o.body.users??[],V.value=s.ok?s.body.tokens??[]:[]}k();async function L(){const o=await m.post("/api/users",{username:l.value.username.trim(),password:l.value.password});if(!o.ok){r.value=f(o,"create this account");return}x("ok",`Created ${o.body.user.username}.`),l.value={username:"",password:""},k()}async function M(o){const s=await m.del(`/api/users/${o.id}`);if(!s.ok){r.value=f(s,`delete ${o.username}`);return}x("ok",`Deleted ${o.username}.`),k()}async function W(){var t;const o=u.value;if(!o)return;const s=await m.put(`/api/users/${o.id}/password`,{password:h.value});if(!s.ok){r.value=f(s,`change the password for ${o.username}`);return}u.value=null,h.value="",x("ok",o.id===((t=g.user)==null?void 0:t.id)?"Password changed. You have been signed out everywhere — sign in again.":`Password changed. ${o.username} has been signed out everywhere.`),k()}async function Y(){const o=await m.post("/api/tokens",{name:p.value.trim()});if(!o.ok){r.value=f(o,"create this token");return}w.value={what:`Personal token “${p.value.trim()}”`,value:o.body.token,note:"Send it as a bearer token. The server stores only a hash, so this is the only time it is shown."},p.value="",k()}async function j(o){const s=await m.del(`/api/tokens/${o.id}`);if(!s.ok){r.value=f(s,`revoke ${o.name}`);return}x("ok",`Revoked ${o.name}.`),k()}return(o,s)=>(a(),n("div",null,[e("div",Q,[e("div",null,[s[9]||(s[9]=e("h1",null,"Users & access",-1)),e("div",X,[s[8]||(s[8]=y(" Who can sign in, and the tokens they use from scripts ",-1)),c(S,{label:"how access works here"},{default:b(()=>[...s[7]||(s[7]=[y(" Three kinds of caller. The host token from the environment is the root credential CI holds. An account signs in with a password and gets a browser session. A personal token belongs to one account and is what a script uses — it can do anything that account can. ",-1)])]),_:1})])])]),r.value?(a(),C(J,{key:0,text:r.value,title:"Something went wrong."},null,8,["text"])):_("",!0),w.value?(a(),n("div",Z,[e("b",null,i(w.value.what)+" — copy it now.",1),e("p",null,i(w.value.note),1),e("pre",ee,i(w.value.value),1),e("div",se,[e("button",{onClick:s[0]||(s[0]=t=>w.value=null)},"I have stored it")])])):_("",!0),e("div",te,[e("section",oe,[e("div",ae,[s[10]||(s[10]=e("h2",{class:"section"},"Accounts",-1)),s[11]||(s[11]=e("span",{class:"grow"},null,-1)),e("span",ne,i($.value.length),1)]),N.value?$.value.length?(a(),n("table",le,[s[13]||(s[13]=e("thead",null,[e("tr",null,[e("th",null,"User"),e("th",null,"Added"),e("th",{"aria-label":"Actions"})])],-1)),e("tbody",null,[(a(!0),n(R,null,I($.value,t=>{var v;return a(),n("tr",{key:t.id},[e("td",re,[e("b",null,i(t.username),1),t.id===((v=U(g).user)==null?void 0:v.id)?(a(),n("span",ie,"you")):_("",!0)]),e("td",de,[c(E,{at:t.createdAt},null,8,["at"])]),e("td",ue,[e("button",{class:"ghost sm",onClick:q=>{u.value=t,h.value=""}},"Change password",8,ce),c(B,{class:"danger sm",confirm:`Delete ${t.username}? Their sessions and tokens go too.`,onRun:q=>M(t)},{default:b(()=>[...s[12]||(s[12]=[y("Delete",-1)])]),_:1},8,["confirm","onRun"])])])}),128))])])):(a(),n("p",pe,"No accounts yet.")):(a(),C(F,{key:0,rows:3})),e("form",{class:"stack-form",onSubmit:P(L,["prevent"])},[s[17]||(s[17]=e("h3",null,"Add an account",-1)),e("div",ve,[e("label",me,[s[14]||(s[14]=e("span",null,"Username",-1)),A(e("input",{"onUpdate:modelValue":s[1]||(s[1]=t=>l.value.username=t),type:"text",autocomplete:"off"},null,512),[[T,l.value.username]])]),e("label",he,[s[15]||(s[15]=e("span",null,"Password",-1)),A(e("input",{"onUpdate:modelValue":s[2]||(s[2]=t=>l.value.password=t),type:"password",autocomplete:"new-password"},null,512),[[T,l.value.password]])])]),s[18]||(s[18]=e("p",{class:"hint"},"At least 8 characters.",-1)),e("div",we,[e("button",{class:"primary",type:"submit",disabled:!O.value},"Add account",8,ke),s[16]||(s[16]=e("span",{class:"grow"},null,-1))]),c(D,{what:"this account creation",method:"POST",path:"/api/users",body:{username:l.value.username||"alice",password:"…"}},null,8,["body"])],32)]),e("section",fe,[e("div",ye,[s[20]||(s[20]=e("h2",{class:"section"},"Your API tokens",-1)),c(S,{label:"when to use one"},{default:b(()=>[...s[19]||(s[19]=[y(" A script or a CI job signing in as you. It carries whatever you can do, so give each one a name you will recognise later and revoke the ones you stop using. ",-1)])]),_:1})]),N.value?V.value.length?(a(),n("table",be,[s[22]||(s[22]=e("thead",null,[e("tr",null,[e("th",null,"Name"),e("th",null,"Last used"),e("th",{"aria-label":"Actions"})])],-1)),e("tbody",null,[(a(!0),n(R,null,I(V.value,t=>(a(),n("tr",{key:t.id},[e("td",_e,[e("b",null,i(t.name),1)]),e("td",ge,[t.lastUsedAt?(a(),C(E,{key:0,at:t.lastUsedAt},null,8,["at"])):(a(),n("span",$e,"never"))]),e("td",Ce,[c(B,{class:"danger sm",confirm:`Revoke ${t.name}? Anything using it stops working.`,onRun:v=>j(t)},{default:b(()=>[...s[21]||(s[21]=[y("Revoke",-1)])]),_:1},8,["confirm","onRun"])])]))),128))])])):(a(),n("p",Ae,i(U(g).root?"The host token is not an account, so it has no personal tokens.":"No tokens yet."),1)):(a(),C(F,{key:0,rows:2})),U(g).root?_("",!0):(a(),n("form",{key:3,class:"stack-form",onSubmit:P(Y,["prevent"])},[s[24]||(s[24]=e("h3",null,"New token",-1)),e("label",Te,[s[23]||(s[23]=e("span",null,"What is it for",-1)),A(e("input",{"onUpdate:modelValue":s[3]||(s[3]=t=>p.value=t),type:"text",placeholder:"ci-deploy",autocomplete:"off"},null,512),[[T,p.value]])]),e("div",Ue,[e("button",{class:"primary",type:"submit",disabled:!p.value.trim()},"Create token",8,xe)]),c(D,{what:"this token creation",method:"POST",path:"/api/tokens",body:{name:p.value||"ci-deploy"}},null,8,["body"])],32))])]),c(G,{name:"fade"},{default:b(()=>{var t;return[u.value?(a(),n("div",{key:0,class:"scrim",onClick:s[6]||(s[6]=P(v=>u.value=null,["self"]))},[e("div",Ve,[e("h3",null,"Change password for "+i(u.value.username),1),e("p",Ne," This signs "+i(u.value.id===((t=U(g).user)==null?void 0:t.id)?"you":"them")+" out everywhere — every session and personal token is revoked. ",1),e("label",Pe,[s[25]||(s[25]=e("span",null,"New password",-1)),A(e("input",{"onUpdate:modelValue":s[4]||(s[4]=v=>h.value=v),type:"password",autocomplete:"new-password"},null,512),[[T,h.value]])]),e("div",Se,[e("button",{class:"primary",disabled:h.value.length<8,onClick:W}," Change password ",8,Re),e("button",{class:"ghost",onClick:s[5]||(s[5]=v=>u.value=null)},"Cancel")])])])):_("",!0)]}),_:1})]))}}),je=K(Ie,[["__scopeId","data-v-09c4a1c4"]]);export{je as default};
|
|
2
|
+
//# sourceMappingURL=UsersView-DyqtgK5V.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UsersView-DyqtgK5V.js","sources":["../../src/views/UsersView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * Accounts and personal API tokens.\n *\n * Accounts landed in 0.10.0 with no UI at all, so the only way to add a second operator was a curl\n * call — which is exactly the thing a control plane exists to spare people.\n *\n * TWO AUDIENCES, TWO SECTIONS, and the split is deliberate. **Accounts** are about other people and\n * are shared state; **tokens** are yours alone (the API scopes them to the caller and cannot show\n * anyone else's). Mixing them into one table would imply an admin can manage another person's\n * tokens, which is not true and would be a bad idea if it were.\n *\n * SECRETS ARE SHOWN ONCE, and the page says so in the same breath as showing them. Same discipline\n * as a notifier signing secret and a registry credential: there is no read path on the server, so\n * this is not a policy that could be relaxed later — the value genuinely stops existing.\n */\nimport { computed, ref } from 'vue';\nimport { api, problem } from '../api/client';\nimport { authState } from '../composables/useAuth';\nimport { toast } from '../composables/useToasts';\nimport ActionButton from '../components/ActionButton.vue';\nimport EquivalentCommand from '../components/EquivalentCommand.vue';\nimport ErrorNote from '../components/ErrorNote.vue';\nimport InfoHint from '../components/InfoHint.vue';\nimport RelativeTime from '../components/RelativeTime.vue';\nimport SkeletonList from '../components/SkeletonList.vue';\n\ntype User = { id: number; username: string; role: string; createdAt: number };\ntype Token = { id: number; name: string; createdAt: number; lastUsedAt: number | null };\n\nconst users = ref<User[]>([]);\nconst tokens = ref<Token[]>([]);\nconst loaded = ref(false);\nconst listError = ref('');\n\nconst newUser = ref({ username: '', password: '' });\nconst newToken = ref('');\nconst pwFor = ref<User | null>(null);\nconst pwValue = ref('');\n\n/** Held only until dismissed — there is no way to show either of these again. */\nconst revealed = ref<{ what: string; value: string; note: string } | null>(null);\n\nconst canCreateUser = computed(\n () => newUser.value.username.trim().length > 0 && newUser.value.password.length >= 8,\n);\n\nasync function load(): Promise<void> {\n const [u, t] = await Promise.all([\n api.get<{ users: User[] }>('/api/users'),\n api.get<{ tokens: Token[] }>('/api/tokens'),\n ]);\n loaded.value = true;\n if (!u.ok) {\n listError.value = problem(u, 'load the accounts');\n return;\n }\n listError.value = '';\n users.value = u.body.users ?? [];\n // Root (PSTACK_TOKEN) is not a user, so it has no personal tokens — an error here is expected.\n tokens.value = t.ok ? (t.body.tokens ?? []) : [];\n}\nvoid load();\n\nasync function createUser(): Promise<void> {\n const r = await api.post<{ user: User }>('/api/users', {\n username: newUser.value.username.trim(),\n password: newUser.value.password,\n });\n if (!r.ok) {\n listError.value = problem(r, 'create this account');\n return;\n }\n toast('ok', `Created ${r.body.user.username}.`);\n newUser.value = { username: '', password: '' };\n void load();\n}\n\nasync function removeUser(u: User): Promise<void> {\n const r = await api.del(`/api/users/${u.id}`);\n // The server refuses to delete the last account. That is a rule worth surfacing verbatim rather\n // than as \"could not delete\" — it tells the operator what to do instead.\n if (!r.ok) {\n listError.value = problem(r, `delete ${u.username}`);\n return;\n }\n toast('ok', `Deleted ${u.username}.`);\n void load();\n}\n\nasync function changePassword(): Promise<void> {\n const u = pwFor.value;\n if (!u) return;\n const r = await api.put(`/api/users/${u.id}/password`, { password: pwValue.value });\n if (!r.ok) {\n listError.value = problem(r, `change the password for ${u.username}`);\n return;\n }\n pwFor.value = null;\n pwValue.value = '';\n // Not a footnote: the change signs that user out everywhere, and if it was YOU, the next request\n // is a 401. Saying so here is the difference between an expected step and an apparent bug.\n toast(\n 'ok',\n u.id === authState.user?.id\n ? `Password changed. You have been signed out everywhere — sign in again.`\n : `Password changed. ${u.username} has been signed out everywhere.`,\n );\n void load();\n}\n\nasync function createToken(): Promise<void> {\n const r = await api.post<{ token: string; id: number }>('/api/tokens', {\n name: newToken.value.trim(),\n });\n if (!r.ok) {\n listError.value = problem(r, 'create this token');\n return;\n }\n revealed.value = {\n what: `Personal token “${newToken.value.trim()}”`,\n value: r.body.token,\n note: 'Send it as a bearer token. The server stores only a hash, so this is the only time it is shown.',\n };\n newToken.value = '';\n void load();\n}\n\nasync function removeToken(t: Token): Promise<void> {\n const r = await api.del(`/api/tokens/${t.id}`);\n if (!r.ok) {\n listError.value = problem(r, `revoke ${t.name}`);\n return;\n }\n toast('ok', `Revoked ${t.name}.`);\n void load();\n}\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>Users & access</h1>\n <div class=\"sub\">\n Who can sign in, and the tokens they use from scripts\n <InfoHint label=\"how access works here\">\n Three kinds of caller. The host token from the environment is the root credential CI\n holds. An account signs in with a password and gets a browser session. A personal token\n belongs to one account and is what a script uses — it can do anything that account can.\n </InfoHint>\n </div>\n </div>\n </div>\n\n <ErrorNote v-if=\"listError\" :text=\"listError\" title=\"Something went wrong.\" />\n\n <div v-if=\"revealed\" class=\"banner ok\">\n <b>{{ revealed.what }} — copy it now.</b>\n <p>{{ revealed.note }}</p>\n <pre class=\"code\">{{ revealed.value }}</pre>\n <div class=\"row\">\n <button @click=\"revealed = null\">I have stored it</button>\n </div>\n </div>\n\n <div class=\"grid-2\">\n <section class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Accounts</h2>\n <span class=\"grow\" />\n <span class=\"mute\" style=\"font-size: var(--t-xs)\">{{ users.length }}</span>\n </div>\n\n <SkeletonList v-if=\"!loaded\" :rows=\"3\" />\n <!-- `cards` + `data-label` per cell: below 640px the same markup renders as cards. Without\n it the row's two buttons pushed the table past the viewport and got clipped. -->\n <table v-else-if=\"users.length\" class=\"cards\">\n <thead>\n <tr>\n <th>User</th>\n <th>Added</th>\n <th aria-label=\"Actions\" />\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"u in users\" :key=\"u.id\">\n <td class=\"name\" data-label=\"user\">\n <b>{{ u.username }}</b>\n <span v-if=\"u.id === authState.user?.id\" class=\"badge info\">you</span>\n </td>\n <td class=\"dim nowrap\" data-label=\"added\"><RelativeTime :at=\"u.createdAt\" /></td>\n <td class=\"right nowrap\" data-label=\"\">\n <button class=\"ghost sm\" @click=\"pwFor = u; pwValue = ''\">Change password</button>\n <ActionButton\n class=\"danger sm\"\n :confirm=\"`Delete ${u.username}? Their sessions and tokens go too.`\"\n @run=\"removeUser(u)\"\n >Delete</ActionButton\n >\n </td>\n </tr>\n </tbody>\n </table>\n <p v-else class=\"hint\">No accounts yet.</p>\n\n <form class=\"stack-form\" @submit.prevent=\"createUser\">\n <h3>Add an account</h3>\n <div class=\"row wrap two-up\">\n <label class=\"field grow\">\n <span>Username</span>\n <input v-model=\"newUser.username\" type=\"text\" autocomplete=\"off\" />\n </label>\n <label class=\"field grow\">\n <span>Password</span>\n <input v-model=\"newUser.password\" type=\"password\" autocomplete=\"new-password\" />\n </label>\n </div>\n <p class=\"hint\">At least 8 characters.</p>\n <div class=\"row\">\n <button class=\"primary\" type=\"submit\" :disabled=\"!canCreateUser\">Add account</button>\n <span class=\"grow\" />\n </div>\n <EquivalentCommand\n what=\"this account creation\"\n method=\"POST\"\n path=\"/api/users\"\n :body=\"{ username: newUser.username || 'alice', password: '…' }\"\n />\n </form>\n </section>\n\n <section class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Your API tokens</h2>\n <InfoHint label=\"when to use one\">\n A script or a CI job signing in as you. It carries whatever you can do, so give each one\n a name you will recognise later and revoke the ones you stop using.\n </InfoHint>\n </div>\n\n <SkeletonList v-if=\"!loaded\" :rows=\"2\" />\n <table v-else-if=\"tokens.length\" class=\"cards\">\n <thead>\n <tr>\n <th>Name</th>\n <th>Last used</th>\n <th aria-label=\"Actions\" />\n </tr>\n </thead>\n <tbody>\n <tr v-for=\"t in tokens\" :key=\"t.id\">\n <td class=\"name\" data-label=\"name\"><b>{{ t.name }}</b></td>\n <td class=\"dim nowrap\" data-label=\"last used\">\n <RelativeTime v-if=\"t.lastUsedAt\" :at=\"t.lastUsedAt\" />\n <span v-else class=\"mute\">never</span>\n </td>\n <td class=\"right nowrap\" data-label=\"\">\n <ActionButton\n class=\"danger sm\"\n :confirm=\"`Revoke ${t.name}? Anything using it stops working.`\"\n @run=\"removeToken(t)\"\n >Revoke</ActionButton\n >\n </td>\n </tr>\n </tbody>\n </table>\n <p v-else class=\"hint\">\n {{ authState.root ? 'The host token is not an account, so it has no personal tokens.' : 'No tokens yet.' }}\n </p>\n\n <form v-if=\"!authState.root\" class=\"stack-form\" @submit.prevent=\"createToken\">\n <h3>New token</h3>\n <label class=\"field\">\n <span>What is it for</span>\n <input v-model=\"newToken\" type=\"text\" placeholder=\"ci-deploy\" autocomplete=\"off\" />\n </label>\n <div class=\"row\">\n <button class=\"primary\" type=\"submit\" :disabled=\"!newToken.trim()\">Create token</button>\n </div>\n <EquivalentCommand\n what=\"this token creation\"\n method=\"POST\"\n path=\"/api/tokens\"\n :body=\"{ name: newToken || 'ci-deploy' }\"\n />\n </form>\n </section>\n </div>\n\n <!-- Password change: a dialog, because it is a distinct decision about one row. -->\n <Transition name=\"fade\">\n <div v-if=\"pwFor\" class=\"scrim\" @click.self=\"pwFor = null\">\n <div class=\"sheet\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Change password\">\n <h3>Change password for {{ pwFor.username }}</h3>\n <p class=\"hint\">\n This signs {{ pwFor.id === authState.user?.id ? 'you' : 'them' }} out everywhere —\n every session and personal token is revoked.\n </p>\n <label class=\"field\">\n <span>New password</span>\n <input v-model=\"pwValue\" type=\"password\" autocomplete=\"new-password\" />\n </label>\n <div class=\"row\">\n <button class=\"primary\" :disabled=\"pwValue.length < 8\" @click=\"changePassword\">\n Change password\n </button>\n <button class=\"ghost\" @click=\"pwFor = null\">Cancel</button>\n </div>\n </div>\n </div>\n </Transition>\n </div>\n</template>\n\n<style scoped>\n.stack-form {\n margin-top: var(--s5);\n padding-top: var(--s4);\n border-top: 1px solid var(--line-soft);\n display: flex;\n flex-direction: column;\n gap: var(--s3);\n}\n.stack-form h3 {\n font-size: var(--t-sm);\n color: var(--fg-dim);\n}\ntd.right {\n text-align: end;\n}\n/* Two fields share a line where there is room and stack where there is not — at 390px a pair of\n * half-width inputs is two inputs nobody can type into. */\n.two-up > .field {\n flex: 1 1 200px;\n}\ntd.right button {\n margin-inline-start: var(--s2);\n}\n</style>\n"],"names":["users","ref","tokens","loaded","listError","newUser","newToken","pwFor","pwValue","revealed","canCreateUser","computed","load","u","t","api","problem","createUser","r","toast","removeUser","changePassword","_a","authState","createToken","removeToken","_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","_hoisted_10","_Fragment","_renderList","_hoisted_11","_unref","_hoisted_12","_hoisted_13","RelativeTime","_hoisted_14","$event","_hoisted_15","ActionButton","_hoisted_16","SkeletonList","_hoisted_17","_hoisted_18","_vModelText","_hoisted_19","_hoisted_20","_hoisted_21","EquivalentCommand","_hoisted_22","_hoisted_23","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","_hoisted_28","_hoisted_29","_hoisted_30","_hoisted_31","_hoisted_32","_Transition","_hoisted_33","_hoisted_34","_hoisted_35","_hoisted_36","_hoisted_37"],"mappings":"qqDA8BA,MAAMA,EAAQC,EAAY,EAAE,EACtBC,EAASD,EAAa,EAAE,EACxBE,EAASF,EAAI,EAAK,EAClBG,EAAYH,EAAI,EAAE,EAElBI,EAAUJ,EAAI,CAAE,SAAU,GAAI,SAAU,GAAI,EAC5CK,EAAWL,EAAI,EAAE,EACjBM,EAAQN,EAAiB,IAAI,EAC7BO,EAAUP,EAAI,EAAE,EAGhBQ,EAAWR,EAA0D,IAAI,EAEzES,EAAgBC,EACpB,IAAMN,EAAQ,MAAM,SAAS,KAAA,EAA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,KAAK,QAAM,WACrB,IAAA,OAkBM,OAlBKrE,EAAA,WAAXmB,EAkBM,MAAA,OAlBY,MAAM,QAAS,yBAAYnB,EAAA,MAAK,KAAA,CAAA,MAAA,CAAA,EAAA,GAChDoB,EAgBM,MAhBNkD,GAgBM,CAfJlD,EAAiD,KAAA,KAA7C,uBAAoBU,EAAG9B,EAAA,MAAM,QAAQ,EAAA,CAAA,EACzCoB,EAGI,IAHJmD,GAAgB,iBACAvE,EAAA,MAAM,OAAOyC,EAAAA,KAAU,OAAVA,YAAAA,EAAgB,kBAAsB,kEAEnE,CAAA,EACArB,EAGQ,QAHRoD,GAGQ,CAFNlD,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAF,EAAyB,YAAnB,eAAY,EAAA,KAClBA,EAAuE,QAAA,sCAAvDnB,EAAO,MAAA6C,GAAE,KAAK,WAAW,aAAa,cAAA,gBAAtC7C,EAAA,KAAO,CAAA,KAEzBmB,EAKM,MALNqD,GAKM,CAJJrD,EAES,SAAA,CAFD,MAAM,UAAW,SAAUnB,EAAA,MAAQ,OAAM,EAAO,QAAOa,CAAA,EAAgB,oBAE/E,EAAA4D,EAAA,EACAtD,EAA2D,SAAA,CAAnD,MAAM,QAAS,uBAAOpB,EAAA,MAAK,KAAA,EAAS,QAAM,CAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{d as k,c as r,a,F as f,
|
|
2
|
-
//# sourceMappingURL=VarEditor.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
import{d as k,c as r,a,F as f,s as h,o as c}from"./index-zMwxPFi6.js";const b=["value","aria-label","onInput"],V=["value","aria-label","onInput"],_=["aria-label","onClick"],x=k({__name:"VarEditor",props:{modelValue:{}},emits:["update:modelValue","change"],setup(d,{emit:p}){const s=d,t=p;function m(u,l){const o=s.modelValue.map((e,n)=>n===u?{...e,...l}:e);t("update:modelValue",o),t("change")}function i(){t("update:modelValue",[...s.modelValue,{k:"",v:""}]),t("change")}function v(u){const l=s.modelValue.filter((o,e)=>e!==u);t("update:modelValue",l.length?l:[{k:"",v:""}]),t("change")}return(u,l)=>(c(),r("div",null,[l[0]||(l[0]=a("div",{class:"kv head"},[a("span",null,"name"),a("span",null,"value"),a("span")],-1)),(c(!0),r(f,null,h(d.modelValue,(o,e)=>(c(),r("div",{key:e,class:"kv"},[a("input",{type:"text",value:o.k,"aria-label":`variable name ${e+1}`,placeholder:"PR",spellcheck:"false",autocomplete:"off",onInput:n=>m(e,{k:n.target.value.trim()})},null,40,b),a("input",{type:"text",value:o.v,"aria-label":`variable value ${e+1}`,placeholder:"7",spellcheck:"false",autocomplete:"off",onInput:n=>m(e,{v:n.target.value})},null,40,V),a("button",{class:"sm ghost","aria-label":`remove variable ${e+1}`,onClick:n=>v(e)},"−",8,_)]))),128)),a("button",{class:"sm",onClick:i},"+ variable")]))}});export{x as _};
|
|
2
|
+
//# sourceMappingURL=VarEditor.vue_vue_type_script_setup_true_lang-CDXij21z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VarEditor.vue_vue_type_script_setup_true_lang-
|
|
1
|
+
{"version":3,"file":"VarEditor.vue_vue_type_script_setup_true_lang-CDXij21z.js","sources":["../../src/components/VarEditor.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The free-form variable editor, shared by the Config tab and Submit.\n *\n * Free-form on purpose: the spec's `env:` block lists what it DECLARES, which is not the same as\n * what it NEEDS — `stack: pr-${PR}` consumes `PR` without declaring it anywhere. The authoritative\n * list of what is missing is the server's 400 text, not this form.\n */\nimport type { VarPair } from '../api/types';\n\nconst props = defineProps<{ modelValue: VarPair[] }>();\nconst emit = defineEmits<{ 'update:modelValue': [VarPair[]]; change: [] }>();\n\nfunction set(i: number, patch: Partial<VarPair>): void {\n const next = props.modelValue.map((e, n) => (n === i ? { ...e, ...patch } : e));\n emit('update:modelValue', next);\n emit('change');\n}\n\nfunction add(): void {\n emit('update:modelValue', [...props.modelValue, { k: '', v: '' }]);\n emit('change');\n}\n\nfunction remove(i: number): void {\n const next = props.modelValue.filter((_, n) => n !== i);\n // Never leave the editor with no rows: an empty list looks like a broken control.\n emit('update:modelValue', next.length ? next : [{ k: '', v: '' }]);\n emit('change');\n}\n</script>\n\n<template>\n <div>\n <div class=\"kv head\"><span>name</span><span>value</span><span /></div>\n <div v-for=\"(e, i) in modelValue\" :key=\"i\" class=\"kv\">\n <input\n type=\"text\"\n :value=\"e.k\"\n :aria-label=\"`variable name ${i + 1}`\"\n placeholder=\"PR\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n @input=\"set(i, { k: ($event.target as HTMLInputElement).value.trim() })\"\n />\n <input\n type=\"text\"\n :value=\"e.v\"\n :aria-label=\"`variable value ${i + 1}`\"\n placeholder=\"7\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n @input=\"set(i, { v: ($event.target as HTMLInputElement).value })\"\n />\n <button class=\"sm ghost\" :aria-label=\"`remove variable ${i + 1}`\" @click=\"remove(i)\">−</button>\n </div>\n <button class=\"sm\" @click=\"add\">+ variable</button>\n </div>\n</template>\n"],"names":["props","__props","emit","__emit","set","i","patch","next","add","remove","_","n","_createElementBlock","_createElementVNode","_openBlock","_Fragment","_renderList","e","$event","_hoisted_3"],"mappings":"kRAUA,MAAMA,EAAQC,EACRC,EAAOC,EAEb,SAASC,EAAIC,EAAWC,EAA+B,CACrD,MAAMC,EAAOP,EAAM,WAAW,IAAI,CAAC,EAAG,IAAO,IAAMK,EAAI,CAAE,GAAG,EAAG,GAAGC,CAAA,EAAU,CAAE,EAC9EJ,EAAK,oBAAqBK,CAAI,EAC9BL,EAAK,QAAQ,CACf,CAEA,SAASM,GAAY,CACnBN,EAAK,oBAAqB,CAAC,GAAGF,EAAM,WAAY,CAAE,EAAG,GAAI,EAAG,EAAA,CAAI,CAAC,EACjEE,EAAK,QAAQ,CACf,CAEA,SAASO,EAAOJ,EAAiB,CAC/B,MAAME,EAAOP,EAAM,WAAW,OAAO,CAACU,EAAGC,IAAMA,IAAMN,CAAC,EAEtDH,EAAK,oBAAqBK,EAAK,OAASA,EAAO,CAAC,CAAE,EAAG,GAAI,EAAG,EAAA,CAAI,CAAC,EACjEL,EAAK,QAAQ,CACf,mBAIEU,EAwBM,MAAA,KAAA,aAvBJC,EAAsE,MAAA,CAAjE,MAAM,WAAS,CAACA,EAAiB,YAAX,MAAI,EAAOA,EAAkB,YAAZ,OAAK,EAAOA,EAAQ,MAAA,CAAA,QAChEC,EAAA,EAAA,EAAAF,EAoBMG,EAAA,KAAAC,EApBgBf,EAAA,WAAU,CAAnBgB,EAAGZ,SAAhBO,EAoBM,MAAA,CApB6B,IAAKP,EAAG,MAAM,IAAA,GAC/CQ,EAQE,QAAA,CAPA,KAAK,OACJ,MAAOI,EAAE,EACT,8BAA6BZ,EAAC,CAAA,GAC/B,YAAY,KACZ,WAAW,QACX,aAAa,MACZ,QAAKa,GAAEd,EAAIC,EAAC,CAAA,EAAQa,EAAO,OAA4B,MAAM,MAAI,CAAA,CAAA,aAEpEL,EAQE,QAAA,CAPA,KAAK,OACJ,MAAOI,EAAE,EACT,+BAA8BZ,EAAC,CAAA,GAChC,YAAY,IACZ,WAAW,QACX,aAAa,MACZ,QAAKa,GAAEd,EAAIC,KAASa,EAAO,OAA4B,KAAA,CAAK,CAAA,aAE/DL,EAA+F,SAAA,CAAvF,MAAM,WAAY,gCAA+BR,EAAC,CAAA,GAAS,QAAKa,GAAET,EAAOJ,CAAC,CAAA,EAAG,IAAC,EAAAc,CAAA,CAAA,WAExFN,EAAmD,SAAA,CAA3C,MAAM,KAAM,QAAOL,CAAA,EAAK,YAAU,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_commonjsHelpers-CqkleIqs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_plugin-vue_export-helper-DlAUqK2U.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{g}from"./_commonjsHelpers-CqkleIqs.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
|
|
2
|
+
//# sourceMappingURL=addon-fit-CevVMrUA.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addon-fit-CevVMrUA.js","sources":["../../../../node_modules/.bun/@xterm+addon-fit@0.10.0+c27fd418321dfbfb/node_modules/@xterm/addon-fit/lib/addon-fit.js"],"sourcesContent":["!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports.FitAddon=t():e.FitAddon=t()}(self,(()=>(()=>{\"use strict\";var e={};return(()=>{var t=e;Object.defineProperty(t,\"__esModule\",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const t=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal)return;if(!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,t=e._renderService.dimensions;if(0===t.css.cell.width||0===t.css.cell.height)return;const r=0===this._terminal.options.scrollback?0:e.viewport.scrollBarWidth,i=window.getComputedStyle(this._terminal.element.parentElement),o=parseInt(i.getPropertyValue(\"height\")),s=Math.max(0,parseInt(i.getPropertyValue(\"width\"))),n=window.getComputedStyle(this._terminal.element),l=o-(parseInt(n.getPropertyValue(\"padding-top\"))+parseInt(n.getPropertyValue(\"padding-bottom\"))),a=s-(parseInt(n.getPropertyValue(\"padding-right\"))+parseInt(n.getPropertyValue(\"padding-left\")))-r;return{cols:Math.max(2,Math.floor(a/t.css.cell.width)),rows:Math.max(1,Math.floor(l/t.css.cell.height))}}}})(),e})()));\n//# sourceMappingURL=addon-fit.js.map"],"names":["e","module","t","r","i","o","s","l","a"],"mappings":"qcAAC,SAASA,EAAE,EAAE,CAAmDC,EAAA,QAAe,EAAC,CAAkH,GAAE,MAAM,KAAK,IAAI,CAAc,IAAID,EAAE,GAAG,OAAO,IAAI,CAAC,IAAI,EAAEA,EAAE,OAAO,eAAe,EAAE,aAAa,CAAC,MAAM,EAAE,CAAC,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