@odigos/ui-kit 0.0.129 → 0.0.131
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/CHANGELOG.md +20 -0
- package/lib/chunks/ui-components-c940a3cc.js +2024 -0
- package/lib/chunks/vendor-55cc654c.js +1 -0
- package/lib/components/_v2/badge/index.d.ts +10 -0
- package/lib/components/_v2/button/index.d.ts +2 -1
- package/lib/components/_v2/cards/data-card/index.d.ts +12 -0
- package/lib/components/_v2/cards/index.d.ts +4 -0
- package/lib/components/_v2/cards/section-card/index.d.ts +24 -0
- package/lib/components/_v2/cards/status-card/index.d.ts +9 -0
- package/lib/components/_v2/cards/text-card/index.d.ts +12 -0
- package/lib/components/_v2/drawer/header/index.d.ts +9 -0
- package/lib/components/_v2/drawer/index.d.ts +9 -0
- package/lib/components/_v2/header/index.d.ts +7 -0
- package/lib/components/_v2/icon-button/index.d.ts +14 -0
- package/lib/components/_v2/index.d.ts +8 -0
- package/lib/components/_v2/navbar/index.d.ts +12 -0
- package/lib/components/_v2/segment/index.d.ts +3 -1
- package/lib/components/_v2/table/index.d.ts +25 -0
- package/lib/components/_v2/tag/index.d.ts +9 -0
- package/lib/components/_v2/typography/index.d.ts +4 -8
- package/lib/components/code/index.d.ts +2 -0
- package/lib/components/styled.d.ts +1 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/index.d.ts +1 -0
- package/lib/containers/_v2/pipeline-collectors/general-info/index.d.ts +8 -0
- package/lib/containers/_v2/pipeline-collectors/general-info/yaml-drawer/index.d.ts +9 -0
- package/lib/containers/_v2/pipeline-collectors/helpers/get-general-badge.d.ts +5 -0
- package/lib/containers/_v2/pipeline-collectors/helpers/get-general-status-card.d.ts +4 -0
- package/lib/containers/_v2/pipeline-collectors/helpers/get-general-text-cards.d.ts +4 -0
- package/lib/containers/_v2/pipeline-collectors/helpers/get-general-title.d.ts +2 -0
- package/lib/containers/_v2/pipeline-collectors/helpers/index.d.ts +4 -0
- package/lib/containers/_v2/pipeline-collectors/index.d.ts +11 -0
- package/lib/containers/_v2/pipeline-collectors/pods-info/index.d.ts +9 -0
- package/lib/containers/_v2/pipeline-collectors/pods-info/pod-drawer/index.d.ts +9 -0
- package/lib/containers/_v2/pipeline-collectors/toolbar/index.d.ts +17 -0
- package/lib/containers/v2.js +15 -0
- package/lib/containers.js +24 -24
- package/lib/functions/generate-id/index.d.ts +1 -0
- package/lib/functions/get-status-color/index.d.ts +2 -2
- package/lib/functions/get-status-from-pod-status/index.d.ts +2 -0
- package/lib/functions/get-status-icon/index.d.ts +2 -2
- package/lib/functions/index.d.ts +2 -0
- package/lib/functions.js +1 -1
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/useInfiniteScroll.d.ts +10 -0
- package/lib/hooks/useTimeAgo.d.ts +4 -3
- package/lib/hooks.js +1 -1
- package/lib/icons/arrows/arrow-down-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-down-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-left-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-left-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-right-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-right-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-up-icon/index.d.ts +2 -0
- package/lib/icons/arrows/arrow-up-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-down-circle-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-down-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-down-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-left-circle-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-left-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-left-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-right-circle-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-right-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-right-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-up-circle-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-up-icon/index.d.ts +2 -0
- package/lib/icons/arrows/chevron-up-square-icon/index.d.ts +2 -0
- package/lib/icons/arrows/index.d.ts +20 -0
- package/lib/icons/common/home-icon/index.d.ts +1 -1
- package/lib/icons/index.d.ts +1 -0
- package/lib/icons.js +1 -1
- package/lib/mock-data/index.d.ts +1 -0
- package/lib/mock-data/pipeline-collectors/index.d.ts +6 -0
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme/animations/index.d.ts +4 -0
- package/lib/theme/palletes/index.d.ts +5 -1
- package/lib/theme.js +1 -1
- package/lib/types/common/index.d.ts +7 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types/pipeline-collectors/index.d.ts +102 -0
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +17 -19
- package/lib/chunks/ui-components-a3c3ae8b.js +0 -1770
- package/lib/chunks/vendor-f206ac21.js +0 -1
package/lib/containers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperativeHandle as o,useMemo as l,Fragment as r,useCallback as s,Children as c}from"react";import d,{css as u}from"styled-components";import{
|
|
1
|
+
import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperativeHandle as o,useMemo as l,Fragment as r,useCallback as s,Children as c}from"react";import d,{css as u}from"styled-components";import{r as p,s as m,A as h,K as g,t as y,v,w as b,x as f,y as x,z as $,E as C,G as S,H as k,J as w,L as T,M as D,N,T as E,Q as O,R as F,U as I,V as A,X as M,Y as R,Z as L,_ as P,$ as K,a0 as j,a1 as V,a2 as q,a3 as z,a4 as H,q as B,a5 as W,a6 as _,a7 as U,a8 as J,a9 as G,aa as Y,ab as X,c as Z,ac as Q,ad as ee,ae as te,af as ie,ag as ae,ah as ne,ai as oe,aj as le,ak as re,al as se,k as ce,am as de,an as ue,ao as pe,ap as me,aq as he,ar as ge,as as ye,at as ve,au as be,av as fe,aw as xe,ax as $e,ay as Ce,az as Se,aA as ke,C as we,aB as Te,aC as De,aD as Ne,aE as Ee,aF as Oe,aG as Fe,aH as Ie,aI as Ae,aJ as Me,F as Re,aK as Le,aL as Pe,aM as Ke,aN as je,aO as Ve,aP as qe,aQ as ze,aR as He,aS as Be,aT as We,aU as _e,aV as Ue,aW as Je,aX as Ge,aY as Ye,aZ as Xe,a_ as Ze,a$ as Qe,b0 as et,b1 as tt,b2 as it,b3 as at,b4 as nt,b5 as ot,b6 as lt,b7 as rt,b8 as st,b9 as ct,ba as dt,bb as ut,bc as pt,bd as mt,be as ht,bf as gt,bg as yt,bh as vt,bi as bt,bj as ft,bk as xt,bl as $t,bm as Ct,bn as St,bo as kt,bp as wt,bq as Tt,br as Dt,bs as Nt,bt as Et,bu as Ot,bv as Ft,bw as It,bx as At,by as Mt,bz as Rt,bA as Lt,bB as Pt,bC as Kt,bD as jt,bE as Vt,bF as qt,u as zt,bG as Ht,bH as Bt,bI as Wt,bJ as _t,bK as Ut,bL as Jt,bM as Gt,bN as Yt,bO as Xt,bP as Zt,bQ as Qt,bR as ei,bS as ti,bT as ii,bU as ai,bV as ni,bW as oi,bX as li,bY as ri,bZ as si,a as ci,b_ as di,b$ as ui,c0 as pi,c1 as mi,c2 as hi,c3 as gi,c4 as yi}from"./chunks/ui-components-c940a3cc.js";import{VSquareIcon as vi,XSquareIcon as bi,EditIcon as fi,TrashIcon as xi,OdigosLogoText as $i,PlusIcon as Ci,SearchIcon as Si,FilterIcon as ki,DataStreamIcon as wi,VIcon as Ti,OdigosLogo as Di,ArrowIcon as Ni,RefreshLeftArrowIcon as Ei,NotificationIcon as Oi,UserIcon as Fi,ImageErrorIcon as Ii,OverviewIcon as Ai,InstrumentationRuleIcon as Mi,ActionIcon as Ri,SourceIcon as Li,DestinationIcon as Pi,SlackLogo as Ki,CopyIcon as ji,KeyIcon as Vi,TerminalIcon as qi,ExclamationTriangleIcon as zi,TraceViewIcon as Hi}from"./icons.js";import{MarkerType as Bi,useNodesState as Wi,useEdgesState as _i,applyNodeChanges as Ui}from"@xyflow/react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-55cc654c.js";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";const Ji=e=>{const{type:t,name:i,notes:a,signals:n,disabled:o,fields:{collectContainerAttributes:l,collectReplicaSetAttributes:r,collectWorkloadId:s,collectClusterId:c,labelsAttributes:d,annotationsAttributes:u,clusterAttributes:y,overwriteExistingValues:v,attributeNamesToDelete:b,renames:f,piiCategories:x,fallbackSamplingRatio:$,samplingPercentage:C,endpointsFilters:S,servicesNameFilters:k,attributeFilters:w}}=e,T=[{title:p.TYPE,value:t},{type:m.ActiveStatus,title:p.STATUS,value:String(!o)},{type:m.Monitors,title:p.SIGNALS_FOR_PROCESSING,value:n?.map(e=>e.toLowerCase()).join(", ")||""},{title:p.NAME,value:i||""},{title:p.NOTES,value:a||""},{type:m.Divider}];if(t===h.K8sAttributes&&(T.push({title:"Collect Container Attributes",value:String(l)}),T.push({title:"Collect ReplicaSet Attributes",value:String(r)}),T.push({title:"Collect Workload ID",value:String(s)}),T.push({title:"Collect Cluster ID",value:String(c)}),d?.length&&T.push({type:m.Divider}),d?.forEach(({labelKey:e,attributeKey:t,from:i},a)=>{let n="";n+=`Label Key: ${e}\n`,n+=`Attribute Key: ${t}\n`,n+=`From: ${i||g.Pod}\n`,T.push({title:"Label"+(d.length>1?` #${a+1}`:""),value:n})}),u?.length&&T.push({type:m.Divider}),u?.forEach(({annotationKey:e,attributeKey:t,from:i},a)=>{let n="";n+=`Annotation Key: ${e}\n`,n+=`Attribute Key: ${t}\n`,n+=`From: ${i||g.Pod}\n`,T.push({title:"Annotation"+(u.length>1?` #${a+1}`:""),value:n})})),t===h.AddClusterInfo){T.push({title:"Overwrite Existing Values",value:String(v||!1)});let e="";y?.forEach(({attributeName:t,attributeStringValue:i},a)=>{e+=`${t}: ${i}`,a<y.length-1&&(e+=", ")}),T.push({title:"Attributes",value:e})}if(t===h.DeleteAttributes){let e="";b?.forEach((t,i)=>{e+=t,i<b.length-1&&(e+=", ")}),T.push({title:"Attributes",value:e})}if(t===h.RenameAttributes){let e="";const t=Object.entries(f||{});t.forEach(([i,a],n)=>{e+=`${i}: ${a}`,n<t.length-1&&(e+=", ")}),T.push({title:"Attributes",value:e})}if(t===h.PiiMasking){let e="";x?.forEach((t,i)=>{e+=t,i<x.length-1&&(e+=", ")}),T.push({title:"Categories",value:e})}return t===h.ErrorSampler&&T.push({title:"Sampling Ratio",value:String($)}),t===h.ProbabilisticSampler&&T.push({title:"Sampling Percentage",value:String(C)}),t===h.LatencySampler&&S?.forEach(({serviceName:e,httpRoute:t,minimumLatencyThreshold:i,fallbackSamplingRatio:a},n)=>{let o="";o+=`Service Name: ${e}\n`,o+=`HTTP Route: ${t}\n`,o+=`Min. Latency: ${i}\n`,o+=`Fallback Sampling Ratio: ${a}`,T.push({title:"Endpoint"+(S.length>1?` #${n+1}`:""),value:o})}),t===h.ServiceNameSampler&&k?.forEach(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:i},a)=>{let n="";n+=`Service Name: ${e}\n`,n+=`Sampling Ratio: ${t}\n`,n+=`Fallback Sampling Ratio: ${i}`,T.push({title:"Filter"+(k.length>1?` #${a+1}`:""),value:n})}),t===h.SpanAttributeSampler&&w?.forEach(({serviceName:e,attributeKey:t,fallbackSamplingRatio:i,condition:a},n)=>{let o="";o+=`Service Name: ${e}\n`,o+=`Attribute Key: ${t}\n`,o+=`Fallback Sampling Ratio: ${i}\n`;const l=Object.keys(a)[0];o+=`Condition: ${l}\n`,o+=`Operation: ${a[l]?.operation}\n`,o+=`Expected Value: ${a[l]?.expectedValue}`,"jsonCondition"===l&&(o+=`\nJSON Path: ${a[l].jsonPath}`),T.push({title:"Filter"+(w.length>1?` #${n+1}`:""),value:o})}),T},Gi=f.PiiCategories,Yi=d.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: row;
|
|
4
4
|
gap: 32px;
|
|
@@ -14,7 +14,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
14
14
|
padding: 4px;
|
|
15
15
|
`,ha=d(N)`
|
|
16
16
|
margin-bottom: 12px;
|
|
17
|
-
`,ga=({isUpdate:t,action:i,formData:a,formErrors:n,handleFormChange:o})=>{const l=E.useTheme();return e.createElement(ma,null,t&&e.createElement("div",null,e.createElement(ha,null,"Status"),e.createElement(O,{options:[{icon:vi,label:p.ENABLED,value:!1,selectedBgColor:l.text.success+E.opacity.hex["050"]},{icon:bi,label:p.DISABLED,value:!0,selectedBgColor:l.text.error+E.opacity.hex["050"]}],selected:a.disabled,setSelected:e=>o("disabled",e)})),!t&&e.createElement(F,{title:"",description:i.docsDescription,actionButton:e.createElement(I,{endpoint:i.docsEndpoint})}),e.createElement(A,{title:"Signals for Processing",required:!0,allowedSignals:i.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>o("signals",e),errorMessage:n.signals}),!t&&e.createElement(x,{title:"Action name",placeholder:"Use a name that describes the action",value:a.name||"",onChange:({target:{value:e}})=>o("name",e),errorMessage:n.name}),e.createElement(pa,{actionType:i.type,value:a.fields,setValue:(e,t)=>o(`fields.${e}`,t),formErrors:n}),e.createElement(M,{title:"Notes",value:a.notes||"",onChange:({target:{value:e}})=>o("notes",e),errorMessage:n.notes}))},ya=a(({children:i,width:a=640,title:r,titleTooltip:s,hideEditTitleFromEdit:c,icons:d,iconSrcs:u,isEdit:p=!1,isFormDirty:m=!1,isLastItem:h=!1,onClose:g,onEdit:y,onSave:v,onDelete:b,onCancel:f,tabs:x,headerActionButtons:$},C)=>{const S=E.useTheme(),{isThisPending:k}=R(),{addNotification:w}=L(),{drawerType:T,drawerEntityId:D,setDrawerType:O,setDrawerEntityId:F}=P();K({key:"Enter",active:p},()=>Q());const[I,A]=t(!1),[M,W]=t(!1),_=n(null),
|
|
17
|
+
`,ga=({isUpdate:t,action:i,formData:a,formErrors:n,handleFormChange:o})=>{const l=E.useTheme();return e.createElement(ma,null,t&&e.createElement("div",null,e.createElement(ha,null,"Status"),e.createElement(O,{options:[{icon:vi,label:p.ENABLED,value:!1,selectedBgColor:l.text.success+E.opacity.hex["050"]},{icon:bi,label:p.DISABLED,value:!0,selectedBgColor:l.text.error+E.opacity.hex["050"]}],selected:a.disabled,setSelected:e=>o("disabled",e)})),!t&&e.createElement(F,{title:"",description:i.docsDescription,actionButton:e.createElement(I,{endpoint:i.docsEndpoint})}),e.createElement(A,{title:"Signals for Processing",required:!0,allowedSignals:i.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>o("signals",e),errorMessage:n.signals}),!t&&e.createElement(x,{title:"Action name",placeholder:"Use a name that describes the action",value:a.name||"",onChange:({target:{value:e}})=>o("name",e),errorMessage:n.name}),e.createElement(pa,{actionType:i.type,value:a.fields,setValue:(e,t)=>o(`fields.${e}`,t),formErrors:n}),e.createElement(M,{title:"Notes",value:a.notes||"",onChange:({target:{value:e}})=>o("notes",e),errorMessage:n.notes}))},ya=a(({children:i,width:a=640,title:r,titleTooltip:s,hideEditTitleFromEdit:c,icons:d,iconSrcs:u,isEdit:p=!1,isFormDirty:m=!1,isLastItem:h=!1,onClose:g,onEdit:y,onSave:v,onDelete:b,onCancel:f,tabs:x,headerActionButtons:$},C)=>{const S=E.useTheme(),{isThisPending:k}=R(),{addNotification:w}=L(),{drawerType:T,drawerEntityId:D,setDrawerType:O,setDrawerEntityId:F}=P();K({key:"Enter",active:p},()=>Q());const[I,A]=t(!1),[M,W]=t(!1),_=n(null),U=T===H.Source,J=()=>{A(!1),W(!1)},G=()=>{J(),y&&y(!1),O(null),F(null),g?.()};o(C,()=>({closeDrawer:G}));const Y=()=>{_.current?.clearTitle(),f&&f(),J()},X=()=>{const e=_.current?.isTitleDirty();m||e?W(!0):Y()},Z=()=>{A(!0)},Q=()=>{v&&v(_.current?.getTitle()||"")},ee=l(()=>!!T&&k({entityType:T,entityId:D}),[T,D]),te=e=>{w({type:B.Warning,title:"Pending",message:`Cannot click ${e}, ${T} is pending`,hideFromHistory:!0})},ie=$||[];return y&&!p&&ie.push({"data-id":"drawer-edit",variant:"tertiary",onClick:ee?()=>te("edit"):()=>y(!0),children:e.createElement(e.Fragment,null,e.createElement(fi,null),e.createElement(N,{size:14,family:"secondary",decoration:"underline"},"Edit"))}),b&&!p&&ie.push({"data-id":"drawer-delete",variant:"tertiary",onClick:ee?()=>te(U?"uninstrument":"delete"):Z,children:e.createElement(e.Fragment,null,e.createElement(xi,null),e.createElement(N,{color:S.text.error,size:14,family:"secondary",decoration:"underline"},U?j.UNINSTRUMENT:j.DELETE))}),e.createElement(e.Fragment,null,e.createElement(V,{isOpen:!0,onClose:p?X:G,closeOnEscape:!I&&!M,width:`${a+64}px`,header:{icons:d,iconSrcs:u,title:r,titleTooltip:s,replaceTitleWith:!c&&p?e.createElement(va,{ref:_,title:r}):void 0,actionButtons:ie,tabs:x},footer:{isOpen:p,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:Q,children:j.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:X,children:j.CANCEL}],rightButtons:b?[{"data-id":"drawer-delete",variant:"tertiary",onClick:Z,children:e.createElement(e.Fragment,null,e.createElement(xi,null),e.createElement(N,{size:14,color:S.text.error,family:"secondary",decoration:"underline"},j.DELETE))}]:[]}},i),e.createElement(q,{isOpen:I,noOverlay:!0,name:`${T}${r?` (${r})`:""}`,type:T,isLastItem:h,onApprove:()=>{b&&b(),J()},onDeny:J}),e.createElement(z,{isOpen:M,noOverlay:!0,name:"edit mode",onApprove:Y,onDeny:J}))}),va=a(({title:a},n)=>{const[l,r]=t(a);return i(()=>{r(a)},[a]),o(n,()=>({getTitle:()=>l||a,isTitleDirty:()=>l!==a,clearTitle:()=>r(a)})),e.createElement(x,{"data-id":"title",value:l,onChange:e=>r(e.target.value)})});va.displayName=va.name,ya.displayName=ya.name;const ba=d.div`
|
|
18
18
|
width: 100%;
|
|
19
19
|
height: 100%;
|
|
20
20
|
max-height: calc(100vh - 220px);
|
|
@@ -24,10 +24,10 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
26
|
gap: 12px;
|
|
27
|
-
`,xa=({updateAction:i,deleteAction:a})=>{const{actions:o}=W(),{drawerType:r,drawerEntityId:s}=P(),c=n(null),d=r!==H.Action,[u,m]=t(!1),[h,g]=t(!1),{formData:y,formErrors:v,handleFormChange:b,resetFormData:f,validateForm:x,loadFormWithDrawerItem:$}=_(),C=l(()=>{if(d)return f();const e=o?.find(e=>e.id===s);return e?$(e):f(),e},[d,s,o]);if(!C)return null;const S=
|
|
27
|
+
`,xa=({updateAction:i,deleteAction:a})=>{const{actions:o}=W(),{drawerType:r,drawerEntityId:s}=P(),c=n(null),d=r!==H.Action,[u,m]=t(!1),[h,g]=t(!1),{formData:y,formErrors:v,handleFormChange:b,resetFormData:f,validateForm:x,loadFormWithDrawerItem:$}=_(),C=l(()=>{if(d)return f();const e=o?.find(e=>e.id===s);return e?$(e):f(),e},[d,s,o]);if(!C)return null;const S=U.find(({type:e})=>e===C.type)||U.find(({label:e})=>"Attributes"===e)?.items?.find(({type:e})=>e===C.type)||U.find(({label:e})=>"Samplers"===e)?.items?.find(({type:e})=>e===C.type);return e.createElement(ya,{ref:c,title:C.name||C.type,icons:[J(C.type)],isEdit:u,isFormDirty:h,onEdit:e=>{m("boolean"!=typeof e||e)},onSave:e=>{if(x({withAlert:!0,alertTitle:X.Update})){const t=e!==C.type?e:"";b("name",t),i(s,{...y,name:t}),m(!1),g(!1)}},onDelete:()=>{a(s,C.type),m(!1),g(!1),c.current?.closeDrawer()},onCancel:()=>{m(!1),g(!1),$(C)}},u&&S?e.createElement(ba,null,e.createElement(ga,{isUpdate:!0,action:S,formData:y,formErrors:v,handleFormChange:(...e)=>{g(!0),b(...e)}})):e.createElement(fa,null,e.createElement(G,{conditions:C.conditions||[]}),e.createElement(Y,{title:p.ACTION_DETAILS,data:C?Ji(C):[]})))},$a=d(Z)`
|
|
28
28
|
margin-top: 24px;
|
|
29
29
|
gap: 12px;
|
|
30
|
-
`,Ca=({createAction:i})=>{const{currentModal:a,setCurrentModal:n}=Q(),o=a===H.Action,{formData:l,formErrors:r,handleFormChange:s,resetFormData:c,validateForm:d}=_(),[u,m]=t(void 0),h=()=>{c(),m(void 0),n("")},g=()=>{if(!d({withAlert:!0,alertTitle:X.Create}))return null;i(l),h()};return K({key:"Enter",active:o},()=>g()),e.createElement(ee,{isOpen:o,onClose:h,header:{title:"Add Action"},actionComponent:e.createElement(te,{buttons:[{variant:"primary",label:"DONE",onClick:g,disabled:!u}]})},e.createElement(ie,null,e.createElement(F,{title:"Select Action",description:"Select an action to modify telemetry data before it`s sent to destinations. Choose an action type and configure its details."}),e.createElement($a,null,e.createElement(ae,{type:B.Warning,message:ne.DEFINED_FOR_ALL_STREAMS(p.ACTIONS)}),e.createElement(oe,{options:
|
|
30
|
+
`,Ca=({createAction:i})=>{const{currentModal:a,setCurrentModal:n}=Q(),o=a===H.Action,{formData:l,formErrors:r,handleFormChange:s,resetFormData:c,validateForm:d}=_(),[u,m]=t(void 0),h=()=>{c(),m(void 0),n("")},g=()=>{if(!d({withAlert:!0,alertTitle:X.Create}))return null;i(l),h()};return K({key:"Enter",active:o},()=>g()),e.createElement(ee,{isOpen:o,onClose:h,header:{title:"Add Action"},actionComponent:e.createElement(te,{buttons:[{variant:"primary",label:"DONE",onClick:g,disabled:!u}]})},e.createElement(ie,null,e.createElement(F,{title:"Select Action",description:"Select an action to modify telemetry data before it`s sent to destinations. Choose an action type and configure its details."}),e.createElement($a,null,e.createElement(ae,{type:B.Warning,message:ne.DEFINED_FOR_ALL_STREAMS(p.ACTIONS)}),e.createElement(oe,{options:U,selectedOption:u,onOptionSelect:e=>{return t=e,c(),s("type",t?.type||""),void m(t);var t},autoFocus:!u?.type})),u?.type?e.createElement("div",null,e.createElement(le,{margin:"16px 0"}),e.createElement(ga,{action:u,formData:l,formErrors:r,handleFormChange:s})):null))},Sa=e=>{const{type:t,fields:{collectContainerAttributes:i,collectReplicaSetAttributes:a,collectWorkloadId:n,collectClusterId:o,labelsAttributes:l,annotationsAttributes:r,clusterAttributes:s,overwriteExistingValues:c,attributeNamesToDelete:d,renames:u,piiCategories:p,fallbackSamplingRatio:m,samplingPercentage:y,endpointsFilters:v,attributeFilters:b,servicesNameFilters:f}}=e;let x="";if(t===h.K8sAttributes&&(i&&(x+="Container Attributes, "),a&&(x+="ReplicaSet Attributes, "),n&&(x+="Workload ID, "),o&&(x+="Cluster ID, "),l?.forEach(({labelKey:e,attributeKey:t,from:i},a)=>{x+=`Label: ${e} ${t} ${i||g.Pod} `,a===l.length-1&&(x+=", ")}),r?.forEach(({annotationKey:e,attributeKey:t,from:i},a)=>{x+=`Annotation: ${e} ${t} ${i||g.Pod} `,a===r.length-1&&(x+=", ")})),t===h.AddClusterInfo&&(x+=`Overwrite Existing: ${c}\n`,s?.forEach(({attributeName:e,attributeStringValue:t},i)=>{x+=`${e}: ${t}`,i<s.length-1&&(x+=", ")})),t===h.DeleteAttributes&&d?.forEach((e,t)=>{x+=e,t<d.length-1&&(x+=", ")}),t===h.RenameAttributes){const e=Object.entries(u||{});e.forEach(([t,i],a)=>{x+=`${t}: ${i}`,a<e.length-1&&(x+=", ")})}return t===h.PiiMasking&&p?.forEach((e,t)=>{x+=e,t<p.length-1&&(x+=", ")}),t===h.ErrorSampler&&(x+=String(m)),t===h.ProbabilisticSampler&&(x+=String(y),x+="%"),t===h.LatencySampler&&v?.forEach(({serviceName:e,httpRoute:t,minimumLatencyThreshold:i,fallbackSamplingRatio:a},n)=>{x+=`Endpoint${v.length>1?` #${n+1}`:""}=${e}${t}\n`,x+=` Latency=${i}`,x+=` Sampling=${a}`,n<v.length-1&&(x+=", ")}),t===h.ServiceNameSampler&&f?.forEach(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:i})=>{x+=`Service Name: ${e}, `,x+=`Sampling Ratio: ${t}, `,x+=`Fallback Sampling Ratio: ${i}\n`}),t===h.SpanAttributeSampler&&b?.forEach(({serviceName:e,attributeKey:t,fallbackSamplingRatio:i})=>{x+=`Service Name: ${e}, `,x+=`Attribute Key: ${t}, `,x+=`Fallback Sampling Ratio: ${i}\n`}),x},ka=({conditions:t,id:i})=>{const{errors:a,warnings:n,disableds:o,hasLoadings:r}=l(()=>re(t),[t]),s=a.length>0?a:n.length>0?n:o.length>0?o:[];if(s.length>0)return e.createElement("div",{style:{lineHeight:1}},e.createElement(wa,{conditions:s,id:i}));const c=r?pe.Loading:B.Success;return e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:c,title:c,withBorder:!0,withIcon:!0}))},wa=({conditions:t,id:i})=>{const a=E.useTheme();return e.createElement(ce,null,de(t).map(({status:t,type:n,reason:o,message:l,lastTransitionTime:r},s)=>{"loading"!==t&&"disabled"!==t||(t=B.Info);const c=me(t,a);return e.createElement(ue,{key:`condition-${i}-${t}-${n}-${s}`,titleIcon:c,title:n,text:l||o||"",timestamp:r},e.createElement(se,{status:t,title:o||n,withBorder:!0,withIcon:!0}))}))},Ta=({instrumentationRules:e,sources:t,actions:i,destinations:a,searchText:n,selectedCategory:o})=>{const l=n?e.filter(e=>e.type?.toLowerCase().includes(n)||e.ruleName?.toLowerCase().includes(n)):e,r=n?t.filter(e=>e.name?.toLowerCase().includes(n)||e.otelServiceName?.toLowerCase().includes(n)||e.namespace?.toLowerCase().includes(n)):t,s=n?i.filter(e=>e.type?.toLowerCase().includes(n)||e.name?.toLowerCase().includes(n)):i,c=n?a.filter(e=>e.destinationType.displayName?.toLowerCase().includes(n)||e.name?.toLowerCase().includes(n)):a,d=[{category:H.Source,label:"Sources",count:r.length,entities:[]},{category:H.Action,label:"Actions",count:s.length,entities:[]},{category:H.Destination,label:"Destinations",count:c.length,entities:[]},{category:H.InstrumentationRule,label:"Instrumentation Rules",count:l.length,entities:[]}];d.unshift({category:"all",label:"All",count:l.length+r.length+s.length+c.length,entities:[]});const u=d.filter(({count:e,category:t})=>!!e&&"all"!==t&&["all",t].includes(o)).map(e=>({...e,entities:e.category===H.InstrumentationRule?l:e.category===H.Source?r:e.category===H.Action?s:e.category===H.Destination?c:[]}));return{categories:d,searchResults:u}},Da=[{key:"icon",title:""},{key:"name",title:p.NAME,sortable:!0},{key:"signals",title:p.MONITORS},{key:"active-status",title:p.STATUS},{key:"conditions",title:"Conditions"},{key:"type",title:p.TYPE,sortable:!0},{key:"spec",title:"Spec",sortable:!0},{key:"notes",title:p.NOTES,sortable:!0}],Na=({maxHeight:t,maxWidth:i})=>{const a=E.useTheme(),n=he(),{actions:o,actionsLoading:r}=W(),{setDrawerType:s,setDrawerEntityId:c}=P(),d=l(()=>Ta({instrumentationRules:[],sources:[],actions:ge(o,n),destinations:[],searchText:n.searchText,selectedCategory:H.Action}).searchResults.find(({category:e})=>e===H.Action)?.entities||[],[o,n]),u=l(()=>d.map(t=>{const{hasErrors:i,hasWarnings:n,hasDisableds:o}=re(t.conditions||[]);return{status:i?B.Error:n?B.Warning:void 0,faded:o,onClick:()=>{s(H.Action),c(t.id)},cells:[{columnKey:"icon",component:()=>e.createElement(ye,{icon:J(t.type)})},{columnKey:"name",value:ve(t,H.Action,{prioritizeDisplayName:!0})},{columnKey:"type",value:t.type,textColor:a.text.info},{columnKey:"notes",value:t.notes,textColor:a.text.info,withTooltip:!0},{columnKey:"spec",value:Sa(t),textColor:a.text.info,withTooltip:!0},{columnKey:"signals",component:()=>e.createElement(be,{withLabels:!0,monitors:t.signals||[]})},{columnKey:"conditions",component:()=>e.createElement(ka,{conditions:t.conditions||[],id:t.id})},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:t.disabled?B.Error:B.Success,title:t.disabled?p.DISABLED:p.ENABLED,withIcon:!0,withBorder:!0}))}]}}),[d]),{badge:m,badgeTooltip:h}=l(()=>d.length!==o.length?{badge:`${d.length}/${o.length}`,badgeTooltip:p.FILTERED_COUNT_TOOLTIP}:{badge:o.length,badgeTooltip:void 0},[d,o]);return e.createElement(fe,{$maxWidth:i},e.createElement(xe,null,e.createElement($e,{icon:Ce(H.Action),title:p.ACTIONS,badge:m,badgeTooltip:h,loading:r})),e.createElement(Se,{$maxHeight:t},e.createElement(ke,{columns:Da,rows:u})),!d.length&&e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(Te,null)))},Ea=d(Z)`
|
|
31
31
|
// width: 100vw;
|
|
32
32
|
// height: 100vh;
|
|
33
33
|
gap: 64px;
|
|
@@ -124,20 +124,20 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
124
124
|
justify-content: center;
|
|
125
125
|
|
|
126
126
|
pointer-events: none;
|
|
127
|
-
`,Wa=({height:t,entityType:i,entities:a,metrics:n,isVm:o})=>{const r=l(()=>a.map(t=>{const a=Le(t);if(!a)return null;const l=[H.Source,H.Destination].includes(i),r=[H.Destination,H.Action].includes(i),s=[H.Destination,H.Action,H.InstrumentationRule].includes(i),c=r?i==H.Destination?Pe(t.exportedSignals):t.signals:void 0,d=l?n?.[`${i.toLowerCase()}s`]?.find(e=>JSON.stringify(Le(e))===JSON.stringify(a)):void 0,u=s?!t.disabled:void 0,p=ve(t,i,{extended:i===H.Source,prioritizeDisplayName:i!==H.Source}),m=((e,t,i)=>{switch(e){case H.Source:return i?`${t.kind}`:`${t.namespace} • ${t.kind}`;case H.Destination:return t.destinationType.displayName;case H.Action:case H.InstrumentationRule:return t.type;default:return""}})(i,t,o),h=l?Ke(d?.throughput):void 0,{priorotizedStatus:g,hasDisableds:y}=re(t.conditions||[]),{icons:v,icon:b,iconSrc:f}=((e,t)=>{switch(e){case H.Source:return{icons:ze(t.containers),icon:Ce(e)};case H.Destination:return qe(t.destinationType.type);case H.Action:return{icon:
|
|
127
|
+
`,Wa=({height:t,entityType:i,entities:a,metrics:n,isVm:o})=>{const r=l(()=>a.map(t=>{const a=Le(t);if(!a)return null;const l=[H.Source,H.Destination].includes(i),r=[H.Destination,H.Action].includes(i),s=[H.Destination,H.Action,H.InstrumentationRule].includes(i),c=r?i==H.Destination?Pe(t.exportedSignals):t.signals:void 0,d=l?n?.[`${i.toLowerCase()}s`]?.find(e=>JSON.stringify(Le(e))===JSON.stringify(a)):void 0,u=s?!t.disabled:void 0,p=ve(t,i,{extended:i===H.Source,prioritizeDisplayName:i!==H.Source}),m=((e,t,i)=>{switch(e){case H.Source:return i?`${t.kind}`:`${t.namespace} • ${t.kind}`;case H.Destination:return t.destinationType.displayName;case H.Action:case H.InstrumentationRule:return t.type;default:return""}})(i,t,o),h=l?Ke(d?.throughput):void 0,{priorotizedStatus:g,hasDisableds:y}=re(t.conditions||[]),{icons:v,icon:b,iconSrc:f}=((e,t)=>{switch(e){case H.Source:return{icons:ze(t.containers),icon:Ce(e)};case H.Destination:return qe(t.destinationType.type);case H.Action:return{icon:J(t.type)};case H.InstrumentationRule:return{icon:Ve(t.type)};default:return{icon:Ce(e)}}})(i,t);return e.createElement(za,{key:JSON.stringify(a),entityType:i,entityId:a,raw:t,title:p,subTitle:m,faded:y,status:g,label:h,icons:v,icon:b,iconSrc:f,monitors:c,isActive:u})}),[a,i,n,o]);return e.createElement(Ha,{$height:t},e.createElement(je,{containerHeight:t-24,elementHeight:80,elements:r}),e.createElement(Ba,{$hide:!0}))},_a=d.div`
|
|
128
128
|
width: ${({$isVm:e})=>e?"45vw":"22vw"};
|
|
129
129
|
|
|
130
130
|
display: flex;
|
|
131
131
|
flex-direction: column;
|
|
132
132
|
gap: 12px;
|
|
133
|
-
`,
|
|
133
|
+
`,Ua=({entityType:t,entities:i,unfilteredCount:a,metrics:n,loading:o,maxHeight:l,isVm:r})=>{const s=i.length!==a,c=Math.min(l,80*i.length+12);return r&&[H.InstrumentationRule,H.Action].includes(t)?null:e.createElement(_a,{$isVm:r},e.createElement(Va,{entityType:t,badge:s?`${i.length}/${a}`:a,badgeTooltip:s?p.FILTERED_COUNT_TOOLTIP:void 0,isLoading:o}),i.length?e.createElement(Wa,{height:c,entityType:t,entities:i,metrics:n,isVm:r}):o?e.createElement(He,{size:3}):e.createElement(Ra,{entityType:t,description:p.TO_COLLECT_OTEL_DATA}))},Ja=d.div`
|
|
134
134
|
width: 100%;
|
|
135
135
|
height: ${({$height:e})=>e};
|
|
136
136
|
|
|
137
137
|
display: flex;
|
|
138
138
|
justify-content: space-evenly;
|
|
139
139
|
gap: 24px;
|
|
140
|
-
`,Ga=({height:a,metrics:n})=>{const{isVm:o}=Be(),l=he(),{selectedStreamName:r}=We(),{containerRef:s,containerHeight:c}=_e(),{sources:d,sourcesLoading:u,destinations:p,destinationsLoading:m,actions:h,actionsLoading:g,instrumentationRules:y,instrumentationRulesLoading:v}=W(),[b,f]=t([]),[x,$]=t([]),[C,S]=t([]),[k,w]=t([]);return i(()=>{f(Je(
|
|
140
|
+
`,Ga=({height:a,metrics:n})=>{const{isVm:o}=Be(),l=he(),{selectedStreamName:r}=We(),{containerRef:s,containerHeight:c}=_e(),{sources:d,sourcesLoading:u,destinations:p,destinationsLoading:m,actions:h,actionsLoading:g,instrumentationRules:y,instrumentationRulesLoading:v}=W(),[b,f]=t([]),[x,$]=t([]),[C,S]=t([]),[k,w]=t([]);return i(()=>{f(Ue(Je(d,r),l))},[d,r,l]),i(()=>{$(Ge(Ye(p,r),l))},[p,r,l]),i(()=>{S(ge(h,l))},[h,l]),i(()=>{w(y)},[y]),e.createElement(Ja,{ref:s,$height:a},e.createElement(Ua,{entityType:H.InstrumentationRule,entities:k,unfilteredCount:y.length,loading:v,maxHeight:c,isVm:o}),e.createElement(Ua,{entityType:H.Source,entities:b,unfilteredCount:d.length,metrics:n,loading:u,maxHeight:c,isVm:o}),e.createElement(Ua,{entityType:H.Action,entities:C,unfilteredCount:h.length,loading:g,maxHeight:c,isVm:o}),e.createElement(Ua,{entityType:H.Destination,entities:x,unfilteredCount:p.length,metrics:n,loading:m,maxHeight:c,isVm:o}))},Ya=d.div`
|
|
141
141
|
position: relative;
|
|
142
142
|
max-width: 200px;
|
|
143
143
|
`;d.div`
|
|
@@ -155,7 +155,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
155
155
|
display: flex;
|
|
156
156
|
align-items: center;
|
|
157
157
|
overflow-x: scroll;
|
|
158
|
-
`,Za=({onClose:a})=>{const n=E.useTheme(),{onClickNode:o}=Xe(),{searchText:s}=he(),{selectedStreamName:c}=We(),{sources:d,destinations:u,actions:p,instrumentationRules:m}=W(),{popupRef:h,popupOpen:g,setPopupOpen:y,popupPosition:v,handlePosition:b}=Ze();i(()=>{g||(b(0,50),y(!0))},[g]);const[f,x]=t("all"),{categories:$,searchResults:C}=l(()=>Ta({instrumentationRules:m,sources:
|
|
158
|
+
`,Za=({onClose:a})=>{const n=E.useTheme(),{onClickNode:o}=Xe(),{searchText:s}=he(),{selectedStreamName:c}=We(),{sources:d,destinations:u,actions:p,instrumentationRules:m}=W(),{popupRef:h,popupOpen:g,setPopupOpen:y,popupPosition:v,handlePosition:b}=Ze();i(()=>{g||(b(0,50),y(!0))},[g]);const[f,x]=t("all"),{categories:$,searchResults:C}=l(()=>Ta({instrumentationRules:m,sources:Je(d,c),actions:p,destinations:Ye(u,c),searchText:s,selectedCategory:f}),[m,d,p,u,c,s,f]);return C.length?e.createElement(Qe,{ref:h,isOpen:g,top:v.top,left:v.left,maxWidth:"420px",header:e.createElement(Xa,null,$.map(({category:t,label:i,count:a})=>!!a&&e.createElement(et,{key:`category-select-${t}`,label:i,badgeLabel:a,isSelected:f===t,onClick:()=>x(t)})))},C.map(({category:t,label:i,entities:l},s)=>!!l.length&&e.createElement(r,{key:`category-list-${t}`},e.createElement(tt,{style:{maxHeight:"all"!==f?"240px":"140px",padding:"12px 0"}},e.createElement(N,{size:12,family:"secondary",color:n.text.darker_grey,style:{marginLeft:"16px"}},i),l.map((i,n)=>e.createElement(et,{key:`entity-${s}-${n}`,icon:Ce(t),label:ve(i,t,{extended:!0}),onClick:()=>{const e=Le(i);o(null,{data:{type:t,id:e}}),a()},style:{width:"100%",justifyContent:"flex-start"},color:"transparent"}))),e.createElement(le,{thickness:s===C.length-1?0:1,length:"90%",margin:"8px auto"})))):e.createElement(Qe,{ref:h,isOpen:g,top:v.top,left:v.left},e.createElement(Te,null))},Qa=({preventPopup:i=!1})=>{const{searchText:a,setSearchText:o}=he(),[l,r]=t(!1),s=!!a||l,c=()=>{o(""),r(!1)},d=n(null);return it(d,c),K({key:"Escape",active:s},c),e.createElement(Ya,{ref:d},e.createElement(x,{placeholder:"Search",icon:Si,value:a,onChange:e=>o(e.target.value.toLowerCase()),onFocus:()=>r(!0)}),s&&!i?e.createElement(Za,{onClose:c}):null)},en=({sources:t,title:i="Condition",value:a,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t.forEach(({conditions:t})=>{t?.forEach(({type:t,reason:i})=>{e.find(e=>e.id===`${t}#${i}`)||e.push({id:`${t}#${i}`,value:`${at(t)} - ${at(i)}`})})}),e.sort((e,t)=>e.id?.localeCompare(t.id||"")||0)},[t]);return e.createElement(nt,{disabled:!s?.length,title:i,placeholder:"All",options:s,value:a,onSelect:n,onDeselect:o,...r})},tn=({sources:t,title:i="Error Message",value:a,onSelect:n,onDeselect:o,disabled:r,...s})=>{const c=l(()=>{const e=[];return t.forEach(({conditions:t})=>{de(t||[]).forEach(({status:t,message:i,reason:a})=>{t!==B.Error||e.find(e=>e.id===i)||(i?e.find(e=>e.id===i)||e.push({id:i,value:i}):a&&(e.find(e=>e.id===a)||e.push({id:a,value:a})))})}),e},[t]);return e.createElement(nt,{disabled:r||!c?.length,title:i,placeholder:"All",options:c,value:a,onSelect:n,onDeselect:o,...s})},an=({sources:t,title:i="Programming Language",value:a,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t.forEach(({containers:t})=>{t?.forEach(({language:t})=>{e.find(e=>e.id===t)||e.push({id:t,value:ot[t]||t})})}),e.sort((e,t)=>e.id?.localeCompare(t.id||"")||0)},[t]);return e.createElement(nt,{disabled:!s?.length,title:i,placeholder:"All",options:s,value:a,onSelect:n,onDeselect:o,...r})},nn=({title:t="Monitors",value:i,onSelect:a,onDeselect:n,...o})=>{const r=l(()=>{const e=[];return lt.forEach(({id:t,value:i})=>{e.find(e=>e.id===t)||e.push({id:t,value:i})}),e},[]);return e.createElement(nt,{disabled:!r?.length,title:t,placeholder:"All",options:r,value:i,onSelect:a,onDeselect:n,...o})},on=({namespaces:t,title:i="Namespace",value:a,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t?.forEach(({name:t})=>{e.find(e=>e.id===t)||e.push({id:t,value:t})}),e},[t]);return e.createElement(nt,{disabled:!s?.length,title:i,placeholder:"Select namespace",options:s,value:a,onSelect:n,onDeselect:o,...r})},ln=({sources:t,title:i="Kind",value:a,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t.forEach(({kind:t})=>{e.find(e=>e.id===t)||e.push({id:t,value:t})}),e},[t]);return e.createElement(nt,{disabled:!s?.length,title:i,placeholder:"All",options:s,value:a,onSelect:n,onDeselect:o,...r})},rn=d.div`
|
|
159
159
|
display: flex;
|
|
160
160
|
flex-direction: column;
|
|
161
161
|
gap: 12px;
|
|
@@ -167,7 +167,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
167
167
|
${({$color:e})=>`color: ${e};`}
|
|
168
168
|
`,dn=d.div`
|
|
169
169
|
margin-left: auto;
|
|
170
|
-
`,un=e=>{let t=0;return Object.values(e).forEach(e=>{e&&Array.isArray(e)&&e.length>0&&(t+=e.length)}),e.onlyErrors&&t++,e.searchText&&t++,t},pn=()=>{const a=E.useTheme(),{isVm:o}=Be(),{namespaces:r,sources:s}=W(),{selectedStreamName:c}=We(),{getItemSS:d,setItemSS:u,removeItemSS:p}=st(),{popupRef:m,popupOpen:h,setPopupOpen:g,popupPosition:y,handlePosition:v}=Ze(),{namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:w,setAll:T,clearAll:D,getEmptyState:N}=he(),O=l(()=>
|
|
170
|
+
`,un=e=>{let t=0;return Object.values(e).forEach(e=>{e&&Array.isArray(e)&&e.length>0&&(t+=e.length)}),e.onlyErrors&&t++,e.searchText&&t++,t},pn=()=>{const a=E.useTheme(),{isVm:o}=Be(),{namespaces:r,sources:s}=W(),{selectedStreamName:c}=We(),{getItemSS:d,setItemSS:u,removeItemSS:p}=st(),{popupRef:m,popupOpen:h,setPopupOpen:g,popupPosition:y,handlePosition:v}=Ze(),{namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:w,setAll:T,clearAll:D,getEmptyState:N}=he(),O=l(()=>Je(s,c),[s,c]),[F,I]=t({namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:w}),[A,M]=t(un(F));i(()=>{const e=d(rt.OVERVIEW_FILTERS,N());T(e)},[]),i(()=>{if(!h){const e={namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:w};I(e),M(un(e))}},[h,b,f,x,$,C,S,w]);const R=()=>{g(!1)},L=n(null);return it(L,R),K({key:"Escape",active:h},R),e.createElement(Ya,{ref:L},e.createElement(et,{label:"Filters",icon:ki,badgeLabel:A,badgeFilled:!!A,withBorder:!0,color:"transparent",onClick:()=>{v(0,50),g(!0)}}),e.createElement(Qe,{ref:m,isOpen:h,top:y.top,left:y.left,width:"420px",footer:e.createElement(ce,null,e.createElement(cn,{variant:"primary",onClick:()=>{u(rt.OVERVIEW_FILTERS,F),T(F),M(un(F)),g(!1)}},"Apply"),e.createElement(cn,{variant:"secondary",onClick:R},"Cancel"),e.createElement(dn,null,e.createElement(cn,{variant:"tertiary",onClick:()=>{p(rt.OVERVIEW_FILTERS),D(),I(N()),M(0),g(!1)},$color:a.text.error},"Reset")))},e.createElement(rn,null,!o&&e.createElement(on,{namespaces:r,value:F.namespaces,onSelect:e=>I(t=>({...t,namespaces:[...t.namespaces||[],e]})),onDeselect:e=>I(t=>({...t,namespaces:(t.namespaces||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(ln,{sources:O,value:F.kinds,onSelect:e=>I(t=>({...t,kinds:[...t.kinds||[],e]})),onDeselect:e=>I(t=>({...t,kinds:(t.kinds||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(an,{sources:O,value:F.languages,onSelect:e=>I(t=>({...t,languages:[...t.languages||[],e]})),onDeselect:e=>I(t=>({...t,languages:(t.languages||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(nn,{value:F.monitors,onSelect:e=>I(t=>({...t,monitors:[...t.monitors||[],e]})),onDeselect:e=>I(t=>({...t,monitors:(t.monitors||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(en,{sources:O,value:F.conditions,onSelect:e=>I(t=>({...t,conditions:[...t.conditions||[],e]})),onDeselect:e=>I(t=>({...t,conditions:(t.conditions||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(sn,null,e.createElement(k,{title:"Show only sources with errors",initialValue:F.onlyErrors,onChange:e=>I(t=>({...t,errors:[],onlyErrors:e}))})),e.createElement(tn,{sources:O,value:F.errors,onSelect:e=>I(t=>({...t,errors:[...t.errors||[],e]})),onDeselect:e=>I(t=>({...t,errors:(t.errors||[]).filter(t=>t.id!==e.id)})),disabled:!F.onlyErrors,showSearch:!0,required:!0,isMulti:!0}))))},mn=d.div`
|
|
171
171
|
display: flex;
|
|
172
172
|
flex-direction: column;
|
|
173
173
|
gap: 24px;
|
|
@@ -196,7 +196,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
196
196
|
width: 100%;
|
|
197
197
|
`,Cn=d.div`
|
|
198
198
|
width: 100%;
|
|
199
|
-
`,Sn=({onClickNewDataStream:i,updateDataStream:a,deleteDataStream:n})=>{const o=E.useTheme(),{
|
|
199
|
+
`,Sn=({onClickNewDataStream:i,updateDataStream:a,deleteDataStream:n})=>{const o=E.useTheme(),{clearStore:r}=dt(),{popupRef:s,popupOpen:c,setPopupOpen:d,popupPosition:u,handlePosition:p}=Ze(),{dataStreams:m,selectedStreamName:h,setSelectedStreamName:g}=We(),[y,v]=t(""),[b,f]=t(""),[$,C]=t(""),S=l(()=>m.filter(({name:e})=>!$||e.toLowerCase().includes($.toLowerCase())).map(({name:t})=>e.createElement($n,{key:`stream-${t}`},e.createElement(Cn,null,e.createElement(et,{label:t,isSelected:h===t,onClick:()=>{r(),g(t),d(!1)},color:"transparent",style:{width:"100%",justifyContent:"flex-start"}})),t!==ut&&e.createElement(pt,{onClick:()=>f(t),tooltip:j.DELETE},e.createElement(xi,null)),e.createElement(pt,{onClick:()=>v(t),tooltip:j.EDIT},e.createElement(fi,null)))),[m,h,$]);return e.createElement(e.Fragment,null,e.createElement(vn,null,e.createElement(bn,{$gap:0},e.createElement(Fe,{variant:"tertiary",onClick:()=>{p(0,50),d(e=>!e)}},e.createElement(wi,{fill:o.text.info}),e.createElement(fn,null,"Data Stream: ",h),e.createElement(mt,{extend:c}),e.createElement(Ne,{label:m.length})),e.createElement(le,{orientation:"vertical",length:"32px",thickness:2,margin:"0"}),e.createElement(ht,{onClick:()=>{r(),i()},label:j.NEW})),e.createElement(Qe,{ref:s,isOpen:c,top:u.top,left:u.left,header:e.createElement(x,{placeholder:"Search...",icon:Si,value:$,onChange:e=>C(e.target.value)})},e.createElement(xn,null,S))),e.createElement(q,{isOpen:""!==b,name:b,onApprove:()=>{n(b),f("")},onDeny:()=>{f("")}}),e.createElement(yn,{isOpen:""!==y,onClose:()=>{v("")},dataStreamName:y,updateDataStream:a}))},kn=d.div`
|
|
200
200
|
display: flex;
|
|
201
201
|
align-items: center;
|
|
202
202
|
margin: 20px 0;
|
|
@@ -254,7 +254,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
254
254
|
`,_n=d.div`
|
|
255
255
|
width: 170px;
|
|
256
256
|
margin-right: 8px;
|
|
257
|
-
`,
|
|
257
|
+
`,Un=d.div`
|
|
258
258
|
display: flex;
|
|
259
259
|
flex-direction: column;
|
|
260
260
|
align-self: stretch;
|
|
@@ -265,9 +265,9 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
265
265
|
@media (height < 800px) {
|
|
266
266
|
max-height: calc(100vh - 400px);
|
|
267
267
|
}
|
|
268
|
-
`,
|
|
268
|
+
`,Jn=d(Bn)`
|
|
269
269
|
margin-top: 80px;
|
|
270
|
-
`,{MANAGED:Gn,SELF_HOSTED:Yn,DETECTED:Xn,EXISTS:Zn}=kt,Qn=[{value:"All types",id:"all"},{value:Gn.TITLE,id:Gn.TITLE},{value:Yn.TITLE,id:Yn.TITLE},{value:Xn.TITLE,id:Xn.TITLE},{value:Zn.TITLE,id:Zn.TITLE}],eo=Qn[0],to=[xt.Logs,xt.Metrics,xt.Traces],io=(e,t,i)=>e.map(e=>{const{type:a,displayName:n}=e.destinationType,o=e.dataStreamNames?.includes(t),l=i.has(e.id);return{id:e.id,type:a,displayName:n,selected:o||l,fields:[],testConnectionSupported:!1,supportedSignals:{[xt.Logs]:{supported:e.exportedSignals.logs},[xt.Metrics]:{supported:e.exportedSignals.metrics},[xt.Traces]:{supported:e.exportedSignals.traces}}}}),ao=({hidden:i,categories:a,potentialDestinations:n,onSelectNew:o,onSelectConfigured:r,isLoadingForDestinationIds:s})=>{const{destinations:c}=W(),{selectedStreamName:d}=We(),{configuredDestinations:u,configuredDestinationsUpdateOnly:p}=dt(),[m,h]=t(""),[g,y]=t(eo),[v,b]=t(to),f=l(()=>{const e=wt(a);return e.unshift({name:Zn.TITLE,description:Zn.DESCRIPTION,icon:Ti,items:io(c,d,new Set(u.concat(p).map(e=>e.id)))}),e.unshift({name:Xn.TITLE,description:Xn.DESCRIPTION,icon:Di,items:n}),e.map(e=>{const t=e.items.filter(t=>{const i=!m||t.displayName.toLowerCase().includes(m.toLowerCase()),a="all"===g.id||g.id===e.name,n=v.some(e=>t.supportedSignals[e.toLowerCase()]?.supported);return i&&a&&n});return{...e,items:t}}).filter(({items:e})=>!!e.length)},[a,n,c,m,g,v,d,u,p]);return i?null:e.createElement(Bn,null,e.createElement(F,{title:"Choose destination",description:"Add backend destination you want to connect with Odigos."}),e.createElement(Wn,null,e.createElement(_n,null,e.createElement(x,{placeholder:"Search...",icon:Si,value:m,onChange:({target:{value:e}})=>h(e)})),e.createElement(_n,null,e.createElement(nt,{options:Qn,value:g,onSelect:y,onDeselect:()=>{}})),e.createElement(A,{title:"",selectedSignals:v,setSelectedSignals:b})),e.createElement(le,null),f.length?e.createElement(
|
|
270
|
+
`,{MANAGED:Gn,SELF_HOSTED:Yn,DETECTED:Xn,EXISTS:Zn}=kt,Qn=[{value:"All types",id:"all"},{value:Gn.TITLE,id:Gn.TITLE},{value:Yn.TITLE,id:Yn.TITLE},{value:Xn.TITLE,id:Xn.TITLE},{value:Zn.TITLE,id:Zn.TITLE}],eo=Qn[0],to=[xt.Logs,xt.Metrics,xt.Traces],io=(e,t,i)=>e.map(e=>{const{type:a,displayName:n}=e.destinationType,o=e.dataStreamNames?.includes(t),l=i.has(e.id);return{id:e.id,type:a,displayName:n,selected:o||l,fields:[],testConnectionSupported:!1,supportedSignals:{[xt.Logs]:{supported:e.exportedSignals.logs},[xt.Metrics]:{supported:e.exportedSignals.metrics},[xt.Traces]:{supported:e.exportedSignals.traces}}}}),ao=({hidden:i,categories:a,potentialDestinations:n,onSelectNew:o,onSelectConfigured:r,isLoadingForDestinationIds:s})=>{const{destinations:c}=W(),{selectedStreamName:d}=We(),{configuredDestinations:u,configuredDestinationsUpdateOnly:p}=dt(),[m,h]=t(""),[g,y]=t(eo),[v,b]=t(to),f=l(()=>{const e=wt(a);return e.unshift({name:Zn.TITLE,description:Zn.DESCRIPTION,icon:Ti,items:io(c,d,new Set(u.concat(p).map(e=>e.id)))}),e.unshift({name:Xn.TITLE,description:Xn.DESCRIPTION,icon:Di,items:n}),e.map(e=>{const t=e.items.filter(t=>{const i=!m||t.displayName.toLowerCase().includes(m.toLowerCase()),a="all"===g.id||g.id===e.name,n=v.some(e=>t.supportedSignals[e.toLowerCase()]?.supported);return i&&a&&n});return{...e,items:t}}).filter(({items:e})=>!!e.length)},[a,n,c,m,g,v,d,u,p]);return i?null:e.createElement(Bn,null,e.createElement(F,{title:"Choose destination",description:"Add backend destination you want to connect with Odigos."}),e.createElement(Wn,null,e.createElement(_n,null,e.createElement(x,{placeholder:"Search...",icon:Si,value:m,onChange:({target:{value:e}})=>h(e)})),e.createElement(_n,null,e.createElement(nt,{options:Qn,value:g,onSelect:y,onDeselect:()=>{}})),e.createElement(A,{title:"",selectedSignals:v,setSelectedSignals:b})),e.createElement(le,null),f.length?e.createElement(Un,null,e.createElement(Hn,{items:f,onSelectNew:e=>o(e,v),onSelectConfigured:r,isLoadingForDestinationIds:s})):e.createElement(Jn,null,e.createElement(Te,{title:"No destinations found"})))},no=d.div`
|
|
271
271
|
display: flex;
|
|
272
272
|
`,oo=d.div`
|
|
273
273
|
border-right: 1px solid ${({theme:e})=>e.colors.border};
|
|
@@ -276,7 +276,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
276
276
|
@media (max-width: 1050px) {
|
|
277
277
|
display: none;
|
|
278
278
|
}
|
|
279
|
-
`,lo=({isOnboarding:i,categories:a,potentialDestinations:n,createDestination:o,updateDestination:l,deleteDestination:r,testConnection:s})=>{const{destinations:c}=W(),{selectedStreamName:d}=We(),{currentModal:u,setCurrentModal:m}=Q(),{addConfiguredDestination:h,addConfiguredDestinationUpdateOnly:g,removeConfiguredDestinationUpdateOnly:y,configuredDestinationsUpdateOnly:v}=dt(),b=u===H.Destination,[f,x]=t(void 0),{formData:$,formErrors:C,handleFormChange:S,resetFormData:k,validateForm:w,setYamlFields:T,dynamicFields:D,setDynamicFields:N,loadFormWithDrawerItem:E}=$t({supportedSignals:f?.supportedSignals,preLoadedFields:f?.fields}),[O,F]=t([]),I=e=>{const t={};return e||D.forEach(e=>t[e.name]=e.value),{id:e?.id||"",name:e?.name||$.name,disabled:e?.disabled||$.disabled,dataStreamNames:e?.dataStreamNames||[],conditions:e?.conditions||[],exportedSignals:e?.exportedSignals||$.exportedSignals,fields:e?.fields||JSON.stringify(t),destinationType:e?.destinationType||{type:f.type,displayName:f.displayName,supportedSignals:{logs:{supported:!1},metrics:{supported:!1},traces:{supported:!1}}}}},A=async e=>{if(i&&!e){const e=I();h(e)}else if(i&&e){const t=I(e);v.some(t=>t.id===e.id)?y(e):g(t)}else if(i||e){if(!i&&e){const t=I(e),i=t.dataStreamNames.some(e=>e===d);F(t=>[...t,e.id]),i?await r(e.id):await l(e.id,E(t)),F(t=>t.filter(t=>t!==e.id))}}else o($)},M=()=>{k(),x(void 0),m("")},R=()=>{k(),x(void 0)},L=async()=>{if(f){if(!w({withAlert:!i,alertTitle:X.Create}))return null;A()}M()};return K({key:"Enter",active:b},()=>L()),e.createElement(ee,{isOpen:b,onClose:M,header:{title:p.ADD_DESTINATION},actionComponent:e.createElement(te,{buttons:(()=>{const
|
|
279
|
+
`,lo=({isOnboarding:i,categories:a,potentialDestinations:n,createDestination:o,updateDestination:l,deleteDestination:r,testConnection:s})=>{const{destinations:c}=W(),{selectedStreamName:d}=We(),{currentModal:u,setCurrentModal:m}=Q(),{addConfiguredDestination:h,addConfiguredDestinationUpdateOnly:g,removeConfiguredDestinationUpdateOnly:y,configuredDestinationsUpdateOnly:v}=dt(),b=u===H.Destination,[f,x]=t(void 0),{formData:$,formErrors:C,handleFormChange:S,resetFormData:k,validateForm:w,setYamlFields:T,dynamicFields:D,setDynamicFields:N,loadFormWithDrawerItem:E}=$t({supportedSignals:f?.supportedSignals,preLoadedFields:f?.fields}),[O,F]=t([]),I=e=>{const t={};return e||D.forEach(e=>t[e.name]=e.value),{id:e?.id||"",name:e?.name||$.name,disabled:e?.disabled||$.disabled,dataStreamNames:e?.dataStreamNames||[],conditions:e?.conditions||[],exportedSignals:e?.exportedSignals||$.exportedSignals,fields:e?.fields||JSON.stringify(t),destinationType:e?.destinationType||{type:f.type,displayName:f.displayName,supportedSignals:{logs:{supported:!1},metrics:{supported:!1},traces:{supported:!1}}}}},A=async e=>{if(i&&!e){const e=I();h(e)}else if(i&&e){const t=I(e);v.some(t=>t.id===e.id)?y(e):g(t)}else if(i||e){if(!i&&e){const t=I(e),i=t.dataStreamNames.some(e=>e===d);F(t=>[...t,e.id]),i?await r(e.id):await l(e.id,E(t)),F(t=>t.filter(t=>t!==e.id))}}else o($)},M=()=>{k(),x(void 0),m("")},R=()=>{k(),x(void 0)},L=async()=>{if(f){if(!w({withAlert:!i,alertTitle:X.Create}))return null;A()}M()};return K({key:"Enter",active:b},()=>L()),e.createElement(ee,{isOpen:b,onClose:M,header:{title:p.ADD_DESTINATION},actionComponent:e.createElement(te,{buttons:(()=>{const t=[{label:"DONE",variant:"primary",onClick:L}];return f&&t.unshift({label:"BACK",icon:()=>e.createElement(Ni,{rotate:-90}),variant:"secondary",onClick:R}),t})()})},e.createElement(no,null,e.createElement(oo,null,e.createElement(Tt,{currentStep:f?2:1,data:[{stepNumber:1,title:p.DESTINATIONS},{stepNumber:2,title:p.CONNECTION}]})),e.createElement(ie,{style:{margin:"32px 24px 12px 24px"}},e.createElement(ao,{hidden:void 0!==f,categories:a,potentialDestinations:n,onSelectNew:(e,t)=>{k(),S("type",e?.type||""),S("currentStreamName",d);const i={logs:!1,metrics:!1,traces:!1};t.filter(t=>e.supportedSignals[t].supported).forEach(e=>i[e]=!0),S("exportedSignals",i),T(e?.fields||[]),x(e)},onSelectConfigured:e=>{const t=c.find(t=>t.id===e);t&&A(t)},isLoadingForDestinationIds:O}),f&&e.createElement(Kn,{categoryItem:f,formData:$,formErrors:C,handleFormChange:S,dynamicFields:D,setDynamicFields:N,validateForm:w,testConnection:s}))))},ro=d.div`
|
|
280
280
|
display: flex;
|
|
281
281
|
flex-direction: column;
|
|
282
282
|
align-items: center;
|
|
@@ -394,19 +394,19 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
394
394
|
display: flex;
|
|
395
395
|
align-items: center;
|
|
396
396
|
justify-content: center;
|
|
397
|
-
`,Jo=d.div`
|
|
398
|
-
width: 290px;
|
|
399
397
|
`,Uo=d.div`
|
|
398
|
+
width: 290px;
|
|
399
|
+
`,Jo=d.div`
|
|
400
400
|
margin-bottom: 6px;
|
|
401
401
|
`,Go=d.div`
|
|
402
402
|
display: flex;
|
|
403
403
|
align-items: center;
|
|
404
404
|
gap: 6px;
|
|
405
|
-
`,Yo=({id:t,seen:i,type:a,title:n,message:o,time:l,crdType:r,target:s,onClick:c})=>{const d=E.useTheme(),u=zt(),{onClickNotification:p}=Ht(),m=!!r&&!!s,h=n?.toLowerCase().includes(X.Delete.toLowerCase())||!1,g=me(a,d);return e.createElement(Wo,{key:`notification-${t}`,className:m?"click-enabled":"",onClick:()=>{m&&(c(),p({id:t,crdType:r,target:s}))}},e.createElement(_o,{$type:h?B.Error:a},h?e.createElement(xi,null):e.createElement(g,null)),e.createElement(
|
|
405
|
+
`,Yo=({id:t,seen:i,type:a,title:n,message:o,time:l,crdType:r,target:s,onClick:c})=>{const d=E.useTheme(),{formatTimeAgo:u}=zt(),{onClickNotification:p}=Ht(),m=!!r&&!!s,h=n?.toLowerCase().includes(X.Delete.toLowerCase())||!1,g=me(a,d);return e.createElement(Wo,{key:`notification-${t}`,className:m?"click-enabled":"",onClick:()=>{m&&(c(),p({id:t,crdType:r,target:s}))}},e.createElement(_o,{$type:h?B.Error:a},h?e.createElement(xi,null):e.createElement(g,null)),e.createElement(Uo,null,e.createElement(Jo,null,e.createElement(N,{size:14},o)),e.createElement(Go,null,e.createElement(N,{size:10,color:d.text.grey},u(l)),!i&&e.createElement(e.Fragment,null,e.createElement(N,{size:10},"·"),e.createElement(N,{size:10,color:d.colors.orange_soft},"new")))))},Xo=(e,t,i)=>{const a=e?.serviceName||t?.otelServiceName||t?.name,n=i?[Fi]:ze(t?.containers||[]),{priorotizedStatus:o}=re(t?.conditions||[]);return{id:a,title:a,icons:n.length?n:[Ii],status:o,serviceMapEntry:e}},Zo=e=>"user"===e?.otelServiceName&&!e?.namespace&&!e?.name&&!e?.kind,Qo=d.div`
|
|
406
406
|
width: 100%;
|
|
407
407
|
height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px)`};
|
|
408
408
|
position: relative;
|
|
409
|
-
`,el={namespace:"",name:"",kind:"",otelServiceName:"user",selected:!0,numberOfInstances:0,dataStreamNames:[],containers:[],conditions:[]},tl=({heightToRemove:t,serviceMap:a})=>{const n=E.useTheme(),{sources:o,sourcesLoading:l}=W(),{containerRef:r,containerHeight:s,containerWidth:c}=_e(),[d,u,m]=Wi([]),[h,g,y]=_i([]);return i(()=>{if(s&&c){const t=(({sources:e,serviceMap:t,containerHeight:i,containerWidth:a})=>{const n=[],o=new Map,l=((e,t)=>{const i=new Map,a=new Map,n=new Map,o=new Set;e.forEach(e=>{o.add(e.serviceName),e.services.forEach(e=>{o.add(e.serviceName)})}),o.forEach(e=>{a.set(e,[]),n.set(e,0)}),e.forEach(e=>{e.services.forEach(t=>{a.get(e.serviceName)?.push(t.serviceName);const i=n.get(t.serviceName)||0;n.set(t.serviceName,i+1)})});const l=[],r=[];for(o.forEach(e=>{0===(n.get(e)||0)&&r.push(e)});r.length>0;){const e=[],t=r.length;for(let i=0;i<t;i++){const t=r.shift();e.push(t),a.get(t)?.forEach(e=>{const t=n.get(e)||0;n.set(e,t-1),t-1==0&&r.push(e)})}e.length>0&&l.push(e)}return o.forEach(e=>{l.flat().includes(e)||(0===l.length?l.push([e]):l[l.length-1].push(e))}),l.forEach((e,a)=>{const n=100+150*a,o=150*(e.length-1),l=(t-o)/2;e.forEach((e,t)=>{const a=l+150*t,o=n;i.set(e,{x:a,y:o})})}),i})(t,a);if(t.length&&e.length){t.forEach(t=>{const i=t.serviceName;if(n.find(e=>e.id===`${H.Source}-${i}-${Bt.MapItem}`))return;const a=e.find(e=>i===e.otelServiceName||i===e.name);o.set(i,t),t.services.forEach(e=>o.set(e.serviceName,{serviceName:e.serviceName,services:[]})),n.push({id:`${H.Source}-${i}-${Bt.MapItem}`,type:Bt.MapItem,position:l.get(i),data:Xo(t,a,Zo(a))})}),o.forEach((t,i)=>{if(n.find(e=>e.id===`${H.Source}-${i}-${Bt.MapItem}`))return;const a=e.find(e=>i===e.otelServiceName||i===e.name);n.push({id:`${H.Source}-${i}-${Bt.MapItem}`,type:Bt.MapItem,position:l.get(i),data:Xo(t,a,Zo(a))})});let i=50;e.forEach(e=>{const t=e.otelServiceName||e.name;n.find(e=>e.id===`${H.Source}-${t}-${Bt.MapItem}`)||(n.push({id:`${H.Source}-${t}-${Bt.MapItem}`,type:Bt.MapItem,position:{x:i,y:10},data:Xo(void 0,e,Zo(e))}),i+=110)})}else n.push({id:`${H.Source}-${Bt.NoData}`,type:Bt.NoData,position:{x:a/2-150,y:i/4},data:{subTitle:p.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}});return n})({serviceMap:a,sources:[el].concat(o),sourcesLoading:l,containerHeight:s,containerWidth:c});d.length>1?(e=t,u(t=>{const i=e.map(e=>{const i=t.find(t=>t.id===e.id);return e.position=i?.position||e.position,{id:e.id,item:e,type:i?"replace":"add"}});return t.find(e=>e.id===`${H.Source}-${Bt.NoData}`)&&i.push({id:`${H.Source}-${Bt.NoData}`,type:"remove"}),
|
|
409
|
+
`,el={namespace:"",name:"",kind:"",otelServiceName:"user",selected:!0,numberOfInstances:0,dataStreamNames:[],containers:[],conditions:[]},tl=({heightToRemove:t,serviceMap:a})=>{const n=E.useTheme(),{sources:o,sourcesLoading:l}=W(),{containerRef:r,containerHeight:s,containerWidth:c}=_e(),[d,u,m]=Wi([]),[h,g,y]=_i([]);return i(()=>{if(s&&c){const t=(({sources:e,serviceMap:t,containerHeight:i,containerWidth:a})=>{const n=[],o=new Map,l=((e,t)=>{const i=new Map,a=new Map,n=new Map,o=new Set;e.forEach(e=>{o.add(e.serviceName),e.services.forEach(e=>{o.add(e.serviceName)})}),o.forEach(e=>{a.set(e,[]),n.set(e,0)}),e.forEach(e=>{e.services.forEach(t=>{a.get(e.serviceName)?.push(t.serviceName);const i=n.get(t.serviceName)||0;n.set(t.serviceName,i+1)})});const l=[],r=[];for(o.forEach(e=>{0===(n.get(e)||0)&&r.push(e)});r.length>0;){const e=[],t=r.length;for(let i=0;i<t;i++){const t=r.shift();e.push(t),a.get(t)?.forEach(e=>{const t=n.get(e)||0;n.set(e,t-1),t-1==0&&r.push(e)})}e.length>0&&l.push(e)}return o.forEach(e=>{l.flat().includes(e)||(0===l.length?l.push([e]):l[l.length-1].push(e))}),l.forEach((e,a)=>{const n=100+150*a,o=150*(e.length-1),l=(t-o)/2;e.forEach((e,t)=>{const a=l+150*t,o=n;i.set(e,{x:a,y:o})})}),i})(t,a);if(t.length&&e.length){t.forEach(t=>{const i=t.serviceName;if(n.find(e=>e.id===`${H.Source}-${i}-${Bt.MapItem}`))return;const a=e.find(e=>i===e.otelServiceName||i===e.name);o.set(i,t),t.services.forEach(e=>o.set(e.serviceName,{serviceName:e.serviceName,services:[]})),n.push({id:`${H.Source}-${i}-${Bt.MapItem}`,type:Bt.MapItem,position:l.get(i),data:Xo(t,a,Zo(a))})}),o.forEach((t,i)=>{if(n.find(e=>e.id===`${H.Source}-${i}-${Bt.MapItem}`))return;const a=e.find(e=>i===e.otelServiceName||i===e.name);n.push({id:`${H.Source}-${i}-${Bt.MapItem}`,type:Bt.MapItem,position:l.get(i),data:Xo(t,a,Zo(a))})});let i=50;e.forEach(e=>{const t=e.otelServiceName||e.name;n.find(e=>e.id===`${H.Source}-${t}-${Bt.MapItem}`)||(n.push({id:`${H.Source}-${t}-${Bt.MapItem}`,type:Bt.MapItem,position:{x:i,y:10},data:Xo(void 0,e,Zo(e))}),i+=110)})}else n.push({id:`${H.Source}-${Bt.NoData}`,type:Bt.NoData,position:{x:a/2-150,y:i/4},data:{subTitle:p.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}});return n})({serviceMap:a,sources:[el].concat(o),sourcesLoading:l,containerHeight:s,containerWidth:c});d.length>1?(e=t,u(t=>{const i=e.map(e=>{const i=t.find(t=>t.id===e.id);return e.position=i?.position||e.position,{id:e.id,item:e,type:i?"replace":"add"}});return t.find(e=>e.id===`${H.Source}-${Bt.NoData}`)&&i.push({id:`${H.Source}-${Bt.NoData}`,type:"remove"}),Ui(i,t)})):u(t)}var e},[a,o,l,s,c]),i(()=>{g((({theme:e,nodes:t,serviceMap:i})=>{const a=[];return t.forEach(({id:t,data:{id:n,status:o}})=>{const{services:l}=i.find(e=>e.serviceName===n)||{services:[]};l.forEach(i=>{const n=t,l=`${H.Source}-${i.serviceName}-${Bt.MapItem}`,r=o===B.Error;a.push({id:`${n}-to-${l}`,source:n,target:l,markerEnd:{type:Bi.ArrowClosed},style:{stroke:r?e?.colors.dark_red:e?.colors.border}})})}),a})({theme:n,nodes:d,serviceMap:a}))},[n,d,a]),e.createElement(Qo,{ref:r,$heightToRemove:t},e.createElement(Wt,{nodes:d,edges:h,onNodesChange:m,onEdgesChange:y,zoomOnScroll:!0}))},il=d.div`
|
|
410
410
|
display: flex;
|
|
411
411
|
flex-direction: column;
|
|
412
412
|
align-items: center;
|
|
@@ -461,12 +461,12 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
461
461
|
max-height: calc(100vh - 200px);
|
|
462
462
|
height: fit-content;
|
|
463
463
|
overflow-y: scroll;
|
|
464
|
-
`,hl=({onEditStream:t,onEditSources:i,onEditDestinations:a,categories:n})=>{const{selectedStreamName:o}=We(),{configuredSources:r,configuredDestinations:s,configuredDestinationsUpdateOnly:c}=dt(),d=l(()=>Object.values(r).reduce((e,t)=>e+t.filter(e=>e.selected).length,0),[r]);return e.createElement(ie,{$isNotModal:!0},e.createElement(Z,{$gap:12},e.createElement(F,{title:p.SUMMARY,description:p.STREAM_CONFIRM}),e.createElement(ml,null,e.createElement(Y,{title:p.STREAM_NAME,action:()=>e.createElement(_t,{onClick:t}),data:[{title:"",value:o}]}),e.createElement(Y,{title:p.SELECTED_SOURCES,titleBadge:d,action:()=>e.createElement(_t,{onClick:i})},e.createElement(ul,{filteredNamespacesAndSources:r,withInstances:!1})),e.createElement(Y,{title:p.SELECTED_DESTINATIONS,titleBadge:s.length+c.length,action:()=>e.createElement(_t,{onClick:a})},e.createElement(so,{categories:n})))))};var gl;!function(e){e.Overview="overview",e.InstrumentationRules="InstrumentationRule",e.Sources="Source",e.Actions="Action",e.Destinations="Destination"}(gl||(gl={}));const yl=({onClickId:i,defaultSelectedId:a,extendedNavIcons:n})=>{const{isVm:o}=Be(),[r,s]=t(a||""),c=l(()=>[{id:gl.Overview,icon:Ai,selected:r===gl.Overview,onClick:()=>{s(gl.Overview),i(gl.Overview)},tooltip:"Overview"},...(n||[]).map(e=>({...e,selected:r===e.id,onClick:()=>{s(e.id),e.onClick()}}))],[r]),d=l(()=>{const e=[{id:gl.Sources,icon:Li,selected:r===gl.Sources,onClick:()=>{s(gl.Sources),i(gl.Sources)},tooltip:"Sources"},{id:gl.Destinations,icon:Pi,selected:r===gl.Destinations,onClick:()=>{s(gl.Destinations),i(gl.Destinations)},tooltip:"Destinations"}];return o||(e.push({id:gl.InstrumentationRules,icon:Mi,selected:r===gl.InstrumentationRules,onClick:()=>{s(gl.InstrumentationRules),i(gl.InstrumentationRules)},tooltip:"Instrumentation Rules"}),e.push({id:gl.Actions,icon:Ri,selected:r===gl.Actions,onClick:()=>{s(gl.Actions),i(gl.Actions)},tooltip:"Actions"})),e},[o,r]);return e.createElement(
|
|
464
|
+
`,hl=({onEditStream:t,onEditSources:i,onEditDestinations:a,categories:n})=>{const{selectedStreamName:o}=We(),{configuredSources:r,configuredDestinations:s,configuredDestinationsUpdateOnly:c}=dt(),d=l(()=>Object.values(r).reduce((e,t)=>e+t.filter(e=>e.selected).length,0),[r]);return e.createElement(ie,{$isNotModal:!0},e.createElement(Z,{$gap:12},e.createElement(F,{title:p.SUMMARY,description:p.STREAM_CONFIRM}),e.createElement(ml,null,e.createElement(Y,{title:p.STREAM_NAME,action:()=>e.createElement(_t,{onClick:t}),data:[{title:"",value:o}]}),e.createElement(Y,{title:p.SELECTED_SOURCES,titleBadge:d,action:()=>e.createElement(_t,{onClick:i})},e.createElement(ul,{filteredNamespacesAndSources:r,withInstances:!1})),e.createElement(Y,{title:p.SELECTED_DESTINATIONS,titleBadge:s.length+c.length,action:()=>e.createElement(_t,{onClick:a})},e.createElement(so,{categories:n})))))};var gl;!function(e){e.Overview="overview",e.InstrumentationRules="InstrumentationRule",e.Sources="Source",e.Actions="Action",e.Destinations="Destination"}(gl||(gl={}));const yl=({onClickId:i,defaultSelectedId:a,extendedNavIcons:n})=>{const{isVm:o}=Be(),[r,s]=t(a||""),c=l(()=>[{id:gl.Overview,icon:Ai,selected:r===gl.Overview,onClick:()=>{s(gl.Overview),i(gl.Overview)},tooltip:"Overview"},...(n||[]).map(e=>({...e,selected:r===e.id,onClick:()=>{s(e.id),e.onClick()}}))],[r]),d=l(()=>{const e=[{id:gl.Sources,icon:Li,selected:r===gl.Sources,onClick:()=>{s(gl.Sources),i(gl.Sources)},tooltip:"Sources"},{id:gl.Destinations,icon:Pi,selected:r===gl.Destinations,onClick:()=>{s(gl.Destinations),i(gl.Destinations)},tooltip:"Destinations"}];return o||(e.push({id:gl.InstrumentationRules,icon:Mi,selected:r===gl.InstrumentationRules,onClick:()=>{s(gl.InstrumentationRules),i(gl.InstrumentationRules)},tooltip:"Instrumentation Rules"}),e.push({id:gl.Actions,icon:Ri,selected:r===gl.Actions,onClick:()=>{s(gl.Actions),i(gl.Actions)},tooltip:"Actions"})),e},[o,r]);return e.createElement(Ut,{orientation:"vertical",mainIcons:c,subIcons:d})},vl=({})=>e.createElement(pt,{onClick:()=>window.open("https://join.slack.com/t/odigos/shared_invite/zt-2wc6gm4j9-EhcVFYrLwHqvcIErO9sVzw","_blank","noopener noreferrer"),tooltip:"Join our Slack community"},e.createElement(Ki,null)),bl=(e,t)=>{const{name:i,kind:a,namespace:n}=e,o=[{title:p.KIND,value:a},{title:p.NAME,value:i,tooltip:"Resource name"}];return t||(o.unshift({title:p.NAMESPACE,value:n}),o.push({type:m.Divider}),o.push({type:m.CopyText,value:`kubectl get ${a} ${i} -n ${n}`.toLowerCase()})),o},fl=d.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
flex-direction: column;
|
|
467
467
|
gap: 24px;
|
|
468
468
|
padding: 4px;
|
|
469
|
-
`,xl=({formData:t,handleFormChange:i})=>e.createElement(fl,null,e.createElement(x,{name:"sourceName",title:"Source name",tooltip:"This overrides the default service name that runs in your cluster.",placeholder:"Use a name that overrides the source name",value:t.otelServiceName,onChange:({target:{value:e}})=>i("otelServiceName",e)})),$l=({workloadOdigosHealthStatus:t})=>{if(!t)return null;const i=
|
|
469
|
+
`,xl=({formData:t,handleFormChange:i})=>e.createElement(fl,null,e.createElement(x,{name:"sourceName",title:"Source name",tooltip:"This overrides the default service name that runs in your cluster.",placeholder:"Use a name that overrides the source name",value:t.otelServiceName,onChange:({target:{value:e}})=>i("otelServiceName",e)})),$l=({workloadOdigosHealthStatus:t})=>{if(!t)return null;const i=Jt(t.status),a=at(t.reasonEnum),n=t.message;return e.createElement(ce,{$alignItems:"center",$justifyContent:"center"},e.createElement(se,{status:i,title:a,subtitle:n,withBackground:i!==pe.Disabled,withBorder:!0,withIcon:!0,width:"calc(100% - 24px)"}))},Cl=({source:a,fetchSourceDescribe:n})=>{const[o,l]=t(!1),[r,s]=t(null);return i(()=>{a&&n({variables:{namespace:a.namespace,name:a.name,kind:a.kind}}).then(({data:e})=>{e?.describeSource?s(e.describeSource):l(!0)})},[n,a]),r||o?e.createElement(Z,{$gap:12},o?e.createElement(we,{$height:"70vh"},e.createElement(Te,{subTitle:"Could not fetch describe for this source"})):r?.pods?.length?r.pods.map(({podName:t,nodeName:i,phase:n,agentInjected:o,runningLatestWorkloadRevision:l,containers:s})=>{const d=n.status!==B.Success||Gt(s)?B.Error:B.Success,u=[];return u.push(e.createElement(Yt,{value:`kubectl get pod ${t.value} -n ${r?.namespace?.value||a.namespace}`.toLowerCase()})),u.push(e.createElement(le,{length:"100%",margin:"0"})),u.push(e.createElement(Xt,{title:i.name,tooltip:i.explain||"",value:{status:i.status||void 0,text:i.value}})),u.push(e.createElement(le,{length:"100%",margin:"0"})),u.push(e.createElement(Xt,{title:n.name,tooltip:n.explain||"",value:{status:n.status||void 0,text:n.value}})),u.push(e.createElement(le,{length:"100%",margin:"0"})),u.push(e.createElement(Xt,{title:o.name,tooltip:o.explain||"",value:{status:o.status||void 0,text:o.value}})),u.push(e.createElement(le,{length:"100%",margin:"0"})),l?.name&&(u.push(e.createElement(Xt,{title:l.name,tooltip:l.explain||void 0,value:{status:l.status||void 0,text:l.value}})),u.push(e.createElement(le,{length:"100%",margin:"0"}))),s.forEach(t=>{u.push(e.createElement(Zt,{...t}))}),e.createElement(Y,{key:`pod-${t.value}`,title:`Pod: ${t.value}`,withExtend:!0,action:()=>e.createElement(se,{status:d,title:d,withIcon:!0,withBorder:!0})},c.toArray(u))}):e.createElement(we,{$height:"70vh"},e.createElement(Te,{subTitle:"Check if you have any running pods and try again"}))):e.createElement(we,{$height:"70vh"},e.createElement(Re,null))},Sl=d(ce)`
|
|
470
470
|
width: 100%;
|
|
471
471
|
align-items: center;
|
|
472
472
|
justify-content: space-between;
|
|
@@ -480,10 +480,10 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
480
480
|
display: flex;
|
|
481
481
|
flex-direction: column;
|
|
482
482
|
gap: 12px;
|
|
483
|
-
`,Ol=({persistSources:a,updateSource:o,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d})=>{const{isVm:u}=Be(),{sources:m}=W(),{selectedStreamName:h}=We(),{drawerType:g,drawerEntityId:y}=P(),v=l(()=>
|
|
483
|
+
`,Ol=({persistSources:a,updateSource:o,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d})=>{const{isVm:u}=Be(),{sources:m}=W(),{selectedStreamName:h}=We(),{drawerType:g,drawerEntityId:y}=P(),v=l(()=>Je(m,h),[m,h]),b=n(null),f=g===H.Source,[x,$]=t(!1),[C,S]=t(!1),[k,w]=t(wl.Overview),[T,D]=t(null);i(()=>{f&&y&&s(y).then(e=>D(e||null))},[f,y]);const{formData:E,handleFormChange:O,resetFormData:F,loadFormWithDrawerItem:I}=ti(),A=l(()=>{if(!f)return F();const e=(T&&JSON.stringify(qt(T))===JSON.stringify(qt(y))?T:null)||v?.find(e=>e.namespace===y.namespace&&e.name===y.name&&e.kind===y.kind);return e?I(e):F(),e},[f,y,v,T]),M=l(()=>{const e=A?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===pe.Loading,containers:A?.containers||[]}},[A]),R=l(()=>{const e=[{label:wl.Overview,onClick:()=>w(wl.Overview),selected:k===wl.Overview}];return Tl.includes(A?.kind)&&e.push({label:wl.Pods,onClick:()=>w(wl.Pods),selected:k===wl.Pods}),A?.containers?.some(({language:e})=>Dl.includes(e))&&e.push({label:wl.Libraries,onClick:()=>w(wl.Libraries),selected:k===wl.Libraries}),e},[k,A]);return A?e.createElement(ya,{ref:b,onClose:()=>{w(wl.Overview),D(null)},title:A.otelServiceName||A.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:ze(A.containers),isEdit:x,isFormDirty:C,onEdit:k===wl.Overview?e=>{$("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=E.otelServiceName!==A.name?E.otelServiceName:"";O("otelServiceName",e),await o(y,{...E,otelServiceName:e}),D(null),S(!1),$(!1)},onDelete:k===wl.Overview?async()=>{const{namespace:e}=A;a({[e]:[{...A,selected:!1,currentStreamName:h}]},{}),D(null),S(!1),$(!1),b.current?.closeDrawer()}:void 0,onCancel:()=>{S(!1),$(!1),O("otelServiceName",A.otelServiceName||A.name||"")},isLastItem:1===v.length,tabs:R,headerActionButtons:[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>r([y]),children:e.createElement(e.Fragment,null,e.createElement(Ei,null),e.createElement(N,{size:14,family:"secondary",decoration:"underline"},"Restart"))}]},k===wl.Overview?x?e.createElement(Nl,null,e.createElement(xl,{formData:E,handleFormChange:(...e)=>{S(!0),O(...e),O("currentStreamName",h)}})):e.createElement(El,null,e.createElement($l,{workloadOdigosHealthStatus:A.workloadOdigosHealthStatus}),e.createElement(G,{conditions:A.conditions||[]}),e.createElement(Y,{title:p.SOURCE_DETAILS,data:A?bl(A,u):[]}),e.createElement(Y,{title:u?p.DETECTED_PROCESSES:p.DETECTED_CONTAINERS,titleBadge:M.isLoading?pe.Loading:M.containers.length,description:M.description||(u?p.DETECTED_PROCESSES_DESCRIPTION:p.DETECTED_CONTAINERS_DESCRIPTION)},M.containers.map(t=>e.createElement(ii,{key:`source-container-${t.containerName}`,...t,callbackRuntimeOverride:async e=>await o(y,e)})))):k===wl.Pods?e.createElement(Cl,{source:A,fetchSourceDescribe:c}):e.createElement(kl,{source:A,fetchSourceLibraries:d})):null},Fl=d.div`
|
|
484
484
|
max-width: ${({$fullWidth:e})=>e?"unset":"420px"};
|
|
485
485
|
width: 100%;
|
|
486
|
-
`,Il=a(({isModal:t,fetchSingleNamespace:i,onClickSummary:a},n)=>{const l=E.useTheme(),{isVm:r}=Be(),s=oi({fetchSingleNamespace:i}),{selectedSources:c,fetchingNamespace:d,selectedAllNamespaces:u,onSelectAllNamespaces:m,getApiSourcesPayload:h,getApiFutureAppsPayload:g,searchText:y,setSearchText:v,searchBy:b,setSearchBy:f,showSelectedOnly:$,setShowSelectedOnly:C,showRunningOnly:S,setShowRunningOnly:w}=s;o(n,()=>({getFormValues:()=>({apps:h(),futureApps:g()})}));const T=Object.values(c).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return e.createElement(ie,{$isNotModal:!t},e.createElement(Z,{$gap:12},e.createElement(Z,{$gap:24},a&&e.createElement(gt,{onClick:a}),e.createElement(F,{title:p.SELECT_SOURCES,badgeLabel:T,description:p.SELECT_SOURCES_DESCRIPTION}),e.createElement(ce,{$justifyContent:"space-between"},e.createElement(Fl,{$fullWidth:r},e.createElement(x,{placeholder:b===H.Source?p.SEARCH_SOURCES:p.SEARCH_NAMESPACES,icon:Si,value:y,onChange:e=>v(e.target.value.toLowerCase())})),!r&&e.createElement(O,{options:[{label:p.SOURCE,value:H.Source,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary},{label:p.NAMESPACE,value:H.Namespace,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary}],selected:b,setSelected:f})),e.createElement(ce,{$gap:36},e.createElement(k,{title:p.SELECT_ALL,initialValue:u,onChange:m,disabled:!!d}),e.createElement(k,{title:p.ONLY_SELECTED,initialValue:$,onChange:C}),e.createElement(k,{title:p.ONLY_RUNNING_INSTANCES,initialValue:S,onChange:w}))),e.createElement(le,null),e.createElement(ul,{isModal:t,...s})))});Il.displayName=Il.name;const Al=({fetchSingleNamespace:t,persistSources:i})=>{const{currentModal:a,setCurrentModal:o}=Q(),l=a===H.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();i(e,t),r()}},c=n(null);return K({key:"Enter",active:l},s),l?e.createElement(ee,{isOpen:l,onClose:r,header:{title:"Add Source"},actionComponent:e.createElement(te,{buttons:[{label:"DONE",variant:"primary",onClick:s}]})},e.createElement(Il,{ref:c,isModal:!0,fetchSingleNamespace:t})):null},Ml=e=>{const t=[{key:"checkbox-and-icon",title:""},{key:"name",title:p.NAME,sortable:!0},{key:"kind",title:"Kind",sortable:!0}];return e||t.push({key:"namespace",title:p.NAMESPACE,sortable:!0}),t.push({key:"containers",title:p.DETECTED_CONTAINERS}),t.push({key:"conditions",title:"Conditions"}),t.push({key:"throughput",title:"Throughput",sortable:!0}),t},Rl=({metrics:t,maxHeight:i,maxWidth:a})=>{const n=E.useTheme(),{isVm:o}=Be(),r=he(),{isThisPending:c}=R(),{selectedStreamName:d}=We(),{sources:u,sourcesLoading:m}=W(),{setDrawerType:h,setDrawerEntityId:g}=P(),{selectedSources:y,setSelectedSources:b}=Ie(),{isAwaitingInstrumentation:f,sourcesToCreate:x,sourcesCreated:$,sourcesToDelete:C,sourcesDeleted:S}=Ae(),k=l(()=>{const e=(e,t)=>e>0&&Math.floor(100/e*t)||1;return x?e(x,$):C?e(C,S):1},[x,$,C,S]),w=l(()=>
|
|
486
|
+
`,Il=a(({isModal:t,fetchSingleNamespace:i,onClickSummary:a},n)=>{const l=E.useTheme(),{isVm:r}=Be(),s=oi({fetchSingleNamespace:i}),{selectedSources:c,fetchingNamespace:d,selectedAllNamespaces:u,onSelectAllNamespaces:m,getApiSourcesPayload:h,getApiFutureAppsPayload:g,searchText:y,setSearchText:v,searchBy:b,setSearchBy:f,showSelectedOnly:$,setShowSelectedOnly:C,showRunningOnly:S,setShowRunningOnly:w}=s;o(n,()=>({getFormValues:()=>({apps:h(),futureApps:g()})}));const T=Object.values(c).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return e.createElement(ie,{$isNotModal:!t},e.createElement(Z,{$gap:12},e.createElement(Z,{$gap:24},a&&e.createElement(gt,{onClick:a}),e.createElement(F,{title:p.SELECT_SOURCES,badgeLabel:T,description:p.SELECT_SOURCES_DESCRIPTION}),e.createElement(ce,{$justifyContent:"space-between"},e.createElement(Fl,{$fullWidth:r},e.createElement(x,{placeholder:b===H.Source?p.SEARCH_SOURCES:p.SEARCH_NAMESPACES,icon:Si,value:y,onChange:e=>v(e.target.value.toLowerCase())})),!r&&e.createElement(O,{options:[{label:p.SOURCE,value:H.Source,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary},{label:p.NAMESPACE,value:H.Namespace,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary}],selected:b,setSelected:f})),e.createElement(ce,{$gap:36},e.createElement(k,{title:p.SELECT_ALL,initialValue:u,onChange:m,disabled:!!d}),e.createElement(k,{title:p.ONLY_SELECTED,initialValue:$,onChange:C}),e.createElement(k,{title:p.ONLY_RUNNING_INSTANCES,initialValue:S,onChange:w}))),e.createElement(le,null),e.createElement(ul,{isModal:t,...s})))});Il.displayName=Il.name;const Al=({fetchSingleNamespace:t,persistSources:i})=>{const{currentModal:a,setCurrentModal:o}=Q(),l=a===H.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();i(e,t),r()}},c=n(null);return K({key:"Enter",active:l},s),l?e.createElement(ee,{isOpen:l,onClose:r,header:{title:"Add Source"},actionComponent:e.createElement(te,{buttons:[{label:"DONE",variant:"primary",onClick:s}]})},e.createElement(Il,{ref:c,isModal:!0,fetchSingleNamespace:t})):null},Ml=e=>{const t=[{key:"checkbox-and-icon",title:""},{key:"name",title:p.NAME,sortable:!0},{key:"kind",title:"Kind",sortable:!0}];return e||t.push({key:"namespace",title:p.NAMESPACE,sortable:!0}),t.push({key:"containers",title:p.DETECTED_CONTAINERS}),t.push({key:"conditions",title:"Conditions"}),t.push({key:"throughput",title:"Throughput",sortable:!0}),t},Rl=({metrics:t,maxHeight:i,maxWidth:a})=>{const n=E.useTheme(),{isVm:o}=Be(),r=he(),{isThisPending:c}=R(),{selectedStreamName:d}=We(),{sources:u,sourcesLoading:m}=W(),{setDrawerType:h,setDrawerEntityId:g}=P(),{selectedSources:y,setSelectedSources:b}=Ie(),{isAwaitingInstrumentation:f,sourcesToCreate:x,sourcesCreated:$,sourcesToDelete:C,sourcesDeleted:S}=Ae(),k=l(()=>{const e=(e,t)=>e>0&&Math.floor(100/e*t)||1;return x?e(x,$):C?e(C,S):1},[x,$,C,S]),w=l(()=>Je(u,d),[u,d]),T=l(()=>Ta({instrumentationRules:[],sources:Ue(w,r),actions:[],destinations:[],searchText:r.searchText,selectedCategory:H.Source}).searchResults.find(({category:e})=>e===H.Source)?.entities||[],[w,r]),[D,O]=l(()=>{let e=0;return Object.values(y).forEach(t=>{e+=t.length}),[0!==e,e]},[y]),F=s(e=>{if(e){const e={};T.forEach(t=>{const i={namespace:t.namespace,name:t.name,kind:t.kind};c({entityType:H.Source,entityId:i})||(e[t.namespace]?e[t.namespace].push(t):e[t.namespace]=[t])}),b(e)}else b({})},[T]),I=s(e=>{const{namespace:t,name:i,kind:a}=e,n={...y};n[t]||(n[t]=[]);const o=n[t].findIndex(e=>e.name===i&&e.kind===a);-1===o?n[t].push(e):n[t].splice(o,1),b(n)},[y]),A=l(()=>T.map(i=>{const a=qt(i),o=JSON.stringify(a),{hasErrors:l,hasWarnings:r,hasDisableds:s}=re(i.conditions||[]),d=c({entityType:H.Source,entityId:a}),u=!!y[a.namespace]?.find(e=>e.namespace===a.namespace&&e.name===a.name&&e.kind===a.kind);return{status:l?B.Error:r?B.Warning:void 0,faded:s,onClick:()=>{h(H.Source),g(a)},cells:[{columnKey:"checkbox-and-icon",component:()=>e.createElement(ce,{$gap:16},e.createElement(v,{disabled:d,value:u,onChange:()=>I(i)}),e.createElement(li,{icons:ze(i.containers),id:o}))},{columnKey:"name",value:ve(i,H.Source,{extended:!0})},{columnKey:"kind",value:i.kind,textColor:n.text.info},{columnKey:"namespace",value:i.namespace,textColor:n.text.info},{columnKey:"throughput",value:Ke(Nt(t,H.Source,a).throughput),textColor:n.text.info},{columnKey:"conditions",component:()=>e.createElement(ka,{conditions:i.conditions||[],id:o})},{columnKey:"containers",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:B.Info,title:ri(i.containers),withBorder:!0}))}]}}),[T,y,t,I]),{badge:M,badgeTooltip:L}=l(()=>T.length!==w.length?{badge:`${T.length}/${w.length}`,badgeTooltip:p.FILTERED_COUNT_TOOLTIP}:{badge:w.length,badgeTooltip:void 0},[T,w]);return e.createElement(fe,{$maxWidth:a},e.createElement(xe,null,e.createElement(v,{partiallyChecked:D&&T?.length!==O,value:D&&T?.length===O,onChange:F,disabled:!T?.length}),e.createElement($e,{icon:Ce(H.Source),title:p.SOURCES,badge:M,badgeTooltip:L,loading:m||f})),e.createElement(Se,{$maxHeight:i},e.createElement(ke,{columns:Ml(o),rows:A})),f&&!A.length?e.createElement(we,{style:{marginTop:"2rem",gap:"24px"}},e.createElement(De,{width:420}),e.createElement(ce,{$gap:16},e.createElement(N,{color:n.text.info},x?"Instrumenting":"Uninstrumenting"," workloads..."),e.createElement(Ne,{label:`${k}%`}))):A.length?null:e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(Te,null)))},Ll=({expiresAt:t})=>{const i=E.useTheme(),{formatTimeAgo:a}=zt(),n=a(t),o=new Date(t).toDateString().split(" ").slice(1).join(" "),l=si(t,0)?i.text.error:si(t,6048e5)?i.text.warning:i.text.success;return e.createElement(N,{size:14,color:l},n," (",o,")")},Pl=d.div`
|
|
487
487
|
position: relative;
|
|
488
488
|
`,Kl=({token:i,saveToken:a})=>{const n=E.useTheme(),{isCopied:o,clickCopy:l}=ci(),{formData:r,handleFormChange:s,resetFormData:c}=di({token:i}),[d,u]=t(!1),p=()=>{u(!1),c()},m=me(B.Success,n);return e.createElement(ce,{$gap:0},e.createElement(pt,{size:32,onClick:()=>l(i)},o?e.createElement(m,null):e.createElement(ji,null)),e.createElement(le,{orientation:"vertical",length:"12px"}),e.createElement(Pl,null,e.createElement(pt,{size:32,onClick:()=>{u(!0)}},e.createElement(fi,null)),d&&e.createElement(ui,{flipX:!0,clientX:36,isOpen:d,onClose:p,onSave:()=>{a(r.token).then(p)},title:"Enter a new API Token",titleTooltip:"Contact us to generate a new one"},e.createElement(x,{placeholder:"API Token",type:"password",value:r.token,onChange:e=>s("token",e.target.value)}))))},jl=({tokens:t,saveToken:i})=>e.createElement(Y,{title:"Authorization Tokens",titleBadge:t.length,data:[{type:m.Table,value:{columns:[{key:"icon",title:""},{key:"name",title:"Name"},{key:"expires_at",title:"Expires"},{key:"token",title:"Token"},{key:"actions",title:""}],rows:t.map(({name:t,token:a,expiresAt:n})=>({cells:[{columnKey:"icon",icon:Vi},{columnKey:"name",value:t},{columnKey:"token",value:`${new Array(15).fill("•").join("")}`},{columnKey:"expires_at",component:()=>e.createElement(Ll,{expiresAt:n})},{columnKey:"actions",component:()=>e.createElement(Kl,{token:a,saveToken:i})}]}))}}]}),Vl=({fetchDescribeOdigos:a})=>{const[n,o]=t(null);if(i(()=>{a().then(({data:e})=>{o(e?.describeOdigos||null)})},[a]),!n)return e.createElement(we,null,e.createElement(Re,null));const l=t=>t?.name?[e.createElement(le,{key:`divider-${t.name}`}),e.createElement(Xt,{key:`describe-row-${t.name}`,title:t.name,subTitle:t.explain||void 0,value:{status:t.status||(Qt(t.value)?ei(t.value)?B.Success:B.Error:B.Default),text:t.value}})]:[];return e.createElement(e.Fragment,null,e.createElement(Y,{title:"General Information",withExtend:!0,initialExtended:!0,data:[{title:n?.odigosVersion?.name,value:n?.odigosVersion?.value},{title:n?.kubernetesVersion?.name,value:n?.kubernetesVersion?.value},{title:n?.installationMethod?.name,value:n?.installationMethod?.value},{title:n?.tier?.name,value:n?.tier?.value},{title:"# of sources",value:n?.numberOfSources?.toString()},{title:"# of destinations",value:n?.numberOfDestinations?.toString()}]}),e.createElement(Y,{title:"Cluster Collector",withExtend:!0},Object.values(n?.clusterCollector||{}).map(l)),e.createElement(Y,{title:"Node Collector",withExtend:!0},Object.values(n?.nodeCollector||{}).map(l)))},ql=d.div`
|
|
489
489
|
display: flex;
|
|
@@ -517,7 +517,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
517
517
|
stroke: ${({theme:e})=>e.text.secondary};
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
`,
|
|
520
|
+
`,Ul=d.div`
|
|
521
521
|
position: absolute;
|
|
522
522
|
top: 2px;
|
|
523
523
|
left: ${({$darkMode:e})=>e?"2px":"calc(100% - 2px - 24px)"};
|
|
@@ -527,7 +527,7 @@ import e,{useState as t,useEffect as i,forwardRef as a,useRef as n,useImperative
|
|
|
527
527
|
background-color: ${({theme:e})=>e.colors.border};
|
|
528
528
|
border-radius: 100%;
|
|
529
529
|
transition: all 0.3s;
|
|
530
|
-
`,
|
|
530
|
+
`,Jl=({path:t})=>e.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"none"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:t})),Gl=()=>{const{darkMode:t,setDarkMode:i}=pi();return e.createElement(_l,{onClick:()=>i(!t)},e.createElement(Jl,{path:"M14 7.977A4.333 4.333 0 1 1 8.023 2H8a6 6 0 1 0 6 6v-.023Z"}),e.createElement(Jl,{path:"M8 15.333v-.666m-5.185-1.482.471-.471M.666 8h.667m1.482-5.185.471.47M8 1.334V.667m4.714 2.619.471-.471M14.667 8h.666m-2.619 4.714.471.471M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}),e.createElement(Ul,{$darkMode:t}))},Yl=e=>{const{spans:t}=e,i=new Map;t.forEach(e=>{i.set(e.spanID,{...e,spans:[]})});const a=[];return t.forEach(e=>{const t=i.get(e.spanID);let n=!1;if(e.references.length){const t=e.references.find(e=>"CHILD_OF"===e.refType);t&&t.spanID&&i.has(t.spanID)||(n=!0)}else n=!0;if(n)a.push(t);else{const a=e.references.find(e=>"CHILD_OF"===e.refType);if(a){const e=i.get(a.spanID);e&&(e.spans=e.spans||[],e.spans.push(t),e.spans=e.spans.sort((e,t)=>e.startTime-t.startTime))}}}),a.sort((e,t)=>e.startTime-t.startTime)},Xl=(e,t)=>{const{tags:i}=e,a={},n=[];return i.forEach(e=>{a[e.key]=e.value}),n.push({type:m.Code,value:{language:"json",code:JSON.stringify(a,null,2),pretty:t}}),n},Zl=e=>{const{logs:t}=e,i=[];return t.forEach((e,a)=>{e.fields.forEach(e=>{i.push({title:e.key,value:e.value})}),a!==t.length-1&&i.push({type:m.Divider})}),i},Ql=e=>{const{traceID:t,spanID:i,processID:a,operationName:n,duration:o,startTime:l,warnings:r}=e,s=[];return s.push({type:m.CopyText,title:"Trace ID",value:t}),s.push({type:m.CopyText,title:"Span ID",value:i}),s.push({type:m.Divider}),s.push({title:"Service",value:a}),s.push({title:"Operation",value:n}),s.push({title:"Duration",value:mi(o)}),s.push({title:"Start time",value:new Date(l/1e3).toLocaleString()}),r.length&&(s.push({type:m.Divider}),s.push({title:"Warnings",titleIcon:zi,value:r})),s},er=(e,t)=>{const{tags:i}=e,a={},n=[];return i.forEach(e=>{a[e.key]=e.value}),n.push({type:m.Code,value:{language:"json",code:JSON.stringify(a,null,2),pretty:t}}),n},tr=d.div`
|
|
531
531
|
display: flex;
|
|
532
532
|
flex-direction: column;
|
|
533
533
|
gap: 12px;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const generateId: () => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StatusType } from '@/types';
|
|
2
1
|
import { DefaultTheme } from 'styled-components';
|
|
3
|
-
|
|
2
|
+
import { OtherStatusType, StatusType } from '@/types';
|
|
3
|
+
export declare const getStatusColor: (theme: DefaultTheme, status: StatusType | OtherStatusType, weight: keyof typeof theme.v2.colors.purple | keyof typeof theme.v2.colors.red | keyof typeof theme.v2.colors.yellow | keyof typeof theme.v2.colors.green | keyof typeof theme.v2.colors.silver) => string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { StatusType, type SVG } from '@/types';
|
|
2
1
|
import type { DefaultTheme } from 'styled-components';
|
|
3
|
-
|
|
2
|
+
import { OtherStatusType, StatusType, type SVG } from '@/types';
|
|
3
|
+
export declare const getStatusIcon: (status: StatusType | OtherStatusType, theme: DefaultTheme) => SVG;
|
package/lib/functions/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './filter-sources-by-stream';
|
|
|
10
10
|
export * from './flatten-object-keys';
|
|
11
11
|
export * from './format-bytes';
|
|
12
12
|
export * from './format-duration';
|
|
13
|
+
export * from './generate-id';
|
|
13
14
|
export * from './get-action-icon';
|
|
14
15
|
export * from './get-conditions-booleans';
|
|
15
16
|
export * from './get-containers-counts';
|
|
@@ -29,6 +30,7 @@ export * from './get-programming-language-icon';
|
|
|
29
30
|
export * from './get-recursive-values';
|
|
30
31
|
export * from './get-sse-target-from-id';
|
|
31
32
|
export * from './get-status-color';
|
|
33
|
+
export * from './get-status-from-pod-status';
|
|
32
34
|
export * from './get-status-icon';
|
|
33
35
|
export * from './get-status-type-from-odigos-health';
|
|
34
36
|
export * from './get-value-for-range';
|
package/lib/functions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{bn as capitalizeFirstLetter,cm as cleanObjectEmptyStringsValues,bi as compareCondition,bp as deepClone,ar as filterActions,aX as filterDestinations,aY as filterDestinationsByStream,aV as filterSources,aW as filterSourcesByStream,cn as flattenObjectKeys,aM as formatBytes,c1 as formatDuration,g as generateId,a8 as getActionIcon,ak as getConditionsBooleans,aQ as getContainersIcons,bY as getContainersInstrumentedCount,aP as getDestinationIcon,ay as getEntityIcon,aK as getEntityId,at as getEntityLabel,co as getIdFromSseTarget,aO as getInstrumentationRuleIcon,cp as getMainContainerLanguage,bs as getMetricForEntity,cq as getMonitorIcon,cr as getPlatformIcon,cs as getPlatformLabel,bB as getProgrammingLanguageIcon,c3 as getRecursiveValues,ct as getSseTargetFromId,cu as getStatusColor,b as getStatusFromPodStatus,ap as getStatusIcon,bL as getStatusTypeFromOdigosHealth,cv as getValueForRange,bF as getWorkloadId,bm as getYamlFieldsForDestination,bM as hasUnhealthyInstances,E as isEmpty,cw as isLegalK8sLabel,bZ as isOverTime,bQ as isStringABoolean,cx as isTimeElapsed,cy as isValidVersion,am as mapConditions,bh as mapDestinationFieldsForDisplay,aL as mapExportedSignals,cz as numbersOnly,bR as parseBooleanFromString,cA as parseJsonStringToPrettyString,cB as removeEmptyValuesFromObject,bj as safeJsonParse,cC as safeJsonStringify,aE as sleep,b3 as splitCamelString,cD as stringifyNonStringValues}from"./chunks/ui-components-c940a3cc.js";import"./icons.js";import"react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-55cc654c.js";import"react-dom";import"styled-components";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|
package/lib/hooks/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './useCopy';
|
|
|
8
8
|
export * from './useDataStreamFormData';
|
|
9
9
|
export * from './useDestinationFormData';
|
|
10
10
|
export * from './useGenericForm';
|
|
11
|
+
export * from './useInfiniteScroll';
|
|
11
12
|
export * from './useInstrumentationRuleFormData';
|
|
12
13
|
export * from './useKeyDown';
|
|
13
14
|
export * from './useOnClickOutside';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
interface UseInfiniteScrollParams {
|
|
2
|
+
items: unknown[];
|
|
3
|
+
rowHeight: number;
|
|
4
|
+
}
|
|
5
|
+
export declare const useInfiniteScroll: ({ items, rowHeight }: UseInfiniteScrollParams) => {
|
|
6
|
+
overflowRef: import("react").RefObject<null>;
|
|
7
|
+
listHeight: number;
|
|
8
|
+
listItems: import("@tanstack/virtual-core").VirtualItem[];
|
|
9
|
+
};
|
|
10
|
+
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
declare const useTimeAgo: () =>
|
|
3
|
-
|
|
1
|
+
export type FormatTimeAgo = (wen: Date | number | string) => string;
|
|
2
|
+
export declare const useTimeAgo: () => {
|
|
3
|
+
formatTimeAgo: FormatTimeAgo;
|
|
4
|
+
};
|
package/lib/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{a6 as useActionFormData,cH as useBodyScroll,aZ as useClickNode,bG as useClickNotification,aS as useConnection,aU as useContainerSize,a as useCopy,b9 as useDataStreamFormData,bl as useDestinationFormData,b_ as useGenericForm,cI as useInfiniteScroll,bC as useInstrumentationRuleFormData,$ as useKeyDown,b2 as useOnClickOutside,a_ as usePopup,b8 as useSessionStorage,bS as useSourceFormData,bW as useSourceSelectionFormData,u as useTimeAgo,bE as useTransition}from"./chunks/ui-components-c940a3cc.js";import"./icons.js";import"react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-55cc654c.js";import"react-dom";import"styled-components";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|