@basaltkit/deploy-ui 0.3.0 → 0.4.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.
@@ -28,6 +28,7 @@ const PATHS = {
28
28
  chevron: 'M9 6l6 6-6 6',
29
29
  arrow: 'M5 12h14M13 6l6 6-6 6',
30
30
  commit: 'M12 8.5a3.5 3.5 0 1 1 0 7 3.5 3.5 0 1 1 0-7zM3 12h5.5M15.5 12H21',
31
+ globe: 'M12 3a9 9 0 1 1 0 18 9 9 0 1 1 0-18zM3 12h18M12 3c2.5 2.5 3.8 5.5 3.8 9s-1.3 6.5-3.8 9c-2.5-2.5-3.8-5.5-3.8-9s1.3-6.5 3.8-9z',
31
32
  merge: 'M7 4v10M7 14a3 3 0 1 0 0 6 3 3 0 1 0 0-6zM17 4a3 3 0 1 0 0 6 3 3 0 1 0 0-6zM17 10c0 4-4 6-10 6',
32
33
  };
33
34
  const SVG = 'http://www.w3.org/2000/svg';
@@ -1,6 +1,7 @@
1
1
  import { Api, ApiError, exchange, ServerGone } from './api.js';
2
- import { App, forgetSession, SERVER_KEY, TOKEN_KEY } from './app.js';
2
+ import { App, applyShell, forgetSession, SERVER_KEY, TOKEN_KEY } from './app.js';
3
3
  import { el, replace } from './dom.js';
4
+ import { pickLocale, setLocale, t } from './i18n.js';
4
5
  import { describe } from './reply.js';
5
6
  function storageOf(win) {
6
7
  try {
@@ -19,6 +20,9 @@ function storageOf(win) {
19
20
  */
20
21
  export async function boot(env) {
21
22
  const doc = env.document;
23
+ const languages = env.languages ?? [];
24
+ setLocale(pickLocale(undefined, languages), languages);
25
+ applyShell(doc);
22
26
  const shell = {
23
27
  nav: doc.getElementById('nav'),
24
28
  bar: doc.getElementById('target-bar'),
@@ -62,7 +66,7 @@ export async function boot(env) {
62
66
  // The server is gone or not ours: the page already says so.
63
67
  if (error instanceof ServerGone)
64
68
  return undefined;
65
- replace(shell.main, el('div', { class: 'banner err', role: 'alert' }, el('strong', {}, 'The UI could not start.'), el('p', {}, describe(error))));
69
+ replace(shell.main, el('div', { class: 'banner err', role: 'alert' }, el('strong', {}, t('start.failed')), el('p', {}, describe(error))));
66
70
  return undefined;
67
71
  }
68
72
  return app;
@@ -82,9 +86,7 @@ function keep(env, credentials) {
82
86
  const final = (error) => error instanceof ApiError && (error.status === 409 || error.status === 410 || error.status === 429);
83
87
  function refusal(error) {
84
88
  const taken = error instanceof ApiError && error.status === 409;
85
- return el('div', { class: 'banner err', role: 'alert' }, el('strong', {}, taken ? 'This UI already has its browser session.' : 'The code was refused.'), el('p', {}, taken
86
- ? 'Another tab or browser claimed it first. If that was not you, stop basalt-deploy-ui in your terminal now (Ctrl-C) and start it again.'
87
- : `${describe(error)}. Start basalt-deploy-ui again.`));
89
+ return el('div', { class: 'banner err', role: 'alert' }, el('strong', {}, taken ? t('start.sessionTaken') : t('start.codeRefused')), el('p', {}, taken ? t('start.sessionTakenHelp') : t('start.again', { why: describe(error) })));
88
90
  }
89
91
  /**
90
92
  * No session yet: the code the terminal shows, typed here (`--pair`: nothing
@@ -96,12 +98,12 @@ function pair(env, main) {
96
98
  return new Promise((resolve) => {
97
99
  const input = el('input', { id: 'pair-code', name: 'code', type: 'text', autocomplete: 'off', spellcheck: false, required: true, placeholder: 'ABCD-EFGH', aria: { describedby: 'pair-help' } });
98
100
  const status = el('span', { class: 'field-error', role: 'alert' });
99
- const submit = el('button', { type: 'submit', class: 'primary' }, 'Open the session');
100
- const form = el('form', { class: 'card pair', aria: { label: 'Pair this page' }, on: { submit: (event) => {
101
+ const submit = el('button', { type: 'submit', class: 'primary' }, t('pair.open'));
102
+ const form = el('form', { class: 'card pair', aria: { label: t('pair.title') }, on: { submit: (event) => {
101
103
  event.preventDefault();
102
104
  const code = input.value.trim();
103
105
  if (!/^[A-Za-z0-9_\s-]{1,128}$/.test(code)) {
104
- replace(status, 'Type the code your terminal shows.');
106
+ replace(status, t('pair.typeCode'));
105
107
  return;
106
108
  }
107
109
  submit.disabled = true;
@@ -116,11 +118,11 @@ function pair(env, main) {
116
118
  input.focus();
117
119
  replace(status, describe(error));
118
120
  });
119
- } } }, el('div', { class: 'card-head' }, el('h3', {}, 'Pair this page')), el('div', { class: 'card-body' }, el('div', { class: 'field' }, el('label', { for: 'pair-code' }, 'Pairing code'), input, el('span', { id: 'pair-help', class: 'field-help' }, 'Type the pairing code basalt-deploy-ui shows in your terminal (2 minutes, 5 tries). Without --pair, open the URL it printed instead.'), status)), el('div', { class: 'card-foot' }, submit));
121
+ } } }, el('div', { class: 'card-head' }, el('h3', {}, t('pair.title'))), el('div', { class: 'card-body' }, el('div', { class: 'field' }, el('label', { for: 'pair-code' }, t('pair.code')), input, el('span', { id: 'pair-help', class: 'field-help' }, t('pair.help')), status)), el('div', { class: 'card-foot' }, submit));
120
122
  replace(main, form);
121
123
  input.focus();
122
124
  });
123
125
  }
124
126
  if (typeof window !== 'undefined' && document.getElementById('app')) {
125
- void boot({ location: window.location, history: window.history, storage: storageOf(window), fetch: (input, init) => window.fetch(input, init), document, crypto: window.crypto });
127
+ void boot({ location: window.location, history: window.history, storage: storageOf(window), fetch: (input, init) => window.fetch(input, init), document, crypto: window.crypto, languages: window.navigator.languages ?? [window.navigator.language] });
126
128
  }
@@ -53,6 +53,8 @@ export interface TargetsReply {
53
53
  path: string;
54
54
  exists: boolean;
55
55
  actor?: string;
56
+ /** The page's language, as the operator last chose it. */
57
+ locale?: 'en' | 'pt';
56
58
  targets: TargetView[];
57
59
  error?: string;
58
60
  }
@@ -1,10 +1,11 @@
1
1
  import { el, quiet } from './dom.js';
2
+ import { serverText, t } from './i18n.js';
2
3
  import { icon } from './icons.js';
3
4
  import { ApiError } from './api.js';
4
5
  /** What went wrong, as a banner: a protocol error (code, message, hint), a failure of the connection, or the local server's refusal. */
5
6
  export function problem(reply, error) {
6
7
  if (error !== undefined)
7
- return banner('err', 'The UI refused the request', [describe(error)]);
8
+ return banner('err', t('reply.uiRefused'), [describe(error)]);
8
9
  if (!reply)
9
10
  return null;
10
11
  if (reply.failure)
@@ -12,30 +13,30 @@ export function problem(reply, error) {
12
13
  if (reply.error)
13
14
  return errorBanner(reply.error, reply.diagnostics);
14
15
  if (!reply.ok)
15
- return banner('err', 'The command failed', [`exit code ${reply.exitCode ?? 'unknown'}`], reply.diagnostics);
16
+ return banner('err', t('reply.commandFailed'), [t('reply.exitCode', { code: reply.exitCode ?? t('unknown') })], reply.diagnostics);
16
17
  return null;
17
18
  }
18
19
  export function describe(error) {
19
20
  if (error instanceof ApiError)
20
- return `${error.message} (HTTP ${error.status})`;
21
+ return `${serverText(error.message)} (HTTP ${error.status})`;
21
22
  return error instanceof Error ? error.message : String(error);
22
23
  }
23
24
  export function failureBanner(failure, diagnostics = []) {
24
- return banner('err', failure.message, failure.hint ? [failure.hint] : [], diagnostics, failure.code);
25
+ return banner('err', serverText(failure.message), failure.hint ? [serverText(failure.hint)] : [], diagnostics, failure.code);
25
26
  }
26
27
  export function errorBanner(error, diagnostics = []) {
27
28
  const lines = [];
28
29
  if (error.hint)
29
30
  lines.push(error.hint);
30
31
  if (error.holder)
31
- lines.push(`held by pid ${error.holder.pid} on ${error.holder.host}, ${error.holder.actor}, ${error.holder.command}${error.holder.runId ? ` (run ${error.holder.runId})` : ''}`);
32
+ lines.push(t(error.holder.runId ? 'reply.heldByRun' : 'reply.heldBy', { ...error.holder }));
32
33
  for (const finding of error.findings ?? [])
33
34
  lines.push(`${finding.level}: ${finding.message}${finding.fix ? ` — ${finding.fix}` : ''}`);
34
35
  return banner('err', error.message, lines, diagnostics, error.code);
35
36
  }
36
37
  export function banner(level, title, lines = [], diagnostics = [], code) {
37
- return el('div', { class: `banner ${level}`, role: level === 'err' ? 'alert' : 'status' }, icon(level === 'ok' ? 'ok' : level === 'warn' ? 'alert' : 'error', 'icon banner-icon'), el('div', { class: 'banner-body' }, el('strong', { class: 'banner-title' }, quiet(level === 'ok' ? 'OK: ' : level === 'warn' ? 'Warning: ' : 'Error: '), title), code ? el('span', { class: 'banner-code' }, ` [${code}]`) : null, ...lines.filter((line) => line !== '' && line !== null && line !== undefined && line !== false).map((line) => el('p', {}, line)), diagnostics.length > 0 ? diagnosticsBlock(diagnostics) : null));
38
+ return el('div', { class: `banner ${level}`, role: level === 'err' ? 'alert' : 'status' }, icon(level === 'ok' ? 'ok' : level === 'warn' ? 'alert' : 'error', 'icon banner-icon'), el('div', { class: 'banner-body' }, el('strong', { class: 'banner-title' }, quiet(t(level === 'ok' ? 'level.ok' : level === 'warn' ? 'level.warn' : 'level.err')), title), code ? el('span', { class: 'banner-code' }, ` [${code}]`) : null, ...lines.filter((line) => line !== '' && line !== null && line !== undefined && line !== false).map((line) => el('p', {}, line)), diagnostics.length > 0 ? diagnosticsBlock(diagnostics) : null));
38
39
  }
39
40
  export function diagnosticsBlock(lines) {
40
- return el('details', { class: 'disclosure' }, el('summary', {}, `Diagnostics (${lines.length})`), el('pre', { class: 'diagnostics' }, lines.join('\n')));
41
+ return el('details', { class: 'disclosure' }, el('summary', {}, t('reply.diagnostics', { count: lines.length })), el('pre', { class: 'diagnostics' }, lines.join('\n')));
41
42
  }
@@ -1,4 +1,5 @@
1
1
  import { el } from './dom.js';
2
+ import { formatLocale, reasonText, t } from './i18n.js';
2
3
  import { icon } from './icons.js';
3
4
  import { clean, short } from './sanitize.js';
4
5
  /**
@@ -7,22 +8,7 @@ import { clean, short } from './sanitize.js';
7
8
  * — rendered as text nodes only, cleaned again here, never a link. A list
8
9
  * that is missing or unavailable is said so and never disables an action.
9
10
  */
10
- /** Fixed local text for each reason: the server's wording never reaches the page. */
11
- const REASONS = {
12
- 'skipped': 'the fetch is skipped, so a run deploys the commit already checked out',
13
- 'not-fetched': 'the server could not fetch the branch from its remote',
14
- 'no-previous': 'there is no earlier release to compare with',
15
- 'missing-commit': 'a commit is not in the server\'s checkout (rewritten history, or never fetched there)',
16
- 'shallow': 'the server\'s checkout is a shallow clone, so its history is incomplete',
17
- 'unrelated': 'the two commits share no history',
18
- 'timeout': 'git took too long on the server',
19
- 'too-large': 'git\'s answer was too large',
20
- 'malformed': 'git\'s answer could not be read',
21
- 'git-failed': 'git failed on the server',
22
- };
23
- export function reasonText(reason) {
24
- return typeof reason === 'string' && Object.hasOwn(REASONS, reason) ? REASONS[reason] : 'the server gave no usable reason';
25
- }
11
+ export { reasonText };
26
12
  /** A shape check: anything from the server that is not a list of commits is "unavailable", never a crash. */
27
13
  export function validCommits(value) {
28
14
  if (typeof value !== 'object' || value === null)
@@ -36,27 +22,27 @@ export function validCommits(value) {
36
22
  }
37
23
  /** Why there is no list: a quiet note, never an error the operator must clear. */
38
24
  export function unavailable(text) {
39
- return el('div', { class: 'commits-note' }, icon('info'), el('span', {}, el('strong', {}, 'Commit list unavailable'), ` — ${text}.`));
25
+ return el('div', { class: 'commits-note' }, icon('info'), el('span', {}, el('strong', {}, t('commits.unavailable')), ` — ${text}.`));
40
26
  }
41
- /** `1 Oct 2026, 10:00` in the operator's locale; the exact time in the tooltip. */
27
+ /** `1 Oct 2026, 10:00` in the page's language (the browser's variant of it); the exact time in the tooltip. */
42
28
  function date(at) {
43
29
  if (typeof at !== 'string')
44
30
  return null;
45
31
  const parsed = new Date(at);
46
32
  if (Number.isNaN(parsed.getTime()))
47
33
  return null;
48
- return el('time', { title: clean(at) }, parsed.toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'short' }));
34
+ return el('time', { title: clean(at) }, parsed.toLocaleString(formatLocale(), { dateStyle: 'medium', timeStyle: 'short' }));
49
35
  }
50
36
  function commitItem(c) {
51
37
  const subject = clean(c.subject);
52
38
  const author = clean(c.author);
53
- return el('li', { class: c.merge ? 'commit is-merge' : 'commit' }, el('span', { class: 'commit-dot', aria: { hidden: 'true' } }), el('code', { class: 'commit-sha', title: short(c.sha) }, short(c.sha).slice(0, 7)), el('span', { class: 'commit-subject', title: subject }, c.merge ? icon('merge', 'icon commit-merge') : null, subject || el('span', { class: 'muted' }, '(no subject)')), el('span', { class: 'commit-meta' }, author ? el('span', { class: 'commit-author' }, author) : null, date(c.at)));
39
+ return el('li', { class: c.merge ? 'commit is-merge' : 'commit' }, el('span', { class: 'commit-dot', aria: { hidden: 'true' } }), el('code', { class: 'commit-sha', title: short(c.sha) }, short(c.sha).slice(0, 7)), el('span', { class: 'commit-subject', title: subject }, c.merge ? icon('merge', 'icon commit-merge') : null, subject || el('span', { class: 'muted' }, t('commits.noSubject'))), el('span', { class: 'commit-meta' }, author ? el('span', { class: 'commit-author' }, author) : null, date(c.at)));
54
40
  }
55
41
  /** The most commits the server sends per list (COMMITS_LIMIT): the page imports no code from the deploy package. */
56
42
  const LIST_LIMIT = 50;
57
43
  /** One side of a range: a heading with its sign and count, the commits newest first, and what the cap left out. */
58
44
  export function commitGroup(tone, label, list, total) {
59
- return el('section', { class: `commit-group commit-group-${tone}`, aria: { label: `${label}: ${total}` } }, el('header', { class: 'commit-group-head' }, el('span', { class: 'commit-sign', aria: { hidden: 'true' } }, tone === 'added' ? '+' : '−'), el('span', { class: 'commit-group-title' }, label), el('span', { class: 'commit-count' }, String(total))), el('ol', { class: 'commit-list' }, ...list.map(commitItem)), total > list.length ? el('p', { class: 'commit-more' }, `+ ${total - list.length} older commit${total - list.length === 1 ? '' : 's'} not shown — the server sends at most ${LIST_LIMIT} per list.`) : null);
45
+ return el('section', { class: `commit-group commit-group-${tone}`, aria: { label: `${label}: ${total}` } }, el('header', { class: 'commit-group-head' }, el('span', { class: 'commit-sign', aria: { hidden: 'true' } }, tone === 'added' ? '+' : '−'), el('span', { class: 'commit-group-title' }, label), el('span', { class: 'commit-count' }, String(total))), el('ol', { class: 'commit-list' }, ...list.map(commitItem)), total > list.length ? el('p', { class: 'commit-more' }, t('commits.olderNotShown', { count: total - list.length, limit: LIST_LIMIT })) : null);
60
46
  }
61
47
  /** `abc1234 → def5678`, for a card's head. */
62
48
  export function rangeSpan(range) {
@@ -68,9 +54,9 @@ export function rangeSpan(range) {
68
54
  */
69
55
  export function commitsBlock(value, labels, order = ['added', 'removed']) {
70
56
  if (value === undefined)
71
- return unavailable('the server\'s @basaltkit/deploy is older than the commit lists');
57
+ return unavailable(t('commits.olderDeploy'));
72
58
  if (!validCommits(value))
73
- return unavailable('the server\'s answer could not be read');
59
+ return unavailable(t('commits.unreadable'));
74
60
  if (!value.ok)
75
61
  return unavailable(reasonText(value.reason));
76
62
  const r = value.range;
@@ -85,5 +71,5 @@ export function commitsBlock(value, labels, order = ['added', 'removed']) {
85
71
  /** A compact list for a confirmation dialog: at most `max` commits, then how many more. */
86
72
  export function commitSummary(tone, label, list, total, max = 8) {
87
73
  const shown = list.slice(0, max);
88
- return el('span', { class: `commit-summary commit-group-${tone}` }, el('span', { class: 'commit-summary-head' }, el('span', { class: 'commit-sign', aria: { hidden: 'true' } }, tone === 'added' ? '+' : '−'), `${label} `, el('span', { class: 'commit-count' }, String(total))), ...shown.map((c) => el('span', { class: 'commit-summary-row' }, el('code', { class: 'commit-sha' }, short(c.sha).slice(0, 7)), el('span', { class: 'commit-subject' }, clean(c.subject)))), total > shown.length ? el('span', { class: 'commit-more' }, `and ${total - shown.length} more`) : null);
74
+ return el('span', { class: `commit-summary commit-group-${tone}` }, el('span', { class: 'commit-summary-head' }, el('span', { class: 'commit-sign', aria: { hidden: 'true' } }, tone === 'added' ? '+' : '−'), `${label} `, el('span', { class: 'commit-count' }, String(total))), ...shown.map((c) => el('span', { class: 'commit-summary-row' }, el('code', { class: 'commit-sha' }, short(c.sha).slice(0, 7)), el('span', { class: 'commit-subject' }, clean(c.subject)))), total > shown.length ? el('span', { class: 'commit-more' }, t('commits.andMore', { count: total - shown.length })) : null);
89
75
  }
@@ -1,5 +1,6 @@
1
1
  import { confirmDialog } from './dialog.js';
2
2
  import { button, card, el, emptyState, pageHead, pill, replace, when } from './dom.js';
3
+ import { t } from './i18n.js';
3
4
  import { icon } from './icons.js';
4
5
  import { problem } from './reply.js';
5
6
  import { clean, short } from './sanitize.js';
@@ -12,43 +13,45 @@ export function renderHistory(app) {
12
13
  const preview = el('div', { class: 'rollback-preview', aria: { live: 'polite' } });
13
14
  const current = releases.find((r) => r.status === 'ok');
14
15
  const choices = releases.filter((r) => r.status === 'ok' && r !== current);
15
- const select = el('select', { id: 'rollback-to', on: { change: () => replace(preview) } }, el('option', { value: '' }, 'the last healthy release (the deploy decides)'), ...choices.map((r) => el('option', { value: r.sha }, `${short(r.sha)} — ${when(r.at)}`)));
16
- return el('section', { aria: { labelledby: 'history-title' } }, pageHead('history-title', 'History', 'The last 10 releases the server recorded, newest first.', el('button', { type: 'button', on: { click: () => { void app.refreshStatus(); } } }, icon('refresh'), 'Refresh')), !status ? emptyState('history', 'Load the status first.', 'The releases come with the status of the target.') : null, releases.length > 0 ? card('Releases', [table(app, releases, status?.subjects)], { bodyClass: 'flush', actions: [el('span', { class: 'muted num' }, `${releases.length} recorded`)] }) : status ? emptyState('inbox', 'No release recorded yet.', 'The first deploy of this target will show here.') : null, status ? card('Roll back', [
17
- el('div', { class: 'field' }, el('label', { for: 'rollback-to' }, 'Back to'), select),
18
- el('p', { class: 'form-note' }, icon('alert'), 'Code only: the database is not rolled back. The commit it leaves is held: a scheduled run will not redeploy it until the branch moves on.'),
16
+ const select = el('select', { id: 'rollback-to', on: { change: () => replace(preview) } }, el('option', { value: '' }, t('history.lastHealthy')), ...choices.map((r) => el('option', { value: r.sha }, `${short(r.sha)} — ${when(r.at)}`)));
17
+ return el('section', { aria: { labelledby: 'history-title' } }, pageHead('history-title', t('screen.history'), t('history.sub'), el('button', { type: 'button', on: { click: () => { void app.refreshStatus(); } } }, icon('refresh'), t('refresh'))), !status ? emptyState('history', t('history.loadStatus'), t('history.loadStatusText')) : null, releases.length > 0 ? card(t('history.releases'), [table(app, releases, status?.subjects)], { bodyClass: 'flush', actions: [el('span', { class: 'muted num' }, t('history.recorded', { count: releases.length }))] }) : status ? emptyState('inbox', t('history.none'), t('history.noneText')) : null, status ? card(t('history.rollBack'), [
18
+ el('div', { class: 'field' }, el('label', { for: 'rollback-to' }, t('history.backTo')), select),
19
+ el('p', { class: 'form-note' }, icon('alert'), t('history.codeOnly')),
19
20
  preview,
20
21
  message,
21
22
  ], { foot: [
22
- button('Preview changes', () => { void showPreview(app, select.value, preview); }),
23
- button('Roll back…', () => { void rollback(app, select.value, message, preview); }, { class: 'danger' }),
23
+ button(t('history.preview'), () => { void showPreview(app, select.value, preview); }),
24
+ button(t('history.rollBackEllipsis'), () => { void rollback(app, select.value, message, preview); }, { class: 'danger' }),
24
25
  ] }) : null);
25
26
  }
27
+ /** A release's status in the page's language; one this UI does not know is shown as the server wrote it. */
28
+ const releaseStatus = (status) => (status === 'ok' || status === 'failed' ? t(`release.${status}`) : status);
26
29
  /** The release each row is compared with: the one it was deployed over, else the next older one on record. */
27
30
  const previousOf = (releases, index) => releases[index]?.previous || releases[index + 1]?.sha;
28
31
  function table(app, releases, subjects) {
29
32
  const known = typeof subjects === 'object' && subjects !== null ? subjects : {};
30
- const columns = ['Commit', 'When', 'Status', 'Actor', 'Via', 'Client', 'Migrations', 'Backup', 'Note'];
31
- return el('div', { class: 'table-wrap' }, el('table', { class: 'releases' }, el('thead', {}, el('tr', {}, el('th', { scope: 'col', class: 'disclosure' }, el('span', { class: 'visually-hidden' }, 'Changes')), ...columns.map((h) => el('th', { scope: 'col' }, h)))), el('tbody', {}, ...releases.flatMap((r, index) => {
33
+ const columns = ['col.commit', 'col.when', 'col.status', 'col.actor', 'col.via', 'col.client', 'col.migrations', 'col.backup', 'col.note'].map((key) => t(key));
34
+ return el('div', { class: 'table-wrap' }, el('table', { class: 'releases' }, el('thead', {}, el('tr', {}, el('th', { scope: 'col', class: 'disclosure' }, el('span', { class: 'visually-hidden' }, t('history.changes'))), ...columns.map((h) => el('th', { scope: 'col' }, h)))), el('tbody', {}, ...releases.flatMap((r, index) => {
32
35
  const from = previousOf(releases, index);
33
36
  const detail = el('td', { colspan: columns.length + 1, class: 'release-changes-cell' });
34
37
  const detailRow = el('tr', { class: 'release-changes', hidden: true }, detail);
35
38
  const toggle = el('button', {
36
39
  type: 'button', class: 'disclosure-button', disabled: !from,
37
- title: from ? `Commits between ${short(from).slice(0, 7)} and ${short(r.sha).slice(0, 7)}` : 'No earlier release to compare with',
38
- aria: { expanded: 'false', label: from ? `Show the commits of ${short(r.sha).slice(0, 7)}` : 'No earlier release to compare with' },
40
+ title: from ? t('history.between', { from: short(from).slice(0, 7), to: short(r.sha).slice(0, 7) }) : t('history.noEarlier'),
41
+ aria: { expanded: 'false', label: from ? t('history.showCommits', { sha: short(r.sha).slice(0, 7) }) : t('history.noEarlier') },
39
42
  on: { click: () => { void toggleChanges(app, from, r.sha, row, detailRow, detail, toggle); } },
40
43
  }, icon('chevron'));
41
44
  const subject = Object.hasOwn(known, r.sha) ? clean(known[r.sha]) : '';
42
- const row = el('tr', { class: 'release-row' }, el('td', { class: 'disclosure' }, toggle), el('td', { class: 'release-commit' }, el('code', {}, short(r.sha).slice(0, 7)), subject ? el('span', { class: 'release-subject', title: subject }, subject) : null), el('td', { class: 'nowrap num' }, when(r.at)), el('td', {}, pill(r.status === 'ok' ? 'ok' : 'err', r.status)), el('td', {}, r.actor ?? r.user), el('td', { class: 'muted' }, r.via ?? ''), el('td', { class: 'mono' }, r.client ?? ''), el('td', { class: 'mono wrap' }, r.migrations.join(', ')), el('td', { class: 'mono wrap' }, r.backup ?? ''), el('td', { class: 'wrap' }, r.note ?? ''));
45
+ const row = el('tr', { class: 'release-row' }, el('td', { class: 'disclosure' }, toggle), el('td', { class: 'release-commit' }, el('code', {}, short(r.sha).slice(0, 7)), subject ? el('span', { class: 'release-subject', title: subject }, subject) : null), el('td', { class: 'nowrap num' }, when(r.at)), el('td', {}, pill(r.status === 'ok' ? 'ok' : 'err', releaseStatus(r.status))), el('td', {}, r.actor ?? r.user), el('td', { class: 'muted' }, r.via ?? ''), el('td', { class: 'mono' }, r.client ?? ''), el('td', { class: 'mono wrap' }, r.migrations.join(', ')), el('td', { class: 'mono wrap' }, r.backup ?? ''), el('td', { class: 'wrap' }, r.note ?? ''));
43
46
  return [row, detailRow];
44
47
  }))));
45
48
  }
46
49
  /** The server's answer to `commits`, as a block: an older deploy that does not know the command is said plainly. */
47
50
  function commitsReply(reply, labels, order) {
48
51
  if (reply.error?.code === 'usage' && /unknown command/.test(clean(reply.error.message)))
49
- return unavailable('the server\'s @basaltkit/deploy is older than the commit lists');
52
+ return unavailable(t('commits.olderDeploy'));
50
53
  if (!reply.ok && !reply.result)
51
- return problem(reply) ?? unavailable('no answer');
54
+ return problem(reply) ?? unavailable(t('commits.noAnswer'));
52
55
  const result = reply.result;
53
56
  return commitsBlock(result?.commits, labels, order);
54
57
  }
@@ -59,10 +62,10 @@ async function toggleChanges(app, from, to, row, detailRow, cell, toggle) {
59
62
  toggle.setAttribute('aria-expanded', String(open));
60
63
  if (!open || cell.dataset['loaded'] === 'yes')
61
64
  return;
62
- replace(cell, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, 'Reading the commits on the server…')));
65
+ replace(cell, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, t('history.reading'))));
63
66
  try {
64
67
  const reply = await app.commits(from, to);
65
- replace(cell, commitsReply(reply, { added: 'Brought in', removed: 'Taken out', same: 'The same commit as the release before: nothing changed.' }));
68
+ replace(cell, commitsReply(reply, { added: t('history.broughtIn'), removed: t('history.takenOut'), same: t('history.same') }));
66
69
  if (reply.ok)
67
70
  cell.dataset['loaded'] = 'yes';
68
71
  }
@@ -77,55 +80,57 @@ async function readPreview(app, to) {
77
80
  reply = await app.rollbackPreview(to || undefined);
78
81
  }
79
82
  catch (error) {
80
- return { lines: ['Commit list unavailable: the preview failed — the rollback still works.'], block: problem(undefined, error) ?? unavailable('no answer') };
83
+ return { lines: [t('history.previewFailed')], block: problem(undefined, error) ?? unavailable(t('commits.noAnswer')) };
81
84
  }
82
85
  const result = reply.result;
83
- const block = commitsReply(reply, { removed: 'Leaves production', added: 'Comes back (not in the current release)', same: 'Nothing changes.' }, ['removed', 'added']);
86
+ const block = commitsReply(reply, { removed: t('history.leaves'), added: t('history.comesBack'), same: t('history.nothingChanges') }, ['removed', 'added']);
84
87
  const commits = result?.commits;
85
88
  if (!validCommits(commits))
86
- return { lines: ['Commit list unavailable — the rollback still works.'], block };
89
+ return { lines: [t('history.previewUnavailable')], block };
87
90
  if (!commits.ok)
88
- return { lines: [`Commit list unavailable: ${reasonText(commits.reason)} — the rollback still works.`], block };
91
+ return { lines: [t('history.previewReason', { reason: reasonText(commits.reason) })], block };
89
92
  const r = commits.range;
90
93
  return {
91
94
  ...(typeof result?.to === 'string' ? { to: result.to } : {}),
92
95
  block,
93
96
  lines: [
94
- r.removedTotal > 0 ? commitSummary('removed', 'Leaves production', r.removed, r.removedTotal) : 'No commit leaves production.',
95
- r.addedTotal > 0 ? commitSummary('added', 'Comes back (not in the current release)', r.added, r.addedTotal, 4) : null,
97
+ r.removedTotal > 0 ? commitSummary('removed', t('history.leaves'), r.removed, r.removedTotal) : t('history.noneLeaves'),
98
+ r.addedTotal > 0 ? commitSummary('added', t('history.comesBack'), r.added, r.addedTotal, 4) : null,
96
99
  ],
97
100
  };
98
101
  }
99
102
  async function showPreview(app, to, area) {
100
- replace(area, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, 'Reading the commits on the server…')));
103
+ replace(area, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, t('history.reading'))));
101
104
  replace(area, (await readPreview(app, to)).block);
102
105
  }
103
106
  async function rollback(app, to, message, area) {
104
- const t = app.current;
105
- if (!t)
107
+ const target = app.current;
108
+ if (!target)
106
109
  return;
107
- replace(area, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, 'Reading what would leave production…')));
110
+ replace(area, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, t('history.readingLeaving'))));
108
111
  const preview = await readPreview(app, to);
109
112
  replace(area, preview.block);
110
113
  const ok = await confirmDialog({
111
- title: `Roll back ${t.name}?`,
112
- context: `${t.ssh} · ${t.dir}${app.hello ? ` · host ${app.hello.host}` : ''}`,
114
+ title: t('history.rollBackTitle', { name: target.name }),
115
+ context: [target.ssh, target.dir, app.hello ? t('ctx.hostPart', { host: app.hello.host }) : null].filter(Boolean).join(' · '),
113
116
  lines: [
114
- to ? `Back to ${short(to).slice(0, 7)}.` : `Back to the last healthy release${preview.to ? ` — ${short(preview.to).slice(0, 7)} now` : ''}.`,
117
+ to ? t('history.backToSha', { sha: short(to).slice(0, 7) })
118
+ : preview.to ? t('history.backToLastHealthyNow', { sha: short(preview.to).slice(0, 7) })
119
+ : t('history.backToLastHealthy'),
115
120
  ...preview.lines,
116
- 'The commit it leaves is held until the branch moves on.',
121
+ t('history.heldUntil'),
117
122
  ],
118
- confirmLabel: 'Roll back',
123
+ confirmLabel: t('history.rollBackConfirm'),
119
124
  danger: true,
120
- ...(t.protected ? { typeToConfirm: t.name } : {}),
125
+ ...(target.protected ? { typeToConfirm: target.name } : {}),
121
126
  });
122
127
  if (!ok)
123
128
  return;
124
- replace(message, el('p', { class: 'muted' }, 'Starting the rollback…'));
129
+ replace(message, el('p', { class: 'muted' }, t('history.starting')));
125
130
  let reply;
126
131
  try {
127
132
  // Exactly what it sent before the preview existed: the deploy still decides the target when none was picked.
128
- reply = await app.api.post('rollback', { target: t.name, confirm: true, confirmedTarget: t, ...(t.protected ? { confirmName: t.name } : {}), ...(to ? { to } : {}) });
133
+ reply = await app.api.post('rollback', { target: target.name, confirm: true, confirmedTarget: target, ...(target.protected ? { confirmName: target.name } : {}), ...(to ? { to } : {}) });
129
134
  }
130
135
  catch (error) {
131
136
  replace(message, problem(undefined, error));
@@ -137,7 +142,7 @@ async function rollback(app, to, message, area) {
137
142
  replace(message);
138
143
  if (preview.to)
139
144
  app.previewedRollbacks.set(result.runId, preview.to);
140
- app.watch(result.runId, `rollback ${result.runId}`);
145
+ app.watch(result.runId, t('run.rollbackTitle', { runId: result.runId }));
141
146
  return;
142
147
  }
143
148
  replace(message, problem(reply));
@@ -1,5 +1,6 @@
1
1
  import { confirmDialog } from './dialog.js';
2
2
  import { append, button, card, el, emptyState, pageHead, replace } from './dom.js';
3
+ import { t } from './i18n.js';
3
4
  import { icon } from './icons.js';
4
5
  import { banner, describe, diagnosticsBlock, problem } from './reply.js';
5
6
  import { ApiError } from './api.js';
@@ -8,21 +9,21 @@ import { commitsBlock, rangeSpan, validCommits } from './view-commits.js';
8
9
  export function renderPlan(app) {
9
10
  const reply = app.planReply;
10
11
  const plan = app.plan;
11
- const root = el('section', { aria: { labelledby: 'plan-title' } }, pageHead('plan-title', 'Plan & deploy', 'plan changes nothing on the server. Its preflight may reach the git remote, so it can take a while.', button(app.planBusy ? 'Planning…' : plan ? 'Plan again' : 'Run plan', () => { void app.runPlan(); }, { disabled: app.planBusy, class: plan ? '' : 'primary' })));
12
+ const root = el('section', { aria: { labelledby: 'plan-title' } }, pageHead('plan-title', t('screen.plan'), t('plan.sub'), button(app.planBusy ? t('plan.planning') : plan ? t('plan.again') : t('plan.run'), () => { void app.runPlan(); }, { disabled: app.planBusy, class: plan ? '' : 'primary' })));
12
13
  if (!reply) {
13
14
  append(root, app.planBusy
14
- ? emptyState('refresh', 'Planning…', 'Preflight checks and the plan run on the server; nothing changes there.')
15
- : emptyState('plan', 'No plan yet', 'Run a plan to see what a deploy would do, the questions it would ask, and anything that would stop it.'));
15
+ ? emptyState('refresh', t('plan.planning'), t('plan.planningText'))
16
+ : emptyState('plan', t('plan.none'), t('plan.noneText')));
16
17
  return root;
17
18
  }
18
19
  if (!plan) {
19
- append(root, problem(reply) ?? el('p', {}, 'No plan came back.'));
20
+ append(root, problem(reply) ?? el('p', {}, t('plan.noneBack')));
20
21
  return root;
21
22
  }
22
23
  append(root, ...findings(plan.findings));
23
24
  append(root, outgoing(plan.commits));
24
25
  if (plan.lines.length > 0) {
25
- append(root, card('What a run would do', [el('div', { class: 'table-wrap' }, el('table', { class: 'plan-lines' }, el('tbody', {}, ...plan.lines.map((line) => el('tr', {}, el('th', { scope: 'row' }, el('span', { class: 'step-chip' }, line.step)), el('td', {}, line.text))))))], { bodyClass: 'flush' }));
26
+ append(root, card(t('plan.wouldDo'), [el('div', { class: 'table-wrap' }, el('table', { class: 'plan-lines' }, el('tbody', {}, ...plan.lines.map((line) => el('tr', {}, el('th', { scope: 'row' }, el('span', { class: 'step-chip' }, line.step)), el('td', {}, line.text))))))], { bodyClass: 'flush' }));
26
27
  }
27
28
  if (reply.diagnostics.length > 0)
28
29
  append(root, diagnosticsBlock(reply.diagnostics));
@@ -33,25 +34,25 @@ export function renderPlan(app) {
33
34
  function outgoing(commits) {
34
35
  const range = validCommits(commits) && commits.ok ? commits.range : undefined;
35
36
  const summary = !range ? null
36
- : range.relation === 'ahead' ? `${range.addedTotal} commit${range.addedTotal === 1 ? '' : 's'}`
37
- : range.relation === 'diverged' ? `${range.addedTotal} new · ${range.removedTotal} only on the server`
38
- : range.relation === 'behind' ? `${range.removedTotal} behind`
37
+ : range.relation === 'ahead' ? t('plan.commitCount', { count: range.addedTotal })
38
+ : range.relation === 'diverged' ? t('plan.diverged', { added: range.addedTotal, removed: range.removedTotal })
39
+ : range.relation === 'behind' ? t('plan.behindCount', { count: range.removedTotal })
39
40
  : null;
40
- return card('What will go out', [
41
- range?.relation === 'diverged' ? banner('warn', 'The branch was rewritten on the remote', ['A run refuses it: its merge is fast-forward only. The commits only on the server would be lost.']) : null,
42
- range?.relation === 'behind' ? banner('warn', 'The remote\'s branch is behind the server', ['A run refuses it: its merge is fast-forward only.']) : null,
43
- range?.held ? banner('warn', 'This commit is held by a rollback', ['A run refuses it unless you deploy anyway (--unhold).']) : null,
44
- commitsBlock(commits, { added: 'Goes out', removed: 'Only on the server', same: 'Nothing new — the server already runs the tip of the branch.' }),
41
+ return card(t('plan.goesOutTitle'), [
42
+ range?.relation === 'diverged' ? banner('warn', t('plan.rewritten'), [t('plan.rewrittenHelp')]) : null,
43
+ range?.relation === 'behind' ? banner('warn', t('plan.behind'), [t('plan.behindHelp')]) : null,
44
+ range?.held ? banner('warn', t('plan.heldByRollback'), [t('plan.heldByRollbackHelp')]) : null,
45
+ commitsBlock(commits, { added: t('plan.goesOut'), removed: t('plan.onlyOnServer'), same: t('plan.nothingNew') }),
45
46
  ], { actions: range && range.relation !== 'same' ? [summary ? el('span', { class: 'muted' }, summary) : null, rangeSpan(range)] : [] });
46
47
  }
47
48
  function findings(list) {
48
49
  if (list.length === 0)
49
- return [banner('ok', 'No problem found.')];
50
+ return [banner('ok', t('plan.noProblem'))];
50
51
  const sorted = [...list].sort((a, b) => (a.level === b.level ? 0 : a.level === 'error' ? -1 : 1));
51
52
  const errors = list.filter((f) => f.level === 'error').length;
52
- return [card('Findings', [findingList(sorted)], {
53
+ return [card(t('plan.findings'), [findingList(sorted)], {
53
54
  bodyClass: 'flush',
54
- actions: [el('span', { class: 'muted' }, `${errors} error${errors === 1 ? '' : 's'}, ${list.length - errors} warning${list.length - errors === 1 ? '' : 's'}`)],
55
+ actions: [el('span', { class: 'muted' }, `${t('plan.errors', { count: errors })}, ${t('plan.warnings', { count: list.length - errors })}`)],
55
56
  })];
56
57
  }
57
58
  /** Findings with a severity badge; the fix is copyable text, never run by the page. */
@@ -59,24 +60,24 @@ export function findingList(list, label) {
59
60
  return el('ul', { class: 'findings', ...(label ? { aria: { label } } : {}) }, ...list.map((f) => findingItem(f)));
60
61
  }
61
62
  export function findingItem(f) {
62
- return el('li', { class: 'finding' }, el('span', { class: `sev sev-${f.level === 'error' ? 'error' : 'warning'}` }, f.level === 'error' ? 'Error ' : 'Warning '), el('span', { class: 'finding-msg' }, f.id ? el('span', { class: 'finding-id' }, `[${f.id}] `) : null, f.message), f.fix ? el('div', { class: 'fix' }, el('span', { class: 'fix-label' }, 'Fix: '), el('code', {}, f.fix)) : null);
63
+ return el('li', { class: 'finding' }, el('span', { class: `sev sev-${f.level === 'error' ? 'error' : 'warning'}` }, f.level === 'error' ? t('sev.error') : t('sev.warning')), el('span', { class: 'finding-msg' }, f.id ? el('span', { class: 'finding-id' }, `[${f.id}] `) : null, f.message), f.fix ? el('div', { class: 'fix' }, el('span', { class: 'fix-label' }, t('plan.fix')), el('code', {}, f.fix)) : null);
63
64
  }
64
65
  function questionField(question, index) {
65
66
  const id = `q-${index}`;
66
- const label = el('label', { for: id }, question.message, question.optional ? '' : el('span', { class: 'required', title: 'required' }, ' *'), question.key ? el('span', { class: 'field-key' }, ` (${question.key})`) : null);
67
+ const label = el('label', { for: id }, question.message, question.optional ? '' : el('span', { class: 'required', title: t('form.required') }, ' *'), question.key ? el('span', { class: 'field-key' }, ` (${question.key})`) : null);
67
68
  let input;
68
69
  if (question.kind === 'secret') {
69
70
  // No default, no autocomplete, no spellcheck: a secret is typed, sent once, and the field is emptied.
70
71
  input = el('input', { type: 'password', id, autocomplete: 'off', spellcheck: false, required: !question.optional, aria: { describedby: `${id}-error` } });
71
72
  }
72
73
  else if (question.kind === 'choice') {
73
- input = el('select', { id, aria: { describedby: `${id}-error` } }, ...(question.optional ? [el('option', { value: '' }, '(none)')] : []), ...(question.choices ?? []).map((c) => el('option', { value: c }, c)));
74
+ input = el('select', { id, aria: { describedby: `${id}-error` } }, ...(question.optional ? [el('option', { value: '' }, t('form.none'))] : []), ...(question.choices ?? []).map((c) => el('option', { value: c }, c)));
74
75
  if (question.default !== undefined)
75
76
  input.value = question.default;
76
77
  }
77
78
  else if (question.kind === 'confirm') {
78
79
  input = el('input', { type: 'checkbox', id, checked: question.default === 'yes' || question.default === 'true', aria: { describedby: `${id}-error` } });
79
- return { node: el('div', { class: 'field check' }, el('label', { for: id }, input, el('span', {}, question.message, question.optional ? '' : el('span', { class: 'required', title: 'required' }, ' *'), question.key ? el('span', { class: 'field-key' }, ` (${question.key})`) : null)), el('span', { id: `${id}-error`, class: 'field-error' })), field: { question, input } };
80
+ return { node: el('div', { class: 'field check' }, el('label', { for: id }, input, el('span', {}, question.message, question.optional ? '' : el('span', { class: 'required', title: t('form.required') }, ' *'), question.key ? el('span', { class: 'field-key' }, ` (${question.key})`) : null)), el('span', { id: `${id}-error`, class: 'field-error' })), field: { question, input } };
80
81
  }
81
82
  else {
82
83
  input = el('input', { type: 'text', id, value: question.default ?? '', autocomplete: 'off', spellcheck: false, required: !question.optional, aria: { describedby: `${id}-error` } });
@@ -104,7 +105,7 @@ function clearFields(fields) {
104
105
  }
105
106
  }
106
107
  function deployForm(app, questions, blocking) {
107
- const t = app.current;
108
+ const target = app.current;
108
109
  const fields = [];
109
110
  const nodes = questions.map((q, i) => {
110
111
  const { node, field } = questionField(q, i);
@@ -122,7 +123,7 @@ function deployForm(app, questions, blocking) {
122
123
  replace(slot, text);
123
124
  };
124
125
  const send = async (route) => {
125
- if (!t)
126
+ if (!target)
126
127
  return;
127
128
  replace(message);
128
129
  for (let i = 0; i < questions.length; i++) {
@@ -132,33 +133,33 @@ function deployForm(app, questions, blocking) {
132
133
  }
133
134
  const deploy = route === 'run';
134
135
  const ok = await confirmDialog({
135
- title: deploy ? `Deploy to ${t.name}?` : `Write the .env on ${t.name}?`,
136
- context: `${t.ssh} · ${t.dir}${app.hello ? ` · host ${app.hello.host}` : ''}${app.status ? ` · app ${app.status.app}` : ''}`,
136
+ title: deploy ? t('plan.deployTo', { name: target.name }) : t('plan.writeEnvOn', { name: target.name }),
137
+ context: [target.ssh, target.dir, app.hello ? t('ctx.hostPart', { host: app.hello.host }) : null, app.status ? t('ctx.appPart', { app: app.status.app }) : null].filter(Boolean).join(' · '),
137
138
  lines: [
138
- deploy ? 'Fetch, .env, build, migrate, restart, health check — the run goes on on the server if this page closes (unless attended).' : 'The .env and the dedicated infra only; nothing is built or restarted.',
139
- deploy && app.plan?.lines.some((l) => /migrat/i.test(l.step) || /migrat/i.test(l.text)) ? el('strong', {}, 'This will migrate the database.') : null,
139
+ deploy ? t('plan.deployLine') : t('plan.envLine'),
140
+ deploy && app.plan?.lines.some((l) => /migrat/i.test(l.step) || /migrat/i.test(l.text)) ? el('strong', {}, t('plan.willMigrate')) : null,
140
141
  ],
141
- confirmLabel: deploy ? 'Deploy' : 'Write .env',
142
+ confirmLabel: deploy ? t('plan.deploy') : t('plan.writeEnv'),
142
143
  danger: true,
143
- ...(t.protected ? { typeToConfirm: t.name } : {}),
144
+ ...(target.protected ? { typeToConfirm: target.name } : {}),
144
145
  });
145
146
  if (!ok)
146
147
  return;
147
148
  const answers = collectAnswers(fields);
148
149
  clearFields(fields);
149
- const body = { target: t.name, confirm: true, confirmedTarget: t, answers, ...(t.protected ? { confirmName: t.name } : {}) };
150
+ const body = { target: target.name, confirm: true, confirmedTarget: target, answers, ...(target.protected ? { confirmName: target.name } : {}) };
150
151
  if (!deploy) {
151
- app.attended(`env on ${t.name}`, 'env', body);
152
+ app.attended(t('plan.envOn', { name: target.name }), 'env', body);
152
153
  return;
153
154
  }
154
155
  if (unhold.checked)
155
156
  body['unhold'] = true;
156
157
  if (attended.checked) {
157
158
  body['attended'] = true;
158
- app.attended(`run on ${t.name} (attended)`, 'run', body);
159
+ app.attended(t('plan.runAttended', { name: target.name }), 'run', body);
159
160
  return;
160
161
  }
161
- replace(message, el('p', { class: 'muted' }, 'Starting the run on the server…'));
162
+ replace(message, el('p', { class: 'muted' }, t('plan.starting')));
162
163
  let reply;
163
164
  try {
164
165
  reply = await app.api.post('run', body);
@@ -174,15 +175,15 @@ function deployForm(app, questions, blocking) {
174
175
  const result = reply.result;
175
176
  if (reply.ok && result?.runId) {
176
177
  replace(message);
177
- app.watch(result.runId, `run ${result.runId}`);
178
+ app.watch(result.runId, t('run.title', { runId: result.runId }));
178
179
  return;
179
180
  }
180
181
  if (reply.error && /^answer-/.test(reply.error.code)) {
181
182
  const id = /env\.[A-Z_][A-Z0-9_]*/.exec(reply.error.message)?.[0];
182
183
  if (id)
183
- showFieldError(id, `${reply.error.message} — type it again`);
184
+ showFieldError(id, t('plan.typeAgain', { message: reply.error.message }));
184
185
  }
185
186
  replace(message, problem(reply));
186
187
  };
187
- return el('form', { class: 'card', aria: { label: 'Deploy' }, on: { submit: (event) => { event.preventDefault(); void send('run'); } } }, el('div', { class: 'card-head' }, el('h3', {}, questions.length > 0 ? 'What the run will ask' : 'Deploy'), t?.protected ? el('span', { class: 'badge badge-protected' }, icon('shield'), 'PROTECTED') : null), el('div', { class: 'card-body' }, el('p', { class: 'form-note' }, icon(questions.length > 0 ? 'lock' : 'ok'), questions.length > 0 ? 'Secrets are sent once, over your ssh, to the deploy on the server; they are never stored here and the fields are emptied after sending.' : 'Nothing to answer: the .env is complete.'), nodes.length > 0 ? el('div', { class: 'form-section' }, ...nodes) : null, el('div', { class: 'form-section' }, hold ? el('div', { class: 'field check' }, el('label', { for: 'unhold' }, unhold, el('span', {}, ' Deploy anyway: the held commit ', el('code', {}, hold.sha.slice(0, 12)), ' may be deployed (--unhold)'))) : null, el('details', { class: 'advanced' }, el('summary', {}, 'Advanced'), el('div', { class: 'field check' }, el('label', { for: 'attended' }, attended, el('span', {}, ' Attended: the run stops at its next step if this page closes or the UI quits'))))), blocking ? banner('err', 'The plan found problems that stop a run: fix them first.') : null, message), el('div', { class: 'card-foot' }, button('Write .env only…', () => { void send('env'); }), el('button', { type: 'submit', class: 'primary', disabled: blocking }, 'Deploy…')));
188
+ return el('form', { class: 'card', aria: { label: t('plan.deploy') }, on: { submit: (event) => { event.preventDefault(); void send('run'); } } }, el('div', { class: 'card-head' }, el('h3', {}, questions.length > 0 ? t('plan.willAsk') : t('plan.deploy')), target?.protected ? el('span', { class: 'badge badge-protected' }, icon('shield'), t('protected.badge')) : null), el('div', { class: 'card-body' }, el('p', { class: 'form-note' }, icon(questions.length > 0 ? 'lock' : 'ok'), questions.length > 0 ? t('plan.secrets') : t('plan.nothingToAnswer')), nodes.length > 0 ? el('div', { class: 'form-section' }, ...nodes) : null, el('div', { class: 'form-section' }, hold ? el('div', { class: 'field check' }, el('label', { for: 'unhold' }, unhold, el('span', {}, t('plan.unhold'), el('code', {}, hold.sha.slice(0, 12)), t('plan.unholdTail')))) : null, el('details', { class: 'advanced' }, el('summary', {}, t('plan.advanced')), el('div', { class: 'field check' }, el('label', { for: 'attended' }, attended, el('span', {}, t('plan.attended')))))), blocking ? banner('err', t('plan.blocks')) : null, message), el('div', { class: 'card-foot' }, button(t('plan.writeEnvOnly'), () => { void send('env'); }), el('button', { type: 'submit', class: 'primary', disabled: blocking }, t('plan.deployEllipsis'))));
188
189
  }