diff options
Diffstat (limited to 'web/static/catalog.mjs')
| -rw-r--r-- | web/static/catalog.mjs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/web/static/catalog.mjs b/web/static/catalog.mjs index d1d3444..e110dee 100644 --- a/web/static/catalog.mjs +++ b/web/static/catalog.mjs @@ -12,6 +12,7 @@ function url(address, port, protocol = 'http') { export function catalogViews(pathLink) { let active = 'files', timer = null, request = null, revision = 0, pending = new Set(); const rows = new Map(); + let namespace = ''; function status(view, text, error = false) { const p = $(`${view}-status`); p.textContent = text; p.classList.toggle('error', error); } @@ -19,7 +20,7 @@ export function catalogViews(pathLink) { if (pending.has(site.name)) return; pending.add(site.name); updateSite(site); try { - const r = await fetch(`/fs/sites/${encodeURIComponent(site.name)}/ctl`, { method: 'PUT', body: command }); + const r = await fetch(`/fs${namespace}/sites/${encodeURIComponent(site.name)}/ctl`, { method: 'PUT', body: command }); if (!r.ok) throw new Error(await r.text()); status('sites', `${site.title}: ${command} requested.`); } catch (error) { status('sites', error.message, true); } @@ -35,7 +36,7 @@ export function catalogViews(pathLink) { const tools = element('div'); tools.className = 'site-actions'; const build = element('button', 'build'), watch = element('button', 'watch'), cancel = element('button', 'cancel'); for (const b of [build, watch, cancel]) b.type = 'button'; - tools.append(build, watch, cancel, pathLink('files', `/sites/${site.name}/public`), pathLink('log', `/sites/${site.name}/log`)); + tools.append(build, watch, cancel, pathLink('files', `${namespace}/sites/${site.name}/public`), pathLink('log', `${namespace}/sites/${site.name}/log`)); actions.append(tools); tr.append(name, phase, finished, actions); row = { tr, link, root, phase, finished, build, watch, cancel }; rows.set(site.name, row); $('sites-entries').append(tr); @@ -74,6 +75,7 @@ export function catalogViews(pathLink) { if (!r.ok) throw new Error(`Unable to load ${view}: HTTP ${r.status}`); const data = await r.json(); if (ticket !== revision || active !== view) return; + namespace = data.namespace || ''; if (view === 'sites') { const names = new Set(data.sites.map(s => s.name)); for (const [name, row] of rows) if (!names.has(name)) { row.tr.remove(); rows.delete(name); } |
