@attraccess/plugin-shelly 0.1.0 → 0.2.0-nightly.1197.2
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/LICENSE.md +14 -0
- package/dist/index.js +116 -125
- package/frontend/{__federation_expose_Plugin-CLiHEWPT.js → __federation_expose_Plugin-BlvPZQ52.js} +382 -452
- package/frontend/__federation_fn_import-BHGw2mzr.js +1 -0
- package/frontend/{_virtual___federation_fn_import-BXODRNto.js → _virtual___federation_fn_import-D2E5es2p.js} +2 -4
- package/frontend/remoteEntry.js +3 -71
- package/frontend/style.css +2 -22
- package/package.json +14 -12
- package/dist/migrations.js +0 -57
- package/frontend/__federation_fn_import-DAGm_xmC.js +0 -2
package/frontend/{__federation_expose_Plugin-CLiHEWPT.js → __federation_expose_Plugin-BlvPZQ52.js}
RENAMED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { r as importShared } from "./_virtual___federation_fn_import-
|
|
2
|
-
|
|
3
|
-
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
4
|
-
|
|
5
|
-
//#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.api-client.ts
|
|
1
|
+
import { r as importShared } from "./_virtual___federation_fn_import-D2E5es2p.js";
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod, mod.exports), cb = null), mod.exports);
|
|
4
|
+
// ../../../libs/plugins-frontend-sdk/src/lib/frontend.api-client.ts
|
|
6
5
|
var BASE_URL_GLOBAL = "__ATTRACCESS_API_BASE_URL__";
|
|
7
6
|
/** The API origin the host is talking to. Falls back to the current origin. */
|
|
8
7
|
function getApiBaseUrl() {
|
|
@@ -16,10 +15,20 @@ var PluginApiError = class extends Error {
|
|
|
16
15
|
this.name = "PluginApiError";
|
|
17
16
|
}
|
|
18
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Joins validation messages into one text. Messages that already end a sentence are separated by a space, so
|
|
20
|
+
* "The URL is too long." and "The token is short." never become "long., token".
|
|
21
|
+
*/
|
|
22
|
+
function joinErrorMessages(parts) {
|
|
23
|
+
return parts.map((part) => part.trim()).filter(Boolean).reduce((joined, part) => {
|
|
24
|
+
if (joined === "") return part;
|
|
25
|
+
return /[.!?]$/.test(joined) ? `${joined} ${part}` : `${joined}, ${part}`;
|
|
26
|
+
}, "");
|
|
27
|
+
}
|
|
19
28
|
async function toError(res) {
|
|
20
29
|
try {
|
|
21
30
|
const body = await res.json();
|
|
22
|
-
const message = Array.isArray(body.message) ? body.message
|
|
31
|
+
const message = Array.isArray(body.message) ? joinErrorMessages(body.message) : body.message;
|
|
23
32
|
if (message) return new PluginApiError(message, res.status);
|
|
24
33
|
} catch {}
|
|
25
34
|
return new PluginApiError(`Request failed (HTTP ${res.status}).`, res.status);
|
|
@@ -61,8 +70,9 @@ function createPluginApiClient(basePath = "") {
|
|
|
61
70
|
}
|
|
62
71
|
};
|
|
63
72
|
}
|
|
64
|
-
|
|
65
|
-
|
|
73
|
+
// ../../../libs/plugins-frontend-sdk/src/lib/frontend.license.ts
|
|
74
|
+
var { useCallback: useCallback$7, useEffect: useEffect$5, useState: useState$6 } = await importShared("react");
|
|
75
|
+
// ../../../node_modules/.pnpm/react@19.3.1/node_modules/react/cjs/react-jsx-runtime.production.js
|
|
66
76
|
/**
|
|
67
77
|
* @license React
|
|
68
78
|
* react-jsx-runtime.production.js
|
|
@@ -94,8 +104,7 @@ var require_react_jsx_runtime_production = /* @__PURE__ */ __commonJSMin(((expor
|
|
|
94
104
|
exports.jsx = jsxProd;
|
|
95
105
|
exports.jsxs = jsxProd;
|
|
96
106
|
}));
|
|
97
|
-
|
|
98
|
-
//#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.live-updates.tsx
|
|
107
|
+
// ../../../libs/plugins-frontend-sdk/src/lib/frontend.live-updates.tsx
|
|
99
108
|
var import_jsx_runtime = (/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
100
109
|
module.exports = require_react_jsx_runtime_production();
|
|
101
110
|
})))();
|
|
@@ -154,14 +163,11 @@ function usePluginLiveUpdates(props) {
|
|
|
154
163
|
]);
|
|
155
164
|
return { abort: useCallback$6(() => unsubscribe.current?.(), []) };
|
|
156
165
|
}
|
|
157
|
-
|
|
158
|
-
//#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-drawer.tsx
|
|
166
|
+
// ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-drawer.tsx
|
|
159
167
|
var { StandardDrawer: SharedStandardDrawer } = await importShared("@attraccess/plugins-frontend-ui");
|
|
160
|
-
|
|
161
|
-
//#region ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-modal.tsx
|
|
168
|
+
// ../../../libs/plugins-frontend-sdk/src/lib/frontend.standard-modal.tsx
|
|
162
169
|
var { StandardModal: SharedStandardModal } = await importShared("@attraccess/plugins-frontend-ui");
|
|
163
|
-
|
|
164
|
-
//#region frontend/src/api.ts
|
|
170
|
+
// frontend/src/api.ts
|
|
165
171
|
var api = createPluginApiClient("/api/shelly");
|
|
166
172
|
function listDevices() {
|
|
167
173
|
return api.request("/devices");
|
|
@@ -218,8 +224,7 @@ function discoverDevices(input = {}) {
|
|
|
218
224
|
body: input
|
|
219
225
|
});
|
|
220
226
|
}
|
|
221
|
-
|
|
222
|
-
//#region frontend/src/shared/drawer.tsx
|
|
227
|
+
// frontend/src/shared/TextFieldRow.tsx
|
|
223
228
|
var { Input, Label, TextField } = await importShared("@heroui/react");
|
|
224
229
|
function TextFieldRow({ label, value, onChange, placeholder, required, description, dataCy }) {
|
|
225
230
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TextField, {
|
|
@@ -253,15 +258,12 @@ var en_default = {
|
|
|
253
258
|
"model": "Model",
|
|
254
259
|
"auth": "Auth",
|
|
255
260
|
"firmware": "Firmware",
|
|
256
|
-
"actions": "Actions",
|
|
257
261
|
"unknown": "Unknown",
|
|
258
262
|
"generation": "Gen {{generation}}",
|
|
259
263
|
"generationPlus": "Gen {{generation}}+",
|
|
260
264
|
"empty": "No devices yet. Run discovery, or add your first Shelly by its IP.",
|
|
261
265
|
"probeError": "Probe failed: {{message}}",
|
|
262
266
|
"info": "View device info",
|
|
263
|
-
"more": "More actions",
|
|
264
|
-
"deviceActions": "Device actions",
|
|
265
267
|
"manageFirmware": "Manage firmware",
|
|
266
268
|
"password": "Set admin password",
|
|
267
269
|
"reprobe": "Re-probe device",
|
|
@@ -383,15 +385,12 @@ var de_default = {
|
|
|
383
385
|
"model": "Modell",
|
|
384
386
|
"auth": "Authentifizierung",
|
|
385
387
|
"firmware": "Firmware",
|
|
386
|
-
"actions": "Aktionen",
|
|
387
388
|
"unknown": "Unbekannt",
|
|
388
389
|
"generation": "Gen {{generation}}",
|
|
389
390
|
"generationPlus": "Gen {{generation}}+",
|
|
390
391
|
"empty": "Noch keine Geräte vorhanden. Starte die Suche oder füge dein erstes Shelly-Gerät über seine IP-Adresse hinzu.",
|
|
391
392
|
"probeError": "Geräteprüfung fehlgeschlagen: {{message}}",
|
|
392
393
|
"info": "Geräteinformationen anzeigen",
|
|
393
|
-
"more": "Weitere Aktionen",
|
|
394
|
-
"deviceActions": "Geräteaktionen",
|
|
395
394
|
"manageFirmware": "Firmware verwalten",
|
|
396
395
|
"password": "Admin-Passwort festlegen",
|
|
397
396
|
"reprobe": "Gerät erneut prüfen",
|
|
@@ -500,19 +499,17 @@ var de_default = {
|
|
|
500
499
|
"refresh": "Aktualisieren"
|
|
501
500
|
}
|
|
502
501
|
};
|
|
503
|
-
|
|
504
|
-
//#region frontend/src/i18n.ts
|
|
502
|
+
// frontend/src/i18n.ts
|
|
505
503
|
var { useTranslations } = await importShared("@attraccess/plugins-frontend-ui");
|
|
506
504
|
var useShellyTranslations = () => useTranslations({
|
|
507
505
|
en: en_default,
|
|
508
506
|
de: de_default
|
|
509
507
|
}, { escapeValues: false });
|
|
510
|
-
|
|
511
|
-
//#region frontend/src/devices/AddDeviceDrawer.tsx
|
|
508
|
+
// frontend/src/devices/AddDeviceDrawer.tsx
|
|
512
509
|
var { DrawerBody: DrawerBody$4, DrawerHeader: DrawerHeader$4, DrawerHeading: DrawerHeading$4, Form: Form$3 } = await importShared("@heroui/react");
|
|
513
|
-
var { PlusIcon: PlusIcon$
|
|
510
|
+
var { PlusIcon: PlusIcon$2, XIcon: XIcon$4 } = await importShared("lucide-react");
|
|
514
511
|
var { useCallback: useCallback$5, useRef: useRef$2, useState: useState$5 } = await importShared("react");
|
|
515
|
-
var { Button: Button$
|
|
512
|
+
var { Button: Button$8, StandardDrawer: StandardDrawer$4, StatusAlert: StatusAlert$5 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
516
513
|
function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
|
|
517
514
|
const { t, tMessage } = useShellyTranslations();
|
|
518
515
|
const [ipAddress, setIpAddress] = useState$5("");
|
|
@@ -566,7 +563,7 @@ function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
|
|
|
566
563
|
className: "sh:text-sm sh:text-muted",
|
|
567
564
|
children: t("add.description")
|
|
568
565
|
})]
|
|
569
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
566
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$8, {
|
|
570
567
|
isIconOnly: true,
|
|
571
568
|
variant: "ghost",
|
|
572
569
|
"aria-label": t("common.close"),
|
|
@@ -600,18 +597,18 @@ function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
|
|
|
600
597
|
}),
|
|
601
598
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
602
599
|
className: "sh:flex sh:justify-end sh:gap-2 sh:pt-2",
|
|
603
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
600
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$8, {
|
|
604
601
|
variant: "secondary",
|
|
605
602
|
onPress: close,
|
|
606
603
|
children: t("common.cancel")
|
|
607
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$
|
|
604
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$8, {
|
|
608
605
|
variant: "primary",
|
|
609
606
|
type: "submit",
|
|
610
607
|
isPending: submitting,
|
|
611
608
|
onPress: submit,
|
|
612
609
|
"data-cy": "shelly-add-submit",
|
|
613
610
|
children: [
|
|
614
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon$
|
|
611
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon$2, { className: "sh:h-4 sh:w-4" }),
|
|
615
612
|
" ",
|
|
616
613
|
t("devices.add")
|
|
617
614
|
]
|
|
@@ -625,12 +622,11 @@ function AddDeviceDrawer({ isOpen, onOpenChange, onAdded }) {
|
|
|
625
622
|
}) })]
|
|
626
623
|
});
|
|
627
624
|
}
|
|
628
|
-
|
|
629
|
-
//#region frontend/src/AdminPasswordDrawer.tsx
|
|
625
|
+
// frontend/src/AdminPasswordDrawer.tsx
|
|
630
626
|
var { DrawerBody: DrawerBody$3, DrawerFooter: DrawerFooter$2, DrawerHeader: DrawerHeader$3, DrawerHeading: DrawerHeading$3, Form: Form$2 } = await importShared("@heroui/react");
|
|
631
627
|
var { KeyRoundIcon: KeyRoundIcon$1, XIcon: XIcon$3 } = await importShared("lucide-react");
|
|
632
628
|
var { useCallback: useCallback$4, useEffect: useEffect$3, useState: useState$4 } = await importShared("react");
|
|
633
|
-
var { Button: Button$
|
|
629
|
+
var { Button: Button$7, PasswordInput: PasswordInput$2, StandardDrawer: StandardDrawer$3, StatusAlert: StatusAlert$4 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
634
630
|
function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
|
|
635
631
|
const { t, tMessage } = useShellyTranslations();
|
|
636
632
|
const [currentPassword, setCurrentPassword] = useState$4("");
|
|
@@ -698,7 +694,7 @@ function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
|
|
|
698
694
|
address: device.ipAddress
|
|
699
695
|
})
|
|
700
696
|
})]
|
|
701
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
697
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$7, {
|
|
702
698
|
isIconOnly: true,
|
|
703
699
|
variant: "ghost",
|
|
704
700
|
"aria-label": t("common.close"),
|
|
@@ -739,11 +735,11 @@ function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
|
|
|
739
735
|
})
|
|
740
736
|
]
|
|
741
737
|
}) }),
|
|
742
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DrawerFooter$2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
738
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DrawerFooter$2, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$7, {
|
|
743
739
|
variant: "secondary",
|
|
744
740
|
onPress: close,
|
|
745
741
|
children: t("common.cancel")
|
|
746
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$
|
|
742
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$7, {
|
|
747
743
|
variant: "primary",
|
|
748
744
|
isPending: submitting,
|
|
749
745
|
onPress: () => void submit(),
|
|
@@ -757,12 +753,53 @@ function AdminPasswordDrawer({ device, onOpenChange, onSaved }) {
|
|
|
757
753
|
]
|
|
758
754
|
});
|
|
759
755
|
}
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
var {
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
756
|
+
// frontend/src/devices/info/AuthProtectedForm.tsx
|
|
757
|
+
var { Button: Button$6, PasswordInput: PasswordInput$1 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
758
|
+
var { Form: Form$1 } = await importShared("@heroui/react");
|
|
759
|
+
function AuthProtectedForm({ authState, currentPassword, onChange, loading, onLoad }) {
|
|
760
|
+
const { t } = useShellyTranslations();
|
|
761
|
+
if (authState !== "required") return null;
|
|
762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
763
|
+
className: "sh:rounded-md sh:border-l-4 sh:border-l-warning sh:bg-warning/5 sh:p-4",
|
|
764
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Form$1, {
|
|
765
|
+
onSubmit: (e) => {
|
|
766
|
+
e.preventDefault();
|
|
767
|
+
onLoad();
|
|
768
|
+
},
|
|
769
|
+
className: "sh:flex sh:flex-col sh:gap-3",
|
|
770
|
+
children: [
|
|
771
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
772
|
+
className: "sh:text-sm",
|
|
773
|
+
children: t("info.auth")
|
|
774
|
+
}),
|
|
775
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PasswordInput$1, {
|
|
776
|
+
label: t("password.title"),
|
|
777
|
+
value: currentPassword,
|
|
778
|
+
onChange,
|
|
779
|
+
placeholder: t("info.passwordPlaceholder"),
|
|
780
|
+
autoComplete: "current-password",
|
|
781
|
+
"data-cy": "shelly-info-current-password"
|
|
782
|
+
}),
|
|
783
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
784
|
+
className: "sh:flex sh:justify-end",
|
|
785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$6, {
|
|
786
|
+
variant: "primary",
|
|
787
|
+
size: "sm",
|
|
788
|
+
isPending: loading,
|
|
789
|
+
onPress: onLoad,
|
|
790
|
+
"data-cy": "shelly-info-unlock",
|
|
791
|
+
children: t("info.load")
|
|
792
|
+
})
|
|
793
|
+
}),
|
|
794
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
795
|
+
type: "submit",
|
|
796
|
+
hidden: true
|
|
797
|
+
})
|
|
798
|
+
]
|
|
799
|
+
})
|
|
800
|
+
});
|
|
801
|
+
}
|
|
802
|
+
// frontend/src/devices/info/infoValues.ts
|
|
766
803
|
function formatInfoValue(value, t, language, suffix = "") {
|
|
767
804
|
if (value === void 0 || value === null || value === "") return t("info.notReported");
|
|
768
805
|
if (typeof value === "boolean") return t(value ? "info.on" : "info.off");
|
|
@@ -793,6 +830,8 @@ function formatUptime(seconds, t, language) {
|
|
|
793
830
|
if (hours > 0) return `${hours}h ${minutes}m`;
|
|
794
831
|
return `${minutes}m`;
|
|
795
832
|
}
|
|
833
|
+
// frontend/src/devices/info/DeviceInfoCards.tsx
|
|
834
|
+
var { Card } = await importShared("@heroui/react");
|
|
796
835
|
function DeviceInfoCards({ info }) {
|
|
797
836
|
const { t, language } = useShellyTranslations();
|
|
798
837
|
const formatValue = (value, suffix = "") => formatInfoValue(value, t, language, suffix);
|
|
@@ -907,49 +946,11 @@ function DeviceInfoCards({ info }) {
|
|
|
907
946
|
}) })] }, card.title))
|
|
908
947
|
});
|
|
909
948
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Form$1, {
|
|
916
|
-
onSubmit: (e) => {
|
|
917
|
-
e.preventDefault();
|
|
918
|
-
onLoad();
|
|
919
|
-
},
|
|
920
|
-
className: "sh:flex sh:flex-col sh:gap-3",
|
|
921
|
-
children: [
|
|
922
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
923
|
-
className: "sh:text-sm",
|
|
924
|
-
children: t("info.auth")
|
|
925
|
-
}),
|
|
926
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PasswordInput$1, {
|
|
927
|
-
label: t("password.title"),
|
|
928
|
-
value: currentPassword,
|
|
929
|
-
onChange,
|
|
930
|
-
placeholder: t("info.passwordPlaceholder"),
|
|
931
|
-
autoComplete: "current-password",
|
|
932
|
-
"data-cy": "shelly-info-current-password"
|
|
933
|
-
}),
|
|
934
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
935
|
-
className: "sh:flex sh:justify-end",
|
|
936
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$4, {
|
|
937
|
-
variant: "primary",
|
|
938
|
-
size: "sm",
|
|
939
|
-
isPending: loading,
|
|
940
|
-
onPress: onLoad,
|
|
941
|
-
"data-cy": "shelly-info-unlock",
|
|
942
|
-
children: t("info.load")
|
|
943
|
-
})
|
|
944
|
-
}),
|
|
945
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
946
|
-
type: "submit",
|
|
947
|
-
hidden: true
|
|
948
|
-
})
|
|
949
|
-
]
|
|
950
|
-
})
|
|
951
|
-
});
|
|
952
|
-
}
|
|
949
|
+
// frontend/src/devices/info/DeviceInfoDrawer.tsx
|
|
950
|
+
var { Button: Button$5, StandardDrawer: StandardDrawer$2, StatusAlert: StatusAlert$3, useDateTimeFormatter: useDateTimeFormatter$1 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
951
|
+
var { DrawerBody: DrawerBody$2, DrawerFooter: DrawerFooter$1, DrawerHeader: DrawerHeader$2, DrawerHeading: DrawerHeading$2, Skeleton } = await importShared("@heroui/react");
|
|
952
|
+
var { InfoIcon: InfoIcon$1, RefreshCwIcon: RefreshCwIcon$2, XIcon: XIcon$2 } = await importShared("lucide-react");
|
|
953
|
+
var { useCallback: useCallback$3, useEffect: useEffect$2, useState: useState$3 } = await importShared("react");
|
|
953
954
|
function DeviceInfoDrawer({ device, onOpenChange }) {
|
|
954
955
|
const { t } = useShellyTranslations();
|
|
955
956
|
const formatDateTime = useDateTimeFormatter$1({
|
|
@@ -1001,7 +1002,7 @@ function DeviceInfoDrawer({ device, onOpenChange }) {
|
|
|
1001
1002
|
className: "sh:text-sm sh:text-muted",
|
|
1002
1003
|
children: device.ipAddress
|
|
1003
1004
|
})]
|
|
1004
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
1005
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$5, {
|
|
1005
1006
|
isIconOnly: true,
|
|
1006
1007
|
variant: "ghost",
|
|
1007
1008
|
"aria-label": t("common.close"),
|
|
@@ -1040,7 +1041,7 @@ function DeviceInfoDrawer({ device, onOpenChange }) {
|
|
|
1040
1041
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1041
1042
|
className: "sh:text-xs sh:text-default-500",
|
|
1042
1043
|
children: info ? t("info.updated", { time: formatDateTime(info.fetchedAt) }) : ""
|
|
1043
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$
|
|
1044
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$5, {
|
|
1044
1045
|
variant: "secondary",
|
|
1045
1046
|
onPress: () => void load(),
|
|
1046
1047
|
isPending: loading,
|
|
@@ -1055,9 +1056,8 @@ function DeviceInfoDrawer({ device, onOpenChange }) {
|
|
|
1055
1056
|
]
|
|
1056
1057
|
});
|
|
1057
1058
|
}
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
var { Button: Button$3, StandardDrawer: StandardDrawer$1, StatusAlert: StatusAlert$2 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1059
|
+
// frontend/src/DiscoverDrawer.tsx
|
|
1060
|
+
var { Button: Button$4, StandardDrawer: StandardDrawer$1, StatusAlert: StatusAlert$2 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1061
1061
|
var { Chip: Chip$2, DrawerBody: DrawerBody$1, DrawerHeader: DrawerHeader$1, DrawerHeading: DrawerHeading$1, Form, Spinner: Spinner$1 } = await importShared("@heroui/react");
|
|
1062
1062
|
var { SearchIcon: SearchIcon$1, XIcon: XIcon$1 } = await importShared("lucide-react");
|
|
1063
1063
|
var { useCallback: useCallback$2, useRef: useRef$1, useState: useState$2 } = await importShared("react");
|
|
@@ -1154,7 +1154,7 @@ function DiscoverDrawer({ isOpen, onOpenChange, onDiscovered }) {
|
|
|
1154
1154
|
className: "sh:text-sm sh:text-muted",
|
|
1155
1155
|
children: t("discovery.description")
|
|
1156
1156
|
})]
|
|
1157
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
1157
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$4, {
|
|
1158
1158
|
isIconOnly: true,
|
|
1159
1159
|
variant: "ghost",
|
|
1160
1160
|
"aria-label": t("common.close"),
|
|
@@ -1189,11 +1189,11 @@ function DiscoverDrawer({ isOpen, onOpenChange, onDiscovered }) {
|
|
|
1189
1189
|
result && !running && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResultSummary, { result }),
|
|
1190
1190
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1191
1191
|
className: "sh:flex sh:justify-end sh:gap-2 sh:pt-2",
|
|
1192
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
1192
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$4, {
|
|
1193
1193
|
variant: "secondary",
|
|
1194
1194
|
onPress: close,
|
|
1195
1195
|
children: t(result ? "common.done" : "common.cancel")
|
|
1196
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$
|
|
1196
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$4, {
|
|
1197
1197
|
variant: "primary",
|
|
1198
1198
|
type: "submit",
|
|
1199
1199
|
isPending: running,
|
|
@@ -1214,11 +1214,65 @@ function DiscoverDrawer({ isOpen, onOpenChange, onDiscovered }) {
|
|
|
1214
1214
|
}) })]
|
|
1215
1215
|
});
|
|
1216
1216
|
}
|
|
1217
|
-
|
|
1218
|
-
|
|
1217
|
+
// frontend/src/devices/firmware/FirmwareDetails.tsx
|
|
1218
|
+
var { EmptyState: EmptyState$1, useDateTimeFormatter } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1219
|
+
function VersionRow({ label, value }) {
|
|
1220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1221
|
+
className: "sh:flex sh:items-baseline sh:justify-between sh:gap-3 sh:border-b sh:border-default-200 sh:py-2 sh:last:border-b-0",
|
|
1222
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1223
|
+
className: "sh:text-xs sh:font-medium sh:uppercase sh:tracking-wide sh:text-default-500",
|
|
1224
|
+
children: label
|
|
1225
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1226
|
+
className: "sh:min-w-0 sh:truncate sh:text-sm sh:text-default-800",
|
|
1227
|
+
title: value,
|
|
1228
|
+
children: value
|
|
1229
|
+
})]
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
function FirmwareDetails({ status }) {
|
|
1233
|
+
const { t } = useShellyTranslations();
|
|
1234
|
+
const formatDateTime = useDateTimeFormatter({ showSeconds: true });
|
|
1235
|
+
if (!status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState$1, { message: t("firmware.empty") });
|
|
1236
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
1237
|
+
className: "sh:rounded-xl sh:border sh:border-default-200 sh:bg-surface sh:p-4",
|
|
1238
|
+
"data-cy": "shelly-firmware-details",
|
|
1239
|
+
children: [
|
|
1240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1241
|
+
label: t("firmware.installed"),
|
|
1242
|
+
value: status.currentVersion ?? t("devices.unknown")
|
|
1243
|
+
}),
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1245
|
+
label: t("firmware.stable"),
|
|
1246
|
+
value: status.available.stable ?? t("firmware.upToDate")
|
|
1247
|
+
}),
|
|
1248
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1249
|
+
label: t("firmware.beta"),
|
|
1250
|
+
value: status.available.beta ?? t("firmware.nothingNewer")
|
|
1251
|
+
}),
|
|
1252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1253
|
+
label: t("firmware.checked"),
|
|
1254
|
+
value: String(formatDateTime(status.fetchedAt))
|
|
1255
|
+
})
|
|
1256
|
+
]
|
|
1257
|
+
});
|
|
1258
|
+
}
|
|
1259
|
+
// frontend/src/devices/firmware/shortVersion.ts
|
|
1260
|
+
/**
|
|
1261
|
+
* Gen1 reports versions as `20230913-114150/v1.14.0` — only the tail is useful
|
|
1262
|
+
* at a glance, the full string stays in the tooltip.
|
|
1263
|
+
*/
|
|
1264
|
+
function shortVersion(version) {
|
|
1265
|
+
const tail = version.split("/").pop();
|
|
1266
|
+
return tail && tail.length > 0 ? tail : version;
|
|
1267
|
+
}
|
|
1268
|
+
// frontend/src/devices/firmware/FirmwareDrawer.tsx
|
|
1269
|
+
var { Button: Button$3, PasswordInput, StandardDrawer, StatusAlert: StatusAlert$1, TableDataLoadingIndicator: TableDataLoadingIndicator$1 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1270
|
+
var { DrawerBody, DrawerFooter, DrawerHeader, DrawerHeading, Spinner } = await importShared("@heroui/react");
|
|
1271
|
+
var { CpuIcon: CpuIcon$1, DownloadIcon, RefreshCwIcon: RefreshCwIcon$1, XIcon } = await importShared("lucide-react");
|
|
1219
1272
|
var { useCallback: useCallback$1, useEffect: useEffect$1, useRef, useState: useState$1 } = await importShared("react");
|
|
1220
1273
|
var UPDATE_TIMEOUT_MS = 3e5;
|
|
1221
|
-
|
|
1274
|
+
var STAGES = ["stable", "beta"];
|
|
1275
|
+
function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
|
|
1222
1276
|
const { t, tMessage } = useShellyTranslations();
|
|
1223
1277
|
const [status, setStatus] = useState$1(null);
|
|
1224
1278
|
const [currentPassword, setCurrentPassword] = useState$1("");
|
|
@@ -1297,126 +1351,6 @@ function useFirmwareDrawerState({ device, onOpenChange, onUpdated }) {
|
|
|
1297
1351
|
}, Math.max(0, deadline.current - Date.now()));
|
|
1298
1352
|
return () => clearTimeout(timeout);
|
|
1299
1353
|
}, [installing, device]);
|
|
1300
|
-
return {
|
|
1301
|
-
t,
|
|
1302
|
-
tMessage,
|
|
1303
|
-
status,
|
|
1304
|
-
currentPassword,
|
|
1305
|
-
setCurrentPassword,
|
|
1306
|
-
loading,
|
|
1307
|
-
error,
|
|
1308
|
-
installing,
|
|
1309
|
-
installedVersion,
|
|
1310
|
-
targetVersion,
|
|
1311
|
-
close,
|
|
1312
|
-
load,
|
|
1313
|
-
install,
|
|
1314
|
-
stages: ["stable", "beta"],
|
|
1315
|
-
device,
|
|
1316
|
-
onOpenChange
|
|
1317
|
-
};
|
|
1318
|
-
}
|
|
1319
|
-
//#endregion
|
|
1320
|
-
//#region frontend/src/devices/firmware/FirmwareDrawer.tsx
|
|
1321
|
-
var { Button: Button$2, EmptyState: EmptyState$1, PasswordInput, StandardDrawer, StatusAlert: StatusAlert$1, TableDataLoadingIndicator: TableDataLoadingIndicator$1, useDateTimeFormatter } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1322
|
-
var { DrawerBody, DrawerFooter, DrawerHeader, DrawerHeading, Spinner, Tooltip: Tooltip$1 } = await importShared("@heroui/react");
|
|
1323
|
-
var { ArrowUpCircleIcon, CpuIcon: CpuIcon$1, DownloadIcon, RefreshCwIcon: RefreshCwIcon$1, XIcon } = await importShared("lucide-react");
|
|
1324
|
-
function shortVersion(version) {
|
|
1325
|
-
const tail = version.split("/").pop();
|
|
1326
|
-
return tail && tail.length > 0 ? tail : version;
|
|
1327
|
-
}
|
|
1328
|
-
/** Table cell summarising a device's firmware state from the bulk overview. */
|
|
1329
|
-
function FirmwareCell({ entry }) {
|
|
1330
|
-
const { t } = useShellyTranslations();
|
|
1331
|
-
if (!entry) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1332
|
-
className: "sh:text-sm sh:text-default-400",
|
|
1333
|
-
children: t("firmware.checking")
|
|
1334
|
-
});
|
|
1335
|
-
if (entry.error || !entry.status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1336
|
-
className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-400",
|
|
1337
|
-
title: entry.error ?? void 0,
|
|
1338
|
-
children: t("firmware.unavailable")
|
|
1339
|
-
});
|
|
1340
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1341
|
-
className: "sh:flex sh:flex-col sh:gap-1",
|
|
1342
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1343
|
-
className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-700",
|
|
1344
|
-
title: entry.status.currentVersion ?? void 0,
|
|
1345
|
-
children: entry.status.currentVersion ? shortVersion(entry.status.currentVersion) : t("devices.unknown")
|
|
1346
|
-
}), entry.status.hasUpdate && entry.status.available.stable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1347
|
-
className: "sh:max-w-40 sh:truncate sh:text-xs sh:text-warning-600",
|
|
1348
|
-
title: entry.status.available.stable,
|
|
1349
|
-
children: t("firmware.available", { version: shortVersion(entry.status.available.stable) })
|
|
1350
|
-
})]
|
|
1351
|
-
});
|
|
1352
|
-
}
|
|
1353
|
-
/**
|
|
1354
|
-
* "Update available" marker next to the device name, so the signal survives the
|
|
1355
|
-
* breakpoints where the Firmware column is hidden. Icon-only on purpose: a text
|
|
1356
|
-
* chip here widens the Device column enough to push the row actions out of the
|
|
1357
|
-
* table's visible width on tablets.
|
|
1358
|
-
*/
|
|
1359
|
-
function UpdateAvailableIndicator({ entry }) {
|
|
1360
|
-
const { t } = useShellyTranslations();
|
|
1361
|
-
const version = entry?.status?.hasUpdate ? entry.status.available.stable : null;
|
|
1362
|
-
if (!version) return null;
|
|
1363
|
-
const label = t("firmware.updateAvailable", { version: shortVersion(version) });
|
|
1364
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip$1, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$2, {
|
|
1365
|
-
variant: "ghost",
|
|
1366
|
-
size: "sm",
|
|
1367
|
-
isIconOnly: true,
|
|
1368
|
-
"aria-label": label,
|
|
1369
|
-
className: "sh:h-6 sh:w-6 sh:min-w-6 sh:text-warning",
|
|
1370
|
-
"data-cy": "shelly-update-available",
|
|
1371
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpCircleIcon, { className: "sh:h-4 sh:w-4" })
|
|
1372
|
-
}) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Content, { children: label })] });
|
|
1373
|
-
}
|
|
1374
|
-
function VersionRow({ label, value }) {
|
|
1375
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1376
|
-
className: "sh:flex sh:items-baseline sh:justify-between sh:gap-3 sh:border-b sh:border-default-200 sh:py-2 sh:last:border-b-0",
|
|
1377
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1378
|
-
className: "sh:text-xs sh:font-medium sh:uppercase sh:tracking-wide sh:text-default-500",
|
|
1379
|
-
children: label
|
|
1380
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1381
|
-
className: "sh:min-w-0 sh:truncate sh:text-sm sh:text-default-800",
|
|
1382
|
-
title: value,
|
|
1383
|
-
children: value
|
|
1384
|
-
})]
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
function FirmwareDetails({ status }) {
|
|
1388
|
-
const { t } = useShellyTranslations();
|
|
1389
|
-
const formatDateTime = useDateTimeFormatter({ showSeconds: true });
|
|
1390
|
-
if (!status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState$1, { message: t("firmware.empty") });
|
|
1391
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
1392
|
-
className: "sh:rounded-xl sh:border sh:border-default-200 sh:bg-surface sh:p-4",
|
|
1393
|
-
"data-cy": "shelly-firmware-details",
|
|
1394
|
-
children: [
|
|
1395
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1396
|
-
label: t("firmware.installed"),
|
|
1397
|
-
value: status.currentVersion ?? t("devices.unknown")
|
|
1398
|
-
}),
|
|
1399
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1400
|
-
label: t("firmware.stable"),
|
|
1401
|
-
value: status.available.stable ?? t("firmware.upToDate")
|
|
1402
|
-
}),
|
|
1403
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1404
|
-
label: t("firmware.beta"),
|
|
1405
|
-
value: status.available.beta ?? t("firmware.nothingNewer")
|
|
1406
|
-
}),
|
|
1407
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(VersionRow, {
|
|
1408
|
-
label: t("firmware.checked"),
|
|
1409
|
-
value: String(formatDateTime(status.fetchedAt))
|
|
1410
|
-
})
|
|
1411
|
-
]
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
|
|
1415
|
-
const { t, tMessage, status, currentPassword, setCurrentPassword, loading, error, installing, installedVersion, targetVersion, close, load, install, stages } = useFirmwareDrawerState({
|
|
1416
|
-
device,
|
|
1417
|
-
onOpenChange,
|
|
1418
|
-
onUpdated
|
|
1419
|
-
});
|
|
1420
1354
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(StandardDrawer, {
|
|
1421
1355
|
isOpen: !!device,
|
|
1422
1356
|
onOpenChange,
|
|
@@ -1438,7 +1372,7 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
|
|
|
1438
1372
|
address: device.ipAddress
|
|
1439
1373
|
})
|
|
1440
1374
|
})]
|
|
1441
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$
|
|
1375
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$3, {
|
|
1442
1376
|
isIconOnly: true,
|
|
1443
1377
|
variant: "ghost",
|
|
1444
1378
|
"aria-label": t("common.close"),
|
|
@@ -1489,7 +1423,7 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
|
|
|
1489
1423
|
}) }),
|
|
1490
1424
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(DrawerFooter, {
|
|
1491
1425
|
className: "sh:flex-wrap",
|
|
1492
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$
|
|
1426
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$3, {
|
|
1493
1427
|
variant: "secondary",
|
|
1494
1428
|
onPress: load,
|
|
1495
1429
|
isPending: loading,
|
|
@@ -1500,10 +1434,10 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
|
|
|
1500
1434
|
" ",
|
|
1501
1435
|
t("firmware.recheck")
|
|
1502
1436
|
]
|
|
1503
|
-
}),
|
|
1437
|
+
}), STAGES.map((stage) => {
|
|
1504
1438
|
const version = status?.available[stage];
|
|
1505
1439
|
if (!version) return null;
|
|
1506
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$
|
|
1440
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$3, {
|
|
1507
1441
|
variant: stage === "stable" ? "primary" : "secondary",
|
|
1508
1442
|
onPress: () => install(stage),
|
|
1509
1443
|
isPending: installing === stage,
|
|
@@ -1527,11 +1461,8 @@ function FirmwareDrawer({ device, onOpenChange, onUpdated }) {
|
|
|
1527
1461
|
]
|
|
1528
1462
|
});
|
|
1529
1463
|
}
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
var { Button: Button$1 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1533
|
-
var { Chip: Chip$1, Dropdown, DropdownItem, DropdownMenu, DropdownPopover, DropdownTrigger, Tooltip } = await importShared("@heroui/react");
|
|
1534
|
-
var { CpuIcon, InfoIcon, KeyRoundIcon, MoreVerticalIcon, RefreshCwIcon, Trash2Icon, TriangleAlertIcon } = await importShared("lucide-react");
|
|
1464
|
+
// frontend/src/devices/AuthChip.tsx
|
|
1465
|
+
var { Chip: Chip$1 } = await importShared("@heroui/react");
|
|
1535
1466
|
function AuthChip({ state }) {
|
|
1536
1467
|
const { t } = useShellyTranslations();
|
|
1537
1468
|
const { color } = {
|
|
@@ -1547,9 +1478,84 @@ function AuthChip({ state }) {
|
|
|
1547
1478
|
children: t(`auth.${state}`)
|
|
1548
1479
|
});
|
|
1549
1480
|
}
|
|
1481
|
+
// frontend/src/devices/EmptyDevices.tsx
|
|
1482
|
+
var { Button: Button$2, EmptyState } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1483
|
+
var { PlusIcon: PlusIcon$1 } = await importShared("lucide-react");
|
|
1484
|
+
function EmptyDevices({ onAdd }) {
|
|
1485
|
+
const { t } = useShellyTranslations();
|
|
1486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1487
|
+
className: "sh:flex sh:flex-col sh:items-center sh:justify-center sh:gap-3 sh:pb-6",
|
|
1488
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { message: t("devices.empty") }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button$2, {
|
|
1489
|
+
variant: "secondary",
|
|
1490
|
+
size: "sm",
|
|
1491
|
+
onPress: onAdd,
|
|
1492
|
+
"data-cy": "shelly-add-open-empty",
|
|
1493
|
+
children: [
|
|
1494
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon$1, { className: "sh:h-4 sh:w-4" }),
|
|
1495
|
+
" ",
|
|
1496
|
+
t("devices.add")
|
|
1497
|
+
]
|
|
1498
|
+
})]
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
// frontend/src/devices/firmware/FirmwareCell.tsx
|
|
1502
|
+
/** Table cell summarising a device's firmware state from the bulk overview. */
|
|
1503
|
+
function FirmwareCell({ entry }) {
|
|
1504
|
+
const { t } = useShellyTranslations();
|
|
1505
|
+
if (!entry) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1506
|
+
className: "sh:text-sm sh:text-default-400",
|
|
1507
|
+
children: t("firmware.checking")
|
|
1508
|
+
});
|
|
1509
|
+
if (entry.error || !entry.status) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1510
|
+
className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-400",
|
|
1511
|
+
title: entry.error ?? void 0,
|
|
1512
|
+
children: t("firmware.unavailable")
|
|
1513
|
+
});
|
|
1514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1515
|
+
className: "sh:flex sh:flex-col sh:gap-1",
|
|
1516
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1517
|
+
className: "sh:block sh:max-w-40 sh:truncate sh:text-sm sh:text-default-700",
|
|
1518
|
+
title: entry.status.currentVersion ?? void 0,
|
|
1519
|
+
children: entry.status.currentVersion ? shortVersion(entry.status.currentVersion) : t("devices.unknown")
|
|
1520
|
+
}), entry.status.hasUpdate && entry.status.available.stable && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1521
|
+
className: "sh:max-w-40 sh:truncate sh:text-xs sh:text-warning-600",
|
|
1522
|
+
title: entry.status.available.stable,
|
|
1523
|
+
children: t("firmware.available", { version: shortVersion(entry.status.available.stable) })
|
|
1524
|
+
})]
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
// frontend/src/devices/firmware/UpdateAvailableIndicator.tsx
|
|
1528
|
+
var { Button: Button$1 } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1529
|
+
var { Tooltip: Tooltip$1 } = await importShared("@heroui/react");
|
|
1530
|
+
var { ArrowUpCircleIcon } = await importShared("lucide-react");
|
|
1531
|
+
/**
|
|
1532
|
+
* "Update available" marker next to the device name, so the signal survives the
|
|
1533
|
+
* breakpoints where the Firmware column is hidden. Icon-only on purpose: a text
|
|
1534
|
+
* chip here widens the Device column enough to push the row actions out of the
|
|
1535
|
+
* table's visible width on tablets.
|
|
1536
|
+
*/
|
|
1537
|
+
function UpdateAvailableIndicator({ entry }) {
|
|
1538
|
+
const { t } = useShellyTranslations();
|
|
1539
|
+
const version = entry?.status?.hasUpdate ? entry.status.available.stable : null;
|
|
1540
|
+
if (!version) return null;
|
|
1541
|
+
const label = t("firmware.updateAvailable", { version: shortVersion(version) });
|
|
1542
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip$1, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button$1, {
|
|
1543
|
+
variant: "ghost",
|
|
1544
|
+
size: "sm",
|
|
1545
|
+
isIconOnly: true,
|
|
1546
|
+
"aria-label": label,
|
|
1547
|
+
className: "sh:h-6 sh:w-6 sh:min-w-6 sh:text-warning",
|
|
1548
|
+
"data-cy": "shelly-update-available",
|
|
1549
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ArrowUpCircleIcon, { className: "sh:h-4 sh:w-4" })
|
|
1550
|
+
}) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip$1.Content, { children: label })] });
|
|
1551
|
+
}
|
|
1552
|
+
// frontend/src/devices/ProbeErrorIndicator.tsx
|
|
1553
|
+
var { Button } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1554
|
+
var { Tooltip } = await importShared("@heroui/react");
|
|
1555
|
+
var { TriangleAlertIcon } = await importShared("lucide-react");
|
|
1550
1556
|
function ProbeErrorIndicator({ message }) {
|
|
1551
1557
|
const { t } = useShellyTranslations();
|
|
1552
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button
|
|
1558
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Trigger, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Button, {
|
|
1553
1559
|
variant: "ghost",
|
|
1554
1560
|
size: "sm",
|
|
1555
1561
|
isIconOnly: true,
|
|
@@ -1559,79 +1565,72 @@ function ProbeErrorIndicator({ message }) {
|
|
|
1559
1565
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TriangleAlertIcon, { className: "sh:h-4 sh:w-4" })
|
|
1560
1566
|
}) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tooltip.Content, { children: t("devices.probeError", { message }) })] });
|
|
1561
1567
|
}
|
|
1562
|
-
|
|
1568
|
+
// frontend/src/devices/RowActions.tsx
|
|
1569
|
+
var { TableRowActions } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1570
|
+
var { CpuIcon, InfoIcon, KeyRoundIcon, RefreshCwIcon, Trash2Icon } = await importShared("lucide-react");
|
|
1571
|
+
function RowActions({ device, isBusy, onInfo, onFirmware, onAuth, onReprobe, onDelete }) {
|
|
1563
1572
|
const { t } = useShellyTranslations();
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
className: "sh:text-danger",
|
|
1620
|
-
"data-cy": `shelly-device-delete-${deviceId}`,
|
|
1621
|
-
children: [
|
|
1622
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Trash2Icon, { className: "sh:mr-2 sh:inline sh:h-4 sh:w-4" }),
|
|
1623
|
-
" ",
|
|
1624
|
-
t("devices.delete")
|
|
1625
|
-
]
|
|
1626
|
-
})
|
|
1627
|
-
]
|
|
1628
|
-
}) })] })]
|
|
1573
|
+
const deviceId = device.id;
|
|
1574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableRowActions, {
|
|
1575
|
+
itemName: device.name,
|
|
1576
|
+
isPending: isBusy,
|
|
1577
|
+
"data-cy": `shelly-device-menu-${deviceId}`,
|
|
1578
|
+
actions: [
|
|
1579
|
+
{
|
|
1580
|
+
key: "info",
|
|
1581
|
+
label: t("devices.info"),
|
|
1582
|
+
icon: InfoIcon,
|
|
1583
|
+
onPress: onInfo,
|
|
1584
|
+
"data-cy": `shelly-device-info-${deviceId}`
|
|
1585
|
+
},
|
|
1586
|
+
{
|
|
1587
|
+
key: "firmware",
|
|
1588
|
+
label: t("devices.manageFirmware"),
|
|
1589
|
+
icon: CpuIcon,
|
|
1590
|
+
onPress: onFirmware,
|
|
1591
|
+
"data-cy": `shelly-device-firmware-${deviceId}`
|
|
1592
|
+
},
|
|
1593
|
+
{
|
|
1594
|
+
key: "auth",
|
|
1595
|
+
label: t("devices.password"),
|
|
1596
|
+
icon: KeyRoundIcon,
|
|
1597
|
+
onPress: onAuth,
|
|
1598
|
+
"data-cy": `shelly-device-auth-${deviceId}`
|
|
1599
|
+
},
|
|
1600
|
+
{
|
|
1601
|
+
key: "reprobe",
|
|
1602
|
+
label: t("devices.reprobe"),
|
|
1603
|
+
icon: RefreshCwIcon,
|
|
1604
|
+
onPress: onReprobe,
|
|
1605
|
+
"data-cy": `shelly-device-reprobe-${deviceId}`
|
|
1606
|
+
},
|
|
1607
|
+
{
|
|
1608
|
+
key: "delete",
|
|
1609
|
+
label: t("devices.delete"),
|
|
1610
|
+
icon: Trash2Icon,
|
|
1611
|
+
tone: "danger",
|
|
1612
|
+
onPress: onDelete,
|
|
1613
|
+
"data-cy": `shelly-device-delete-${deviceId}`,
|
|
1614
|
+
confirm: {
|
|
1615
|
+
title: t("devices.delete"),
|
|
1616
|
+
message: t("devices.deleteDescription", {
|
|
1617
|
+
name: device.name,
|
|
1618
|
+
address: device.ipAddress
|
|
1619
|
+
}),
|
|
1620
|
+
confirmLabel: t("common.delete"),
|
|
1621
|
+
cancelLabel: t("common.cancel"),
|
|
1622
|
+
"data-cy": "shelly-delete-confirmation-modal",
|
|
1623
|
+
confirmDataCy: "shelly-delete-confirm",
|
|
1624
|
+
cancelDataCy: "shelly-delete-cancel"
|
|
1625
|
+
}
|
|
1626
|
+
}
|
|
1627
|
+
]
|
|
1629
1628
|
});
|
|
1630
1629
|
}
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
var { Chip, TableCell, TableRow } = await importShared("@heroui/react");
|
|
1634
|
-
function
|
|
1630
|
+
// frontend/src/devices/DevicesTable.tsx
|
|
1631
|
+
var { TableActionsColumnHeader } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1632
|
+
var { Chip, Table, TableBody, TableCell, TableColumn, TableContent, TableHeader, TableRow, TableScrollContainer } = await importShared("@heroui/react");
|
|
1633
|
+
function renderDeviceRow(device, { firmware, rowBusyId, setInfoDevice, setFirmwareDevice, setAuthDevice, withRowBusy, onDelete }, t) {
|
|
1635
1634
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableRow, {
|
|
1636
1635
|
id: device.id,
|
|
1637
1636
|
"data-cy": `shelly-device-row-${device.id}`,
|
|
@@ -1685,24 +1684,70 @@ function renderDevicesPageDevicesRows(device, { firmware, t, rowBusyId, setInfoD
|
|
|
1685
1684
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableCell, {
|
|
1686
1685
|
className: "sh:whitespace-nowrap",
|
|
1687
1686
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowActions, {
|
|
1688
|
-
|
|
1687
|
+
device,
|
|
1689
1688
|
isBusy: rowBusyId === device.id,
|
|
1690
1689
|
onInfo: () => setInfoDevice(device),
|
|
1691
1690
|
onFirmware: () => setFirmwareDevice(device),
|
|
1692
1691
|
onAuth: () => setAuthDevice(device),
|
|
1693
1692
|
onReprobe: () => withRowBusy(device.id, () => reprobeDevice(device.id)),
|
|
1694
|
-
onDelete: () =>
|
|
1693
|
+
onDelete: () => onDelete(device)
|
|
1695
1694
|
})
|
|
1696
1695
|
})
|
|
1697
1696
|
]
|
|
1698
1697
|
}, device.id);
|
|
1699
1698
|
}
|
|
1700
|
-
|
|
1701
|
-
|
|
1699
|
+
function DevicesTable({ devices, onAdd, ...rowProps }) {
|
|
1700
|
+
const { t, language } = useShellyTranslations();
|
|
1701
|
+
const { firmware, rowBusyId } = rowProps;
|
|
1702
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Table, {
|
|
1703
|
+
"data-cy": "shelly-device-table",
|
|
1704
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableScrollContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableContent, {
|
|
1705
|
+
"aria-label": t("devices.table"),
|
|
1706
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TableHeader, { children: [
|
|
1707
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1708
|
+
isRowHeader: true,
|
|
1709
|
+
children: t("devices.device")
|
|
1710
|
+
}),
|
|
1711
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1712
|
+
className: "sh:hidden sh:sm:table-cell sh:md:hidden sh:lg:table-cell",
|
|
1713
|
+
children: t("devices.address")
|
|
1714
|
+
}),
|
|
1715
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1716
|
+
className: "sh:hidden sh:lg:table-cell",
|
|
1717
|
+
children: t("devices.model")
|
|
1718
|
+
}),
|
|
1719
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1720
|
+
className: "sh:hidden sh:sm:table-cell",
|
|
1721
|
+
children: t("devices.auth")
|
|
1722
|
+
}),
|
|
1723
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1724
|
+
className: "sh:hidden sh:xl:table-cell",
|
|
1725
|
+
children: t("devices.firmware")
|
|
1726
|
+
}),
|
|
1727
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1728
|
+
id: "actions",
|
|
1729
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableActionsColumnHeader, {})
|
|
1730
|
+
})
|
|
1731
|
+
] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, {
|
|
1732
|
+
items: devices,
|
|
1733
|
+
dependencies: [
|
|
1734
|
+
firmware,
|
|
1735
|
+
rowBusyId,
|
|
1736
|
+
language
|
|
1737
|
+
],
|
|
1738
|
+
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDevices, { onAdd }),
|
|
1739
|
+
children: (device) => renderDeviceRow(device, rowProps, t)
|
|
1740
|
+
})]
|
|
1741
|
+
}) })
|
|
1742
|
+
});
|
|
1743
|
+
}
|
|
1744
|
+
// frontend/src/devices/DevicesPage.tsx
|
|
1745
|
+
var { PageHeader, StatusAlert, TableDataLoadingIndicator } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1702
1746
|
var { useOverlayState } = await importShared("@heroui/react");
|
|
1747
|
+
var { PlusIcon, SearchIcon, WifiIcon: WifiIcon$1 } = await importShared("lucide-react");
|
|
1703
1748
|
var { useCallback, useEffect, useState } = await importShared("react");
|
|
1704
|
-
function
|
|
1705
|
-
const { t
|
|
1749
|
+
function DevicesPage() {
|
|
1750
|
+
const { t } = useShellyTranslations();
|
|
1706
1751
|
const [devices, setDevices] = useState([]);
|
|
1707
1752
|
const [loading, setLoading] = useState(true);
|
|
1708
1753
|
const [pageError, setPageError] = useState(null);
|
|
@@ -1711,8 +1756,6 @@ function useDevicesPageState() {
|
|
|
1711
1756
|
const [authDevice, setAuthDevice] = useState(null);
|
|
1712
1757
|
const [firmwareDevice, setFirmwareDevice] = useState(null);
|
|
1713
1758
|
const [firmware, setFirmware] = useState({});
|
|
1714
|
-
const [deleteTarget, setDeleteTarget] = useState(null);
|
|
1715
|
-
const [deleting, setDeleting] = useState(false);
|
|
1716
1759
|
const addDrawer = useOverlayState();
|
|
1717
1760
|
const discoverDrawer = useOverlayState();
|
|
1718
1761
|
const refreshFirmware = useCallback(async (known = []) => {
|
|
@@ -1743,78 +1786,25 @@ function useDevicesPageState() {
|
|
|
1743
1786
|
useEffect(() => {
|
|
1744
1787
|
refresh();
|
|
1745
1788
|
}, [refresh]);
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
refreshFirmware,
|
|
1766
|
-
refresh,
|
|
1767
|
-
withRowBusy: useCallback(async (id, action) => {
|
|
1768
|
-
setRowBusyId(id);
|
|
1769
|
-
try {
|
|
1770
|
-
await action();
|
|
1771
|
-
await refresh();
|
|
1772
|
-
} catch (err) {
|
|
1773
|
-
setPageError(err instanceof Error ? err.message : String(err));
|
|
1774
|
-
} finally {
|
|
1775
|
-
setRowBusyId(null);
|
|
1776
|
-
}
|
|
1777
|
-
}, [refresh]),
|
|
1778
|
-
confirmDelete: useCallback(async () => {
|
|
1779
|
-
if (!deleteTarget) return;
|
|
1780
|
-
setDeleting(true);
|
|
1781
|
-
try {
|
|
1782
|
-
await deleteDevice(deleteTarget.id);
|
|
1783
|
-
await refresh();
|
|
1784
|
-
setDeleteTarget(null);
|
|
1785
|
-
} catch (err) {
|
|
1786
|
-
setPageError(err instanceof Error ? err.message : String(err));
|
|
1787
|
-
setDeleteTarget(null);
|
|
1788
|
-
} finally {
|
|
1789
|
-
setDeleting(false);
|
|
1790
|
-
}
|
|
1791
|
-
}, [deleteTarget, refresh])
|
|
1792
|
-
};
|
|
1793
|
-
}
|
|
1794
|
-
//#endregion
|
|
1795
|
-
//#region frontend/src/devices/DevicesPage.tsx
|
|
1796
|
-
var { Button, EmptyState, PageHeader, StatusAlert, StatusDialog, TableDataLoadingIndicator } = await importShared("@attraccess/plugins-frontend-ui");
|
|
1797
|
-
var { Table, TableBody, TableColumn, TableContent, TableHeader, TableScrollContainer } = await importShared("@heroui/react");
|
|
1798
|
-
var { PlusIcon, SearchIcon, WifiIcon: WifiIcon$1 } = await importShared("lucide-react");
|
|
1799
|
-
function EmptyDevices({ onAdd }) {
|
|
1800
|
-
const { t } = useShellyTranslations();
|
|
1801
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1802
|
-
className: "sh:flex sh:flex-col sh:items-center sh:justify-center sh:gap-3 sh:pb-6",
|
|
1803
|
-
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, { message: t("devices.empty") }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Button, {
|
|
1804
|
-
variant: "secondary",
|
|
1805
|
-
size: "sm",
|
|
1806
|
-
onPress: onAdd,
|
|
1807
|
-
"data-cy": "shelly-add-open-empty",
|
|
1808
|
-
children: [
|
|
1809
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlusIcon, { className: "sh:h-4 sh:w-4" }),
|
|
1810
|
-
" ",
|
|
1811
|
-
t("devices.add")
|
|
1812
|
-
]
|
|
1813
|
-
})]
|
|
1814
|
-
});
|
|
1815
|
-
}
|
|
1816
|
-
function DevicesPage() {
|
|
1817
|
-
const { t, language, devices, loading, pageError, rowBusyId, infoDevice, setInfoDevice, authDevice, setAuthDevice, firmwareDevice, setFirmwareDevice, firmware, deleteTarget, setDeleteTarget, deleting, addDrawer, discoverDrawer, refreshFirmware, refresh, withRowBusy, confirmDelete } = useDevicesPageState();
|
|
1789
|
+
const withRowBusy = useCallback(async (id, action) => {
|
|
1790
|
+
setRowBusyId(id);
|
|
1791
|
+
try {
|
|
1792
|
+
await action();
|
|
1793
|
+
await refresh();
|
|
1794
|
+
} catch (err) {
|
|
1795
|
+
setPageError(err instanceof Error ? err.message : String(err));
|
|
1796
|
+
} finally {
|
|
1797
|
+
setRowBusyId(null);
|
|
1798
|
+
}
|
|
1799
|
+
}, [refresh]);
|
|
1800
|
+
const removeDevice = useCallback(async (device) => {
|
|
1801
|
+
try {
|
|
1802
|
+
await deleteDevice(device.id);
|
|
1803
|
+
await refresh();
|
|
1804
|
+
} catch (err) {
|
|
1805
|
+
setPageError(err instanceof Error ? err.message : String(err));
|
|
1806
|
+
}
|
|
1807
|
+
}, [refresh]);
|
|
1818
1808
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1819
1809
|
className: "sh:mx-auto sh:flex sh:w-full sh:max-w-5xl sh:flex-col sh:gap-6 sh:p-4 sh:md:p-6",
|
|
1820
1810
|
children: [
|
|
@@ -1844,55 +1834,16 @@ function DevicesPage() {
|
|
|
1844
1834
|
title: t("devices.loadError"),
|
|
1845
1835
|
children: pageError
|
|
1846
1836
|
}),
|
|
1847
|
-
loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableDataLoadingIndicator, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
className: "sh:hidden sh:sm:table-cell sh:md:hidden sh:lg:table-cell",
|
|
1858
|
-
children: t("devices.address")
|
|
1859
|
-
}),
|
|
1860
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1861
|
-
className: "sh:hidden sh:lg:table-cell",
|
|
1862
|
-
children: t("devices.model")
|
|
1863
|
-
}),
|
|
1864
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1865
|
-
className: "sh:hidden sh:sm:table-cell",
|
|
1866
|
-
children: t("devices.auth")
|
|
1867
|
-
}),
|
|
1868
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1869
|
-
className: "sh:hidden sh:xl:table-cell",
|
|
1870
|
-
children: t("devices.firmware")
|
|
1871
|
-
}),
|
|
1872
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableColumn, {
|
|
1873
|
-
className: "sh:text-end",
|
|
1874
|
-
children: t("devices.actions")
|
|
1875
|
-
})
|
|
1876
|
-
] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableBody, {
|
|
1877
|
-
items: devices,
|
|
1878
|
-
dependencies: [
|
|
1879
|
-
firmware,
|
|
1880
|
-
rowBusyId,
|
|
1881
|
-
language
|
|
1882
|
-
],
|
|
1883
|
-
renderEmptyState: () => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyDevices, { onAdd: addDrawer.open }),
|
|
1884
|
-
children: (device) => renderDevicesPageDevicesRows(device, {
|
|
1885
|
-
firmware,
|
|
1886
|
-
t,
|
|
1887
|
-
rowBusyId,
|
|
1888
|
-
setInfoDevice,
|
|
1889
|
-
setFirmwareDevice,
|
|
1890
|
-
setAuthDevice,
|
|
1891
|
-
withRowBusy,
|
|
1892
|
-
setDeleteTarget
|
|
1893
|
-
})
|
|
1894
|
-
})]
|
|
1895
|
-
}) })
|
|
1837
|
+
loading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TableDataLoadingIndicator, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DevicesTable, {
|
|
1838
|
+
devices,
|
|
1839
|
+
firmware,
|
|
1840
|
+
rowBusyId,
|
|
1841
|
+
onAdd: addDrawer.open,
|
|
1842
|
+
setInfoDevice,
|
|
1843
|
+
setFirmwareDevice,
|
|
1844
|
+
setAuthDevice,
|
|
1845
|
+
onDelete: removeDevice,
|
|
1846
|
+
withRowBusy
|
|
1896
1847
|
}),
|
|
1897
1848
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AddDeviceDrawer, {
|
|
1898
1849
|
isOpen: addDrawer.isOpen,
|
|
@@ -1917,35 +1868,15 @@ function DevicesPage() {
|
|
|
1917
1868
|
device: firmwareDevice,
|
|
1918
1869
|
onOpenChange: (open) => !open && setFirmwareDevice(null),
|
|
1919
1870
|
onUpdated: () => void refreshFirmware(devices)
|
|
1920
|
-
}),
|
|
1921
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusDialog, {
|
|
1922
|
-
isOpen: !!deleteTarget,
|
|
1923
|
-
onClose: () => setDeleteTarget(null),
|
|
1924
|
-
status: "error",
|
|
1925
|
-
title: t("devices.delete"),
|
|
1926
|
-
action: {
|
|
1927
|
-
label: t("common.delete"),
|
|
1928
|
-
onPress: confirmDelete,
|
|
1929
|
-
isPending: deleting,
|
|
1930
|
-
"data-cy": "shelly-delete-confirm"
|
|
1931
|
-
},
|
|
1932
|
-
closeLabel: t("common.cancel"),
|
|
1933
|
-
closeDataCy: "shelly-delete-cancel",
|
|
1934
|
-
"data-cy": "shelly-delete-confirmation-modal",
|
|
1935
|
-
children: t("devices.deleteDescription", {
|
|
1936
|
-
name: deleteTarget?.name,
|
|
1937
|
-
address: deleteTarget?.ipAddress
|
|
1938
|
-
})
|
|
1939
1871
|
})
|
|
1940
1872
|
]
|
|
1941
1873
|
});
|
|
1942
1874
|
}
|
|
1943
|
-
|
|
1944
|
-
//#region frontend/src/plugin.tsx
|
|
1875
|
+
// frontend/src/plugin.tsx
|
|
1945
1876
|
var { WifiIcon } = await importShared("lucide-react");
|
|
1946
1877
|
var ShellyPlugin = class {
|
|
1947
1878
|
getPluginName() {
|
|
1948
|
-
return "shelly-plugin@0.
|
|
1879
|
+
return "shelly-plugin@0.2.0";
|
|
1949
1880
|
}
|
|
1950
1881
|
getDependencies() {
|
|
1951
1882
|
return [];
|
|
@@ -1970,5 +1901,4 @@ var ShellyPlugin = class {
|
|
|
1970
1901
|
}];
|
|
1971
1902
|
}
|
|
1972
1903
|
};
|
|
1973
|
-
//#endregion
|
|
1974
1904
|
export { ShellyPlugin as default };
|