@scalio-cloud/ui 0.58.0 → 0.60.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 +32 -1
- package/package.json +1 -1
- package/react/ai.js +3 -1
- package/react/dialog.js +10 -1
- package/react/saas_updates.js +100 -12
package/README.md
CHANGED
|
@@ -439,9 +439,13 @@ import { askConfirm, askText, showMessage } from "@scalio-cloud/ui/react";
|
|
|
439
439
|
if (!(await askConfirm({ title: "Benutzer löschen", text: "Das lässt sich nicht rückgängig machen.", confirmLabel: "Löschen", danger: true }))) return;
|
|
440
440
|
const name = await askText({ title: "Umbenennen", label: "Neuer Name", value: old, required: true }); // null on Abbrechen
|
|
441
441
|
await showMessage({ title: "Gespeichert", text: "Alles da." });
|
|
442
|
+
const a = await askConfirm({ text: "Einschalten?", check: "Fehlerberichte senden" }); // false or { checked }
|
|
442
443
|
```
|
|
443
444
|
|
|
444
|
-
|
|
445
|
+
`check` (since 0.60.0) adds a checkbox under the text, off unless `checked: true`; OK then resolves `{ checked }`
|
|
446
|
+
(truthy) instead of `true`, Abbrechen still `false`. Without `check` nothing changes.
|
|
447
|
+
|
|
448
|
+
Test IDs: `confirm-dialog`, `confirm-dialog-ok`, `confirm-dialog-cancel`, `confirm-dialog-input`, `confirm-dialog-check`. `SaasUpdatesPanel` asks
|
|
445
449
|
with `askConfirm` and then shows `UpdateProgress` (`saas-update-progress`): it polls `/version.json` (props
|
|
446
450
|
`versionUrl`, `checkVersion`, `pollMs` 5 s, `timeoutMs` 20 min) and reloads the page once the new version runs.
|
|
447
451
|
|
|
@@ -552,6 +556,33 @@ const updates = saasUpdatesApi(api); // once, outside the component
|
|
|
552
556
|
The banner is blue (orange for a security update); people without admin role only see when the update is planned.
|
|
553
557
|
«Später» hides it for this version until the next browser session.
|
|
554
558
|
|
|
559
|
+
### Vorabversionen (pre-releases)
|
|
560
|
+
|
|
561
|
+
Since 0.60.0 (scalio-docs ADR 0115, BL-404) the panel can show the switch «Vorabversionen anzeigen» (EN «Show
|
|
562
|
+
pre-releases»). It is optional: without `admin` and `onPrereleaseChange` the panel looks exactly as before.
|
|
563
|
+
|
|
564
|
+
```jsx
|
|
565
|
+
<SaasUpdatesPanel client={updates} lang={lang} admin={isAdmin}
|
|
566
|
+
prerelease={settings.prerelease} // stored value, default off
|
|
567
|
+
onPrereleaseChange={(on, o) => api.put("/settings/prerelease", { on, ...o })} // the app saves it
|
|
568
|
+
notify={…} />
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
- The switch shows only with `admin={true}` and an `onPrereleaseChange` function. Turning it on asks first (no way
|
|
572
|
+
back, only the backup before the update; best-effort support) with the checkbox «Fehlerberichte aus Vorabversionen
|
|
573
|
+
an Scalio senden» (off by default, ADR 0115 P9) and calls `onPrereleaseChange(true, { errorReports })`; turning it
|
|
574
|
+
off asks nothing and calls `onPrereleaseChange(false)` (stops only new pre-releases). A rejected promise keeps the old value and shows the error (`saas-updates-prerelease-error`).
|
|
575
|
+
- Self-hosted (`saas: false`) or while `/saas-updates` fails, the section shows only the switch (the Scalio Installer
|
|
576
|
+
reads the value from the app).
|
|
577
|
+
- An offer with `prerelease: true` gets the title «Vorabversion 1.3.0rc2 ist verfügbar» with an orange badge
|
|
578
|
+
«Vorabversion», a warning below it, «keine Frist, nur auf Klick» instead of the deadline, no «Verschieben bis», and
|
|
579
|
+
«Jetzt aktualisieren» asks with the warning and a red button. The banner shows the same badge and «Wird nur auf
|
|
580
|
+
Klick installiert.».
|
|
581
|
+
- `PrereleaseSwitch` (props `value`, `onChange`, `lang`, `labels`, `notify`, `disabled`) is exported for other pages.
|
|
582
|
+
|
|
583
|
+
Test IDs: `saas-updates-prerelease`, `saas-updates-prerelease-switch`, `saas-updates-prerelease-error`,
|
|
584
|
+
`saas-updates-prerelease-badge`, `saas-updates-prerelease-warning`, `saas-update-banner-prerelease`.
|
|
585
|
+
|
|
555
586
|
## Scalio Agent: Einstellungen → Scalio Agent (React)
|
|
556
587
|
|
|
557
588
|
Since 0.56.0 (scalio-docs ADR 0107, `interfaces/agent-v2.md`) every app that uses the Scalio Agent shows the same
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.60.0",
|
|
4
4
|
"description": "Scalio Control Room design tokens, Tailwind preset, self-hosted fonts, the shared app header, sign-in layout, sidebar and page blocks",
|
|
5
5
|
"license": "SEE LICENSE IN README.md",
|
|
6
6
|
"private": false,
|
package/react/ai.js
CHANGED
|
@@ -226,7 +226,8 @@ function aiApi(api, paths) {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
-
// Props: value (public_settings `ai`), status ({licensed, managed, defaults
|
|
229
|
+
// Props: value (public_settings `ai`), status ({licensed, managed, defaults, scalio, local}; `local: false` hides Ollama,
|
|
230
|
+
// e.g. on SaaS where the server cannot reach the customer's network), onSave(patch) -> Promise,
|
|
230
231
|
// client (aiApi; optional, without it no usage block), features ([{key, label, hint, max}]), canReset,
|
|
231
232
|
// demo, lang, labels, notify(message, tone), formatError(err).
|
|
232
233
|
function AiSettingsPanel(props) {
|
|
@@ -290,6 +291,7 @@ function AiSettingsPanel(props) {
|
|
|
290
291
|
h("select", { id: "ai-provider", className: "scalio-input", value: p, disabled: off, "data-testid": "ai-provider-select",
|
|
291
292
|
onChange: (e) => set({ activeProvider: e.target.value }) },
|
|
292
293
|
PROVIDERS.filter((x) => x !== "scalio" || status.scalio !== false || p === "scalio")
|
|
294
|
+
.filter((x) => x !== "ollama" || status.local !== false || p === "ollama")
|
|
293
295
|
.map((x) => h("option", { key: x, value: x }, PROVIDER_NAMES[x])))));
|
|
294
296
|
}
|
|
295
297
|
if (!managed && p === "scalio") {
|
package/react/dialog.js
CHANGED
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
// from `if (!confirm(t)) return;` to `if (!(await askConfirm({ text: t }))) return;`.
|
|
5
5
|
// The dialog mounts itself into document.body on first use; apps need no provider. Keyboard as ADR 0095: the focus
|
|
6
6
|
// starts on OK (or the text field), Enter confirms, Escape cancels, Tab stays inside.
|
|
7
|
+
// askConfirm({ check: "Label", checked }) adds a checkbox (off unless `checked`); OK then resolves { checked } instead
|
|
8
|
+
// of true (still truthy), cancel stays false (ADR 0115 P9, e.g. «Fehlerberichte an Scalio senden»).
|
|
7
9
|
|
|
8
10
|
const React = require("react");
|
|
9
11
|
const { labelsFor } = require("./labels");
|
|
@@ -65,12 +67,14 @@ function ConfirmDialog(props) {
|
|
|
65
67
|
const { kind, title, text, label, placeholder, danger, required, onDone } = props;
|
|
66
68
|
const L = Object.assign({}, labelsFor(props.lang || pageLang()).dialog);
|
|
67
69
|
const [value, setValue] = React.useState(props.value == null ? "" : String(props.value));
|
|
70
|
+
const withCheck = kind === "confirm" && !!props.check;
|
|
71
|
+
const [checked, setChecked] = React.useState(!!props.checked);
|
|
68
72
|
const panel = React.useRef(null);
|
|
69
73
|
const okRef = React.useRef(null);
|
|
70
74
|
const inputRef = React.useRef(null);
|
|
71
75
|
const blocked = kind === "text" && required && !value.trim();
|
|
72
76
|
const cancelValue = kind === "confirm" ? false : kind === "text" ? null : undefined;
|
|
73
|
-
const ok = () => { if (!blocked) onDone(kind === "confirm" ? true : kind === "text" ? value.trim() : undefined); };
|
|
77
|
+
const ok = () => { if (!blocked) onDone(kind === "confirm" ? (withCheck ? { checked } : true) : kind === "text" ? value.trim() : undefined); };
|
|
74
78
|
const cancel = () => onDone(cancelValue);
|
|
75
79
|
|
|
76
80
|
React.useEffect(() => {
|
|
@@ -114,6 +118,11 @@ function ConfirmDialog(props) {
|
|
|
114
118
|
onChange: (e) => setValue(e.target.value), onInput: (e) => setValue(e.target.value),
|
|
115
119
|
}))
|
|
116
120
|
: null,
|
|
121
|
+
withCheck
|
|
122
|
+
? h("label", { className: "scalio-settings-check scalio-dialog-check" },
|
|
123
|
+
h("input", { type: "checkbox", checked, "data-testid": "confirm-dialog-check", onChange: (e) => setChecked(e.target.checked) }),
|
|
124
|
+
h("span", null, props.check))
|
|
125
|
+
: null,
|
|
117
126
|
h(
|
|
118
127
|
"div",
|
|
119
128
|
{ className: "scalio-dialog-actions" },
|
package/react/saas_updates.js
CHANGED
|
@@ -7,7 +7,7 @@ const React = require("react");
|
|
|
7
7
|
const h = React.createElement;
|
|
8
8
|
const Icons = require("./icons");
|
|
9
9
|
const { Notice } = require("./blocks");
|
|
10
|
-
const { SettingsSection, SettingsField: Field } = require("./settings");
|
|
10
|
+
const { SettingsSection, SettingsField: Field, SettingsRow } = require("./settings");
|
|
11
11
|
const { askConfirm } = require("./dialog");
|
|
12
12
|
const { trapTab } = require("./wizard");
|
|
13
13
|
|
|
@@ -65,6 +65,18 @@ const LABELS = {
|
|
|
65
65
|
notConnected: "Die Verbindung dieser Instanz zu Scalio wird gerade eingerichtet. Danach sehen Sie hier die Updates. Bleibt diese Meldung länger als eine Stunde, melden Sie sich bitte beim Support.",
|
|
66
66
|
saved: "Gespeichert.",
|
|
67
67
|
weekdays: ["Mo", "Di", "Mi", "Do", "Fr", "Sa", "So"],
|
|
68
|
+
prerelease: "Vorabversion",
|
|
69
|
+
prereleaseAvailable: "Vorabversion {version} ist verfügbar",
|
|
70
|
+
prereleaseSwitch: "Vorabversionen anzeigen",
|
|
71
|
+
prereleaseHint: "Vorabversionen sind Release Candidates, die Scalio vor dem Release für Kunden freigibt. Sie werden nie automatisch installiert, nur auf Ihren Klick. Ausschalten stoppt nur neue Vorabversionen; eine installierte bleibt, bis das nächste Release kommt.",
|
|
72
|
+
prereleaseConfirmTitle: "Vorabversionen anzeigen?",
|
|
73
|
+
prereleaseConfirm: "Vorabversionen sind Testversionen vor dem Release. Nach dem Update gibt es kein Zurück auf die alte Version, nur die Wiederherstellung der Sicherung vor dem Update. Support nach bestem Bemühen, ohne SLA. Vorabversionen werden nur auf Ihren Klick installiert.",
|
|
74
|
+
prereleaseConfirmGo: "Einschalten",
|
|
75
|
+
prereleaseErrorReports: "Fehlerberichte aus Vorabversionen an Scalio senden",
|
|
76
|
+
prereleaseWarning: "Vorabversion: Testversion vor dem Release. Nach dem Update gibt es kein Zurück auf die alte Version, nur die Wiederherstellung der Sicherung vor dem Update. Support nach bestem Bemühen, ohne SLA.",
|
|
77
|
+
prereleaseNoDue: "keine Frist, nur auf Klick",
|
|
78
|
+
prereleaseNowConfirm: "Vorabversion {version} jetzt installieren? Es gibt kein Zurück auf die alte Version, nur die Wiederherstellung der Sicherung vor dem Update. Die Anwendung ist einige Minuten nicht erreichbar.",
|
|
79
|
+
bannerPrerelease: "Wird nur auf Klick installiert.",
|
|
68
80
|
},
|
|
69
81
|
en: {
|
|
70
82
|
title: "Updates",
|
|
@@ -119,6 +131,18 @@ const LABELS = {
|
|
|
119
131
|
notConnected: "Scalio is still setting up the connection of this instance. The updates show here once it is ready. If this message stays for more than an hour, please contact support.",
|
|
120
132
|
saved: "Saved.",
|
|
121
133
|
weekdays: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
|
|
134
|
+
prerelease: "Pre-release",
|
|
135
|
+
prereleaseAvailable: "Pre-release {version} is available",
|
|
136
|
+
prereleaseSwitch: "Show pre-releases",
|
|
137
|
+
prereleaseHint: "Pre-releases are release candidates Scalio opens to customers before the release. They are never installed automatically, only on your click. Turning this off only stops new pre-releases; an installed one stays until the next release.",
|
|
138
|
+
prereleaseConfirmTitle: "Show pre-releases?",
|
|
139
|
+
prereleaseConfirm: "Pre-releases are test versions before the release. After the update there is no way back to the old version, only restoring the backup taken before the update. Best-effort support, no SLA. Pre-releases are installed only on your click.",
|
|
140
|
+
prereleaseConfirmGo: "Turn on",
|
|
141
|
+
prereleaseErrorReports: "Send error reports from pre-releases to Scalio",
|
|
142
|
+
prereleaseWarning: "Pre-release: a test version before the release. After the update there is no way back to the old version, only restoring the backup taken before the update. Best-effort support, no SLA.",
|
|
143
|
+
prereleaseNoDue: "no deadline, only on a click",
|
|
144
|
+
prereleaseNowConfirm: "Install pre-release {version} now? There is no way back to the old version, only restoring the backup taken before the update. The application is unavailable for a few minutes.",
|
|
145
|
+
bannerPrerelease: "Installed only on a click.",
|
|
122
146
|
},
|
|
123
147
|
};
|
|
124
148
|
|
|
@@ -178,19 +202,31 @@ function UpdateBanner(props) {
|
|
|
178
202
|
return h(Notice, { kind: "info", banner: true, testId: "saas-update-banner", title: fill(L.plannedTitle, { planned: when(offer.planned_at, props.lang) }),
|
|
179
203
|
onDismiss: later, dismissLabel: L.later }, fill(L.plannedText, { version: offer.version }));
|
|
180
204
|
}
|
|
181
|
-
|
|
182
|
-
|
|
205
|
+
// A pre-release (ADR 0115) never has a deadline and installs only on a click.
|
|
206
|
+
const pre = !!offer.prerelease;
|
|
207
|
+
const text = (pre
|
|
208
|
+
? [offer.planned_at ? fill(L.bannerPlanned, { planned: when(offer.planned_at, props.lang) }) : L.bannerPrerelease]
|
|
209
|
+
: [fill(L.bannerText, { due: when(offer.due_at, props.lang) }),
|
|
210
|
+
offer.planned_at ? fill(L.bannerPlanned, { planned: when(offer.planned_at, props.lang) }) : L.bannerManual]).join(" ");
|
|
183
211
|
// onOpen (e.g. the router's navigate) wins over a plain link to settingsTo.
|
|
184
212
|
const action = props.onOpen
|
|
185
213
|
? { label: L.bannerAction, onClick: props.onOpen, testId: "saas-update-banner-open" }
|
|
186
214
|
: props.settingsTo ? { label: L.bannerAction, href: props.settingsTo, testId: "saas-update-banner-open" } : null;
|
|
187
215
|
return h(Notice, {
|
|
188
216
|
kind: offer.kind === "security" ? "warn" : "info", banner: true, testId: "saas-update-banner",
|
|
189
|
-
title:
|
|
217
|
+
title: offerTitle(offer, L, "saas-update-banner-prerelease"),
|
|
190
218
|
action, onDismiss: later, dismissLabel: L.later,
|
|
191
219
|
}, text);
|
|
192
220
|
}
|
|
193
221
|
|
|
222
|
+
// «Version 1.1.0 ist verfügbar»; a pre-release gets its own wording and the badge «Vorabversion».
|
|
223
|
+
function offerTitle(offer, L, badgeId) {
|
|
224
|
+
const text = fill(offer.prerelease ? L.prereleaseAvailable : offer.kind === "security" ? L.security : L.available, { version: offer.version });
|
|
225
|
+
if (!offer.prerelease) return text;
|
|
226
|
+
return h(React.Fragment, null, text, " ",
|
|
227
|
+
h("span", { className: "scalio-badge is-warn", "data-testid": badgeId }, L.prerelease));
|
|
228
|
+
}
|
|
229
|
+
|
|
194
230
|
const EMPTY_WINDOW = { days: [], start: "02:00", hours: 3, tz: "Europe/Zurich" };
|
|
195
231
|
|
|
196
232
|
// The running version as the instance itself reports it (/version.json of the frontend image, ADR 0074).
|
|
@@ -260,10 +296,53 @@ function UpdateProgress(props) {
|
|
|
260
296
|
: null)));
|
|
261
297
|
}
|
|
262
298
|
|
|
299
|
+
// Switch «Vorabversionen anzeigen» (ADR 0115 P3/P6/P7): per app, admin only, off by default. The app stores the value
|
|
300
|
+
// (onChange(on) may return a promise; a rejection keeps the old value and shows the error). Turning it on asks first,
|
|
301
|
+
// with the checkbox «Fehlerberichte aus Vorabversionen an Scalio senden» (off): onChange(true, { errorReports }).
|
|
302
|
+
function PrereleaseSwitch(props) {
|
|
303
|
+
const L = labels(props.lang, props.labels);
|
|
304
|
+
const fmtErr = props.formatError || errorText;
|
|
305
|
+
const [on, setOn] = React.useState(!!props.value);
|
|
306
|
+
const [busy, setBusy] = React.useState(false);
|
|
307
|
+
const [error, setError] = React.useState("");
|
|
308
|
+
React.useEffect(() => { setOn(!!props.value); }, [props.value]);
|
|
309
|
+
const change = async (next) => {
|
|
310
|
+
let opts = null;
|
|
311
|
+
if (next) {
|
|
312
|
+
const yes = await askConfirm({ title: L.prereleaseConfirmTitle, text: L.prereleaseConfirm, confirmLabel: L.prereleaseConfirmGo,
|
|
313
|
+
check: L.prereleaseErrorReports, lang: props.lang });
|
|
314
|
+
if (!yes) return;
|
|
315
|
+
opts = { errorReports: !!yes.checked }; // ADR 0115 P9, off unless ticked
|
|
316
|
+
}
|
|
317
|
+
setBusy(true);
|
|
318
|
+
setError("");
|
|
319
|
+
try {
|
|
320
|
+
await (opts ? props.onChange(next, opts) : props.onChange(next));
|
|
321
|
+
setOn(next);
|
|
322
|
+
} catch (e) {
|
|
323
|
+
const t = fmtErr(e);
|
|
324
|
+
if (props.notify) props.notify(t, "error");
|
|
325
|
+
setError(t);
|
|
326
|
+
}
|
|
327
|
+
setBusy(false);
|
|
328
|
+
};
|
|
329
|
+
return h("div", { "data-testid": "saas-updates-prerelease" },
|
|
330
|
+
h(SettingsRow, { title: L.prereleaseSwitch, hint: L.prereleaseHint },
|
|
331
|
+
h("input", { type: "checkbox", role: "switch", className: "scalio-switch", checked: on, disabled: busy || props.disabled,
|
|
332
|
+
"aria-label": L.prereleaseSwitch, "data-testid": "saas-updates-prerelease-switch", onChange: (e) => change(e.target.checked) })),
|
|
333
|
+
error ? h("div", { className: "scalio-notice is-error", role: "alert", "data-testid": "saas-updates-prerelease-error" }, error) : null);
|
|
334
|
+
}
|
|
335
|
+
|
|
263
336
|
// Props: client (saasUpdatesApi), lang, labels, notify(message, tone), formatError(err).
|
|
337
|
+
// Pre-releases (ADR 0115, optional): admin (true shows the switch), prerelease (stored value, default off),
|
|
338
|
+
// onPrereleaseChange(on, { errorReports }) (the app saves it; the options come only when turning on). Without onPrereleaseChange and admin the panel looks as before.
|
|
264
339
|
function SaasUpdatesPanel(props) {
|
|
265
340
|
const L = labels(props.lang, props.labels);
|
|
266
341
|
const fmtErr = props.formatError || errorText;
|
|
342
|
+
const preSwitch = props.admin === true && typeof props.onPrereleaseChange === "function"
|
|
343
|
+
? h(PrereleaseSwitch, { key: "prerelease", value: props.prerelease, onChange: props.onPrereleaseChange, lang: props.lang,
|
|
344
|
+
labels: props.labels, notify: props.notify, formatError: props.formatError })
|
|
345
|
+
: null;
|
|
267
346
|
const [st, setSt] = React.useState(null);
|
|
268
347
|
const [busy, setBusy] = React.useState(false);
|
|
269
348
|
const [error, setError] = React.useState("");
|
|
@@ -298,21 +377,23 @@ function SaasUpdatesPanel(props) {
|
|
|
298
377
|
return ok;
|
|
299
378
|
};
|
|
300
379
|
const updateNow = async (offer) => {
|
|
301
|
-
const yes = await askConfirm({ title: L.now, text: fill(L.nowConfirm, { version: offer.version }),
|
|
380
|
+
const yes = await askConfirm({ title: L.now, text: fill(offer.prerelease ? L.prereleaseNowConfirm : L.nowConfirm, { version: offer.version }),
|
|
381
|
+
confirmLabel: L.nowGo, danger: !!offer.prerelease, lang: props.lang });
|
|
302
382
|
if (!yes) return;
|
|
303
383
|
const from = st && st.current_version;
|
|
304
384
|
if (await act("now")) setUpdating({ version: offer.version, from });
|
|
305
385
|
};
|
|
306
386
|
|
|
307
387
|
if (!st) return h(SettingsSection, { id: "updates", title: L.title, description: L.hint, testId: "saas-updates" },
|
|
308
|
-
error ? h("div", { className: "scalio-notice is-error", role: "alert" }, error) : null);
|
|
309
|
-
|
|
388
|
+
error ? h("div", { key: "err", className: "scalio-notice is-error", role: "alert" }, error) : null, preSwitch);
|
|
389
|
+
// Self-hosted: no Compass offers here, but the switch stays (the Scalio Installer reads it, ADR 0115 P6).
|
|
390
|
+
if (st.saas === false) return preSwitch ? h(SettingsSection, { id: "updates", title: L.title, testId: "saas-updates" }, preSwitch) : null;
|
|
310
391
|
|
|
311
392
|
// No active support connection: nothing to show or change until Compass has paired the instance (in SaaS
|
|
312
393
|
// Compass pairs it, never the customer). Older scalio-connect only sends the error text.
|
|
313
394
|
if (st.connected === false || (st.connected === undefined && st.error === "Keine Verbindung zu Compass")) {
|
|
314
395
|
return h(SettingsSection, { id: "updates", title: L.title, description: L.hint, testId: "saas-updates" },
|
|
315
|
-
h("div", { className: "scalio-notice is-warn", "data-testid": "saas-updates-not-connected" }, L.notConnected));
|
|
396
|
+
h("div", { key: "nc", className: "scalio-notice is-warn", "data-testid": "saas-updates-not-connected" }, L.notConnected), preSwitch);
|
|
316
397
|
}
|
|
317
398
|
|
|
318
399
|
const offer = st.offer;
|
|
@@ -323,12 +404,17 @@ function SaasUpdatesPanel(props) {
|
|
|
323
404
|
if (st.reachable !== false) rows.push(h("p", { key: "none", className: "scalio-settings-text", "data-testid": "saas-updates-none" }, L.none));
|
|
324
405
|
} else {
|
|
325
406
|
const due = offer.due_at ? offer.due_at.slice(0, 10) : "";
|
|
407
|
+
const pre = !!offer.prerelease; // ADR 0115: no deadline, never forced, only on a click
|
|
326
408
|
rows.push(h("div", { key: "offer", className: cxNotice(offer), "data-testid": "saas-updates-offer" },
|
|
327
409
|
h("div", { className: "scalio-notice-body" },
|
|
328
|
-
h("div", { className: "scalio-notice-title" },
|
|
410
|
+
h("div", { className: "scalio-notice-title" }, offerTitle(offer, L, "saas-updates-prerelease-badge")),
|
|
329
411
|
h("div", { className: "scalio-notice-text" },
|
|
330
|
-
|
|
412
|
+
pre && !offer.due_at
|
|
413
|
+
? [L.prereleaseNoDue].concat(offer.planned_at ? [`${L.planned}: ${when(offer.planned_at, props.lang)}`] : []).join(" · ")
|
|
414
|
+
: `${L.due}: ${when(offer.due_at, props.lang)} · ${L.planned}: ${offer.planned_at ? when(offer.planned_at, props.lang) : L.plannedNone}`,
|
|
331
415
|
offer.held ? h("div", null, L.held) : null, offer.forced ? h("div", null, L.forced) : null))));
|
|
416
|
+
if (pre) rows.push(h("div", { key: "prewarn", className: "scalio-notice is-warn", role: "note", "data-testid": "saas-updates-prerelease-warning" },
|
|
417
|
+
L.prereleaseWarning));
|
|
332
418
|
if (offer.notes) rows.push(h(Field, { key: "notes", label: L.notes },
|
|
333
419
|
h("pre", { className: "scalio-settings-text", style: { whiteSpace: "pre-wrap" }, "data-testid": "saas-updates-notes" }, offer.notes)));
|
|
334
420
|
if (!offer.forced) {
|
|
@@ -336,7 +422,8 @@ function SaasUpdatesPanel(props) {
|
|
|
336
422
|
h("button", { type: "button", className: "scalio-btn is-solid", disabled: busy || offer.held, "data-testid": "saas-updates-now",
|
|
337
423
|
onClick: () => updateNow(offer) },
|
|
338
424
|
h(Icons.Download, { className: "scalio-icon" }), L.now)));
|
|
339
|
-
|
|
425
|
+
// Postponing only makes sense against a deadline; a pre-release has none.
|
|
426
|
+
if (offer.due_at || !pre) rows.push(h(Field, { key: "post", id: "saas-updates-until", label: L.postpone },
|
|
340
427
|
h("div", { style: { display: "flex", gap: "0.5rem" } },
|
|
341
428
|
h("input", { id: "saas-updates-until", type: "date", className: "scalio-input", value: until, max: due, disabled: busy,
|
|
342
429
|
"data-testid": "saas-updates-until", onChange: (e) => setUntil(e.target.value) }),
|
|
@@ -344,6 +431,7 @@ function SaasUpdatesPanel(props) {
|
|
|
344
431
|
onClick: () => act("postpone", { until: new Date(`${until}T00:00:00`).toISOString() }) }, L.postponeGo))));
|
|
345
432
|
}
|
|
346
433
|
}
|
|
434
|
+
if (preSwitch) rows.push(preSwitch);
|
|
347
435
|
rows.push(h(Field, { key: "mode", label: L.mode },
|
|
348
436
|
["auto", "manual"].map((m) => h("label", { key: m, className: "scalio-settings-check" },
|
|
349
437
|
h("input", { type: "radio", name: "saas-updates-mode", checked: st.mode === m, disabled: busy, "data-testid": `saas-updates-mode-${m}`,
|
|
@@ -382,4 +470,4 @@ function cxNotice(offer) {
|
|
|
382
470
|
return `scalio-notice ${offer.kind === "security" ? "is-warn" : "is-info"}`;
|
|
383
471
|
}
|
|
384
472
|
|
|
385
|
-
module.exports = { UpdateBanner, SaasUpdatesPanel, UpdateProgress, saasUpdatesApi, SAAS_UPDATE_LABELS: LABELS };
|
|
473
|
+
module.exports = { UpdateBanner, SaasUpdatesPanel, PrereleaseSwitch, UpdateProgress, saasUpdatesApi, SAAS_UPDATE_LABELS: LABELS };
|