@nice2dev/ui-monitoring 1.0.16 â 1.0.18
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.d.ts +3 -3
- package/dist/index.mjs +337 -272
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
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;
|
|
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:"đ"}},re=[{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"}],te=({logs:x,streams:S,totalCount:I,isLoading:g,savedQueries:B,patterns:h=[],onQueryExecute:_,onQuerySave:E,onQueryDelete:F,onStreamToggle:G,onLogClick:T,onExport:k,onTailStart:V,onTailStop:O,isTailing:w=!1,className:b,style:A,testId:P,"data-testid":H})=>{const M=H??P,[z,C]=a.useState(""),[N,W]=a.useState("now-1h"),[q,K]=a.useState(1e3),[R,U]=a.useState(new Set(["trace","debug","info","warn","error","fatal"])),[y,Q]=a.useState(new Set),[J,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:q,direction:"backward"})},m=r=>{Q(i=>{const l=new Set(i);return l.has(r)?l.delete(r):l.add(r),l})},Y=r=>{U(i=>{const l=new Set(i);return l.has(r)?l.delete(r):l.add(r),l})},X=()=>{n.trim()&&(E(n,z),o(!1),v(""))},Z=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":M,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:re.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:()=>Y(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=>G(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:Z(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,ee])=>e.jsxs("span",{style:{padding:"2px 8px",background:"var(--bg-tertiary, #333)",borderRadius:"4px",fontSize:"10px"},children:[j,"=",String(ee)]},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:X,style:{padding:"8px 16px",borderRadius:"6px",border:"none",background:"var(--color-primary, #3b82f6)",color:"var(--bg-primary, #fff)",cursor:"pointer"},children:"Save"})]})]})})]})},oe={critical:{color:"var(--color-error, #ef4444)",icon:"đ´"},warning:{color:"var(--color-warning, #f59e0b)",icon:"đĄ"},info:{color:"var(--color-primary, #3b82f6)",icon:"đĩ"}},ne=[{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"}],ie=({dashboard:x,metrics:S,alerts:I=[],timeRanges:g=ne,onTimeRangeChange:B,onVariableChange:h,onPanelEdit:_,onPanelAdd:E,onPanelRemove:F,onPanelMove:G,onAlertAcknowledge:T,onAlertSilence:k,onQueryExecute:V,onDashboardSave:O,onRefresh:w,isEditing:b=!1,onEditModeToggle:A,className:P,style:H,testId:M,"data-testid":z})=>{const C=z??M,[N,W]=a.useState(!1),[q,K]=a.useState(!0),[R,U]=a.useState(null),y=I.filter(t=>t.status==="firing"),Q=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 J(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"})}},J=(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)",...H},"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&&q&&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:Q(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=oe[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=te;exports.NiceMetricsDashboard=ie;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { default as default_2 } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NiceStandardProps } from '@nice2dev/ui';
|
|
3
3
|
|
|
4
4
|
export declare interface Alert {
|
|
5
5
|
id: string;
|
|
@@ -115,7 +115,7 @@ export declare type MetricType = 'gauge' | 'counter' | 'histogram' | 'summary';
|
|
|
115
115
|
|
|
116
116
|
export declare const NiceLogExplorer: default_2.FC<NiceLogExplorerProps>;
|
|
117
117
|
|
|
118
|
-
export declare interface NiceLogExplorerProps extends
|
|
118
|
+
export declare interface NiceLogExplorerProps extends NiceStandardProps {
|
|
119
119
|
logs: LogEntry[];
|
|
120
120
|
streams: LogStream[];
|
|
121
121
|
totalCount: number;
|
|
@@ -135,7 +135,7 @@ export declare interface NiceLogExplorerProps extends NiceBaseProps {
|
|
|
135
135
|
|
|
136
136
|
export declare const NiceMetricsDashboard: default_2.FC<NiceMetricsDashboardProps>;
|
|
137
137
|
|
|
138
|
-
export declare interface NiceMetricsDashboardProps extends
|
|
138
|
+
export declare interface NiceMetricsDashboardProps extends NiceStandardProps {
|
|
139
139
|
dashboard: Dashboard;
|
|
140
140
|
metrics: Record<string, Metric>;
|
|
141
141
|
alerts?: Alert[];
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,25 @@
|
|
|
1
|
-
import { jsxs as t, jsx as e, Fragment as
|
|
2
|
-
import { useState as p, useMemo as
|
|
1
|
+
import { jsxs as t, jsx as e, Fragment as Y } from "react/jsx-runtime";
|
|
2
|
+
import { useState as p, useMemo as X } from "react";
|
|
3
3
|
const _ = {
|
|
4
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: {
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
info: {
|
|
7
|
+
color: "var(--color-primary, #3b82f6)",
|
|
8
|
+
bg: "var(--nice-primary-tint-15, #3b82f622)",
|
|
9
|
+
icon: "âšī¸"
|
|
10
|
+
},
|
|
11
|
+
warn: {
|
|
12
|
+
color: "var(--color-warning, #f59e0b)",
|
|
13
|
+
bg: "var(--nice-warning-tint-15, #f59e0b22)",
|
|
14
|
+
icon: "â ī¸"
|
|
15
|
+
},
|
|
16
|
+
error: {
|
|
17
|
+
color: "var(--color-error, #ef4444)",
|
|
18
|
+
bg: "var(--nice-danger-tint-15, #ef444422)",
|
|
19
|
+
icon: "â"
|
|
20
|
+
},
|
|
9
21
|
fatal: { color: "var(--color-error, #dc2626)", bg: "#dc262622", icon: "đ" }
|
|
10
|
-
},
|
|
22
|
+
}, ne = [
|
|
11
23
|
{ label: "Last 5 min", value: "now-5m" },
|
|
12
24
|
{ label: "Last 15 min", value: "now-15m" },
|
|
13
25
|
{ label: "Last 30 min", value: "now-30m" },
|
|
@@ -17,7 +29,7 @@ const _ = {
|
|
|
17
29
|
{ label: "Last 12 hours", value: "now-12h" },
|
|
18
30
|
{ label: "Last 24 hours", value: "now-24h" },
|
|
19
31
|
{ label: "Last 7 days", value: "now-7d" }
|
|
20
|
-
],
|
|
32
|
+
], se = ({
|
|
21
33
|
logs: u,
|
|
22
34
|
streams: w,
|
|
23
35
|
totalCount: T,
|
|
@@ -27,7 +39,7 @@ const _ = {
|
|
|
27
39
|
onQueryExecute: E,
|
|
28
40
|
onQuerySave: F,
|
|
29
41
|
onQueryDelete: V,
|
|
30
|
-
onStreamToggle:
|
|
42
|
+
onStreamToggle: U,
|
|
31
43
|
onLogClick: W,
|
|
32
44
|
onExport: z,
|
|
33
45
|
onTailStart: O,
|
|
@@ -35,11 +47,12 @@ const _ = {
|
|
|
35
47
|
isTailing: C = !1,
|
|
36
48
|
className: y,
|
|
37
49
|
style: j,
|
|
38
|
-
|
|
50
|
+
testId: H,
|
|
51
|
+
"data-testid": Q
|
|
39
52
|
}) => {
|
|
40
|
-
const [R, L] = p(""), [N, $] = p("now-1h"), [
|
|
53
|
+
const q = Q ?? H, [R, L] = p(""), [N, $] = p("now-1h"), [G, Z] = p(1e3), [I, J] = p(
|
|
41
54
|
/* @__PURE__ */ new Set(["trace", "debug", "info", "warn", "error", "fatal"])
|
|
42
|
-
), [m,
|
|
55
|
+
), [m, M] = p(/* @__PURE__ */ new Set()), [K, D] = p(null), [o, n] = p(!1), [i, f] = p(""), [x, c] = p("logs"), [l, g] = p(""), d = X(() => u.filter((r) => !(!I.has(r.level) || l && !r.message.toLowerCase().includes(l.toLowerCase()))), [u, I, l]), B = X(() => {
|
|
43
56
|
const r = {
|
|
44
57
|
trace: 0,
|
|
45
58
|
debug: 0,
|
|
@@ -53,22 +66,22 @@ const _ = {
|
|
|
53
66
|
E({
|
|
54
67
|
query: R,
|
|
55
68
|
timeRange: { from: N, to: "now" },
|
|
56
|
-
limit:
|
|
69
|
+
limit: G,
|
|
57
70
|
direction: "backward"
|
|
58
71
|
});
|
|
59
72
|
}, S = (r) => {
|
|
60
|
-
|
|
73
|
+
M((a) => {
|
|
61
74
|
const s = new Set(a);
|
|
62
75
|
return s.has(r) ? s.delete(r) : s.add(r), s;
|
|
63
76
|
});
|
|
64
|
-
},
|
|
65
|
-
|
|
77
|
+
}, ee = (r) => {
|
|
78
|
+
J((a) => {
|
|
66
79
|
const s = new Set(a);
|
|
67
80
|
return s.has(r) ? s.delete(r) : s.add(r), s;
|
|
68
81
|
});
|
|
69
|
-
},
|
|
82
|
+
}, re = () => {
|
|
70
83
|
i.trim() && (F(i, R), n(!1), f(""));
|
|
71
|
-
},
|
|
84
|
+
}, te = (r) => {
|
|
72
85
|
if (!l)
|
|
73
86
|
return r;
|
|
74
87
|
const a = new RegExp(`(${l})`, "gi");
|
|
@@ -89,7 +102,7 @@ const _ = {
|
|
|
89
102
|
color: "var(--text-primary, #e0e0e0)",
|
|
90
103
|
...j
|
|
91
104
|
},
|
|
92
|
-
"data-testid":
|
|
105
|
+
"data-testid": q,
|
|
93
106
|
children: [
|
|
94
107
|
/* @__PURE__ */ t(
|
|
95
108
|
"div",
|
|
@@ -134,7 +147,7 @@ const _ = {
|
|
|
134
147
|
color: "var(--bg-primary, #fff)",
|
|
135
148
|
fontSize: "12px"
|
|
136
149
|
},
|
|
137
|
-
children:
|
|
150
|
+
children: ne.map((r) => /* @__PURE__ */ e("option", { value: r.value, children: r.label }, r.value))
|
|
138
151
|
}
|
|
139
152
|
),
|
|
140
153
|
/* @__PURE__ */ t(
|
|
@@ -199,7 +212,7 @@ const _ = {
|
|
|
199
212
|
return /* @__PURE__ */ t(
|
|
200
213
|
"button",
|
|
201
214
|
{
|
|
202
|
-
onClick: () =>
|
|
215
|
+
onClick: () => ee(r),
|
|
203
216
|
style: {
|
|
204
217
|
display: "flex",
|
|
205
218
|
alignItems: "center",
|
|
@@ -288,7 +301,7 @@ const _ = {
|
|
|
288
301
|
{
|
|
289
302
|
type: "checkbox",
|
|
290
303
|
defaultChecked: !0,
|
|
291
|
-
onChange: (a) =>
|
|
304
|
+
onChange: (a) => U(r.id, a.target.checked)
|
|
292
305
|
}
|
|
293
306
|
),
|
|
294
307
|
/* @__PURE__ */ e(
|
|
@@ -447,233 +460,240 @@ const _ = {
|
|
|
447
460
|
x === "logs" && /* @__PURE__ */ t("div", { style: { flex: 1, overflow: "auto", fontFamily: "monospace", fontSize: "12px" }, children: [
|
|
448
461
|
d.map((r) => {
|
|
449
462
|
const a = _[r.level], s = m.has(r.id);
|
|
450
|
-
return /* @__PURE__ */ t(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
{
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
463
|
+
return /* @__PURE__ */ t(
|
|
464
|
+
"div",
|
|
465
|
+
{
|
|
466
|
+
style: { borderBottom: "1px solid var(--nice-bg-secondary, #252525)" },
|
|
467
|
+
children: [
|
|
468
|
+
/* @__PURE__ */ t(
|
|
469
|
+
"div",
|
|
470
|
+
{
|
|
471
|
+
onClick: () => S(r.id),
|
|
472
|
+
style: {
|
|
473
|
+
display: "flex",
|
|
474
|
+
alignItems: "flex-start",
|
|
475
|
+
gap: "8px",
|
|
476
|
+
padding: "6px 12px",
|
|
477
|
+
cursor: "pointer",
|
|
478
|
+
background: s ? "var(--bg-elevated, #252525)" : "transparent"
|
|
479
|
+
},
|
|
480
|
+
children: [
|
|
481
|
+
/* @__PURE__ */ e(
|
|
482
|
+
"span",
|
|
483
|
+
{
|
|
484
|
+
style: {
|
|
485
|
+
color: "var(--text-muted, #666)",
|
|
486
|
+
fontSize: "10px",
|
|
487
|
+
minWidth: "160px"
|
|
488
|
+
},
|
|
489
|
+
children: new Date(r.timestamp).toISOString()
|
|
490
|
+
}
|
|
491
|
+
),
|
|
492
|
+
/* @__PURE__ */ e(
|
|
493
|
+
"span",
|
|
494
|
+
{
|
|
495
|
+
style: {
|
|
496
|
+
padding: "2px 6px",
|
|
497
|
+
borderRadius: "4px",
|
|
498
|
+
background: a.bg,
|
|
499
|
+
color: a.color,
|
|
500
|
+
fontSize: "10px",
|
|
501
|
+
fontWeight: 500,
|
|
502
|
+
minWidth: "50px",
|
|
503
|
+
textAlign: "center"
|
|
504
|
+
},
|
|
505
|
+
children: r.level.toUpperCase()
|
|
506
|
+
}
|
|
507
|
+
),
|
|
508
|
+
r.service && /* @__PURE__ */ t(
|
|
509
|
+
"span",
|
|
510
|
+
{
|
|
511
|
+
style: {
|
|
512
|
+
color: "var(--color-accent, #8b5cf6)",
|
|
513
|
+
fontSize: "10px",
|
|
514
|
+
minWidth: "80px"
|
|
515
|
+
},
|
|
516
|
+
children: [
|
|
517
|
+
"[",
|
|
518
|
+
r.service,
|
|
519
|
+
"]"
|
|
520
|
+
]
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
/* @__PURE__ */ e(
|
|
524
|
+
"span",
|
|
525
|
+
{
|
|
526
|
+
style: { flex: 1, whiteSpace: "pre-wrap", wordBreak: "break-all" },
|
|
527
|
+
dangerouslySetInnerHTML: { __html: te(r.message) }
|
|
528
|
+
}
|
|
529
|
+
)
|
|
530
|
+
]
|
|
531
|
+
}
|
|
532
|
+
),
|
|
533
|
+
s && /* @__PURE__ */ t(
|
|
534
|
+
"div",
|
|
535
|
+
{
|
|
536
|
+
style: {
|
|
537
|
+
padding: "12px 12px 12px 200px",
|
|
538
|
+
background: "var(--bg-elevated, #252525)",
|
|
539
|
+
borderTop: "1px solid var(--border-color, #333)"
|
|
540
|
+
},
|
|
541
|
+
children: [
|
|
542
|
+
/* @__PURE__ */ t(
|
|
543
|
+
"div",
|
|
544
|
+
{
|
|
545
|
+
style: {
|
|
546
|
+
display: "grid",
|
|
547
|
+
gridTemplateColumns: "repeat(3, 1fr)",
|
|
548
|
+
gap: "12px",
|
|
549
|
+
marginBottom: "12px"
|
|
550
|
+
},
|
|
551
|
+
children: [
|
|
552
|
+
/* @__PURE__ */ t("div", { children: [
|
|
553
|
+
/* @__PURE__ */ e(
|
|
554
|
+
"div",
|
|
555
|
+
{
|
|
556
|
+
style: {
|
|
557
|
+
fontSize: "10px",
|
|
558
|
+
color: "var(--text-muted, #888)",
|
|
559
|
+
marginBottom: "2px"
|
|
560
|
+
},
|
|
561
|
+
children: "Source"
|
|
562
|
+
}
|
|
563
|
+
),
|
|
564
|
+
/* @__PURE__ */ e("div", { style: { fontSize: "11px" }, children: r.source })
|
|
565
|
+
] }),
|
|
566
|
+
r.host && /* @__PURE__ */ t("div", { children: [
|
|
567
|
+
/* @__PURE__ */ e(
|
|
568
|
+
"div",
|
|
569
|
+
{
|
|
570
|
+
style: {
|
|
571
|
+
fontSize: "10px",
|
|
572
|
+
color: "var(--text-muted, #888)",
|
|
573
|
+
marginBottom: "2px"
|
|
574
|
+
},
|
|
575
|
+
children: "Host"
|
|
576
|
+
}
|
|
577
|
+
),
|
|
578
|
+
/* @__PURE__ */ e("div", { style: { fontSize: "11px" }, children: r.host })
|
|
579
|
+
] }),
|
|
580
|
+
r.traceId && /* @__PURE__ */ t("div", { children: [
|
|
581
|
+
/* @__PURE__ */ e(
|
|
582
|
+
"div",
|
|
583
|
+
{
|
|
584
|
+
style: {
|
|
585
|
+
fontSize: "10px",
|
|
586
|
+
color: "var(--text-muted, #888)",
|
|
587
|
+
marginBottom: "2px"
|
|
588
|
+
},
|
|
589
|
+
children: "Trace ID"
|
|
590
|
+
}
|
|
591
|
+
),
|
|
592
|
+
/* @__PURE__ */ e("div", { style: { fontSize: "11px", fontFamily: "monospace" }, children: r.traceId })
|
|
593
|
+
] })
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
),
|
|
597
|
+
Object.keys(r.attributes).length > 0 && /* @__PURE__ */ t("div", { style: { marginBottom: "12px" }, children: [
|
|
598
|
+
/* @__PURE__ */ e(
|
|
599
|
+
"div",
|
|
600
|
+
{
|
|
601
|
+
style: {
|
|
602
|
+
fontSize: "10px",
|
|
603
|
+
color: "var(--text-muted, #888)",
|
|
604
|
+
marginBottom: "4px"
|
|
605
|
+
},
|
|
606
|
+
children: "Attributes"
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
/* @__PURE__ */ e("div", { style: { display: "flex", flexWrap: "wrap", gap: "4px" }, children: Object.entries(r.attributes).map(([k, oe]) => /* @__PURE__ */ t(
|
|
610
|
+
"span",
|
|
611
|
+
{
|
|
612
|
+
style: {
|
|
613
|
+
padding: "2px 8px",
|
|
614
|
+
background: "var(--bg-tertiary, #333)",
|
|
615
|
+
borderRadius: "4px",
|
|
616
|
+
fontSize: "10px"
|
|
617
|
+
},
|
|
618
|
+
children: [
|
|
619
|
+
k,
|
|
620
|
+
"=",
|
|
621
|
+
String(oe)
|
|
622
|
+
]
|
|
623
|
+
},
|
|
624
|
+
k
|
|
625
|
+
)) })
|
|
626
|
+
] }),
|
|
627
|
+
r.stackTrace && /* @__PURE__ */ t("div", { children: [
|
|
628
|
+
/* @__PURE__ */ e(
|
|
629
|
+
"div",
|
|
630
|
+
{
|
|
631
|
+
style: {
|
|
632
|
+
fontSize: "10px",
|
|
633
|
+
color: "var(--text-muted, #888)",
|
|
634
|
+
marginBottom: "4px"
|
|
635
|
+
},
|
|
636
|
+
children: "Stack Trace"
|
|
637
|
+
}
|
|
638
|
+
),
|
|
639
|
+
/* @__PURE__ */ e(
|
|
640
|
+
"pre",
|
|
641
|
+
{
|
|
642
|
+
style: {
|
|
643
|
+
margin: 0,
|
|
644
|
+
padding: "8px",
|
|
645
|
+
background: "var(--bg-elevated, #1e1e1e)",
|
|
646
|
+
borderRadius: "4px",
|
|
647
|
+
fontSize: "10px",
|
|
648
|
+
overflow: "auto",
|
|
649
|
+
maxHeight: "200px",
|
|
650
|
+
color: "var(--color-error, #ef4444)"
|
|
651
|
+
},
|
|
652
|
+
children: r.stackTrace
|
|
653
|
+
}
|
|
654
|
+
)
|
|
655
|
+
] }),
|
|
656
|
+
/* @__PURE__ */ t("div", { style: { marginTop: "12px", display: "flex", gap: "8px" }, children: [
|
|
657
|
+
/* @__PURE__ */ e(
|
|
658
|
+
"button",
|
|
659
|
+
{
|
|
660
|
+
onClick: () => W(r),
|
|
661
|
+
style: {
|
|
662
|
+
padding: "4px 12px",
|
|
663
|
+
borderRadius: "4px",
|
|
664
|
+
border: "none",
|
|
665
|
+
background: "var(--color-primary, #3b82f6)",
|
|
666
|
+
color: "var(--bg-primary, #fff)",
|
|
667
|
+
cursor: "pointer",
|
|
668
|
+
fontSize: "10px"
|
|
669
|
+
},
|
|
670
|
+
children: "View Details"
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
r.traceId && /* @__PURE__ */ e(
|
|
674
|
+
"button",
|
|
675
|
+
{
|
|
676
|
+
onClick: () => L(`{traceId="${r.traceId}"}`),
|
|
677
|
+
style: {
|
|
678
|
+
padding: "4px 12px",
|
|
679
|
+
borderRadius: "4px",
|
|
680
|
+
border: "none",
|
|
681
|
+
background: "var(--bg-tertiary, #333)",
|
|
682
|
+
color: "var(--bg-primary, #fff)",
|
|
683
|
+
cursor: "pointer",
|
|
684
|
+
fontSize: "10px"
|
|
685
|
+
},
|
|
686
|
+
children: "Show Trace"
|
|
687
|
+
}
|
|
688
|
+
)
|
|
689
|
+
] })
|
|
690
|
+
]
|
|
691
|
+
}
|
|
692
|
+
)
|
|
693
|
+
]
|
|
694
|
+
},
|
|
695
|
+
r.id
|
|
696
|
+
);
|
|
677
697
|
}),
|
|
678
698
|
d.length === 0 && !v && /* @__PURE__ */ t(
|
|
679
699
|
"div",
|
|
@@ -819,7 +839,7 @@ const _ = {
|
|
|
819
839
|
/* @__PURE__ */ e(
|
|
820
840
|
"button",
|
|
821
841
|
{
|
|
822
|
-
onClick:
|
|
842
|
+
onClick: re,
|
|
823
843
|
style: {
|
|
824
844
|
padding: "8px 16px",
|
|
825
845
|
borderRadius: "6px",
|
|
@@ -840,11 +860,11 @@ const _ = {
|
|
|
840
860
|
]
|
|
841
861
|
}
|
|
842
862
|
);
|
|
843
|
-
},
|
|
863
|
+
}, ie = {
|
|
844
864
|
critical: { color: "var(--color-error, #ef4444)", icon: "đ´" },
|
|
845
865
|
warning: { color: "var(--color-warning, #f59e0b)", icon: "đĄ" },
|
|
846
866
|
info: { color: "var(--color-primary, #3b82f6)", icon: "đĩ" }
|
|
847
|
-
},
|
|
867
|
+
}, ae = [
|
|
848
868
|
{ from: "now-5m", to: "now", display: "Last 5 minutes" },
|
|
849
869
|
{ from: "now-15m", to: "now", display: "Last 15 minutes" },
|
|
850
870
|
{ from: "now-1h", to: "now", display: "Last 1 hour" },
|
|
@@ -854,17 +874,17 @@ const _ = {
|
|
|
854
874
|
{ from: "now-24h", to: "now", display: "Last 24 hours" },
|
|
855
875
|
{ from: "now-7d", to: "now", display: "Last 7 days" },
|
|
856
876
|
{ from: "now-30d", to: "now", display: "Last 30 days" }
|
|
857
|
-
],
|
|
877
|
+
], ce = ({
|
|
858
878
|
dashboard: u,
|
|
859
879
|
metrics: w,
|
|
860
880
|
alerts: T = [],
|
|
861
|
-
timeRanges: v =
|
|
881
|
+
timeRanges: v = ae,
|
|
862
882
|
onTimeRangeChange: A,
|
|
863
883
|
onVariableChange: b,
|
|
864
884
|
onPanelEdit: E,
|
|
865
885
|
onPanelAdd: F,
|
|
866
886
|
onPanelRemove: V,
|
|
867
|
-
onPanelMove:
|
|
887
|
+
onPanelMove: U,
|
|
868
888
|
onAlertAcknowledge: W,
|
|
869
889
|
onAlertSilence: z,
|
|
870
890
|
onQueryExecute: O,
|
|
@@ -873,10 +893,11 @@ const _ = {
|
|
|
873
893
|
isEditing: y = !1,
|
|
874
894
|
onEditModeToggle: j,
|
|
875
895
|
className: H,
|
|
876
|
-
style:
|
|
877
|
-
|
|
896
|
+
style: Q,
|
|
897
|
+
testId: q,
|
|
898
|
+
"data-testid": R
|
|
878
899
|
}) => {
|
|
879
|
-
const [N, $] = p(!1), [
|
|
900
|
+
const L = R ?? q, [N, $] = p(!1), [G, Z] = p(!0), [I, J] = p(null), m = T.filter((o) => o.status === "firing"), M = (o) => {
|
|
880
901
|
var i, f, x;
|
|
881
902
|
const n = (i = o.queries[0]) != null && i.expression ? w[o.queries[0].expression] : null;
|
|
882
903
|
switch (o.type) {
|
|
@@ -920,7 +941,15 @@ const _ = {
|
|
|
920
941
|
height: "100%"
|
|
921
942
|
},
|
|
922
943
|
children: /* @__PURE__ */ t("svg", { viewBox: "0 0 100 60", style: { width: "100%", maxWidth: "200px" }, children: [
|
|
923
|
-
/* @__PURE__ */ e(
|
|
944
|
+
/* @__PURE__ */ e(
|
|
945
|
+
"path",
|
|
946
|
+
{
|
|
947
|
+
d: "M 10 50 A 40 40 0 0 1 90 50",
|
|
948
|
+
fill: "none",
|
|
949
|
+
stroke: "var(--nice-text, #333)",
|
|
950
|
+
strokeWidth: "8"
|
|
951
|
+
}
|
|
952
|
+
),
|
|
924
953
|
/* @__PURE__ */ e(
|
|
925
954
|
"path",
|
|
926
955
|
{
|
|
@@ -931,13 +960,24 @@ const _ = {
|
|
|
931
960
|
strokeDasharray: `${g * 1.26} 126`
|
|
932
961
|
}
|
|
933
962
|
),
|
|
934
|
-
/* @__PURE__ */ e(
|
|
963
|
+
/* @__PURE__ */ e(
|
|
964
|
+
"text",
|
|
965
|
+
{
|
|
966
|
+
x: "50",
|
|
967
|
+
y: "45",
|
|
968
|
+
textAnchor: "middle",
|
|
969
|
+
fill: "var(--nice-border, #e0e0e0)",
|
|
970
|
+
fontSize: "16",
|
|
971
|
+
fontWeight: "600",
|
|
972
|
+
children: c.toFixed(1)
|
|
973
|
+
}
|
|
974
|
+
)
|
|
935
975
|
] })
|
|
936
976
|
}
|
|
937
977
|
);
|
|
938
978
|
}
|
|
939
979
|
case "timeseries":
|
|
940
|
-
return
|
|
980
|
+
return K(o, n);
|
|
941
981
|
case "table":
|
|
942
982
|
return /* @__PURE__ */ e("div", { style: { overflow: "auto", height: "100%" }, children: /* @__PURE__ */ t("table", { style: { width: "100%", fontSize: "11px", borderCollapse: "collapse" }, children: [
|
|
943
983
|
/* @__PURE__ */ e("thead", { children: /* @__PURE__ */ t("tr", { style: { background: "var(--bg-elevated, #252525)" }, children: [
|
|
@@ -1053,7 +1093,7 @@ const _ = {
|
|
|
1053
1093
|
default:
|
|
1054
1094
|
return /* @__PURE__ */ e("div", { style: { padding: "12px", color: "var(--text-muted, #666)" }, children: "Unsupported panel type" });
|
|
1055
1095
|
}
|
|
1056
|
-
},
|
|
1096
|
+
}, K = (o, n) => {
|
|
1057
1097
|
const i = (n == null ? void 0 : n.values) ?? [];
|
|
1058
1098
|
if (i.length === 0)
|
|
1059
1099
|
return /* @__PURE__ */ e(
|
|
@@ -1080,9 +1120,34 @@ const _ = {
|
|
|
1080
1120
|
preserveAspectRatio: "none",
|
|
1081
1121
|
style: { width: "100%", height: "100%" },
|
|
1082
1122
|
children: [
|
|
1083
|
-
[0, 25, 50, 75, 100].map((d) => /* @__PURE__ */ e(
|
|
1084
|
-
|
|
1085
|
-
|
|
1123
|
+
[0, 25, 50, 75, 100].map((d) => /* @__PURE__ */ e(
|
|
1124
|
+
"line",
|
|
1125
|
+
{
|
|
1126
|
+
x1: "0",
|
|
1127
|
+
y1: d,
|
|
1128
|
+
x2: "100",
|
|
1129
|
+
y2: d,
|
|
1130
|
+
stroke: "var(--nice-text, #333)",
|
|
1131
|
+
strokeWidth: "0.5"
|
|
1132
|
+
},
|
|
1133
|
+
d
|
|
1134
|
+
)),
|
|
1135
|
+
o.chartType === "area" || o.chartType === "stacked_area" ? /* @__PURE__ */ e(
|
|
1136
|
+
"polygon",
|
|
1137
|
+
{
|
|
1138
|
+
points: `0,100 ${g} 100,100`,
|
|
1139
|
+
fill: "var(--nice-primary-tint-20, rgba(59, 130, 246, 0.2))"
|
|
1140
|
+
}
|
|
1141
|
+
) : null,
|
|
1142
|
+
/* @__PURE__ */ e(
|
|
1143
|
+
"polyline",
|
|
1144
|
+
{
|
|
1145
|
+
points: g,
|
|
1146
|
+
fill: "none",
|
|
1147
|
+
stroke: "var(--nice-primary, #3b82f6)",
|
|
1148
|
+
strokeWidth: "1"
|
|
1149
|
+
}
|
|
1150
|
+
)
|
|
1086
1151
|
]
|
|
1087
1152
|
}
|
|
1088
1153
|
);
|
|
@@ -1104,7 +1169,7 @@ const _ = {
|
|
|
1104
1169
|
height: "100%",
|
|
1105
1170
|
background: "var(--bg-elevated, #1e1e1e)",
|
|
1106
1171
|
color: "var(--text-primary, #e0e0e0)",
|
|
1107
|
-
...
|
|
1172
|
+
...Q
|
|
1108
1173
|
},
|
|
1109
1174
|
"data-testid": L,
|
|
1110
1175
|
children: [
|
|
@@ -1182,7 +1247,7 @@ const _ = {
|
|
|
1182
1247
|
children: "đ Refresh"
|
|
1183
1248
|
}
|
|
1184
1249
|
),
|
|
1185
|
-
y ? /* @__PURE__ */ t(
|
|
1250
|
+
y ? /* @__PURE__ */ t(Y, { children: [
|
|
1186
1251
|
/* @__PURE__ */ e(
|
|
1187
1252
|
"button",
|
|
1188
1253
|
{
|
|
@@ -1235,7 +1300,7 @@ const _ = {
|
|
|
1235
1300
|
]
|
|
1236
1301
|
}
|
|
1237
1302
|
),
|
|
1238
|
-
u.variables.length > 0 &&
|
|
1303
|
+
u.variables.length > 0 && G && /* @__PURE__ */ e(
|
|
1239
1304
|
"div",
|
|
1240
1305
|
{
|
|
1241
1306
|
style: {
|
|
@@ -1322,7 +1387,7 @@ const _ = {
|
|
|
1322
1387
|
},
|
|
1323
1388
|
children: [
|
|
1324
1389
|
/* @__PURE__ */ e("span", { style: { flex: 1, fontSize: "12px", fontWeight: 500 }, children: o.title }),
|
|
1325
|
-
y && /* @__PURE__ */ t(
|
|
1390
|
+
y && /* @__PURE__ */ t(Y, { children: [
|
|
1326
1391
|
/* @__PURE__ */ e(
|
|
1327
1392
|
"button",
|
|
1328
1393
|
{
|
|
@@ -1361,7 +1426,7 @@ const _ = {
|
|
|
1361
1426
|
]
|
|
1362
1427
|
}
|
|
1363
1428
|
),
|
|
1364
|
-
/* @__PURE__ */ e("div", { style: { height: "calc(100% - 40px)" }, children:
|
|
1429
|
+
/* @__PURE__ */ e("div", { style: { height: "calc(100% - 40px)" }, children: M(o) })
|
|
1365
1430
|
]
|
|
1366
1431
|
},
|
|
1367
1432
|
o.id
|
|
@@ -1426,7 +1491,7 @@ const _ = {
|
|
|
1426
1491
|
),
|
|
1427
1492
|
/* @__PURE__ */ t("div", { style: { maxHeight: "60vh", overflow: "auto" }, children: [
|
|
1428
1493
|
T.map((o) => {
|
|
1429
|
-
const n =
|
|
1494
|
+
const n = ie[o.severity];
|
|
1430
1495
|
return /* @__PURE__ */ t(
|
|
1431
1496
|
"div",
|
|
1432
1497
|
{
|
|
@@ -1557,6 +1622,6 @@ const _ = {
|
|
|
1557
1622
|
);
|
|
1558
1623
|
};
|
|
1559
1624
|
export {
|
|
1560
|
-
|
|
1561
|
-
|
|
1625
|
+
se as NiceLogExplorer,
|
|
1626
|
+
ce as NiceMetricsDashboard
|
|
1562
1627
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/ui-monitoring",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
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.
|
|
34
|
+
"@nice2dev/ui": "^1.0.18",
|
|
35
35
|
"react": ">=17.0.0",
|
|
36
36
|
"react-dom": ">=17.0.0"
|
|
37
37
|
},
|