@nice2dev/ui-iot 1.1.6 β 1.1.7
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/dist/index.cjs +1 -1
- package/dist/index.mjs +31 -17
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),U=[{type:"device-list",label:"Device List",icon:"π"},{type:"device-status",label:"Device Status",icon:"π’"},{type:"telemetry-chart",label:"Telemetry Chart",icon:"π"},{type:"gauge",label:"Gauge",icon:"β±οΈ"},{type:"map",label:"Device Map",icon:"πΊοΈ"},{type:"alarms",label:"Alarms",icon:"π¨"},{type:"control-panel",label:"Control Panel",icon:"ποΈ"},{type:"topology",label:"Network Topology",icon:"π"},{type:"kpi",label:"KPI Card",icon:"π―"},{type:"camera-feed",label:"Camera Feed",icon:"πΉ"}];function Z({devices:r=[],widgets:s=[],alarms:a=[],onDeviceSelect:i,onWidgetChange:c,onCommand:n,onAlarmAcknowledge:o,fetchTelemetry:d,className:b=""}){const[m,v]=f.useState(s),[x,u]=f.useState(null),[h,g]=f.useState("dashboard"),[N,k]=f.useState(!1),[j,T]=f.useState(""),y=f.useCallback(l=>{v(w=>{const C=l(w);return c==null||c(C),C})},[c]),_=f.useCallback(l=>{var C;const w={id:crypto.randomUUID(),type:l,title:((C=U.find(E=>E.type===l))==null?void 0:C.label)||l,position:{x:0,y:ee(m),width:4,height:3},config:{}};y(E=>[...E,w])},[m,y]),R=f.useCallback(l=>{u(l),i==null||i(l)},[i]),I=f.useCallback(l=>{o==null||o(l)},[o]),S=r.filter(l=>!j||l.name.toLowerCase().includes(j.toLowerCase())||l.type.toLowerCase().includes(j.toLowerCase())),P=a.filter(l=>!l.cleared),L=P.filter(l=>l.severity==="critical"||l.severity==="high");return e.jsxs("div",{className:`nice-iot-dashboard ${b}`,children:[e.jsxs("header",{className:"nice-iot-dashboard__header",children:[e.jsx("h1",{children:"IoT Dashboard"}),e.jsxs("div",{className:"nice-iot-dashboard__stats",children:[e.jsxs("span",{className:"nice-iot-dashboard__stat",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"π±"}),r.length," Devices"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--online",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"π’"}),r.filter(l=>l.status==="online").length," Online"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--offline",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"β«"}),r.filter(l=>l.status==="offline").length," Offline"]}),L.length>0&&e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"π¨"}),L.length," Alarms"]})]}),e.jsxs("nav",{className:"nice-iot-dashboard__nav",children:[e.jsx("button",{className:h==="dashboard"?"active":"",onClick:()=>g("dashboard"),children:"Dashboard"}),e.jsx("button",{className:h==="devices"?"active":"",onClick:()=>g("devices"),children:"Devices"}),e.jsxs("button",{className:h==="alarms"?"active":"",onClick:()=>g("alarms"),children:["Alarms ",P.length>0&&`(${P.length})`]})]}),e.jsx("div",{className:"nice-iot-dashboard__actions",children:h==="dashboard"&&e.jsx("button",{onClick:()=>k(!N),children:N?"β Done":"βοΈ Edit"})})]}),h==="dashboard"&&e.jsxs("div",{className:"nice-iot-dashboard__main",children:[N&&e.jsxs("aside",{className:"nice-iot-dashboard__palette",children:[e.jsx("h4",{children:"Add Widget"}),U.map(l=>e.jsxs("button",{className:"nice-iot-dashboard__palette-item",onClick:()=>_(l.type),children:[e.jsx("span",{children:l.icon}),e.jsx("span",{children:l.label})]},l.type))]}),e.jsxs("div",{className:"nice-iot-dashboard__grid",children:[m.map(l=>e.jsx(re,{widget:l,devices:r,alarms:a,isEditing:N,onCommand:n,onDelete:()=>y(w=>w.filter(C=>C.id!==l.id))},l.id)),m.length===0&&e.jsx("div",{className:"nice-iot-dashboard__empty",children:N?"Add widgets from the palette":"No widgets configured. Click Edit to add widgets."})]})]}),h==="devices"&&e.jsxs("div",{className:"nice-iot-dashboard__devices",children:[e.jsx("div",{className:"nice-iot-dashboard__devices-toolbar",children:e.jsx("input",{type:"search",placeholder:"Search devices...",value:j,onChange:l=>T(l.target.value)})}),e.jsx("div",{className:"nice-iot-dashboard__device-grid",children:S.map(l=>e.jsx(se,{device:l,isSelected:(x==null?void 0:x.id)===l.id,onSelect:()=>R(l)},l.id))}),x&&e.jsx(ie,{device:x,onCommand:n,onClose:()=>u(null)})]}),h==="alarms"&&e.jsx("div",{className:"nice-iot-dashboard__alarms",children:e.jsxs("table",{className:"nice-iot-dashboard__alarm-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Severity"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Message"}),e.jsx("th",{children:"Time"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:P.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"nice-iot-dashboard__no-alarms",children:"No active alarms"})}):P.map(l=>{const w=r.find(C=>C.id===l.deviceId);return e.jsxs("tr",{className:`nice-iot-dashboard__alarm-row nice-iot-dashboard__alarm-row--${l.severity}`,children:[e.jsx("td",{children:e.jsx("span",{className:`nice-iot-dashboard__severity nice-iot-dashboard__severity--${l.severity}`,children:l.severity})}),e.jsx("td",{children:(w==null?void 0:w.name)||l.deviceId}),e.jsx("td",{children:l.message}),e.jsx("td",{children:l.timestamp.toLocaleString()}),e.jsx("td",{children:l.acknowledged?"Acknowledged":"Active"}),e.jsx("td",{children:!l.acknowledged&&e.jsx("button",{onClick:()=>I(l.id),children:"Acknowledge"})})]},l.id)})})]})})]})}function ee(r){return r.length===0?0:Math.max(...r.map(s=>s.position.y+s.position.height))}function D(r){switch(r){case"online":return"var(--nice-success, #28a745)";case"offline":return"var(--nice-text-secondary, #6c757d)";case"warning":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"maintenance":return"var(--nice-info, #17a2b8)";default:return"var(--nice-text-secondary, #6c757d)"}}function re({widget:r,devices:s,alarms:a,isEditing:i,onCommand:c,onDelete:n}){const o=U.find(d=>d.type===r.type);return e.jsxs("div",{className:`nice-iot-dashboard__widget nice-iot-dashboard__widget--${r.type}`,style:{gridColumn:`span ${r.position.width}`,gridRow:`span ${r.position.height}`},children:[e.jsxs("div",{className:"nice-iot-dashboard__widget-header",children:[e.jsx("span",{className:"nice-iot-dashboard__widget-icon",children:o==null?void 0:o.icon}),e.jsx("span",{className:"nice-iot-dashboard__widget-title",children:r.title}),i&&e.jsx("button",{className:"nice-iot-dashboard__widget-delete",onClick:n,children:"Γ"})]}),e.jsx("div",{className:"nice-iot-dashboard__widget-content",children:e.jsx(ae,{widget:r,devices:s,alarms:a,onCommand:c})})]})}function ae({widget:r,devices:s,alarms:a,onCommand:i}){switch(r.type){case"device-list":return e.jsx("div",{className:"nice-iot-dashboard__device-list",children:s.slice(0,10).map(c=>e.jsxs("div",{className:"nice-iot-dashboard__device-list-item",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:D(c.status)}}),e.jsx("span",{children:c.name}),e.jsx("span",{className:"nice-iot-dashboard__device-type",children:c.type})]},c.id))});case"device-status":return e.jsx("div",{className:"nice-iot-dashboard__status-grid",children:["online","offline","warning","error"].map(c=>{const n=s.filter(o=>o.status===c).length;return e.jsxs("div",{className:"nice-iot-dashboard__status-card",children:[e.jsx("span",{className:"nice-iot-dashboard__status-indicator",style:{background:D(c)}}),e.jsx("span",{className:"nice-iot-dashboard__status-count",children:n}),e.jsx("span",{className:"nice-iot-dashboard__status-label",children:c})]},c)})});case"telemetry-chart":return e.jsxs("div",{className:"nice-iot-dashboard__chart-placeholder",children:[e.jsx("span",{children:"π"}),e.jsx("span",{children:"Telemetry Chart"}),e.jsx("small",{children:"Configure device and capability"})]});case"gauge":return e.jsx("div",{className:"nice-iot-dashboard__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #0066cc)",strokeWidth:"8",strokeDasharray:"63 126"}),e.jsx("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"14",fontWeight:"bold",children:"50%"})]})});case"map":return e.jsxs("div",{className:"nice-iot-dashboard__map-placeholder",children:[e.jsx("span",{children:"πΊοΈ"}),e.jsx("span",{children:"Device Map"}),e.jsxs("small",{children:[s.filter(c=>c.location).length," devices with location"]})]});case"alarms":{const c=a.filter(n=>!n.cleared).slice(0,5);return e.jsx("div",{className:"nice-iot-dashboard__alarm-list",children:c.length===0?e.jsx("div",{className:"nice-iot-dashboard__alarm-empty",children:"No active alarms"}):c.map(n=>e.jsxs("div",{className:`nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${n.severity}`,children:[e.jsx("span",{className:"nice-iot-dashboard__alarm-severity",children:n.severity}),e.jsx("span",{className:"nice-iot-dashboard__alarm-message",children:n.message})]},n.id))})}case"control-panel":return e.jsxs("div",{className:"nice-iot-dashboard__control-placeholder",children:[e.jsx("span",{children:"ποΈ"}),e.jsx("span",{children:"Control Panel"}),e.jsx("small",{children:"Configure device controls"})]});case"kpi":return e.jsxs("div",{className:"nice-iot-dashboard__kpi",children:[e.jsx("div",{className:"nice-iot-dashboard__kpi-value",children:s.length}),e.jsx("div",{className:"nice-iot-dashboard__kpi-label",children:"Total Devices"})]});default:return e.jsx("div",{className:"nice-iot-dashboard__widget-placeholder",children:r.type})}}function se({device:r,isSelected:s,onSelect:a}){return e.jsxs("div",{className:`nice-iot-dashboard__device-card ${s?"nice-iot-dashboard__device-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-iot-dashboard__device-card-header",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:D(r.status)}}),e.jsx("span",{className:"nice-iot-dashboard__device-name",children:r.name})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-card-body",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-info",children:[e.jsxs("span",{children:["Type: ",r.type]}),e.jsxs("span",{children:["Protocol: ",r.protocol]})]}),r.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__device-lastseen",children:["Last seen: ",r.lastSeen.toLocaleString()]}),e.jsxs("div",{className:"nice-iot-dashboard__device-capabilities",children:[r.capabilities.slice(0,3).map(i=>e.jsx("span",{className:"nice-iot-dashboard__capability-badge",children:i.name},i.id)),r.capabilities.length>3&&e.jsxs("span",{className:"nice-iot-dashboard__capability-more",children:["+",r.capabilities.length-3]})]})]})]})}function ie({device:r,onCommand:s,onClose:a}){return e.jsxs("aside",{className:"nice-iot-dashboard__device-detail",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-detail-header",children:[e.jsx("h3",{children:r.name}),e.jsx("button",{onClick:a,children:"Γ"})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-iot-dashboard__status-badge",style:{background:D(r.status)},children:r.status})]}),r.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Last Seen:"}),e.jsx("span",{children:r.lastSeen.toLocaleString()})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connection"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Protocol:"}),e.jsx("span",{children:r.protocol})]}),r.connectionInfo.host&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Host:"}),e.jsxs("span",{children:[r.connectionInfo.host,":",r.connectionInfo.port]})]})]}),r.metadata&&e.jsxs("section",{children:[e.jsx("h4",{children:"Metadata"}),r.metadata.manufacturer&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Manufacturer:"}),e.jsx("span",{children:r.metadata.manufacturer})]}),r.metadata.model&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Model:"}),e.jsx("span",{children:r.metadata.model})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Capabilities"}),e.jsx("div",{className:"nice-iot-dashboard__capabilities-list",children:r.capabilities.map(i=>e.jsxs("div",{className:"nice-iot-dashboard__capability-item",children:[e.jsx("span",{className:"nice-iot-dashboard__capability-name",children:i.name}),e.jsx("span",{className:"nice-iot-dashboard__capability-type",children:i.type}),i.writable&&s&&e.jsx("button",{className:"nice-iot-dashboard__capability-control",onClick:()=>s(r.id,i.id,!0),children:"Control"})]},i.id))})]})]})]})}const ce=[{name:"MQTT Broker",image:"eclipse-mosquitto:latest"},{name:"Node-RED",image:"nodered/node-red:latest"},{name:"InfluxDB",image:"influxdb:latest"},{name:"Grafana",image:"grafana/grafana:latest"},{name:"Telegraf",image:"telegraf:latest"},{name:"Protocol Adapter",image:"nice2dev/protocol-adapter:latest"}];function ne({nodes:r=[],modules:s=[],onNodeSelect:a,onModuleDeploy:i,onModuleAction:c,onNodeSync:n,className:o=""}){const[d,b]=f.useState(null),[m,v]=f.useState("nodes"),[x,u]=f.useState(!1),[h,g]=f.useState({name:"",image:"",status:"pending"}),N=f.useCallback(y=>{b(y),a==null||a(y)},[a]),k=f.useCallback(async()=>{!d||!h.name||!h.image||(await(i==null?void 0:i(d.id,h)),u(!1),g({name:"",image:"",status:"pending"}))},[d,h,i]),j=f.useCallback(async(y,_)=>{d&&await(c==null?void 0:c(d.id,y,_))},[d,c]),T=f.useCallback(async()=>{d&&await(n==null?void 0:n(d.id))},[d,n]);return e.jsxs("div",{className:`nice-edge-manager ${o}`,children:[e.jsxs("header",{className:"nice-edge-manager__header",children:[e.jsx("h1",{children:"Edge Manager"}),e.jsxs("nav",{className:"nice-edge-manager__nav",children:[e.jsxs("button",{className:m==="nodes"?"active":"",onClick:()=>v("nodes"),children:["Nodes (",r.length,")"]}),e.jsx("button",{className:m==="modules"?"active":"",onClick:()=>v("modules"),children:"Modules"})]})]}),e.jsxs("div",{className:"nice-edge-manager__main",children:[m==="nodes"&&e.jsx("div",{className:"nice-edge-manager__nodes",children:e.jsxs("div",{className:"nice-edge-manager__node-grid",children:[r.map(y=>e.jsx(te,{node:y,isSelected:(d==null?void 0:d.id)===y.id,onSelect:()=>N(y)},y.id)),r.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No edge nodes configured"})]})}),m==="modules"&&d&&e.jsxs("div",{className:"nice-edge-manager__modules",children:[e.jsxs("div",{className:"nice-edge-manager__modules-header",children:[e.jsxs("h3",{children:["Modules on ",d.name]}),e.jsx("button",{className:"nice-edge-manager__deploy-btn",onClick:()=>u(!0),children:"+ Deploy Module"})]}),e.jsxs("div",{className:"nice-edge-manager__module-grid",children:[d.deployedModules.map(y=>e.jsx(de,{module:y,onAction:_=>j(y.id,_)},y.id)),d.deployedModules.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No modules deployed on this node"})]})]}),m==="modules"&&!d&&e.jsx("div",{className:"nice-edge-manager__no-selection",children:"Select a node from the Nodes tab to manage modules"}),d&&e.jsx(le,{node:d,onSync:T,onClose:()=>b(null)})]}),x&&e.jsx(fe,{config:h,templates:ce,onChange:g,onDeploy:k,onClose:()=>u(!1)})]})}function W(r){switch(r){case"running":return"var(--nice-success, #28a745)";case"stopped":return"var(--nice-text-secondary, #6c757d)";case"updating":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"unreachable":return"var(--nice-text-secondary, #868e96)";default:return"var(--nice-text-secondary, #6c757d)"}}function $(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:r<1024*1024*1024?`${(r/1024/1024).toFixed(1)} MB`:`${(r/1024/1024/1024).toFixed(2)} GB`}function oe(r){const s=Math.floor(r/86400),a=Math.floor(r%86400/3600),i=Math.floor(r%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function te({node:r,isSelected:s,onSelect:a}){return e.jsxs("div",{className:`nice-edge-manager__node-card ${s?"nice-edge-manager__node-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-edge-manager__node-header",children:[e.jsx("span",{className:"nice-edge-manager__node-status",style:{background:W(r.status)}}),e.jsx("span",{className:"nice-edge-manager__node-name",children:r.name}),e.jsx("span",{className:"nice-edge-manager__node-type",children:r.type})]}),e.jsxs("div",{className:"nice-edge-manager__node-body",children:[e.jsxs("div",{className:"nice-edge-manager__node-info",children:[e.jsxs("span",{children:["π₯οΈ ",r.hardware.cpu]}),e.jsxs("span",{children:["πΎ ",(r.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsx("div",{className:"nice-edge-manager__node-metrics",children:r.metrics&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${r.metrics.cpuUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[r.metrics.cpuUsage.toFixed(0),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"MEM"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${r.metrics.memoryUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[r.metrics.memoryUsage.toFixed(0),"%"]})]})]})}),e.jsxs("div",{className:"nice-edge-manager__node-modules",children:[r.deployedModules.length," modules deployed"]})]})]})}function de({module:r,onAction:s}){const a={running:"var(--nice-success, #28a745)",stopped:"var(--nice-text-secondary, #6c757d)",error:"var(--nice-danger, #dc3545)",pending:"var(--nice-warning, #ffc107)"};return e.jsxs("div",{className:"nice-edge-manager__module-card",children:[e.jsxs("div",{className:"nice-edge-manager__module-header",children:[e.jsx("span",{className:"nice-edge-manager__module-status",style:{background:a[r.status]||"var(--nice-text-secondary, #6c757d)"}}),e.jsx("span",{className:"nice-edge-manager__module-name",children:r.name}),e.jsxs("span",{className:"nice-edge-manager__module-version",children:["v",r.version]})]}),e.jsxs("div",{className:"nice-edge-manager__module-body",children:[e.jsx("div",{className:"nice-edge-manager__module-image",children:r.image}),r.resources&&e.jsxs("div",{className:"nice-edge-manager__module-resources",children:[r.resources.cpuLimit&&e.jsxs("span",{children:["CPU: ",r.resources.cpuLimit]}),r.resources.memoryLimitMB&&e.jsxs("span",{children:["RAM: ",r.resources.memoryLimitMB," MB"]})]}),r.ports&&r.ports.length>0&&e.jsxs("div",{className:"nice-edge-manager__module-ports",children:["Ports: ",r.ports.map(i=>`${i.host}:${i.container}`).join(", ")]})]}),e.jsxs("div",{className:"nice-edge-manager__module-actions",children:[r.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>s("stop"),children:"Stop"}),e.jsx("button",{onClick:()=>s("restart"),children:"Restart"})]}),r.status==="stopped"&&e.jsx("button",{onClick:()=>s("start"),children:"Start"}),e.jsx("button",{className:"nice-edge-manager__module-remove",onClick:()=>s("remove"),children:"Remove"})]})]})}function le({node:r,onSync:s,onClose:a}){return e.jsxs("aside",{className:"nice-edge-manager__detail",children:[e.jsxs("div",{className:"nice-edge-manager__detail-header",children:[e.jsx("h3",{children:r.name}),e.jsxs("div",{className:"nice-edge-manager__detail-actions",children:[e.jsx("button",{onClick:s,children:"π Sync"}),e.jsx("button",{onClick:a,children:"Γ"})]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-edge-manager__status-badge",style:{background:W(r.status)},children:r.status})]}),r.metrics&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Uptime:"}),e.jsx("span",{children:oe(r.metrics.uptime)})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Hardware"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"CPU:"}),e.jsxs("span",{children:[r.hardware.cpu," (",r.hardware.cores," cores)"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Memory:"}),e.jsxs("span",{children:[(r.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Storage:"}),e.jsxs("span",{children:[(r.hardware.storageMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Architecture:"}),e.jsx("span",{children:r.hardware.architecture})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Software"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"OS:"}),e.jsxs("span",{children:[r.software.os," ",r.software.osVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Runtime:"}),e.jsxs("span",{children:[r.software.runtime," ",r.software.runtimeVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Agent:"}),e.jsxs("span",{children:[r.software.agent," v",r.software.agentVersion]})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connectivity"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Cloud:"}),e.jsx("span",{children:r.connectivity.cloudConnected?"β Connected":"β Disconnected"})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Network:"}),e.jsx("span",{children:r.connectivity.localNetwork})]}),r.connectivity.publicIP&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Public IP:"}),e.jsx("span",{children:r.connectivity.publicIP})]}),r.connectivity.lastSync&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Last Sync:"}),e.jsx("span",{children:r.connectivity.lastSync.toLocaleString()})]})]}),r.metrics&&e.jsxs("section",{children:[e.jsx("h4",{children:"Resource Usage"}),e.jsxs("div",{className:"nice-edge-manager__resource-chart",children:[e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.cpuUsage}%`}})}),e.jsxs("span",{children:[r.metrics.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Memory"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.memoryUsage}%`}})}),e.jsxs("span",{children:[r.metrics.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Disk"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.diskUsage}%`}})}),e.jsxs("span",{children:[r.metrics.diskUsage.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"nice-edge-manager__network-stats",children:[e.jsxs("span",{children:["β ",$(r.metrics.networkIn)]}),e.jsxs("span",{children:["β ",$(r.metrics.networkOut)]})]})]})]})]})}function fe({config:r,templates:s,onChange:a,onDeploy:i,onClose:c}){return e.jsx("div",{className:"nice-edge-manager__dialog-overlay",children:e.jsxs("div",{className:"nice-edge-manager__dialog",children:[e.jsxs("div",{className:"nice-edge-manager__dialog-header",children:[e.jsx("h3",{children:"Deploy Module"}),e.jsx("button",{onClick:c,children:"Γ"})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-content",children:[e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Template (optional)"}),e.jsxs("select",{value:"",onChange:n=>{const o=s.find(d=>d.image===n.target.value);o&&a({...r,name:o.name,image:o.image})},children:[e.jsx("option",{value:"",children:"Select a template..."}),s.map(n=>e.jsx("option",{value:n.image,children:n.name},n.image))]})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Module Name"}),e.jsx("input",{type:"text",value:r.name||"",onChange:n=>a({...r,name:n.target.value}),placeholder:"e.g., my-module"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Container Image"}),e.jsx("input",{type:"text",value:r.image||"",onChange:n=>a({...r,image:n.target.value}),placeholder:"e.g., nginx:latest"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Version"}),e.jsx("input",{type:"text",value:r.version||"1.0.0",onChange:n=>a({...r,version:n.target.value})})]})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-footer",children:[e.jsx("button",{onClick:c,children:"Cancel"}),e.jsx("button",{className:"nice-edge-manager__deploy-confirm",onClick:i,children:"Deploy"})]})]})})}const me=(r,s)=>s,pe=f.createContext(me);function M(){return{t:f.useContext(pe)}}f.createContext({dir:"ltr",isRTL:!1,flip:r=>r,value:r=>r.ltr});f.createContext(null);f.createContext(null);const ye={radius:"md",shadow:"md",fill:"solid",buttonStyle:"flat",inputStyle:"bordered",cardStyle:"elevated",badgeStyle:"solid",tabStyle:"underline",toggleStyle:"default",tooltipStyle:"dark",modalStyle:"default",tableStyle:"default",menuStyle:"default",animation:"normal",density:"normal"};f.createContext({displayStyle:"default",variantConfig:ye,setDisplayStyle:()=>{}});f.createContext({});f.createContext({direction:"ltr",isRTL:!1,flip:r=>r,flipStyle:(r,s)=>({[r]:s})});f.createContext({permissions:{},getAccessMode:()=>"full"});f.createContext(null);const he=process.env.NODE_ENV==="development";let G={enabled:he,slowRenderThreshold:16};const V=[],A=new Map,Q=new Map;function ue(){V.length=0,A.clear(),Q.clear()}function be(r){const s=G.slowRenderThreshold;return V.filter(a=>a.actualDuration>s)}function H(r){return r<1?`${(r*1e3).toFixed(0)}ΞΌs`:r<1e3?`${r.toFixed(2)}ms`:`${(r/1e3).toFixed(2)}s`}function ge(){const r=Array.from(A.values()),s=be(),a=r.reduce((n,o)=>n+o.renderCount,0),i=r.length>0?r.reduce((n,o)=>n+o.avgRenderTime,0)/r.length:0,c=Array.from(Q.values());return{stats:r,slowRenders:s,totalRenders:a,avgRenderTime:i,marks:c}}function xe(){const r=ge();console.group("%c[Nice2Dev Performance Report]","color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"),console.log(`Total renders: ${r.totalRenders}`),console.log(`Average render time: ${H(r.avgRenderTime)}`),console.log(`Slow renders: ${r.slowRenders.length}`),console.group("Component Stats"),console.table(r.stats.sort((s,a)=>a.totalRenderTime-s.totalRenderTime).map(s=>({Name:s.componentName,Renders:s.renderCount,"Avg Time":H(s.avgRenderTime),"Max Time":H(s.maxRenderTime),"Total Time":H(s.totalRenderTime),"Slow Renders":s.slowRenderCount}))),console.groupEnd(),r.slowRenders.length>0&&(console.group("Slow Renders (last 10)"),console.table(r.slowRenders.slice(-10).map(s=>({Component:s.componentName,Phase:s.phase,Duration:H(s.actualDuration),Time:new Date(s.timestamp).toLocaleTimeString()}))),console.groupEnd()),r.marks.length>0&&(console.group("Custom Marks"),console.table(r.marks.filter(s=>s.duration).map(s=>({Name:s.name,Duration:H(s.duration)}))),console.groupEnd()),console.groupEnd()}const ve=f.memo(({position:r="bottom-right",defaultCollapsed:s=!0})=>{const[a,i]=f.useState(s),[c,n]=f.useState([]),[o,d]=f.useState({used:0,total:0});if(f.useEffect(()=>{const m=()=>{const x=Array.from(A.values());n(x.sort((h,g)=>g.totalRenderTime-h.totalRenderTime).slice(0,10));const u=window.performance;u.memory&&d({used:u.memory.usedJSHeapSize/1024/1024,total:u.memory.totalJSHeapSize/1024/1024})};m();const v=setInterval(m,2e3);return()=>clearInterval(v)},[]),!G.enabled)return null;const b={position:"fixed",zIndex:99999,...r.includes("top")?{top:8}:{bottom:8},...r.includes("left")?{left:8}:{right:8}};return e.jsxs("div",{style:{...b,background:"var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",color:"var(--bg-primary, #fff)",borderRadius:8,fontSize:11,fontFamily:"Monaco, Consolas, monospace",padding:a?"4px 8px":8,maxWidth:a?"auto":300,maxHeight:a?"auto":400,overflow:"auto"},children:[e.jsxs("div",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:8},onClick:()=>i(m=>!m),children:[e.jsx("span",{style:{color:"var(--color-success, #22c55e)"},children:"β"}),e.jsx("span",{children:"Profiler"}),o.used>0&&e.jsxs("span",{style:{color:o.used>100?"var(--color-warning, #f59e0b)":"var(--text-muted, #64748b)"},children:[o.used.toFixed(0),"MB"]}),e.jsx("span",{style:{marginLeft:"auto",opacity:.5},children:a?"βΌ":"β²"})]}),!a&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{borderBottom:"1px solid var(--border-color, #333)",paddingBottom:4,marginBottom:8},children:e.jsx("strong",{children:"Top Components"})}),c.map(m=>e.jsxs("div",{style:{marginBottom:4,display:"flex",gap:8},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:m.componentName}),e.jsx("span",{style:{color:m.avgRenderTime>16?"var(--color-warning, #f59e0b)":"var(--color-success, #22c55e)"},children:H(m.avgRenderTime)}),e.jsxs("span",{style:{color:"var(--text-muted, #64748b)",minWidth:30,textAlign:"right"},children:["x",m.renderCount]})]},m.componentName)),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[e.jsx("button",{onClick:xe,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Print Report"}),e.jsx("button",{onClick:ue,style:{flex:1,padding:"4px 8px",background:"var(--bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Clear"})]})]})]})});ve.displayName="ProfilerOverlay";process.env.NODE_ENV;f.createContext(null);f.createContext({enabled:!0,active:!1,run:()=>{}});const F="nice-tutorial-button-styles";if(typeof document<"u"&&!document.getElementById(F)){const r=document.createElement("style");r.id=F,r.textContent=`
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),f=require("react"),U=[{type:"device-list",label:"Device List",icon:"π"},{type:"device-status",label:"Device Status",icon:"π’"},{type:"telemetry-chart",label:"Telemetry Chart",icon:"π"},{type:"gauge",label:"Gauge",icon:"β±οΈ"},{type:"map",label:"Device Map",icon:"πΊοΈ"},{type:"alarms",label:"Alarms",icon:"π¨"},{type:"control-panel",label:"Control Panel",icon:"ποΈ"},{type:"topology",label:"Network Topology",icon:"π"},{type:"kpi",label:"KPI Card",icon:"π―"},{type:"camera-feed",label:"Camera Feed",icon:"πΉ"}];function Z({devices:r=[],widgets:s=[],alarms:a=[],onDeviceSelect:i,onWidgetChange:c,onCommand:n,onAlarmAcknowledge:o,fetchTelemetry:d,className:b=""}){const[m,v]=f.useState(s),[x,u]=f.useState(null),[h,g]=f.useState("dashboard"),[N,k]=f.useState(!1),[j,T]=f.useState(""),y=f.useCallback(l=>{v(w=>{const C=l(w);return c==null||c(C),C})},[c]),_=f.useCallback(l=>{var C;const w={id:crypto.randomUUID(),type:l,title:((C=U.find(E=>E.type===l))==null?void 0:C.label)||l,position:{x:0,y:ee(m),width:4,height:3},config:{}};y(E=>[...E,w])},[m,y]),R=f.useCallback(l=>{u(l),i==null||i(l)},[i]),I=f.useCallback(l=>{o==null||o(l)},[o]),S=r.filter(l=>!j||l.name.toLowerCase().includes(j.toLowerCase())||l.type.toLowerCase().includes(j.toLowerCase())),P=a.filter(l=>!l.cleared),L=P.filter(l=>l.severity==="critical"||l.severity==="high");return e.jsxs("div",{className:`nice-iot-dashboard ${b}`,children:[e.jsxs("header",{className:"nice-iot-dashboard__header",children:[e.jsx("h1",{children:"IoT Dashboard"}),e.jsxs("div",{className:"nice-iot-dashboard__stats",children:[e.jsxs("span",{className:"nice-iot-dashboard__stat",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"π±"}),r.length," Devices"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--online",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"π’"}),r.filter(l=>l.status==="online").length," Online"]}),e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--offline",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"β«"}),r.filter(l=>l.status==="offline").length," Offline"]}),L.length>0&&e.jsxs("span",{className:"nice-iot-dashboard__stat nice-iot-dashboard__stat--alarms",children:[e.jsx("span",{className:"nice-iot-dashboard__stat-icon",children:"π¨"}),L.length," Alarms"]})]}),e.jsxs("nav",{className:"nice-iot-dashboard__nav",children:[e.jsx("button",{className:h==="dashboard"?"active":"",onClick:()=>g("dashboard"),children:"Dashboard"}),e.jsx("button",{className:h==="devices"?"active":"",onClick:()=>g("devices"),children:"Devices"}),e.jsxs("button",{className:h==="alarms"?"active":"",onClick:()=>g("alarms"),children:["Alarms ",P.length>0&&`(${P.length})`]})]}),e.jsx("div",{className:"nice-iot-dashboard__actions",children:h==="dashboard"&&e.jsx("button",{onClick:()=>k(!N),children:N?"β Done":"βοΈ Edit"})})]}),h==="dashboard"&&e.jsxs("div",{className:"nice-iot-dashboard__main",children:[N&&e.jsxs("aside",{className:"nice-iot-dashboard__palette",children:[e.jsx("h4",{children:"Add Widget"}),U.map(l=>e.jsxs("button",{className:"nice-iot-dashboard__palette-item",onClick:()=>_(l.type),children:[e.jsx("span",{children:l.icon}),e.jsx("span",{children:l.label})]},l.type))]}),e.jsxs("div",{className:"nice-iot-dashboard__grid",children:[m.map(l=>e.jsx(re,{widget:l,devices:r,alarms:a,isEditing:N,onCommand:n,onDelete:()=>y(w=>w.filter(C=>C.id!==l.id))},l.id)),m.length===0&&e.jsx("div",{className:"nice-iot-dashboard__empty",children:N?"Add widgets from the palette":"No widgets configured. Click Edit to add widgets."})]})]}),h==="devices"&&e.jsxs("div",{className:"nice-iot-dashboard__devices",children:[e.jsx("div",{className:"nice-iot-dashboard__devices-toolbar",children:e.jsx("input",{type:"search",placeholder:"Search devices...",value:j,onChange:l=>T(l.target.value)})}),e.jsx("div",{className:"nice-iot-dashboard__device-grid",children:S.map(l=>e.jsx(se,{device:l,isSelected:(x==null?void 0:x.id)===l.id,onSelect:()=>R(l)},l.id))}),x&&e.jsx(ie,{device:x,onCommand:n,onClose:()=>u(null)})]}),h==="alarms"&&e.jsx("div",{className:"nice-iot-dashboard__alarms",children:e.jsxs("table",{className:"nice-iot-dashboard__alarm-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"Severity"}),e.jsx("th",{children:"Device"}),e.jsx("th",{children:"Message"}),e.jsx("th",{children:"Time"}),e.jsx("th",{children:"Status"}),e.jsx("th",{children:"Actions"})]})}),e.jsx("tbody",{children:P.length===0?e.jsx("tr",{children:e.jsx("td",{colSpan:6,className:"nice-iot-dashboard__no-alarms",children:"No active alarms"})}):P.map(l=>{const w=r.find(C=>C.id===l.deviceId);return e.jsxs("tr",{className:`nice-iot-dashboard__alarm-row nice-iot-dashboard__alarm-row--${l.severity}`,children:[e.jsx("td",{children:e.jsx("span",{className:`nice-iot-dashboard__severity nice-iot-dashboard__severity--${l.severity}`,children:l.severity})}),e.jsx("td",{children:(w==null?void 0:w.name)||l.deviceId}),e.jsx("td",{children:l.message}),e.jsx("td",{children:l.timestamp.toLocaleString()}),e.jsx("td",{children:l.acknowledged?"Acknowledged":"Active"}),e.jsx("td",{children:!l.acknowledged&&e.jsx("button",{onClick:()=>I(l.id),children:"Acknowledge"})})]},l.id)})})]})})]})}function ee(r){return r.length===0?0:Math.max(...r.map(s=>s.position.y+s.position.height))}function D(r){switch(r){case"online":return"var(--nice-success, #28a745)";case"offline":return"var(--nice-text-secondary, #6c757d)";case"warning":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"maintenance":return"var(--nice-info, #17a2b8)";default:return"var(--nice-text-secondary, #6c757d)"}}function re({widget:r,devices:s,alarms:a,isEditing:i,onCommand:c,onDelete:n}){const o=U.find(d=>d.type===r.type);return e.jsxs("div",{className:`nice-iot-dashboard__widget nice-iot-dashboard__widget--${r.type}`,style:{gridColumn:`span ${r.position.width}`,gridRow:`span ${r.position.height}`},children:[e.jsxs("div",{className:"nice-iot-dashboard__widget-header",children:[e.jsx("span",{className:"nice-iot-dashboard__widget-icon",children:o==null?void 0:o.icon}),e.jsx("span",{className:"nice-iot-dashboard__widget-title",children:r.title}),i&&e.jsx("button",{className:"nice-iot-dashboard__widget-delete",onClick:n,children:"Γ"})]}),e.jsx("div",{className:"nice-iot-dashboard__widget-content",children:e.jsx(ae,{widget:r,devices:s,alarms:a,onCommand:c})})]})}function ae({widget:r,devices:s,alarms:a,onCommand:i}){switch(r.type){case"device-list":return e.jsx("div",{className:"nice-iot-dashboard__device-list",children:s.slice(0,10).map(c=>e.jsxs("div",{className:"nice-iot-dashboard__device-list-item",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:D(c.status)}}),e.jsx("span",{children:c.name}),e.jsx("span",{className:"nice-iot-dashboard__device-type",children:c.type})]},c.id))});case"device-status":return e.jsx("div",{className:"nice-iot-dashboard__status-grid",children:["online","offline","warning","error"].map(c=>{const n=s.filter(o=>o.status===c).length;return e.jsxs("div",{className:"nice-iot-dashboard__status-card",children:[e.jsx("span",{className:"nice-iot-dashboard__status-indicator",style:{background:D(c)}}),e.jsx("span",{className:"nice-iot-dashboard__status-count",children:n}),e.jsx("span",{className:"nice-iot-dashboard__status-label",children:c})]},c)})});case"telemetry-chart":return e.jsxs("div",{className:"nice-iot-dashboard__chart-placeholder",children:[e.jsx("span",{children:"π"}),e.jsx("span",{children:"Telemetry Chart"}),e.jsx("small",{children:"Configure device and capability"})]});case"gauge":return e.jsx("div",{className:"nice-iot-dashboard__gauge",children:e.jsxs("svg",{viewBox:"0 0 100 60",children:[e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-border, #e0e0e0)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 55 A 40 40 0 0 1 90 55",fill:"none",stroke:"var(--nice-primary, #0066cc)",strokeWidth:"8",strokeDasharray:"63 126"}),e.jsx("text",{x:"50",y:"50",textAnchor:"middle",fontSize:"14",fontWeight:"bold",children:"50%"})]})});case"map":return e.jsxs("div",{className:"nice-iot-dashboard__map-placeholder",children:[e.jsx("span",{children:"πΊοΈ"}),e.jsx("span",{children:"Device Map"}),e.jsxs("small",{children:[s.filter(c=>c.location).length," devices with location"]})]});case"alarms":{const c=a.filter(n=>!n.cleared).slice(0,5);return e.jsx("div",{className:"nice-iot-dashboard__alarm-list",children:c.length===0?e.jsx("div",{className:"nice-iot-dashboard__alarm-empty",children:"No active alarms"}):c.map(n=>e.jsxs("div",{className:`nice-iot-dashboard__alarm-item nice-iot-dashboard__alarm-item--${n.severity}`,children:[e.jsx("span",{className:"nice-iot-dashboard__alarm-severity",children:n.severity}),e.jsx("span",{className:"nice-iot-dashboard__alarm-message",children:n.message})]},n.id))})}case"control-panel":return e.jsxs("div",{className:"nice-iot-dashboard__control-placeholder",children:[e.jsx("span",{children:"ποΈ"}),e.jsx("span",{children:"Control Panel"}),e.jsx("small",{children:"Configure device controls"})]});case"kpi":return e.jsxs("div",{className:"nice-iot-dashboard__kpi",children:[e.jsx("div",{className:"nice-iot-dashboard__kpi-value",children:s.length}),e.jsx("div",{className:"nice-iot-dashboard__kpi-label",children:"Total Devices"})]});default:return e.jsx("div",{className:"nice-iot-dashboard__widget-placeholder",children:r.type})}}function se({device:r,isSelected:s,onSelect:a}){return e.jsxs("div",{className:`nice-iot-dashboard__device-card ${s?"nice-iot-dashboard__device-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-iot-dashboard__device-card-header",children:[e.jsx("span",{className:"nice-iot-dashboard__device-status",style:{background:D(r.status)}}),e.jsx("span",{className:"nice-iot-dashboard__device-name",children:r.name})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-card-body",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-info",children:[e.jsxs("span",{children:["Type: ",r.type]}),e.jsxs("span",{children:["Protocol: ",r.protocol]})]}),r.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__device-lastseen",children:["Last seen: ",r.lastSeen.toLocaleString()]}),e.jsxs("div",{className:"nice-iot-dashboard__device-capabilities",children:[r.capabilities.slice(0,3).map(i=>e.jsx("span",{className:"nice-iot-dashboard__capability-badge",children:i.name},i.id)),r.capabilities.length>3&&e.jsxs("span",{className:"nice-iot-dashboard__capability-more",children:["+",r.capabilities.length-3]})]})]})]})}function ie({device:r,onCommand:s,onClose:a}){return e.jsxs("aside",{className:"nice-iot-dashboard__device-detail",children:[e.jsxs("div",{className:"nice-iot-dashboard__device-detail-header",children:[e.jsx("h3",{children:r.name}),e.jsx("button",{onClick:a,children:"Γ"})]}),e.jsxs("div",{className:"nice-iot-dashboard__device-detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-iot-dashboard__status-badge",style:{background:D(r.status)},children:r.status})]}),r.lastSeen&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Last Seen:"}),e.jsx("span",{children:r.lastSeen.toLocaleString()})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connection"}),e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Protocol:"}),e.jsx("span",{children:r.protocol})]}),r.connectionInfo.host&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Host:"}),e.jsxs("span",{children:[r.connectionInfo.host,":",r.connectionInfo.port]})]})]}),r.metadata&&e.jsxs("section",{children:[e.jsx("h4",{children:"Metadata"}),r.metadata.manufacturer&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Manufacturer:"}),e.jsx("span",{children:r.metadata.manufacturer})]}),r.metadata.model&&e.jsxs("div",{className:"nice-iot-dashboard__detail-row",children:[e.jsx("span",{children:"Model:"}),e.jsx("span",{children:r.metadata.model})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Capabilities"}),e.jsx("div",{className:"nice-iot-dashboard__capabilities-list",children:r.capabilities.map(i=>e.jsxs("div",{className:"nice-iot-dashboard__capability-item",children:[e.jsx("span",{className:"nice-iot-dashboard__capability-name",children:i.name}),e.jsx("span",{className:"nice-iot-dashboard__capability-type",children:i.type}),i.writable&&s&&e.jsx("button",{className:"nice-iot-dashboard__capability-control",onClick:()=>s(r.id,i.id,!0),children:"Control"})]},i.id))})]})]})]})}const ce=[{name:"MQTT Broker",image:"eclipse-mosquitto:latest"},{name:"Node-RED",image:"nodered/node-red:latest"},{name:"InfluxDB",image:"influxdb:latest"},{name:"Grafana",image:"grafana/grafana:latest"},{name:"Telegraf",image:"telegraf:latest"},{name:"Protocol Adapter",image:"nice2dev/protocol-adapter:latest"}];function ne({nodes:r=[],modules:s=[],onNodeSelect:a,onModuleDeploy:i,onModuleAction:c,onNodeSync:n,className:o=""}){const[d,b]=f.useState(null),[m,v]=f.useState("nodes"),[x,u]=f.useState(!1),[h,g]=f.useState({name:"",image:"",status:"pending"}),N=f.useCallback(y=>{b(y),a==null||a(y)},[a]),k=f.useCallback(async()=>{!d||!h.name||!h.image||(await(i==null?void 0:i(d.id,h)),u(!1),g({name:"",image:"",status:"pending"}))},[d,h,i]),j=f.useCallback(async(y,_)=>{d&&await(c==null?void 0:c(d.id,y,_))},[d,c]),T=f.useCallback(async()=>{d&&await(n==null?void 0:n(d.id))},[d,n]);return e.jsxs("div",{className:`nice-edge-manager ${o}`,children:[e.jsxs("header",{className:"nice-edge-manager__header",children:[e.jsx("h1",{children:"Edge Manager"}),e.jsxs("nav",{className:"nice-edge-manager__nav",children:[e.jsxs("button",{className:m==="nodes"?"active":"",onClick:()=>v("nodes"),children:["Nodes (",r.length,")"]}),e.jsx("button",{className:m==="modules"?"active":"",onClick:()=>v("modules"),children:"Modules"})]})]}),e.jsxs("div",{className:"nice-edge-manager__main",children:[m==="nodes"&&e.jsx("div",{className:"nice-edge-manager__nodes",children:e.jsxs("div",{className:"nice-edge-manager__node-grid",children:[r.map(y=>e.jsx(te,{node:y,isSelected:(d==null?void 0:d.id)===y.id,onSelect:()=>N(y)},y.id)),r.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No edge nodes configured"})]})}),m==="modules"&&d&&e.jsxs("div",{className:"nice-edge-manager__modules",children:[e.jsxs("div",{className:"nice-edge-manager__modules-header",children:[e.jsxs("h3",{children:["Modules on ",d.name]}),e.jsx("button",{className:"nice-edge-manager__deploy-btn",onClick:()=>u(!0),children:"+ Deploy Module"})]}),e.jsxs("div",{className:"nice-edge-manager__module-grid",children:[d.deployedModules.map(y=>e.jsx(de,{module:y,onAction:_=>j(y.id,_)},y.id)),d.deployedModules.length===0&&e.jsx("div",{className:"nice-edge-manager__empty",children:"No modules deployed on this node"})]})]}),m==="modules"&&!d&&e.jsx("div",{className:"nice-edge-manager__no-selection",children:"Select a node from the Nodes tab to manage modules"}),d&&e.jsx(le,{node:d,onSync:T,onClose:()=>b(null)})]}),x&&e.jsx(fe,{config:h,templates:ce,onChange:g,onDeploy:k,onClose:()=>u(!1)})]})}function W(r){switch(r){case"running":return"var(--nice-success, #28a745)";case"stopped":return"var(--nice-text-secondary, #6c757d)";case"updating":return"var(--nice-warning, #ffc107)";case"error":return"var(--nice-danger, #dc3545)";case"unreachable":return"var(--nice-text-secondary, #868e96)";default:return"var(--nice-text-secondary, #6c757d)"}}function $(r){return r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:r<1024*1024*1024?`${(r/1024/1024).toFixed(1)} MB`:`${(r/1024/1024/1024).toFixed(2)} GB`}function oe(r){const s=Math.floor(r/86400),a=Math.floor(r%86400/3600),i=Math.floor(r%3600/60);return s>0?`${s}d ${a}h`:a>0?`${a}h ${i}m`:`${i}m`}function te({node:r,isSelected:s,onSelect:a}){return e.jsxs("div",{className:`nice-edge-manager__node-card ${s?"nice-edge-manager__node-card--selected":""}`,onClick:a,children:[e.jsxs("div",{className:"nice-edge-manager__node-header",children:[e.jsx("span",{className:"nice-edge-manager__node-status",style:{background:W(r.status)}}),e.jsx("span",{className:"nice-edge-manager__node-name",children:r.name}),e.jsx("span",{className:"nice-edge-manager__node-type",children:r.type})]}),e.jsxs("div",{className:"nice-edge-manager__node-body",children:[e.jsxs("div",{className:"nice-edge-manager__node-info",children:[e.jsxs("span",{children:["π₯οΈ ",r.hardware.cpu]}),e.jsxs("span",{children:["πΎ ",(r.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsx("div",{className:"nice-edge-manager__node-metrics",children:r.metrics&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${r.metrics.cpuUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[r.metrics.cpuUsage.toFixed(0),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__metric",children:[e.jsx("span",{className:"nice-edge-manager__metric-label",children:"MEM"}),e.jsx("div",{className:"nice-edge-manager__metric-bar",children:e.jsx("div",{className:"nice-edge-manager__metric-fill",style:{width:`${r.metrics.memoryUsage}%`}})}),e.jsxs("span",{className:"nice-edge-manager__metric-value",children:[r.metrics.memoryUsage.toFixed(0),"%"]})]})]})}),e.jsxs("div",{className:"nice-edge-manager__node-modules",children:[r.deployedModules.length," modules deployed"]})]})]})}function de({module:r,onAction:s}){const a={running:"var(--nice-success, #28a745)",stopped:"var(--nice-text-secondary, #6c757d)",error:"var(--nice-danger, #dc3545)",pending:"var(--nice-warning, #ffc107)"};return e.jsxs("div",{className:"nice-edge-manager__module-card",children:[e.jsxs("div",{className:"nice-edge-manager__module-header",children:[e.jsx("span",{className:"nice-edge-manager__module-status",style:{background:a[r.status]||"var(--nice-text-secondary, #6c757d)"}}),e.jsx("span",{className:"nice-edge-manager__module-name",children:r.name}),e.jsxs("span",{className:"nice-edge-manager__module-version",children:["v",r.version]})]}),e.jsxs("div",{className:"nice-edge-manager__module-body",children:[e.jsx("div",{className:"nice-edge-manager__module-image",children:r.image}),r.resources&&e.jsxs("div",{className:"nice-edge-manager__module-resources",children:[r.resources.cpuLimit&&e.jsxs("span",{children:["CPU: ",r.resources.cpuLimit]}),r.resources.memoryLimitMB&&e.jsxs("span",{children:["RAM: ",r.resources.memoryLimitMB," MB"]})]}),r.ports&&r.ports.length>0&&e.jsxs("div",{className:"nice-edge-manager__module-ports",children:["Ports: ",r.ports.map(i=>`${i.host}:${i.container}`).join(", ")]})]}),e.jsxs("div",{className:"nice-edge-manager__module-actions",children:[r.status==="running"&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>s("stop"),children:"Stop"}),e.jsx("button",{onClick:()=>s("restart"),children:"Restart"})]}),r.status==="stopped"&&e.jsx("button",{onClick:()=>s("start"),children:"Start"}),e.jsx("button",{className:"nice-edge-manager__module-remove",onClick:()=>s("remove"),children:"Remove"})]})]})}function le({node:r,onSync:s,onClose:a}){return e.jsxs("aside",{className:"nice-edge-manager__detail",children:[e.jsxs("div",{className:"nice-edge-manager__detail-header",children:[e.jsx("h3",{children:r.name}),e.jsxs("div",{className:"nice-edge-manager__detail-actions",children:[e.jsx("button",{onClick:s,children:"π Sync"}),e.jsx("button",{onClick:a,children:"Γ"})]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-content",children:[e.jsxs("section",{children:[e.jsx("h4",{children:"Status"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Status:"}),e.jsx("span",{className:"nice-edge-manager__status-badge",style:{background:W(r.status)},children:r.status})]}),r.metrics&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Uptime:"}),e.jsx("span",{children:oe(r.metrics.uptime)})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Hardware"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"CPU:"}),e.jsxs("span",{children:[r.hardware.cpu," (",r.hardware.cores," cores)"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Memory:"}),e.jsxs("span",{children:[(r.hardware.memoryMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Storage:"}),e.jsxs("span",{children:[(r.hardware.storageMB/1024).toFixed(1)," GB"]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Architecture:"}),e.jsx("span",{children:r.hardware.architecture})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Software"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"OS:"}),e.jsxs("span",{children:[r.software.os," ",r.software.osVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Runtime:"}),e.jsxs("span",{children:[r.software.runtime," ",r.software.runtimeVersion]})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Agent:"}),e.jsxs("span",{children:[r.software.agent," v",r.software.agentVersion]})]})]}),e.jsxs("section",{children:[e.jsx("h4",{children:"Connectivity"}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Cloud:"}),e.jsx("span",{children:r.connectivity.cloudConnected?"β Connected":"β Disconnected"})]}),e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Network:"}),e.jsx("span",{children:r.connectivity.localNetwork})]}),r.connectivity.publicIP&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Public IP:"}),e.jsx("span",{children:r.connectivity.publicIP})]}),r.connectivity.lastSync&&e.jsxs("div",{className:"nice-edge-manager__detail-row",children:[e.jsx("span",{children:"Last Sync:"}),e.jsx("span",{children:r.connectivity.lastSync.toLocaleString()})]})]}),r.metrics&&e.jsxs("section",{children:[e.jsx("h4",{children:"Resource Usage"}),e.jsxs("div",{className:"nice-edge-manager__resource-chart",children:[e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"CPU"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.cpuUsage}%`}})}),e.jsxs("span",{children:[r.metrics.cpuUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Memory"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.memoryUsage}%`}})}),e.jsxs("span",{children:[r.metrics.memoryUsage.toFixed(1),"%"]})]}),e.jsxs("div",{className:"nice-edge-manager__resource-item",children:[e.jsx("span",{children:"Disk"}),e.jsx("div",{className:"nice-edge-manager__resource-bar",children:e.jsx("div",{className:"nice-edge-manager__resource-fill",style:{width:`${r.metrics.diskUsage}%`}})}),e.jsxs("span",{children:[r.metrics.diskUsage.toFixed(1),"%"]})]})]}),e.jsxs("div",{className:"nice-edge-manager__network-stats",children:[e.jsxs("span",{children:["β ",$(r.metrics.networkIn)]}),e.jsxs("span",{children:["β ",$(r.metrics.networkOut)]})]})]})]})]})}function fe({config:r,templates:s,onChange:a,onDeploy:i,onClose:c}){return e.jsx("div",{className:"nice-edge-manager__dialog-overlay",children:e.jsxs("div",{className:"nice-edge-manager__dialog",children:[e.jsxs("div",{className:"nice-edge-manager__dialog-header",children:[e.jsx("h3",{children:"Deploy Module"}),e.jsx("button",{onClick:c,children:"Γ"})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-content",children:[e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Template (optional)"}),e.jsxs("select",{value:"",onChange:n=>{const o=s.find(d=>d.image===n.target.value);o&&a({...r,name:o.name,image:o.image})},children:[e.jsx("option",{value:"",children:"Select a template..."}),s.map(n=>e.jsx("option",{value:n.image,children:n.name},n.image))]})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Module Name"}),e.jsx("input",{type:"text",value:r.name||"",onChange:n=>a({...r,name:n.target.value}),placeholder:"e.g., my-module"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Container Image"}),e.jsx("input",{type:"text",value:r.image||"",onChange:n=>a({...r,image:n.target.value}),placeholder:"e.g., nginx:latest"})]}),e.jsxs("div",{className:"nice-edge-manager__field",children:[e.jsx("label",{children:"Version"}),e.jsx("input",{type:"text",value:r.version||"1.0.0",onChange:n=>a({...r,version:n.target.value})})]})]}),e.jsxs("div",{className:"nice-edge-manager__dialog-footer",children:[e.jsx("button",{onClick:c,children:"Cancel"}),e.jsx("button",{className:"nice-edge-manager__deploy-confirm",onClick:i,children:"Deploy"})]})]})})}const me=(r,s)=>s,pe=f.createContext(me);function M(){return{t:f.useContext(pe)}}f.createContext({dir:"ltr",isRTL:!1,flip:r=>r,value:r=>r.ltr});f.createContext(null);f.createContext(null);const ye={radius:"md",shadow:"md",fill:"solid",buttonStyle:"flat",inputStyle:"bordered",cardStyle:"elevated",badgeStyle:"solid",tabStyle:"underline",toggleStyle:"default",tooltipStyle:"dark",modalStyle:"default",tableStyle:"default",menuStyle:"default",animation:"normal",density:"normal"};f.createContext({displayStyle:"default",variantConfig:ye,setDisplayStyle:()=>{}});f.createContext({});f.createContext({direction:"ltr",isRTL:!1,flip:r=>r,flipStyle:(r,s)=>({[r]:s})});f.createContext({permissions:{},getAccessMode:()=>"full"});f.createContext(null);const he=process.env.NODE_ENV==="development";let G={enabled:he,slowRenderThreshold:16};const V=[],A=new Map,Q=new Map;function ue(){V.length=0,A.clear(),Q.clear()}function be(r){const s=G.slowRenderThreshold;return V.filter(a=>a.actualDuration>s)}function H(r){return r<1?`${(r*1e3).toFixed(0)}ΞΌs`:r<1e3?`${r.toFixed(2)}ms`:`${(r/1e3).toFixed(2)}s`}function ge(){const r=Array.from(A.values()),s=be(),a=r.reduce((n,o)=>n+o.renderCount,0),i=r.length>0?r.reduce((n,o)=>n+o.avgRenderTime,0)/r.length:0,c=Array.from(Q.values());return{stats:r,slowRenders:s,totalRenders:a,avgRenderTime:i,marks:c}}function xe(){const r=ge();console.group("%c[Nice2Dev Performance Report]","color: var(--nice-info, #6366f1); font-weight: bold; font-size: 14px"),console.log(`Total renders: ${r.totalRenders}`),console.log(`Average render time: ${H(r.avgRenderTime)}`),console.log(`Slow renders: ${r.slowRenders.length}`),console.group("Component Stats"),console.table(r.stats.sort((s,a)=>a.totalRenderTime-s.totalRenderTime).map(s=>({Name:s.componentName,Renders:s.renderCount,"Avg Time":H(s.avgRenderTime),"Max Time":H(s.maxRenderTime),"Total Time":H(s.totalRenderTime),"Slow Renders":s.slowRenderCount}))),console.groupEnd(),r.slowRenders.length>0&&(console.group("Slow Renders (last 10)"),console.table(r.slowRenders.slice(-10).map(s=>({Component:s.componentName,Phase:s.phase,Duration:H(s.actualDuration),Time:new Date(s.timestamp).toLocaleTimeString()}))),console.groupEnd()),r.marks.length>0&&(console.group("Custom Marks"),console.table(r.marks.filter(s=>s.duration).map(s=>({Name:s.name,Duration:H(s.duration)}))),console.groupEnd()),console.groupEnd()}const ve=f.memo(({position:r="bottom-right",defaultCollapsed:s=!0})=>{const[a,i]=f.useState(s),[c,n]=f.useState([]),[o,d]=f.useState({used:0,total:0});if(f.useEffect(()=>{const m=()=>{const x=Array.from(A.values());n(x.sort((h,g)=>g.totalRenderTime-h.totalRenderTime).slice(0,10));const u=window.performance;u.memory&&d({used:u.memory.usedJSHeapSize/1024/1024,total:u.memory.totalJSHeapSize/1024/1024})};m();const v=setInterval(m,2e3);return()=>clearInterval(v)},[]),!G.enabled)return null;const b={position:"fixed",zIndex:99999,...r.includes("top")?{top:8}:{bottom:8},...r.includes("left")?{left:8}:{right:8}};return e.jsxs("div",{style:{...b,background:"var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",color:"var(--nice-bg-primary, #fff)",borderRadius:8,fontSize:11,fontFamily:"Monaco, Consolas, monospace",padding:a?"4px 8px":8,maxWidth:a?"auto":300,maxHeight:a?"auto":400,overflow:"auto"},children:[e.jsxs("div",{style:{cursor:"pointer",display:"flex",alignItems:"center",gap:8},onClick:()=>i(m=>!m),children:[e.jsx("span",{style:{color:"var(--nice-color-success, #22c55e)"},children:"β"}),e.jsx("span",{children:"Profiler"}),o.used>0&&e.jsxs("span",{style:{color:o.used>100?"var(--nice-color-warning, #f59e0b)":"var(--nice-text-muted, #64748b)"},children:[o.used.toFixed(0),"MB"]}),e.jsx("span",{style:{marginLeft:"auto",opacity:.5},children:a?"βΌ":"β²"})]}),!a&&e.jsxs("div",{style:{marginTop:8},children:[e.jsx("div",{style:{borderBottom:"1px solid var(--nice-border-color, #333)",paddingBottom:4,marginBottom:8},children:e.jsx("strong",{children:"Top Components"})}),c.map(m=>e.jsxs("div",{style:{marginBottom:4,display:"flex",gap:8},children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:m.componentName}),e.jsx("span",{style:{color:m.avgRenderTime>16?"var(--nice-color-warning, #f59e0b)":"var(--nice-color-success, #22c55e)"},children:H(m.avgRenderTime)}),e.jsxs("span",{style:{color:"var(--nice-text-muted, #64748b)",minWidth:30,textAlign:"right"},children:["x",m.renderCount]})]},m.componentName)),e.jsxs("div",{style:{marginTop:8,display:"flex",gap:8},children:[e.jsx("button",{onClick:xe,style:{flex:1,padding:"4px 8px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Print Report"}),e.jsx("button",{onClick:ue,style:{flex:1,padding:"4px 8px",background:"var(--nice-bg-tertiary, #333)",border:"none",borderRadius:4,color:"var(--nice-bg-primary, #fff)",cursor:"pointer",fontSize:10},children:"Clear"})]})]})]})});ve.displayName="ProfilerOverlay";process.env.NODE_ENV;f.createContext(null);f.createContext({enabled:!0,active:!1,run:()=>{}});const F="nice-tutorial-button-styles";if(typeof document<"u"&&!document.getElementById(F)){const r=document.createElement("style");r.id=F,r.textContent=`
|
|
2
2
|
.nice-tutorial-button {
|
|
3
3
|
display: inline-flex;
|
|
4
4
|
align-items: center;
|
package/dist/index.mjs
CHANGED
|
@@ -286,7 +286,15 @@ function te({
|
|
|
286
286
|
] });
|
|
287
287
|
case "gauge":
|
|
288
288
|
return /* @__PURE__ */ e("div", { className: "nice-iot-dashboard__gauge", children: /* @__PURE__ */ a("svg", { viewBox: "0 0 100 60", children: [
|
|
289
|
-
/* @__PURE__ */ e(
|
|
289
|
+
/* @__PURE__ */ e(
|
|
290
|
+
"path",
|
|
291
|
+
{
|
|
292
|
+
d: "M 10 55 A 40 40 0 0 1 90 55",
|
|
293
|
+
fill: "none",
|
|
294
|
+
stroke: "var(--nice-border, #e0e0e0)",
|
|
295
|
+
strokeWidth: "8"
|
|
296
|
+
}
|
|
297
|
+
),
|
|
290
298
|
/* @__PURE__ */ e(
|
|
291
299
|
"path",
|
|
292
300
|
{
|
|
@@ -663,12 +671,14 @@ function ye({ module: r, onAction: i }) {
|
|
|
663
671
|
"span",
|
|
664
672
|
{
|
|
665
673
|
className: "nice-edge-manager__module-status",
|
|
666
|
-
style: {
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
674
|
+
style: {
|
|
675
|
+
background: {
|
|
676
|
+
running: "var(--nice-success, #28a745)",
|
|
677
|
+
stopped: "var(--nice-text-secondary, #6c757d)",
|
|
678
|
+
error: "var(--nice-danger, #dc3545)",
|
|
679
|
+
pending: "var(--nice-warning, #ffc107)"
|
|
680
|
+
}[r.status] || "var(--nice-text-secondary, #6c757d)"
|
|
681
|
+
}
|
|
672
682
|
}
|
|
673
683
|
),
|
|
674
684
|
/* @__PURE__ */ e("span", { className: "nice-edge-manager__module-name", children: r.name }),
|
|
@@ -1070,7 +1080,7 @@ const ke = ce(
|
|
|
1070
1080
|
style: {
|
|
1071
1081
|
...g,
|
|
1072
1082
|
background: "var(--nice-overlay-85, rgba(0, 0, 0, 0.85))",
|
|
1073
|
-
color: "var(--bg-primary, #fff)",
|
|
1083
|
+
color: "var(--nice-bg-primary, #fff)",
|
|
1074
1084
|
borderRadius: 8,
|
|
1075
1085
|
fontSize: 11,
|
|
1076
1086
|
fontFamily: "Monaco, Consolas, monospace",
|
|
@@ -1086,13 +1096,13 @@ const ke = ce(
|
|
|
1086
1096
|
style: { cursor: "pointer", display: "flex", alignItems: "center", gap: 8 },
|
|
1087
1097
|
onClick: () => n((m) => !m),
|
|
1088
1098
|
children: [
|
|
1089
|
-
/* @__PURE__ */ e("span", { style: { color: "var(--color-success, #22c55e)" }, children: "β" }),
|
|
1099
|
+
/* @__PURE__ */ e("span", { style: { color: "var(--nice-color-success, #22c55e)" }, children: "β" }),
|
|
1090
1100
|
/* @__PURE__ */ e("span", { children: "Profiler" }),
|
|
1091
1101
|
t.used > 0 && /* @__PURE__ */ a(
|
|
1092
1102
|
"span",
|
|
1093
1103
|
{
|
|
1094
1104
|
style: {
|
|
1095
|
-
color: t.used > 100 ? "var(--color-warning, #f59e0b)" : "var(--text-muted, #64748b)"
|
|
1105
|
+
color: t.used > 100 ? "var(--nice-color-warning, #f59e0b)" : "var(--nice-text-muted, #64748b)"
|
|
1096
1106
|
},
|
|
1097
1107
|
children: [
|
|
1098
1108
|
t.used.toFixed(0),
|
|
@@ -1109,7 +1119,7 @@ const ke = ce(
|
|
|
1109
1119
|
"div",
|
|
1110
1120
|
{
|
|
1111
1121
|
style: {
|
|
1112
|
-
borderBottom: "1px solid var(--border-color, #333)",
|
|
1122
|
+
borderBottom: "1px solid var(--nice-border-color, #333)",
|
|
1113
1123
|
paddingBottom: 4,
|
|
1114
1124
|
marginBottom: 8
|
|
1115
1125
|
},
|
|
@@ -1122,7 +1132,7 @@ const ke = ce(
|
|
|
1122
1132
|
"span",
|
|
1123
1133
|
{
|
|
1124
1134
|
style: {
|
|
1125
|
-
color: m.avgRenderTime > 16 ? "var(--color-warning, #f59e0b)" : "var(--color-success, #22c55e)"
|
|
1135
|
+
color: m.avgRenderTime > 16 ? "var(--nice-color-warning, #f59e0b)" : "var(--nice-color-success, #22c55e)"
|
|
1126
1136
|
},
|
|
1127
1137
|
children: D(m.avgRenderTime)
|
|
1128
1138
|
}
|
|
@@ -1130,7 +1140,11 @@ const ke = ce(
|
|
|
1130
1140
|
/* @__PURE__ */ a(
|
|
1131
1141
|
"span",
|
|
1132
1142
|
{
|
|
1133
|
-
style: {
|
|
1143
|
+
style: {
|
|
1144
|
+
color: "var(--nice-text-muted, #64748b)",
|
|
1145
|
+
minWidth: 30,
|
|
1146
|
+
textAlign: "right"
|
|
1147
|
+
},
|
|
1134
1148
|
children: [
|
|
1135
1149
|
"x",
|
|
1136
1150
|
m.renderCount
|
|
@@ -1146,10 +1160,10 @@ const ke = ce(
|
|
|
1146
1160
|
style: {
|
|
1147
1161
|
flex: 1,
|
|
1148
1162
|
padding: "4px 8px",
|
|
1149
|
-
background: "var(--bg-tertiary, #333)",
|
|
1163
|
+
background: "var(--nice-bg-tertiary, #333)",
|
|
1150
1164
|
border: "none",
|
|
1151
1165
|
borderRadius: 4,
|
|
1152
|
-
color: "var(--bg-primary, #fff)",
|
|
1166
|
+
color: "var(--nice-bg-primary, #fff)",
|
|
1153
1167
|
cursor: "pointer",
|
|
1154
1168
|
fontSize: 10
|
|
1155
1169
|
},
|
|
@@ -1163,10 +1177,10 @@ const ke = ce(
|
|
|
1163
1177
|
style: {
|
|
1164
1178
|
flex: 1,
|
|
1165
1179
|
padding: "4px 8px",
|
|
1166
|
-
background: "var(--bg-tertiary, #333)",
|
|
1180
|
+
background: "var(--nice-bg-tertiary, #333)",
|
|
1167
1181
|
border: "none",
|
|
1168
1182
|
borderRadius: 4,
|
|
1169
|
-
color: "var(--bg-primary, #fff)",
|
|
1183
|
+
color: "var(--nice-bg-primary, #fff)",
|
|
1170
1184
|
cursor: "pointer",
|
|
1171
1185
|
fontSize: 10
|
|
1172
1186
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui-iot",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "Nice2Dev IoT Components - Device dashboards, edge management, and protocol support",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"react-dom": ">=17.0.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@nice2dev/ui-core": "^1.1.
|
|
39
|
+
"@nice2dev/ui-core": "^1.1.7",
|
|
40
40
|
"@testing-library/jest-dom": "^7.0.1",
|
|
41
41
|
"@testing-library/react": "^16.3.3",
|
|
42
42
|
"@types/react": "^19.2.18",
|