@scalio-cloud/ui 0.51.0 → 0.52.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/nav.css CHANGED
@@ -603,6 +603,8 @@
603
603
  .scalio-license-bar > div { height: 100%; background: hsl(var(--primary)); }
604
604
  .scalio-license-bar > div.is-unlimited { background: #10b981; }
605
605
  .scalio-license-bar > div.is-full { background: hsl(var(--destructive)); }
606
+ .scalio-license-bar > div.is-near { background: #d97706; }
607
+ .dark .scalio-license-bar > div.is-near { background: #f59e0b; }
606
608
  .scalio-license-addons { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.5rem; margin-bottom: 1rem; }
607
609
  @media (min-width: 640px) { .scalio-license-addons { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
608
610
  .scalio-license-addon { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; padding: 0.625rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: 2px; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scalio-cloud/ui",
3
- "version": "0.51.0",
3
+ "version": "0.52.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/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 };
package/react/fields.js CHANGED
@@ -455,7 +455,7 @@ function Input(props) {
455
455
  className: error ? `${className} border-destructive` : className,
456
456
  "aria-invalid": error ? true : rest["aria-invalid"],
457
457
  "aria-describedby": error ? `${id}-error` : rest["aria-describedby"],
458
- "data-testid": testId,
458
+ "data-testid": testId !== undefined ? testId : rest["data-testid"],
459
459
  onChange: change,
460
460
  onBlur: blur,
461
461
  })),
package/react/license.js CHANGED
@@ -93,6 +93,8 @@ function UsageBar({ item }) {
93
93
  const used = item.used === undefined || item.used === null ? null : item.used;
94
94
  const full = !unlimited && used !== null && used >= item.max;
95
95
  const pct = unlimited ? 100 : Math.min(100, Math.round(((used || 0) / Math.max(1, item.max)) * 100));
96
+ // Amber from 90 percent: a hint to extend before new people are blocked.
97
+ const near = !unlimited && !full && used !== null && pct >= 90;
96
98
  return h(
97
99
  "div",
98
100
  { "data-testid": `license-limit-${item.key}` },
@@ -100,9 +102,9 @@ function UsageBar({ item }) {
100
102
  "div",
101
103
  { className: "scalio-license-bar-head" },
102
104
  h("span", { className: "scalio-license-bar-label" }, item.label),
103
- h("span", { className: cx("scalio-license-bar-value", full && "is-error") }, used === null ? "-" : used, " / ", unlimited ? "∞" : item.max)
105
+ h("span", { className: cx("scalio-license-bar-value", full && "is-error", near && "is-warn") }, used === null ? "-" : used, " / ", unlimited ? "∞" : item.max)
104
106
  ),
105
- h("div", { className: "scalio-license-bar" }, h("div", { className: cx(full && "is-full", unlimited && "is-unlimited"), style: { width: `${pct}%` } })),
107
+ h("div", { className: "scalio-license-bar" }, h("div", { className: cx(full && "is-full", near && "is-near", unlimited && "is-unlimited"), style: { width: `${pct}%` } })),
106
108
  item.hint ? h("p", { className: "scalio-license-bar-hint", "data-testid": `license-limit-${item.key}-hint` }, item.hint) : null
107
109
  );
108
110
  }