@scalio-cloud/ui 0.87.1 → 0.88.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/package.json +1 -1
- package/react/beacon.js +11 -2
- package/react/labels.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scalio-cloud/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.88.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/beacon.js
CHANGED
|
@@ -23,6 +23,13 @@ function fmtDate(value, lang) {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
// api: axios instance with the app's base URL (/api). Every method resolves to the response body.
|
|
26
|
+
// `message` {de, en} of a failed check (scalio-connect 0.24); older backends only send the English `detail`.
|
|
27
|
+
function checkMessage(d, lang) {
|
|
28
|
+
const m = d && d.message;
|
|
29
|
+
const text = m && typeof m === "object" ? m[lang === "en" ? "en" : "de"] || m.en || m.de : typeof m === "string" ? m : "";
|
|
30
|
+
return text || d.detail || d.status;
|
|
31
|
+
}
|
|
32
|
+
|
|
26
33
|
function peersApi(api) {
|
|
27
34
|
const data = (p) => p.then((r) => r.data);
|
|
28
35
|
const enc = encodeURIComponent;
|
|
@@ -56,7 +63,7 @@ function BeaconConnection({ client, lang, labels, onChange }) {
|
|
|
56
63
|
setNote("");
|
|
57
64
|
try {
|
|
58
65
|
const d = await fn();
|
|
59
|
-
if (d && d.ok === false) throw new Error(L.beaconCheckFailed.replace("{detail}", d
|
|
66
|
+
if (d && d.ok === false) throw new Error(L.beaconCheckFailed.replace("{detail}", checkMessage(d, lang)));
|
|
60
67
|
setCode("");
|
|
61
68
|
setNote(typeof ok === "function" ? ok(d) : ok);
|
|
62
69
|
await load();
|
|
@@ -76,11 +83,13 @@ function BeaconConnection({ client, lang, labels, onChange }) {
|
|
|
76
83
|
h("p", { className: "scalio-support-meta" }, beacons.length ? L.beaconHelpConnected : L.beaconHelp),
|
|
77
84
|
beacons.map((p) => {
|
|
78
85
|
const q = p.queue || {};
|
|
86
|
+
const removed = p.status === "removed_by_peer";
|
|
79
87
|
return h(
|
|
80
88
|
"div",
|
|
81
89
|
{ key: p.id, className: "scalio-support-conn", "data-testid": "beacon-peer" },
|
|
82
90
|
h("div", { className: "scalio-support-conn-head" },
|
|
83
|
-
h("span", { className: "scalio-badge " + (p.usable ? "is-ok" : "is-error") },
|
|
91
|
+
h("span", { className: "scalio-badge " + (p.usable && !removed ? "is-ok" : "is-error") },
|
|
92
|
+
removed ? L.beaconRemovedByPeer : p.usable ? L.beaconConnected : L.beaconKeyLost)),
|
|
84
93
|
h("dl", { className: "scalio-support-conn-facts" },
|
|
85
94
|
h("dt", null, L.beaconAddress), h("dd", null, p.url),
|
|
86
95
|
p.version ? h(React.Fragment, null, h("dt", null, L.version), h("dd", null, p.version)) : null,
|
package/react/labels.js
CHANGED
|
@@ -221,6 +221,7 @@ const LABELS = {
|
|
|
221
221
|
beaconCode: "Kopplungscode",
|
|
222
222
|
beaconConnected: "Verbunden",
|
|
223
223
|
beaconKeyLost: "Schlüssel nicht lesbar, bitte neu verbinden",
|
|
224
|
+
beaconRemovedByPeer: "Von der anderen App entfernt",
|
|
224
225
|
beaconLastContact: "Letzter Kontakt",
|
|
225
226
|
beaconPaired: "Mit Beacon verbunden.",
|
|
226
227
|
beaconChecked: "Verbindung funktioniert (Beacon {version}).",
|
|
@@ -794,6 +795,7 @@ const LABELS = {
|
|
|
794
795
|
beaconCode: "Pairing code",
|
|
795
796
|
beaconConnected: "Connected",
|
|
796
797
|
beaconKeyLost: "Key cannot be read, please connect again",
|
|
798
|
+
beaconRemovedByPeer: "Removed by the other app",
|
|
797
799
|
beaconLastContact: "Last contact",
|
|
798
800
|
beaconPaired: "Connected with Beacon.",
|
|
799
801
|
beaconChecked: "Connection works (Beacon {version}).",
|