@nice2dev/ui-monitoring 1.0.11 → 1.0.14

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/README.md CHANGED
@@ -14,3 +14,17 @@ npm install @nice2dev/ui-monitoring @nice2dev/ui
14
14
  ```
15
15
 
16
16
  Requires `@nice2dev/ui` as a peer dependency for shared base types.
17
+
18
+ ## Styling
19
+
20
+ This package ships unstyled component logic. Import the shared CSS bundle once at your app entrypoint:
21
+
22
+ ```tsx
23
+ import '@nice2dev/ui/style.css';
24
+ ```
25
+
26
+ Optional: opt into the legacy shorthand token aliases (`--bg-*`, `--text-*`, `--border-*`, ...) when migrating from a custom design-token system:
27
+
28
+ ```tsx
29
+ import '@nice2dev/ui/css/legacy-bg-text-aliases.css';
30
+ ```
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),d=require("react"),F={trace:{color:"var(--text-muted, #888)",bg:"#88888822",icon:"⋯"},debug:{color:"var(--color-accent, #8b5cf6)",bg:"#8b5cf622",icon:"🔍"},info:{color:"var(--color-primary, #3b82f6)",bg:"#3b82f622",icon:"â„šī¸"},warn:{color:"var(--color-warning, #f59e0b)",bg:"#f59e0b22",icon:"âš ī¸"},error:{color:"var(--color-error, #ef4444)",bg:"#ef444422",icon:"❌"},fatal:{color:"var(--color-error, #dc2626)",bg:"#dc262622",icon:"💀"}},Z=[{label:"Last 5 min",value:"now-5m"},{label:"Last 15 min",value:"now-15m"},{label:"Last 30 min",value:"now-30m"},{label:"Last 1 hour",value:"now-1h"},{label:"Last 3 hours",value:"now-3h"},{label:"Last 6 hours",value:"now-6h"},{label:"Last 12 hours",value:"now-12h"},{label:"Last 24 hours",value:"now-24h"},{label:"Last 7 days",value:"now-7d"}],ee=({logs:c,streams:k,totalCount:I,isLoading:p,savedQueries:B,patterns:v=[],onQueryExecute:V,onQuerySave:O,onQueryDelete:P,onStreamToggle:U,onLogClick:T,onExport:w,onTailStart:_,onTailStop:H,isTailing:z=!1,className:b,style:A,"data-testid":q})=>{const[C,R]=d.useState(""),[N,W]=d.useState("now-1h"),[M,Y]=d.useState(1e3),[L,J]=d.useState(new Set(["trace","debug","info","warn","error","fatal"])),[y,Q]=d.useState(new Set),[K,D]=d.useState(null),[t,o]=d.useState(!1),[n,u]=d.useState(""),[l,m]=d.useState("logs"),[x,j]=d.useState(""),i=d.useMemo(()=>c.filter(r=>!(!L.has(r.level)||x&&!r.message.toLowerCase().includes(x.toLowerCase()))),[c,L,x]),f=d.useMemo(()=>{const r={trace:0,debug:0,info:0,warn:0,error:0,fatal:0};return c.forEach(s=>r[s.level]++),r},[c]),g=()=>{V({query:C,timeRange:{from:N,to:"now"},limit:M,direction:"backward"})},h=r=>{Q(s=>{const a=new Set(s);return a.has(r)?a.delete(r):a.add(r),a})},G=r=>{J(s=>{const a=new Set(s);return a.has(r)?a.delete(r):a.add(r),a})},$=()=>{n.trim()&&(O(n,C),o(!1),u(""))},E=r=>{if(!x)return r;const s=new RegExp(`(${x})`,"gi");return r.replace(s,'<mark style="background: #f59e0b; color: black; padding: 0 2px; border-radius: 2px;">$1</mark>')};return e.jsxs("div",{className:`nice-log-explorer ${b||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...A},"data-testid":q,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"12px"},children:[e.jsx("input",{type:"text",value:C,onChange:r=>R(r.target.value),placeholder:'Enter query... e.g., {service="api"} |= "error"',onKeyDown:r=>r.key==="Enter"&&g(),style:{flex:1,padding:"10px 16px",borderRadius:"8px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"13px",fontFamily:"monospace"}}),e.jsx("select",{value:N,onChange:r=>W(r.target.value),style:{padding:"10px 12px",borderRadius:"8px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"12px"},children:Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))}),e.jsxs("button",{onClick:g,disabled:p,style:{padding:"10px 24px",borderRadius:"8px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:p?"not-allowed":"pointer",fontSize:"13px",fontWeight:500,opacity:p?.7:1},children:[p?"âŗ":"🔍"," Search"]}),e.jsx("button",{onClick:()=>o(!0),style:{padding:"10px 12px",borderRadius:"8px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"💾"}),_&&e.jsx("button",{onClick:z?H:_,style:{padding:"10px 16px",borderRadius:"8px",border:"none",background:z?"var(--color-success, #22c55e)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:z?"⏚ Stop":"â–ļ Tail"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:"Levels:"}),Object.keys(F).map(r=>{const s=F[r],a=f[r],S=L.has(r);return e.jsxs("button",{onClick:()=>G(r),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"4px",border:"none",background:S?s.bg:"transparent",color:S?s.color:"var(--text-muted, #666)",cursor:"pointer",fontSize:"11px",opacity:S?1:.5},children:[r.toUpperCase()," (",a,")"]},r)}),e.jsx("div",{style:{flex:1}}),e.jsx("input",{type:"text",value:x,onChange:r=>j(r.target.value),placeholder:"Filter results...",style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px",width:"150px"}})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:"220px",borderRight:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px"},children:[e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:"11px",color:"var(--text-muted, #888)",textTransform:"uppercase"},children:"Log Streams"}),k.map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 0",cursor:"pointer",fontSize:"12px"},children:[e.jsx("input",{type:"checkbox",defaultChecked:!0,onChange:s=>U(r.id,s.target.checked)}),e.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:r.color}}),e.jsx("span",{children:r.name})]},r.id)),k.length===0&&e.jsx("div",{style:{color:"var(--text-muted, #666)",fontSize:"11px"},children:"No streams discovered"})]}),e.jsxs("div",{style:{borderTop:"1px solid var(--border-color, #333)",padding:"12px",maxHeight:"200px",overflow:"auto"},children:[e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:"11px",color:"var(--text-muted, #888)",textTransform:"uppercase"},children:"Saved Queries"}),B.map(r=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 8px",marginBottom:"4px",background:"var(--bg-elevated, #252525)",borderRadius:"4px",cursor:"pointer",fontSize:"11px"},onClick:()=>R(r.query),children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.name}),e.jsx("button",{onClick:s=>{s.stopPropagation(),P(r.id)},style:{background:"none",border:"none",color:"var(--text-muted, #666)",cursor:"pointer",fontSize:"10px"},children:"✕"})]},r.id)),B.length===0&&e.jsx("div",{style:{color:"var(--text-muted, #666)",fontSize:"11px"},children:"No saved queries"})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--border-color, #333)"},children:[[{id:"logs",label:`📜 Logs (${i.length})`},{id:"patterns",label:`đŸ”Ŧ Patterns (${v.length})`}].map(r=>e.jsx("button",{onClick:()=>m(r.id),style:{padding:"10px 20px",border:"none",background:l===r.id?"var(--bg-elevated, #1e1e1e)":"transparent",color:l===r.id?"var(--bg-primary, #fff)":"var(--text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:l===r.id?"2px solid #3b82f6":"2px solid transparent"},children:r.label},r.id)),e.jsx("div",{style:{flex:1}}),e.jsxs("div",{style:{display:"flex",gap:"8px",padding:"8px"},children:[e.jsx("button",{onClick:()=>w("json"),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"JSON"}),e.jsx("button",{onClick:()=>w("csv"),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"CSV"})]})]}),l==="logs"&&e.jsxs("div",{style:{flex:1,overflow:"auto",fontFamily:"monospace",fontSize:"12px"},children:[i.map(r=>{const s=F[r.level],a=y.has(r.id);return e.jsxs("div",{style:{borderBottom:"1px solid #252525"},children:[e.jsxs("div",{onClick:()=>h(r.id),style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 12px",cursor:"pointer",background:a?"var(--bg-elevated, #252525)":"transparent"},children:[e.jsx("span",{style:{color:"var(--text-muted, #666)",fontSize:"10px",minWidth:"160px"},children:new Date(r.timestamp).toISOString()}),e.jsx("span",{style:{padding:"2px 6px",borderRadius:"4px",background:s.bg,color:s.color,fontSize:"10px",fontWeight:500,minWidth:"50px",textAlign:"center"},children:r.level.toUpperCase()}),r.service&&e.jsxs("span",{style:{color:"var(--color-accent, #8b5cf6)",fontSize:"10px",minWidth:"80px"},children:["[",r.service,"]"]}),e.jsx("span",{style:{flex:1,whiteSpace:"pre-wrap",wordBreak:"break-all"},dangerouslySetInnerHTML:{__html:E(r.message)}})]}),a&&e.jsxs("div",{style:{padding:"12px 12px 12px 200px",background:"var(--bg-elevated, #252525)",borderTop:"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px",marginBottom:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"2px"},children:"Source"}),e.jsx("div",{style:{fontSize:"11px"},children:r.source})]}),r.host&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"2px"},children:"Host"}),e.jsx("div",{style:{fontSize:"11px"},children:r.host})]}),r.traceId&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"2px"},children:"Trace ID"}),e.jsx("div",{style:{fontSize:"11px",fontFamily:"monospace"},children:r.traceId})]})]}),Object.keys(r.attributes).length>0&&e.jsxs("div",{style:{marginBottom:"12px"},children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"4px"},children:"Attributes"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:Object.entries(r.attributes).map(([S,X])=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",fontSize:"10px"},children:[S,"=",String(X)]},S))})]}),r.stackTrace&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"4px"},children:"Stack Trace"}),e.jsx("pre",{style:{margin:0,padding:"8px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"4px",fontSize:"10px",overflow:"auto",maxHeight:"200px",color:"var(--color-error, #ef4444)"},children:r.stackTrace})]}),e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:()=>T(r),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"View Details"}),r.traceId&&e.jsx("button",{onClick:()=>R(`{traceId="${r.traceId}"}`),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Show Trace"})]})]})]},r.id)}),i.length===0&&!p&&e.jsxs("div",{style:{padding:"48px",textAlign:"center",color:"var(--text-muted, #666)"},children:[e.jsx("span",{style:{fontSize:"48px"},children:"📭"}),e.jsx("p",{style:{marginTop:"16px"},children:"No logs match your query"})]}),p&&e.jsxs("div",{style:{padding:"48px",textAlign:"center",color:"var(--text-muted, #666)"},children:[e.jsx("span",{style:{fontSize:"48px"},children:"âŗ"}),e.jsx("p",{style:{marginTop:"16px"},children:"Loading logs..."})]})]}),l==="patterns"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[v.map(r=>{const s=F[r.level];return e.jsxs("div",{style:{marginBottom:"12px",padding:"16px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",borderLeft:`3px solid ${s.color}`},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",fontWeight:500},children:r.pattern}),e.jsxs("span",{style:{padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",fontSize:"11px"},children:[r.count," occurrences"]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:["Sample: ",r.samples[0]]})]},r.id)}),v.length===0&&e.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--text-muted, #666)"},children:e.jsx("p",{children:"No patterns detected. Run a query first."})})]})]})]}),t&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"400px",background:"var(--bg-elevated, #252525)",borderRadius:"12px",padding:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"14px"},children:"Save Query"}),e.jsx("input",{type:"text",value:n,onChange:r=>u(r.target.value),placeholder:"Query name...",style:{width:"100%",padding:"10px",borderRadius:"8px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"13px",marginBottom:"16px"}}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[e.jsx("button",{onClick:()=>o(!1),style:{padding:"8px 16px",borderRadius:"6px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:$,style:{padding:"8px 16px",borderRadius:"6px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Save"})]})]})})]})},re={critical:{color:"var(--color-error, #ef4444)",icon:"🔴"},warning:{color:"var(--color-warning, #f59e0b)",icon:"🟡"},info:{color:"var(--color-primary, #3b82f6)",icon:"đŸ”ĩ"}},te=[{from:"now-5m",to:"now",display:"Last 5 minutes"},{from:"now-15m",to:"now",display:"Last 15 minutes"},{from:"now-1h",to:"now",display:"Last 1 hour"},{from:"now-3h",to:"now",display:"Last 3 hours"},{from:"now-6h",to:"now",display:"Last 6 hours"},{from:"now-12h",to:"now",display:"Last 12 hours"},{from:"now-24h",to:"now",display:"Last 24 hours"},{from:"now-7d",to:"now",display:"Last 7 days"},{from:"now-30d",to:"now",display:"Last 30 days"}],oe=({dashboard:c,metrics:k,alerts:I=[],timeRanges:p=te,onTimeRangeChange:B,onVariableChange:v,onPanelEdit:V,onPanelAdd:O,onPanelRemove:P,onPanelMove:U,onAlertAcknowledge:T,onAlertSilence:w,onQueryExecute:_,onDashboardSave:H,onRefresh:z,isEditing:b=!1,onEditModeToggle:A,className:q,style:C,"data-testid":R})=>{const[N,W]=d.useState(!1),[M,Y]=d.useState(!0),[L,J]=d.useState(null),y=I.filter(t=>t.status==="firing"),Q=t=>{var n,u,l;const o=(n=t.queries[0])!=null&&n.expression?k[t.queries[0].expression]:null;switch(t.type){case"stat":return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",flexDirection:"column"},children:[e.jsx("div",{style:{fontSize:"48px",fontWeight:600,color:o?D(o.currentValue,t.thresholds):"var(--text-primary, #e0e0e0)"},children:(o==null?void 0:o.currentValue.toFixed(2))??"-"}),(o==null?void 0:o.unit)&&e.jsx("div",{style:{fontSize:"14px",color:"var(--text-muted, #888)",marginTop:"4px"},children:o.unit})]});case"gauge":const m=(o==null?void 0:o.currentValue)??0,x=((l=(u=t.thresholds)==null?void 0:u[t.thresholds.length-1])==null?void 0:l.value)??100,j=Math.min(m/x*100,100);return e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsxs("svg",{viewBox:"0 0 100 60",style:{width:"100%",maxWidth:"200px"},children:[e.jsx("path",{d:"M 10 50 A 40 40 0 0 1 90 50",fill:"none",stroke:"#333",strokeWidth:"8"}),e.jsx("path",{d:"M 10 50 A 40 40 0 0 1 90 50",fill:"none",stroke:D(m,t.thresholds),strokeWidth:"8",strokeDasharray:`${j*1.26} 126`}),e.jsx("text",{x:"50",y:"45",textAnchor:"middle",fill:"#e0e0e0",fontSize:"16",fontWeight:"600",children:m.toFixed(1)})]})});case"timeseries":return K(t,o);case"table":return e.jsx("div",{style:{overflow:"auto",height:"100%"},children:e.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"var(--bg-elevated, #252525)"},children:[e.jsx("th",{style:{padding:"6px 8px",textAlign:"left",borderBottom:"1px solid var(--border-color, #333)"},children:"Time"}),e.jsx("th",{style:{padding:"6px 8px",textAlign:"right",borderBottom:"1px solid var(--border-color, #333)"},children:"Value"})]})}),e.jsx("tbody",{children:o==null?void 0:o.values.slice(-10).reverse().map((i,f)=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"4px 8px",borderBottom:"1px solid var(--border-color, #333)"},children:new Date(i.timestamp).toLocaleTimeString()}),e.jsxs("td",{style:{padding:"4px 8px",borderBottom:"1px solid var(--border-color, #333)",textAlign:"right"},children:[i.value.toFixed(2)," ",o.unit]})]},f))})]})});case"bar_gauge":return e.jsx("div",{style:{padding:"8px",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:t.queries.map((i,f)=>{var $,E;const g=k[i.expression],h=(g==null?void 0:g.currentValue)??0,G=((E=($=t.thresholds)==null?void 0:$[t.thresholds.length-1])==null?void 0:E.value)??100;return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",marginBottom:"4px"},children:[e.jsx("span",{children:i.legendFormat??i.expression}),e.jsx("span",{children:h.toFixed(1)})]}),e.jsx("div",{style:{height:"16px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${h/G*100}%`,background:D(h,t.thresholds),borderRadius:"4px"}})})]},f)})});case"text":return e.jsx("div",{style:{padding:"12px",fontSize:"12px",lineHeight:"1.6"},children:t.description});default:return e.jsx("div",{style:{padding:"12px",color:"var(--text-muted, #666)"},children:"Unsupported panel type"})}},K=(t,o)=>{const n=(o==null?void 0:o.values)??[];if(n.length===0)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted, #666)"},children:"No data"});const u=n.map(i=>i.value),l=Math.min(...u),x=Math.max(...u)-l||1,j=n.map((i,f)=>{const g=f/(n.length-1)*100,h=100-(i.value-l)/x*80;return`${g},${h}`}).join(" ");return e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",style:{width:"100%",height:"100%"},children:[[0,25,50,75,100].map(i=>e.jsx("line",{x1:"0",y1:i,x2:"100",y2:i,stroke:"#333",strokeWidth:"0.5"},i)),t.chartType==="area"||t.chartType==="stacked_area"?e.jsx("polygon",{points:`0,100 ${j} 100,100`,fill:"rgba(59, 130, 246, 0.2)"}):null,e.jsx("polyline",{points:j,fill:"none",stroke:"#3b82f6",strokeWidth:"1"})]})},D=(t,o)=>{if(!o||o.length===0)return"var(--color-primary, #3b82f6)";for(let n=o.length-1;n>=0;n--)if(t>=o[n].value)return o[n].color;return"var(--color-success, #22c55e)"};return e.jsxs("div",{className:`nice-metrics-dashboard ${q||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...C},"data-testid":R,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsx("span",{style:{fontSize:"20px"},children:"📊"}),e.jsx("span",{style:{fontWeight:500,fontSize:"14px"},children:c.name}),e.jsx("div",{style:{flex:1}}),y.length>0&&e.jsxs("button",{onClick:()=>W(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"4px",border:"none",background:"#ef444422",color:"var(--color-error, #ef4444)",cursor:"pointer",fontSize:"12px"},children:["🔴 ",y.length," Alert",y.length!==1&&"s"]}),e.jsx("select",{value:c.timeRange.display,onChange:t=>{const o=p.find(n=>n.display===t.target.value);o&&B(o)},style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"12px"},children:p.map(t=>e.jsx("option",{value:t.display,children:t.display},t.display))}),e.jsx("button",{onClick:z,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"🔄 Refresh"}),b?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:O,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"+ Add Panel"}),e.jsx("button",{onClick:H,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"💾 Save"})]}):null,A&&e.jsx("button",{onClick:A,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:b?"var(--color-warning, #f59e0b)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:b?"✓ Done":"âœī¸ Edit"})]}),c.variables.length>0&&M&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:c.variables.map(t=>{var o;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsxs("label",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:[t.label,":"]}),t.type==="textbox"?e.jsx("input",{type:"text",value:t.current,onChange:n=>v(t.id,n.target.value),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px",width:"120px"}}):e.jsx("select",{value:t.current,onChange:n=>v(t.id,n.target.value),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px"},children:(o=t.options)==null?void 0:o.map(n=>e.jsx("option",{value:n,children:n},n))})]},t.id)})}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gridAutoRows:"minmax(100px, auto)",gap:"16px"},children:c.panels.map(t=>e.jsxs("div",{style:{gridColumn:`span ${t.position.w}`,gridRow:`span ${t.position.h}`,background:"var(--bg-elevated, #252525)",borderRadius:"8px",overflow:"hidden",border:L===t.id?"2px solid #3b82f6":"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #1e1e1e)"},children:[e.jsx("span",{style:{flex:1,fontSize:"12px",fontWeight:500},children:t.title}),b&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>V(t),style:{padding:"2px 6px",marginLeft:"4px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:"10px"},children:"âœī¸"}),e.jsx("button",{onClick:()=>P(t.id),style:{padding:"2px 6px",marginLeft:"4px",borderRadius:"4px",border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"✕"})]})]}),e.jsx("div",{style:{height:"calc(100% - 40px)"},children:Q(t)})]},t.id))})}),N&&e.jsx("div",{style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.7)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"600px",maxHeight:"80vh",background:"var(--bg-elevated, #252525)",borderRadius:"12px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px",borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsxs("span",{style:{fontWeight:600},children:["Active Alerts (",y.length,")"]}),e.jsx("button",{onClick:()=>W(!1),style:{background:"none",border:"none",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:"✕"})]}),e.jsxs("div",{style:{maxHeight:"60vh",overflow:"auto"},children:[I.map(t=>{const o=re[t.severity];return e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--border-color, #333)",borderLeft:`4px solid ${o.color}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[e.jsx("span",{children:o.icon}),e.jsx("span",{style:{fontWeight:500},children:t.name}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",borderRadius:"4px",background:t.status==="firing"?"#ef444422":"#22c55e22",color:t.status==="firing"?"var(--color-error, #ef4444)":"var(--color-success, #22c55e)",fontSize:"10px"},children:t.status})]}),e.jsx("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"var(--text-muted, #888)"},children:t.message}),e.jsxs("div",{style:{display:"flex",gap:"8px",fontSize:"11px",color:"var(--text-muted, #666)"},children:[e.jsxs("span",{children:["Value: ",t.value]}),e.jsx("span",{children:"â€ĸ"}),e.jsxs("span",{children:["Threshold: ",t.threshold]}),e.jsx("span",{children:"â€ĸ"}),e.jsx("span",{children:new Date(t.startsAt).toLocaleString()})]}),t.status==="firing"&&T&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:()=>T(t.id),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Acknowledge"}),w&&e.jsx("button",{onClick:()=>w(t.id,36e5),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Silence 1h"})]})]},t.id)}),I.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--text-muted, #666)"},children:"No alerts"})]})]})})]})};exports.NiceLogExplorer=ee;exports.NiceMetricsDashboard=oe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("react"),$={trace:{color:"var(--text-muted, #888)",bg:"var(--nice-overlay-15, #88888822)",icon:"⋯"},debug:{color:"var(--color-accent, #8b5cf6)",bg:"#8b5cf622",icon:"🔍"},info:{color:"var(--color-primary, #3b82f6)",bg:"var(--nice-primary-tint-15, #3b82f622)",icon:"â„šī¸"},warn:{color:"var(--color-warning, #f59e0b)",bg:"var(--nice-warning-tint-15, #f59e0b22)",icon:"âš ī¸"},error:{color:"var(--color-error, #ef4444)",bg:"var(--nice-danger-tint-15, #ef444422)",icon:"❌"},fatal:{color:"var(--color-error, #dc2626)",bg:"#dc262622",icon:"💀"}},Z=[{label:"Last 5 min",value:"now-5m"},{label:"Last 15 min",value:"now-15m"},{label:"Last 30 min",value:"now-30m"},{label:"Last 1 hour",value:"now-1h"},{label:"Last 3 hours",value:"now-3h"},{label:"Last 6 hours",value:"now-6h"},{label:"Last 12 hours",value:"now-12h"},{label:"Last 24 hours",value:"now-24h"},{label:"Last 7 days",value:"now-7d"}],ee=({logs:x,streams:S,totalCount:I,isLoading:g,savedQueries:B,patterns:h=[],onQueryExecute:_,onQuerySave:E,onQueryDelete:F,onStreamToggle:q,onLogClick:T,onExport:k,onTailStart:V,onTailStop:O,isTailing:w=!1,className:b,style:A,"data-testid":P})=>{const[z,C]=a.useState(""),[N,W]=a.useState("now-1h"),[H,U]=a.useState(1e3),[R,Q]=a.useState(new Set(["trace","debug","info","warn","error","fatal"])),[y,M]=a.useState(new Set),[G,D]=a.useState(null),[t,o]=a.useState(!1),[n,v]=a.useState(""),[p,c]=a.useState("logs"),[d,u]=a.useState(""),s=a.useMemo(()=>x.filter(r=>!(!R.has(r.level)||d&&!r.message.toLowerCase().includes(d.toLowerCase()))),[x,R,d]),L=a.useMemo(()=>{const r={trace:0,debug:0,info:0,warn:0,error:0,fatal:0};return x.forEach(i=>r[i.level]++),r},[x]),f=()=>{_({query:z,timeRange:{from:N,to:"now"},limit:H,direction:"backward"})},m=r=>{M(i=>{const l=new Set(i);return l.has(r)?l.delete(r):l.add(r),l})},J=r=>{Q(i=>{const l=new Set(i);return l.has(r)?l.delete(r):l.add(r),l})},K=()=>{n.trim()&&(E(n,z),o(!1),v(""))},Y=r=>{if(!d)return r;const i=new RegExp(`(${d})`,"gi");return r.replace(i,'<mark style="background: var(--nice-warning, #f59e0b); color: black; padding: 0 var(--nice-space-0-5, 2px); border-radius: var(--nice-radius-sm, 2px);">$1</mark>')};return e.jsxs("div",{className:`nice-log-explorer ${b||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...A},"data-testid":P,children:[e.jsxs("div",{style:{padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsxs("div",{style:{display:"flex",gap:"8px",marginBottom:"12px"},children:[e.jsx("input",{type:"text",value:z,onChange:r=>C(r.target.value),placeholder:'Enter query... e.g., {service="api"} |= "error"',onKeyDown:r=>r.key==="Enter"&&f(),style:{flex:1,padding:"10px 16px",borderRadius:"8px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"13px",fontFamily:"monospace"}}),e.jsx("select",{value:N,onChange:r=>W(r.target.value),style:{padding:"10px 12px",borderRadius:"8px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"12px"},children:Z.map(r=>e.jsx("option",{value:r.value,children:r.label},r.value))}),e.jsxs("button",{onClick:f,disabled:g,style:{padding:"10px 24px",borderRadius:"8px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:g?"not-allowed":"pointer",fontSize:"13px",fontWeight:500,opacity:g?.7:1},children:[g?"âŗ":"🔍"," Search"]}),e.jsx("button",{onClick:()=>o(!0),style:{padding:"10px 12px",borderRadius:"8px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"💾"}),V&&e.jsx("button",{onClick:w?O:V,style:{padding:"10px 16px",borderRadius:"8px",border:"none",background:w?"var(--color-success, #22c55e)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:w?"⏚ Stop":"â–ļ Tail"})]}),e.jsxs("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[e.jsx("span",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:"Levels:"}),Object.keys($).map(r=>{const i=$[r],l=L[r],j=R.has(r);return e.jsxs("button",{onClick:()=>J(r),style:{display:"flex",alignItems:"center",gap:"4px",padding:"4px 10px",borderRadius:"4px",border:"none",background:j?i.bg:"transparent",color:j?i.color:"var(--text-muted, #666)",cursor:"pointer",fontSize:"11px",opacity:j?1:.5},children:[r.toUpperCase()," (",l,")"]},r)}),e.jsx("div",{style:{flex:1}}),e.jsx("input",{type:"text",value:d,onChange:r=>u(r.target.value),placeholder:"Filter results...",style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px",width:"150px"}})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",overflow:"hidden"},children:[e.jsxs("div",{style:{width:"220px",borderRight:"1px solid var(--border-color, #333)",display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px"},children:[e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:"11px",color:"var(--text-muted, #888)",textTransform:"uppercase"},children:"Log Streams"}),S.map(r=>e.jsxs("label",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 0",cursor:"pointer",fontSize:"12px"},children:[e.jsx("input",{type:"checkbox",defaultChecked:!0,onChange:i=>q(r.id,i.target.checked)}),e.jsx("span",{style:{width:"8px",height:"8px",borderRadius:"50%",background:r.color}}),e.jsx("span",{children:r.name})]},r.id)),S.length===0&&e.jsx("div",{style:{color:"var(--text-muted, #666)",fontSize:"11px"},children:"No streams discovered"})]}),e.jsxs("div",{style:{borderTop:"1px solid var(--border-color, #333)",padding:"12px",maxHeight:"200px",overflow:"auto"},children:[e.jsx("h4",{style:{margin:"0 0 8px 0",fontSize:"11px",color:"var(--text-muted, #888)",textTransform:"uppercase"},children:"Saved Queries"}),B.map(r=>e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",padding:"6px 8px",marginBottom:"4px",background:"var(--bg-elevated, #252525)",borderRadius:"4px",cursor:"pointer",fontSize:"11px"},onClick:()=>C(r.query),children:[e.jsx("span",{style:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r.name}),e.jsx("button",{onClick:i=>{i.stopPropagation(),F(r.id)},style:{background:"none",border:"none",color:"var(--text-muted, #666)",cursor:"pointer",fontSize:"10px"},children:"✕"})]},r.id)),B.length===0&&e.jsx("div",{style:{color:"var(--text-muted, #666)",fontSize:"11px"},children:"No saved queries"})]})]}),e.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",borderBottom:"1px solid var(--border-color, #333)"},children:[[{id:"logs",label:`📜 Logs (${s.length})`},{id:"patterns",label:`đŸ”Ŧ Patterns (${h.length})`}].map(r=>e.jsx("button",{onClick:()=>c(r.id),style:{padding:"10px 20px",border:"none",background:p===r.id?"var(--bg-elevated, #1e1e1e)":"transparent",color:p===r.id?"var(--bg-primary, #fff)":"var(--text-muted, #888)",cursor:"pointer",fontSize:"12px",borderBottom:p===r.id?"2px solid var(--nice-primary, #3b82f6)":"2px solid transparent"},children:r.label},r.id)),e.jsx("div",{style:{flex:1}}),e.jsxs("div",{style:{display:"flex",gap:"8px",padding:"8px"},children:[e.jsx("button",{onClick:()=>k("json"),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"JSON"}),e.jsx("button",{onClick:()=>k("csv"),style:{padding:"4px 8px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"CSV"})]})]}),p==="logs"&&e.jsxs("div",{style:{flex:1,overflow:"auto",fontFamily:"monospace",fontSize:"12px"},children:[s.map(r=>{const i=$[r.level],l=y.has(r.id);return e.jsxs("div",{style:{borderBottom:"1px solid var(--nice-bg-secondary, #252525)"},children:[e.jsxs("div",{onClick:()=>m(r.id),style:{display:"flex",alignItems:"flex-start",gap:"8px",padding:"6px 12px",cursor:"pointer",background:l?"var(--bg-elevated, #252525)":"transparent"},children:[e.jsx("span",{style:{color:"var(--text-muted, #666)",fontSize:"10px",minWidth:"160px"},children:new Date(r.timestamp).toISOString()}),e.jsx("span",{style:{padding:"2px 6px",borderRadius:"4px",background:i.bg,color:i.color,fontSize:"10px",fontWeight:500,minWidth:"50px",textAlign:"center"},children:r.level.toUpperCase()}),r.service&&e.jsxs("span",{style:{color:"var(--color-accent, #8b5cf6)",fontSize:"10px",minWidth:"80px"},children:["[",r.service,"]"]}),e.jsx("span",{style:{flex:1,whiteSpace:"pre-wrap",wordBreak:"break-all"},dangerouslySetInnerHTML:{__html:Y(r.message)}})]}),l&&e.jsxs("div",{style:{padding:"12px 12px 12px 200px",background:"var(--bg-elevated, #252525)",borderTop:"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(3, 1fr)",gap:"12px",marginBottom:"12px"},children:[e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"2px"},children:"Source"}),e.jsx("div",{style:{fontSize:"11px"},children:r.source})]}),r.host&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"2px"},children:"Host"}),e.jsx("div",{style:{fontSize:"11px"},children:r.host})]}),r.traceId&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"2px"},children:"Trace ID"}),e.jsx("div",{style:{fontSize:"11px",fontFamily:"monospace"},children:r.traceId})]})]}),Object.keys(r.attributes).length>0&&e.jsxs("div",{style:{marginBottom:"12px"},children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"4px"},children:"Attributes"}),e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"4px"},children:Object.entries(r.attributes).map(([j,X])=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",fontSize:"10px"},children:[j,"=",String(X)]},j))})]}),r.stackTrace&&e.jsxs("div",{children:[e.jsx("div",{style:{fontSize:"10px",color:"var(--text-muted, #888)",marginBottom:"4px"},children:"Stack Trace"}),e.jsx("pre",{style:{margin:0,padding:"8px",background:"var(--bg-elevated, #1e1e1e)",borderRadius:"4px",fontSize:"10px",overflow:"auto",maxHeight:"200px",color:"var(--color-error, #ef4444)"},children:r.stackTrace})]}),e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:()=>T(r),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"View Details"}),r.traceId&&e.jsx("button",{onClick:()=>C(`{traceId="${r.traceId}"}`),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"Show Trace"})]})]})]},r.id)}),s.length===0&&!g&&e.jsxs("div",{style:{padding:"48px",textAlign:"center",color:"var(--text-muted, #666)"},children:[e.jsx("span",{style:{fontSize:"48px"},children:"📭"}),e.jsx("p",{style:{marginTop:"16px"},children:"No logs match your query"})]}),g&&e.jsxs("div",{style:{padding:"48px",textAlign:"center",color:"var(--text-muted, #666)"},children:[e.jsx("span",{style:{fontSize:"48px"},children:"âŗ"}),e.jsx("p",{style:{marginTop:"16px"},children:"Loading logs..."})]})]}),p==="patterns"&&e.jsxs("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:[h.map(r=>{const i=$[r.level];return e.jsxs("div",{style:{marginBottom:"12px",padding:"16px",background:"var(--bg-elevated, #252525)",borderRadius:"8px",borderLeft:`3px solid ${i.color}`},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",marginBottom:"8px"},children:[e.jsx("span",{style:{fontFamily:"monospace",fontSize:"12px",fontWeight:500},children:r.pattern}),e.jsxs("span",{style:{padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",fontSize:"11px"},children:[r.count," occurrences"]})]}),e.jsxs("div",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:["Sample: ",r.samples[0]]})]},r.id)}),h.length===0&&e.jsx("div",{style:{padding:"48px",textAlign:"center",color:"var(--text-muted, #666)"},children:e.jsx("p",{children:"No patterns detected. Run a query first."})})]})]})]}),t&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"400px",background:"var(--bg-elevated, #252525)",borderRadius:"12px",padding:"24px"},children:[e.jsx("h3",{style:{margin:"0 0 16px 0",fontSize:"14px"},children:"Save Query"}),e.jsx("input",{type:"text",value:n,onChange:r=>v(r.target.value),placeholder:"Query name...",style:{width:"100%",padding:"10px",borderRadius:"8px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"13px",marginBottom:"16px"}}),e.jsxs("div",{style:{display:"flex",justifyContent:"flex-end",gap:"8px"},children:[e.jsx("button",{onClick:()=>o(!1),style:{padding:"8px 16px",borderRadius:"6px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Cancel"}),e.jsx("button",{onClick:K,style:{padding:"8px 16px",borderRadius:"6px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Save"})]})]})})]})},re={critical:{color:"var(--color-error, #ef4444)",icon:"🔴"},warning:{color:"var(--color-warning, #f59e0b)",icon:"🟡"},info:{color:"var(--color-primary, #3b82f6)",icon:"đŸ”ĩ"}},te=[{from:"now-5m",to:"now",display:"Last 5 minutes"},{from:"now-15m",to:"now",display:"Last 15 minutes"},{from:"now-1h",to:"now",display:"Last 1 hour"},{from:"now-3h",to:"now",display:"Last 3 hours"},{from:"now-6h",to:"now",display:"Last 6 hours"},{from:"now-12h",to:"now",display:"Last 12 hours"},{from:"now-24h",to:"now",display:"Last 24 hours"},{from:"now-7d",to:"now",display:"Last 7 days"},{from:"now-30d",to:"now",display:"Last 30 days"}],oe=({dashboard:x,metrics:S,alerts:I=[],timeRanges:g=te,onTimeRangeChange:B,onVariableChange:h,onPanelEdit:_,onPanelAdd:E,onPanelRemove:F,onPanelMove:q,onAlertAcknowledge:T,onAlertSilence:k,onQueryExecute:V,onDashboardSave:O,onRefresh:w,isEditing:b=!1,onEditModeToggle:A,className:P,style:z,"data-testid":C})=>{const[N,W]=a.useState(!1),[H,U]=a.useState(!0),[R,Q]=a.useState(null),y=I.filter(t=>t.status==="firing"),M=t=>{var n,v,p;const o=(n=t.queries[0])!=null&&n.expression?S[t.queries[0].expression]:null;switch(t.type){case"stat":return e.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",flexDirection:"column"},children:[e.jsx("div",{style:{fontSize:"48px",fontWeight:600,color:o?D(o.currentValue,t.thresholds):"var(--text-primary, #e0e0e0)"},children:(o==null?void 0:o.currentValue.toFixed(2))??"-"}),(o==null?void 0:o.unit)&&e.jsx("div",{style:{fontSize:"14px",color:"var(--text-muted, #888)",marginTop:"4px"},children:o.unit})]});case"gauge":{const c=(o==null?void 0:o.currentValue)??0,d=((p=(v=t.thresholds)==null?void 0:v[t.thresholds.length-1])==null?void 0:p.value)??100,u=Math.min(c/d*100,100);return e.jsx("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",height:"100%"},children:e.jsxs("svg",{viewBox:"0 0 100 60",style:{width:"100%",maxWidth:"200px"},children:[e.jsx("path",{d:"M 10 50 A 40 40 0 0 1 90 50",fill:"none",stroke:"var(--nice-text, #333)",strokeWidth:"8"}),e.jsx("path",{d:"M 10 50 A 40 40 0 0 1 90 50",fill:"none",stroke:D(c,t.thresholds),strokeWidth:"8",strokeDasharray:`${u*1.26} 126`}),e.jsx("text",{x:"50",y:"45",textAnchor:"middle",fill:"var(--nice-border, #e0e0e0)",fontSize:"16",fontWeight:"600",children:c.toFixed(1)})]})})}case"timeseries":return G(t,o);case"table":return e.jsx("div",{style:{overflow:"auto",height:"100%"},children:e.jsxs("table",{style:{width:"100%",fontSize:"11px",borderCollapse:"collapse"},children:[e.jsx("thead",{children:e.jsxs("tr",{style:{background:"var(--bg-elevated, #252525)"},children:[e.jsx("th",{style:{padding:"6px 8px",textAlign:"left",borderBottom:"1px solid var(--border-color, #333)"},children:"Time"}),e.jsx("th",{style:{padding:"6px 8px",textAlign:"right",borderBottom:"1px solid var(--border-color, #333)"},children:"Value"})]})}),e.jsx("tbody",{children:o==null?void 0:o.values.slice(-10).reverse().map((c,d)=>e.jsxs("tr",{children:[e.jsx("td",{style:{padding:"4px 8px",borderBottom:"1px solid var(--border-color, #333)"},children:new Date(c.timestamp).toLocaleTimeString()}),e.jsxs("td",{style:{padding:"4px 8px",borderBottom:"1px solid var(--border-color, #333)",textAlign:"right"},children:[c.value.toFixed(2)," ",o.unit]})]},d))})]})});case"bar_gauge":return e.jsx("div",{style:{padding:"8px",height:"100%",display:"flex",flexDirection:"column",justifyContent:"center"},children:t.queries.map((c,d)=>{var f,m;const u=S[c.expression],s=(u==null?void 0:u.currentValue)??0,L=((m=(f=t.thresholds)==null?void 0:f[t.thresholds.length-1])==null?void 0:m.value)??100;return e.jsxs("div",{style:{marginBottom:"8px"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:"11px",marginBottom:"4px"},children:[e.jsx("span",{children:c.legendFormat??c.expression}),e.jsx("span",{children:s.toFixed(1)})]}),e.jsx("div",{style:{height:"16px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",overflow:"hidden"},children:e.jsx("div",{style:{height:"100%",width:`${s/L*100}%`,background:D(s,t.thresholds),borderRadius:"4px"}})})]},d)})});case"text":return e.jsx("div",{style:{padding:"12px",fontSize:"12px",lineHeight:"1.6"},children:t.description});default:return e.jsx("div",{style:{padding:"12px",color:"var(--text-muted, #666)"},children:"Unsupported panel type"})}},G=(t,o)=>{const n=(o==null?void 0:o.values)??[];if(n.length===0)return e.jsx("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",height:"100%",color:"var(--text-muted, #666)"},children:"No data"});const v=n.map(s=>s.value),p=Math.min(...v),d=Math.max(...v)-p||1,u=n.map((s,L)=>{const f=L/(n.length-1)*100,m=100-(s.value-p)/d*80;return`${f},${m}`}).join(" ");return e.jsxs("svg",{viewBox:"0 0 100 100",preserveAspectRatio:"none",style:{width:"100%",height:"100%"},children:[[0,25,50,75,100].map(s=>e.jsx("line",{x1:"0",y1:s,x2:"100",y2:s,stroke:"var(--nice-text, #333)",strokeWidth:"0.5"},s)),t.chartType==="area"||t.chartType==="stacked_area"?e.jsx("polygon",{points:`0,100 ${u} 100,100`,fill:"var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))"}):null,e.jsx("polyline",{points:u,fill:"none",stroke:"var(--nice-primary, #3b82f6)",strokeWidth:"1"})]})},D=(t,o)=>{if(!o||o.length===0)return"var(--color-primary, #3b82f6)";for(let n=o.length-1;n>=0;n--)if(t>=o[n].value)return o[n].color;return"var(--color-success, #22c55e)"};return e.jsxs("div",{className:`nice-metrics-dashboard ${P||""}`,style:{display:"flex",flexDirection:"column",height:"100%",background:"var(--bg-elevated, #1e1e1e)",color:"var(--text-primary, #e0e0e0)",...z},"data-testid":C,children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"12px",padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:[e.jsx("span",{style:{fontSize:"20px"},children:"📊"}),e.jsx("span",{style:{fontWeight:500,fontSize:"14px"},children:x.name}),e.jsx("div",{style:{flex:1}}),y.length>0&&e.jsxs("button",{onClick:()=>W(!0),style:{display:"flex",alignItems:"center",gap:"6px",padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--nice-danger-tint-15, #ef444422)",color:"var(--color-error, #ef4444)",cursor:"pointer",fontSize:"12px"},children:["🔴 ",y.length," Alert",y.length!==1&&"s"]}),e.jsx("select",{value:x.timeRange.display,onChange:t=>{const o=g.find(n=>n.display===t.target.value);o&&B(o)},style:{padding:"6px 12px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"12px"},children:g.map(t=>e.jsx("option",{value:t.display,children:t.display},t.display))}),e.jsx("button",{onClick:w,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"🔄 Refresh"}),b?e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:E,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"+ Add Panel"}),e.jsx("button",{onClick:O,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:"var(--color-success, #22c55e)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:"💾 Save"})]}):null,A&&e.jsx("button",{onClick:A,style:{padding:"6px 12px",borderRadius:"4px",border:"none",background:b?"var(--color-warning, #f59e0b)":"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"12px"},children:b?"✓ Done":"âœī¸ Edit"})]}),x.variables.length>0&&H&&e.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:"12px",padding:"12px 16px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #252525)"},children:x.variables.map(t=>{var o;return e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px"},children:[e.jsxs("label",{style:{fontSize:"11px",color:"var(--text-muted, #888)"},children:[t.label,":"]}),t.type==="textbox"?e.jsx("input",{type:"text",value:t.current,onChange:n=>h(t.id,n.target.value),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px",width:"120px"}}):e.jsx("select",{value:t.current,onChange:n=>h(t.id,n.target.value),style:{padding:"4px 8px",borderRadius:"4px",border:"1px solid var(--border-color, #444)",background:"var(--bg-elevated, #1e1e1e)",color:"var(--bg-primary, #fff)",fontSize:"11px"},children:(o=t.options)==null?void 0:o.map(n=>e.jsx("option",{value:n,children:n},n))})]},t.id)})}),e.jsx("div",{style:{flex:1,overflow:"auto",padding:"16px"},children:e.jsx("div",{style:{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gridAutoRows:"minmax(100px, auto)",gap:"16px"},children:x.panels.map(t=>e.jsxs("div",{style:{gridColumn:`span ${t.position.w}`,gridRow:`span ${t.position.h}`,background:"var(--bg-elevated, #252525)",borderRadius:"8px",overflow:"hidden",border:R===t.id?"2px solid var(--nice-primary, #3b82f6)":"1px solid var(--border-color, #333)"},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"8px 12px",borderBottom:"1px solid var(--border-color, #333)",background:"var(--bg-elevated, #1e1e1e)"},children:[e.jsx("span",{style:{flex:1,fontSize:"12px",fontWeight:500},children:t.title}),b&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>_(t),style:{padding:"2px 6px",marginLeft:"4px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:"10px"},children:"âœī¸"}),e.jsx("button",{onClick:()=>F(t.id),style:{padding:"2px 6px",marginLeft:"4px",borderRadius:"4px",border:"none",background:"var(--color-error, #ef4444)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"10px"},children:"✕"})]})]}),e.jsx("div",{style:{height:"calc(100% - 40px)"},children:M(t)})]},t.id))})}),N&&e.jsx("div",{style:{position:"fixed",inset:0,background:"var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",display:"flex",alignItems:"center",justifyContent:"center",zIndex:1e3},children:e.jsxs("div",{style:{width:"600px",maxHeight:"80vh",background:"var(--bg-elevated, #252525)",borderRadius:"12px",overflow:"hidden"},children:[e.jsxs("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center",padding:"16px",borderBottom:"1px solid var(--border-color, #333)"},children:[e.jsxs("span",{style:{fontWeight:600},children:["Active Alerts (",y.length,")"]}),e.jsx("button",{onClick:()=>W(!1),style:{background:"none",border:"none",color:"var(--text-muted, #888)",cursor:"pointer",fontSize:"18px"},children:"✕"})]}),e.jsxs("div",{style:{maxHeight:"60vh",overflow:"auto"},children:[I.map(t=>{const o=re[t.severity];return e.jsxs("div",{style:{padding:"16px",borderBottom:"1px solid var(--border-color, #333)",borderLeft:`4px solid ${o.color}`},children:[e.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"8px",marginBottom:"8px"},children:[e.jsx("span",{children:o.icon}),e.jsx("span",{style:{fontWeight:500},children:t.name}),e.jsx("span",{style:{marginLeft:"auto",padding:"2px 8px",borderRadius:"4px",background:t.status==="firing"?"var(--nice-danger-tint-15, #ef444422)":"var(--nice-success-tint-15, #22c55e22)",color:t.status==="firing"?"var(--color-error, #ef4444)":"var(--color-success, #22c55e)",fontSize:"10px"},children:t.status})]}),e.jsx("p",{style:{margin:"0 0 8px 0",fontSize:"12px",color:"var(--text-muted, #888)"},children:t.message}),e.jsxs("div",{style:{display:"flex",gap:"8px",fontSize:"11px",color:"var(--text-muted, #666)"},children:[e.jsxs("span",{children:["Value: ",t.value]}),e.jsx("span",{children:"â€ĸ"}),e.jsxs("span",{children:["Threshold: ",t.threshold]}),e.jsx("span",{children:"â€ĸ"}),e.jsx("span",{children:new Date(t.startsAt).toLocaleString()})]}),t.status==="firing"&&T&&e.jsxs("div",{style:{marginTop:"12px",display:"flex",gap:"8px"},children:[e.jsx("button",{onClick:()=>T(t.id),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Acknowledge"}),k&&e.jsx("button",{onClick:()=>k(t.id,36e5),style:{padding:"4px 12px",borderRadius:"4px",border:"none",background:"var(--bg-tertiary, #333)",color:"var(--bg-primary, #fff)",cursor:"pointer",fontSize:"11px"},children:"Silence 1h"})]})]},t.id)}),I.length===0&&e.jsx("div",{style:{padding:"24px",textAlign:"center",color:"var(--text-muted, #666)"},children:"No alerts"})]})]})})]})};exports.NiceLogExplorer=ee;exports.NiceMetricsDashboard=oe;
package/dist/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { jsxs as t, jsx as e, Fragment as X } from "react/jsx-runtime";
2
- import { useState as s, useMemo as Z } from "react";
3
- const V = {
4
- trace: { color: "var(--text-muted, #888)", bg: "#88888822", icon: "⋯" },
1
+ import { jsxs as t, jsx as e, Fragment as J } from "react/jsx-runtime";
2
+ import { useState as p, useMemo as K } from "react";
3
+ const _ = {
4
+ trace: { color: "var(--text-muted, #888)", bg: "var(--nice-overlay-15, #88888822)", icon: "⋯" },
5
5
  debug: { color: "var(--color-accent, #8b5cf6)", bg: "#8b5cf622", icon: "🔍" },
6
- info: { color: "var(--color-primary, #3b82f6)", bg: "#3b82f622", icon: "â„šī¸" },
7
- warn: { color: "var(--color-warning, #f59e0b)", bg: "#f59e0b22", icon: "âš ī¸" },
8
- error: { color: "var(--color-error, #ef4444)", bg: "#ef444422", icon: "❌" },
6
+ info: { color: "var(--color-primary, #3b82f6)", bg: "var(--nice-primary-tint-15, #3b82f622)", icon: "â„šī¸" },
7
+ warn: { color: "var(--color-warning, #f59e0b)", bg: "var(--nice-warning-tint-15, #f59e0b22)", icon: "âš ī¸" },
8
+ error: { color: "var(--color-error, #ef4444)", bg: "var(--nice-danger-tint-15, #ef444422)", icon: "❌" },
9
9
  fatal: { color: "var(--color-error, #dc2626)", bg: "#dc262622", icon: "💀" }
10
10
  }, te = [
11
11
  { label: "Last 5 min", value: "now-5m" },
@@ -17,29 +17,29 @@ const V = {
17
17
  { label: "Last 12 hours", value: "now-12h" },
18
18
  { label: "Last 24 hours", value: "now-24h" },
19
19
  { label: "Last 7 days", value: "now-7d" }
20
- ], ae = ({
21
- logs: p,
22
- streams: z,
20
+ ], de = ({
21
+ logs: u,
22
+ streams: w,
23
23
  totalCount: T,
24
- isLoading: u,
24
+ isLoading: v,
25
25
  savedQueries: A,
26
26
  patterns: b = [],
27
- onQueryExecute: O,
28
- onQuerySave: _,
29
- onQueryDelete: H,
30
- onStreamToggle: J,
27
+ onQueryExecute: E,
28
+ onQuerySave: F,
29
+ onQueryDelete: V,
30
+ onStreamToggle: G,
31
31
  onLogClick: W,
32
- onExport: C,
33
- onTailStart: P,
34
- onTailStop: Q,
35
- isTailing: R = !1,
32
+ onExport: z,
33
+ onTailStart: O,
34
+ onTailStop: P,
35
+ isTailing: C = !1,
36
36
  className: y,
37
37
  style: j,
38
- "data-testid": q
38
+ "data-testid": H
39
39
  }) => {
40
- const [L, I] = s(""), [N, $] = s("now-1h"), [G, ee] = s(1e3), [B, K] = s(
40
+ const [R, L] = p(""), [N, $] = p("now-1h"), [Q, Y] = p(1e3), [I, M] = p(
41
41
  /* @__PURE__ */ new Set(["trace", "debug", "info", "warn", "error", "fatal"])
42
- ), [m, M] = s(/* @__PURE__ */ new Set()), [Y, D] = s(null), [o, n] = s(!1), [i, g] = s(""), [c, S] = s("logs"), [x, k] = s(""), a = Z(() => p.filter((r) => !(!B.has(r.level) || x && !r.message.toLowerCase().includes(x.toLowerCase()))), [p, B, x]), h = Z(() => {
42
+ ), [m, q] = p(/* @__PURE__ */ new Set()), [U, D] = p(null), [o, n] = p(!1), [i, f] = p(""), [x, c] = p("logs"), [l, g] = p(""), d = K(() => u.filter((r) => !(!I.has(r.level) || l && !r.message.toLowerCase().includes(l.toLowerCase()))), [u, I, l]), B = K(() => {
43
43
  const r = {
44
44
  trace: 0,
45
45
  debug: 0,
@@ -48,33 +48,33 @@ const V = {
48
48
  error: 0,
49
49
  fatal: 0
50
50
  };
51
- return p.forEach((d) => r[d.level]++), r;
52
- }, [p]), f = () => {
53
- O({
54
- query: L,
51
+ return u.forEach((a) => r[a.level]++), r;
52
+ }, [u]), h = () => {
53
+ E({
54
+ query: R,
55
55
  timeRange: { from: N, to: "now" },
56
- limit: G,
56
+ limit: Q,
57
57
  direction: "backward"
58
58
  });
59
- }, v = (r) => {
60
- M((d) => {
61
- const l = new Set(d);
62
- return l.has(r) ? l.delete(r) : l.add(r), l;
59
+ }, S = (r) => {
60
+ q((a) => {
61
+ const s = new Set(a);
62
+ return s.has(r) ? s.delete(r) : s.add(r), s;
63
63
  });
64
- }, U = (r) => {
65
- K((d) => {
66
- const l = new Set(d);
67
- return l.has(r) ? l.delete(r) : l.add(r), l;
64
+ }, X = (r) => {
65
+ M((a) => {
66
+ const s = new Set(a);
67
+ return s.has(r) ? s.delete(r) : s.add(r), s;
68
68
  });
69
- }, E = () => {
70
- i.trim() && (_(i, L), n(!1), g(""));
71
- }, F = (r) => {
72
- if (!x)
69
+ }, Z = () => {
70
+ i.trim() && (F(i, R), n(!1), f(""));
71
+ }, ee = (r) => {
72
+ if (!l)
73
73
  return r;
74
- const d = new RegExp(`(${x})`, "gi");
74
+ const a = new RegExp(`(${l})`, "gi");
75
75
  return r.replace(
76
- d,
77
- '<mark style="background: #f59e0b; color: black; padding: 0 2px; border-radius: 2px;">$1</mark>'
76
+ a,
77
+ '<mark style="background: var(--nice-warning, #f59e0b); color: black; padding: 0 var(--nice-space-0-5, 2px); border-radius: var(--nice-radius-sm, 2px);">$1</mark>'
78
78
  );
79
79
  };
80
80
  return /* @__PURE__ */ t(
@@ -89,7 +89,7 @@ const V = {
89
89
  color: "var(--text-primary, #e0e0e0)",
90
90
  ...j
91
91
  },
92
- "data-testid": q,
92
+ "data-testid": H,
93
93
  children: [
94
94
  /* @__PURE__ */ t(
95
95
  "div",
@@ -105,10 +105,10 @@ const V = {
105
105
  "input",
106
106
  {
107
107
  type: "text",
108
- value: L,
109
- onChange: (r) => I(r.target.value),
108
+ value: R,
109
+ onChange: (r) => L(r.target.value),
110
110
  placeholder: 'Enter query... e.g., {service="api"} |= "error"',
111
- onKeyDown: (r) => r.key === "Enter" && f(),
111
+ onKeyDown: (r) => r.key === "Enter" && h(),
112
112
  style: {
113
113
  flex: 1,
114
114
  padding: "10px 16px",
@@ -140,21 +140,21 @@ const V = {
140
140
  /* @__PURE__ */ t(
141
141
  "button",
142
142
  {
143
- onClick: f,
144
- disabled: u,
143
+ onClick: h,
144
+ disabled: v,
145
145
  style: {
146
146
  padding: "10px 24px",
147
147
  borderRadius: "8px",
148
148
  border: "none",
149
149
  background: "var(--color-primary, #3b82f6)",
150
150
  color: "var(--bg-primary, #fff)",
151
- cursor: u ? "not-allowed" : "pointer",
151
+ cursor: v ? "not-allowed" : "pointer",
152
152
  fontSize: "13px",
153
153
  fontWeight: 500,
154
- opacity: u ? 0.7 : 1
154
+ opacity: v ? 0.7 : 1
155
155
  },
156
156
  children: [
157
- u ? "âŗ" : "🔍",
157
+ v ? "âŗ" : "🔍",
158
158
  " Search"
159
159
  ]
160
160
  }
@@ -175,31 +175,31 @@ const V = {
175
175
  children: "💾"
176
176
  }
177
177
  ),
178
- P && /* @__PURE__ */ e(
178
+ O && /* @__PURE__ */ e(
179
179
  "button",
180
180
  {
181
- onClick: R ? Q : P,
181
+ onClick: C ? P : O,
182
182
  style: {
183
183
  padding: "10px 16px",
184
184
  borderRadius: "8px",
185
185
  border: "none",
186
- background: R ? "var(--color-success, #22c55e)" : "var(--bg-tertiary, #333)",
186
+ background: C ? "var(--color-success, #22c55e)" : "var(--bg-tertiary, #333)",
187
187
  color: "var(--bg-primary, #fff)",
188
188
  cursor: "pointer",
189
189
  fontSize: "12px"
190
190
  },
191
- children: R ? "⏚ Stop" : "â–ļ Tail"
191
+ children: C ? "⏚ Stop" : "â–ļ Tail"
192
192
  }
193
193
  )
194
194
  ] }),
195
195
  /* @__PURE__ */ t("div", { style: { display: "flex", gap: "8px", alignItems: "center" }, children: [
196
196
  /* @__PURE__ */ e("span", { style: { fontSize: "11px", color: "var(--text-muted, #888)" }, children: "Levels:" }),
197
- Object.keys(V).map((r) => {
198
- const d = V[r], l = h[r], w = B.has(r);
197
+ Object.keys(_).map((r) => {
198
+ const a = _[r], s = B[r], k = I.has(r);
199
199
  return /* @__PURE__ */ t(
200
200
  "button",
201
201
  {
202
- onClick: () => U(r),
202
+ onClick: () => X(r),
203
203
  style: {
204
204
  display: "flex",
205
205
  alignItems: "center",
@@ -207,16 +207,16 @@ const V = {
207
207
  padding: "4px 10px",
208
208
  borderRadius: "4px",
209
209
  border: "none",
210
- background: w ? d.bg : "transparent",
211
- color: w ? d.color : "var(--text-muted, #666)",
210
+ background: k ? a.bg : "transparent",
211
+ color: k ? a.color : "var(--text-muted, #666)",
212
212
  cursor: "pointer",
213
213
  fontSize: "11px",
214
- opacity: w ? 1 : 0.5
214
+ opacity: k ? 1 : 0.5
215
215
  },
216
216
  children: [
217
217
  r.toUpperCase(),
218
218
  " (",
219
- l,
219
+ s,
220
220
  ")"
221
221
  ]
222
222
  },
@@ -228,8 +228,8 @@ const V = {
228
228
  "input",
229
229
  {
230
230
  type: "text",
231
- value: x,
232
- onChange: (r) => k(r.target.value),
231
+ value: l,
232
+ onChange: (r) => g(r.target.value),
233
233
  placeholder: "Filter results...",
234
234
  style: {
235
235
  padding: "4px 8px",
@@ -271,7 +271,7 @@ const V = {
271
271
  children: "Log Streams"
272
272
  }
273
273
  ),
274
- z.map((r) => /* @__PURE__ */ t(
274
+ w.map((r) => /* @__PURE__ */ t(
275
275
  "label",
276
276
  {
277
277
  style: {
@@ -288,7 +288,7 @@ const V = {
288
288
  {
289
289
  type: "checkbox",
290
290
  defaultChecked: !0,
291
- onChange: (d) => J(r.id, d.target.checked)
291
+ onChange: (a) => G(r.id, a.target.checked)
292
292
  }
293
293
  ),
294
294
  /* @__PURE__ */ e(
@@ -307,7 +307,7 @@ const V = {
307
307
  },
308
308
  r.id
309
309
  )),
310
- z.length === 0 && /* @__PURE__ */ e("div", { style: { color: "var(--text-muted, #666)", fontSize: "11px" }, children: "No streams discovered" })
310
+ w.length === 0 && /* @__PURE__ */ e("div", { style: { color: "var(--text-muted, #666)", fontSize: "11px" }, children: "No streams discovered" })
311
311
  ] }),
312
312
  /* @__PURE__ */ t(
313
313
  "div",
@@ -345,7 +345,7 @@ const V = {
345
345
  cursor: "pointer",
346
346
  fontSize: "11px"
347
347
  },
348
- onClick: () => I(r.query),
348
+ onClick: () => L(r.query),
349
349
  children: [
350
350
  /* @__PURE__ */ e(
351
351
  "span",
@@ -362,8 +362,8 @@ const V = {
362
362
  /* @__PURE__ */ e(
363
363
  "button",
364
364
  {
365
- onClick: (d) => {
366
- d.stopPropagation(), H(r.id);
365
+ onClick: (a) => {
366
+ a.stopPropagation(), V(r.id);
367
367
  },
368
368
  style: {
369
369
  background: "none",
@@ -389,20 +389,20 @@ const V = {
389
389
  /* @__PURE__ */ t("div", { style: { flex: 1, display: "flex", flexDirection: "column", overflow: "hidden" }, children: [
390
390
  /* @__PURE__ */ t("div", { style: { display: "flex", borderBottom: "1px solid var(--border-color, #333)" }, children: [
391
391
  [
392
- { id: "logs", label: `📜 Logs (${a.length})` },
392
+ { id: "logs", label: `📜 Logs (${d.length})` },
393
393
  { id: "patterns", label: `đŸ”Ŧ Patterns (${b.length})` }
394
394
  ].map((r) => /* @__PURE__ */ e(
395
395
  "button",
396
396
  {
397
- onClick: () => S(r.id),
397
+ onClick: () => c(r.id),
398
398
  style: {
399
399
  padding: "10px 20px",
400
400
  border: "none",
401
- background: c === r.id ? "var(--bg-elevated, #1e1e1e)" : "transparent",
402
- color: c === r.id ? "var(--bg-primary, #fff)" : "var(--text-muted, #888)",
401
+ background: x === r.id ? "var(--bg-elevated, #1e1e1e)" : "transparent",
402
+ color: x === r.id ? "var(--bg-primary, #fff)" : "var(--text-muted, #888)",
403
403
  cursor: "pointer",
404
404
  fontSize: "12px",
405
- borderBottom: c === r.id ? "2px solid #3b82f6" : "2px solid transparent"
405
+ borderBottom: x === r.id ? "2px solid var(--nice-primary, #3b82f6)" : "2px solid transparent"
406
406
  },
407
407
  children: r.label
408
408
  },
@@ -413,7 +413,7 @@ const V = {
413
413
  /* @__PURE__ */ e(
414
414
  "button",
415
415
  {
416
- onClick: () => C("json"),
416
+ onClick: () => z("json"),
417
417
  style: {
418
418
  padding: "4px 8px",
419
419
  borderRadius: "4px",
@@ -429,7 +429,7 @@ const V = {
429
429
  /* @__PURE__ */ e(
430
430
  "button",
431
431
  {
432
- onClick: () => C("csv"),
432
+ onClick: () => z("csv"),
433
433
  style: {
434
434
  padding: "4px 8px",
435
435
  borderRadius: "4px",
@@ -444,21 +444,21 @@ const V = {
444
444
  )
445
445
  ] })
446
446
  ] }),
447
- c === "logs" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", fontFamily: "monospace", fontSize: "12px" }, children: [
448
- a.map((r) => {
449
- const d = V[r.level], l = m.has(r.id);
450
- return /* @__PURE__ */ t("div", { style: { borderBottom: "1px solid #252525" }, children: [
447
+ x === "logs" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", fontFamily: "monospace", fontSize: "12px" }, children: [
448
+ d.map((r) => {
449
+ const a = _[r.level], s = m.has(r.id);
450
+ return /* @__PURE__ */ t("div", { style: { borderBottom: "1px solid var(--nice-bg-secondary, #252525)" }, children: [
451
451
  /* @__PURE__ */ t(
452
452
  "div",
453
453
  {
454
- onClick: () => v(r.id),
454
+ onClick: () => S(r.id),
455
455
  style: {
456
456
  display: "flex",
457
457
  alignItems: "flex-start",
458
458
  gap: "8px",
459
459
  padding: "6px 12px",
460
460
  cursor: "pointer",
461
- background: l ? "var(--bg-elevated, #252525)" : "transparent"
461
+ background: s ? "var(--bg-elevated, #252525)" : "transparent"
462
462
  },
463
463
  children: [
464
464
  /* @__PURE__ */ e(
@@ -478,8 +478,8 @@ const V = {
478
478
  style: {
479
479
  padding: "2px 6px",
480
480
  borderRadius: "4px",
481
- background: d.bg,
482
- color: d.color,
481
+ background: a.bg,
482
+ color: a.color,
483
483
  fontSize: "10px",
484
484
  fontWeight: 500,
485
485
  minWidth: "50px",
@@ -507,13 +507,13 @@ const V = {
507
507
  "span",
508
508
  {
509
509
  style: { flex: 1, whiteSpace: "pre-wrap", wordBreak: "break-all" },
510
- dangerouslySetInnerHTML: { __html: F(r.message) }
510
+ dangerouslySetInnerHTML: { __html: ee(r.message) }
511
511
  }
512
512
  )
513
513
  ]
514
514
  }
515
515
  ),
516
- l && /* @__PURE__ */ t(
516
+ s && /* @__PURE__ */ t(
517
517
  "div",
518
518
  {
519
519
  style: {
@@ -589,7 +589,7 @@ const V = {
589
589
  children: "Attributes"
590
590
  }
591
591
  ),
592
- /* @__PURE__ */ e("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: Object.entries(r.attributes).map(([w, re]) => /* @__PURE__ */ t(
592
+ /* @__PURE__ */ e("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: Object.entries(r.attributes).map(([k, re]) => /* @__PURE__ */ t(
593
593
  "span",
594
594
  {
595
595
  style: {
@@ -599,12 +599,12 @@ const V = {
599
599
  fontSize: "10px"
600
600
  },
601
601
  children: [
602
- w,
602
+ k,
603
603
  "=",
604
604
  String(re)
605
605
  ]
606
606
  },
607
- w
607
+ k
608
608
  )) })
609
609
  ] }),
610
610
  r.stackTrace && /* @__PURE__ */ t("div", { children: [
@@ -656,7 +656,7 @@ const V = {
656
656
  r.traceId && /* @__PURE__ */ e(
657
657
  "button",
658
658
  {
659
- onClick: () => I(`{traceId="${r.traceId}"}`),
659
+ onClick: () => L(`{traceId="${r.traceId}"}`),
660
660
  style: {
661
661
  padding: "4px 12px",
662
662
  borderRadius: "4px",
@@ -675,7 +675,7 @@ const V = {
675
675
  )
676
676
  ] }, r.id);
677
677
  }),
678
- a.length === 0 && !u && /* @__PURE__ */ t(
678
+ d.length === 0 && !v && /* @__PURE__ */ t(
679
679
  "div",
680
680
  {
681
681
  style: { padding: "48px", textAlign: "center", color: "var(--text-muted, #666)" },
@@ -685,7 +685,7 @@ const V = {
685
685
  ]
686
686
  }
687
687
  ),
688
- u && /* @__PURE__ */ t(
688
+ v && /* @__PURE__ */ t(
689
689
  "div",
690
690
  {
691
691
  style: { padding: "48px", textAlign: "center", color: "var(--text-muted, #666)" },
@@ -696,9 +696,9 @@ const V = {
696
696
  }
697
697
  )
698
698
  ] }),
699
- c === "patterns" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: [
699
+ x === "patterns" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", padding: "16px" }, children: [
700
700
  b.map((r) => {
701
- const d = V[r.level];
701
+ const a = _[r.level];
702
702
  return /* @__PURE__ */ t(
703
703
  "div",
704
704
  {
@@ -707,7 +707,7 @@ const V = {
707
707
  padding: "16px",
708
708
  background: "var(--bg-elevated, #252525)",
709
709
  borderRadius: "8px",
710
- borderLeft: `3px solid ${d.color}`
710
+ borderLeft: `3px solid ${a.color}`
711
711
  },
712
712
  children: [
713
713
  /* @__PURE__ */ t(
@@ -764,7 +764,7 @@ const V = {
764
764
  style: {
765
765
  position: "fixed",
766
766
  inset: 0,
767
- background: "rgba(0,0,0,0.7)",
767
+ background: "var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",
768
768
  display: "flex",
769
769
  alignItems: "center",
770
770
  justifyContent: "center",
@@ -786,7 +786,7 @@ const V = {
786
786
  {
787
787
  type: "text",
788
788
  value: i,
789
- onChange: (r) => g(r.target.value),
789
+ onChange: (r) => f(r.target.value),
790
790
  placeholder: "Query name...",
791
791
  style: {
792
792
  width: "100%",
@@ -819,7 +819,7 @@ const V = {
819
819
  /* @__PURE__ */ e(
820
820
  "button",
821
821
  {
822
- onClick: E,
822
+ onClick: Z,
823
823
  style: {
824
824
  padding: "8px 16px",
825
825
  borderRadius: "6px",
@@ -855,30 +855,30 @@ const V = {
855
855
  { from: "now-7d", to: "now", display: "Last 7 days" },
856
856
  { from: "now-30d", to: "now", display: "Last 30 days" }
857
857
  ], le = ({
858
- dashboard: p,
859
- metrics: z,
858
+ dashboard: u,
859
+ metrics: w,
860
860
  alerts: T = [],
861
- timeRanges: u = ne,
861
+ timeRanges: v = ne,
862
862
  onTimeRangeChange: A,
863
863
  onVariableChange: b,
864
- onPanelEdit: O,
865
- onPanelAdd: _,
866
- onPanelRemove: H,
867
- onPanelMove: J,
864
+ onPanelEdit: E,
865
+ onPanelAdd: F,
866
+ onPanelRemove: V,
867
+ onPanelMove: G,
868
868
  onAlertAcknowledge: W,
869
- onAlertSilence: C,
870
- onQueryExecute: P,
871
- onDashboardSave: Q,
872
- onRefresh: R,
869
+ onAlertSilence: z,
870
+ onQueryExecute: O,
871
+ onDashboardSave: P,
872
+ onRefresh: C,
873
873
  isEditing: y = !1,
874
874
  onEditModeToggle: j,
875
- className: q,
876
- style: L,
877
- "data-testid": I
875
+ className: H,
876
+ style: R,
877
+ "data-testid": L
878
878
  }) => {
879
- const [N, $] = s(!1), [G, ee] = s(!0), [B, K] = s(null), m = T.filter((o) => o.status === "firing"), M = (o) => {
880
- var i, g, c;
881
- const n = (i = o.queries[0]) != null && i.expression ? z[o.queries[0].expression] : null;
879
+ const [N, $] = p(!1), [Q, Y] = p(!0), [I, M] = p(null), m = T.filter((o) => o.status === "firing"), q = (o) => {
880
+ var i, f, x;
881
+ const n = (i = o.queries[0]) != null && i.expression ? w[o.queries[0].expression] : null;
882
882
  switch (o.type) {
883
883
  case "stat":
884
884
  return /* @__PURE__ */ t(
@@ -907,8 +907,8 @@ const V = {
907
907
  ]
908
908
  }
909
909
  );
910
- case "gauge":
911
- const S = (n == null ? void 0 : n.currentValue) ?? 0, x = ((c = (g = o.thresholds) == null ? void 0 : g[o.thresholds.length - 1]) == null ? void 0 : c.value) ?? 100, k = Math.min(S / x * 100, 100);
910
+ case "gauge": {
911
+ const c = (n == null ? void 0 : n.currentValue) ?? 0, l = ((x = (f = o.thresholds) == null ? void 0 : f[o.thresholds.length - 1]) == null ? void 0 : x.value) ?? 100, g = Math.min(c / l * 100, 100);
912
912
  return /* @__PURE__ */ e(
913
913
  "div",
914
914
  {
@@ -920,23 +920,24 @@ const V = {
920
920
  height: "100%"
921
921
  },
922
922
  children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 60", style: { width: "100%", maxWidth: "200px" }, children: [
923
- /* @__PURE__ */ e("path", { d: "M 10 50 A 40 40 0 0 1 90 50", fill: "none", stroke: "#333", strokeWidth: "8" }),
923
+ /* @__PURE__ */ e("path", { d: "M 10 50 A 40 40 0 0 1 90 50", fill: "none", stroke: "var(--nice-text, #333)", strokeWidth: "8" }),
924
924
  /* @__PURE__ */ e(
925
925
  "path",
926
926
  {
927
927
  d: "M 10 50 A 40 40 0 0 1 90 50",
928
928
  fill: "none",
929
- stroke: D(S, o.thresholds),
929
+ stroke: D(c, o.thresholds),
930
930
  strokeWidth: "8",
931
- strokeDasharray: `${k * 1.26} 126`
931
+ strokeDasharray: `${g * 1.26} 126`
932
932
  }
933
933
  ),
934
- /* @__PURE__ */ e("text", { x: "50", y: "45", textAnchor: "middle", fill: "#e0e0e0", fontSize: "16", fontWeight: "600", children: S.toFixed(1) })
934
+ /* @__PURE__ */ e("text", { x: "50", y: "45", textAnchor: "middle", fill: "var(--nice-border, #e0e0e0)", fontSize: "16", fontWeight: "600", children: c.toFixed(1) })
935
935
  ] })
936
936
  }
937
937
  );
938
+ }
938
939
  case "timeseries":
939
- return Y(o, n);
940
+ return U(o, n);
940
941
  case "table":
941
942
  return /* @__PURE__ */ e("div", { style: { overflow: "auto", height: "100%" }, children: /* @__PURE__ */ t("table", { style: { width: "100%", fontSize: "11px", borderCollapse: "collapse" }, children: [
942
943
  /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { style: { background: "var(--bg-elevated, #252525)" }, children: [
@@ -963,7 +964,7 @@ const V = {
963
964
  }
964
965
  )
965
966
  ] }) }),
966
- /* @__PURE__ */ e("tbody", { children: n == null ? void 0 : n.values.slice(-10).reverse().map((a, h) => /* @__PURE__ */ t("tr", { children: [
967
+ /* @__PURE__ */ e("tbody", { children: n == null ? void 0 : n.values.slice(-10).reverse().map((c, l) => /* @__PURE__ */ t("tr", { children: [
967
968
  /* @__PURE__ */ e(
968
969
  "td",
969
970
  {
@@ -971,7 +972,7 @@ const V = {
971
972
  padding: "4px 8px",
972
973
  borderBottom: "1px solid var(--border-color, #333)"
973
974
  },
974
- children: new Date(a.timestamp).toLocaleTimeString()
975
+ children: new Date(c.timestamp).toLocaleTimeString()
975
976
  }
976
977
  ),
977
978
  /* @__PURE__ */ t(
@@ -983,13 +984,13 @@ const V = {
983
984
  textAlign: "right"
984
985
  },
985
986
  children: [
986
- a.value.toFixed(2),
987
+ c.value.toFixed(2),
987
988
  " ",
988
989
  n.unit
989
990
  ]
990
991
  }
991
992
  )
992
- ] }, h)) })
993
+ ] }, l)) })
993
994
  ] }) });
994
995
  case "bar_gauge":
995
996
  return /* @__PURE__ */ e(
@@ -1002,9 +1003,9 @@ const V = {
1002
1003
  flexDirection: "column",
1003
1004
  justifyContent: "center"
1004
1005
  },
1005
- children: o.queries.map((a, h) => {
1006
- var E, F;
1007
- const f = z[a.expression], v = (f == null ? void 0 : f.currentValue) ?? 0, U = ((F = (E = o.thresholds) == null ? void 0 : E[o.thresholds.length - 1]) == null ? void 0 : F.value) ?? 100;
1006
+ children: o.queries.map((c, l) => {
1007
+ var h, S;
1008
+ const g = w[c.expression], d = (g == null ? void 0 : g.currentValue) ?? 0, B = ((S = (h = o.thresholds) == null ? void 0 : h[o.thresholds.length - 1]) == null ? void 0 : S.value) ?? 100;
1008
1009
  return /* @__PURE__ */ t("div", { style: { marginBottom: "8px" }, children: [
1009
1010
  /* @__PURE__ */ t(
1010
1011
  "div",
@@ -1016,8 +1017,8 @@ const V = {
1016
1017
  marginBottom: "4px"
1017
1018
  },
1018
1019
  children: [
1019
- /* @__PURE__ */ e("span", { children: a.legendFormat ?? a.expression }),
1020
- /* @__PURE__ */ e("span", { children: v.toFixed(1) })
1020
+ /* @__PURE__ */ e("span", { children: c.legendFormat ?? c.expression }),
1021
+ /* @__PURE__ */ e("span", { children: d.toFixed(1) })
1021
1022
  ]
1022
1023
  }
1023
1024
  ),
@@ -1035,15 +1036,15 @@ const V = {
1035
1036
  {
1036
1037
  style: {
1037
1038
  height: "100%",
1038
- width: `${v / U * 100}%`,
1039
- background: D(v, o.thresholds),
1039
+ width: `${d / B * 100}%`,
1040
+ background: D(d, o.thresholds),
1040
1041
  borderRadius: "4px"
1041
1042
  }
1042
1043
  }
1043
1044
  )
1044
1045
  }
1045
1046
  )
1046
- ] }, h);
1047
+ ] }, l);
1047
1048
  })
1048
1049
  }
1049
1050
  );
@@ -1052,7 +1053,7 @@ const V = {
1052
1053
  default:
1053
1054
  return /* @__PURE__ */ e("div", { style: { padding: "12px", color: "var(--text-muted, #666)" }, children: "Unsupported panel type" });
1054
1055
  }
1055
- }, Y = (o, n) => {
1056
+ }, U = (o, n) => {
1056
1057
  const i = (n == null ? void 0 : n.values) ?? [];
1057
1058
  if (i.length === 0)
1058
1059
  return /* @__PURE__ */ e(
@@ -1068,9 +1069,9 @@ const V = {
1068
1069
  children: "No data"
1069
1070
  }
1070
1071
  );
1071
- const g = i.map((a) => a.value), c = Math.min(...g), x = Math.max(...g) - c || 1, k = i.map((a, h) => {
1072
- const f = h / (i.length - 1) * 100, v = 100 - (a.value - c) / x * 80;
1073
- return `${f},${v}`;
1072
+ const f = i.map((d) => d.value), x = Math.min(...f), l = Math.max(...f) - x || 1, g = i.map((d, B) => {
1073
+ const h = B / (i.length - 1) * 100, S = 100 - (d.value - x) / l * 80;
1074
+ return `${h},${S}`;
1074
1075
  }).join(" ");
1075
1076
  return /* @__PURE__ */ t(
1076
1077
  "svg",
@@ -1079,9 +1080,9 @@ const V = {
1079
1080
  preserveAspectRatio: "none",
1080
1081
  style: { width: "100%", height: "100%" },
1081
1082
  children: [
1082
- [0, 25, 50, 75, 100].map((a) => /* @__PURE__ */ e("line", { x1: "0", y1: a, x2: "100", y2: a, stroke: "#333", strokeWidth: "0.5" }, a)),
1083
- o.chartType === "area" || o.chartType === "stacked_area" ? /* @__PURE__ */ e("polygon", { points: `0,100 ${k} 100,100`, fill: "rgba(59, 130, 246, 0.2)" }) : null,
1084
- /* @__PURE__ */ e("polyline", { points: k, fill: "none", stroke: "#3b82f6", strokeWidth: "1" })
1083
+ [0, 25, 50, 75, 100].map((d) => /* @__PURE__ */ e("line", { x1: "0", y1: d, x2: "100", y2: d, stroke: "var(--nice-text, #333)", strokeWidth: "0.5" }, d)),
1084
+ o.chartType === "area" || o.chartType === "stacked_area" ? /* @__PURE__ */ e("polygon", { points: `0,100 ${g} 100,100`, fill: "var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))" }) : null,
1085
+ /* @__PURE__ */ e("polyline", { points: g, fill: "none", stroke: "var(--nice-primary, #3b82f6)", strokeWidth: "1" })
1085
1086
  ]
1086
1087
  }
1087
1088
  );
@@ -1096,16 +1097,16 @@ const V = {
1096
1097
  return /* @__PURE__ */ t(
1097
1098
  "div",
1098
1099
  {
1099
- className: `nice-metrics-dashboard ${q || ""}`,
1100
+ className: `nice-metrics-dashboard ${H || ""}`,
1100
1101
  style: {
1101
1102
  display: "flex",
1102
1103
  flexDirection: "column",
1103
1104
  height: "100%",
1104
1105
  background: "var(--bg-elevated, #1e1e1e)",
1105
1106
  color: "var(--text-primary, #e0e0e0)",
1106
- ...L
1107
+ ...R
1107
1108
  },
1108
- "data-testid": I,
1109
+ "data-testid": L,
1109
1110
  children: [
1110
1111
  /* @__PURE__ */ t(
1111
1112
  "div",
@@ -1120,7 +1121,7 @@ const V = {
1120
1121
  },
1121
1122
  children: [
1122
1123
  /* @__PURE__ */ e("span", { style: { fontSize: "20px" }, children: "📊" }),
1123
- /* @__PURE__ */ e("span", { style: { fontWeight: 500, fontSize: "14px" }, children: p.name }),
1124
+ /* @__PURE__ */ e("span", { style: { fontWeight: 500, fontSize: "14px" }, children: u.name }),
1124
1125
  /* @__PURE__ */ e("div", { style: { flex: 1 } }),
1125
1126
  m.length > 0 && /* @__PURE__ */ t(
1126
1127
  "button",
@@ -1133,7 +1134,7 @@ const V = {
1133
1134
  padding: "6px 12px",
1134
1135
  borderRadius: "4px",
1135
1136
  border: "none",
1136
- background: "#ef444422",
1137
+ background: "var(--nice-danger-tint-15, #ef444422)",
1137
1138
  color: "var(--color-error, #ef4444)",
1138
1139
  cursor: "pointer",
1139
1140
  fontSize: "12px"
@@ -1149,9 +1150,9 @@ const V = {
1149
1150
  /* @__PURE__ */ e(
1150
1151
  "select",
1151
1152
  {
1152
- value: p.timeRange.display,
1153
+ value: u.timeRange.display,
1153
1154
  onChange: (o) => {
1154
- const n = u.find((i) => i.display === o.target.value);
1155
+ const n = v.find((i) => i.display === o.target.value);
1155
1156
  n && A(n);
1156
1157
  },
1157
1158
  style: {
@@ -1162,13 +1163,13 @@ const V = {
1162
1163
  color: "var(--bg-primary, #fff)",
1163
1164
  fontSize: "12px"
1164
1165
  },
1165
- children: u.map((o) => /* @__PURE__ */ e("option", { value: o.display, children: o.display }, o.display))
1166
+ children: v.map((o) => /* @__PURE__ */ e("option", { value: o.display, children: o.display }, o.display))
1166
1167
  }
1167
1168
  ),
1168
1169
  /* @__PURE__ */ e(
1169
1170
  "button",
1170
1171
  {
1171
- onClick: R,
1172
+ onClick: C,
1172
1173
  style: {
1173
1174
  padding: "6px 12px",
1174
1175
  borderRadius: "4px",
@@ -1181,11 +1182,11 @@ const V = {
1181
1182
  children: "🔄 Refresh"
1182
1183
  }
1183
1184
  ),
1184
- y ? /* @__PURE__ */ t(X, { children: [
1185
+ y ? /* @__PURE__ */ t(J, { children: [
1185
1186
  /* @__PURE__ */ e(
1186
1187
  "button",
1187
1188
  {
1188
- onClick: _,
1189
+ onClick: F,
1189
1190
  style: {
1190
1191
  padding: "6px 12px",
1191
1192
  borderRadius: "4px",
@@ -1201,7 +1202,7 @@ const V = {
1201
1202
  /* @__PURE__ */ e(
1202
1203
  "button",
1203
1204
  {
1204
- onClick: Q,
1205
+ onClick: P,
1205
1206
  style: {
1206
1207
  padding: "6px 12px",
1207
1208
  borderRadius: "4px",
@@ -1234,7 +1235,7 @@ const V = {
1234
1235
  ]
1235
1236
  }
1236
1237
  ),
1237
- p.variables.length > 0 && G && /* @__PURE__ */ e(
1238
+ u.variables.length > 0 && Q && /* @__PURE__ */ e(
1238
1239
  "div",
1239
1240
  {
1240
1241
  style: {
@@ -1245,7 +1246,7 @@ const V = {
1245
1246
  borderBottom: "1px solid var(--border-color, #333)",
1246
1247
  background: "var(--bg-elevated, #252525)"
1247
1248
  },
1248
- children: p.variables.map((o) => {
1249
+ children: u.variables.map((o) => {
1249
1250
  var n;
1250
1251
  return /* @__PURE__ */ t("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
1251
1252
  /* @__PURE__ */ t("label", { style: { fontSize: "11px", color: "var(--text-muted, #888)" }, children: [
@@ -1297,7 +1298,7 @@ const V = {
1297
1298
  gridAutoRows: "minmax(100px, auto)",
1298
1299
  gap: "16px"
1299
1300
  },
1300
- children: p.panels.map((o) => /* @__PURE__ */ t(
1301
+ children: u.panels.map((o) => /* @__PURE__ */ t(
1301
1302
  "div",
1302
1303
  {
1303
1304
  style: {
@@ -1306,7 +1307,7 @@ const V = {
1306
1307
  background: "var(--bg-elevated, #252525)",
1307
1308
  borderRadius: "8px",
1308
1309
  overflow: "hidden",
1309
- border: B === o.id ? "2px solid #3b82f6" : "1px solid var(--border-color, #333)"
1310
+ border: I === o.id ? "2px solid var(--nice-primary, #3b82f6)" : "1px solid var(--border-color, #333)"
1310
1311
  },
1311
1312
  children: [
1312
1313
  /* @__PURE__ */ t(
@@ -1321,11 +1322,11 @@ const V = {
1321
1322
  },
1322
1323
  children: [
1323
1324
  /* @__PURE__ */ e("span", { style: { flex: 1, fontSize: "12px", fontWeight: 500 }, children: o.title }),
1324
- y && /* @__PURE__ */ t(X, { children: [
1325
+ y && /* @__PURE__ */ t(J, { children: [
1325
1326
  /* @__PURE__ */ e(
1326
1327
  "button",
1327
1328
  {
1328
- onClick: () => O(o),
1329
+ onClick: () => E(o),
1329
1330
  style: {
1330
1331
  padding: "2px 6px",
1331
1332
  marginLeft: "4px",
@@ -1342,7 +1343,7 @@ const V = {
1342
1343
  /* @__PURE__ */ e(
1343
1344
  "button",
1344
1345
  {
1345
- onClick: () => H(o.id),
1346
+ onClick: () => V(o.id),
1346
1347
  style: {
1347
1348
  padding: "2px 6px",
1348
1349
  marginLeft: "4px",
@@ -1360,7 +1361,7 @@ const V = {
1360
1361
  ]
1361
1362
  }
1362
1363
  ),
1363
- /* @__PURE__ */ e("div", { style: { height: "calc(100% - 40px)" }, children: M(o) })
1364
+ /* @__PURE__ */ e("div", { style: { height: "calc(100% - 40px)" }, children: q(o) })
1364
1365
  ]
1365
1366
  },
1366
1367
  o.id
@@ -1373,7 +1374,7 @@ const V = {
1373
1374
  style: {
1374
1375
  position: "fixed",
1375
1376
  inset: 0,
1376
- background: "rgba(0,0,0,0.7)",
1377
+ background: "var(--nice-overlay-70, rgba(0, 0, 0, 0.7))",
1377
1378
  display: "flex",
1378
1379
  alignItems: "center",
1379
1380
  justifyContent: "center",
@@ -1454,7 +1455,7 @@ const V = {
1454
1455
  marginLeft: "auto",
1455
1456
  padding: "2px 8px",
1456
1457
  borderRadius: "4px",
1457
- background: o.status === "firing" ? "#ef444422" : "#22c55e22",
1458
+ background: o.status === "firing" ? "var(--nice-danger-tint-15, #ef444422)" : "var(--nice-success-tint-15, #22c55e22)",
1458
1459
  color: o.status === "firing" ? "var(--color-error, #ef4444)" : "var(--color-success, #22c55e)",
1459
1460
  fontSize: "10px"
1460
1461
  },
@@ -1516,10 +1517,10 @@ const V = {
1516
1517
  children: "Acknowledge"
1517
1518
  }
1518
1519
  ),
1519
- C && /* @__PURE__ */ e(
1520
+ z && /* @__PURE__ */ e(
1520
1521
  "button",
1521
1522
  {
1522
- onClick: () => C(o.id, 36e5),
1523
+ onClick: () => z(o.id, 36e5),
1523
1524
  style: {
1524
1525
  padding: "4px 12px",
1525
1526
  borderRadius: "4px",
@@ -1556,6 +1557,6 @@ const V = {
1556
1557
  );
1557
1558
  };
1558
1559
  export {
1559
- ae as NiceLogExplorer,
1560
+ de as NiceLogExplorer,
1560
1561
  le as NiceMetricsDashboard
1561
1562
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice2dev/ui-monitoring",
3
- "version": "1.0.11",
3
+ "version": "1.0.14",
4
4
  "description": "Nice2Dev UI Monitoring - Observability React components: MetricsDashboard (Grafana-style), LogExplorer (Loki-style)",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "dependencies": {},
33
33
  "peerDependencies": {
34
- "@nice2dev/ui": "1.0.11",
34
+ "@nice2dev/ui": "^1.0.14",
35
35
  "react": ">=17.0.0",
36
36
  "react-dom": ">=17.0.0"
37
37
  },