@scalio-cloud/ui 0.51.1 → 0.52.1
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/package.json +3 -3
- package/react/backup.js +25 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.1",
|
|
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,
|
|
@@ -148,8 +148,8 @@
|
|
|
148
148
|
"@radix-ui/react-tabs": "1.2.1",
|
|
149
149
|
"class-variance-authority": "0.7.1",
|
|
150
150
|
"clsx": "2.1.1",
|
|
151
|
-
"jsdom": "
|
|
152
|
-
"lucide-react": "1.
|
|
151
|
+
"jsdom": "31.0.0",
|
|
152
|
+
"lucide-react": "1.69.0",
|
|
153
153
|
"react": "19.3.1",
|
|
154
154
|
"react-dom": "19.3.1",
|
|
155
155
|
"sonner": "2.0.8",
|
package/react/backup.js
CHANGED
|
@@ -129,6 +129,24 @@ function useNotify(props) {
|
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
// ------------------------------------------------------------------------------------------------- export ---
|
|
132
|
+
// Export options of the app (scalio-backup AppSpec.export_options, e.g. «Archiv der Anhänge mitnehmen»).
|
|
133
|
+
function appOptionDefaults(options) {
|
|
134
|
+
const out = {};
|
|
135
|
+
(options || []).forEach((o) => { out[o.key] = o.default !== false; });
|
|
136
|
+
return out;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function appOptionValues(options, chosen, withData) {
|
|
140
|
+
const out = {};
|
|
141
|
+
options.forEach((o) => { out[o.key] = (chosen[o.key] !== false) && (withData || !o.dataOnly); });
|
|
142
|
+
return out;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function optionText(text, lang) {
|
|
146
|
+
if (!text || typeof text === "string") return text || "";
|
|
147
|
+
return (lang === "en" ? text.en : text.de) || text.en || "";
|
|
148
|
+
}
|
|
149
|
+
|
|
132
150
|
function BackupExport(props) {
|
|
133
151
|
const { client, lang } = props;
|
|
134
152
|
const L = labelsFor(lang, props.labels).backup;
|
|
@@ -140,6 +158,7 @@ function BackupExport(props) {
|
|
|
140
158
|
const [code, setCode] = React.useState("");
|
|
141
159
|
const [withData, setWithData] = React.useState(true);
|
|
142
160
|
const [withSecrets, setWithSecrets] = React.useState(true);
|
|
161
|
+
const [opts, setOpts] = React.useState({}); // the app's own export options (GET /backup/status -> options)
|
|
143
162
|
const [ack, setAck] = React.useState(false);
|
|
144
163
|
const [busy, setBusy] = React.useState(false);
|
|
145
164
|
const [job, setJob] = React.useState(null);
|
|
@@ -163,6 +182,7 @@ function BackupExport(props) {
|
|
|
163
182
|
client.status().then((data) => {
|
|
164
183
|
if (!alive) return;
|
|
165
184
|
setSt(data);
|
|
185
|
+
setOpts(appOptionDefaults(data.options));
|
|
166
186
|
if (props.onStatus) props.onStatus(data);
|
|
167
187
|
const jobs = data.jobs || [];
|
|
168
188
|
const running = jobs.find((j) => j.status === "running");
|
|
@@ -185,6 +205,7 @@ function BackupExport(props) {
|
|
|
185
205
|
n.clear();
|
|
186
206
|
try {
|
|
187
207
|
const data = await client.startExport({ password: pw, includeData: withData, includeSecrets: withSecrets,
|
|
208
|
+
...(st && st.options && st.options.length ? { options: appOptionValues(st.options, opts, withData) } : {}),
|
|
188
209
|
currentPassword: cur, mfaCode: code });
|
|
189
210
|
setJob(data);
|
|
190
211
|
setPw(""); setPw2(""); setCur(""); setCode(""); setAck(false);
|
|
@@ -222,6 +243,9 @@ function BackupExport(props) {
|
|
|
222
243
|
disabledReason ? h("div", { className: "scalio-notice is-info", "data-testid": "backup-disabled" }, disabledReason) : null,
|
|
223
244
|
check("backup-with-data", withData, setWithData, L.withData, L.withDataOn, L.withDataOff),
|
|
224
245
|
check("backup-with-secrets", withSecrets, setWithSecrets, L.withSecrets, L.withSecretsOn, L.withSecretsOff),
|
|
246
|
+
...((st && st.options) || []).filter((o) => withData || !o.dataOnly).map((o) => h(React.Fragment, { key: o.key },
|
|
247
|
+
check(`backup-option-${o.key}`, opts[o.key] !== false, (v) => setOpts({ ...opts, [o.key]: v }),
|
|
248
|
+
optionText(o.title, lang), optionText(o.on, lang), optionText(o.off, lang)))),
|
|
225
249
|
h("p", { className: "scalio-settings-help" }, L.notIncluded),
|
|
226
250
|
h(Field, { id: "backup-password", label: L.password, hint: fill(L.passwordHint, { n: minLen }) },
|
|
227
251
|
h("input", { id: "backup-password", type: "password", className: "scalio-input", value: pw, disabled: busy,
|
|
@@ -549,4 +573,4 @@ function MaintenanceNotice(props) {
|
|
|
549
573
|
h("span", null, fill(L.maintenance, { what, phase: p.phase && L.phase && L.phase[p.phase] ? ` (${L.phase[p.phase]})` : "" })));
|
|
550
574
|
}
|
|
551
575
|
|
|
552
|
-
module.exports = { BackupPanel, BackupExport, BackupImport, MaintenanceNotice, backupApi, isMaintenance };
|
|
576
|
+
module.exports = { BackupPanel, BackupExport, BackupImport, MaintenanceNotice, backupApi, isMaintenance, appOptionDefaults, appOptionValues, optionText };
|