@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.
- package/README.md +6 -0
- package/dist/client/api.js +6 -5
- package/dist/client/app.js +78 -36
- package/dist/client/dialog.js +3 -2
- package/dist/client/i18n-messages.js +14 -0
- package/dist/client/i18n.js +756 -0
- package/dist/client/icons.js +1 -0
- package/dist/client/main.js +12 -10
- package/dist/client/messages.d.ts +2 -0
- package/dist/client/reply.js +8 -7
- package/dist/client/view-commits.js +10 -24
- package/dist/client/view-history.js +39 -34
- package/dist/client/view-plan.js +36 -35
- package/dist/client/view-run.js +52 -48
- package/dist/client/view-status.js +27 -26
- package/dist/client/view-targets.js +26 -25
- package/dist/page.d.ts +2 -2
- package/dist/page.js +7 -1
- package/dist/server.js +9 -3
- package/dist/targets.d.ts +6 -0
- package/dist/targets.js +8 -2
- package/package.json +3 -2
package/dist/client/icons.js
CHANGED
|
@@ -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';
|
package/dist/client/main.js
CHANGED
|
@@ -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', {}, '
|
|
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 ? '
|
|
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' }, '
|
|
100
|
-
const form = el('form', { class: 'card pair', aria: { label: '
|
|
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, '
|
|
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', {}, '
|
|
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
|
}
|
package/dist/client/reply.js
CHANGED
|
@@ -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', '
|
|
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', '
|
|
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(
|
|
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' ? '
|
|
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', {},
|
|
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
|
-
|
|
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', {}, '
|
|
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
|
|
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(
|
|
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' },
|
|
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' },
|
|
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('
|
|
57
|
+
return unavailable(t('commits.olderDeploy'));
|
|
72
58
|
if (!validCommits(value))
|
|
73
|
-
return unavailable('
|
|
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' },
|
|
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: '' },
|
|
16
|
-
return el('section', { aria: { labelledby: 'history-title' } }, pageHead('history-title', '
|
|
17
|
-
el('div', { class: 'field' }, el('label', { for: 'rollback-to' }, '
|
|
18
|
-
el('p', { class: 'form-note' }, icon('alert'), '
|
|
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('
|
|
23
|
-
button('
|
|
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 = ['
|
|
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' }, '
|
|
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 ?
|
|
38
|
-
aria: { expanded: 'false', label: from ?
|
|
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('
|
|
52
|
+
return unavailable(t('commits.olderDeploy'));
|
|
50
53
|
if (!reply.ok && !reply.result)
|
|
51
|
-
return problem(reply) ?? unavailable('
|
|
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', {}, '
|
|
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: '
|
|
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: ['
|
|
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: '
|
|
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: ['
|
|
89
|
+
return { lines: [t('history.previewUnavailable')], block };
|
|
87
90
|
if (!commits.ok)
|
|
88
|
-
return { lines: [
|
|
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', '
|
|
95
|
-
r.addedTotal > 0 ? commitSummary('added', '
|
|
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', {}, '
|
|
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
|
|
105
|
-
if (!
|
|
107
|
+
const target = app.current;
|
|
108
|
+
if (!target)
|
|
106
109
|
return;
|
|
107
|
-
replace(area, el('div', { class: 'commits-note' }, icon('refresh'), el('span', {}, '
|
|
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:
|
|
112
|
-
context:
|
|
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 ?
|
|
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
|
-
'
|
|
121
|
+
t('history.heldUntil'),
|
|
117
122
|
],
|
|
118
|
-
confirmLabel: '
|
|
123
|
+
confirmLabel: t('history.rollBackConfirm'),
|
|
119
124
|
danger: true,
|
|
120
|
-
...(
|
|
125
|
+
...(target.protected ? { typeToConfirm: target.name } : {}),
|
|
121
126
|
});
|
|
122
127
|
if (!ok)
|
|
123
128
|
return;
|
|
124
|
-
replace(message, el('p', { class: 'muted' }, '
|
|
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:
|
|
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,
|
|
145
|
+
app.watch(result.runId, t('run.rollbackTitle', { runId: result.runId }));
|
|
141
146
|
return;
|
|
142
147
|
}
|
|
143
148
|
replace(message, problem(reply));
|
package/dist/client/view-plan.js
CHANGED
|
@@ -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', '
|
|
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', '
|
|
15
|
-
: emptyState('plan', '
|
|
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', {}, '
|
|
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('
|
|
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' ?
|
|
37
|
-
: range.relation === 'diverged' ?
|
|
38
|
-
: range.relation === '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('
|
|
41
|
-
range?.relation === 'diverged' ? banner('warn', '
|
|
42
|
-
range?.relation === 'behind' ? banner('warn', '
|
|
43
|
-
range?.held ? banner('warn', '
|
|
44
|
-
commitsBlock(commits, { added: '
|
|
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', '
|
|
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('
|
|
53
|
+
return [card(t('plan.findings'), [findingList(sorted)], {
|
|
53
54
|
bodyClass: 'flush',
|
|
54
|
-
actions: [el('span', { class: 'muted' }, `${errors
|
|
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' ? '
|
|
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: '' }, '
|
|
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
|
|
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 (!
|
|
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 ?
|
|
136
|
-
context:
|
|
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 ? '
|
|
139
|
-
deploy && app.plan?.lines.some((l) => /migrat/i.test(l.step) || /migrat/i.test(l.text)) ? el('strong', {}, '
|
|
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 ? '
|
|
142
|
+
confirmLabel: deploy ? t('plan.deploy') : t('plan.writeEnv'),
|
|
142
143
|
danger: true,
|
|
143
|
-
...(
|
|
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:
|
|
150
|
+
const body = { target: target.name, confirm: true, confirmedTarget: target, answers, ...(target.protected ? { confirmName: target.name } : {}) };
|
|
150
151
|
if (!deploy) {
|
|
151
|
-
app.attended(
|
|
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(
|
|
159
|
+
app.attended(t('plan.runAttended', { name: target.name }), 'run', body);
|
|
159
160
|
return;
|
|
160
161
|
}
|
|
161
|
-
replace(message, el('p', { class: 'muted' }, '
|
|
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,
|
|
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,
|
|
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: '
|
|
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
|
}
|