@samyx/preview-stacks-ui 0.25.2 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{ActionButton.vue_vue_type_script_setup_true_lang-D5wrEmB2.js → ActionButton.vue_vue_type_script_setup_true_lang-B0qf7_XI.js} +2 -2
- package/dist/assets/{ActionButton.vue_vue_type_script_setup_true_lang-D5wrEmB2.js.map → ActionButton.vue_vue_type_script_setup_true_lang-B0qf7_XI.js.map} +1 -1
- package/dist/assets/{AxesTab-DPb0krkI.js → AxesTab-BxVd_LDI.js} +2 -2
- package/dist/assets/{AxesTab-DPb0krkI.js.map → AxesTab-BxVd_LDI.js.map} +1 -1
- package/dist/assets/{ConfigTab-DLhjDiis.js → ConfigTab-DSHTlGAK.js} +2 -2
- package/dist/assets/{ConfigTab-DLhjDiis.js.map → ConfigTab-DSHTlGAK.js.map} +1 -1
- package/dist/assets/ConflictNote.vue_vue_type_script_setup_true_lang-R1IfGYYT.js +2 -0
- package/dist/assets/ConflictNote.vue_vue_type_script_setup_true_lang-R1IfGYYT.js.map +1 -0
- package/dist/assets/DangerTab-BZ5e4YGe.js +2 -0
- package/dist/assets/DangerTab-BZ5e4YGe.js.map +1 -0
- package/dist/assets/{DashboardView-DxZUkxRF.js → DashboardView-TYfDe8IH.js} +2 -2
- package/dist/assets/{DashboardView-DxZUkxRF.js.map → DashboardView-TYfDe8IH.js.map} +1 -1
- package/dist/assets/DeploymentDetailView-RSDMb2tC.js +2 -0
- package/dist/assets/DeploymentDetailView-RSDMb2tC.js.map +1 -0
- package/dist/assets/DeploymentsView-DYAPYBih.js +2 -0
- package/dist/assets/DeploymentsView-DYAPYBih.js.map +1 -0
- package/dist/assets/{EquivalentCommand-C45BzkNz.js → EquivalentCommand-GFG6rkn5.js} +3 -3
- package/dist/assets/{EquivalentCommand-C45BzkNz.js.map → EquivalentCommand-GFG6rkn5.js.map} +1 -1
- package/dist/assets/{ErrorNote.vue_vue_type_script_setup_true_lang-B3hfwyPR.js → ErrorNote.vue_vue_type_script_setup_true_lang-DNaY6OBe.js} +2 -2
- package/dist/assets/{ErrorNote.vue_vue_type_script_setup_true_lang-B3hfwyPR.js.map → ErrorNote.vue_vue_type_script_setup_true_lang-DNaY6OBe.js.map} +1 -1
- package/dist/assets/HelpModal.vue_vue_type_script_setup_true_lang-DEjnzS2A.js +2 -0
- package/dist/assets/{HelpModal.vue_vue_type_script_setup_true_lang-BSOuxyyP.js.map → HelpModal.vue_vue_type_script_setup_true_lang-DEjnzS2A.js.map} +1 -1
- package/dist/assets/JobDetailView-DvFGqRQj.js +2 -0
- package/dist/assets/{JobDetailView-HFOJln2b.js.map → JobDetailView-DvFGqRQj.js.map} +1 -1
- package/dist/assets/{JobsView-dWw_uNGE.js → JobsView-C-rxx15K.js} +2 -2
- package/dist/assets/{JobsView-dWw_uNGE.js.map → JobsView-C-rxx15K.js.map} +1 -1
- package/dist/assets/{LogViewer.vue_vue_type_script_setup_true_lang-5r84oNls.js → LogViewer.vue_vue_type_script_setup_true_lang-6CJlo0ox.js} +3 -3
- package/dist/assets/{LogViewer.vue_vue_type_script_setup_true_lang-5r84oNls.js.map → LogViewer.vue_vue_type_script_setup_true_lang-6CJlo0ox.js.map} +1 -1
- package/dist/assets/LoginView-CAXL0Xhr.js +2 -0
- package/dist/assets/LoginView-CAXL0Xhr.js.map +1 -0
- package/dist/assets/LoginView-Djedwklv.css +1 -0
- package/dist/assets/LogsTab-Bzz4JBQM.js +6 -0
- package/dist/assets/LogsTab-Bzz4JBQM.js.map +1 -0
- package/dist/assets/{NotFoundView-jZIc0wDm.js → NotFoundView-BRn9Jn4H.js} +2 -2
- package/dist/assets/{NotFoundView-jZIc0wDm.js.map → NotFoundView-BRn9Jn4H.js.map} +1 -1
- package/dist/assets/{NotifiersView-DJu-c-a6.js → NotifiersView-Bd13G-1b.js} +2 -2
- package/dist/assets/{NotifiersView-DJu-c-a6.js.map → NotifiersView-Bd13G-1b.js.map} +1 -1
- package/dist/assets/OverviewTab-Ae5-H5DV.js +2 -0
- package/dist/assets/OverviewTab-Ae5-H5DV.js.map +1 -0
- package/dist/assets/PublicLogsView-BAe90EbI.css +1 -0
- package/dist/assets/PublicLogsView-DvCE0GT1.js +4 -0
- package/dist/assets/PublicLogsView-DvCE0GT1.js.map +1 -0
- package/dist/assets/{RefreshButton.vue_vue_type_script_setup_true_lang-CXCY3Vlc.js → RefreshButton.vue_vue_type_script_setup_true_lang-DpeOKN8U.js} +2 -2
- package/dist/assets/{RefreshButton.vue_vue_type_script_setup_true_lang-CXCY3Vlc.js.map → RefreshButton.vue_vue_type_script_setup_true_lang-DpeOKN8U.js.map} +1 -1
- package/dist/assets/RegistriesView-ZRRfxVTX.js +2 -0
- package/dist/assets/{RegistriesView-BeiFx468.js.map → RegistriesView-ZRRfxVTX.js.map} +1 -1
- package/dist/assets/{RelativeTime.vue_vue_type_script_setup_true_lang-BGissyps.js → RelativeTime.vue_vue_type_script_setup_true_lang-Dm9XnXF7.js} +2 -2
- package/dist/assets/{RelativeTime.vue_vue_type_script_setup_true_lang-BGissyps.js.map → RelativeTime.vue_vue_type_script_setup_true_lang-Dm9XnXF7.js.map} +1 -1
- package/dist/assets/{RequiresTab-Bb3_lYqC.js → RequiresTab-CLfNJHOh.js} +2 -2
- package/dist/assets/{RequiresTab-Bb3_lYqC.js.map → RequiresTab-CLfNJHOh.js.map} +1 -1
- package/dist/assets/{RoutingView-y8L_ex2z.js → RoutingView-BCsr0bjm.js} +3 -3
- package/dist/assets/{RoutingView-y8L_ex2z.js.map → RoutingView-BCsr0bjm.js.map} +1 -1
- package/dist/assets/RuntimeTab-CeJS5wuv.js +2 -0
- package/dist/assets/RuntimeTab-CeJS5wuv.js.map +1 -0
- package/dist/assets/SelectMenu.vue_vue_type_script_setup_true_lang-BLfPhhAj.js +2 -0
- package/dist/assets/{SelectMenu.vue_vue_type_script_setup_true_lang-D8NGgBfa.js.map → SelectMenu.vue_vue_type_script_setup_true_lang-BLfPhhAj.js.map} +1 -1
- package/dist/assets/{SettingsView-C-xJVgVw.js → SettingsView-Bo-SQP0q.js} +2 -2
- package/dist/assets/{SettingsView-C-xJVgVw.js.map → SettingsView-Bo-SQP0q.js.map} +1 -1
- package/dist/assets/{SkeletonList.vue_vue_type_script_setup_true_lang-qMyLRAMp.js → SkeletonList.vue_vue_type_script_setup_true_lang-DjfNq2KM.js} +2 -2
- package/dist/assets/{SkeletonList.vue_vue_type_script_setup_true_lang-qMyLRAMp.js.map → SkeletonList.vue_vue_type_script_setup_true_lang-DjfNq2KM.js.map} +1 -1
- package/dist/assets/SpecDetailView-C68gpDhO.js +2 -0
- package/dist/assets/{SpecDetailView-CGQZS7NU.js.map → SpecDetailView-C68gpDhO.js.map} +1 -1
- package/dist/assets/{SpecsView-D9mKql2j.js → SpecsView-mr3zSd-0.js} +2 -2
- package/dist/assets/{SpecsView-D9mKql2j.js.map → SpecsView-mr3zSd-0.js.map} +1 -1
- package/dist/assets/SsoView-D2yf-noE.js +2 -0
- package/dist/assets/SsoView-D2yf-noE.js.map +1 -0
- package/dist/assets/{StateBadge.vue_vue_type_script_setup_true_lang-BgbZLzlL.js → StateBadge.vue_vue_type_script_setup_true_lang-BqldkWlT.js} +2 -2
- package/dist/assets/{StateBadge.vue_vue_type_script_setup_true_lang-BgbZLzlL.js.map → StateBadge.vue_vue_type_script_setup_true_lang-BqldkWlT.js.map} +1 -1
- package/dist/assets/{SubmitView-DuGtFMgF.js → SubmitView-Cdxo6Chq.js} +5 -5
- package/dist/assets/{SubmitView-DuGtFMgF.js.map → SubmitView-Cdxo6Chq.js.map} +1 -1
- package/dist/assets/SwarmView-DVKI5lNe.js +2 -0
- package/dist/assets/SwarmView-DVKI5lNe.js.map +1 -0
- package/dist/assets/Teleport-BUn4ayOo.js +4 -0
- package/dist/assets/{Teleport-DfE2iP8c.js.map → Teleport-BUn4ayOo.js.map} +1 -1
- package/dist/assets/TerminalTab-BRumgZMI.js +3 -0
- package/dist/assets/{TerminalTab-D5ncE4Cv.js.map → TerminalTab-BRumgZMI.js.map} +1 -1
- package/dist/assets/{UsersView-BxU2ho4N.js → UsersView-B7C2Bc3R.js} +2 -2
- package/dist/assets/{UsersView-BxU2ho4N.js.map → UsersView-B7C2Bc3R.js.map} +1 -1
- package/dist/assets/{VarEditor.vue_vue_type_script_setup_true_lang-SKwJUsNC.js → VarEditor.vue_vue_type_script_setup_true_lang-CyOlKVt5.js} +2 -2
- package/dist/assets/{VarEditor.vue_vue_type_script_setup_true_lang-SKwJUsNC.js.map → VarEditor.vue_vue_type_script_setup_true_lang-CyOlKVt5.js.map} +1 -1
- package/dist/assets/{VariablesView-BnW2I-92.js → VariablesView-UCBhNd_o.js} +2 -2
- package/dist/assets/{VariablesView-BnW2I-92.js.map → VariablesView-UCBhNd_o.js.map} +1 -1
- package/dist/assets/index-9Ra4jfL4.js +149 -0
- package/dist/assets/index-9Ra4jfL4.js.map +1 -0
- package/dist/assets/index-B_k9b7xG.css +1 -0
- package/dist/assets/useDeployment-DFOIiXrd.js +2 -0
- package/dist/assets/useDeployment-DFOIiXrd.js.map +1 -0
- package/dist/assets/useFormat-DIlTY5Dl.js +2 -0
- package/dist/assets/useFormat-DIlTY5Dl.js.map +1 -0
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/ConflictNote.vue_vue_type_script_setup_true_lang-HglPeTkY.js +0 -2
- package/dist/assets/ConflictNote.vue_vue_type_script_setup_true_lang-HglPeTkY.js.map +0 -1
- package/dist/assets/DangerTab-BLDIlbN5.js +0 -2
- package/dist/assets/DangerTab-BLDIlbN5.js.map +0 -1
- package/dist/assets/DeploymentDetailView-CEg8sA5I.js +0 -2
- package/dist/assets/DeploymentDetailView-CEg8sA5I.js.map +0 -1
- package/dist/assets/DeploymentsView-BfhwFiiQ.js +0 -2
- package/dist/assets/DeploymentsView-BfhwFiiQ.js.map +0 -1
- package/dist/assets/HelpModal.vue_vue_type_script_setup_true_lang-BSOuxyyP.js +0 -2
- package/dist/assets/JobDetailView-HFOJln2b.js +0 -2
- package/dist/assets/LoginView-0vIrAhlr.js +0 -2
- package/dist/assets/LoginView-0vIrAhlr.js.map +0 -1
- package/dist/assets/LoginView-BFIG7vGw.css +0 -1
- package/dist/assets/LogsTab-CFlgBsW3.js +0 -6
- package/dist/assets/LogsTab-CFlgBsW3.js.map +0 -1
- package/dist/assets/OverviewTab-DlJt0MIg.js +0 -2
- package/dist/assets/OverviewTab-DlJt0MIg.js.map +0 -1
- package/dist/assets/RegistriesView-BeiFx468.js +0 -2
- package/dist/assets/RuntimeTab-DWZ5eFho.js +0 -2
- package/dist/assets/RuntimeTab-DWZ5eFho.js.map +0 -1
- package/dist/assets/SelectMenu.vue_vue_type_script_setup_true_lang-D8NGgBfa.js +0 -2
- package/dist/assets/SpecDetailView-CGQZS7NU.js +0 -2
- package/dist/assets/Teleport-DfE2iP8c.js +0 -4
- package/dist/assets/TerminalTab-D5ncE4Cv.js +0 -3
- package/dist/assets/index-DVMQBHXF.js +0 -139
- package/dist/assets/index-DVMQBHXF.js.map +0 -1
- package/dist/assets/index-lyuEu6lW.css +0 -1
- package/dist/assets/useDeployment-DGzBsXE-.js +0 -2
- package/dist/assets/useDeployment-DGzBsXE-.js.map +0 -1
- package/dist/assets/useFormat-DVXTfIS-.js +0 -2
- package/dist/assets/useFormat-DVXTfIS-.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubmitView-DuGtFMgF.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';\nimport SelectMenu from '../components/SelectMenu.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[]>([]);\n\n/** `— choose —` stays first: an empty value is a real state here, not a placeholder. */\nconst specOptions = computed(() => [\n { value: '', label: '— choose —' },\n ...specs.value.map((s) => ({ value: s.name, label: s.name, hint: s.kind })),\n]);\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\n/**\n * The preview domain, guessed from where this page is served.\n *\n * The UI lives on a host UNDER the preview domain (ui.preview.example.com, pstack.preview…), so\n * previews live beside it: drop this page's own first label and that is the base every generated\n * hostname hangs off. localhost and bare IPs have no domain to offer — those keep an honest\n * placeholder rather than generating `pr-123.192.168.1.5`.\n */\nfunction detectPreviewDomain(): string {\n const h = location.hostname;\n if (h === 'localhost' || h.endsWith('.localhost') || /^[\\d.]+$/.test(h) || h.includes(':')) {\n return 'preview.example.com';\n }\n const labels = h.split('.');\n return labels.length >= 3 ? labels.slice(1).join('.') : h;\n}\n\n/**\n * Kept as a function of the domain so the example is true on the host it is loaded on — a spec\n * copied from here should deploy without edits, not after find-and-replacing example.com.\n *\n * The compose half uses `pstack.routing.port`, NOT hand-written traefik labels: pstack generates\n * the router, TLS and network wiring from that one label. A bare `traefik.enable=true` is the\n * OPT-OUT signal (any traefik.* label means \"leave my service alone\") — which is what an older\n * version of this example taught, producing a service that was never reachable.\n */\nconst exampleSpec = (domain: string): string => `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 # The base every generated hostname hangs off: the app below is served at\n # app-pr-\\${PR}.${domain}\n PREVIEW_DOMAIN: ${domain}\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 # The ONE label routing needs: pstack generates the Traefik router, TLS and network wiring\n # from it. Writing any traefik.* label yourself is the opt-out — pstack then leaves the\n # service entirely alone, so only do that when you need something the shorthand cannot say.\n - pstack.routing.port=80\n`;\n\nfunction loadExample(): void {\n source.value = 'inline';\n form.value.spec = exampleSpec(detectPreviewDomain());\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 <!-- The \"nothing saved until valid\" reassurance lives beside the Submit button below — the\n moment of commitment is where a guarantee about committing belongs, not floating above\n an unrelated id field. -->\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 <SelectMenu v-model=\"specName\" id=\"sn\" label=\"Stored spec\" :options=\"specOptions\" />\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=\"12\"\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=\"6\"\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=\"mute\" style=\"font-size: var(--t-sm)\">\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\n is shared or isolated comes from the spec, not from this form.\n </InfoHint>\n </span>\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_COMPOSE","props","__props","form","ref","vars","source","specName","submitting","error","result","specs","specOptions","computed","api","r","chosenSpec","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","detectPreviewDomain","h","labels","exampleSpec","domain","loadExample","_createElementBlock","_createElementVNode","_hoisted_1","_toDisplayString","_hoisted_2","_hoisted_3","_openBlock","_hoisted_4","_cache","_Fragment","_createVNode","_component_RouterLink","_normalizeClass","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","$event","_hoisted_12","InfoHint","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","SelectMenu","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_21","_vModelText","_hoisted_22","_hoisted_23","VarEditor","_hoisted_24","_hoisted_25","ActionButton","_hoisted_26","_hoisted_27","_b","_hoisted_28","o","i","_createBlock","ErrorNote"],"mappings":"k8CAyRMA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mDA1PxB,MAAMC,EAAQC,EAERC,EAAOC,EAAI,CAAE,GAAIH,EAAM,IAAM,GAAI,KAAM,GAAI,QAAS,EAAA,CAAI,EACxDI,EAAOD,EAAe,CAAC,CAAE,EAAG,GAAI,EAAG,EA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AA,EAAA,EAAAP,EAAiB,YAAX,OAAI,EAAA,mBAAO,+CACjD,EAAA,GAAAO,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAP,EAAmB,YAAb,SAAM,EAAA,mBAAO,qFACd,EAAA,GAAAO,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAP,EAAkB,YAAZ,QAAK,EAAA,mBAAO,oBAChD,EAAA,EAAA,eAGe1C,EAAA,WAAjBoF,EAAqFC,GAAA,OAA5D,KAAMrF,EAAA,MAAO,MAAM,sCAAA"}
|
|
1
|
+
{"version":3,"file":"SubmitView-Cdxo6Chq.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';\nimport SelectMenu from '../components/SelectMenu.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[]>([]);\n\n/** `— choose —` stays first: an empty value is a real state here, not a placeholder. */\nconst specOptions = computed(() => [\n { value: '', label: '— choose —' },\n ...specs.value.map((s) => ({ value: s.name, label: s.name, hint: s.kind })),\n]);\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\n/**\n * The preview domain, guessed from where this page is served.\n *\n * The UI lives on a host UNDER the preview domain (ui.preview.example.com, pstack.preview…), so\n * previews live beside it: drop this page's own first label and that is the base every generated\n * hostname hangs off. localhost and bare IPs have no domain to offer — those keep an honest\n * placeholder rather than generating `pr-123.192.168.1.5`.\n */\nfunction detectPreviewDomain(): string {\n const h = location.hostname;\n if (h === 'localhost' || h.endsWith('.localhost') || /^[\\d.]+$/.test(h) || h.includes(':')) {\n return 'preview.example.com';\n }\n const labels = h.split('.');\n return labels.length >= 3 ? labels.slice(1).join('.') : h;\n}\n\n/**\n * Kept as a function of the domain so the example is true on the host it is loaded on — a spec\n * copied from here should deploy without edits, not after find-and-replacing example.com.\n *\n * The compose half uses `pstack.routing.port`, NOT hand-written traefik labels: pstack generates\n * the router, TLS and network wiring from that one label. A bare `traefik.enable=true` is the\n * OPT-OUT signal (any traefik.* label means \"leave my service alone\") — which is what an older\n * version of this example taught, producing a service that was never reachable.\n */\nconst exampleSpec = (domain: string): string => `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 # The base every generated hostname hangs off: the app below is served at\n # app-pr-\\${PR}.${domain}\n PREVIEW_DOMAIN: ${domain}\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 # The ONE label routing needs: pstack generates the Traefik router, TLS and network wiring\n # from it. Writing any traefik.* label yourself is the opt-out — pstack then leaves the\n # service entirely alone, so only do that when you need something the shorthand cannot say.\n - pstack.routing.port=80\n`;\n\nfunction loadExample(): void {\n source.value = 'inline';\n form.value.spec = exampleSpec(detectPreviewDomain());\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 <!-- The \"nothing saved until valid\" reassurance lives beside the Submit button below — the\n moment of commitment is where a guarantee about committing belongs, not floating above\n an unrelated id field. -->\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 <SelectMenu v-model=\"specName\" id=\"sn\" label=\"Stored spec\" :options=\"specOptions\" />\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=\"12\"\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=\"6\"\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=\"mute\" style=\"font-size: var(--t-sm)\">\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\n is shared or isolated comes from the spec, not from this form.\n </InfoHint>\n </span>\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_COMPOSE","props","__props","form","ref","vars","source","specName","submitting","error","result","specs","specOptions","computed","api","r","chosenSpec","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","detectPreviewDomain","h","labels","exampleSpec","domain","loadExample","_createElementBlock","_createElementVNode","_hoisted_1","_toDisplayString","_hoisted_2","_hoisted_3","_openBlock","_hoisted_4","_cache","_Fragment","_createVNode","_component_RouterLink","_normalizeClass","_hoisted_7","_hoisted_8","_hoisted_9","_hoisted_10","_hoisted_11","$event","_hoisted_12","InfoHint","_hoisted_13","_hoisted_14","_hoisted_15","_hoisted_16","SelectMenu","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_21","_vModelText","_hoisted_22","_hoisted_23","VarEditor","_hoisted_24","_hoisted_25","ActionButton","_hoisted_26","_hoisted_27","_b","_hoisted_28","o","i","_createBlock","ErrorNote"],"mappings":"i8CAyRMA,GAAkB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mDA1PxB,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,EAML,IAAI,EAMRO,EAAQP,EAAgB,EAAE,EAG1BQ,EAAcC,EAAS,IAAM,CACjC,CAAE,MAAO,GAAI,MAAO,YAAA,EACpB,GAAGF,EAAM,MAAM,IAAK,IAAO,CAAE,MAAO,EAAE,KAAM,MAAO,EAAE,KAAM,KAAM,EAAE,MAAO,CAAA,CAC3E,EACIG,EAAI,IAAmB,YAAY,EAAE,KAAMC,GAAM,CAChDA,EAAE,IAAM,MAAM,QAAQA,EAAE,KAAK,KAAK,IAAGJ,EAAM,MAAQI,EAAE,KAAK,MAChE,CAAC,EAED,MAAMC,EAAaH,EAAS,IAAMF,EAAM,MAA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AO,EAAE,CAAA,GAAK,MAAA,CAAA,cAAA,KAAA,CAAA,aAAyB,IAE3F,CAAA,GAAAgD,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAA,GAF2F,WAE3F,EAAA,CAAA,mCAcO+B,GAAA5D,EAAAnB,EAAA,QAAA,YAAAmB,EAAQ,kBAAR,MAAA4D,EAAyB,QAApCjC,IAAAN,EAUM,MAVNwC,GAUM,CATJvC,EAAyE,SAAtE,iDAA8CE,EAAG3C,QAAO,KAAK,EAAG,KAAE,CAAA,EACrEyC,EAOI,IAAA,KAAA,EANFK,EAAA,EAAA,EAAAN,EAGCS,SAH0BjD,EAAA,MAAO,gBAAe,CAA/BiF,EAAGC,kBAAoCD,GAAC,CACxD/B,EACCC,EAAA,CADY,GAAE,gBAAkB,mBAAmB8B,CAAC,CAAA,EAAA,aAAK,IAAO,KAAJA,CAAC,EAAA,CAAA,CAAA,qBACjDC,EAAIlF,EAAA,MAAO,gBAAgB,OAAM,GAA7C8C,EAAA,EAAAN,EAA4D,UAAT,IAAE,yCACvD,yDAAsD,EAAA,GAAAQ,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAP,EAAiB,YAAX,OAAI,EAAA,mBAAO,+CACjD,EAAA,GAAAO,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAP,EAAmB,YAAb,SAAM,EAAA,mBAAO,qFACd,EAAA,GAAAO,EAAA,EAAA,IAAAA,EAAA,EAAA,EAAAP,EAAkB,YAAZ,QAAK,EAAA,mBAAO,oBAChD,EAAA,EAAA,eAGe1C,EAAA,WAAjBoF,EAAqFC,GAAA,OAA5D,KAAMrF,EAAA,MAAO,MAAM,sCAAA"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{d as U,s as E,M as H,c as o,a as e,f as r,e as c,w as k,_ as F,z as w,g as i,t as l,F as y,y as N,r as u,O as S,o as s,D as I,E as D,u as g,n as V,C as P}from"./index-9Ra4jfL4.js";import{s as _}from"./useFormat-DIlTY5Dl.js";import{_ as W}from"./ActionButton.vue_vue_type_script_setup_true_lang-B0qf7_XI.js";import{_ as A}from"./ErrorNote.vue_vue_type_script_setup_true_lang-DNaY6OBe.js";import{_ as M}from"./HelpModal.vue_vue_type_script_setup_true_lang-DEjnzS2A.js";import{_ as q}from"./RefreshButton.vue_vue_type_script_setup_true_lang-DpeOKN8U.js";import{_ as z}from"./SelectMenu.vue_vue_type_script_setup_true_lang-BLfPhhAj.js";import{_ as G}from"./SkeletonList.vue_vue_type_script_setup_true_lang-DjfNq2KM.js";import"./Teleport-BUn4ayOo.js";const L={class:"page-head"},J={class:"sub"},K={key:2,class:"panel"},Q={class:"phead"},X={key:0,class:"mute",style:{"font-size":"var(--t-sm)"}},Y={class:"mono"},Z={key:0,class:"banner warn"},ee={key:1,class:"banner plain"},te={key:0,class:"banner warn"},ae={class:"mono"},se={key:1,class:"cards"},oe={class:"stagger"},ne={class:"name","data-label":"hostname"},le={key:0,class:"badge info",title:"the node this control plane runs on"},re={"data-label":"role"},ie={key:0,class:"mute",style:{"font-size":"var(--t-sm)"}},de={"data-label":"status"},ue={"data-label":"availability"},me={"data-label":"engine",class:"mono"},ve={"data-label":"id",class:"mono mute"},he={key:2,class:"mute"},ce={key:3,class:"panel"},pe={class:"kvlist",style:{"margin-bottom":"var(--s4)"}},be={class:"k mono"},fe={class:"v mute"},ke={class:"row",style:{"flex-wrap":"wrap",gap:"var(--s3)","align-items":"flex-end"}},we={class:"field inline"},ye={key:0,class:"field inline"},ge={class:"mute",style:{"font-size":"var(--t-sm)"}},_e={key:1,class:"banner leaked",style:{"margin-top":"var(--s3)"}},xe={class:"code",style:{"white-space":"pre-wrap","word-break":"break-all","max-height":"50vh",overflow:"auto"}},je={class:"row"},Oe=U({__name:"SwarmView",setup(Te){const n=u(null),p=u(""),x=u(!1);async function j(){const d=await V.get("/api/swarm");if(x.value=!0,!d.ok){p.value=P(d,"read the swarm");return}p.value="",n.value={...d.body,nodes:d.body.nodes??[],ports:d.body.ports??[]}}E(j,1e4);const v=u("command"),f=u("ubuntu"),m=u(""),b=u(!1),h=u(""),T=[{value:"command",label:"docker swarm join …",blurb:"One line, for a machine that already runs Docker."},{value:"script",label:"Shell script",blurb:"Installs Docker if missing (get.docker.com), then joins."},{value:"cloud-config",label:"cloud-config",blurb:"User-data for a fresh cloud machine: Docker from the distro, then join."},{value:"token",label:"Token only",blurb:"The bare join token, for your own tooling."}];async function B(){b.value=!0,h.value="",m.value="";const d=`format=${v.value}${v.value==="cloud-config"?`&distro=${encodeURIComponent(f.value)}`:""}`,t=await V.getText(`/api/swarm/join?${d}`);if(b.value=!1,t.status===403){h.value="The join token is admin-only. Sign in as an admin, or use the machine token.";return}if(t.status===409){h.value="This host is not a swarm manager, so there is nothing to join. Nothing was revealed.";return}if(!t.ok){h.value=t.text||`HTTP ${t.status}`;return}m.value=t.text}async function O(){try{await navigator.clipboard.writeText(m.value),S("ok","Copied.")}catch{S("error","Could not reach the clipboard — select the text and copy it.")}}return H(()=>{m.value=""}),(d,t)=>{var C,$;return s(),o("div",null,[e("div",L,[e("div",null,[e("h1",null,[t[4]||(t[4]=r(" Swarm ",-1)),c(M,{title:"How swarm mode works"},{default:k(()=>[...t[3]||(t[3]=[e("p",null,[e("b",null,"This host is the manager."),r(" Previews deploy as swarm stacks — the compose file you submit is converted on every deploy (profiles resolved, "),e("code",null,"restart"),r(" and limits moved under "),e("code",null,"deploy"),r(", Traefik labels onto the service) — and their tasks run on whichever node has room. ")],-1),e("p",null,[e("b",null,"A worker is one command away."),r(" Open the ports below between the machines, run the join material on the new one, and it appears in this table. Nothing else on this host changes: the control plane stays here, the axes and the leak gate never cared which node a container landed on. ")],-1),e("p",null,[e("b",null,"What a worker cannot do."),r(" A shell and stop/start reach only tasks on this node (docker's verbs are node-local); logs reach every node through the manager. A volume a task creates on a worker stays there when the stack is torn down — use named volumes only for data you can lose, and an axis for data you cannot. ")],-1)])]),_:1})]),e("div",J,[t[6]||(t[6]=r(" The nodes previews run on, and how to add one ",-1)),c(F,{label:"where this comes from"},{default:k(()=>[...t[5]||(t[5]=[e("code",null,"docker node ls",-1),r(" on this host, every ten seconds. Nothing is stored — a node that leaves disappears from here the moment docker stops listing it. ",-1)])]),_:1})])]),t[7]||(t[7]=e("span",{class:"grow"},null,-1)),c(q,{run:j})]),p.value?(s(),w(A,{key:0,text:p.value,title:"Could not read the swarm."},null,8,["text"])):i("",!0),!x.value&&!p.value?(s(),w(G,{key:1,rows:4})):n.value?(s(),o("section",K,[e("div",Q,[t[9]||(t[9]=e("h2",{class:"section"},"Nodes",-1)),t[10]||(t[10]=e("span",{class:"grow"},null,-1)),n.value.active&&n.value.managerAddr?(s(),o("span",X,[t[8]||(t[8]=r(" manager ",-1)),e("span",Y,l(n.value.managerAddr),1)])):i("",!0)]),n.value.reachable?n.value.active?(s(),o(y,{key:2},[n.value.error?(s(),o("div",te,[t[13]||(t[13]=e("b",null,"Docker reported a problem.",-1)),e("p",ae,l(n.value.error),1)])):i("",!0),n.value.nodes.length?(s(),o("table",se,[t[14]||(t[14]=e("thead",null,[e("tr",null,[e("th",null,"Hostname"),e("th",null,"Role"),e("th",null,"Status"),e("th",null,"Availability"),e("th",null,"Engine"),e("th",null,"Id")])],-1)),e("tbody",oe,[(s(!0),o(y,null,N(n.value.nodes,(a,R)=>(s(),o("tr",{key:a.id,style:I({"--i":R})},[e("td",ne,[r(l(a.hostname||"—")+" ",1),a.self?(s(),o("span",le,"this node")):i("",!0)]),e("td",re,[e("span",{class:D(["badge",a.role==="manager"?"isolated":""])},l(g(_)(a.role)),3),a.managerStatus?(s(),o("span",ie,l(a.managerStatus),1)):i("",!0)]),e("td",de,[e("span",{class:D(a.status==="ready"?"s-ok":"s-failed")},l(g(_)(a.status)),3)]),e("td",ue,l(g(_)(a.availability||"unknown")),1),e("td",me,l(a.engineVersion||"—"),1),e("td",ve,l(a.id.slice(0,12)),1)],4))),128))])])):(s(),o("p",he,"Docker lists no nodes — on a manager that should at least be this one."))],64)):(s(),o("div",ee,[t[12]||(t[12]=e("b",null,"Not a swarm manager.",-1)),e("p",null,l(n.value.note),1)])):(s(),o("div",Z,[...t[11]||(t[11]=[e("b",null,"Docker did not answer.",-1),e("p",null,"Nothing about the swarm is known right now — which is not the same as there being no swarm.",-1)])]))])):i("",!0),(C=n.value)!=null&&C.active?(s(),o("section",ce,[t[20]||(t[20]=e("div",{class:"phead"},[e("h2",{class:"section"},"Add a worker")],-1)),t[21]||(t[21]=e("p",{class:"dim"}," Open these between the new machine and every other node first — a worker that cannot reach them joins and then never receives a task. ",-1)),e("ul",pe,[(s(!0),o(y,null,N(n.value.ports,a=>(s(),o("li",{key:a.port},[e("span",be,l(a.port),1),e("span",fe,l(a.why),1)]))),128))]),e("div",ke,[e("div",we,[t[15]||(t[15]=e("label",{for:"join-format"},"Give me",-1)),c(z,{id:"join-format","model-value":v.value,label:"What to reveal",options:T.map(a=>({value:a.value,label:a.label})),"onUpdate:modelValue":t[0]||(t[0]=a=>v.value=a)},null,8,["model-value","options"])]),v.value==="cloud-config"?(s(),o("div",ye,[t[16]||(t[16]=e("label",{for:"join-distro"},"Distro",-1)),c(z,{id:"join-distro",modelValue:f.value,"onUpdate:modelValue":t[1]||(t[1]=a=>f.value=a),label:"Which Docker install steps",options:["ubuntu","debian","fedora","suse","arch","alpine"].map(a=>({value:a,label:a}))},null,8,["modelValue","options"])])):i("",!0),c(W,{variant:"primary",pending:b.value,disabled:b.value,onClick:B},{default:k(()=>[...t[17]||(t[17]=[r(" Reveal ",-1)])]),_:1},8,["pending","disabled"]),e("span",ge,l(($=T.find(a=>a.value===v.value))==null?void 0:$.blurb),1)]),h.value?(s(),w(A,{key:0,text:h.value,title:"Nothing was revealed."},null,8,["text"])):i("",!0),m.value?(s(),o("div",_e,[t[18]||(t[18]=e("b",null,"This is a secret — whoever has it can add a node that runs any task here.",-1)),t[19]||(t[19]=e("p",null,[r(" Shown once; it is not stored in this page and is forgotten when you leave. Rotate it on the manager with "),e("code",null,"docker swarm join-token --rotate worker"),r(" if it leaks. ")],-1)),e("pre",xe,l(m.value),1),e("div",je,[e("button",{onClick:O},"Copy"),e("button",{onClick:t[2]||(t[2]=a=>m.value="")},"Hide")])])):i("",!0)])):i("",!0)])}}});export{Oe as default};
|
|
2
|
+
//# sourceMappingURL=SwarmView-DVKI5lNe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwarmView-DVKI5lNe.js","sources":["../../src/views/SwarmView.vue"],"sourcesContent":["<script setup lang=\"ts\">\n/**\n * The swarm this host manages: its nodes, and what a new worker needs to join.\n *\n * Read straight from docker on every refresh — there is no cached node list anywhere (a table of\n * what is running is exactly what AGENTS.md invariant 10 refuses). Three states are kept apart:\n * docker did not answer (nothing is known), this daemon is not a manager (previews run with\n * compose), and active (the node table).\n *\n * THE JOIN TOKEN IS A SECRET. Whoever holds it can add a node that runs any task on the cluster.\n * It is fetched on a click and never by the poll, shown once, held in component state only, and\n * cleared the moment this page is left.\n */\nimport { onBeforeUnmount, ref } from 'vue';\nimport { api, problem } from '../api/client';\nimport type { SwarmInfo } from '../api/types';\nimport { usePolling } from '../composables/usePolling';\nimport { sentence } from '../composables/useFormat';\nimport { toast } from '../composables/useToasts';\nimport ActionButton from '../components/ActionButton.vue';\nimport ErrorNote from '../components/ErrorNote.vue';\nimport HelpModal from '../components/HelpModal.vue';\nimport InfoHint from '../components/InfoHint.vue';\nimport RefreshButton from '../components/RefreshButton.vue';\nimport SelectMenu from '../components/SelectMenu.vue';\nimport SkeletonList from '../components/SkeletonList.vue';\n\nconst info = ref<SwarmInfo | null>(null);\nconst error = ref('');\nconst loaded = ref(false);\n\nasync function load(): Promise<void> {\n const r = await api.get<SwarmInfo>('/api/swarm');\n loaded.value = true;\n if (!r.ok) {\n error.value = problem(r, 'read the swarm');\n return;\n }\n error.value = '';\n info.value = {\n ...r.body,\n nodes: r.body.nodes ?? [],\n ports: r.body.ports ?? [],\n };\n}\nusePolling(load, 10_000);\n\n// ── joining ─────────────────────────────────────────────────────────────────────────────────────\ntype Format = 'token' | 'command' | 'script' | 'cloud-config';\nconst format = ref<Format>('command');\nconst distro = ref('ubuntu');\nconst revealed = ref('');\nconst revealing = ref(false);\nconst joinError = ref('');\n\nconst FORMATS: Array<{ value: Format; label: string; blurb: string }> = [\n { value: 'command', label: 'docker swarm join …', blurb: 'One line, for a machine that already runs Docker.' },\n { value: 'script', label: 'Shell script', blurb: 'Installs Docker if missing (get.docker.com), then joins.' },\n { value: 'cloud-config', label: 'cloud-config', blurb: 'User-data for a fresh cloud machine: Docker from the distro, then join.' },\n { value: 'token', label: 'Token only', blurb: 'The bare join token, for your own tooling.' },\n];\n\nasync function reveal(): Promise<void> {\n revealing.value = true;\n joinError.value = '';\n revealed.value = '';\n const q = `format=${format.value}${format.value === 'cloud-config' ? `&distro=${encodeURIComponent(distro.value)}` : ''}`;\n const r = await api.getText(`/api/swarm/join?${q}`);\n revealing.value = false;\n if (r.status === 403) {\n joinError.value = 'The join token is admin-only. Sign in as an admin, or use the machine token.';\n return;\n }\n if (r.status === 409) {\n joinError.value = 'This host is not a swarm manager, so there is nothing to join. Nothing was revealed.';\n return;\n }\n if (!r.ok) {\n joinError.value = r.text || `HTTP ${r.status}`;\n return;\n }\n revealed.value = r.text;\n}\n\nasync function copy(): Promise<void> {\n try {\n await navigator.clipboard.writeText(revealed.value);\n toast('ok', 'Copied.');\n } catch {\n toast('error', 'Could not reach the clipboard — select the text and copy it.');\n }\n}\n\n// Leaving the page forgets the secret; coming back means asking for it again.\nonBeforeUnmount(() => {\n revealed.value = '';\n});\n</script>\n\n<template>\n <div>\n <div class=\"page-head\">\n <div>\n <h1>\n Swarm\n <HelpModal title=\"How swarm mode works\">\n <p>\n <b>This host is the manager.</b> Previews deploy as swarm stacks — the compose file you\n submit is converted on every deploy (profiles resolved, <code>restart</code> and limits\n moved under <code>deploy</code>, Traefik labels onto the service) — and their tasks run\n on whichever node has room.\n </p>\n <p>\n <b>A worker is one command away.</b> Open the ports below between the machines, run the\n join material on the new one, and it appears in this table. Nothing else on this host\n changes: the control plane stays here, the axes and the leak gate never cared which node\n a container landed on.\n </p>\n <p>\n <b>What a worker cannot do.</b> A shell and stop/start reach only tasks on this node\n (docker's verbs are node-local); logs reach every node through the manager. A volume a\n task creates on a worker stays there when the stack is torn down — use named volumes\n only for data you can lose, and an axis for data you cannot.\n </p>\n </HelpModal>\n </h1>\n <div class=\"sub\">\n The nodes previews run on, and how to add one\n <InfoHint label=\"where this comes from\">\n <code>docker node ls</code> on this host, every ten seconds. Nothing is stored — a node that\n leaves disappears from here the moment docker stops listing it.\n </InfoHint>\n </div>\n </div>\n <span class=\"grow\" />\n <RefreshButton :run=\"load\" />\n </div>\n\n <ErrorNote v-if=\"error\" :text=\"error\" title=\"Could not read the swarm.\" />\n\n <SkeletonList v-if=\"!loaded && !error\" :rows=\"4\" />\n\n <!-- ============================ the cluster ============================ -->\n <section v-else-if=\"info\" class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Nodes</h2>\n <span class=\"grow\" />\n <span v-if=\"info.active && info.managerAddr\" class=\"mute\" style=\"font-size: var(--t-sm)\">\n manager <span class=\"mono\">{{ info.managerAddr }}</span>\n </span>\n </div>\n\n <!-- Three states, never folded: unknown is not \"no nodes\", and not-a-manager is not an error. -->\n <div v-if=\"!info.reachable\" class=\"banner warn\">\n <b>Docker did not answer.</b>\n <p>Nothing about the swarm is known right now — which is not the same as there being no swarm.</p>\n </div>\n <div v-else-if=\"!info.active\" class=\"banner plain\">\n <b>Not a swarm manager.</b>\n <p>{{ info.note }}</p>\n </div>\n <template v-else>\n <div v-if=\"info.error\" class=\"banner warn\">\n <b>Docker reported a problem.</b>\n <p class=\"mono\">{{ info.error }}</p>\n </div>\n <table v-if=\"info.nodes.length\" class=\"cards\">\n <thead>\n <tr>\n <th>Hostname</th>\n <th>Role</th>\n <th>Status</th>\n <th>Availability</th>\n <th>Engine</th>\n <th>Id</th>\n </tr>\n </thead>\n <tbody class=\"stagger\">\n <tr v-for=\"(n, i) in info.nodes\" :key=\"n.id\" :style=\"{ '--i': i }\">\n <td class=\"name\" data-label=\"hostname\">\n {{ n.hostname || '—' }}\n <span v-if=\"n.self\" class=\"badge info\" title=\"the node this control plane runs on\">this node</span>\n </td>\n <td data-label=\"role\">\n <span class=\"badge\" :class=\"n.role === 'manager' ? 'isolated' : ''\">{{ sentence(n.role) }}</span>\n <span v-if=\"n.managerStatus\" class=\"mute\" style=\"font-size: var(--t-sm)\"> {{ n.managerStatus }}</span>\n </td>\n <td data-label=\"status\">\n <span :class=\"n.status === 'ready' ? 's-ok' : 's-failed'\">{{ sentence(n.status) }}</span>\n </td>\n <td data-label=\"availability\">{{ sentence(n.availability || 'unknown') }}</td>\n <td data-label=\"engine\" class=\"mono\">{{ n.engineVersion || '—' }}</td>\n <td data-label=\"id\" class=\"mono mute\">{{ n.id.slice(0, 12) }}</td>\n </tr>\n </tbody>\n </table>\n <p v-else class=\"mute\">Docker lists no nodes — on a manager that should at least be this one.</p>\n </template>\n </section>\n\n <!-- ============================ add a worker ============================ -->\n <section v-if=\"info?.active\" class=\"panel\">\n <div class=\"phead\">\n <h2 class=\"section\">Add a worker</h2>\n </div>\n\n <p class=\"dim\">\n Open these between the new machine and every other node first — a worker that cannot reach\n them joins and then never receives a task.\n </p>\n <ul class=\"kvlist\" style=\"margin-bottom: var(--s4)\">\n <li v-for=\"p in info.ports\" :key=\"p.port\">\n <span class=\"k mono\">{{ p.port }}</span>\n <span class=\"v mute\">{{ p.why }}</span>\n </li>\n </ul>\n\n <div class=\"row\" style=\"flex-wrap: wrap; gap: var(--s3); align-items: flex-end\">\n <div class=\"field inline\">\n <label for=\"join-format\">Give me</label>\n <SelectMenu\n id=\"join-format\"\n :model-value=\"format\"\n label=\"What to reveal\"\n :options=\"FORMATS.map((f) => ({ value: f.value, label: f.label }))\"\n @update:model-value=\"(v) => (format = v as Format)\"\n />\n </div>\n <div v-if=\"format === 'cloud-config'\" class=\"field inline\">\n <label for=\"join-distro\">Distro</label>\n <SelectMenu\n id=\"join-distro\"\n v-model=\"distro\"\n label=\"Which Docker install steps\"\n :options=\"['ubuntu', 'debian', 'fedora', 'suse', 'arch', 'alpine'].map((d) => ({ value: d, label: d }))\"\n />\n </div>\n <ActionButton variant=\"primary\" :pending=\"revealing\" :disabled=\"revealing\" @click=\"reveal\">\n Reveal\n </ActionButton>\n <span class=\"mute\" style=\"font-size: var(--t-sm)\">{{ FORMATS.find((f) => f.value === format)?.blurb }}</span>\n </div>\n\n <ErrorNote v-if=\"joinError\" :text=\"joinError\" title=\"Nothing was revealed.\" />\n\n <div v-if=\"revealed\" class=\"banner leaked\" style=\"margin-top: var(--s3)\">\n <b>This is a secret — whoever has it can add a node that runs any task here.</b>\n <p>\n Shown once; it is not stored in this page and is forgotten when you leave. Rotate it on the\n manager with <code>docker swarm join-token --rotate worker</code> if it leaks.\n </p>\n <pre class=\"code\" style=\"white-space: pre-wrap; word-break: break-all; max-height: 50vh; overflow: auto\">{{ revealed }}</pre>\n <div class=\"row\">\n <button @click=\"copy\">Copy</button>\n <button @click=\"revealed = ''\">Hide</button>\n </div>\n </div>\n </section>\n </div>\n</template>\n"],"names":["info","ref","error","loaded","load","r","api","problem","usePolling","format","distro","revealed","revealing","joinError","FORMATS","reveal","q","copy","toast","onBeforeUnmount","_createElementBlock","_createElementVNode","_hoisted_1","_createVNode","HelpModal","_cache","_hoisted_2","InfoHint","RefreshButton","_createBlock","ErrorNote","SkeletonList","_openBlock","_hoisted_3","_hoisted_4","_hoisted_5","_hoisted_6","_toDisplayString","_Fragment","_hoisted_9","_hoisted_10","_hoisted_11","_hoisted_12","n","i","_hoisted_13","_hoisted_14","_hoisted_15","_normalizeClass","_unref","sentence","_hoisted_16","_hoisted_17","_hoisted_18","_hoisted_19","_hoisted_20","_hoisted_21","_hoisted_8","_hoisted_7","_a","_hoisted_22","_hoisted_23","_renderList","p","_hoisted_24","_hoisted_25","_hoisted_26","_hoisted_27","SelectMenu","f","v","_hoisted_28","$event","d","ActionButton","_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,ax as Be,o as Y,z as J,w as ae,$ as X,D as ke,W as ue,am as Re,g as je}from"./index-9Ra4jfL4.js";function $e(e,t){const n=typeof e=="string"&&!t?`${e}Context`:t,o=Symbol(n);return[u=>{const a=be(o,u);if(a||a===null)return a;throw new Error(`Injection \`${o.toString()}\` not found. Component must be used within ${Array.isArray(e)?`one of the following components: ${e.join(", ")}`:`\`${e}\``}`)},u=>(Ee(o,u),u)]}function T(){let e=document.activeElement;if(e==null)return null;for(;e!=null&&e.shadowRoot!=null&&e.shadowRoot.activeElement!=null;)e=e.shadowRoot.activeElement;return e}function le(e,t,n){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),o.dispatchEvent(s)}function Ue(e){return e==null}function Tt(e,t){var n;const o=se();return F(()=>{o.value=e()},{...t,flush:(n=t==null?void 0:t.flush)!==null&&n!==void 0?n:"sync"}),Se(o)}function Q(e,t){return Ae()?(Pe(e,t),!0):!1}function We(e){let t=!1,n;const o=re(!0);return((...s)=>(t||(n=o.run(()=>e(...s)),t=!0),n))}const _=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const Ke=e=>typeof e<"u",qe=Object.prototype.toString,ze=e=>qe.call(e)==="[object Object]",ee=He();function He(){var e,t,n;return _&&!!(!((e=window)===null||e===void 0||(e=e.navigator)===null||e===void 0)&&e.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((t=window)===null||t===void 0||(t=t.navigator)===null||t===void 0?void 0:t.maxTouchPoints)>2&&/iPad|Macintosh/.test((n=window)===null||n===void 0?void 0:n.navigator.userAgent))}function K(e){return Array.isArray(e)?e:[e]}function Ve(e){return x()}function Ge(e){if(!_)return e;let t=0,n,o;const s=()=>{t-=1,o&&t<=0&&(o.stop(),n=void 0,o=void 0)};return((...r)=>(t+=1,o||(o=re(!0),n=o.run(()=>e(...r))),Q(s),n))}function _t(e,t=1e4){return Oe((n,o)=>{let s=E(e),r;const u=()=>setTimeout(()=>{s=E(e),o()},E(t));return Q(()=>{clearTimeout(r)}),{get(){return n(),s},set(a){s=a,o(),clearTimeout(r),r=u()}}})}function Ye(e,t){Ve()&&we(e,t)}function Je(e,t,n){return P(e,t,{...n,immediate:!0})}const U=_?window:void 0;function N(e){var t;const n=E(e);return(t=n==null?void 0:n.$el)!==null&&t!==void 0?t:n}function ce(...e){const t=(o,s,r,u)=>(o.addEventListener(s,r,u),()=>o.removeEventListener(s,r,u)),n=w(()=>{const o=K(E(e[0])).filter(s=>s!=null);return o.every(s=>typeof s!="string")?o:void 0});return Je(()=>{var o,s;return[(o=(s=n.value)===null||s===void 0?void 0:s.map(r=>N(r)))!==null&&o!==void 0?o:[U].filter(r=>r!=null),K(E(n.value?e[1]:e[0])),K(D(n.value?e[2]:e[1])),E(n.value?e[3]:e[2])]},([o,s,r,u],a,f)=>{if(!(o!=null&&o.length)||!(s!=null&&s.length)||!(r!=null&&r.length))return;const v=ze(u)?{...u}:u,l=o.flatMap(i=>s.flatMap(c=>r.map(d=>t(i,c,d,v))));f(()=>{l.forEach(i=>i())})},{flush:"post"})}function de(){const e=se(!1),t=x();return t&&Ce(()=>{e.value=!0},t),e}function Xe(e){const t=de();return w(()=>(t.value,!!e()))}function Qe(e){return typeof e=="function"?e:typeof e=="string"?t=>t.key===e:Array.isArray(e)?t=>e.includes(t.key):()=>!0}function Ze(...e){let t,n,o={};e.length===3?(t=e[0],n=e[1],o=e[2]):e.length===2?typeof e[1]=="object"?(t=!0,n=e[0],o=e[1]):(t=e[0],n=e[1]):(t=!0,n=e[0]);const{target:s=U,eventName:r="keydown",passive:u=!1,dedupe:a=!1}=o,f=Qe(t);return ce(s,r,l=>{l.repeat&&E(a)||f(l)&&n(l)},u)}function et(e){return JSON.parse(JSON.stringify(e))}function Lt(e,t,n={}){const{window:o=U,...s}=n;let r;const u=Xe(()=>o&&"ResizeObserver"in o),a=()=>{r&&(r.disconnect(),r=void 0)},f=P(w(()=>{const l=E(e);return Array.isArray(l)?l.map(i=>N(i)):[N(l)]}),l=>{if(a(),u.value&&o){r=new ResizeObserver(t);for(const i of l)i&&r.observe(i,s)}},{immediate:!0,flush:"post"}),v=()=>{a(),f()};return Q(v),{isSupported:u,stop:v}}function It(e,t,n,o={}){var s,r;const{clone:u=!1,passive:a=!1,eventName:f,deep:v=!1,defaultValue:l,shouldEmit:i}=o,c=x(),d=n||(c==null?void 0:c.emit)||(c==null||(s=c.$emit)===null||s===void 0?void 0:s.bind(c))||(c==null||(r=c.proxy)===null||r===void 0||(r=r.$emit)===null||r===void 0?void 0:r.bind(c==null?void 0:c.proxy));let y=f;t||(t="modelValue"),y=y||`update:${t.toString()}`;const h=p=>u?typeof u=="function"?u(p):et(p):p,g=()=>Ke(e[t])?h(e[t]):l,m=p=>{i?i(p)&&d(y,p):d(y,p)};if(a){const p=b(g());let S=!1;return P(()=>e[t],A=>{S||(S=!0,p.value=h(A),I(()=>S=!1))}),P(p,A=>{!S&&(A!==e[t]||v)&&m(A)},{deep:v}),p}else return w({get(){return g()},set(p){m(p)}})}function Z(e){return e?e.flatMap(t=>t.type===De?Z(t.children):[t]):[]}const[fe]=$e("ConfigProvider");function q(e){if(e===null||typeof e!="object")return!1;const t=Object.getPrototypeOf(e);return t!==null&&t!==Object.prototype&&Object.getPrototypeOf(t)!==null||Symbol.iterator in e?!1:Symbol.toStringTag in e?Object.prototype.toString.call(e)==="[object Module]":!0}function G(e,t,n=".",o){if(!q(t))return G(e,{},n,o);const s={...t};for(const r of Object.keys(e)){if(r==="__proto__"||r==="constructor")continue;const u=e[r];u!=null&&(o&&o(s,r,u,n)||(Array.isArray(u)&&Array.isArray(s[r])?s[r]=[...u,...s[r]]:q(u)&&q(s[r])?s[r]=G(u,s[r],(n?`${n}.`:"")+r.toString(),o):s[r]=u))}return s}function tt(e){return(...t)=>t.reduce((n,o)=>G(n,o,"",e),{})}const nt=tt(),ot=Ge(()=>{const e=b(new Map),t=b(),n=w(()=>{for(const u of e.value.values())if(u)return!0;return!1}),o=fe({scrollBody:b(!0)});let s=null;const r=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.documentElement.style.removeProperty("--scrollbar-width"),document.body.style.overflow=t.value??"",ee&&(s==null||s()),t.value=void 0};return P(n,(u,a)=>{var i;if(!_)return;if(!u){a&&r();return}t.value===void 0&&(t.value=document.body.style.overflow);const f=window.innerWidth-document.documentElement.clientWidth,v={padding:f,margin:0},l=(i=o.scrollBody)!=null&&i.value?typeof o.scrollBody.value=="object"?nt({padding:o.scrollBody.value.padding===!0?f:o.scrollBody.value.padding,margin:o.scrollBody.value.margin===!0?f:o.scrollBody.value.margin},v):v:{padding:0,margin:0};f>0&&(document.body.style.paddingRight=typeof l.padding=="number"?`${l.padding}px`:String(l.padding),document.body.style.marginRight=typeof l.margin=="number"?`${l.margin}px`:String(l.margin),document.documentElement.style.setProperty("--scrollbar-width",`${f}px`),document.body.style.overflow="hidden"),ee&&(s=ce(document,"touchmove",c=>rt(c),{passive:!1})),I(()=>{n.value&&(document.body.style.pointerEvents="none",document.body.style.overflow="hidden")})},{immediate:!0,flush:"sync"}),e});function Mt(e){const t=Math.random().toString(36).substring(2,7),n=ot();n.value.set(t,e??!1);const o=w({get:()=>n.value.get(t)??!1,set:s=>n.value.set(t,s)});return Ye(()=>{n.value.delete(t)}),o}function ve(e){const t=window.getComputedStyle(e);if(t.overflowX==="scroll"||t.overflowY==="scroll"||t.overflowX==="auto"&&e.clientWidth<e.scrollWidth||t.overflowY==="auto"&&e.clientHeight<e.scrollHeight)return!0;{const n=e.parentNode;return!(n instanceof Element)||n.tagName==="BODY"?!1:ve(n)}}function rt(e){const t=e||window.event,n=t.target;return n instanceof Element&&ve(n)?!1:t.touches.length>1?!0:(t.preventDefault&&t.cancelable&&t.preventDefault(),!1)}function Ft(e){const t=x(),n=t==null?void 0:t.type.emits,o={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${t==null?void 0:t.type.__name}`),n==null||n.forEach(s=>{o[Te(_e(s))]=(...r)=>e(s,...r)}),o}function pe(){const e=x(),t=b(),n=w(()=>o());Le(()=>{n.value!==o()&&Ie(t)});function o(){return t.value&&"$el"in t.value&&["#text","#comment"].includes(t.value.$el.nodeName)?t.value.$el.nextElementSibling:N(t)}const s=Object.assign({},e.exposed),r={};for(const a in e.props)Object.defineProperty(r,a,{enumerable:!0,configurable:!0,get:()=>e.props[a]});if(Object.keys(s).length>0)for(const a in s)Object.defineProperty(r,a,{enumerable:!0,configurable:!0,get:()=>s[a]});Object.defineProperty(r,"$el",{enumerable:!0,configurable:!0,get:()=>e.vnode.el}),e.exposed=r;function u(a){if(t.value=a,!!a&&(Object.defineProperty(r,"$el",{enumerable:!0,configurable:!0,get:()=>a instanceof Element?a:a.$el}),!(a instanceof Element)&&!Object.hasOwn(a,"$el"))){const f=a.$.exposed,v=Object.assign({},r);for(const l in f)Object.defineProperty(v,l,{enumerable:!0,configurable:!0,get:()=>f[l]});e.exposed=v}}return{forwardRef:u,currentRef:t,currentElement:n}}var st=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},M=new WeakMap,k=new WeakMap,R={},z=0,me=function(e){return e&&(e.host||me(e.parentNode))},it=function(e,t){return t.map(function(n){if(e.contains(n))return n;var o=me(n);return o&&e.contains(o)?o:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},at=function(e,t,n,o){var s=it(t,Array.isArray(e)?e:[e]);R[n]||(R[n]=new WeakMap);var r=R[n],u=[],a=new Set,f=new Set(s),v=function(i){!i||a.has(i)||(a.add(i),v(i.parentNode))};s.forEach(v);var l=function(i){!i||f.has(i)||Array.prototype.forEach.call(i.children,function(c){if(a.has(c))l(c);else try{var d=c.getAttribute(o),y=d!==null&&d!=="false",h=(M.get(c)||0)+1,g=(r.get(c)||0)+1;M.set(c,h),r.set(c,g),u.push(c),h===1&&y&&k.set(c,!0),g===1&&c.setAttribute(n,"true"),y||c.setAttribute(o,"true")}catch(m){console.error("aria-hidden: cannot operate on ",c,m)}})};return l(t),a.clear(),z++,function(){u.forEach(function(i){var c=M.get(i)-1,d=r.get(i)-1;M.set(i,c),r.set(i,d),c||(k.has(i)||i.removeAttribute(o),k.delete(i)),d||i.removeAttribute(n)}),z--,z||(M=new WeakMap,M=new WeakMap,k=new WeakMap,R={})}},ut=function(e,t,n){n===void 0&&(n="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),s=st(e);return s?(o.push.apply(o,Array.from(s.querySelectorAll("[aria-live], script"))),at(o,s,n,"aria-hidden")):function(){return null}};function Nt(e){let t;P(()=>N(e),n=>{let o=!1;try{o=!!(n!=null&&n.closest("[popover]:not(:popover-open)"))}catch{}n&&!o?t=ut(n):t&&t()}),ie(()=>{t&&t()})}function xt(e,t="reka"){var s;let n;const o=fe({useId:void 0});return o.useId?n=o.useId():n=(s=Me)==null?void 0:s(),t?`${t}-${n}`:n}function lt(e,t){const n=b(e);function o(r){return t[n.value][r]??n.value}return{state:n,dispatch:r=>{n.value=o(r)}}}function ct(e,t){var g;const n=b({}),o=b("none"),s=b(e),r=e.value?"mounted":"unmounted";let u;const a=((g=t.value)==null?void 0:g.ownerDocument.defaultView)??U,{state:f,dispatch:v}=lt(r,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),l=m=>{var p;if(_){const S=new CustomEvent(m,{bubbles:!1,cancelable:!1});(p=t.value)==null||p.dispatchEvent(S)}};P(e,async(m,p)=>{var A;const S=p!==m;if(await I(),S){const W=o.value,L=j(t.value);m?(v("MOUNT"),l("enter"),L==="none"&&l("after-enter")):L==="none"||L==="undefined"||((A=n.value)==null?void 0:A.display)==="none"?(v("UNMOUNT"),l("leave"),l("after-leave")):p&&W!==L?(v("ANIMATION_OUT"),l("leave")):(v("UNMOUNT"),l("after-leave"))}},{immediate:!0});const i=m=>{const p=j(t.value),S=p.includes(CSS.escape(m.animationName)),A=f.value==="mounted"?"enter":"leave";if(m.target===t.value&&S&&(l(`after-${A}`),v("ANIMATION_END"),!s.value)){const W=t.value.style.animationFillMode;t.value.style.animationFillMode="forwards",u=a==null?void 0:a.setTimeout(()=>{var L;((L=t.value)==null?void 0:L.style.animationFillMode)==="forwards"&&(t.value.style.animationFillMode=W)})}m.target===t.value&&p==="none"&&v("ANIMATION_END")},c=m=>{m.target===t.value&&(o.value=j(t.value))},d=P(t,(m,p)=>{m?(n.value=getComputedStyle(m),m.addEventListener("animationstart",c),m.addEventListener("animationcancel",i),m.addEventListener("animationend",i)):(v("ANIMATION_END"),u!==void 0&&(a==null||a.clearTimeout(u)),p==null||p.removeEventListener("animationstart",c),p==null||p.removeEventListener("animationcancel",i),p==null||p.removeEventListener("animationend",i))},{immediate:!0}),y=P(f,()=>{const m=j(t.value);o.value=f.value==="mounted"?m:"none"});return ie(()=>{d(),y()}),{isPresent:w(()=>["mounted","unmountSuspended"].includes(f.value))}}function j(e){return e&&getComputedStyle(e).animationName||"none"}var Bt=B({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(e,{slots:t,expose:n}){var v;const{present:o,forceMount:s}=Fe(e),r=b(),{isPresent:u}=ct(o,r);n({present:u});let a=t.default({present:u.value});a=Z(a||[]);const f=x();if(a&&(a==null?void 0:a.length)>1){const l=(v=f==null?void 0:f.parent)!=null&&v.type.name?`<${f.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${l}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(i=>` - ${i}`).join(`
|
|
2
|
+
`)].join(`
|
|
3
|
+
`))}return()=>s.value||o.value||u.value?$(t.default({present:u.value})[0],{ref:l=>{const i=N(l);return typeof(i==null?void 0:i.hasAttribute)>"u"||(i!=null&&i.hasAttribute("data-reka-popper-content-wrapper")?r.value=i.firstElementChild:r.value=i),i}}):null}});const dt=B({name:"PrimitiveSlot",inheritAttrs:!1,setup(e,{attrs:t,slots:n}){return()=>{var f;if(!n.default)return null;const o=Z(n.default()),s=o.findIndex(v=>v.type!==Ne);if(s===-1)return o;const r=o[s];(f=r.props)==null||delete f.ref;const u=r.props?xe(t,r.props):t,a=Be({...r,props:{}},u);return o.length===1?a:(o[s]=a,o)}}}),ft=["area","img","input"],ye=B({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(e,{attrs:t,slots:n}){const o=e.asChild?"template":e.as;return typeof o=="string"&&ft.includes(o)?()=>$(o,t):o!=="template"?()=>$(e.as,t,{default:n.default}):()=>$(dt,t,{default:n.default})}}),vt="dismissableLayer.pointerDownOutside",pt="dismissableLayer.focusOutside";function he(e,t){if(!(t instanceof Element))return!1;const n=t.closest("[data-dismissable-layer]"),o=e.dataset.dismissableLayer===""?e:e.querySelector("[data-dismissable-layer]"),s=Array.from(e.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&(o===n||s.indexOf(o)<s.indexOf(n)))}function mt(e,t,n=!0){var u;const o=((u=t==null?void 0:t.value)==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),s=b(!1),r=b(()=>{});return F(a=>{if(!_||!E(n))return;const f=async l=>{const i=l.target;if(!(!(t!=null&&t.value)||!i)){if(he(t.value,i)){s.value=!1;return}if(l.target&&!s.value){let d=function(){le(vt,e,c)};const c={originalEvent:l};l.pointerType==="touch"?(o.removeEventListener("click",r.value),r.value=d,o.addEventListener("click",r.value,{once:!0})):d()}else o.removeEventListener("click",r.value);s.value=!1}},v=window.setTimeout(()=>{o.addEventListener("pointerdown",f)},0);a(()=>{window.clearTimeout(v),o.removeEventListener("pointerdown",f),o.removeEventListener("click",r.value)})}),{onPointerDownCapture:()=>{E(n)&&(s.value=!0)}}}function yt(e,t,n=!0){var r;const o=((r=t==null?void 0:t.value)==null?void 0:r.ownerDocument)??(globalThis==null?void 0:globalThis.document),s=b(!1);return F(u=>{if(!_||!E(n))return;const a=async f=>{if(!(t!=null&&t.value))return;await I(),await I();const v=f.target;!t.value||!v||he(t.value,v)||f.target&&!s.value&&le(pt,e,{originalEvent:f})};o.addEventListener("focusin",a),u(()=>o.removeEventListener("focusin",a))}),{onFocusCapture:()=>{E(n)&&(s.value=!0)},onBlurCapture:()=>{E(n)&&(s.value=!1)}}}const O=ue({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,originalBodyPointerEvents:void 0,branches:new Set});var ht=B({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(e,{emit:t}){const n=e,o=t,{forwardRef:s,currentElement:r}=pe(),u=w(()=>{var d;return((d=r.value)==null?void 0:d.ownerDocument)??globalThis.document}),a=w(()=>O.layersRoot),f=w(()=>r.value?Array.from(a.value).indexOf(r.value):-1),v=w(()=>O.layersWithOutsidePointerEventsDisabled.size>0),l=w(()=>{const d=Array.from(a.value),[y]=[...O.layersWithOutsidePointerEventsDisabled].slice(-1),h=d.indexOf(y);return f.value>=h}),i=mt(async d=>{const y=[...O.branches].some(h=>h==null?void 0:h.contains(d.target));!l.value||y||(o("pointerDownOutside",d),o("interactOutside",d),await I(),d.defaultPrevented||o("dismiss"))},r),c=yt(d=>{[...O.branches].some(h=>h==null?void 0:h.contains(d.target))||(o("focusOutside",d),o("interactOutside",d),d.defaultPrevented||o("dismiss"))},r);return Ze("Escape",d=>{f.value===a.value.size-1&&(o("escapeKeyDown",d),d.defaultPrevented||o("dismiss"))}),P([r,()=>n.disableOutsidePointerEvents],([d,y],h,g)=>{d&&(y&&(O.layersWithOutsidePointerEventsDisabled.size===0&&(O.originalBodyPointerEvents=u.value.body.style.pointerEvents,u.value.body.style.pointerEvents="none"),O.layersWithOutsidePointerEventsDisabled.add(d),g(()=>{O.layersWithOutsidePointerEventsDisabled.delete(d),O.layersWithOutsidePointerEventsDisabled.size===0&&!Ue(O.originalBodyPointerEvents)&&(u.value.body.style.pointerEvents=O.originalBodyPointerEvents)})),a.value.add(d))},{immediate:!0}),F(d=>{d(()=>{r.value&&(a.value.delete(r.value),O.layersWithOutsidePointerEventsDisabled.delete(r.value))})}),(d,y)=>(Y(),J(D(ye),{ref:D(s),"as-child":d.asChild,as:d.as,"data-dismissable-layer":"",style:ke({pointerEvents:v.value?l.value?"auto":"none":void 0}),onFocusCapture:D(c).onFocusCapture,onBlurCapture:D(c).onBlurCapture,onPointerdownCapture:D(i).onPointerDownCapture},{default:ae(()=>[X(d.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),kt=ht;const gt=We(()=>b([]));function bt(){const e=gt();return{add(t){const n=e.value[0];t!==n&&(n==null||n.pause()),e.value=te(e.value,t),e.value.unshift(t)},remove(t){var n;e.value=te(e.value,t),(n=e.value[0])==null||n.resume()}}}function te(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}const H="focusScope.autoFocusOnMount",V="focusScope.autoFocusOnUnmount",ne={bubbles:!1,cancelable:!0};function Et(e,{select:t=!1}={}){const n=T();for(const o of e)if(C(o,{select:t}),T()!==n)return!0}function Ot(e){const t=ge(e),n=oe(t,e),o=oe(t.reverse(),e);return[n,o]}function ge(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const s=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||s?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function oe(e,t){for(const n of e)if(!wt(n,{upTo:t}))return n}function wt(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function St(e){return e instanceof HTMLInputElement&&"select"in e}function C(e,{select:t=!1}={}){if(e&&e.focus){const n=T();e.focus({preventScroll:!0}),e!==n&&St(e)&&t&&e.select()}}var At=B({__name:"FocusScope",props:{loop:{type:Boolean,required:!1,default:!1},trapped:{type:Boolean,required:!1,default:!1},asChild:{type:Boolean,required:!1},as:{type:null,required:!1}},emits:["mountAutoFocus","unmountAutoFocus"],setup(e,{emit:t}){const n=e,o=t,{currentRef:s,currentElement:r}=pe(),u=b(null),a=bt(),f=ue({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});F(l=>{if(!_)return;const i=r.value;if(!n.trapped)return;function c(g){if(f.paused||!i)return;const m=g.target;i.contains(m)?u.value=m:C(u.value,{select:!0})}function d(g){if(f.paused||!i)return;const m=g.relatedTarget;m!==null&&(i.contains(m)||C(u.value,{select:!0}))}function y(g){const m=u.value;if(m===null||!g.some(A=>A.removedNodes.length>0))return;i.contains(m)||C(i)}document.addEventListener("focusin",c),document.addEventListener("focusout",d);const h=new MutationObserver(y);i&&h.observe(i,{childList:!0,subtree:!0}),l(()=>{document.removeEventListener("focusin",c),document.removeEventListener("focusout",d),h.disconnect()})}),F(async l=>{const i=r.value;if(await I(),!i)return;a.add(f);const c=T();if(!i.contains(c)){const y=new CustomEvent(H,ne);i.addEventListener(H,h=>o("mountAutoFocus",h)),i.dispatchEvent(y),y.defaultPrevented||(Et(ge(i),{select:!0}),T()===c&&C(i))}l(()=>{i.removeEventListener(H,g=>o("mountAutoFocus",g));const y=new CustomEvent(V,ne),h=g=>{o("unmountAutoFocus",g)};i.addEventListener(V,h),i.dispatchEvent(y),i.setAttribute("data-focus-scope-unmounting",""),setTimeout(()=>{y.defaultPrevented||C(c??document.body,{select:!0}),i.removeEventListener(V,h),a.remove(f),i.removeAttribute("data-focus-scope-unmounting")},0)})});function v(l){if(!n.loop&&!n.trapped||f.paused)return;const i=l.key==="Tab"&&!l.altKey&&!l.ctrlKey&&!l.metaKey,c=T();if(i&&c){const d=l.currentTarget,[y,h]=Ot(d);y&&h?!l.shiftKey&&c===h?(l.preventDefault(),n.loop&&C(y,{select:!0})):l.shiftKey&&c===y&&(l.preventDefault(),n.loop&&C(h,{select:!0})):c===d&&l.preventDefault()}}return(l,i)=>(Y(),J(D(ye),{ref_key:"currentRef",ref:s,tabindex:"-1","as-child":l.asChild,as:l.as,onKeydown:v},{default:ae(()=>[X(l.$slots,"default")]),_:3},8,["as-child","as"]))}}),Rt=At;function jt(e){return e?"open":"closed"}function $t(e){const t=T();for(const n of e)if(n===t||(n.focus(),T()!==t))return}var Pt=B({__name:"Teleport",props:{to:{type:null,required:!1,default:"body"},disabled:{type:Boolean,required:!1},defer:{type:Boolean,required:!1},forceMount:{type:Boolean,required:!1}},setup(e){const t=de();return(n,o)=>D(t)||n.forceMount?(Y(),J(Re,{key:0,to:n.to,disabled:n.disabled,defer:n.defer},[X(n.$slots,"default")],8,["to","disabled","defer"])):je("v-if",!0)}}),Ut=Pt;export{kt as D,Rt as F,ye as P,dt as S,Ut as T,pe as a,xt as b,$e as c,jt as d,Ft as e,Nt as f,T as g,Bt as h,Mt as i,fe as j,_ as k,N as l,Tt as m,Ue as n,$t as o,Lt as p,le as q,_t as r,It as u};
|
|
4
|
+
//# sourceMappingURL=Teleport-BUn4ayOo.js.map
|