iobroker.eos-admin 9.0.33 → 9.0.35
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/NEXOWATT_EOS_BUILD_INFO.json +13 -11
- package/README.md +12 -8
- package/adminWww/.vite/manifest.json +233 -224
- package/adminWww/NEXOWATT_EOS_FRONTEND_MANIFEST.json +13897 -13887
- package/adminWww/assets/AccessTime-CuR73YC3.js +1 -0
- package/adminWww/assets/{AdapterUpdateDialog-DBUqmmyD.js → AdapterUpdateDialog-DH6S-kWX.js} +5 -5
- package/adminWww/assets/{Adapters-dDEp7o5h.js → Adapters-CIlqSF5B.js} +5 -5
- package/adminWww/assets/ConfigManager-BhVBfM-q.js +1 -0
- package/adminWww/assets/Enums-3H97czGs.js +92 -0
- package/adminWww/assets/Fields-vWLKiuvO.js +1 -0
- package/adminWww/assets/Files-wmjjMXYM.js +1 -0
- package/adminWww/assets/{Hosts-CwU1LujG.js → Hosts-Bk-xmI98.js} +6 -6
- package/adminWww/assets/Instances-Db6Vgh62.js +4 -0
- package/adminWww/assets/Intro-Dc3wAG9V.js +2 -0
- package/adminWww/assets/KeyboardArrowRight-ifvmV1ZL.js +1 -0
- package/adminWww/assets/{Logs-B5SpNqHq.js → Logs-CPbEGWNq.js} +2 -2
- package/adminWww/assets/MoreHoriz-CS7nODK8.js +1 -0
- package/adminWww/assets/{Objects-COg_cFkz.js → Objects-DJB-2468.js} +4 -4
- package/adminWww/assets/Overview-DdvghCLQ.js +3 -0
- package/adminWww/assets/Pageview-wzrLQZ-j.js +1 -0
- package/adminWww/assets/PersonOff-YtHcY0sV.js +1 -0
- package/adminWww/assets/Star-D8VNXawT.js +1 -0
- package/adminWww/assets/State-0UzpgKYj.js +1 -0
- package/adminWww/assets/UsedResources-Bcmo58YD.js +2 -0
- package/adminWww/assets/Users-BGHf3Rox.js +1 -0
- package/adminWww/assets/ViewCompact-D7bHgn99.js +1 -0
- package/adminWww/assets/ViewSidebar-CjClbCI5.js +1 -0
- package/adminWww/assets/WifiTethering-DJ9VO12W.js +1 -0
- package/adminWww/assets/{bootstrap-Dwfxhm2V.js → bootstrap-qkrk_CAn.js} +25 -25
- package/adminWww/assets/date-fns-BtR4dG_j.js +1 -0
- package/adminWww/assets/en-US-BjjaEI6N.js +1 -0
- package/adminWww/assets/{hostInit-3BbTwhaZ.js → hostInit-DlGqatlv.js} +1 -1
- package/adminWww/assets/icons-material-CUNq6tdT.js +1 -0
- package/adminWww/assets/{index-nddph2Sl.js → index-BrtKq3UN.js} +2 -2
- package/adminWww/assets/{installSVGRenderer-CPDIwFAL.js → installSVGRenderer-DujLjpXt.js} +1 -1
- package/adminWww/assets/isSameWeek-WMSJR5Qs.js +1 -0
- package/adminWww/assets/locale-DN6Bdkdt.js +1 -0
- package/adminWww/assets/{mf-entry-bootstrap-0-d1f0f40f.js → mf-entry-bootstrap-0-3e1cd85c.js} +2 -2
- package/adminWww/assets/sentry-CPzCHrwe.js +1 -0
- package/adminWww/assets/setYear-DDSuW45e.js +1 -0
- package/adminWww/index.html +23 -23
- package/adminWww/mf-manifest.json +1 -1
- package/adminWww/mf-stats.json +1 -1
- package/adminWww/{remoteEntry-eos-9.0.33.js → remoteEntry-eos-9.0.35.js} +1 -1
- package/adminWww/remoteEntry.js +1 -1
- package/build/lib/eosDashboardProcessStatus.js +191 -0
- package/build/lib/eosDashboardProcessStatus.js.map +1 -0
- package/build/lib/eosDeviceEmsPlan.js +285 -9
- package/build/lib/eosDeviceEmsPlan.js.map +1 -1
- package/build/lib/eosDeviceEmsService.js +29 -2
- package/build/lib/eosDeviceEmsService.js.map +1 -1
- package/build/lib/eosKiosk.js +1 -0
- package/build/lib/eosKiosk.js.map +1 -1
- package/build/lib/eosModuleHost.js +17 -6
- package/build/lib/eosModuleHost.js.map +1 -1
- package/build/lib/eosModuleHttp.js +18 -3
- package/build/lib/eosModuleHttp.js.map +1 -1
- package/build/lib/eosModuleProcess.js +17 -0
- package/build/lib/eosModuleProcess.js.map +1 -1
- package/build/lib/eosModuleProcessWorker.js +22 -1
- package/build/lib/eosModuleProcessWorker.js.map +1 -1
- package/build/lib/eosRuntimeControl.js +6 -0
- package/build/lib/eosRuntimeControl.js.map +1 -1
- package/build/lib/eosRuntimeHealth.js +50 -1
- package/build/lib/eosRuntimeHealth.js.map +1 -1
- package/build/lib/eosSupervisorNotifications.js +169 -0
- package/build/lib/eosSupervisorNotifications.js.map +1 -0
- package/build/lib/eosUiProcess.js +1 -0
- package/build/lib/eosUiProcess.js.map +1 -1
- package/build/lib/web.js +5 -0
- package/build/lib/web.js.map +1 -1
- package/docs/README.md +3 -2
- package/docs/reports/unified-9.0.34/PRUEFBERICHT.md +40 -0
- package/docs/reports/unified-9.0.34/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.34/raw/INDEX.json +137 -0
- package/docs/reports/unified-9.0.34/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.34/raw/dashboard-interval.json +108 -0
- package/docs/reports/unified-9.0.34/raw/fixtures-verification.log +44 -0
- package/docs/reports/unified-9.0.34/raw/frontend.log +152 -0
- package/docs/reports/unified-9.0.34/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.34/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.34/raw/mira-dashboard-browser.json +1 -0
- package/docs/reports/unified-9.0.34/raw/mira-devices-browser.log +9 -0
- package/docs/reports/unified-9.0.34/raw/mira-memory-process.json +379 -0
- package/docs/reports/unified-9.0.34/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.34/raw/node22-mira.log +216 -0
- package/docs/reports/unified-9.0.34/raw/node22-protocol-to-ems.log +8 -0
- package/docs/reports/unified-9.0.34/raw/node22-tests-final.log +17850 -0
- package/docs/reports/unified-9.0.34/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.34/raw/node24-mira.log +40 -0
- package/docs/reports/unified-9.0.34/raw/node24-protocol-to-ems.log +6 -0
- package/docs/reports/unified-9.0.34/raw/node24-tests-final.log +2973 -0
- package/docs/reports/unified-9.0.34/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.34/raw/protocol-to-ems.cjs +364 -0
- package/docs/reports/unified-9.0.34/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.34/raw/sbom.log +8 -0
- package/docs/reports/unified-9.0.34/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.34/raw/ui-runtime.log +8 -0
- package/docs/reports/unified-9.0.35/PRUEFBERICHT.md +51 -0
- package/docs/reports/unified-9.0.35/PRUEFERGEBNISSE.json +112 -0
- package/docs/reports/unified-9.0.35/raw/INDEX.json +282 -0
- package/docs/reports/unified-9.0.35/raw/backend.log +5 -0
- package/docs/reports/unified-9.0.35/raw/browser-lp-detail.log +1 -0
- package/docs/reports/unified-9.0.35/raw/browser-lp-feedback.log +1 -0
- package/docs/reports/unified-9.0.35/raw/cold-ocpp-22.log +108 -0
- package/docs/reports/unified-9.0.35/raw/cold-ocpp-24.log +24 -0
- package/docs/reports/unified-9.0.35/raw/core-final-node22.log +1439 -0
- package/docs/reports/unified-9.0.35/raw/core-final-node24.log +1381 -0
- package/docs/reports/unified-9.0.35/raw/dashboard-de-en-nl.json +716 -0
- package/docs/reports/unified-9.0.35/raw/device-chain-closed-fixed.json +98 -0
- package/docs/reports/unified-9.0.35/raw/device-chain-rst-fixed.json +98 -0
- package/docs/reports/unified-9.0.35/raw/device-chain.json +93 -0
- package/docs/reports/unified-9.0.35/raw/ee-fusion-final.log +12 -0
- package/docs/reports/unified-9.0.35/raw/eebus-monitor-browser.json +1 -0
- package/docs/reports/unified-9.0.35/raw/eebus-monitor-node22.log +206 -0
- package/docs/reports/unified-9.0.35/raw/eebus-monitor-node24.log +39 -0
- package/docs/reports/unified-9.0.35/raw/fixtures-verification.log +44 -0
- package/docs/reports/unified-9.0.35/raw/frontend.log +152 -0
- package/docs/reports/unified-9.0.35/raw/installer.log +26 -0
- package/docs/reports/unified-9.0.35/raw/legacy-mail-setup-browser.log +1 -0
- package/docs/reports/unified-9.0.35/raw/lint.log +45 -0
- package/docs/reports/unified-9.0.35/raw/live-ems-loss.log +10 -0
- package/docs/reports/unified-9.0.35/raw/modules.log +5 -0
- package/docs/reports/unified-9.0.35/raw/node22-mira-reconnect-integrity.log +452 -0
- package/docs/reports/unified-9.0.35/raw/node22-mira.log +222 -0
- package/docs/reports/unified-9.0.35/raw/node22-system-status.log +213 -0
- package/docs/reports/unified-9.0.35/raw/node22-tests-final.log +18137 -0
- package/docs/reports/unified-9.0.35/raw/node22-version.log +1 -0
- package/docs/reports/unified-9.0.35/raw/node24-mira-reconnect-integrity.log +79 -0
- package/docs/reports/unified-9.0.35/raw/node24-mira.log +41 -0
- package/docs/reports/unified-9.0.35/raw/node24-system-status.log +40 -0
- package/docs/reports/unified-9.0.35/raw/node24-tests-final.log +3019 -0
- package/docs/reports/unified-9.0.35/raw/node24-version.log +1 -0
- package/docs/reports/unified-9.0.35/raw/notifications-legacy-node22.log +1 -0
- package/docs/reports/unified-9.0.35/raw/notifications-legacy-node24.log +1 -0
- package/docs/reports/unified-9.0.35/raw/notifications-node22.log +67 -0
- package/docs/reports/unified-9.0.35/raw/notifications-node24.log +17 -0
- package/docs/reports/unified-9.0.35/raw/npm-runtime-audit.json +77 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-dashboard-stations-node22.log +110 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-dashboard-stations-node24.log +106 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-history-node22.log +561 -0
- package/docs/reports/unified-9.0.35/raw/ocpp-history-node24.log +98 -0
- package/docs/reports/unified-9.0.35/raw/poll-life-node22.log +38 -0
- package/docs/reports/unified-9.0.35/raw/poll-life-node24.log +12 -0
- package/docs/reports/unified-9.0.35/raw/qa-source-check.log +2 -0
- package/docs/reports/unified-9.0.35/raw/release-metadata.log +13 -0
- package/docs/reports/unified-9.0.35/raw/sbom.log +8 -0
- package/docs/reports/unified-9.0.35/raw/typecheck.log +5 -0
- package/docs/reports/unified-9.0.35/raw/ui-runtime.log +8 -0
- package/docs/reports/unified-9.0.35/raw/vergleich-9.0.33.json +29 -0
- package/docs/reports/unified-9.0.35/raw/vergleich-9.0.34.json +249 -0
- package/docs/reports/unified-9.0.35/raw/vorher-9.0.33-chromium.json +286 -0
- package/docs/reports/unified-9.0.35/raw/vorher-9.0.34-chromium.json +291 -0
- package/docs/start/START_HIER_9.0.34.md +25 -0
- package/docs/start/START_HIER_9.0.35.md +27 -0
- package/io-package.json +12 -12
- package/modules/devices/admin/alias-contract-v1.json +22 -0
- package/modules/devices/admin/ems-assignment.js +6 -1
- package/modules/devices/admin/host-bridge.js +2 -0
- package/modules/devices/admin/index.html +16 -0
- package/modules/devices/admin/index_m.js +168 -9
- package/modules/devices/admin/templates.json +976 -0
- package/modules/devices/checks/emsAssignment.check.js +52 -2
- package/modules/devices/contracts.d.ts +1 -0
- package/modules/devices/index.js +25 -2
- package/modules/devices/lib/alias-contract-v1.json +22 -0
- package/modules/devices/lib/deviceRuntime.js +36 -7
- package/modules/devices/lib/drivers/modbus.js +12 -7
- package/modules/devices/lib/drivers/modbusRtuBus.js +7 -1
- package/modules/devices/lib/drivers/ovumMira.js +152 -0
- package/modules/devices/lib/ovumMiraAliases.js +61 -0
- package/modules/devices/lib/ovumMiraConnection.js +32 -0
- package/modules/devices/lib/templates.json +976 -0
- package/modules/devices/test/aliasContractV1.test.js +4 -4
- package/modules/devices/test/deviceAliasSemantics.test.js +2 -2
- package/modules/devices/test/fixtures/approved-additive-templates.json +3 -1
- package/modules/devices/test/ovumMiraPairing.test.js +76 -0
- package/modules/devices/test/ovumMiraTemplates.test.js +110 -0
- package/modules/devices/test/ovumMiraTransport.test.js +201 -0
- package/modules/eebus/README.md +8 -0
- package/modules/eebus/admin/index.js +29 -2
- package/modules/eebus/build/index.js +28 -3
- package/modules/eebus/build/lib/eebusRuntime.js +17 -2
- package/modules/eebus/build/lib/partnerMonitor.js +160 -0
- package/modules/eebus/build/lib/shipEndpoint.js +4 -0
- package/modules/eebus/build/lib/stateDefinitions.js +1 -0
- package/modules/eebus/src/index.ts +23 -3
- package/modules/eebus/src/lib/eebusRuntime.ts +20 -2
- package/modules/eebus/src/lib/partnerMonitor.ts +127 -0
- package/modules/eebus/src/lib/shipEndpoint.ts +5 -0
- package/modules/eebus/src/lib/stateDefinitions.ts +1 -0
- package/modules/eebus/test/partner-monitor.test.js +82 -0
- package/modules/eebus/test/security.test.js +17 -0
- package/modules/ocpp/README.md +9 -1
- package/modules/ocpp/build/index.js +137 -10
- package/modules/ocpp/build/stationHistory.js +113 -0
- package/modules/ocpp/ocpp/freshness.d.ts +3 -0
- package/modules/ocpp/ocpp/freshness.js +6 -0
- package/modules/ocpp/provenance.json +3 -2
- package/modules/ocpp/runtime.d.ts +1 -0
- package/modules/ocpp/runtime.js +23 -1
- package/modules/ocpp/src/index.ts +163 -12
- package/modules/ocpp/src/stationHistory.ts +119 -0
- package/modules/ocpp/test/hosted.test.cjs +161 -0
- package/package.json +9 -5
- package/release-manifests/unified/build-environment.cdx.json +6 -6
- package/release-manifests/unified/files.json +313 -190
- package/release-manifests/unified/frontend.cdx.json +6 -6
- package/release-manifests/unified/installer.cdx.json +6 -6
- package/release-manifests/unified/obsolete-admin-assets.json +166 -0
- package/release-manifests/unified/runtime.cdx.json +30 -30
- package/release-manifests/unified/validation.json +15 -15
- package/tools/eos-release-manifest.cjs +1 -1
- package/ui/ems/consumers/ovum-mira.js +164 -0
- package/ui/ems/modules/para14a.js +3 -2
- package/ui/ems/modules/stage-a-diagnostics.js +4 -2
- package/ui/ems/modules/thermal-control.js +91 -10
- package/ui/io-package.json +9 -1
- package/ui/lib/installer-lifecycle.js +11 -2
- package/ui/lib/notification-mail.js +235 -40
- package/ui/lib/notification-policy.js +41 -14
- package/ui/main.js +37 -7
- package/ui/package.json +2 -1
- package/ui/www/app.js +122 -24
- package/ui/www/dashboard-lp-status.js +4 -11
- package/ui/www/dashboard-process-status.js +202 -0
- package/ui/www/ems-apps.js +28 -9
- package/ui/www/i18n/en.json +23 -0
- package/ui/www/i18n/nl.json +20 -0
- package/ui/www/index.html +10 -5
- package/ui/www/licenses/smarthome-markdown-components.json +156 -156
- package/ui/www/live-display.js +101 -9
- package/ui/www/manifest.webmanifest +2 -2
- package/ui/www/settings.html +2 -2
- package/ui/www/styles.css +4 -0
- package/adminWww/assets/AddLink-0L0E-LsA.js +0 -1
- package/adminWww/assets/ColorLens-DA51K29x.js +0 -1
- package/adminWww/assets/ConfigManager-DbqTWi2N.js +0 -1
- package/adminWww/assets/Enums-DjldGElU.js +0 -92
- package/adminWww/assets/Fields-0GsPCJeU.js +0 -1
- package/adminWww/assets/FileCopy-B16lEuur.js +0 -1
- package/adminWww/assets/Files-COnUtEbg.js +0 -1
- package/adminWww/assets/Instances-CUX5mxMQ.js +0 -4
- package/adminWww/assets/Intro-BhQmHn3A.js +0 -2
- package/adminWww/assets/Lens-9lkeoWGk.js +0 -1
- package/adminWww/assets/LinearScale-Be5h2beh.js +0 -1
- package/adminWww/assets/North-C2whbHM-.js +0 -1
- package/adminWww/assets/Overview-CitzUjBF.js +0 -3
- package/adminWww/assets/PersonOff-DqBq0Fho.js +0 -1
- package/adminWww/assets/PlaylistAdd-O8k92YBd.js +0 -1
- package/adminWww/assets/State-D5ljzf-T.js +0 -1
- package/adminWww/assets/UsedResources-BY_NF2wB.js +0 -2
- package/adminWww/assets/Users-Cu93_-VF.js +0 -1
- package/adminWww/assets/date-fns-C1dqkno9.js +0 -1
- package/adminWww/assets/icons-material-DjqX0l_7.js +0 -1
- package/adminWww/assets/isSameWeek-Crh37s7U.js +0 -1
- package/adminWww/assets/isWithinInterval-Bo1WiDfq.js +0 -1
- package/adminWww/assets/locale-hLcz_Xh2.js +0 -1
- package/adminWww/assets/sentry-DwQQLI7N.js +0 -1
- package/adminWww/assets/startOfWeek-DJph8SIW.js +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{$r as e,Ao as t,As as n,Bo as r,Ci as i,Do as a,Es as o,Gi as s,Ha as c,Hs as l,Ii as u,Jo as d,Ka as f,Ki as p,Ko as m,Lr as h,Mo as g,Po as _,Qs as ee,Ro as v,To as y,Tr as b,Ts as x,Ui as S,Ur as C,Us as w,Vi as T,Vo as te,Vs as E,Wa as D,Wi as O,Wn as ne,Wo as k,Wr as A,Xn as re,Xo as ie,Yi as ae,Zo as oe,_s as se,er as ce,gi as le,go as j,gs as ue,ic as de,jo as M,js as fe,ks as N,lo as P,mo as F,ms as I,oi as pe,os as me,pc as L,po as R,ps as he,qo as z,qs as ge,r as B,sc as _e,tc as ve,ua as ye,uc as be,xo as xe,ya as Se,yo as V}from"./loadShare-eager-dmdYQhAl.js";import{t as Ce}from"./Apps-BZHXIYjq.js";import{t as we}from"./Computer-BBU3Cm9-.js";import{a as Te,i as Ee,n as De,r as Oe,t as ke}from"./Timer-vc3BIs4y.js";import{t as Ae}from"./Extension-DIV5Bi1u.js";import{t as je}from"./InfoOutlined-Bggo2-pX.js";import{t as Me}from"./Schedule-vdojlve9.js";import{t as Ne}from"./Storage-B44xXFFu.js";import{c as Pe,f as Fe,l as Ie,p as Le,s as Re,t as H}from"./AdminUtils-Dc1eHsx5.js";import{st as ze,xt as Be}from"./bootstrap-qkrk_CAn.js";import{i as Ve,l as He,n as Ue,r as We,t as Ge}from"./classPrivateFieldGet2-DZ8s9-Td.js";var Ke=168;function qe(e,t){if(e)try{return N(e,t)}catch{return}}var U={root:{display:`flex`,maxWidth:460},link:e=>({display:`flex`,width:`100%`,color:`inherit`,borderRadius:`12px`,"&:focus-visible":{outline:`2px solid ${e.palette.primary.main}`,outlineOffset:`2px`}}),card:e=>({display:`flex`,flexDirection:`column`,gap:`12px`,width:`100%`,p:`16px`,position:`relative`,overflow:`hidden`,backgroundColor:e.palette.mode===`dark`?fe(e.palette.background.paper,.08):n(e.palette.background.paper,.03),border:`1px solid`,borderColor:e.palette.divider,backgroundImage:`none`,transition:`border-color 0.15s, background-color 0.15s`,"@media (prefers-reduced-motion: reduce)":{transition:`none`}}),cardClickable:{cursor:`pointer`,"&:hover .intro-card-launch":{opacity:1}},cardOff:e=>({opacity:.45,borderStyle:`dashed`,borderColor:e.palette.text.disabled}),head:{display:`flex`,alignItems:`flex-start`,gap:`14px`},icon:{width:56,height:56,flex:`0 0 auto`,borderRadius:`14px`,display:`flex`,alignItems:`center`,justifyContent:`center`,overflow:`hidden`},iconOffline:{filter:`grayscale(1)`,opacity:.5},img:{width:40,height:40,objectFit:`contain`},headText:{minWidth:0,flex:1,display:`flex`,flexDirection:`column`,gap:`2px`,pr:`20px`},title:{fontSize:`0.98rem`,fontWeight:600,lineHeight:1.25,display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:2,overflow:`hidden`,wordBreak:`break-word`},meta:e=>({fontSize:`0.78rem`,lineHeight:1.35,color:e.palette.text.secondary,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`}),warning:e=>({fontSize:17,ml:`4px`,verticalAlign:`-3px`,color:e.palette.warning.main}),corner:{position:`absolute`,top:16,right:16,zIndex:2,display:`flex`,alignItems:`center`,gap:`8px`},launch:e=>({fontSize:17,opacity:0,color:e.palette.text.secondary,transition:`opacity 0.15s`,"@media (prefers-reduced-motion: reduce)":{transition:`none`}}),lamp:{width:10,height:10,borderRadius:`50%`,flex:`0 0 auto`},lampOnline:e=>({backgroundColor:e.palette.success.main,boxShadow:`0 0 0 3px ${N(e.palette.success.main,.2)}`}),lampOffline:e=>({backgroundColor:e.palette.error.main,boxShadow:`0 0 0 3px ${N(e.palette.error.main,.2)}`}),lampUnknown:e=>({backgroundColor:e.palette.text.disabled}),content:e=>({flex:1,minHeight:0,overflow:`hidden`,fontSize:`0.82rem`,lineHeight:1.5,color:e.palette.text.secondary}),contentClamped:{display:`-webkit-box`,WebkitBoxOrient:`vertical`,WebkitLineClamp:3},infoButton:{alignSelf:`flex-start`,ml:`-6px`,fontSize:`0.78rem`,minHeight:0,py:`2px`},editBar:e=>({position:`absolute`,top:8,right:8,zIndex:3,display:`flex`,gap:`2px`,borderRadius:`10px`,p:`2px`,backgroundColor:N(e.palette.background.paper,.85),backdropFilter:`blur(3px)`}),tooltip:{pointerEvents:`none`},infoTitle:{display:`flex`,alignItems:`center`,gap:`8px`,pr:`12px`},infoTitleText:{flex:1,minWidth:0,overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},infoBody:{fontSize:`0.9rem`,lineHeight:1.5}},W=class e extends ve{constructor(e){super(e),this.state={infoOpen:!1}}static getDerivedStateFromProps(e){return e.edit?{infoOpen:!1}:null}renderContent(){return this.props.children}openDialog(){}renderDialogs(){return null}hoverTint(e){let t=qe(e,this.props.theme.palette.mode===`dark`?.12:.07);return t?`linear-gradient(${t}, ${t})`:void 0}cardMinHeight(){return Ke}static swallow(e,t){e.preventDefault(),e.stopPropagation(),t==null||t()}renderEditBar(){return this.props.edit?w(j,{sx:U.editBar,children:[this.props.toggleActivation?l(R,{title:this.props.t(`show/hide item`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,color:this.props.enabled?`primary`:`default`,onClick:t=>e.swallow(t,this.props.toggleActivation),children:l(D,{fontSize:`small`})})}):null,this.props.onEdit?l(R,{title:this.props.t(`Edit`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,onClick:t=>e.swallow(t,this.props.onEdit),children:l(Te,{fontSize:`small`})})}):null,this.props.onRemove?l(R,{title:this.props.t(`Delete`),slotProps:{popper:{sx:U.tooltip}},children:l(m,{size:`small`,color:`error`,onClick:t=>e.swallow(t,this.props.onRemove),children:l(c,{fontSize:`small`})})}):null]}):null}renderInfoDialog(){var e,n;if(!this.props.showInfo||!this.state.infoOpen)return null;let r=(e=(n=this.props).getHostDescriptionAll)==null?void 0:e.call(n),i=()=>this.setState({infoOpen:!1});return w(t,{open:!0,onClose:i,maxWidth:`sm`,fullWidth:!0,onClick:e=>e.stopPropagation(),children:[w(_,{sx:U.infoTitle,children:[l(je,{color:`primary`}),w(j,{sx:U.infoTitleText,children:[this.props.t(`Info`),`: `,this.props.title]}),l(m,{size:`small`,onClick:i,children:l(f,{})})]}),l(g,{dividers:!0,sx:U.infoBody,children:r==null?void 0:r.el}),w(M,{children:[l(V,{color:`grey`,variant:`outlined`,startIcon:l(ce,{}),disabled:!(r!=null&&r.text),onClick:()=>{var e,t;A.copyToClipboard((r==null?void 0:r.text)||``),(e=(t=this.props).openSnackBarFunc)==null||e.call(t)},children:this.props.t(`Copy to clipboard`)}),l(V,{variant:`contained`,color:`primary`,autoFocus:!0,startIcon:l(f,{}),onClick:i,children:this.props.t(`Close`)})]})]})}render(){var t,n,r;let{theme:i}=this.props,a=this.props.color||i.palette.primary.main,o=!this.props.edit&&!!((t=this.props.action)!=null&&t.link)&&!this.props.unreachable,s=H.getText((n=this.props.action)==null?void 0:n.text,this.props.lang),c=``;if((r=this.props.action)!=null&&r.link)try{c=new URL(this.props.action.link,window.location.href).href}catch{c=this.props.action.link}return l(k,{size:{xs:12,sm:6,md:4,lg:3,xl:2},sx:A.getStyle(i,U.root,this.props.style),children:l(oe,{href:o?this.props.action.link:void 0,underline:`none`,target:`_blank`,rel:`noopener noreferrer`,sx:A.getStyle(i,U.link),children:w(xe,{sx:A.getStyle(i,U.card,{minHeight:this.cardMinHeight()},o&&U.cardClickable,o&&{"&:hover":{borderColor:qe(a,.7)||a,backgroundImage:this.hoverTint(a)}},this.props.edit&&!this.props.enabled&&U.cardOff,this.props.unreachable&&U.cardOff),onClick:e=>{e.stopPropagation(),this.openDialog()},children:[w(j,{sx:U.head,children:[l(j,{sx:A.getStyle(i,U.icon,{backgroundColor:this.props.color||qe(i.palette.text.primary,.07)},(this.props.offline||this.props.unreachable)&&U.iconOffline),children:l(j,{component:`img`,src:this.props.image,alt:``,sx:U.img})}),w(j,{sx:U.headText,children:[w(F,{component:`div`,sx:U.title,children:[this.props.title,this.props.warning||this.props.unreachable?l(R,{title:this.props.warning||this.props.t(`Only reachable in the local network`),slotProps:{popper:{sx:U.tooltip}},children:l(pe,{sx:U.warning})}):null]}),s?l(F,{component:`div`,sx:U.meta,title:c||s,children:s}):null]})]}),o||this.props.status?w(j,{sx:U.corner,children:[o?l(ne,{className:`intro-card-launch`,sx:U.launch}):null,this.props.status?l(R,{title:this.props.t(this.props.status===`unknown`?`unknown`:this.props.status),slotProps:{popper:{sx:U.tooltip}},children:l(j,{sx:A.getStyle(i,U.lamp,this.props.status===`online`&&U.lampOnline,this.props.status===`offline`&&U.lampOffline,this.props.status===`unknown`&&U.lampUnknown)})}):null]}):null,l(j,{sx:A.getStyle(i,U.content,typeof this.props.children==`string`&&U.contentClamped),children:this.renderContent()}),this.props.showInfo&&!this.props.offline?l(V,{sx:U.infoButton,size:`small`,color:`inherit`,startIcon:l(je,{fontSize:`small`}),disabled:this.props.disabled,onClick:t=>e.swallow(t,()=>this.setState({infoOpen:!0})),children:this.props.t(`Info`)}):null,this.renderInfoDialog(),this.renderEditBar(),this.renderDialogs()]})})})}};o();var G={rootGrid:{flexGrow:1},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),paper:{},typography:{paddingRight:30},img:{width:`100%`,height:`100%`,objectFit:`contain`}},Je=class extends ve{constructor(e){super(e),x(this,`cameraUpdateTimer`,void 0),x(this,`cameraRef`,void 0),this.cameraUpdateTimer=null,this.cameraRef=ee()}componentDidMount(){this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval||``,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null)}updateCamera(){if(this.cameraRef.current){if(this.props.camera===`custom`){let e=this.props.cameraUrl;this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),this.cameraRef.current.src=e}else{let e=this.props.camera.split(`.`),t=e.shift(),n=e.shift();this.props.socket.sendTo(`${t}.${n}`,`image`,{name:e.pop(),width:this.cameraRef.current.width}).then(e=>{e&&e.data&&this.cameraRef.current&&(this.cameraRef.current.src=`data:image/jpeg;base64,${e.data}`)})}}}render(){return w(t,{onClose:()=>this.props.onClose(),open:!0,maxWidth:`xl`,fullWidth:!0,fullScreen:!0,sx:{"& .MuiDialog-paper":G.paper},children:[l(_,{children:w(F,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":G.typography},children:[this.props.name,l(m,{size:`large`,sx:G.closeButton,onClick:()=>this.props.onClose(),children:l(f,{})})]})}),l(g,{dividers:!0,children:l(`img`,{style:G.img,src:``,alt:`camera`,ref:this.cameraRef})}),l(M,{children:l(V,{variant:`contained`,autoFocus:!0,onClick:e=>{e.stopPropagation(),this.props.onClose()},color:`primary`,startIcon:l(f,{}),children:this.props.t(`Close`)})})]})}};o();var K={cameraImg:{width:`100%`,height:`100%`,objectFit:`contain`,borderRadius:8},imgContainer:{height:`100%`,width:`100%`},hidden:{display:`none`},imgSkeleton:{transform:`initial`}},Ye=class extends W{constructor(e){super(e),x(this,`cameraRef`,void 0),x(this,`cameraUpdateTimer`,void 0),x(this,`interval`,void 0),Object.assign(this.state,{error:!1,dialog:!1,loaded:!1}),this.cameraRef=ee(),this.cameraUpdateTimer=null,this.interval=e.interval||0}updateCamera(){if(this.cameraRef.current){if(this.props.camera===`custom`){let e=this.props.cameraUrl||``;this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),this.cameraRef.current.src=e}else{let e=(this.props.camera||``).split(`.`),t=e.shift(),n=e.shift();this.props.socket.sendTo(`${t}.${n}`,`image`,{name:e.pop(),width:this.cameraRef.current.width}).then(e=>{e!=null&&e.data&&this.cameraRef.current&&(this.cameraRef.current.src=`data:image/jpeg;base64,${e.data}`)}).catch(e=>window.alert(`Cannot send to instance: ${e}`))}}}componentDidMount(){this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera())}componentWillUnmount(){this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null)}cardMinHeight(){return 260}renderDialogs(){return this.state.dialog?l(Je,{socket:this.props.socket,camera:this.props.camera||``,name:this.props.title,t:this.props.t,onClose:()=>{this.props.camera&&this.props.camera!==`text`&&(this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500)),this.updateCamera()),this.setState({dialog:!1})},cameraUrl:this.props.cameraUrl||``}):null}handleImageLoad(){this.state.loaded||this.setState({loaded:!0,error:!1})}handleImageError(){this.state.error||this.setState({loaded:!1,error:!0})}renderContent(){var e;if(this.props.camera===`custom`){let e=this.props.cameraUrl||``;return this.props.addTs&&(e.includes(`?`)?e+=`&ts=${Date.now()}`:e+=`?ts=${Date.now()}`),w(k,{container:!0,style:K.imgContainer,sx:{alignItems:`center`,justifyContent:`center`},children:[l(`img`,{ref:this.cameraRef,src:e,alt:`Camera`,style:this.state.loaded&&!this.state.error?K.cameraImg:K.hidden,onLoad:()=>this.handleImageLoad(),onError:()=>this.handleImageError()}),!this.state.loaded&&!this.state.error&&l(I,{height:`100%`,width:`100%`,animation:`wave`,style:K.imgSkeleton}),this.state.error&&l(le,{fontSize:`large`})]})}return(e=this.props.camera)!=null&&e.startsWith(`cameras.`)?l(`img`,{ref:this.cameraRef,src:``,alt:`camera`,style:K.cameraImg}):null}render(){return this.props.camera&&this.props.camera!==`text`?this.interval!==this.props.interval&&(this.interval=this.props.interval||0,this.cameraUpdateTimer&&clearInterval(this.cameraUpdateTimer),this.cameraUpdateTimer=setInterval(()=>this.updateCamera(),Math.max(parseInt(this.props.interval,10),500))):this.cameraUpdateTimer&&=(clearInterval(this.cameraUpdateTimer),null),super.render()}};o();var q={formControl:{marginTop:32},rootGrid:{flexGrow:1},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),paper:{},typography:{paddingRight:30},editItem:{marginTop:8},editItemSlider:{marginTop:24},labelSlider:{marginTop:16,fontSize:`1rem`},editColor:{width:`100%`},dropZone:{width:`100%`,height:100,position:`relative`},dropZoneEmpty:{},image:{height:`100%`,width:`auto`,objectFir:`contain`},uploadDiv:{position:`relative`,width:`100%`,height:100,opacity:.9},uploadDivDragging:{opacity:1},uploadCenterDiv:{margin:5,border:`3px dashed grey`,borderRadius:5,width:`calc(100% - 10px)`,height:`calc(100% - 10px)`,position:`relative`},uploadCenterIcon:{paddingTop:10,width:48,height:48},uploadCenterText:{fontSize:16},uploadCenterTextAndIcon:{textAlign:`center`,position:`absolute`,top:0,bottom:0,left:0,right:0}},Xe=class e extends ve{constructor(e){super(e),x(this,`originalData`,void 0),this.state={image:``,name:e.t(`New link`),link:`http://`,linkName:``,color:``,desc:``,addTs:!0,interval:5e3,camera:`text`,cameraList:[],...e.link},this.originalData=JSON.stringify(this.getData())}getData(){return{link:this.state.link,name:this.state.name,desc:this.state.desc,linkName:this.state.linkName,color:this.state.color,image:this.state.image,addTs:this.state.addTs,camera:this.state.camera,interval:this.state.interval}}componentDidMount(){this.getCamerasInstances()}getCamerasInstances(){this.props.socket.getAdapterInstances(`cameras`,!0).then(e=>{let t=[],n=[];e.forEach(e=>{let r=e._id.replace(`system.adapter.`,``);e.common&&e.common.enabled&&n.push(this.props.socket.getState(`${e._id}.alive`).then(e=>e&&e.val&&this.props.socket.sendTo(r,`list`,null)).then(e=>e&&e.list&&e.list.forEach(e=>t.push({id:e.id,name:`${e.desc} [${r}/${e.name}]`}))))}),Promise.all(n).then(()=>this.setState({cameraList:t}))})}static getLinkNameFromLink(e){let t=e.trim().match(/^https?:\/\/([^/:]+)(:\d+)?/);return t?t[1]+(t[2]||``):``}render(){return w(t,{onClose:()=>this.props.onClose(),open:!0,maxWidth:`md`,fullWidth:!0,sx:{"& .MuiDialog-paper":q.paper},children:[l(_,{children:w(F,{component:`h2`,variant:`h6`,sx:{"&.MuiTypography-root":q.typography},children:[this.props.isNew?this.props.t(`Add new link: `):this.props.t(`Edit link`),l(m,{size:`large`,sx:q.closeButton,onClick:()=>this.props.onClose(),children:l(f,{})})]})}),l(g,{dividers:!0,children:w(k,{style:q.rootGrid,container:!0,direction:`row`,children:[l(k,{size:{xs:12,sm:6,md:8,lg:9},children:w(k,{container:!0,sx:{flexDirection:`column`},children:[w(r,{variant:`standard`,style:q.formControl,children:[l(d,{id:`select-helper-label`,children:this.props.t(`Link type`)}),w(he,{variant:`standard`,labelId:`select-helper-label`,value:this.state.camera,onChange:e=>this.setState({camera:e.target.value}),children:[l(me,{value:`text`,children:l(`em`,{children:this.props.t(`Description`)})},`desc`),this.state.cameraList.map(e=>l(me,{value:e.id,children:e.name},e.id)),l(me,{value:`custom`,children:this.props.t(`Custom camera URL`)},`custom`)]})]}),l(P,{variant:`standard`,label:this.props.t(`URL`),value:this.state.link,style:q.editItem,onChange:t=>{let n=e.getLinkNameFromLink(this.state.link);n&&(!this.state.linkName||n===this.state.linkName)?this.setState({link:t.target.value,linkName:e.getLinkNameFromLink(t.target.value)}):this.setState({link:t.target.value})},slotProps:{input:{endAdornment:this.state.link?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({link:``}),children:l(f,{})})}):null}}}),l(P,{variant:`standard`,style:q.editItem,label:this.props.t(`Name`),value:this.state.name||``,onChange:e=>this.setState({name:e.target.value}),slotProps:{input:{endAdornment:this.state.name?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({name:``}),children:l(f,{})})}):null}}}),this.state.link?l(P,{variant:`standard`,style:q.editItem,label:this.props.t(`Link name`),value:this.state.linkName||``,onChange:e=>this.setState({linkName:e.target.value}),slotProps:{input:{endAdornment:this.state.linkName?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({linkName:``}),children:l(f,{})})}):null}}}):null,this.state.camera===`custom`||this.state.camera===`text`?l(P,{variant:`standard`,style:q.editItem,label:this.state.camera===`custom`?this.props.t(`Camera URL`):this.props.t(`Description`),value:this.state.desc||``,onChange:e=>this.setState({desc:e.target.value}),slotProps:{input:{endAdornment:this.state.desc?l(z,{position:`end`,children:l(m,{tabIndex:-1,size:`small`,onClick:()=>this.setState({desc:``}),children:l(f,{})})}):null}}}):null,this.state.camera===`custom`?l(te,{style:q.editItem,control:l(y,{checked:this.state.addTs,onChange:e=>this.setState({addTs:e.target.checked})}),label:this.props.t(`Add timestamp to URL`)}):null,this.state.camera===`text`?null:l(F,{style:q.labelSlider,gutterBottom:!0,children:`Polling interval in ms`}),this.state.camera===`text`?null:l(ue,{style:q.editItemSlider,value:this.state.interval,getAriaValueText:()=>`${this.state.interval}ms`,onChange:(e,t)=>this.setState({interval:t}),step:100,min:500,max:6e4,valueLabelDisplay:`on`}),l(`div`,{style:{...q.editItem,width:50},children:l(P,{variant:`standard`,fullWidth:!0,label:this.props.t(`Color`),style:q.editColor,type:`color`,value:this.state.color,onChange:e=>this.setState({color:e.target.value})})}),l(C,{disabled:!1,crop:!0,maxSize:262144,icon:this.state.image,removeIconFunc:()=>this.setState({image:``}),onChange:e=>this.setState({image:e})})]})}),l(k,{size:{xs:12,sm:6,md:4,lg:3},children:this.state.camera===`text`?l(W,{image:this.state.image,title:this.state.name,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,lang:this.props.lang,style:{width:`100% !important`,maxWidth:`100% !important`,marginLeft:`8px`},color:this.state.color,enabled:!0,theme:this.props.theme,children:this.state.desc}):l(Ye,{interval:this.state.interval,camera:this.state.camera,addTs:this.state.addTs,style:{width:`100% !important`,maxWidth:`100% !important`,marginLeft:`8px`},image:this.state.image,title:this.state.name,socket:this.props.socket,action:{link:this.state.link,text:this.state.linkName},t:this.props.t,lang:this.props.lang,color:this.state.color,enabled:!0,cameraUrl:this.state.desc,theme:this.props.theme})})]})}),w(M,{children:[l(V,{variant:`contained`,autoFocus:!0,onClick:()=>this.props.onClose(this.getData()),disabled:!this.props.isNew&&JSON.stringify(this.getData())===this.originalData,color:`primary`,startIcon:this.props.isNew?l(i,{}):l(D,{}),children:this.props.isNew?this.props.t(`Add`):this.props.t(`Save`)}),l(V,{variant:`contained`,onClick:()=>this.props.onClose(),color:`grey`,startIcon:l(f,{}),children:this.props.t(`Close`)})]})]})}},Ze=class extends ge.Component{constructor(e){super(e),this.state={inProgress:!1,success:!1,error:``,finished:!1}}render(){return w(t,{open:!0,maxWidth:`lg`,fullWidth:!0,children:[l(_,{children:b.t(`Node.js upgrade`)}),w(g,{style:{height:100,padding:`0 20px`,overflow:`hidden`},children:[this.state.finished?null:l(F,{children:b.t(`Performing this update will restart the js-controller afterwards!`)}),this.state.inProgress?l(j,{sx:{display:`flex`,justifyContent:`center`},children:l(a,{})}):null,this.state.success?l(F,{children:b.t(`Node.js update successful, restarting controller now!`)}):null,this.state.error?l(F,{sx:{color:`red`},children:b.t(`Node.js update failed: %s`,this.state.error)}):null]}),w(M,{children:[l(V,{disabled:this.state.inProgress||this.state.finished,color:`primary`,variant:`contained`,startIcon:l(ye,{}),onClick:()=>this.updateNodeJsVersion(),children:b.t(`Upgrade`)}),l(V,{disabled:this.state.inProgress,variant:`contained`,onClick:()=>{this.props.onClose()},color:`primary`,startIcon:l(f,{}),children:b.t(`Close`)})]})]})}async updateNodeJsVersion(){this.setState({inProgress:!0});let e=await this.props.socket.upgradeOsPackages(this.props.hostId,[{name:`nodejs`}],!0);this.setState({inProgress:!1,success:e.success,error:e.error||``,finished:!0})}},Qe={ok:`#01bc69`,info:`#48b9ff`,warning:`#ffbd59`,error:`#ff5f72`},$e={ok:`Normal`,info:`Information`,warning:`Begrenzt`,error:`Störung`};function J(e,t=0){let n=Number(e);return Number.isFinite(n)?n:t}function Y(e,t=``){return(typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`?String(e):t).replace(/\s+/g,` `).trim()||t}function et(e,t){if(e&&typeof e==`object`)return e;try{return JSON.parse(typeof e==`string`?e:``)}catch{return t}}function X(e,t){var n;return(n=e[t])==null?void 0:n.val}function Z(e){let t=J(e,0),n=t<0?`−`:``,r=Math.abs(t);return r>=1e3?`${n}${(r/1e3).toLocaleString(`de-DE`,{minimumFractionDigits:1,maximumFractionDigits:2})} kW`:`${n}${Math.round(r).toLocaleString(`de-DE`)} W`}function tt(e){let t=J(e,0);if(!t)return`noch kein Regeltick`;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<2?`gerade eben`:n<60?`vor ${n} s`:`vor ${Math.round(n/60)} min`}function nt(e){let t=J(e,0);if(!t)return`—`;try{return new Date(t).toLocaleTimeString(`de-DE`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}catch{return`—`}}function Q(e){let t=Y(e).toLowerCase();return t===`error`?`error`:t===`warning`||t===`warn`?`warning`:t===`ok`?`ok`:`info`}function rt(e,t){let n=new Set;for(let t of Object.keys(e||{})){let e=t.match(/^(eos-admin\.\d+)\.info\.adminOverview\./);e!=null&&e[1]&&n.add(e[1])}let r=[];for(let a of n){var i;let n=et(X(e,`${a}.info.adminOverview.summaryJson`),{}),o=et(X(e,`${a}.info.adminOverview.eventsJson`),[]),s=Math.max(J(n.updatedAt,0),J(n.generatedAt,0),J(X(e,`${a}.info.adminOverview.updatedAt`),0),J((i=e[`${a}.info.adminOverview.summaryJson`])==null?void 0:i.ts,0)),c=X(t,`system.adapter.${a}.alive`),l=c==null?null:c===!0||c===1||[`true`,`1`,`online`,`active`].includes(Y(c).toLowerCase());r.push({instance:a,alive:l,summary:{...n,status:Q(n.status||X(e,`${a}.info.adminOverview.status`)),headline:Y(n.headline||X(e,`${a}.info.adminOverview.headline`),`EMS-Diagnose wird aufgebaut`),reason:Y(n.reason||X(e,`${a}.info.adminOverview.reason`),``),binding:Y(n.binding||X(e,`${a}.info.adminOverview.binding`),`none`)},events:Array.isArray(o)?o:[],updatedAt:s})}return r.sort((e,t)=>{let n=e=>e===!0?2:+(e===null);return n(t.alive)-n(e.alive)||t.updatedAt-e.updatedAt||e.instance.localeCompare(t.instance)})}function it(e){let t=[],n=e.charging||{};n.available&&t.push({subsystem:`charging`,severity:J(n.faultCount,0)>0?`error`:J(n.waitingCount,0)>0?`info`:`ok`,title:`${J(n.activeCount,0)} lädt · ${J(n.waitingCount,0)} wartet · ${J(n.faultCount,0)} gestört`,reason:Y(n.limiterText||n.status,`Lademanagement aktiv`),details:`Ist ${Z(n.actualW)} · Soll ${Z(n.targetW)}`});let r=e.storage||{};return r.available&&t.push({subsystem:`storage`,severity:r.writeOk===!1?`error`:`ok`,title:`Speicher ${Y(r.topology,`aktiv`)}${r.socPct==null?``:` · SoC ${Math.round(J(r.socPct,0))} %`}`,reason:Y(r.reason,`Speicherregelung aktiv`),details:`Ist ${Z(r.actualW)} · Soll ${Z(r.targetW)}`}),t}function at({socket:e}){let[t,n]=L(null),[r,i]=L(!0),[a,o]=L(``),[s,c]=L(()=>Date.now()),u=de(async()=>{if(document.visibilityState===`visible`)try{let t=await e.getCurrentInstance();if(!/^eos-admin\.\d+$/.test(t))throw Error(`EOS-Instanz konnte nicht eindeutig ermittelt werden`);let[r,i]=await Promise.all([e.getForeignStates(`${t}.info.adminOverview.*`),e.getForeignStates(`system.adapter.${t}.alive`)]),a=rt(r||{},i||{});n(a[0]||null),o(``)}catch(e){o(Y(e==null?void 0:e.message,`EMS-Diagnose konnte nicht gelesen werden`))}finally{i(!1),c(Date.now())}},[e]);_e(()=>{u();let e=()=>{document.visibilityState===`visible`&&u()};document.addEventListener(`visibilitychange`,e);let t=window.setInterval(()=>void u(),5e3);return()=>{document.removeEventListener(`visibilitychange`,e),window.clearInterval(t)}},[u]);let d=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),f=d===`admin`||d===`service`||d===`installer`||d===`installateur`,p=(t==null?void 0:t.summary)||{},m=t!=null&&t.updatedAt?Math.max(0,s-t.updatedAt):1/0,h=!!(t&&(t.alive===!1||m>2e4)),g=Q(p.status),_=h?`error`:g,ee=Qe[_],v=p.budget||{},y=p.charging||{},b=p.storage||{},x=p.ems||{},S=p.para14a||{},C=p.tariff||{},T=p.forecast||{},te=p.peakShaving||{},E=Math.max(0,J(v.totalW,0)),D=Math.max(0,J(v.remainingW,0)),O=E>0?Math.max(0,Math.min(100,D/E*100)):0,ne=be(()=>(Array.isArray(p.currentDecisions)?p.currentDecisions:it(p)).slice(0,f?5:2),[p,f]),k=f?((t==null?void 0:t.events)||[]).slice(0,6):[],A=[];return Y(p.binding,`none`)!==`none`&&A.push({label:`Bindend: ${Y(v.bindingText||p.binding)}`,warning:!0}),S.communicationFallbackActive?A.push({label:`§14a-Fallback ${Z(S.fallbackCapW)}`,warning:!0}):S.binding&&A.push({label:`§14a begrenzt`,warning:!0}),te.active&&A.push({label:`Peak-Shaving: ${Y(te.status,`aktiv`)}`,warning:!0}),C.available&&A.push({label:`Tarif: ${Y(C.state,`aktiv`)}${C.priceEurPerKwh==null?``:` · ${J(C.priceEurPerKwh).toFixed(3)} €/kWh`}`}),T.available&&A.push({label:`Prognose: ${Y(T.source,`aktiv`)}${T.fresh===!1?` · veraltet`:``}`,warning:T.fresh===!1}),(x.safetyActive||x.safetyEmergencyStop||x.safetyValid===!1)&&A.push({label:`EOS Safety aktiv`,warning:!0}),!t&&!r?w(`section`,{className:`eos-ems-overview-card`,"data-nexowatt-contract":`nexowatt-ems-overview-v1`,style:{"--eos-ems-status-color":Qe.info},children:[w(`header`,{className:`eos-ems-overview-header`,children:[w(`div`,{children:[l(`span`,{className:`eos-ems-overview-eyebrow`,children:`NexoWatt EMS`}),l(`h2`,{children:`Live-Diagnose`}),l(`p`,{children:a||`Die integrierte EMS-Laufzeit startet oder die Diagnosewerte sind derzeit nicht verfügbar.`})]}),w(`div`,{className:`eos-ems-overview-state`,children:[l(`span`,{className:`eos-ems-overview-state-dot`}),l(`strong`,{children:`Nicht verfügbar`}),l(`small`,{children:`read-only`})]})]}),w(`footer`,{className:`eos-ems-overview-footer`,children:[l(`span`,{children:`Diagnose ist rein lesend.`}),l(`span`,{children:`Keine EMS-Regelung wurde verändert.`})]})]}):w(`section`,{className:`eos-ems-overview-card`,"data-nexowatt-contract":`nexowatt-ems-overview-v1`,style:{"--eos-ems-status-color":ee},children:[w(`header`,{className:`eos-ems-overview-header`,children:[w(`div`,{children:[l(`span`,{className:`eos-ems-overview-eyebrow`,children:`NexoWatt EMS · Live-Diagnose`}),l(`h2`,{children:r?`EMS-Diagnose wird geladen …`:h?`EMS-Diagnose ist nicht aktuell`:Y(p.headline,`EMS arbeitet normal`)}),l(`p`,{children:h?`Adapter oder Diagnosewerte sind älter als 20 Sekunden. Die dargestellten Werte dürfen nicht als aktuelle Regelentscheidung verwendet werden.`:Y(p.reason,`EMS arbeitet innerhalb aller aktiven Grenzen.`)})]}),w(`div`,{className:`eos-ems-overview-state`,children:[l(`span`,{className:`eos-ems-overview-state-dot`}),l(`strong`,{children:h?`Offline / veraltet`:$e[_]}),w(`small`,{children:[(t==null?void 0:t.instance)||`eos-admin`,` · `,tt(t==null?void 0:t.updatedAt)]})]})]}),w(`div`,{className:`eos-ems-overview-metrics`,children:[w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`EMS-Budget`}),l(`strong`,{children:E>0?Z(E):`nicht begrenzt`}),w(`small`,{children:[`Rest `,Z(D)]})]}),w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`Lademanagement`}),w(`strong`,{children:[Z(y.actualW),` / `,Z(y.targetW)]}),w(`small`,{children:[J(y.activeCount),` lädt · `,J(y.waitingCount),` wartet`]})]}),b.available?w(`div`,{className:`eos-ems-overview-metric`,children:[w(`span`,{children:[`Speicher `,Y(b.topology,``)]}),w(`strong`,{children:[Z(b.actualW),` / `,Z(b.targetW)]}),l(`small`,{children:b.socPct==null?Y(b.reason,`aktiv`):`SoC ${Math.round(J(b.socPct))} %`})]}):w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`PV-Budget`}),l(`strong`,{children:Z(v.pvBudgetW)}),w(`small`,{children:[`PV-Rest `,Z(v.remainingPvW)]})]}),w(`div`,{className:`eos-ems-overview-metric`,children:[l(`span`,{children:`Letzter Regeltick`}),l(`strong`,{children:tt(x.lastTickTs||(t==null?void 0:t.updatedAt))}),l(`small`,{children:f?`Zyklus ${J(x.cycleMs)} ms`:Y(x.decision,`EMS aktiv`)})]})]}),E>0?l(`div`,{className:`eos-ems-overview-budget`,title:`${O.toFixed(1)} % Restbudget`,children:l(`span`,{style:{width:`${O}%`}})}):null,A.length?l(`div`,{className:`eos-ems-overview-tags`,children:A.map(e=>l(`span`,{className:e.warning?`is-warning`:``,children:e.label},e.label))}):null,w(`div`,{className:`eos-ems-overview-columns`,children:[w(`div`,{className:`eos-ems-overview-panel`,children:[l(`h3`,{children:`Aktuelle Regelentscheidungen`}),ne.length?ne.map((e,t)=>w(`div`,{className:`eos-ems-overview-decision eos-ems-overview-decision--${Q(e.severity)}`,children:[l(`strong`,{children:Y(e.title,`EMS-Entscheidung`)}),l(`span`,{children:Y(e.reason,`Keine zusätzliche Begrenzung`)}),f&&e.details?l(`small`,{children:e.details}):null]},`${e.subsystem||`ems`}-${t}`)):l(`div`,{className:`eos-ems-overview-empty`,children:`Keine aktiven Regelentscheidungen. EOS arbeitet mit den aktuellen Messwerten.`})]}),w(`div`,{className:`eos-ems-overview-panel`,children:[l(`h3`,{children:f?`Letzte EMS-Ereignisse`:`Systemerklärung`}),f?k.length?k.map((e,t)=>w(`div`,{className:`eos-ems-overview-event eos-ems-overview-event--${Q(e.severity)}`,children:[l(`time`,{children:nt(e.ts)}),w(`div`,{children:[l(`strong`,{children:Y(e.title,`EMS`)}),l(`span`,{children:Y(e.message||e.reason,`Zustand aktualisiert`)})]})]},e.id||`${e.ts}-${t}`)):l(`div`,{className:`eos-ems-overview-empty`,children:`Noch keine Zustandsänderung im begrenzten Ereignispuffer.`}):w(`div`,{className:`eos-ems-overview-decision eos-ems-overview-decision--info`,children:[l(`strong`,{children:Y(p.headline,`EMS aktiv`)}),l(`span`,{children:Y(p.reason,`EOS optimiert die Anlage innerhalb aller Sicherheitsgrenzen.`)})]})]})]}),l(`footer`,{className:`eos-ems-overview-footer`,children:l(`span`,{children:`Diagnose ist rein lesend. Keine Kachel besitzt Schreibhoheit.`})})]})}Ve(),o(),Ue();var $={button:{position:`absolute`,bottom:16,right:16},saveButton:e=>({backgroundColor:e.palette.success.main,right:80,"&:hover":{backgroundColor:e.palette.success.dark}}),addButton:e=>({backgroundColor:e.palette.secondary.main,right:144,"&:hover":{backgroundColor:e.palette.secondary.dark}}),closeButton:e=>({backgroundColor:e.palette.error.main,"&:hover":{backgroundColor:e.palette.error.dark}}),hostOffline:e=>({color:e.palette.error.main,fontWeight:500}),updateExists:{color:`#c28700`,marginRight:4},updateNo:{color:`#00b204`,marginRight:4},nodeUpdate:{opacity:.6},instanceNumber:{opacity:.6,fontWeight:500},hostStats:{display:`grid`,gridTemplateColumns:`auto minmax(0, 1fr)`,columnGap:`10px`,rowGap:`3px`,alignItems:`baseline`},hostStatLabel:e=>({color:e.palette.text.disabled,whiteSpace:`nowrap`}),hostStatValue:{overflow:`hidden`,textOverflow:`ellipsis`,whiteSpace:`nowrap`},hostInfoStats:{display:`grid`,gridTemplateColumns:`auto auto minmax(0, 1fr)`,columnGap:`12px`,rowGap:`6px`,alignItems:`center`},hostInfoIcon:e=>({display:`flex`,alignItems:`center`,color:e.palette.text.disabled,fontSize:18,"& svg":{fontSize:18}}),hostInfoValue:{overflowWrap:`anywhere`},diskValue:{display:`flex`,alignItems:`center`,gap:`8px`},diskBar:{flex:`1 1 auto`,minWidth:60,maxWidth:160,height:8,borderRadius:4},diskText:{whiteSpace:`nowrap`},updateIcon:{cursor:`pointer`,fontSize:16},tooltip:{pointerEvents:`none`},cards:{alignContent:`flex-start`,width:`100%`,pt:`12px`,px:`8px`,pb:`64px`}},ot={Uptime:H.formatSeconds,"System uptime":H.formatSeconds,RAM:H.formatRam,Speed:H.formatSpeed,"Disk size":H.formatBytes,"Disk free":H.formatBytes,timeOffset:e=>{let t=Math.abs(e),n=Math.floor(t/60),r=t%60;return`UTC${e>0?`-`:`+`}${n}${r?`:${r.toString().padStart(2,`0`)}`:``}`}};function st(e,t,n){let r=typeof t==`number`?t:new Date().getTimezoneOffset(),i=new Date(e-r*6e4);try{return i.toLocaleString(n===`zh-cn`?`zh-CN`:n,{timeZone:`UTC`})}catch{return i.toUTCString().replace(` GMT`,``)}}function ct(e){return e&&e[0].toUpperCase()+e.substring(1)}function lt(e){let t=e.toLowerCase();return t.includes(`darwin`)||t.includes(`osx`)||t.includes(`mac`)?l(u,{}):t.includes(`win`)?l(ae,{}):t.includes(`bsd`)?l(T,{}):t.includes(`linux`)||t.includes(`docker`)||t.includes(`android`)?l(S,{}):l(we,{})}function ut(t,n){switch(t){case`Platform`:case`os`:return lt(`${n.Platform||``} ${n.os||``}`);case`Architecture`:return l(Ee,{});case`CPUs`:case`Model`:return l(O,{});case`Speed`:return l(De,{});case`RAM`:return l(ze,{});case`System uptime`:return l(Oe,{});case`Uptime`:return l(ke,{});case`Node.js`:return l(s,{});case`NPM`:return l(p,{});case`time`:return l(Me,{});case`timeOffset`:return l(re,{});case`adapters count`:return l(Ae,{});case`Disk size`:case`Disk free`:return l(Ne,{});case`Active instances`:return l(Ce,{});case`location`:return l(Se,{});case`alive`:case`active`:return n[t]?l(Be,{color:`success`}):l(e,{color:`error`});default:return null}}var dt=new WeakMap,ft=new WeakMap,pt=new WeakMap,mt=class e extends ge.Component{constructor(t){super(t),We(this,dt,18e5),We(this,ft,3e5),We(this,pt,6e4),x(this,`introLinksOriginal`,void 0),x(this,`deactivatedOriginal`,void 0),x(this,`remoteAccess`,null),x(this,`t`,void 0),x(this,`getDataTimeout`,void 0),x(this,`updateHostsAlive`,async t=>{let n=JSON.parse(JSON.stringify(this.state.alive)),r=[];if(t.find(e=>e.type===`deleted`))this.getDataDelayed();else if(t.forEach(e=>{!!n[e.id]!=!!e.alive&&(n[e.id]=e.alive,r.push(e.id))}),r.length){let t=JSON.parse(JSON.stringify(this.state.hostsData)),i=new Map(this.state.hostDataTimestampMap),a=Date.now();(await Promise.all(r.map(e=>this.getHostData(e,n[e])))).forEach(n=>{t[n.id]=e.preprocessHostData(n.data),i.set(n.id,a)}),this.setState({alive:n,hostsData:t,hostDataTimestampMap:i},()=>this.checkBackendTime())}}),x(this,`updateHosts`,t=>{let n=[];if(t.find(e=>!e.obj))this.getDataDelayed();else if(n=t.map(e=>e.id),n.length){let t=JSON.parse(JSON.stringify(this.state.hostsData)),r=new Map(this.state.hostDataTimestampMap),i=Date.now();Promise.all(n.map(e=>this.getHostData(e))).then(n=>{n.forEach(n=>{t[n.id]=e.preprocessHostData(n.data),r.set(n.id,i)}),this.setState({hostsData:t,hostDataTimestampMap:r})})}}),x(this,`getDataDelayed`,e=>{this.getDataTimeout&&clearTimeout(this.getDataTimeout),this.getDataTimeout=setTimeout(()=>{this.getDataTimeout=void 0,this.getData(!0).catch(e=>console.error(`Cannot get data: ${e}`))},300)}),this.state={instances:null,deactivated:[],edit:!1,link:null,introLinks:[],editLink:!1,editLinkIndex:-1,openSnackBar:!1,hasUnsavedChanges:!1,reverseProxy:null,alive:{},hostsData:{},hosts:null,hostTimeDiffMap:new Map,hostDataTimestampMap:new Map,nodeUpdateSupported:!1,nodeUpdateDialog:null},this.t=t.t}checkBackendTime(){let e=this.state.hostTimeDiffMap,t=this.state.hostDataTimestampMap,n=Date.now();for(let[r,i]of Object.entries(this.state.hostsData)){let a=Math.abs(i.time-n);e.set(r,a),t.set(r,n)}this.setState({hostTimeDiffMap:e,hostDataTimestampMap:t})}async componentDidMount(){let e=window;e.NEXOWATT_EOS_ADMIN_SOCKET=this.props.socket,e.NEXOWATT_EOS_SOCKET=this.props.socket,window.dispatchEvent(new CustomEvent(`nexowatt-eos-admin-socket-ready`));let t=[],n=!1;try{var r;let[e,i]=await Promise.all([this.props.socket.getObject(`system.adapter.${this.props.adminInstance}`),this.props.socket.checkFeatureSupported(`CONTROLLER_OS_PACKAGE_UPGRADE`)]);t=(e==null||(r=e.native)==null?void 0:r.reverseProxy)||[],n=i}catch(e){if(String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase()===`admin`)throw e}await new Promise(e=>this.setState({reverseProxy:t,nodeUpdateSupported:n},()=>e())),await this.getData(),this.props.instancesWorker.registerHandler(this.getDataDelayed),this.props.hostsWorker.registerHandler(this.updateHosts),this.props.hostsWorker.registerAliveHandler(this.updateHostsAlive),this.checkBackendTime()}componentWillUnmount(){this.getDataTimeout&&=(clearTimeout(this.getDataTimeout),void 0),this.props.instancesWorker.unregisterHandler(this.getDataDelayed),this.props.hostsWorker.unregisterHandler(this.updateHosts),this.props.hostsWorker.unregisterAliveHandler(this.updateHostsAlive)}async activateEditMode(){var e;let t=await this.props.socket.getSystemConfig(!0),n=await this.getInstances(!0,null,t),r=t!=null&&(e=t.native)!=null&&e.introLinks?t.native.introLinks:[];this.introLinksOriginal=JSON.stringify(r),this.deactivatedOriginal=JSON.parse(JSON.stringify(n.deactivated)),this.setState({instances:n.instances,deactivated:n.deactivated,edit:!0,introLinks:r,hasUnsavedChanges:!1})}deactivateEditMode(){this.state.hasUnsavedChanges,this.setState({deactivated:this.deactivatedOriginal||null,introLinks:JSON.parse(this.introLinksOriginal||`[]`),hasUnsavedChanges:!1,edit:!1},()=>{this.deactivatedOriginal=void 0,this.introLinksOriginal=void 0})}toggleCard(e,t){if(!this.state.instances||!this.state.instances.length)return;let n=JSON.parse(JSON.stringify(this.state.deactivated)),r=n.indexOf(`${e}_${t}`);r===-1?(n.push(`${e}_${t}`),n.sort()):n.splice(r,1);let i=JSON.stringify(n)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(this.state.introLinks)!==this.introLinksOriginal;this.setState({deactivated:n,hasUnsavedChanges:i})}getInstancesCards(){return(this.state.instances||[]).map(e=>{var t;let n=`${e.id}_${e.linkName}`,r=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase(),i=r===`admin`||r===`service`;if(!i&&/^(?:admin|xterm)(?:\.|$)/i.test(e.id))return null;let a=i&&/^(?:admin|xterm)(?:\.|$)/i.test(e.id)||!((t=this.state.deactivated)!=null&&t.includes(n));if(a||this.state.edit){let t=``;if(e.link)try{t=new URL(e.link,window.location.href).host}catch{t=e.link.replace(/^https?:\/\//,``).split(`/`)[0]}if(e.id===this.props.adminInstance)return null;let n=window.isFinite(e.id.split(`.`).pop());if(n){var o;n=!!((o=this.state.instances)!=null&&o.find(t=>t.id!==e.id&&e.name===t.name&&e.id.split(`.`)[0]===t.id.split(`.`)[0]))}let r=this.state.hostsData?this.state.hostsData[e.id]:null,i;e.info&&(i=r&&typeof r==`object`?r.alive===!1?`offline`:`online`:`unknown`);let s=this.state.hostTimeDiffMap.get(e.id)??0,c=this.state.hostDataTimestampMap.get(e.id)??0,u=Date.now()-c<Ge(ft,this);return l(W,{image:e.image||``,title:w(E,{children:[e.name,n?w(`span`,{style:$.instanceNumber,children:[`.`,e.id.split(`.`).pop()]}):null]}),action:{link:e.link||``,text:t},t:this.props.t,lang:this.props.lang,color:e.color||``,showInfo:!!e.info,status:i,edit:this.state.edit,offline:!!r&&r.alive===!1,warning:s>Ge(dt,this)&&u?this.t(`Backend time differs by %s minutes`,Math.round(s/Ge(pt,this)).toString()):void 0,enabled:a,unreachable:!!e.unreachable,disabled:!r||typeof r!=`object`,getHostDescriptionAll:()=>this.getHostDescriptionAll(e.id),toggleActivation:()=>this.toggleCard(e.id,e.linkName||``),openSnackBarFunc:()=>this.setState({openSnackBar:!0}),theme:this.props.theme,children:e.description||this.getHostDescription(e.id)},`${e.id}_${e.link}`)}return null})}toggleLinkCard(e){let t=JSON.parse(JSON.stringify(this.state.introLinks));t[e].enabled=!t[e].enabled;let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==this.introLinksOriginal;this.setState({introLinks:t,hasUnsavedChanges:n})}getLinkCards(){return(this.state.introLinks||[]).map((e,t)=>!e.enabled&&!this.state.edit?null:e.camera===`custom`?l(Ye,{image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,socket:this.props.socket,color:e.color,edit:this.state.edit,interval:e.interval,camera:e.camera,addTs:e.addTs,onEdit:()=>{var e;return this.setState({editLink:!0,editLinkIndex:t,link:JSON.parse(JSON.stringify((e=this.state.introLinks)==null?void 0:e[t]))})},onRemove:()=>{let e=JSON.parse(JSON.stringify(this.state.introLinks));e.splice(t,1);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(e)!==this.introLinksOriginal;this.setState({introLinks:e,hasUnsavedChanges:n})},enabled:e.enabled,lang:this.props.lang,toggleActivation:()=>this.toggleLinkCard(t),cameraUrl:e.desc,theme:this.props.theme},`link${t}`):l(W,{image:e.image,title:e.name,action:{link:e.link,text:e.linkName},t:this.props.t,color:e.color,edit:this.state.edit,onEdit:()=>{var e;return this.setState({editLink:!0,editLinkIndex:t,link:JSON.parse(JSON.stringify((e=this.state.introLinks)==null?void 0:e[t]))})},onRemove:()=>{let e=JSON.parse(JSON.stringify(this.state.introLinks));e.splice(t,1);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(e)!==this.introLinksOriginal;this.setState({introLinks:e,hasUnsavedChanges:n})},enabled:e.enabled,lang:this.props.lang,toggleActivation:()=>this.toggleLinkCard(t),theme:this.props.theme,children:e.desc||``},`link${t}`))}editLinkCard(){return this.state.editLink?l(Xe,{link:this.state.link,socket:this.props.socket,isNew:this.state.editLinkIndex===-1,t:this.props.t,lang:this.props.lang,theme:this.props.theme,onClose:e=>{if(e){let t=JSON.parse(JSON.stringify(this.state.introLinks));this.state.editLinkIndex===-1?(e.enabled=!0,t.push(e)):(e.enabled=t[this.state.editLinkIndex].enabled,t[this.state.editLinkIndex]=e);let n=JSON.stringify(this.state.deactivated)!==JSON.stringify(this.deactivatedOriginal)||JSON.stringify(t)!==this.introLinksOriginal;this.setState({introLinks:t,editLink:!1,hasUnsavedChanges:n,link:null})}else this.setState({editLink:!1})}}):null}getButtons(){let e=[];return this.state.edit?(e.push(l(v,{color:`primary`,size:`small`,sx:A.getStyle(this.props.theme,$.button,$.addButton),onClick:()=>this.setState({editLink:!0,editLinkIndex:-1,link:{}}),children:l(i,{})},`add`)),e.push(l(v,{size:`small`,color:`primary`,disabled:!this.state.hasUnsavedChanges,sx:A.getStyle(this.props.theme,$.button,$.saveButton),onClick:()=>this.saveCards(),children:l(D,{})},`save`)),e.push(l(v,{size:`small`,color:`primary`,sx:A.getStyle(this.props.theme,$.button,$.closeButton),onClick:()=>this.deactivateEditMode(),children:l(f,{})},`close`))):e.push(l(v,{color:`primary`,size:`small`,style:$.button,onClick:()=>this.activateEditMode(),children:l(Te,{})},`edit`)),e}async saveCards(){let e=await this.props.socket.getSystemConfig(!0),t=!1;JSON.stringify(e.common.intro)!==JSON.stringify(this.state.deactivated)&&(e.common.intro=this.state.deactivated||void 0,t=!0),!t&&JSON.stringify(e.native.introLinks)!==JSON.stringify(this.state.introLinks)&&(t=!0,e.native.introLinks=this.state.introLinks),t?this.props.socket.setSystemConfig(e).then(()=>this.props.showAlert(`Updated`,`success`)).catch(e=>{console.log(e),this.props.showAlert(e,`error`)}).then(()=>this.setState({edit:!1})):this.setState({edit:!1})}async getHostData(e,t){let n;if(t!==void 0)n={val:t};else try{n=await this.props.socket.getState(`${e}.alive`)}catch(t){console.error(`Cannot get state ${e}.alive: ${t}`),n={val:!1}}let r={alive:!1};if(n!=null&&n.val)try{r=await this.props.socket.getHostInfo(e,!1,1e4),r&&typeof r==`object`&&r.alive!==!1&&(r.alive=!0)}catch(t){console.error(`Cannot get host info for ${e}: ${t}`),r={alive:!1}}else r={alive:!1};let i=await this.props.socket.getForeignStates(`${e}.versions.*`);return Object.keys(i).forEach(e=>r[`_${e.split(`.`).pop()}`]=i[e].val),{id:e,data:r}}async getHostsData(t){let n=t.map(e=>this.getHostData(e._id)),r=await Promise.all(n),i={},a={},o=new Map(this.state.hostDataTimestampMap),s=Date.now();return r.forEach(t=>{i[t.id]=e.preprocessHostData(t.data),a[t.id]=!!t.data.alive,o.set(t.id,s)}),this.setState({hostDataTimestampMap:o}),{hostsData:i,alive:a}}addLinks(e,t,n,r,i,a){let o={id:e.id,name:e.name,description:e.description,color:e.color,image:e.icon,info:``},s=Fe(e.link,t.name,n,{instances:r,hostname:this.props.hostname,adminInstance:this.props.adminInstance,hosts:i}),c=this.state.reverseProxy,l=null;if(c!=null&&c.length){let e=window.location.pathname;l=c.find(t=>{if(!t.globalPath)return!1;let n=t.globalPath.endsWith(`/`)?t.globalPath:`${t.globalPath}/`;return e===n||e.startsWith(n)})||null}if(s.length>1&&(s.sort((e,t)=>(e.instance||``).localeCompare(t.instance||``,void 0,{numeric:!0})),s.splice(1)),s.length){if(o.link=s[0].url,o.port=s[0].port,this.remoteAccess){let e=Re(o.link,o.port,this.remoteAccess);e===null?o.unreachable=!0:o.link=e}else o.link=Pe(o.link,o.id,r,l)||o.link;let i=He(e.link,t.name,n,this.props.adminInstance,window.location.href);i&&(o.link=i,o.port=void 0,o.unreachable=!1);let c=a.find(e=>e.link===o.link);c?Le(o.link,t.name,c.id.split(`.`)[0])?a[a.indexOf(c)]=o:console.log(`Double links: "${o.id}" and "${c.id}"`):a.push(o)}}static getText(e,t){return e?typeof e==`object`?e[t]||e.en||``:e||``:``}static normalizeLinks(t,n,r){if(!t.common.localLinks&&!t.common.localLink&&!t.common.welcomeScreen&&!t.common.welcomeScreenPro)return null;let i={id:t._id.replace(`system.adapter.`,``),link:``,name:e.getText(t.common.titleLang||t.common.title||t.common.name,n),order:t.common.order||1e3,intro:!0,description:e.getText(t.common.desc,n),icon:t.common.icon?`adapter/${t.common.name}/${t.common.icon}`:`img/no-image.svg`},a=[];if(t.common.localLink){if(typeof t.common.localLink==`string`)a.push({...i,link:t.common.localLink});else{let e=t.common.localLink;if(e.link){let t={...i,link:e.link};e.color&&(t.color=e.color),e.order!==void 0&&typeof e.order==`number`&&(t.order=e.order),e.icon&&e.img&&(t.icon=e.icon||e.img),a.push(t)}else console.warn(`Unknown localLink structure: ${JSON.stringify(t.common.localLink)}`)}}let o=t.common.localLinks;if(o&&typeof o==`object`&&Object.keys(o).forEach(r=>{let s=o[r];if(typeof s==`string`)a.push({...i,link:s});else{let o=s;if(o.link){let s={...i,id:t._id.replace(`system.adapter.`,``)+(r===`_default`?``:` ${r}`),link:o.link,name:i.name+(r===`_default`?``:` ${r}`)};o.color&&(s.color=o.color),o.order!==void 0&&(s.order=parseInt(o.order,10)||1e3),o.icon&&o.img&&(s.icon=o.icon||o.img),o.description&&(s.description=e.getText(o.description,n)),o.pro!==void 0&&(s.pro=typeof o.pro==`string`?o.pro:`${t.common.name}/index.html`),o.cloud!==void 0&&(s.cloud=o.cloud),o.intro!==void 0&&(s.intro=o.intro===!0),o.name&&(s.name=e.getText(o.name,n)),r===`_default`&&(s.default=!0),a.push(s)}else console.warn(`Unknown localLinks structure: ${JSON.stringify(s)}`)}}),t.common.welcomeScreen&&typeof t.common.welcomeScreen==`object`&&((Array.isArray(t.common.welcomeScreen)?t.common.welcomeScreen:[t.common.welcomeScreen]).forEach(r=>{if(r.link){let s={...i,id:`${t._id.replace(`system.adapter.`,``)} cloud`,link:`%web_protocol%://%web_bind%:%web_port%/${r.link}`,cloud:r.link};if(r.color&&(s.color=r.color),r.order!==void 0&&typeof r.order==`number`&&(s.order=r.order),r.icon&&r.img&&(s.icon=r.icon||r.img),r.localLinks){var o;let e=(o=t.common.localLinks)==null?void 0:o[r.localLinks];e&&typeof e==`string`?s.link=e:e&&typeof e==`object`&&e.link&&(s.link=e.link)}r.name&&(s.name=e.getText(r.name,n)),a.push(s)}}),t.common.welcomeScreenPro&&typeof t.common.welcomeScreenPro==`object`&&(Array.isArray(t.common.welcomeScreenPro)?t.common.welcomeScreenPro:[t.common.welcomeScreenPro]).forEach(r=>{if(r.link){let s={...i,id:`${t._id.replace(`system.adapter.`,``)} pro`,link:`%web_protocol%://%web_bind%:%web_port%/${r.link}`,pro:r.link};if(r.color&&(s.color=r.color),r.order!==void 0&&typeof r.order==`number`&&(s.order=r.order),r.icon&&r.img&&(s.icon=r.icon||r.img),r.localLinks){var o;let e=(o=t.common.localLinks)==null?void 0:o[r.localLinks];e&&typeof e==`string`?s.link=e:e&&typeof e==`object`&&e.link&&(s.link=e.link)}r.name&&(s.name=e.getText(r.name,n)),a.push(s)}})),a.forEach(e=>{e.icon.startsWith(`adapter/`)||e.icon.startsWith(`data:image/`)||e.icon.startsWith(`http://`)||e.icon.startsWith(`https://`)||e.icon===`img/no-image.svg`||(e.icon=`adapter/${t.common.name}/${e.icon}`)}),r){let e={};a.forEach(t=>{e[t.link]?(t.color&&(e[t.link].color=t.color),t.icon&&(e[t.link].icon=t.icon),t.cloud&&(e[t.link].cloud=t.cloud),t.pro&&(e[t.link].pro=t.pro),t.intro!==void 0&&(e[t.link].intro=t.intro),t.name&&typeof t.name==`object`&&(e[t.link].name=t.name),t.order!==void 0&&(e[t.link].order=t.order),t.default&&(e[t.link].default=t.default)):e[t.link]=t}),a=Object.values(e)}return a.sort((e,t)=>e.default===void 0&&t.default===void 0?e.order===void 0&&t.order===void 0?0:e.order===void 0?-1:t.order===void 0?1:e.order-t.order:e.default===void 0?-1:t.default===void 0?1:e.order===void 0&&t.order===void 0?0:e.order===void 0?-1:t.order===void 0?1:e.order-t.order),a}async getInstances(t,n,r){n=n||this.state.hosts||[];let i={};n.forEach(e=>i[e._id]=e);try{let a=await this.props.socket.getAdapterInstances(``,t),o=r.common.intro||[];Array.isArray(o)||(o=Object.keys(o),o.sort());let s=[],c={};a.forEach(e=>c[e._id]=e),this.remoteAccess=Ie(c,window.location),a.forEach(t=>{if(!t)return;let n=t.common||null,r=t._id.split(`.`),a=parseInt(r.pop()||``,10),o;if(n!=null&&n.name&&typeof n.name==`object`){let e=n==null?void 0:n.name;o=e[this.props.lang]||e.en}else o=(n==null?void 0:n.name)||``;if((o!==`admin`||n.localLink!==(this.props.hostname||``))&&o!==`web`&&!(o&&o!==`vis-web-admin`&&o.match(/^vis-/)&&o!==`vis-2`)&&!(o!=null&&o.match(/^icons-/))&&n&&(n.enabled||n.onlyWWW)){let r=e.normalizeLinks(t,this.props.lang,!0);r&&r.forEach(e=>this.addLinks(e,n,a,c,i,s))}}),s.forEach(e=>{e.link&&(e.linkName=e.link.replace(`https://`,``).replace(`http://`,``).replace(/^[^_]+:/,``))}),s.sort((e,t)=>{if(e.order!==void 0||t.order!==void 0){if(e.order=e.order===void 0?1e3:e.order,t.order=t.order===void 0?1e3:t.order,e.order<t.order)return-1;if(e.order>t.order)return 1}return e.id>t.id?1:e.id<t.id?-1:0}),n==null||n.forEach(e=>{let t=e==null?void 0:e.common,n=t==null?void 0:t.name;if(typeof n==`object`&&(n&&=n[this.props.lang]||n.en),t){let r={id:e._id,name:n||``,color:``,image:t.icon||`img/no-image.svg`,info:this.t(`Info`),linkName:``};s.push(r)}});let l=[];return o.forEach(e=>{s.find(t=>e===`${t.id}_${t.linkName}`)&&l.push(e)}),o=l,{instances:s,deactivated:o}}catch(e){return console.log(e),{instances:[],deactivated:[]}}}getHostDescription(e){let t=this.state.hostsData?this.state.hostsData[e]:null;if(t&&t.alive===!1)return l(j,{sx:$.hostOffline,children:this.props.t(`Offline`)});let n=``,r=``;if(t){try{t._nodeNewest&&t[`Node.js`]&&B.gt(t._nodeNewest,t[`Node.js`].replace(/^v/,``))&&(n=t._nodeNewest)}catch{}try{t._nodeNewest!==t._nodeNewestNext&&t._nodeNewestNext&&t[`Node.js`]&&t._nodeNewest&&B.gt(t._nodeNewestNext,t[`Node.js`].replace(/^v/,``))&&B.gt(t._nodeNewestNext,t._nodeNewest)&&(n+=(n?` / `:``)+t._nodeNewestNext)}catch{}if(n){let r=this.state.nodeUpdateSupported&&t.Platform===`linux`;n=l(R,{title:this.props.t(`Some updates available`),slotProps:{popper:{sx:$.tooltip}},children:w(`span`,{style:{...$.nodeUpdate,display:`inline-flex`},children:[`(`,n,`)`,r?l(ye,{style:$.updateIcon,onClick:()=>this.setState({nodeUpdateDialog:{hostId:e,version:t._nodeNewestNext}})}):null]})})}try{t._npmNewest&&t.NPM&&B.gt(t._npmNewest,t.NPM)&&(r=t._npmNewest)}catch{}try{t._npmNewest!==t._npmNewestNext&&t._npmNewestNext&&t.NPM&&t._npmNewest&&B.gt(t._npmNewestNext,t.NPM)&&B.gt(t._npmNewestNext,t._npmNewest)&&(r+=(r?` / `:``)+t._npmNewestNext)}catch{}r&&=l(R,{title:this.props.t(`Some updates available`),slotProps:{popper:{sx:$.tooltip}},children:w(`span`,{style:$.nodeUpdate,children:[`(`,r,`)`]})})}return t&&typeof t==`object`?w(j,{sx:$.hostStats,children:[l(j,{sx:$.hostStatLabel,children:this.t(`Platform`)}),l(j,{sx:$.hostStatValue,title:t.Platform||``,children:t.Platform||`--`}),l(j,{sx:$.hostStatLabel,children:this.t(`RAM`)}),l(j,{sx:$.hostStatValue,children:ot.RAM(t.RAM)}),l(j,{sx:$.hostStatLabel,children:this.t(`Node.js`)}),w(j,{sx:$.hostStatValue,children:[l(`span`,{style:n?$.updateExists:$.updateNo,children:t[`Node.js`]||`--`}),n]}),l(j,{sx:$.hostStatLabel,children:this.t(`NPM`)}),w(j,{sx:$.hostStatValue,children:[l(`span`,{style:r?$.updateExists:$.updateNo,children:t.NPM||`--`}),r]})]}):w(j,{sx:$.hostStats,children:[l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{}),l(I,{width:60}),l(I,{})]})}renderDiskRow(e){let t=e[`Disk size`],n=e[`Disk free`],r=t>0?Math.max(0,Math.min(100,n/t*100)):0,i=`${H.formatBytes(n)} / ${H.formatBytes(t)}`,a=r<10?`error`:r<25?`warning`:`success`;return{name:`Disk free`,text:i,value:w(j,{sx:$.diskValue,children:[l(R,{title:`${Math.round(r)}% ${this.t(`Free`)}`,slotProps:{popper:{sx:$.tooltip}},children:l(ie,{variant:`determinate`,value:r,color:a,sx:$.diskBar})}),l(j,{component:`span`,sx:$.diskText,children:i})]})}}renderHostInfoRow(e,t){let n=t[e];return e===`time`?{name:e,text:st(n,t.timeOffset,this.props.lang)}:typeof n==`boolean`?{name:e,text:n?this.t(`Yes`):this.t(`No`)}:ot[e]?{name:e,text:ot[e](n,this.t)||`--`}:typeof n==`object`?{name:e,text:JSON.stringify(n)}:{name:e,text:n.toString()||`--`}}getHostDescriptionAll(e){let t=this.state.hostsData&&typeof this.state.hostsData[e]==`object`?this.state.hostsData[e]:null,n=[];if(t){for(let e of Object.keys(t))if(!(e.startsWith(`_`)||t[e]===null||t[e]===void 0)){if(e===`Disk size`&&typeof t[`Disk free`]==`number`)n.push(this.renderDiskRow(t));else if(e===`Disk free`&&typeof t[`Disk size`]==`number`)continue;else n.push(this.renderHostInfoRow(e,t))}}return{el:l(j,{sx:$.hostInfoStats,children:n.map(e=>w(ge.Fragment,{children:[l(j,{sx:$.hostInfoIcon,children:ut(e.name,t||{})}),l(j,{sx:$.hostStatLabel,children:ct(this.t(e.name))}),l(j,{sx:$.hostInfoValue,children:e.value??e.text})]},e.name))}),text:n.map(e=>`${ct(this.t(e.name))}: ${e.text}`).join(`
|
|
2
|
+
`)}}async getData(e){try{let t=await this.props.socket.getSystemConfig(e),n=await this.props.socket.getCompactHosts(e),r=await this.getInstances(e,n,t);this.setState({instances:r.instances,hosts:n,deactivated:r.deactivated,introLinks:t&&t.native&&t.native.introLinks?t.native.introLinks:[]});let i=await this.getHostsData(n);await new Promise(e=>{this.setState(i,()=>e())})}catch(t){if(String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase()!==`admin`){try{let t=await this.getInstances(e,[],{common:{intro:[]},native:{introLinks:[]}});this.setState({instances:t.instances,hosts:[],deactivated:t.deactivated,introLinks:[],hostsData:{},alive:{}})}catch{this.setState({instances:[],hosts:[],deactivated:[],introLinks:[],hostsData:{},alive:{}})}return}window.alert(`Cannot get data: ${t}`)}}renderCopiedToast(){return l(se,{anchorOrigin:{vertical:`bottom`,horizontal:`left`},open:this.state.openSnackBar,autoHideDuration:3e3,onClose:()=>this.setState({openSnackBar:!1}),message:this.t(`copied`)})}getOverviewRoleConfig(){let e=String(window.NEXOWATT_EOS_ACCESS_ROLE||`unknown`).toLowerCase();return e===`installer`||e===`installateur`?{role:`installer`,label:`Installateur`,text:`Inbetriebnahme, Fehlersuche, Geräte- und EMS-Diagnose – mit deinen freigegebenen Installateurrechten.`,admin:!1}:e!==`admin`&&e!==`service`?{role:`enduser`,label:`Endkunde`,text:`Energie, Laden, Gebäude und die aktuellen EMS-Entscheidungen auf einen Blick.`,admin:!1}:{role:`admin`,label:`Admin / Service`,text:`Systemstatus, Module, Dienste und Anlagenzugänge in einer modernen Serviceübersicht.`,admin:!0}}render(){return this.state.instances?w(h,{elevation:0,overflow:`visible`,children:[this.renderCopiedToast(),w(`section`,{id:`eos-native-overview-hero`,className:`eos-overview-hero eos-native-overview-hero`,"data-eos-native-react-overview":`true`,children:[w(`div`,{children:[l(`span`,{className:`eos-overview-eyebrow`,children:`NexoWatt EOS`}),l(`h1`,{children:`Übersicht`}),l(`p`,{children:this.getOverviewRoleConfig().text})]}),w(`div`,{className:`eos-overview-role`,"data-nexowatt-overview-role":this.getOverviewRoleConfig().role,children:[l(`span`,{className:`eos-overview-status-dot`}),this.getOverviewRoleConfig().label]})]}),this.state.nodeUpdateDialog?l(Ze,{onClose:()=>this.setState({nodeUpdateDialog:null}),socket:this.props.socket,...this.state.nodeUpdateDialog}):null,w(k,{container:!0,className:`eos-native-intro-grid`,spacing:2,sx:$.cards,children:[this.getInstancesCards(),this.getLinkCards(),l(at,{socket:this.props.socket,t:this.props.t,lang:this.props.lang,theme:this.props.theme}),this.getOverviewRoleConfig().admin?l(`div`,{className:`eos-overview-edit-controls`,children:this.getButtons()}):null]}),this.getOverviewRoleConfig().admin?this.editLinkCard():null]}):l(ie,{})}static preprocessHostData(e){var t;if((t=e.dockerInformation)!=null&&t.isDocker){let t=e.dockerInformation.isOfficial?`official image`:`unofficial image`;e.dockerInformation.isOfficial&&(t+=` - ${e.dockerInformation.officialVersion}`),e.Platform=`${e.Platform} (${t})`}return delete e.dockerInformation,e}};export{mt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ds as e,Hs as t}from"./loadShare-eager-dmdYQhAl.js";var n=e(t(`path`,{d:`M16 1H4c-1.1 0-2 .9-2 2v14h2V3h12zm-1 4 6 6v10c0 1.1-.9 2-2 2H7.99C6.89 23 6 22.1 6 21l.01-14c0-1.1.89-2 1.99-2zm-1 7h5.5L14 6.5z`}),`FileCopy`),r=e(t(`path`,{d:`M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z`}),`KeyboardArrowRight`);export{n,r as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{$a as e,Ao as t,Bo as n,Es as r,Gr as i,Ha as a,Hs as o,Is as s,Ka as c,Ko as l,Ln as u,Lr as d,Mo as f,On as p,Po as m,Ps as h,Qi as ee,Rr as te,Ts as g,Ua as _,Us as v,Vs as y,Wa as b,Wr as x,Xo as S,Yn as C,ao as w,as as T,br as E,co as D,eo as ne,go as O,jo as k,kn as A,la as j,lo as re,mo as M,no as ie,oi as N,os as P,po as F,ps as I,qi as L,ro as R,tc as z,to as B,ua as V,yo as H,zr as U,zs as W}from"./loadShare-eager-dmdYQhAl.js";import{t as G}from"./
|
|
2
|
-
`)}\n`],{type:`text/plain;charset=utf-8`})),o=document.createElement(`a`);o.href=a,o.download=`iobroker-log-${this.state.currentHost.replace(`system.host.`,``)}-${new Date().toISOString().replace(/[:.]/g,`-`)}.txt`,document.body.appendChild(o);try{o.click()}finally{o.remove(),setTimeout(()=>window.URL.revokeObjectURL(a),1e3)}}async readLogFiles(){let e=await this.props.socket.getLogsFiles(this.state.currentHost);if(e!=null&&e.length){let t=[];return e.reverse(),e.forEach(e=>{let n=(e.fileName.split(`/`).pop()||``).replace(/iobroker\.?/,``).replace(`.log`,``);n[0]<=`9`&&t.push({path:e,name:n})}),e.sort(),e.forEach(e=>{let n=(e.fileName.split(`/`).pop()||``).replace(/iobroker\.?/,``).replace(`.log`,``);n[0]>`9`&&t.push({path:e,name:n})}),t}return[]}componentDidMount(){this.props.logsWorker.registerHandler(this.logHandler),this.props.clearErrors(),this.props.socket.getCompactAdapters().then(async e=>{let t=await this.props.socket.getCompactHosts(),n={};t.forEach(e=>n[e._id]=e),await new Promise(t=>{this.setState({adapters:e,hosts:n},()=>t())});let r=await this.readLogFiles();this.readLogs(!0,r)}),this.detectSearchInstance()}componentWillUnmount(){this.props.logsWorker.unregisterHandler(this.logHandler),this.props.clearErrors()}getSourceIcon(e){var t;let n=e.replace(/\.\d+$/,``),r=(t=this.state.adapters[n])==null?void 0:t.icon;if(r)r.startsWith(`data:image`)||(r=`./files/${n}.admin/${r}`);else if(this.state.hosts){var i;r=((i=this.state.hosts[`system.${e}`])==null||(i=i.common)==null?void 0:i.icon)||`img/no-image.svg`}return r||``}clearLog(){var e;(e=this.props.logsWorker)==null||e.clearLines(),this.props.clearErrors(),this.logsRequest++,this.searchUntil=0,this.setState({logs:[],logSize:null,logErrors:0,logWarnings:0,searchHours:0,searching:!1,searchError:``,searchTruncated:!1})}handleMessageChange(e){(window._localStorage||window.localStorage).setItem(`Log.message`,e.target.value),this.setState({message:e.target.value})}handleSourceChange(e){(window._localStorage||window.localStorage).setItem(`Log.source`,e),this.setState({source:e},()=>this.onFilterChanged())}getRequestedLogLevel(){let e=this.state.severity;return e===`silly`||e===`debug`?void 0:e}handleSeverityChange(e){(window._localStorage||window.localStorage).setItem(`Log.severity`,e.target.value),this.setState({severity:e.target.value},()=>this.state.searchHours?this.onFilterChanged():this.readLogs(!0))}handleLogDelete(){this.props.socket.delLogs(this.state.currentHost).then(()=>this.clearLog()).then(()=>this.readLogs(!0,void 0,()=>this.setState({logDeleteDialog:!1}))).catch(e=>{this.setState({logDeleteDialog:!1}),window.alert(e)})}handleLogPause(){var e;this.setState({pause:this.state.pause?0:((e=this.state.logs)==null?void 0:e.length)??0})}static openTab(e){var t;(t=window.open(e,`_blank`))==null||t.focus()}getLogFiles(){return this.state.logFiles.map(e=>v(P,{style:Z.downloadEntry,onClick:()=>{r.openTab(e.path.fileName),this.setState({logDownloadDialog:null})},children:[e.name,o(M,{style:Z.downloadLogSize,variant:`caption`,children:G.formatBytes(e.path.size)||`-`})]},e.name))}getSeverities(){let e=[];for(let t in this.severities)e.push(o(P,{value:t,style:Z[`${this.props.themeType}_${t}`],children:t},t));return e}getSources(){let e=Object.keys(this.state.sources).sort();return e.unshift(`1`),e.map(e=>v(P,{value:e,style:{backgroundColor:!this.state.colors||e===`1`?void 0:this.state.sources[e].color,display:`flex`,alignItems:`center`},children:[e===`1`?null:o(E,{src:this.state.sources[e].icon||``,style:Z.iconSelect}),e===`1`?this.t(`Source (show all)`):e]},e))}getOneRow(e,t,n){var r,i,a;let s=(r=this.state.logs)==null?void 0:r[e];if(!s)return;let c=s.severity,{message:l,id:u,hidden:d}=this.getRowView(s,n.sourceFilter,n.filterMessage);d||n.visible++;let f=n.previousKey===s.key?e:s.key??e;n.previousKey=s.key??0,t.push(v(w,{id:n.length===e?`endOfLog`:void 0,sx:x.getStyle(this.props.theme,Z.row,s.odd&&Z.rowOdd,d&&Z.hidden,this.lastRowRender&&s.ts>this.lastRowRender&&Z.updatedRow),style:this.state.colors?{backgroundColor:((i=this.state.sources[s.from])==null?void 0:i.color)||void 0}:{},hover:!0,children:[o(B,{style:{...Z.cell,...Z.cellName},children:v(`div`,{style:Z.iconAndName,children:[o(E,{src:((a=this.state.sources[s.from])==null?void 0:a.icon)||``,style:Z.icon}),o(`div`,{style:Z.name,children:s.from})]})}),this.state.pid&&o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},children:u}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},children:s.time}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`],fontWeight:`bold`},children:s.severity}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},title:typeof l==`object`?l.original:l,children:typeof l==`object`?l.parts.map((e,t)=>o(`span`,{style:e.style,children:e.text},t)):l})]},n.keyPrefix+f))}getRowView(e,t,n){let r=e.message||``,i=``;if(typeof r!=`object`){let t=RegExp(`${e.from.replace(`.`,`\\.`).replace(`)`,`\\)`).replace(`(`,`\\(`)} \\(\\d+\\) `,`g`),n=r.match(t);n?(r=r.replace(n[0],``),i=(n[0].split(` `)[1].match(/\d+/g)||[``])[0]):r=r.replace(`${e.from} `,``)}let a=t!==`1`&&t!==e.from||this.severities[e.severity]<this.severities[this.state.severity];return!a&&n&&(a=typeof r==`object`?!r.original.toLowerCase().includes(n):!r.toLowerCase().includes(n)),{message:r,id:i,hidden:a}}getRows(){var e;let t=[],n={filterMessage:this.state.message.toLowerCase(),sourceFilter:this.state.source,previousKey:0,keyPrefix:``,length:0,visible:0},r=Object.keys(this.state.sources).sort();if(r.unshift(`1`),r.includes(n.sourceFilter)||(n.sourceFilter=`1`),n.previousKey=0,n.keyPrefix=this.state.reverse?`r`:``,n.length=this.state.pause>0?this.state.pause-1:(((e=this.state.logs)==null?void 0:e.length)??0)-1,this.state.reverse)for(let e=0;e<=n.length;e++)this.getOneRow(e,t,n);else for(let e=n.length;e>=0;e--)this.getOneRow(e,t,n);return n.length>0&&this.scrollToEnd&&(setTimeout(()=>{let e=document.getElementById(`endOfLog`);e==null||e.scrollIntoView()},200),this.scrollToEnd=!1),(!this.lastRowRender||Date.now()-this.lastRowRender>1e3)&&(this.lastRowRenderTimeout||=setTimeout(()=>{this.lastRowRenderTimeout=null,this.lastRowRender=Date.now()},1e3)),this.visibleRows=n.visible,t}renderClearDialog(){return this.state.logDeleteDialog?v(t,{onClose:()=>this.setState({logDeleteDialog:!1}),open:!0,children:[v(m,{children:[this.t(`Please confirm`),o(l,{size:`large`,sx:Z.closeButton,onClick:()=>this.setState({logDeleteDialog:!1}),children:o(c,{})})]}),o(f,{dividers:!0,children:o(M,{gutterBottom:!0,children:this.t(`Log file will be deleted. Are you sure?`)})}),v(k,{children:[o(H,{variant:`contained`,autoFocus:!0,onClick:()=>this.handleLogDelete(),color:`primary`,startIcon:o(b,{}),children:this.t(`Ok`)}),o(H,{variant:`contained`,onClick:()=>this.setState({logDeleteDialog:!1}),color:`grey`,startIcon:o(c,{}),children:this.t(`Cancel`)})]})]}):null}changePid(){let e=!this.state.pid;(window._localStorage||window.localStorage).setItem(`Logs.pid`,e?`true`:`false`),this.setState({pid:e})}renderToolbar(){var e,t,n;let r=this.state.pause?o(M,{style:Z.pauseCount,children:(((e=this.state.logs)==null?void 0:e.length)??0)-this.state.pause}):o(u,{}),i=this.props.width===`xs`||this.props.width===`sm`,s=i?o(l,{color:`primary`,onClick:e=>this.setState({logDownloadDialog:e.currentTarget}),children:o(j,{})}):o(H,{variant:`contained`,color:`primary`,startIcon:o(j,{}),onClick:e=>this.setState({logDownloadDialog:e.currentTarget}),children:this.t(`Download log`)});return v(U,{children:[this.props.menuButtonSpace?o(O,{sx:{width:40,flexShrink:0}}):null,o(F,{title:this.props.t(`Refresh log`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.state.searchHours?void this.searchLogFiles():this.readLogs(!0),children:o(V,{})})}),o(F,{title:this.props.t(`Pause output`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,style:Z.pauseButton,onClick:()=>this.handleLogPause(),children:r})}),o(F,{title:this.props.t(`Clear log`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.clearLog(),children:o(a,{})})}),o(F,{title:this.props.t(`Clear on disk permanent`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.setState({logDeleteDialog:!0}),children:o(J,{})})}),o(F,{title:this.props.t(`Show/hide PID`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.changePid(),color:this.state.pid?`primary`:`default`,children:o(`div`,{style:Z.pidSize,children:this.props.t(`PID`)})})}),o(F,{title:this.props.t(`Show/hide colors`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Logs.colors`,this.state.colors?`false`:`true`),this.setState({colors:!this.state.colors})},color:this.state.colors?`primary`:`default`,children:o(L,{style:{width:`0.8em`,height:`0.8em`}})})}),o(F,{title:this.props.t(`Reverse output direction`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Log.reverse`,this.state.reverse?`false`:`true`),this.setState({reverse:!this.state.reverse}),setTimeout(()=>{let e=document.getElementById(`endOfLog`);e==null||e.scrollIntoView()},500)},color:this.state.reverse?`primary`:`default`,children:this.state.reverse?o(p,{}):o(A,{})})}),o(F,{title:this.props.t(`Show errors`),slotProps:{popper:{sx:Z.tooltip}},children:o(D,{badgeContent:this.state.logErrors,color:`error`,sx:{"& .MuiBadge-badge":{...Z.badge,...Z.badgeError}},children:o(l,{size:`large`,onClick:()=>{this.state.severity===`error`?this.setState({severity:`debug`},()=>this.onFilterChanged()):this.setState({severity:`error`,logErrors:0},()=>this.onFilterChanged())},color:this.state.severity===`error`?`primary`:`default`,children:o(_,{})})})}),o(F,{title:this.props.t(`Show errors and warnings`),slotProps:{popper:{sx:Z.tooltip}},children:o(D,{badgeContent:this.state.logWarnings,color:`default`,sx:{"& .MuiBadge-badge":{...Z.badge,...Z.badgeWarn}},children:o(l,{size:`large`,onClick:()=>{this.state.severity===`warn`?this.setState({severity:`debug`},()=>this.onFilterChanged()):this.setState({severity:`warn`,logWarnings:0},()=>this.onFilterChanged())},color:this.state.severity===`warn`?`primary`:`default`,children:o(N,{})})})}),o(F,{title:this.props.t(`Export the shown entries as a text file`),slotProps:{popper:{sx:Z.tooltip}},children:o(`span`,{children:o(l,{size:`large`,disabled:!((t=this.state.logs)!=null&&t.length),onClick:()=>this.exportLogs(),children:o(ae,{})})})}),o(`div`,{style:Z.grow}),(n=this.state.logFiles)!=null&&n.length?s:null,this.state.logDownloadDialog?o(T,{id:`simple-menu`,anchorEl:this.state.logDownloadDialog,keepMounted:!0,open:!!this.state.logDownloadDialog,onClose:()=>this.setState({logDownloadDialog:null}),children:this.getLogFiles()}):null,i?null:o(`div`,{style:Z.grow}),i?null:this.renderLogInfo(),o(O,{sx:{ml:`auto`,pl:1},children:this.props.hostSelector})]})}renderLogInfo(){return this.state.searchError?o(M,{variant:`body2`,sx:[Z.logSize,Z.searchError],title:this.state.searchError,children:this.t(`Search failed: %s`,this.state.searchError)}):this.state.searchHours?v(M,{variant:`body2`,style:Z.logSize,children:[this.t(`Hits: %s`,this.state.searching?`…`:this.visibleRows),this.state.searchTruncated&&!this.state.searching?o(F,{title:this.t(`Only the newest %s hits are shown`,Y),slotProps:{popper:{sx:Z.tooltip}},children:o(O,{component:N,sx:Z.searchTruncated})}):null]}):v(M,{variant:`body2`,title:this.state.estimatedSize?this.props.t(`Estimated size`):``,style:Z.logSize,children:[this.t(`Log size:`),` `,o(`span`,{style:this.state.estimatedSize?Z.logEstimated:void 0,children:this.state.logSize===null?`-`:G.formatBytes(this.state.logSize)})]})}renderTimeHeader(){return o(F,{title:this.t(`Search the log files in this time range`),placement:`top`,slotProps:{popper:{sx:Z.tooltip}},children:o(n,{variant:`standard`,style:Z.formControl,children:o(I,{variant:`standard`,value:this.state.searchHours,disabled:!this.isSearchPossible(),onChange:e=>this.handleSearchHoursChange(Number(e.target.value)),children:X.map(e=>o(P,{value:e,children:e?e===1?this.t(`1 hour`):e<72?this.t(`%s hours`,e):this.t(`%s days`,e/24):this.t(`Latest entries`)},e))})})})}renderTableHeader(){let e=Object.keys(this.state.sources).sort();return e.unshift(`1`),o(R,{children:v(w,{children:[o(B,{sx:Z.source,children:v(n,{variant:`standard`,sx:Z.formControl,children:[o(I,{variant:`standard`,labelId:`source-label`,value:e.includes(this.state.source)?this.state.source:`1`,onChange:e=>this.handleSourceChange(e.target.value),renderValue:e=>v(`div`,{style:{backgroundColor:!this.state.colors||e===`1`?void 0:this.state.sources[e].color,display:`flex`,alignItems:`center`},children:[e===`1`?null:o(E,{src:this.state.sources[e].icon||``,style:Z.iconSelect}),e===`1`?this.t(`Source`):e]}),children:this.getSources()}),(e.includes(this.state.source)?this.state.source:`1`)===`1`?null:o(l,{sx:{position:`absolute`,top:1,right:15,zIndex:1},size:`small`,onClick:()=>this.handleSourceChange(`1`),children:o(ee,{})})]})}),this.state.pid&&o(B,{sx:Z.pid,children:o(O,{component:`div`,sx:Z.header,children:this.t(`PID`)})}),o(B,{sx:Z.timestamp,children:this.renderTimeHeader()}),o(B,{sx:Z.severity,children:o(n,{variant:`standard`,style:Z.formControl,children:o(I,{variant:`standard`,labelId:`severity-label`,value:this.state.severity,onChange:e=>this.handleSeverityChange(e),renderValue:e=>o(`span`,{style:Z[`${this.props.themeType}_${e}`],children:e}),children:this.getSeverities()})})}),o(B,{sx:Z.message,children:o(n,{variant:`standard`,style:Z.formControl,children:o(re,{variant:`standard`,sx:Z.messageText,placeholder:this.t(`Message`),onChange:e=>this.handleMessageChange(e),onKeyDown:e=>{e.key===`Enter`&&this.searchLogFiles()},value:this.state.message,slotProps:{input:{endAdornment:v(y,{children:[this.state.message?o(l,{tabIndex:-1,size:`small`,onClick:()=>{(window._localStorage||window.localStorage).removeItem(`Log.message`),this.setState({message:``})},children:o(c,{})}):null,this.isSearchPossible()?o(F,{title:this.t(`Search in the log files (Enter)`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{tabIndex:-1,size:`small`,disabled:this.state.searching,onClick:()=>this.searchLogFiles(),children:o(C,{})})}):null]})}}})})})]})})}render(){if(!this.state.logs)return o(S,{});this.state.logFiles===null&&!this.readLogsInProcess&&(this.readLogsInProcess=!0,setTimeout(()=>this.readLogFiles().then(e=>{this.readLogsInProcess=!1,this.setState({logFiles:e})}),100)),this.props.currentHost!==this.state.currentHost&&(this.hostsTimer=this.hostsTimer||setTimeout(()=>{this.hostsTimer=null,this.setState({currentHost:this.props.currentHost,logs:[],logFiles:[]},()=>this.readLogs(!0))},200));let t=this.getRows();return v(d,{children:[this.renderToolbar(),v(te,{style:{position:`relative`},children:[this.state.searching?o(S,{sx:Z.searchProgress}):null,o(ie,{style:Z.container,children:v(e,{stickyHeader:!0,size:`small`,sx:Z.table,children:[this.renderTableHeader(),o(ne,{children:t})]})})]}),this.renderClearDialog()]})}},ue=i()(le);export{ue as default};
|
|
1
|
+
import{$a as e,Ao as t,Bo as n,Es as r,Gr as i,Ha as a,Hs as o,Is as s,Ka as c,Ko as l,Ln as u,Lr as d,Mo as f,On as p,Po as m,Ps as h,Qi as ee,Rr as te,Ts as g,Ua as _,Us as v,Vs as y,Wa as b,Wr as x,Xo as S,Yn as C,ao as w,as as T,br as E,co as D,eo as ne,go as O,jo as k,kn as A,la as j,lo as re,mo as M,no as ie,oi as N,os as P,po as F,ps as I,qi as L,ro as R,tc as z,to as B,ua as V,yo as H,zr as U,zs as W}from"./loadShare-eager-dmdYQhAl.js";import{t as G}from"./DeleteForever-CioJt3X3.js";import{t as K}from"./TextSnippet-C9R3EbZy.js";import{t as q}from"./AdminUtils-Dc1eHsx5.js";import{D as J,k as ae}from"./bootstrap-qkrk_CAn.js";r();var Y=3e3,oe=RegExp(`\x1B\\[\\d+m`,`g`),X=[0,1,6,24,72,168,720],se=24,ce=12e4,Z={container:{height:`100%`},table:{tableLayout:`fixed`,minWidth:960,"& td,th":{padding:`3px 4px`},"& td:nth-of-type(5)":{overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`},"& td:last-of-type":{overflowWrap:`anywhere`}},row:{"@media screen and (max-width: 450px)":{"& > *":{fontSize:`8px !important`}}},rowOdd:e=>({backgroundColor:e.palette.background.default}),cell:{verticalAlign:`top`},cellName:{lineHeight:`14px`},updatedRow:{animation:`updated 1s`},formControl:{width:`100%`,"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`},position:`relative`}},light_error:{color:W[800]},light_warn:{color:s[800]},light_debug:{color:h[800]},light_silly:{color:h[700]},dark_error:{color:W[200]},dark_warn:{color:s[200]},dark_debug:{color:`#b1b1b1`},dark_silly:{color:`#7e7e7e`},source:{width:200,"@media screen and (max-width: 450px)":{width:120}},pid:{width:55,"@media screen and (max-width: 450px)":{width:40}},timestamp:{width:175,"@media screen and (max-width: 450px)":{width:100}},severity:{width:80,"@media screen and (max-width: 450px)":{width:61}},message:{minWidth:300,"@media screen and (max-width: 450px)":{minWidth:150}},hidden:{display:`none`},grow:{flexGrow:1},logSize:{marginRight:`1rem`,marginLeft:`1rem`},logEstimated:{fontStyle:`italic`},closeButton:e=>({position:`absolute`,right:8,top:8,color:e.palette.grey[500]}),header:e=>({"& .MuiFormLabel-root.Mui-disabled":{color:e.palette.text.primary},"& .MuiInput-underline::before":{content:`""`,borderBottom:`none`},"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`}}}),pauseButton:{minWidth:48},pauseCount:{color:s[500]},downloadLogSize:{color:h[500],marginLeft:16},downloadEntry:{display:`flex`,justifyContent:`space-between`},pidSize:{fontSize:14,width:24,height:24,display:`flex`,alignItems:`center`},messageText:{"@media screen and (max-width: 450px)":{"& > *":{fontSize:`10px !important`}}},badge:{top:10,right:10},badgeError:{},badgeWarn:{backgroundColor:s[500]},emptyButton:{width:48},icon:{width:16,height:16},iconSelect:{width:24,height:25,marginRight:4},name:{verticalAlign:`top`,display:`inline-block`,marginTop:1,marginLeft:2,overflow:`hidden`,whiteSpace:`nowrap`,width:`100%`,textOverflow:`ellipsis`},iconAndName:{whiteSpace:`nowrap`,display:`flex`},tooltip:{pointerEvents:`none`},searchError:e=>({color:e.palette.error.main,overflow:`hidden`,whiteSpace:`nowrap`,textOverflow:`ellipsis`,maxWidth:400}),searchTruncated:e=>({color:e.palette.warning.main,width:16,height:16,verticalAlign:`text-bottom`,marginLeft:4}),searchProgress:{position:`absolute`,top:0,left:0,right:0,zIndex:3}},Q=[`#ffadad30`,`#ffd6a530`,`#fdffb630`,`#caffbf30`,`#9bf6ff30`,`#a0c4ff30`,`#bdb2ff30`,`#ffc6ff30`,`#fffffc30`],$=[`rgba(255,109,109,0.1)`,`rgba(253,173,84,0.1)`,`rgba(241,255,88,0.1)`,`rgba(115,253,81,0.1)`,`rgba(71,235,255,0.1)`,`rgba(74,145,255,0.1)`,`rgba(108,85,255,0.1)`,`rgba(250,77,250,0.1)`,`rgba(255,255,105,0.1)`],le=class r extends z{constructor(e){super(e),g(this,`severities`,void 0),g(this,`t`,void 0),g(this,`ignoreNextLogs`,!1),g(this,`lastRowRender`,0),g(this,`lastRowRenderTimeout`,null),g(this,`readLogsInProcess`,!1),g(this,`hostsTimer`,null),g(this,`scrollToEnd`,void 0),g(this,`logsRequest`,0),g(this,`searchUntil`,0),g(this,`visibleRows`,0),g(this,`logHandler`,(e,t)=>{if(this.ignoreNextLogs){this.ignoreNextLogs=!1;return}if(this.searchUntil&&(e=e.filter(e=>e.ts>this.searchUntil),!e.length))return;let n=(this.state.logs||[]).concat(e);n.length>Y&&n.splice(0,n.length-Y);let r=0,i=0,a=!1,o,s=Object.keys(this.state.sources).length,c=this.props.themeType===`dark`?$:Q;n.forEach(e=>{if(e.odd===void 0?(a=!a,e.odd=a):a=e.odd,!e.time){let t=new Date(e.ts);e.time=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,`0`)}-${t.getDate().toString().padStart(2,`0`)} ${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}.${t.getMilliseconds().toString().padStart(3,`0`)}`}if(e.severity===`error`?i++:e.severity===`warn`&&r++,e.from){var t,n;!this.state.sources[e.from]&&!(o!=null&&o[e.from])?(o||=JSON.parse(JSON.stringify(this.state.sources)),o[e.from]={active:!0,color:c[s%c.length],icon:this.getSourceIcon(e.from)},s++):!((t=this.state.sources[e.from])!=null&&t.active)&&!(o!=null&&(n=o[e.from])!=null&&n.active)&&(o||=JSON.parse(JSON.stringify(this.state.sources)),o[e.from].active=!0)}});let l={logs:n,logSize:(this.state.logSize??0)+t,estimatedSize:!0,logWarnings:r,logErrors:i};if(o&&(l.sources=o),this.state.reverse){let e=document.getElementById(`endOfLog`);this.scrollToEnd=!e||e.getBoundingClientRect().top<window.innerHeight}this.setState(l)}),this.state={source:(window._localStorage||window.localStorage).getItem(`Log.source`)||`1`,severity:(window._localStorage||window.localStorage).getItem(`Log.severity`)||`debug`,message:(window._localStorage||window.localStorage).getItem(`Log.message`)||``,reverse:(window._localStorage||window.localStorage).getItem(`Log.reverse`)===`true`,logDeleteDialog:!1,logDownloadDialog:null,logFiles:[],logs:null,logSize:null,logErrors:0,logWarnings:0,estimatedSize:!0,pause:0,pid:(window._localStorage||window.localStorage).getItem(`Logs.pid`)===`true`,colors:(window._localStorage||window.localStorage).getItem(`Logs.colors`)===`true`,adapters:{},sources:{},currentHost:this.props.currentHost,hosts:{},searchHours:0,searching:!1,searchError:``,searchTruncated:!1,searchInstance:``},this.scrollToEnd=this.state.reverse,this.severities={silly:0,debug:1,info:2,warn:3,error:4},this.t=e.t}prepareLogs(e){let t=0,n=0,r=!0,i=JSON.parse(JSON.stringify(this.state.sources));Object.values(i).forEach(e=>e.active=!1),e.forEach(e=>{if(r=!r,e.odd=r,!e.time){let t=new Date(e.ts);e.time=`${t.getFullYear()}-${(t.getMonth()+1).toString().padStart(2,`0`)}-${t.getDate().toString().padStart(2,`0`)} ${t.getHours().toString().padStart(2,`0`)}:${t.getMinutes().toString().padStart(2,`0`)}:${t.getSeconds().toString().padStart(2,`0`)}.${t.getMilliseconds().toString().padStart(3,`0`)}`}e.severity===`error`?n++:e.severity===`warn`&&t++,e.from&&(i[e.from]?i[e.from].active=!0:i[e.from]={active:!0,icon:this.getSourceIcon(e.from)})});let a=0,o=this.props.themeType===`dark`?$:Q;return Object.keys(i).sort().forEach(e=>{i[e].color=o[a%o.length],a++}),{logErrors:n,logWarnings:t,sources:i}}readLogs(e,t,n){let r=++this.logsRequest;this.searchUntil=0,(this.state.searchHours||this.state.searching||this.state.searchError)&&this.setState({searchHours:0,searching:!1,searchError:``,searchTruncated:!1}),this.props.logsWorker&&this.state.hosts?this.props.logsWorker.getLogs(e,this.getRequestedLogLevel()).then(e=>{if(!e)return;if(r!==this.logsRequest){t?this.setState({logFiles:t},()=>n&&n()):n&&n();return}let i=[...e.logs];this.scrollToEnd=this.state.reverse;let a={logs:i,logSize:e.logSize,estimatedSize:!1,...this.prepareLogs(i)};t&&(a.logFiles=t),this.setState(a,()=>n&&n())}):t&&this.setState({logFiles:t},()=>n&&n())}isSearchPossible(){return!!this.state.searchInstance}static getLastSearchHours(){let e=parseInt((window._localStorage||window.localStorage).getItem(`Log.searchHours`)||``,10);return e&&X.includes(e)?e:se}async detectSearchInstance(){try{this.setState({searchInstance:await this.props.socket.getCurrentInstance()})}catch(e){console.warn(`Cannot find out the admin instance: ${e}`)}}async searchLogFiles(e){if(!this.isSearchPossible())return;e||=this.state.searchHours||r.getLastSearchHours();let t=++this.logsRequest;this.setState({searchHours:e,searching:!0,searchError:``});let n=this.state.source!==`1`&&this.state.sources[this.state.source]?this.state.source:void 0;try{var i;let r=await ae(this.props.socket,this.state.searchInstance,`admin:searchLogs`,{host:this.state.currentHost,hours:e,level:this.state.severity,source:n,text:this.state.message||void 0,maxRows:Y},ce);if(t!==this.logsRequest)return;if(!r||typeof r!=`object`||!Array.isArray(r.lines))throw Error((typeof r==`string`?r:r==null?void 0:r.error)||`no answer`);let a=[],o=0;for(let e of r.lines){let t=J(e);t&&(o&&o<=t.ts&&(t.key=o+1),o=t.key||0,t.message=q.parseColorMessage(t.message),a.push(t))}let s=r.until||Date.now();(i=this.state.logs)==null||i.forEach(e=>e.ts>s&&a.push(e)),a.length>Y&&a.splice(0,a.length-Y),this.searchUntil=s,this.scrollToEnd=this.state.reverse,this.setState({logs:a,searching:!1,searchTruncated:!!r.truncated,pause:0,...this.prepareLogs(a)})}catch(e){t===this.logsRequest&&this.setState({searching:!1,searchError:e.message||String(e)})}}handleSearchHoursChange(e){e?((window._localStorage||window.localStorage).setItem(`Log.searchHours`,e.toString()),this.searchLogFiles(e)):this.readLogs(!0)}onFilterChanged(){this.state.searchHours&&this.searchLogFiles()}exportLogs(){let e=[],t=this.state.message.toLowerCase(),n=this.state.source!==`1`&&this.state.sources[this.state.source]?this.state.source:`1`,r=this.state.logs||[],i=this.state.pause>0?this.state.pause:r.length;for(let a=0;a<i;a++){let i=r[a];if(i&&!this.getRowView(i,n,t).hidden){let t=typeof i.message==`object`?i.message.original:i.message;e.push(`${i.time} - ${i.severity}: ${(t||``).replace(oe,``)}`)}}this.state.reverse||e.reverse();let a=window.URL.createObjectURL(new Blob([`${e.join(`
|
|
2
|
+
`)}\n`],{type:`text/plain;charset=utf-8`})),o=document.createElement(`a`);o.href=a,o.download=`iobroker-log-${this.state.currentHost.replace(`system.host.`,``)}-${new Date().toISOString().replace(/[:.]/g,`-`)}.txt`,document.body.appendChild(o);try{o.click()}finally{o.remove(),setTimeout(()=>window.URL.revokeObjectURL(a),1e3)}}async readLogFiles(){let e=await this.props.socket.getLogsFiles(this.state.currentHost);if(e!=null&&e.length){let t=[];return e.reverse(),e.forEach(e=>{let n=(e.fileName.split(`/`).pop()||``).replace(/iobroker\.?/,``).replace(`.log`,``);n[0]<=`9`&&t.push({path:e,name:n})}),e.sort(),e.forEach(e=>{let n=(e.fileName.split(`/`).pop()||``).replace(/iobroker\.?/,``).replace(`.log`,``);n[0]>`9`&&t.push({path:e,name:n})}),t}return[]}componentDidMount(){this.props.logsWorker.registerHandler(this.logHandler),this.props.clearErrors(),this.props.socket.getCompactAdapters().then(async e=>{let t=await this.props.socket.getCompactHosts(),n={};t.forEach(e=>n[e._id]=e),await new Promise(t=>{this.setState({adapters:e,hosts:n},()=>t())});let r=await this.readLogFiles();this.readLogs(!0,r)}),this.detectSearchInstance()}componentWillUnmount(){this.props.logsWorker.unregisterHandler(this.logHandler),this.props.clearErrors()}getSourceIcon(e){var t;let n=e.replace(/\.\d+$/,``),r=(t=this.state.adapters[n])==null?void 0:t.icon;if(r)r.startsWith(`data:image`)||(r=`./files/${n}.admin/${r}`);else if(this.state.hosts){var i;r=((i=this.state.hosts[`system.${e}`])==null||(i=i.common)==null?void 0:i.icon)||`img/no-image.svg`}return r||``}clearLog(){var e;(e=this.props.logsWorker)==null||e.clearLines(),this.props.clearErrors(),this.logsRequest++,this.searchUntil=0,this.setState({logs:[],logSize:null,logErrors:0,logWarnings:0,searchHours:0,searching:!1,searchError:``,searchTruncated:!1})}handleMessageChange(e){(window._localStorage||window.localStorage).setItem(`Log.message`,e.target.value),this.setState({message:e.target.value})}handleSourceChange(e){(window._localStorage||window.localStorage).setItem(`Log.source`,e),this.setState({source:e},()=>this.onFilterChanged())}getRequestedLogLevel(){let e=this.state.severity;return e===`silly`||e===`debug`?void 0:e}handleSeverityChange(e){(window._localStorage||window.localStorage).setItem(`Log.severity`,e.target.value),this.setState({severity:e.target.value},()=>this.state.searchHours?this.onFilterChanged():this.readLogs(!0))}handleLogDelete(){this.props.socket.delLogs(this.state.currentHost).then(()=>this.clearLog()).then(()=>this.readLogs(!0,void 0,()=>this.setState({logDeleteDialog:!1}))).catch(e=>{this.setState({logDeleteDialog:!1}),window.alert(e)})}handleLogPause(){var e;this.setState({pause:this.state.pause?0:((e=this.state.logs)==null?void 0:e.length)??0})}static openTab(e){var t;(t=window.open(e,`_blank`))==null||t.focus()}getLogFiles(){return this.state.logFiles.map(e=>v(P,{style:Z.downloadEntry,onClick:()=>{r.openTab(e.path.fileName),this.setState({logDownloadDialog:null})},children:[e.name,o(M,{style:Z.downloadLogSize,variant:`caption`,children:q.formatBytes(e.path.size)||`-`})]},e.name))}getSeverities(){let e=[];for(let t in this.severities)e.push(o(P,{value:t,style:Z[`${this.props.themeType}_${t}`],children:t},t));return e}getSources(){let e=Object.keys(this.state.sources).sort();return e.unshift(`1`),e.map(e=>v(P,{value:e,style:{backgroundColor:!this.state.colors||e===`1`?void 0:this.state.sources[e].color,display:`flex`,alignItems:`center`},children:[e===`1`?null:o(E,{src:this.state.sources[e].icon||``,style:Z.iconSelect}),e===`1`?this.t(`Source (show all)`):e]},e))}getOneRow(e,t,n){var r,i,a;let s=(r=this.state.logs)==null?void 0:r[e];if(!s)return;let c=s.severity,{message:l,id:u,hidden:d}=this.getRowView(s,n.sourceFilter,n.filterMessage);d||n.visible++;let f=n.previousKey===s.key?e:s.key??e;n.previousKey=s.key??0,t.push(v(w,{id:n.length===e?`endOfLog`:void 0,sx:x.getStyle(this.props.theme,Z.row,s.odd&&Z.rowOdd,d&&Z.hidden,this.lastRowRender&&s.ts>this.lastRowRender&&Z.updatedRow),style:this.state.colors?{backgroundColor:((i=this.state.sources[s.from])==null?void 0:i.color)||void 0}:{},hover:!0,children:[o(B,{style:{...Z.cell,...Z.cellName},children:v(`div`,{style:Z.iconAndName,children:[o(E,{src:((a=this.state.sources[s.from])==null?void 0:a.icon)||``,style:Z.icon}),o(`div`,{style:Z.name,children:s.from})]})}),this.state.pid&&o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},children:u}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},children:s.time}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`],fontWeight:`bold`},children:s.severity}),o(B,{style:{...Z.cell,...Z[`${this.props.themeType}_${c}`]},title:typeof l==`object`?l.original:l,children:typeof l==`object`?l.parts.map((e,t)=>o(`span`,{style:e.style,children:e.text},t)):l})]},n.keyPrefix+f))}getRowView(e,t,n){let r=e.message||``,i=``;if(typeof r!=`object`){let t=RegExp(`${e.from.replace(`.`,`\\.`).replace(`)`,`\\)`).replace(`(`,`\\(`)} \\(\\d+\\) `,`g`),n=r.match(t);n?(r=r.replace(n[0],``),i=(n[0].split(` `)[1].match(/\d+/g)||[``])[0]):r=r.replace(`${e.from} `,``)}let a=t!==`1`&&t!==e.from||this.severities[e.severity]<this.severities[this.state.severity];return!a&&n&&(a=typeof r==`object`?!r.original.toLowerCase().includes(n):!r.toLowerCase().includes(n)),{message:r,id:i,hidden:a}}getRows(){var e;let t=[],n={filterMessage:this.state.message.toLowerCase(),sourceFilter:this.state.source,previousKey:0,keyPrefix:``,length:0,visible:0},r=Object.keys(this.state.sources).sort();if(r.unshift(`1`),r.includes(n.sourceFilter)||(n.sourceFilter=`1`),n.previousKey=0,n.keyPrefix=this.state.reverse?`r`:``,n.length=this.state.pause>0?this.state.pause-1:(((e=this.state.logs)==null?void 0:e.length)??0)-1,this.state.reverse)for(let e=0;e<=n.length;e++)this.getOneRow(e,t,n);else for(let e=n.length;e>=0;e--)this.getOneRow(e,t,n);return n.length>0&&this.scrollToEnd&&(setTimeout(()=>{let e=document.getElementById(`endOfLog`);e==null||e.scrollIntoView()},200),this.scrollToEnd=!1),(!this.lastRowRender||Date.now()-this.lastRowRender>1e3)&&(this.lastRowRenderTimeout||=setTimeout(()=>{this.lastRowRenderTimeout=null,this.lastRowRender=Date.now()},1e3)),this.visibleRows=n.visible,t}renderClearDialog(){return this.state.logDeleteDialog?v(t,{onClose:()=>this.setState({logDeleteDialog:!1}),open:!0,children:[v(m,{children:[this.t(`Please confirm`),o(l,{size:`large`,sx:Z.closeButton,onClick:()=>this.setState({logDeleteDialog:!1}),children:o(c,{})})]}),o(f,{dividers:!0,children:o(M,{gutterBottom:!0,children:this.t(`Log file will be deleted. Are you sure?`)})}),v(k,{children:[o(H,{variant:`contained`,autoFocus:!0,onClick:()=>this.handleLogDelete(),color:`primary`,startIcon:o(b,{}),children:this.t(`Ok`)}),o(H,{variant:`contained`,onClick:()=>this.setState({logDeleteDialog:!1}),color:`grey`,startIcon:o(c,{}),children:this.t(`Cancel`)})]})]}):null}changePid(){let e=!this.state.pid;(window._localStorage||window.localStorage).setItem(`Logs.pid`,e?`true`:`false`),this.setState({pid:e})}renderToolbar(){var e,t,n;let r=this.state.pause?o(M,{style:Z.pauseCount,children:(((e=this.state.logs)==null?void 0:e.length)??0)-this.state.pause}):o(u,{}),i=this.props.width===`xs`||this.props.width===`sm`,s=i?o(l,{color:`primary`,onClick:e=>this.setState({logDownloadDialog:e.currentTarget}),children:o(j,{})}):o(H,{variant:`contained`,color:`primary`,startIcon:o(j,{}),onClick:e=>this.setState({logDownloadDialog:e.currentTarget}),children:this.t(`Download log`)});return v(U,{children:[this.props.menuButtonSpace?o(O,{sx:{width:40,flexShrink:0}}):null,o(F,{title:this.props.t(`Refresh log`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.state.searchHours?void this.searchLogFiles():this.readLogs(!0),children:o(V,{})})}),o(F,{title:this.props.t(`Pause output`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,style:Z.pauseButton,onClick:()=>this.handleLogPause(),children:r})}),o(F,{title:this.props.t(`Clear log`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.clearLog(),children:o(a,{})})}),o(F,{title:this.props.t(`Clear on disk permanent`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.setState({logDeleteDialog:!0}),children:o(G,{})})}),o(F,{title:this.props.t(`Show/hide PID`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>this.changePid(),color:this.state.pid?`primary`:`default`,children:o(`div`,{style:Z.pidSize,children:this.props.t(`PID`)})})}),o(F,{title:this.props.t(`Show/hide colors`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Logs.colors`,this.state.colors?`false`:`true`),this.setState({colors:!this.state.colors})},color:this.state.colors?`primary`:`default`,children:o(L,{style:{width:`0.8em`,height:`0.8em`}})})}),o(F,{title:this.props.t(`Reverse output direction`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{size:`large`,onClick:()=>{(window._localStorage||window.localStorage).setItem(`Log.reverse`,this.state.reverse?`false`:`true`),this.setState({reverse:!this.state.reverse}),setTimeout(()=>{let e=document.getElementById(`endOfLog`);e==null||e.scrollIntoView()},500)},color:this.state.reverse?`primary`:`default`,children:this.state.reverse?o(p,{}):o(A,{})})}),o(F,{title:this.props.t(`Show errors`),slotProps:{popper:{sx:Z.tooltip}},children:o(D,{badgeContent:this.state.logErrors,color:`error`,sx:{"& .MuiBadge-badge":{...Z.badge,...Z.badgeError}},children:o(l,{size:`large`,onClick:()=>{this.state.severity===`error`?this.setState({severity:`debug`},()=>this.onFilterChanged()):this.setState({severity:`error`,logErrors:0},()=>this.onFilterChanged())},color:this.state.severity===`error`?`primary`:`default`,children:o(_,{})})})}),o(F,{title:this.props.t(`Show errors and warnings`),slotProps:{popper:{sx:Z.tooltip}},children:o(D,{badgeContent:this.state.logWarnings,color:`default`,sx:{"& .MuiBadge-badge":{...Z.badge,...Z.badgeWarn}},children:o(l,{size:`large`,onClick:()=>{this.state.severity===`warn`?this.setState({severity:`debug`},()=>this.onFilterChanged()):this.setState({severity:`warn`,logWarnings:0},()=>this.onFilterChanged())},color:this.state.severity===`warn`?`primary`:`default`,children:o(N,{})})})}),o(F,{title:this.props.t(`Export the shown entries as a text file`),slotProps:{popper:{sx:Z.tooltip}},children:o(`span`,{children:o(l,{size:`large`,disabled:!((t=this.state.logs)!=null&&t.length),onClick:()=>this.exportLogs(),children:o(K,{})})})}),o(`div`,{style:Z.grow}),(n=this.state.logFiles)!=null&&n.length?s:null,this.state.logDownloadDialog?o(T,{id:`simple-menu`,anchorEl:this.state.logDownloadDialog,keepMounted:!0,open:!!this.state.logDownloadDialog,onClose:()=>this.setState({logDownloadDialog:null}),children:this.getLogFiles()}):null,i?null:o(`div`,{style:Z.grow}),i?null:this.renderLogInfo(),o(O,{sx:{ml:`auto`,pl:1},children:this.props.hostSelector})]})}renderLogInfo(){return this.state.searchError?o(M,{variant:`body2`,sx:[Z.logSize,Z.searchError],title:this.state.searchError,children:this.t(`Search failed: %s`,this.state.searchError)}):this.state.searchHours?v(M,{variant:`body2`,style:Z.logSize,children:[this.t(`Hits: %s`,this.state.searching?`…`:this.visibleRows),this.state.searchTruncated&&!this.state.searching?o(F,{title:this.t(`Only the newest %s hits are shown`,Y),slotProps:{popper:{sx:Z.tooltip}},children:o(O,{component:N,sx:Z.searchTruncated})}):null]}):v(M,{variant:`body2`,title:this.state.estimatedSize?this.props.t(`Estimated size`):``,style:Z.logSize,children:[this.t(`Log size:`),` `,o(`span`,{style:this.state.estimatedSize?Z.logEstimated:void 0,children:this.state.logSize===null?`-`:q.formatBytes(this.state.logSize)})]})}renderTimeHeader(){return o(F,{title:this.t(`Search the log files in this time range`),placement:`top`,slotProps:{popper:{sx:Z.tooltip}},children:o(n,{variant:`standard`,style:Z.formControl,children:o(I,{variant:`standard`,value:this.state.searchHours,disabled:!this.isSearchPossible(),onChange:e=>this.handleSearchHoursChange(Number(e.target.value)),children:X.map(e=>o(P,{value:e,children:e?e===1?this.t(`1 hour`):e<72?this.t(`%s hours`,e):this.t(`%s days`,e/24):this.t(`Latest entries`)},e))})})})}renderTableHeader(){let e=Object.keys(this.state.sources).sort();return e.unshift(`1`),o(R,{children:v(w,{children:[o(B,{sx:Z.source,children:v(n,{variant:`standard`,sx:Z.formControl,children:[o(I,{variant:`standard`,labelId:`source-label`,value:e.includes(this.state.source)?this.state.source:`1`,onChange:e=>this.handleSourceChange(e.target.value),renderValue:e=>v(`div`,{style:{backgroundColor:!this.state.colors||e===`1`?void 0:this.state.sources[e].color,display:`flex`,alignItems:`center`},children:[e===`1`?null:o(E,{src:this.state.sources[e].icon||``,style:Z.iconSelect}),e===`1`?this.t(`Source`):e]}),children:this.getSources()}),(e.includes(this.state.source)?this.state.source:`1`)===`1`?null:o(l,{sx:{position:`absolute`,top:1,right:15,zIndex:1},size:`small`,onClick:()=>this.handleSourceChange(`1`),children:o(ee,{})})]})}),this.state.pid&&o(B,{sx:Z.pid,children:o(O,{component:`div`,sx:Z.header,children:this.t(`PID`)})}),o(B,{sx:Z.timestamp,children:this.renderTimeHeader()}),o(B,{sx:Z.severity,children:o(n,{variant:`standard`,style:Z.formControl,children:o(I,{variant:`standard`,labelId:`severity-label`,value:this.state.severity,onChange:e=>this.handleSeverityChange(e),renderValue:e=>o(`span`,{style:Z[`${this.props.themeType}_${e}`],children:e}),children:this.getSeverities()})})}),o(B,{sx:Z.message,children:o(n,{variant:`standard`,style:Z.formControl,children:o(re,{variant:`standard`,sx:Z.messageText,placeholder:this.t(`Message`),onChange:e=>this.handleMessageChange(e),onKeyDown:e=>{e.key===`Enter`&&this.searchLogFiles()},value:this.state.message,slotProps:{input:{endAdornment:v(y,{children:[this.state.message?o(l,{tabIndex:-1,size:`small`,onClick:()=>{(window._localStorage||window.localStorage).removeItem(`Log.message`),this.setState({message:``})},children:o(c,{})}):null,this.isSearchPossible()?o(F,{title:this.t(`Search in the log files (Enter)`),slotProps:{popper:{sx:Z.tooltip}},children:o(l,{tabIndex:-1,size:`small`,disabled:this.state.searching,onClick:()=>this.searchLogFiles(),children:o(C,{})})}):null]})}}})})})]})})}render(){if(!this.state.logs)return o(S,{});this.state.logFiles===null&&!this.readLogsInProcess&&(this.readLogsInProcess=!0,setTimeout(()=>this.readLogFiles().then(e=>{this.readLogsInProcess=!1,this.setState({logFiles:e})}),100)),this.props.currentHost!==this.state.currentHost&&(this.hostsTimer=this.hostsTimer||setTimeout(()=>{this.hostsTimer=null,this.setState({currentHost:this.props.currentHost,logs:[],logFiles:[]},()=>this.readLogs(!0))},200));let t=this.getRows();return v(d,{children:[this.renderToolbar(),v(te,{style:{position:`relative`},children:[this.state.searching?o(S,{sx:Z.searchProgress}):null,o(ie,{style:Z.container,children:v(e,{stickyHeader:!0,size:`small`,sx:Z.table,children:[this.renderTableHeader(),o(ne,{children:t})]})})]}),this.renderClearDialog()]})}},ue=i()(le);export{ue as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ds as e,Hs as t}from"./loadShare-eager-dmdYQhAl.js";var n=e(t(`path`,{d:`M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2m-2 10h-4v4h-2v-4H7v-2h4V7h2v4h4z`}),`AddBox`),r=e(t(`path`,{d:`M8 11h8v2H8zm12.1 1H22c0-2.76-2.24-5-5-5h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1M19 12h-2v3h-3v2h3v3h2v-3h3v-2h-3z`}),`AddLink`),i=e(t(`path`,{d:`M7 14H5v5h5v-2H7zm-2-4h2V7h3V5H5zm12 7h-3v2h5v-5h-2zM14 5v2h3v3h2V5z`}),`Fullscreen`),a=e(t(`path`,{d:`M5 16h3v3h2v-5H5zm3-8H5v2h5V5H8zm6 11h2v-3h3v-2h-5zm2-11V5h-2v5h5V8z`}),`FullscreenExit`),o=e(t(`path`,{d:`M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z`}),`GetApp`),s=e(t(`path`,{d:`M15.41 16.59 10.83 12l4.58-4.59L14 6l-6 6 6 6z`}),`KeyboardArrowLeft`),c=e(t(`path`,{d:`M6 10c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m12 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m-6 0c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2`}),`MoreHoriz`);export{i as a,a as i,s as n,r as o,o as r,n as s,c as t};
|