@odigos/ui-kit 0.0.180 → 0.0.182

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +16 -12
  3. package/lib/chunks/ui-components-DPfN8yF_.js +2296 -0
  4. package/lib/chunks/vendor-ex1Kb_ap.js +1 -0
  5. package/lib/components/_v2/input/index.d.ts +3 -1
  6. package/lib/components/_v2/segment/index.d.ts +1 -2
  7. package/lib/components/_v2/table/styled.d.ts +29 -18
  8. package/lib/components/selection-button/index.d.ts +1 -1
  9. package/lib/components/styled.d.ts +46 -55
  10. package/lib/components/tab-list/index.d.ts +4 -3
  11. package/lib/components/text/index.d.ts +1 -1
  12. package/lib/components/v2.js +1 -1
  13. package/lib/components.js +1 -1
  14. package/lib/constants.js +1 -1
  15. package/lib/containers/_v2/central-connections/index.d.ts +1 -2
  16. package/lib/containers/_v2/central-connections/source-drawer/styled.d.ts +15 -16
  17. package/lib/containers/_v2/system-drawer/index.d.ts +2 -1
  18. package/lib/containers/_v2/system-drawer/tokens/index.d.ts +7 -0
  19. package/lib/containers/_v2/system-drawer/tokens/token-actions.d.ts +12 -0
  20. package/lib/containers/_v2/system-drawer/tokens/token-expires-at.d.ts +6 -0
  21. package/lib/containers/_v2/system-drawer/tokens/token-input.d.ts +8 -0
  22. package/lib/containers/data-flow-actions-menu/search/search-results/builder.d.ts +1 -1
  23. package/lib/containers/data-flow-actions-menu/styled.d.ts +9 -5
  24. package/lib/containers/source-drawer/describe/index.d.ts +1 -1
  25. package/lib/containers/source-drawer/odigos-health/index.d.ts +1 -2
  26. package/lib/containers/v2.js +21 -21
  27. package/lib/containers.js +122 -122
  28. package/lib/contexts/odigos-context.d.ts +2 -2
  29. package/lib/contexts.js +1 -1
  30. package/lib/functions.js +1 -1
  31. package/lib/hooks/useActionFormData.d.ts +1 -1
  32. package/lib/hooks.js +1 -1
  33. package/lib/icons/auth/okta-icon/index.d.ts +1 -1
  34. package/lib/icons.js +1 -1
  35. package/lib/snippets/add-button/index.d.ts +1 -1
  36. package/lib/snippets.js +1 -1
  37. package/lib/store.js +1 -1
  38. package/lib/theme/animations/index.d.ts +28 -22
  39. package/lib/theme/index.d.ts +3 -12
  40. package/lib/theme.js +1 -1
  41. package/lib/types.js +1 -1
  42. package/lib/visuals.js +1 -1
  43. package/package.json +25 -24
  44. package/lib/chunks/ui-components-fb24c792.js +0 -2289
  45. package/lib/chunks/vendor-0965fadc.js +0 -1
  46. /package/lib/theme/{palletes → palettes}/index.d.ts +0 -0
@@ -1,8 +1,8 @@
1
- import e,{useMemo as t,useState as a,useEffect as l,useCallback as o}from"react";import n,{useTheme as s}from"styled-components";import{F as i,a as r,C as c,T as d,b as u,B as p,S as g,c as h,O as m,N as b,d as f,e as y,f as w,u as C,g as v,D as k,E as x,h as $,i as S,j as I,L as D,P as A,R as P,k as T,l as R,m as z,n as N,o as O,p as M,q as L,r as V,s as W,t as F,A as j,v as E,w as G,x as U,y as H,z as Y,G as q,H as X,I as B,J as K,K as J,M as Q,Q as Z,U as _,Y as ee,V as te,W as ae,X as le,Z as oe,_ as ne,$ as se,a0 as ie,a1 as re,a2 as ce,a3 as de,a4 as ue}from"../chunks/ui-components-fb24c792.js";import{SourceIcon as pe,VSquareIcon as ge,SettingsIcon as he,OdigosLogo as me,DeleteIcon as be,ConnectionsIcon as fe,RefreshIcon as ye,VIcon as we,XIcon as Ce,XSquareIcon as ve,PodIcon as ke,ChevronUpIcon as xe,ChevronDownIcon as $e,TerminalIcon as Se,ArrowDownSquareIcon as Ie,ArrowUpSquareIcon as De,DownloadIcon as Ae,PipelineCollectorIcon as Pe,GatewayIcon as Te,YamlIcon as Re,DiagnoseIcon as ze}from"../icons.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-0965fadc.js";import"react-dom";import"@xyflow/react";import"react-error-boundary";import"lottie-react";import"prism-react-renderer";const Ne=n(i)`
1
+ import{j as e}from"../chunks/vendor-ex1Kb_ap.js";import{useMemo as t,useState as l,useEffect as a,useCallback as n}from"react";import i,{useTheme as o}from"styled-components";import{F as s,a as r,C as c,T as d,b as u,B as p,S as h,c as g,O as m,N as b,d as f,e as w,f as y,u as k,g as C,D as v,E as x,h as $,i as S,j as I,L as T,P as D,R as A,k as P,l as z,m as R,n as N,o as O,p as V,q as M,r as L,s as W,t as F,v as j,A as E,w as G,x as U,y as H,z as Y,G as q,H as B,I as X,J as K,K as J,M as Q,Q as Z,Y as _,U as ee,V as te,W as le,X as ae,Z as ne,_ as ie,$ as oe,a0 as se,a1 as re,a2 as ce,a3 as de,a4 as ue,a5 as pe,a6 as he,a7 as ge}from"../chunks/ui-components-DPfN8yF_.js";import{SourceIcon as me,VSquareIcon as be,SettingsIcon as fe,OdigosLogo as we,DeleteIcon as ye,RefreshIcon as ke,ConnectionsIcon as Ce,VIcon as ve,XIcon as xe,XSquareIcon as $e,PodIcon as Se,ChevronUpIcon as Ie,ChevronDownIcon as Te,TerminalIcon as De,ArrowDownSquareIcon as Ae,ArrowUpSquareIcon as Pe,DownloadIcon as ze,PipelineCollectorIcon as Re,GatewayIcon as Ne,YamlIcon as Oe,EditIcon as Ve,KeyIcon as Me,DiagnoseIcon as Le}from"../icons.js";import"react-dom";import"zustand";import"javascript-time-ago";import"@xyflow/react";import"react-error-boundary";import"lottie-react";import"prism-react-renderer";const We=i(s)`
2
2
  width: ${({$width:e})=>e};
3
3
  gap: 12px;
4
4
  justify-content: space-between;
5
- `,Oe=n.div`
5
+ `,Fe=i.div`
6
6
  display: flex;
7
7
  flex-direction: column;
8
8
  padding: 12px;
@@ -13,7 +13,7 @@ import e,{useMemo as t,useState as a,useEffect as l,useCallback as o}from"react"
13
13
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
14
14
  overflow-y: auto;
15
15
  overflow-x: hidden;
16
- `,Me=n.div`
16
+ `,je=i.div`
17
17
  display: flex;
18
18
  align-items: center;
19
19
  justify-content: space-between;
@@ -25,55 +25,55 @@ import e,{useMemo as t,useState as a,useEffect as l,useCallback as o}from"react"
25
25
  &:hover {
26
26
  background-color: ${({theme:e})=>e.v2.colors.silver[600]};
27
27
  }
28
- `,Le=({formData:a,handleSourceChange:l,handleSelectAll:o,selectedArea:n,searchText:i,filters:f})=>{const y=s(),{activeNamespace:w,isAll:C,isSome:v}=t(()=>{const e=n.value.clusterId&&n.value.namespaceName?a.find(({clusterId:e})=>e===n.value.clusterId)?.namespaces.find(({name:e})=>e===n.value.namespaceName):void 0;if(!e)return{activeNamespace:void 0,isAll:!1,isSome:!1};const t=e.workloads.filter(({selected:e})=>e).length;return{activeNamespace:e,isAll:t>0&&t===e.workloads.length,isSome:t>0&&t<e.workloads.length}},[a,n.value.clusterId,n.value.namespaceName]),k=t(()=>{if(!w)return[];const{clusterId:t}=n.value,{name:a,workloads:o}=w;return o.map(({name:o,selected:n,kind:s})=>{if(i&&!o.toLowerCase().includes(i.toLowerCase()))return null;const h=n||!1;if(f.showOnlySelected&&!h)return null;const m=()=>l({clusterId:t,workloadId:{namespace:a,name:o,kind:s}});return e.createElement(Me,{key:`${t}#${a}#${o}#${s}`,onClick:m},e.createElement(r,{$gap:12},e.createElement(c,{value:h,onChange:m}),e.createElement(d,{size:u.XS},o)),e.createElement(p,{label:s,status:g.Info,textSize:u.XXXS,backgroundColor:y.v2.colors.blue[900]}))})},[a,n.value.clusterId,w,i,f]);return e.createElement(Ne,{$width:"50%"},e.createElement(r,{$padding:"0 12px 0 28px",$gap:12},e.createElement(h,{text:(C?"Unselect":"Select")+" all workloads in the selected namespace"},e.createElement(c,{partiallyChecked:v,value:C,onChange:()=>o({clusterId:n.value.clusterId,namespaceName:n.value.namespaceName,boolean:!C}),disabled:!k.length})),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XS,nowrap:!0},n.value.clusterId?`${n.value.clusterName} > ${n.value.namespaceName} > Workloads`:"Workloads"),e.createElement(p,{label:k.length,status:m.Unknown}))),e.createElement(Oe,{$borderRadius:"0 16px 16px 0"},k.length?k:e.createElement(b,{title:"Workloads not found",subTitle:"Please select a namespace to view workloads"})))},Ve=({formData:a,handleSourceChange:l,handleSelectAll:o,selectedArea:n,searchText:i,filters:C})=>{const v=s(),{isAll:k,isSome:x}=t(()=>{const e=a.length>0&&a.every(({namespaces:e})=>e.every(({workloads:e})=>e.every(({selected:e})=>e)));return{isAll:e,isSome:!e&&a.length>0&&a.some(({namespaces:e})=>e.some(({workloads:e})=>e.some(({selected:e})=>e)))}},[a]),$=t(()=>a.flatMap(({clusterId:t,clusterName:a,namespaces:o})=>o.map(({name:o,workloads:s,selected:b})=>{if(i&&!o.toLowerCase().includes(i.toLowerCase()))return null;const k=s.filter(({selected:e})=>e).length,x=k>0&&k===s.length,$=k>0&&k<s.length,S=b||!1;if(C.showOnlySelected&&!x&&!$&&!S)return null;const I=n.value.clusterId===t&&n.value.namespaceName===o,D=()=>n.setValue({clusterId:t,clusterName:a,namespaceName:o}),A=e=>{D(),l({clusterId:t,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return e.createElement(Me,{key:`${t}#${o}`,$isSelected:I,onClick:D},e.createElement(r,{$gap:12},e.createElement(c,{partiallyChecked:$,value:x,onChange:e=>A({auto:e,all:e})}),e.createElement(d,{size:u.XS},`${a} > ${o}`)),e.createElement(r,{$gap:12},e.createElement(h,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future"},e.createElement(f,{label:"Auto",size:y.S,value:S,onChange:e=>A({auto:e,all:e||void 0})})),e.createElement(r,{$gap:8},e.createElement(d,{variant:w.Span,size:u.XXXS,color:v.v2.colors.silver[200],align:"right"},"Selected"),e.createElement(p,{label:`${k}/${s.length}`,status:I?g.Default:m.Unknown,minWidth:"42px"}))))})),[a,n.value.clusterId,n.value.namespaceName,i,C]);return e.createElement(Ne,{$width:"50%"},e.createElement(r,{$padding:"0 12px 0 28px",$gap:12},e.createElement(h,{text:(k?"Unselect":"Select")+" all workloads in all namespaces"},e.createElement(c,{partiallyChecked:x,value:k,onChange:()=>o({boolean:!k}),disabled:!$.length})),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XS,nowrap:!0},"Namespaces"),e.createElement(p,{label:$.length,status:m.Unknown}))),e.createElement(Oe,{$borderRadius:"16px 0 0 16px"},$.length?$:e.createElement(b,{title:"Namespaces not found",subTitle:""})))},We="75vw",Fe=n.div`
28
+ `,Ee=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:i,searchText:s,filters:f})=>{const w=o(),{activeNamespace:y,isAll:k,isSome:C}=t(()=>{const e=i.value.clusterId&&i.value.namespaceName?l.find(({clusterId:e})=>e===i.value.clusterId)?.namespaces.find(({name:e})=>e===i.value.namespaceName):void 0;if(!e)return{activeNamespace:void 0,isAll:!1,isSome:!1};const t=e.workloads.filter(({selected:e})=>e).length;return{activeNamespace:e,isAll:t>0&&t===e.workloads.length,isSome:t>0&&t<e.workloads.length}},[l,i.value.clusterId,i.value.namespaceName]),v=t(()=>{if(!y)return[];const{clusterId:t}=i.value,{name:l,workloads:n}=y;return n.map(({name:n,selected:i,kind:o})=>{if(s&&!n.toLowerCase().includes(s.toLowerCase()))return null;const g=i||!1;if(f.showOnlySelected&&!g)return null;const m=()=>a({clusterId:t,workloadId:{namespace:l,name:n,kind:o}});return e.jsxs(je,{onClick:m,children:[e.jsxs(r,{$gap:12,children:[e.jsx(c,{value:g,onChange:m}),e.jsx(d,{size:u.XS,children:n})]}),e.jsx(p,{label:o,status:h.Info,textSize:u.XXXS,backgroundColor:w.v2.colors.blue[900]})]},`${t}#${l}#${n}#${o}`)})},[l,i.value.clusterId,y,s,f]);return e.jsxs(We,{$width:"50%",children:[e.jsxs(r,{$padding:"0 12px 0 28px",$gap:12,children:[e.jsx(g,{text:(k?"Unselect":"Select")+" all workloads in the selected namespace",children:e.jsx(c,{partiallyChecked:C,value:k,onChange:()=>n({clusterId:i.value.clusterId,namespaceName:i.value.namespaceName,boolean:!k}),disabled:!v.length})}),e.jsxs(r,{$gap:8,children:[e.jsx(d,{size:u.XS,nowrap:!0,children:i.value.clusterId?`${i.value.clusterName} > ${i.value.namespaceName} > Workloads`:"Workloads"}),e.jsx(p,{label:v.length,status:m.Unknown})]})]}),e.jsx(Fe,{$borderRadius:"0 16px 16px 0",children:v.length?v:e.jsx(b,{title:"Workloads not found",subTitle:"Please select a namespace to view workloads"})})]})},Ge=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:i,searchText:s,filters:k})=>{const C=o(),{isAll:v,isSome:x}=t(()=>{const e=l.length>0&&l.every(({namespaces:e})=>e.every(({workloads:e})=>e.every(({selected:e})=>e)));return{isAll:e,isSome:!e&&l.length>0&&l.some(({namespaces:e})=>e.some(({workloads:e})=>e.some(({selected:e})=>e)))}},[l]),$=t(()=>l.flatMap(({clusterId:t,clusterName:l,namespaces:n})=>n.map(({name:n,workloads:o,selected:b})=>{if(s&&!n.toLowerCase().includes(s.toLowerCase()))return null;const v=o.filter(({selected:e})=>e).length,x=v>0&&v===o.length,$=v>0&&v<o.length,S=b||!1;if(k.showOnlySelected&&!x&&!$&&!S)return null;const I=i.value.clusterId===t&&i.value.namespaceName===n,T=()=>i.setValue({clusterId:t,clusterName:l,namespaceName:n}),D=e=>{T(),a({clusterId:t,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return e.jsxs(je,{$isSelected:I,onClick:T,children:[e.jsxs(r,{$gap:12,children:[e.jsx(c,{partiallyChecked:$,value:x,onChange:e=>D({auto:e,all:e})}),e.jsx(d,{size:u.XS,children:`${l} > ${n}`})]}),e.jsxs(r,{$gap:12,children:[e.jsx(g,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:e.jsx(f,{label:"Auto",size:w.S,value:S,onChange:e=>D({auto:e,all:e||void 0})})}),e.jsxs(r,{$gap:8,children:[e.jsx(d,{variant:y.Span,size:u.XXXS,color:C.v2.colors.silver[200],align:"right",children:"Selected"}),e.jsx(p,{label:`${v}/${o.length}`,status:I?h.Default:m.Unknown,minWidth:"42px"})]})]})]},`${t}#${n}`)})),[l,i.value.clusterId,i.value.namespaceName,s,k]);return e.jsxs(We,{$width:"50%",children:[e.jsxs(r,{$padding:"0 12px 0 28px",$gap:12,children:[e.jsx(g,{text:(v?"Unselect":"Select")+" all workloads in all namespaces",children:e.jsx(c,{partiallyChecked:x,value:v,onChange:()=>n({boolean:!v}),disabled:!$.length})}),e.jsxs(r,{$gap:8,children:[e.jsx(d,{size:u.XS,nowrap:!0,children:"Namespaces"}),e.jsx(p,{label:$.length,status:m.Unknown})]})]}),e.jsx(Fe,{$borderRadius:"16px 0 0 16px",children:$.length?$:e.jsx(b,{title:"Namespaces not found",subTitle:""})})]})},Ue="75vw",He=i.div`
29
29
  display: flex;
30
30
  flex-direction: column;
31
31
  border-radius: 16px;
32
32
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
33
33
  overflow: hidden;
34
- `,je=n.div`
34
+ `,Ye=i.div`
35
35
  display: flex;
36
36
  gap: 12px;
37
37
  padding: 16px;
38
38
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
39
39
  position: sticky;
40
40
  top: 0;
41
- `,Ee=n.div`
41
+ `,qe=i.div`
42
42
  display: flex;
43
43
  gap: 12px;
44
44
  padding: 16px;
45
- `,Ge=n.div`
45
+ `,Be=i.div`
46
46
  padding: 5vh 10vw;
47
47
  border-radius: 12px;
48
48
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
49
- `,Ue=n.div`
49
+ `,Xe=i.div`
50
50
  display: flex;
51
51
  align-items: center;
52
52
  justify-content: flex-end;
53
53
  gap: 16px;
54
54
  padding: 0 12px;
55
- `,He=({onClose:n,snapshots:i,selectedConnectionIds:c,setSelectedConnectionIds:p,persistSources:h})=>{const m=s(),{selectedStreamName:b}=C(),{progress:w,resetProgress:M}=v(),L=t(()=>b||k,[b]),[V,W]=a(""),[F,j]=a(x.Namespace),[E,G]=a({showOnlySelected:!1}),[U,H]=a(!1),[Y,q]=a(!1),[X,B]=a(void 0),[K,J]=a({clusterId:"",clusterName:"",namespaceName:""}),[Q,Z]=a([]);l(()=>{Z(e=>{const t=((e,t)=>$(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(i,c);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId);return a??t})})},[i,c]);const{formDiff:_,isFormDirty:ee}=t(()=>{const e=((e,t,a)=>{const l={};return e.forEach(e=>{e.namespaces.forEach(o=>{const n=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===o.name),s=o.selected||!1,i=s!==n?.selected;if(i&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push({namespace:o.name,selected:s,currentStreamName:a}),s&&(l[e.clusterId]=l[e.clusterId].filter(e=>e.namespace!==o.name||e.namespace===o.name&&(!e.name||!e.kind)))),!i||!s){const t=((e,t,a)=>{const l=[];return t.workloads.forEach(o=>{const n=e?.workloads.find(e=>e.name===o.name&&e.kind===o.kind);o.selected!==n?.selected&&l.push({namespace:t.name,name:o.name,kind:o.kind,selected:o.selected||!1,currentStreamName:a})}),l})(n,o,a);t.length>0&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push(...t))}})}),l})(Q,i.clusters,L);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[Q,i,L]),te=o(({clusterId:e,workloadId:t,selected:a,auto:l})=>{Z(o=>{const n=$(o),s=n.findIndex(t=>t.clusterId===e);if(-1===s)return n;const i=n[s].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return n;if(t.kind&&t.name){const e=n[s].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return n;const l="boolean"==typeof a?a:!n[s].namespaces[i].workloads[e].selected;n[s].namespaces[i].workloads[e].selected=l,l?n[s].namespaces[i].workloads.every(e=>e.selected)&&(n[s].namespaces[i].selected=!0):n[s].namespaces[i].selected=!1}else{const e="boolean"==typeof l?l:!n[s].namespaces[i].selected;n[s].namespaces[i].selected=e,e?n[s].namespaces[i].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof a||a||n[s].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return n})},[]),ae=o(({clusterId:e,namespaceName:t,boolean:a})=>{Z(l=>{const o=$(l);return o.forEach((l,n)=>{e&&l.clusterId!==e||l.namespaces.forEach(({name:e,workloads:l},s)=>{t&&e!==t||(o[n].namespaces[s].selected=a,l.forEach((e,t)=>{o[n].namespaces[s].workloads[t].selected=a}))})}),o})},[]),le=()=>{H(!1),n()};return e.createElement(S,{isOpen:!0,hideOverlay:!Y,width:We,header:{icon:pe,title:"Manage Sources",onClose:n,onCloseDisabled:Y}},Y?e.createElement(I,{$height:"calc(100vh - 136px)"},e.createElement(Ge,null,e.createElement(D,{title:"Creating Sources...",titleSize:u.S,subTitle:"This may take a few moments while sources are being created.",subTitleSize:u.XXXS,withGradient:!0,withSpinner:!0,percentage:w[A.BulkInstrumenting]?.percentage||0}))):e.createElement(Fe,null,e.createElement(je,null,e.createElement(P,{icon:ge,title:"Selected Clusters",badge:{label:c.length}}),e.createElement(T,{width:"300px",value:V,onChange:W,segment:{options:[{label:"Namespace",value:x.Namespace},{label:"Source",value:x.Source}],selected:F,setSelected:j}}),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XXXS,color:m.v2.colors.silver[200],nowrap:!0},"Show only:"),e.createElement(f,{size:y.S,label:"Selected",value:E.showOnlySelected,onChange:e=>G(t=>({...t,showOnlySelected:e}))}))),e.createElement(Ee,null,e.createElement(Ve,{formData:Q,handleSourceChange:te,handleSelectAll:ae,selectedArea:{value:K,setValue:J},searchText:F===x.Namespace?V:"",filters:E}),e.createElement(Le,{formData:Q,handleSourceChange:te,handleSelectAll:ae,selectedArea:{value:K,setValue:J},searchText:F===x.Source?V:"",filters:E}))),e.createElement(Ue,null,Y?null:X?e.createElement(R,{fullWidth:!0,status:g.Error,message:X}):ee?e.createElement(R,{fullWidth:!0,status:g.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):ee?null:e.createElement(R,{fullWidth:!0,status:g.Success,message:"The values reflect the current configuration of the selected cluster."}),e.createElement(r,{$gap:8},e.createElement("div",{style:{width:"150px"}},e.createElement(z,{fullWidth:!0,variant:N.Secondary,label:"Cancel",onClick:()=>ee?H(!0):le(),disabled:!ee||Y})),e.createElement("div",{style:{width:"150px"}},e.createElement(z,{fullWidth:!0,variant:N.Primary,label:"Save",onClick:async()=>{q(!0);const e=await h(_);M(A.BulkInstrumenting),q(!1),e?.error?B(e.error):(p([]),n())},disabled:!ee||Y})))),e.createElement(O,{isOpen:U,onClose:()=>H(!1),onApprove:le}))},Ye="75vw",qe=1.16,Xe=n.div`
55
+ `,Ke=({onClose:i,snapshots:s,selectedConnectionIds:c,setSelectedConnectionIds:p,persistSources:g})=>{const m=o(),{selectedStreamName:b}=k(),{progress:y,resetProgress:V}=C(),M=t(()=>b||v,[b]),[L,W]=l(""),[F,j]=l(x.Namespace),[E,G]=l({showOnlySelected:!1}),[U,H]=l(!1),[Y,q]=l(!1),[B,X]=l(void 0),[K,J]=l({clusterId:"",clusterName:"",namespaceName:""}),[Q,Z]=l([]);a(()=>{Z(e=>{const t=((e,t)=>$(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(s,c);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[s,c]);const{formDiff:_,isFormDirty:ee}=t(()=>{const e=((e,t,l)=>{const a={};return e.forEach(e=>{e.namespaces.forEach(n=>{const i=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),o=n.selected||!1,s=o!==i?.selected;if(s&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push({namespace:n.name,selected:o,currentStreamName:l}),o&&(a[e.clusterId]=a[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!s||!o){const t=((e,t,l)=>{const a=[];return t.workloads.forEach(n=>{const i=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==i?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:l})}),a})(i,n,l);t.length>0&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push(...t))}})}),a})(Q,s.clusters,M);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[Q,s,M]),te=n(({clusterId:e,workloadId:t,selected:l,auto:a})=>{Z(n=>{const i=$(n),o=i.findIndex(t=>t.clusterId===e);if(-1===o)return i;const s=i[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===s)return i;if(t.kind&&t.name){const e=i[o].namespaces[s].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return i;const a="boolean"==typeof l?l:!i[o].namespaces[s].workloads[e].selected;i[o].namespaces[s].workloads[e].selected=a,a?i[o].namespaces[s].workloads.every(e=>e.selected)&&(i[o].namespaces[s].selected=!0):i[o].namespaces[s].selected=!1}else{const e="boolean"==typeof a?a:!i[o].namespaces[s].selected;i[o].namespaces[s].selected=e,e?i[o].namespaces[s].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof l||l||i[o].namespaces[s].workloads.forEach(e=>{e.selected=!1})}return i})},[]),le=n(({clusterId:e,namespaceName:t,boolean:l})=>{Z(a=>{const n=$(a);return n.forEach((a,i)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},o)=>{t&&e!==t||(n[i].namespaces[o].selected=l,a.forEach((e,t)=>{n[i].namespaces[o].workloads[t].selected=l}))})}),n})},[]),ae=()=>{H(!1),i()};return e.jsxs(S,{isOpen:!0,hideOverlay:!Y,width:Ue,header:{icon:me,title:"Manage Sources",onClose:i,onCloseDisabled:Y},children:[Y?e.jsx(I,{$height:"calc(100vh - 136px)",children:e.jsx(Be,{children:e.jsx(T,{title:"Creating Sources...",titleSize:u.S,subTitle:"This may take a few moments while sources are being created.",subTitleSize:u.XXXS,withGradient:!0,withSpinner:!0,percentage:y[D.BulkInstrumenting]?.percentage||0})})}):e.jsxs(He,{children:[e.jsxs(Ye,{children:[e.jsx(A,{icon:be,title:"Selected Clusters",badge:{label:c.length}}),e.jsx(P,{width:"300px",value:L,onChange:W,segment:{options:[{label:"Namespace",value:x.Namespace},{label:"Source",value:x.Source}],selected:F,setSelected:j}}),e.jsxs(r,{$gap:8,children:[e.jsx(d,{size:u.XXXS,color:m.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),e.jsx(f,{size:w.S,label:"Selected",value:E.showOnlySelected,onChange:e=>G(t=>({...t,showOnlySelected:e}))})]})]}),e.jsxs(qe,{children:[e.jsx(Ge,{formData:Q,handleSourceChange:te,handleSelectAll:le,selectedArea:{value:K,setValue:J},searchText:F===x.Namespace?L:"",filters:E}),e.jsx(Ee,{formData:Q,handleSourceChange:te,handleSelectAll:le,selectedArea:{value:K,setValue:J},searchText:F===x.Source?L:"",filters:E})]})]}),e.jsxs(Xe,{children:[Y?null:B?e.jsx(z,{fullWidth:!0,status:h.Error,message:B}):ee?e.jsx(z,{fullWidth:!0,status:h.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):ee?null:e.jsx(z,{fullWidth:!0,status:h.Success,message:"The values reflect the current configuration of the selected cluster."}),e.jsxs(r,{$gap:8,children:[e.jsx("div",{style:{width:"150px"},children:e.jsx(R,{fullWidth:!0,variant:N.Secondary,label:"Cancel",onClick:()=>ee?H(!0):ae(),disabled:!ee||Y})}),e.jsx("div",{style:{width:"150px"},children:e.jsx(R,{fullWidth:!0,variant:N.Primary,label:"Save",onClick:async()=>{q(!0);const e=await g(_);V(D.BulkInstrumenting),q(!1),e?.error?X(e.error):(p([]),i())},disabled:!ee||Y})})]})]}),e.jsx(O,{isOpen:U,onClose:()=>H(!1),onApprove:ae})]})},Je="75vw",Qe=1.16,Ze=i.div`
56
56
  display: flex;
57
57
  flex-direction: column;
58
58
  border-radius: 16px;
59
59
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
60
60
  overflow: hidden;
61
- `,Be=n.div`
61
+ `,_e=i.div`
62
62
  display: flex;
63
63
  gap: 12px;
64
64
  padding: 16px;
65
65
  background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
66
66
  position: sticky;
67
67
  top: 0;
68
- `,Ke=n.div`
68
+ `,et=i.div`
69
69
  display: flex;
70
70
  gap: 12px;
71
71
  padding: 16px;
72
- `,Je=n(i)`
72
+ `,tt=i(s)`
73
73
  width: ${({$width:e})=>e};
74
74
  gap: 12px;
75
75
  justify-content: space-between;
76
- `,Qe=n.div`
76
+ `,lt=i.div`
77
77
  display: flex;
78
78
  flex-direction: column;
79
79
  padding: 12px;
@@ -84,7 +84,7 @@ import e,{useMemo as t,useState as a,useEffect as l,useCallback as o}from"react"
84
84
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
85
85
  overflow-y: auto;
86
86
  overflow-x: hidden;
87
- `,Ze=n.div`
87
+ `,at=i.div`
88
88
  display: flex;
89
89
  align-items: center;
90
90
  gap: 12px;
@@ -95,13 +95,13 @@ import e,{useMemo as t,useState as a,useEffect as l,useCallback as o}from"react"
95
95
  &:hover {
96
96
  background-color: ${({theme:e})=>e.v2.colors.silver[600]};
97
97
  }
98
- `,_e=n.div`
98
+ `,nt=i.div`
99
99
  display: flex;
100
100
  align-items: center;
101
101
  justify-content: flex-end;
102
102
  gap: 16px;
103
103
  padding: 0 12px;
104
- `,et=({onClose:o,connections:n,selectedConnectionIds:i,setSelectedConnectionIds:h,getEffectiveConfig:w,onApply:C})=>{const v=s(),[k,x]=a(""),[$,I]=a({showOnlySelected:!1}),A=t(()=>{const e=[],t=[];for(const a of n){const l=M(a.odigosVersion,qe),o=a.status===g.Success,n=i.includes(a.id),s=!$.showOnlySelected||n,r=!k||a.name.toLowerCase().includes(k.toLowerCase());l&&o&&s&&r?e.push(a):n&&t.push(a.id)}return t.length>0&&h(e=>e.filter(e=>!t.includes(e))),e},[n.length,i.length,k,$]),W=e=>{h(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[F,j]=a(!1),[E,G]=a(!1),[U,H]=a(void 0),[Y,q]=a(!1),[X,B]=a(void 0),{formData:K,handleFormChange:J,areFormValuesEqual:Q,resetFormData:Z}=L(X||{rollout:{automaticRolloutDisabled:!1}}),{isFormDirty:_,isFormMatch:ee}=t(()=>({isFormDirty:i.length>1||void 0!==X&&!Q(X,K),isFormMatch:1===i.length&&void 0!==X&&Q(X,K)}),[i.length,X,K]);l(()=>{1===i.length?(async e=>{if(Y)return;q(!0);const t=await w(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};B(e),Z(e)}q(!1)})(i[0]):B(void 0)},[i.length]);const te=()=>{j(!1),o()};return e.createElement(S,{isOpen:!0,hideOverlay:!0,width:Ye,header:{icon:he,title:"Cluster Configuration",onClose:o}},e.createElement(Xe,null,e.createElement(Be,null,e.createElement(P,{icon:ge,title:"Selected Clusters",badge:{label:i.length}}),e.createElement(T,{width:"300px",placeholder:"Search by cluster name",value:k,onChange:x}),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XXXS,color:v.v2.colors.silver[200],nowrap:!0},"Show only:"),e.createElement(f,{size:y.S,label:"Selected",value:$.showOnlySelected,onChange:e=>I(t=>({...t,showOnlySelected:e}))}))),e.createElement(Ke,null,e.createElement(Je,{$width:"40%"},e.createElement(r,{$padding:"0 12px",$justifyContent:"space-between"},e.createElement(r,{$gap:8},e.createElement(d,{size:u.XS},"Clusters"),e.createElement(p,{label:A.length,status:m.Unknown})),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XXXS,color:v.v2.colors.silver[200],align:"right"},"Selected clusters"),e.createElement(p,{label:`${i.length}/${A.length}`,status:m.Unknown}))),e.createElement(Qe,{$borderRadius:"16px 0 0 16px"},A.length?A.map(t=>e.createElement(Ze,{key:t.id,onClick:()=>W(t.id)},e.createElement(c,{value:i.includes(t.id),onChange:()=>W(t.id)}),e.createElement(d,{size:u.XS},t.name))):e.createElement(b,{title:"Clusters not found",subTitle:"Please select a cluster to update it's configuration"}))),e.createElement(Je,{$width:"60%"},e.createElement(r,{$padding:"0 12px"},e.createElement(d,{size:u.XS},"Configurations")),e.createElement(Qe,{$borderRadius:"0 16px 16px 0",$gap:12},Y?e.createElement(V,null):e.createElement(f,{label:"Automatic Rollout Disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:K.rollout?.automaticRolloutDisabled||!1,onChange:e=>J("rollout.automaticRolloutDisabled",e)}))))),e.createElement(_e,null,Y?e.createElement(D,{icon:me,title:"Fetching Configuration...",titleSize:u.XXS,withGradient:!0}):E?e.createElement(D,{icon:me,title:"Applying Configurations...",titleSize:u.XXS,withGradient:!0}):U?e.createElement(R,{fullWidth:!0,status:g.Error,message:U}):_?e.createElement(R,{fullWidth:!0,status:g.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):ee?e.createElement(R,{fullWidth:!0,status:g.Success,message:"The values reflect the current configuration of the selected cluster."}):null,e.createElement(r,{$gap:8},e.createElement("div",{style:{width:"150px"}},e.createElement(z,{fullWidth:!0,variant:N.Secondary,label:"Cancel",onClick:()=>_?j(!0):te(),disabled:E})),e.createElement("div",{style:{width:"150px"}},e.createElement(z,{fullWidth:!0,variant:N.Primary,label:"Save",onClick:async()=>{G(!0);const e=await C(i,K);G(!1),e?.error?H(e.error):(h([]),o())},disabled:!_||E})))),e.createElement(O,{isOpen:F,onClose:()=>j(!1),onApprove:te}))};var tt,at;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(tt||(tt={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(at||(at={}));const lt=[{key:at.Name,label:"Name"},{key:at.Type,label:"Type",textAlign:"right"},{key:at.Status,label:"Status"},{key:at.OdigosVersion,label:"Odigos Version"},{key:at.ConnectedSince,label:"Connected Since"},{key:at.LastActivity,label:"Last Activity"}],ot=(e,t)=>{const a=e.find(e=>e.key===at.Id)?.rawValue;return t(a?.toString()||"")},nt=({tableRowsMaxHeight:n,connections:i,getConnections:r,onClickConnection:c,deleteConnection:d,getEffectiveConfig:u,applyConfigurations:h,getAllClusterSnapshots:b,persistSources:f})=>{const y=s(),{formatTimeAgo:w}=W(),[C,v]=a(!1),[k,x]=a(i||[]),[$,S]=a(!1),[I,D]=a(null),A=o(async()=>{try{v(!0),x(await r()??[])}catch(e){}finally{v(!1)}},[]),P=o(async()=>{if(b)try{S(!0),D(await b()??null)}catch(e){}finally{S(!1)}},[]);l(()=>{k.length||A()},[k.length,A]),l(()=>{I||P()},[I,P]);const[T,R]=a(""),[z,O]=a(null),[L,V]=a([]),K=t(()=>k.filter(e=>!T||e.name.toLowerCase().includes(T.toLowerCase())).map(t=>({cells:[{key:at.Id,rawValue:t.id},{key:at.Name,rawValue:t.name},{key:at.Type,rawValue:t.type},{key:at.Status,rawValue:t.status,component:()=>(t=>{const a=t===g.Success?"Connection live":"Connection lost",l=t===g.Success?we:Ce;return e.createElement(p,{status:t,label:a,leftIcon:l})})(t.status)},{key:at.OdigosVersion,rawValue:t.odigosVersion},{key:at.ConnectedSince,rawValue:t.connectedAt?w(t.connectedAt):"-"},{key:at.LastActivity,rawValue:t.lastSeenAt?w(t.lastSeenAt):"-"}],onClick:t.status===g.Success?()=>c(t):void 0,isSelected:L.includes(t.id),onSelect:()=>V(e=>Array.from(new Set([...e,t.id]))),onDeselect:()=>V(e=>e.filter(e=>e!==t.id)),hideCheckbox:t.status!==g.Success||z===tt.BulkConfig&&!M(t.odigosVersion,qe)})),[k,L,T,z]),J=o(({cells:e})=>{if(!(e=>e.find(e=>e.key===at.Status)?.rawValue===g.Success)(e))return[{id:F(),label:"Delete Connection",rightIcon:be,onClick:()=>{ot(e,e=>{V([e]),O(tt.Delete)})}}];const t=ot(e,e=>{const t=k.find(t=>t.id===e);return t&&M(t.odigosVersion,qe)||!1});return[I&&f?{id:F(),tooltip:"Manage Sources",rightIcon:pe,onClick:async()=>{ot(e,e=>{V([e]),O(tt.BulkSource)})}}:null,u&&h?{id:F(),tooltip:t?"Edit Configuration":"To use this feature, please upgrade to Odigos v1.16 or later.",rightIcon:he,disabled:!t,onClick:async()=>{ot(e,e=>{V([e]),O(tt.BulkConfig)})}}:null]},[k.length,I]),Q=t(()=>[{id:F(),type:j.Button,buttonProps:{variant:N.Text,size:E.S,label:"Cancel",onClick:()=>V([])}},I&&f?{id:F(),type:j.ButtonDropData,buttonProps:{variant:N.Secondary,size:E.S,label:"Add Component",onClick:e=>O(e)},dropDataProps:{alignX:G.Left,items:[{id:tt.BulkSource,label:"Add Source",icon:pe}]}}:null,u&&h?{id:F(),type:j.Button,buttonProps:{variant:N.Primary,size:E.S,label:"Manage Configurations",rightIcon:he,onClick:()=>O(tt.BulkConfig)}}:null],[I]);return e.createElement(U,null,e.createElement(H,{richTitle:{icon:fe,title:"Connections",badge:{label:k.length.toString(),status:m.Unknown}},search:{placeholder:"Search by cluster name",value:T,onChange:e=>R(e),width:"300px"},actions:[{id:F(),type:j.Button,buttonProps:{variant:N.Secondary,size:E.S,leftIcon:ye,onClick:async()=>{await A(),await P()},disabled:C||$}}]},e.createElement(Y,{variant:q.Pretty,maxHeight:n,headerBackgroundColor:y.v2.colors.silver[1e3],isLoading:C,withCheckboxes:!0,columns:lt,rows:K,rowActionsPushRightPosition:z?`calc(${z===tt.BulkConfig?Ye:We} - 24px)`:void 0,getRowActions:J}),z===tt.BulkConfig&&u&&h&&e.createElement(et,{onClose:()=>O(null),connections:k,selectedConnectionIds:L,setSelectedConnectionIds:V,getEffectiveConfig:u,onApply:h}),z===tt.BulkSource&&I&&f&&e.createElement(He,{onClose:()=>O(null),snapshots:I,selectedConnectionIds:L,setSelectedConnectionIds:V,persistSources:async e=>{if(!f)return{error:"Persist sources function is not defined"};const t=await f(e);return t?.error||await P(),t}}),e.createElement(X,{target:"connection",isOpen:z===tt.Delete,onClose:()=>{V([]),O(null)},onApprove:async()=>{const e=L[0];e&&(await d(e),await A())}}),e.createElement(B,{isOpen:!!L.length&&!z,richTitle:{icon:ge,title:"Selected Clusters",badge:{label:L.length}},actions:Q})))},st=n.div`
104
+ `,it=({onClose:n,connections:i,selectedConnectionIds:s,setSelectedConnectionIds:g,getEffectiveConfig:y,onApply:k})=>{const C=o(),[v,x]=l(""),[$,I]=l({showOnlySelected:!1}),D=t(()=>{const e=[],t=[];for(const l of i){const a=V(l.odigosVersion,Qe),n=l.status===h.Success,i=s.includes(l.id),o=!$.showOnlySelected||i,r=!v||l.name.toLowerCase().includes(v.toLowerCase());a&&n&&o&&r?e.push(l):i&&t.push(l.id)}return t.length>0&&g(e=>e.filter(e=>!t.includes(e))),e},[i.length,s.length,v,$]),W=e=>{g(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[F,j]=l(!1),[E,G]=l(!1),[U,H]=l(void 0),[Y,q]=l(!1),[B,X]=l(void 0),{formData:K,handleFormChange:J,areFormValuesEqual:Q,resetFormData:Z}=M(B||{rollout:{automaticRolloutDisabled:!1}}),{isFormDirty:_,isFormMatch:ee}=t(()=>({isFormDirty:s.length>1||void 0!==B&&!Q(B,K),isFormMatch:1===s.length&&void 0!==B&&Q(B,K)}),[s.length,B,K]);a(()=>{1===s.length?(async e=>{if(Y)return;q(!0);const t=await y(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};X(e),Z(e)}q(!1)})(s[0]):X(void 0)},[s.length]);const te=()=>{j(!1),n()};return e.jsxs(S,{isOpen:!0,hideOverlay:!0,width:Je,header:{icon:fe,title:"Cluster Configuration",onClose:n},children:[e.jsxs(Ze,{children:[e.jsxs(_e,{children:[e.jsx(A,{icon:be,title:"Selected Clusters",badge:{label:s.length}}),e.jsx(P,{width:"300px",placeholder:"Search by cluster name",value:v,onChange:x}),e.jsxs(r,{$gap:8,children:[e.jsx(d,{size:u.XXXS,color:C.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),e.jsx(f,{size:w.S,label:"Selected",value:$.showOnlySelected,onChange:e=>I(t=>({...t,showOnlySelected:e}))})]})]}),e.jsxs(et,{children:[e.jsxs(tt,{$width:"40%",children:[e.jsxs(r,{$padding:"0 12px",$justifyContent:"space-between",children:[e.jsxs(r,{$gap:8,children:[e.jsx(d,{size:u.XS,children:"Clusters"}),e.jsx(p,{label:D.length,status:m.Unknown})]}),e.jsxs(r,{$gap:8,children:[e.jsx(d,{size:u.XXXS,color:C.v2.colors.silver[200],align:"right",children:"Selected clusters"}),e.jsx(p,{label:`${s.length}/${D.length}`,status:m.Unknown})]})]}),e.jsx(lt,{$borderRadius:"16px 0 0 16px",children:D.length?D.map(t=>e.jsxs(at,{onClick:()=>W(t.id),children:[e.jsx(c,{value:s.includes(t.id),onChange:()=>W(t.id)}),e.jsx(d,{size:u.XS,children:t.name})]},t.id)):e.jsx(b,{title:"Clusters not found",subTitle:"Please select a cluster to update it's configuration"})})]}),e.jsxs(tt,{$width:"60%",children:[e.jsx(r,{$padding:"0 12px",children:e.jsx(d,{size:u.XS,children:"Configurations"})}),e.jsx(lt,{$borderRadius:"0 16px 16px 0",$gap:12,children:Y?e.jsx(L,{}):e.jsx(f,{label:"Automatic Rollout Disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:K.rollout?.automaticRolloutDisabled||!1,onChange:e=>J("rollout.automaticRolloutDisabled",e)})})]})]})]}),e.jsxs(nt,{children:[Y?e.jsx(T,{icon:we,title:"Fetching Configuration...",titleSize:u.XXS,withGradient:!0}):E?e.jsx(T,{icon:we,title:"Applying Configurations...",titleSize:u.XXS,withGradient:!0}):U?e.jsx(z,{fullWidth:!0,status:h.Error,message:U}):_?e.jsx(z,{fullWidth:!0,status:h.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):ee?e.jsx(z,{fullWidth:!0,status:h.Success,message:"The values reflect the current configuration of the selected cluster."}):null,e.jsxs(r,{$gap:8,children:[e.jsx("div",{style:{width:"150px"},children:e.jsx(R,{fullWidth:!0,variant:N.Secondary,label:"Cancel",onClick:()=>_?j(!0):te(),disabled:E})}),e.jsx("div",{style:{width:"150px"},children:e.jsx(R,{fullWidth:!0,variant:N.Primary,label:"Save",onClick:async()=>{G(!0);const e=await k(s,K);G(!1),e?.error?H(e.error):(g([]),n())},disabled:!_||E})})]})]}),e.jsx(O,{isOpen:F,onClose:()=>j(!1),onApprove:te})]})};var ot,st;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(ot||(ot={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(st||(st={}));const rt=[{key:st.Name,label:"Name"},{key:st.Type,label:"Type",textAlign:"right"},{key:st.Status,label:"Status"},{key:st.OdigosVersion,label:"Odigos Version"},{key:st.ConnectedSince,label:"Connected Since"},{key:st.LastActivity,label:"Last Activity"}],ct=(e,t)=>{const l=e.find(e=>e.key===st.Id)?.rawValue;return t(l?.toString()||"")},dt=({tableRowsMaxHeight:i,connections:s,getConnections:r,onClickConnection:c,deleteConnection:d,getEffectiveConfig:u,applyConfigurations:g,getAllClusterSnapshots:b,persistSources:f})=>{const w=o(),{formatTimeAgo:y}=W(),[k,C]=l(!1),[v,x]=l(s||[]),[$,S]=l(!1),[I,T]=l(null),D=n(async()=>{try{C(!0),x(await r()??[])}catch(e){}finally{C(!1)}},[]),A=n(async()=>{if(b)try{S(!0),T(await b()??null)}catch(e){}finally{S(!1)}},[]);a(()=>{v.length||D()},[v.length,D]),a(()=>{I||A()},[I,A]);const[P,z]=l(""),[R,O]=l(null),[M,L]=l([]),K=t(()=>v.filter(e=>!P||e.name.toLowerCase().includes(P.toLowerCase())).map(t=>({cells:[{key:st.Id,rawValue:t.id},{key:st.Name,rawValue:t.name},{key:st.Type,rawValue:t.type},{key:st.Status,rawValue:t.status,component:()=>(t=>{const l=t===h.Success?"Connection live":"Connection lost",a=t===h.Success?ve:xe;return e.jsx(p,{status:t,label:l,leftIcon:a})})(t.status)},{key:st.OdigosVersion,rawValue:t.odigosVersion},{key:st.ConnectedSince,rawValue:t.connectedAt?y(t.connectedAt):"-"},{key:st.LastActivity,rawValue:t.lastSeenAt?y(t.lastSeenAt):"-"}],onClick:t.status===h.Success?()=>c(t):void 0,isSelected:M.includes(t.id),onSelect:()=>L(e=>Array.from(new Set([...e,t.id]))),onDeselect:()=>L(e=>e.filter(e=>e!==t.id)),hideCheckbox:t.status!==h.Success||R===ot.BulkConfig&&!V(t.odigosVersion,Qe)})),[v,M,P,R]),J=n(({cells:e})=>{if(!(e=>e.find(e=>e.key===st.Status)?.rawValue===h.Success)(e))return[{id:F(),label:"Delete Connection",rightIcon:ye,onClick:()=>{ct(e,e=>{L([e]),O(ot.Delete)})}}];const t=ct(e,e=>{const t=v.find(t=>t.id===e);return t&&V(t.odigosVersion,Qe)||!1});return[I&&f?{id:F(),tooltip:"Manage Sources",rightIcon:me,onClick:async()=>{ct(e,e=>{L([e]),O(ot.BulkSource)})}}:null,u&&g?{id:F(),tooltip:t?"Edit Configuration":"To use this feature, please upgrade to Odigos v1.16 or later.",rightIcon:fe,disabled:!t,onClick:async()=>{ct(e,e=>{L([e]),O(ot.BulkConfig)})}}:null]},[v.length,I]),Q=t(()=>[{id:F(),type:E.Button,buttonProps:{variant:N.Text,size:j.S,label:"Cancel",onClick:()=>L([])}},I&&f?{id:F(),type:E.ButtonDropData,buttonProps:{variant:N.Secondary,size:j.S,label:"Add Component",onClick:e=>O(e)},dropDataProps:{alignX:G.Left,items:[{id:ot.BulkSource,label:"Add Source",icon:me}]}}:null,u&&g?{id:F(),type:E.Button,buttonProps:{variant:N.Primary,size:j.S,label:"Manage Configurations",rightIcon:fe,onClick:()=>O(ot.BulkConfig)}}:null],[I]);return e.jsx(U,{children:e.jsxs(H,{richTitle:{icon:Ce,title:"Connections",badge:{label:v.length.toString(),status:m.Unknown}},search:{placeholder:"Search by cluster name",value:P,onChange:e=>z(e),width:"300px"},actions:[{id:F(),type:E.Button,buttonProps:{variant:N.Secondary,size:j.S,leftIcon:ke,onClick:async()=>{await D(),await A()},disabled:k||$}}],children:[e.jsx(Y,{variant:q.Pretty,maxHeight:i,headerBackgroundColor:w.v2.colors.silver[1e3],isLoading:k,withCheckboxes:!0,columns:rt,rows:K,rowActionsPushRightPosition:R?`calc(${R===ot.BulkConfig?Je:Ue} - 24px)`:void 0,getRowActions:J}),R===ot.BulkConfig&&u&&g&&e.jsx(it,{onClose:()=>O(null),connections:v,selectedConnectionIds:M,setSelectedConnectionIds:L,getEffectiveConfig:u,onApply:g}),R===ot.BulkSource&&I&&f&&e.jsx(Ke,{onClose:()=>O(null),snapshots:I,selectedConnectionIds:M,setSelectedConnectionIds:L,persistSources:async e=>{if(!f)return{error:"Persist sources function is not defined"};const t=await f(e);return t?.error||await A(),t}}),e.jsx(B,{target:"connection",isOpen:R===ot.Delete,onClose:()=>{L([]),O(null)},onApprove:async()=>{const e=M[0];e&&(await d(e),await D())}}),e.jsx(X,{isOpen:!!M.length&&!R,richTitle:{icon:be,title:"Selected Clusters",badge:{label:M.length}},actions:Q})]})})},ut=i.div`
105
105
  display: flex;
106
106
  align-items: center;
107
107
  justify-content: space-between;
@@ -113,17 +113,17 @@ import e,{useMemo as t,useState as a,useEffect as l,useCallback as o}from"react"
113
113
  &:hover {
114
114
  background: ${({theme:e})=>e.v2.colors.silver[700]};
115
115
  }
116
- `,it=n.div`
117
- animation-name: ${K.animations.fade.in};
118
- `,rt=({pod:o,getExtendedPodInfo:n,onClose:s})=>{const{formatTimeAgo:r}=W(),[c,u]=a(null),[p,h]=a(!1);l(()=>{o?n(o.namespace,o.name).then(e=>u(e??null)):(u(null),h(!1))},[o]);const m=t(()=>[{id:F(),title:"Node",label:c?.node??"-",withCopy:!0},{id:F(),title:"Status",badge:{status:J(c?.status),label:c?.status??"-"}}],[c]),b=t(()=>c?.containers?.map(e=>({id:F(),items:[{id:F(),title:"Container",label:e.name??"-"},{id:F(),title:"Status",label:e.startedAt?`${e.status} (since ${r(e.startedAt)})`:e.status},{id:F(),title:"Ready",badge:{status:e.ready?g.Success:g.Error,leftIcon:e.ready?ge:ve,label:e.ready?"True":"False",invertColors:!0}},{id:F(),title:"Started",badge:{status:e.started?g.Success:g.Error,leftIcon:e.started?ge:ve,label:e.started?"True":"False",invertColors:!0}},{id:F(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:F(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:F(),title:"Restarts",label:e.restarts.toString()},{id:F(),title:"State Reason",label:e.stateReason??"-"},{id:F(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:F(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return e.createElement(S,{isOpen:!!o,header:{icon:ke,title:"Pod Information",onClose:s}},c?null:e.createElement(I,null,e.createElement(V,null)),c?e.createElement(e.Fragment,null,e.createElement(H,{richTitle:{icon:ke,title:c.name,withCopy:!0}},e.createElement(i,{$gap:24},e.createElement(Q,{cellsPerRow:2,items:m}),b.length>0&&e.createElement(i,{$gap:12},e.createElement(st,{onClick:()=>h(e=>!e)},e.createElement(d,null,"Containers Overview"),e.createElement(Z,{icon:p?xe:$e})),p&&b.map(({id:t,items:a})=>e.createElement(it,{key:t},e.createElement(Q,{cellsPerRow:2,items:a})))))),e.createElement(H,{richTitle:{icon:Se,title:"Kubectl Commands"}},e.createElement(i,{$gap:12},e.createElement(_,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),e.createElement(_,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),e.createElement(_,{value:`kubectl logs ${c.name} -n ${c.namespace}`}))),e.createElement(ee,{yaml:c.manifestYAML,defaultOpen:!0})):null)};var ct;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(ct||(ct={}));const dt=[{key:ct.PodName,label:"Pod Name"},{key:ct.Status,label:"Status"},{key:ct.Restarts,label:"Restarts",textAlign:"right"},{key:ct.NodeName,label:"Node Name"},{key:ct.Age,label:"Age",textAlign:"right"},{key:ct.DockerImage,label:"Docker Image",textAlign:"right"}],ut=({isLoading:l,tableRowsMaxHeight:o,pods:n,getExtendedPodInfo:i})=>{const c=s(),{formatTimeAgo:u}=W(),[m,b]=a(null),f=t(()=>n.map(t=>({onClick:()=>b(t),cells:[{key:ct.PodName,rawValue:t.name},{key:ct.Status,rawValue:t.status,component:()=>{return a=t.status,e.createElement(p,{status:J(a),label:a});var a}},{key:ct.Restarts,rawValue:t.restartsCount.toString()},{key:ct.NodeName,rawValue:t.nodeName},{key:ct.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=t;if(!a)return e.createElement(d,null,"-");const l=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),o=l>0?Math.round((a?.metricsDroppedRps??0)/l*100):0,n=o>0?g.Error:g.Success,s=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),i=s>0?Math.round((a?.exporterFailedRps??0)/s*100):0,c=i>0?g.Error:g.Success;return e.createElement(r,{$gap:4},e.createElement(h,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`},e.createElement(p,{status:n,label:`Receiver ${o}%`,leftIcon:n===g.Error?Ie:De,useSecondaryTone:!0,invertColors:!0})),e.createElement(h,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`},e.createElement(p,{status:c,label:`Exporter ${i}%`,leftIcon:c===g.Error?Ie:De,useSecondaryTone:!0,invertColors:!0})))}},{key:ct.Age,rawValue:u(t.creationTimestamp)},{key:ct.DockerImage,rawValue:t.image}]})),[n,c]);return e.createElement(H,{richTitle:{icon:ke,title:"Pods"}},e.createElement(Y,{variant:q.Data,maxHeight:o,isLoading:l,columns:dt,rows:f}),e.createElement(rt,{pod:m,getExtendedPodInfo:i,onClose:()=>b(null)}))};var pt;!function(e){e.Gateway="gateway",e.Node="node"}(pt||(pt={}));const gt=[{value:pt.Gateway,label:"Gateway"},{value:pt.Node,label:"Node Collector"}],ht=n.div`
116
+ `,pt=i.div`
117
+ animation-name: ${ee.in};
118
+ `,ht=({pod:n,getExtendedPodInfo:i,onClose:o})=>{const{formatTimeAgo:r}=W(),[c,u]=l(null),[p,g]=l(!1);a(()=>{n?i(n.namespace,n.name).then(e=>u(e??null)):(u(null),g(!1))},[n]);const m=t(()=>[{id:F(),title:"Node",label:c?.node??"-",withCopy:!0},{id:F(),title:"Status",badge:{status:K(c?.status),label:c?.status??"-"}}],[c]),b=t(()=>c?.containers?.map(e=>({id:F(),items:[{id:F(),title:"Container",label:e.name??"-"},{id:F(),title:"Status",label:e.startedAt?`${e.status} (since ${r(e.startedAt)})`:e.status},{id:F(),title:"Ready",badge:{status:e.ready?h.Success:h.Error,leftIcon:e.ready?be:$e,label:e.ready?"True":"False",invertColors:!0}},{id:F(),title:"Started",badge:{status:e.started?h.Success:h.Error,leftIcon:e.started?be:$e,label:e.started?"True":"False",invertColors:!0}},{id:F(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:F(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:F(),title:"Restarts",label:e.restarts.toString()},{id:F(),title:"State Reason",label:e.stateReason??"-"},{id:F(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:F(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return e.jsxs(S,{isOpen:!!n,header:{icon:Se,title:"Pod Information",onClose:o},children:[c?null:e.jsx(I,{children:e.jsx(L,{})}),c?e.jsxs(e.Fragment,{children:[e.jsx(H,{richTitle:{icon:Se,title:c.name,withCopy:!0},children:e.jsxs(s,{$gap:24,children:[e.jsx(J,{cellsPerRow:2,items:m}),b.length>0&&e.jsxs(s,{$gap:12,children:[e.jsxs(ut,{onClick:()=>g(e=>!e),children:[e.jsx(d,{children:"Containers Overview"}),e.jsx(Q,{icon:p?Ie:Te})]}),p&&b.map(({id:t,items:l})=>e.jsx(pt,{children:e.jsx(J,{cellsPerRow:2,items:l})},t))]})]})}),e.jsx(H,{richTitle:{icon:De,title:"Kubectl Commands"},children:e.jsxs(s,{$gap:12,children:[e.jsx(Z,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),e.jsx(Z,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),e.jsx(Z,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]})}),e.jsx(_,{yaml:c.manifestYAML,defaultOpen:!0})]}):null]})};var gt;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(gt||(gt={}));const mt=[{key:gt.PodName,label:"Pod Name"},{key:gt.Status,label:"Status"},{key:gt.Restarts,label:"Restarts",textAlign:"right"},{key:gt.NodeName,label:"Node Name"},{key:gt.Age,label:"Age",textAlign:"right"},{key:gt.DockerImage,label:"Docker Image",textAlign:"right"}],bt=({isLoading:a,tableRowsMaxHeight:n,pods:i,getExtendedPodInfo:s})=>{const c=o(),{formatTimeAgo:u}=W(),[m,b]=l(null),f=t(()=>i.map(t=>({onClick:()=>b(t),cells:[{key:gt.PodName,rawValue:t.name},{key:gt.Status,rawValue:t.status,component:()=>{return l=t.status,e.jsx(p,{status:K(l),label:l});var l}},{key:gt.Restarts,rawValue:t.restartsCount.toString()},{key:gt.NodeName,rawValue:t.nodeName},{key:gt.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:l}=t;if(!l)return e.jsx(d,{children:"-"});const a=(l?.metricsAcceptedRps??0)+(l?.metricsDroppedRps??0),n=a>0?Math.round((l?.metricsDroppedRps??0)/a*100):0,i=n>0?h.Error:h.Success,o=(l?.exporterSuccessRps??0)+(l?.exporterFailedRps??0),s=o>0?Math.round((l?.exporterFailedRps??0)/o*100):0,c=s>0?h.Error:h.Success;return e.jsxs(r,{$gap:4,children:[e.jsx(g,{text:`Accepted: ${l.metricsAcceptedRps.toLocaleString()}, Dropped: ${l.metricsDroppedRps.toLocaleString()}`,children:e.jsx(p,{status:i,label:`Receiver ${n}%`,leftIcon:i===h.Error?Ae:Pe,useSecondaryTone:!0,invertColors:!0})}),e.jsx(g,{text:`Success: ${l.exporterSuccessRps.toLocaleString()}, Failed: ${l.exporterFailedRps.toLocaleString()}`,children:e.jsx(p,{status:c,label:`Exporter ${s}%`,leftIcon:c===h.Error?Ae:Pe,useSecondaryTone:!0,invertColors:!0})})]})}},{key:gt.Age,rawValue:u(t.creationTimestamp)},{key:gt.DockerImage,rawValue:t.image}]})),[i,c]);return e.jsxs(H,{richTitle:{icon:Se,title:"Pods"},children:[e.jsx(Y,{variant:q.Data,maxHeight:n,isLoading:a,columns:mt,rows:f}),e.jsx(ht,{pod:m,getExtendedPodInfo:s,onClose:()=>b(null)})]})};var ft;!function(e){e.Gateway="gateway",e.Node="node"}(ft||(ft={}));const wt=[{value:ft.Gateway,label:"Gateway"},{value:ft.Node,label:"Node Collector"}],yt=i.div`
119
119
  display: flex;
120
120
  align-items: center;
121
121
  justify-content: space-between;
122
- `,mt=({selectedTab:a,setSelectedTab:l,onClickDownloadDiagnose:o,onClickRefresh:n,loading:s,disabled:i})=>{const c=t(()=>{const e=[];return o&&e.push({id:F(),type:j.Button,buttonProps:{label:"Download Diagnose",leftIcon:Ae,size:E.S,variant:N.Text,onClick:o,disabled:i}}),n&&e.push({id:F(),type:j.Button,buttonProps:{label:"Refresh",leftIcon:ye,size:E.S,variant:N.Text,onClick:n,disabled:i,loading:s}}),e},[o,n,i,s]);return e.createElement(ht,null,e.createElement(r,{$gap:12},e.createElement(r,{$gap:8},e.createElement(Pe,{size:32}),e.createElement(d,{size:u.M,weight:500},"Pipeline Collectors")),e.createElement(te,{options:gt,selected:a,setSelected:l,disabled:i})),e.createElement(ae,{actions:c}))},bt=({isOpen:t,onClose:a,title:l,yaml:o})=>e.createElement(S,{isOpen:t,header:{icon:Te,title:l,onClose:a}},e.createElement(ee,{yaml:o,defaultOpen:!0}));var ft;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(ft||(ft={}));const yt=({richTitle:t,statusCard:l,textCards:o,manifestYaml:n,configMapYaml:s})=>{const[i,c]=a(null);return e.createElement(H,{richTitle:t,actions:[{id:F(),type:j.ButtonDropData,buttonProps:{variant:N.Secondary,size:E.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:ft.ManifestYaml,label:t.title,icon:Re},{id:ft.ConfigMapYaml,label:"ConfigMap",icon:Re}]}}]},e.createElement(r,{$gap:16},e.createElement(le,{...l}),o.map(t=>e.createElement(oe,{key:t.title,...t}))),e.createElement(bt,{isOpen:i===ft.ManifestYaml,onClose:()=>c(null),title:t.title,yaml:n}),e.createElement(bt,{isOpen:i===ft.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:s}))},wt=e=>{switch(e){case ne.Healthy:return"All desired replicas are updated, available, and ready";case ne.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ne.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ne.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ne.Down:return"No available replicas";case ne.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Ct=({tableRowsMaxHeight:n,getGatewayInfo:s,getGatewayPods:i,getNodeCollectorInfo:r,getNodeCollectorPods:c,getExtendedPodInfo:d})=>{const{formatTimeAgo:u}=W(),{isVersionSupported:p,version:h}=se(1.12),[b,f]=a(!1),[y,w]=a(pt.Gateway),[C,v]=a(null),[k,x]=a([]),[$,S]=a(null),[I,D]=a([]),A=o(async()=>{f(!0);try{switch(y){case pt.Gateway:v(await s()??null),x(await i()??[]);break;case pt.Node:S(await r()??null),D(await c()??[])}}catch(e){}f(!1)},[y]);l(()=>{A()},[A]);const P=t(()=>(e=>{switch(e){case pt.Gateway:return"Deployment";case pt.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(y),[y]),T=t(()=>((e,t,a,l)=>{const o={status:m.Disabled,label:"No rollouts yet"};let n=!1,s=null;switch(e){case pt.Gateway:n=t?.rolloutInProgress??!1,s=t?.lastRolloutAt??null;break;case pt.Node:n=a?.rolloutInProgress??!1,s=a?.lastRolloutAt??null;break;default:return o}return n?{status:g.Info,label:"Rollout in progress",rightIcon:ye,useSecondaryTone:!0}:s?{status:m.Disabled,label:`Last Rollout: ${l(s)}`}:o})(y,C,$,u),[C,$,y,u]),R=t(()=>((e,t,a,l)=>{let o=l?g.Info:m.Unknown,n=l?"Loading":ne.Unknown,s=l?"Fetching data...":wt(ne.Unknown);switch(e){case pt.Gateway:o=t?.status?J(t?.status):o,n=t?.status??n,s=t?.status?wt(t.status):s;break;case pt.Node:o=a?.status?J(a?.status):o,n=a?.status??n,s=a?.status?wt(a.status):s}return{status:o,title:n,description:s}})(y,C,$,b),[C,$,y,b]),z=t(()=>((e,t,a,l)=>{switch(e){case pt.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:l},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:l},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:l},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:l}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:l},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:l}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:l},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:l}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:l}]}];case pt.Node:return[{title:"Nodes",cells:[{label:"Desired",value:a?.nodes?.desired.toString()??"-",isLoading:l},{label:"Ready",value:a?.nodes?.ready.toString()??"-",isLoading:l}]},{title:"Requests",cells:[{label:"CPU",value:a?.resources?.requests.cpu??"-",isLoading:l},{label:"Memory",value:a?.resources?.requests.memory??"-",isLoading:l}]},{title:"Limits",cells:[{label:"CPU",value:a?.resources?.limits.cpu??"-",isLoading:l},{label:"Memory",value:a?.resources?.limits.memory??"-",isLoading:l}]},{title:"Docker Image",cells:[{value:a?.imageVersion??"-",isLoading:l}]}];default:return[]}})(y,C,$,b),[C,$,y,b]),N=t(()=>(y===pt.Gateway?C?.manifestYAML:$?.manifestYAML)??"",[C,$,y]),O=t(()=>(y===pt.Gateway?C?.configMapYAML:$?.configMapYAML)??"",[C,$,y]),M=t(()=>y===pt.Gateway?k:I,[k,I,y]);return e.createElement(U,null,e.createElement(mt,{disabled:!p,loading:b,selectedTab:y,setSelectedTab:w,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e.createElement(ie,null,e.createElement(yt,{richTitle:{icon:Te,title:P,badge:T},statusCard:R,textCards:z,manifestYaml:N,configMapYaml:O}),e.createElement(ut,{isLoading:b,tableRowsMaxHeight:n,pods:M,getExtendedPodInfo:d}),!p&&e.createElement(re,{minSupportedVersion:1.12,currentVersion:h||""})))},vt=n.div`
122
+ `,kt=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:i,loading:o,disabled:s})=>{const c=t(()=>{const e=[];return n&&e.push({id:F(),type:E.Button,buttonProps:{label:"Download Diagnose",leftIcon:ze,size:j.S,variant:N.Text,onClick:n,disabled:s}}),i&&e.push({id:F(),type:E.Button,buttonProps:{label:"Refresh",leftIcon:ke,size:j.S,variant:N.Text,onClick:i,disabled:s,loading:o}}),e},[n,i,s,o]);return e.jsxs(yt,{children:[e.jsxs(r,{$gap:12,children:[e.jsxs(r,{$gap:8,children:[e.jsx(Re,{size:32}),e.jsx(d,{size:u.M,weight:500,children:"Pipeline Collectors"})]}),e.jsx(te,{options:wt,selected:l,setSelected:a,disabled:s})]}),e.jsx(le,{actions:c})]})},Ct=({isOpen:t,onClose:l,title:a,yaml:n})=>e.jsx(S,{isOpen:t,header:{icon:Ne,title:a,onClose:l},children:e.jsx(_,{yaml:n,defaultOpen:!0})});var vt;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(vt||(vt={}));const xt=({richTitle:t,statusCard:a,textCards:n,manifestYaml:i,configMapYaml:o})=>{const[s,c]=l(null);return e.jsxs(H,{richTitle:t,actions:[{id:F(),type:E.ButtonDropData,buttonProps:{variant:N.Secondary,size:j.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:vt.ManifestYaml,label:t.title,icon:Oe},{id:vt.ConfigMapYaml,label:"ConfigMap",icon:Oe}]}}],children:[e.jsxs(r,{$gap:16,children:[e.jsx(ae,{...a}),n.map(t=>e.jsx(ne,{...t},t.title))]}),e.jsx(Ct,{isOpen:s===vt.ManifestYaml,onClose:()=>c(null),title:t.title,yaml:i}),e.jsx(Ct,{isOpen:s===vt.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:o})]})},$t=e=>{switch(e){case ie.Healthy:return"All desired replicas are updated, available, and ready";case ie.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ie.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ie.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ie.Down:return"No available replicas";case ie.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},St=({tableRowsMaxHeight:i,getGatewayInfo:o,getGatewayPods:s,getNodeCollectorInfo:r,getNodeCollectorPods:c,getExtendedPodInfo:d})=>{const{formatTimeAgo:u}=W(),{isVersionSupported:p,version:g}=oe(1.12),[b,f]=l(!1),[w,y]=l(ft.Gateway),[k,C]=l(null),[v,x]=l([]),[$,S]=l(null),[I,T]=l([]),D=n(async()=>{f(!0);try{switch(w){case ft.Gateway:C(await o()??null),x(await s()??[]);break;case ft.Node:S(await r()??null),T(await c()??[])}}catch(e){}f(!1)},[w]);a(()=>{D()},[D]);const A=t(()=>(e=>{switch(e){case ft.Gateway:return"Deployment";case ft.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(w),[w]),P=t(()=>((e,t,l,a)=>{const n={status:m.Disabled,label:"No rollouts yet"};let i=!1,o=null;switch(e){case ft.Gateway:i=t?.rolloutInProgress??!1,o=t?.lastRolloutAt??null;break;case ft.Node:i=l?.rolloutInProgress??!1,o=l?.lastRolloutAt??null;break;default:return n}return i?{status:h.Info,label:"Rollout in progress",rightIcon:ke,useSecondaryTone:!0}:o?{status:m.Disabled,label:`Last Rollout: ${a(o)}`}:n})(w,k,$,u),[k,$,w,u]),z=t(()=>((e,t,l,a)=>{let n=a?h.Info:m.Unknown,i=a?"Loading":ie.Unknown,o=a?"Fetching data...":$t(ie.Unknown);switch(e){case ft.Gateway:n=t?.status?K(t?.status):n,i=t?.status??i,o=t?.status?$t(t.status):o;break;case ft.Node:n=l?.status?K(l?.status):n,i=l?.status??i,o=l?.status?$t(l.status):o}return{status:n,title:i,description:o}})(w,k,$,b),[k,$,w,b]),R=t(()=>((e,t,l,a)=>{switch(e){case ft.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:a},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:a},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:a},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:a}]}];case ft.Node:return[{title:"Nodes",cells:[{label:"Desired",value:l?.nodes?.desired.toString()??"-",isLoading:a},{label:"Ready",value:l?.nodes?.ready.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:l?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:l?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:l?.imageVersion??"-",isLoading:a}]}];default:return[]}})(w,k,$,b),[k,$,w,b]),N=t(()=>(w===ft.Gateway?k?.manifestYAML:$?.manifestYAML)??"",[k,$,w]),O=t(()=>(w===ft.Gateway?k?.configMapYAML:$?.configMapYAML)??"",[k,$,w]),V=t(()=>w===ft.Gateway?v:I,[v,I,w]);return e.jsxs(U,{children:[e.jsx(kt,{disabled:!p,loading:b,selectedTab:w,setSelectedTab:y,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e.jsxs(se,{children:[e.jsx(xt,{richTitle:{icon:Ne,title:A,badge:P},statusCard:z,textCards:R,manifestYaml:N,configMapYaml:O}),e.jsx(bt,{isLoading:b,tableRowsMaxHeight:i,pods:V,getExtendedPodInfo:d}),!p&&e.jsx(re,{minSupportedVersion:1.12,currentVersion:g||""})]})]})},It=({value:t,setValue:l,error:a})=>e.jsx(ce,{small:!0,maxWidth:"88px",type:"password",value:t,onChange:e=>l(e.target.value),autoFocus:!0,errorMessage:a}),Tt=({token:t,newToken:l,isLoading:a,isEditing:n,onEdit:i,onCancel:o,onSave:s})=>{const{CopyButton:c}=de();return a?e.jsx(r,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"center",children:e.jsx(T,{title:"Saving...",withGradient:!0})}):n?e.jsxs(r,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"space-between",children:[e.jsx(R,{variant:N.Secondary,size:j.S,leftIcon:xe,onClick:o,disabled:a}),e.jsx(R,{variant:N.Primary,size:j.S,leftIcon:ve,onClick:s,disabled:a||!l})]}):e.jsxs(r,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"space-between",children:[e.jsx(c,{value:t}),e.jsx(Q,{icon:Ve,onClick:i,disabled:a})]})},Dt=({expiresAt:t})=>{const l=new Date(t).toDateString().split(" ").slice(1).join(" "),a=ue(t,0)?h.Error:ue(t,6048e5)?h.Warning:h.Success;return e.jsx(p,{label:l,status:a,invertColors:!0,useSecondaryTone:!0})},At=({tokens:a,updateToken:n})=>{const[i,o]=l(null),[s,r]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=M({newToken:""}),p=t(()=>[{key:"name",label:"Name",noFilter:!0,noSort:!0},{key:"expiresAt",label:"Expires",noFilter:!0,noSort:!0},{key:"token",label:"Token",noFilter:!0,noSort:!0},{key:"actions",label:"Actions",noFilter:!0,noSort:!0}],[]),h=t(()=>a?.map((t,l)=>{const p=i===l,h=s===l;return{cells:[{key:"name",rawValue:t.name},{key:"expiresAt",rawValue:t.expiresAt,component:()=>e.jsx(Dt,{expiresAt:t.expiresAt})},{key:"token",rawValue:`${new Array(15).fill("•").join("")}`,component:p?()=>e.jsx(It,{value:c.newToken,setValue:e=>d("newToken",e.trim())}):void 0},{key:"actions",rawValue:"",component:()=>e.jsx(Tt,{token:t.token,newToken:c.newToken,isLoading:h,isEditing:p,onEdit:()=>o(l),onCancel:()=>(o(null),r(null),void d("newToken","")),onSave:()=>(async e=>{r(e),await n(a?.[e]?.token??"",c.newToken),r(null),o(null),u()})(l)})}]}})||[],[a,s,i,c.newToken]);return e.jsx(H,{richTitle:{icon:Me,title:"Authorization Tokens"},children:e.jsx(Y,{variant:q.Pretty,columns:p,rows:h})})},Pt=i.div`
123
123
  display: flex;
124
124
  align-items: center;
125
125
  justify-content: center;
126
126
  padding: 12px 24px;
127
127
  border-radius: 8px;
128
128
  background-color: ${({theme:e})=>e.v2.colors.silver[800]};
129
- `,kt=({downloadDiagnose:t})=>{const l=s(),{namespaces:o}=ce(),[n,h]=a(null),{formData:m,handleFormChange:b,resetFormData:f}=L({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return e.createElement(H,{richTitle:{icon:ze,title:"Diagnose"}},n?e.createElement(vt,null,e.createElement(D,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:n,withGradient:!0,withVisual:!0,visualIcon:Ae})):e.createElement(i,{$gap:24},e.createElement(d,{size:u.XXS,color:l.v2.colors.silver[200]},"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."),e.createElement(i,{$gap:16},e.createElement(r,{$gap:8},e.createElement(c,{label:"Profiles",value:m.includeProfiles,onChange:e=>b("includeProfiles",e)}),e.createElement(d,{size:u.XXXS,color:l.v2.colors.silver[200]},"Include pprof profiles")),e.createElement(r,{$gap:8},e.createElement(c,{label:"Metrics",value:m.includeMetrics,onChange:e=>b("includeMetrics",e)}),e.createElement(d,{size:u.XXXS,color:l.v2.colors.silver[200]},"Include Prometheus metrics")),e.createElement(r,{$gap:8},e.createElement(c,{label:"Source Workloads",value:m.includeSourceWorkloads,onChange:e=>{b("includeSourceWorkloads",e),e&&b("sourceWorkloadNamespaces",[])}}),e.createElement(d,{size:u.XXXS,color:l.v2.colors.silver[200]},"Include workload and pod manifests for instrumented sources"))),e.createElement(de,{alignX:G.Left,alignY:ue.Bottom,items:o.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:m.sourceWorkloadNamespaces,setSelectedIds:e=>b("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(m.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:N.Secondary,disabled:m.includeSourceWorkloads,leftIcon:m.sourceWorkloadNamespaces.length?()=>e.createElement(p,{label:m.sourceWorkloadNamespaces.length,status:g.Default}):void 0}}),e.createElement(r,{$justifyContent:"flex-end"},e.createElement(z,{label:"Download Diagnose",rightIcon:Ae,variant:N.Primary,onClick:async()=>{h(Date.now()),await t(m),h(null),f()},disabled:null!==n}))))},xt=({fetchDescribeOdigos:t})=>{const{platformType:o,version:n,tier:s}=se(),[i,r]=a(null);return l(()=>{t().then(({data:e})=>r(e?.describeOdigos||null))},[]),e.createElement(H,{richTitle:{icon:Se,title:"General Information"}},e.createElement(Q,{cellsPerRow:2,items:[{id:F(),title:"Odigos Version",label:n},{id:F(),title:`${o.toUpperCase()} Version`,label:i?.kubernetesVersion?.value||"-"},{id:F(),title:"Installation Method",label:i?.installationMethod?.value||"-"},{id:F(),title:"Tier",label:s}]}))},$t=({isOpen:t,onClose:a,fetchDescribeOdigos:l,downloadDiagnose:o})=>e.createElement(S,{isOpen:t,header:{icon:Se,title:"System Overview",onClose:a}},e.createElement(xt,{fetchDescribeOdigos:l}),e.createElement(kt,{downloadDiagnose:o}));export{nt as CentralConnections,Ct as PipelineCollectors,$t as SystemDrawer};
129
+ `,zt=({downloadDiagnose:t})=>{const a=o(),{namespaces:n}=pe(),[i,g]=l(null),{formData:m,handleFormChange:b,resetFormData:f}=M({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return e.jsx(H,{richTitle:{icon:Le,title:"Diagnose"},children:i?e.jsx(Pt,{children:e.jsx(T,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:i,withGradient:!0,withVisual:!0,visualIcon:ze})}):e.jsxs(s,{$gap:24,children:[e.jsx(d,{size:u.XXS,color:a.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e.jsxs(s,{$gap:16,children:[e.jsxs(r,{$gap:8,children:[e.jsx(c,{label:"Profiles",value:m.includeProfiles,onChange:e=>b("includeProfiles",e)}),e.jsx(d,{size:u.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e.jsxs(r,{$gap:8,children:[e.jsx(c,{label:"Metrics",value:m.includeMetrics,onChange:e=>b("includeMetrics",e)}),e.jsx(d,{size:u.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e.jsxs(r,{$gap:8,children:[e.jsx(c,{label:"Source Workloads",value:m.includeSourceWorkloads,onChange:e=>{b("includeSourceWorkloads",e),e&&b("sourceWorkloadNamespaces",[])}}),e.jsx(d,{size:u.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),e.jsx(he,{alignX:G.Left,alignY:ge.Bottom,items:n.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:m.sourceWorkloadNamespaces,setSelectedIds:e=>b("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(m.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:N.Secondary,disabled:m.includeSourceWorkloads,leftIcon:m.sourceWorkloadNamespaces.length?()=>e.jsx(p,{label:m.sourceWorkloadNamespaces.length,status:h.Default}):void 0}}),e.jsx(r,{$justifyContent:"flex-end",children:e.jsx(R,{label:"Download Diagnose",rightIcon:ze,variant:N.Primary,onClick:async()=>{g(Date.now()),await t(m),g(null),f()},disabled:null!==i})})]})})},Rt=({fetchDescribeOdigos:t})=>{const{platformType:n,version:i,tier:o}=oe(),[s,r]=l(null);return a(()=>{t().then(({data:e})=>r(e?.describeOdigos||null))},[]),e.jsx(H,{richTitle:{icon:De,title:"General Information"},children:e.jsx(J,{cellsPerRow:2,items:[{id:F(),title:"Odigos Version",label:i},{id:F(),title:`${n.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:F(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:F(),title:"Tier",label:o}]})})},Nt=({isOpen:t,onClose:l,tokens:a,updateToken:n,fetchDescribeOdigos:i,downloadDiagnose:o})=>e.jsxs(S,{isOpen:t,header:{icon:De,title:"System Overview",onClose:l},children:[e.jsx(Rt,{fetchDescribeOdigos:i}),e.jsx(At,{tokens:a,updateToken:n}),e.jsx(zt,{downloadDiagnose:o})]});export{dt as CentralConnections,St as PipelineCollectors,Nt as SystemDrawer};