@odigos/ui-kit 0.0.181 → 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 (41) hide show
  1. package/CHANGELOG.md +14 -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 +1 -2
  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 -60
  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 -17
  17. package/lib/containers/data-flow-actions-menu/search/search-results/builder.d.ts +1 -1
  18. package/lib/containers/data-flow-actions-menu/styled.d.ts +9 -5
  19. package/lib/containers/source-drawer/describe/index.d.ts +1 -1
  20. package/lib/containers/source-drawer/odigos-health/index.d.ts +1 -2
  21. package/lib/containers/v2.js +21 -21
  22. package/lib/containers.js +122 -122
  23. package/lib/contexts/odigos-context.d.ts +2 -2
  24. package/lib/contexts.js +1 -1
  25. package/lib/functions.js +1 -1
  26. package/lib/hooks/useActionFormData.d.ts +1 -1
  27. package/lib/hooks.js +1 -1
  28. package/lib/icons/auth/okta-icon/index.d.ts +1 -1
  29. package/lib/icons.js +1 -1
  30. package/lib/snippets/add-button/index.d.ts +1 -1
  31. package/lib/snippets.js +1 -1
  32. package/lib/store.js +1 -1
  33. package/lib/theme/animations/index.d.ts +28 -22
  34. package/lib/theme/index.d.ts +3 -12
  35. package/lib/theme.js +1 -1
  36. package/lib/types.js +1 -1
  37. package/lib/visuals.js +1 -1
  38. package/package.json +25 -24
  39. package/lib/chunks/ui-components-93edfedb.js +0 -2297
  40. package/lib/chunks/vendor-0965fadc.js +0 -1
  41. /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 n}from"react";import o,{useTheme as i}from"styled-components";import{F as s,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 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,A as j,v 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,U as _,Y as ee,V as te,W as ae,X as le,Z as ne,_ as oe,$ as ie,a0 as se,a1 as re,a2 as ce,a3 as de,a4 as ue,a5 as pe,a6 as ge,a7 as he}from"../chunks/ui-components-93edfedb.js";import{SourceIcon as me,VSquareIcon as be,SettingsIcon as fe,OdigosLogo as ye,DeleteIcon as we,ConnectionsIcon as ke,RefreshIcon 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"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 We=o(s)`
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
- `,Fe=o.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 n}from"react"
13
13
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
14
14
  overflow-y: auto;
15
15
  overflow-x: hidden;
16
- `,je=o.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 n}from"react"
25
25
  &:hover {
26
26
  background-color: ${({theme:e})=>e.v2.colors.silver[600]};
27
27
  }
28
- `,Ee=({formData:a,handleSourceChange:l,handleSelectAll:n,selectedArea:o,searchText:s,filters:f})=>{const y=i(),{activeNamespace:w,isAll:k,isSome:C}=t(()=>{const e=o.value.clusterId&&o.value.namespaceName?a.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.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,o.value.clusterId,o.value.namespaceName]),v=t(()=>{if(!w)return[];const{clusterId:t}=o.value,{name:a,workloads:n}=w;return n.map(({name:n,selected:o,kind:i})=>{if(s&&!n.toLowerCase().includes(s.toLowerCase()))return null;const h=o||!1;if(f.showOnlySelected&&!h)return null;const m=()=>l({clusterId:t,workloadId:{namespace:a,name:n,kind:i}});return e.createElement(je,{key:`${t}#${a}#${n}#${i}`,onClick:m},e.createElement(r,{$gap:12},e.createElement(c,{value:h,onChange:m}),e.createElement(d,{size:u.XS},n)),e.createElement(p,{label:i,status:g.Info,textSize:u.XXXS,backgroundColor:y.v2.colors.blue[900]}))})},[a,o.value.clusterId,w,s,f]);return e.createElement(We,{$width:"50%"},e.createElement(r,{$padding:"0 12px 0 28px",$gap:12},e.createElement(h,{text:(k?"Unselect":"Select")+" all workloads in the selected namespace"},e.createElement(c,{partiallyChecked:C,value:k,onChange:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!k}),disabled:!v.length})),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XS,nowrap:!0},o.value.clusterId?`${o.value.clusterName} > ${o.value.namespaceName} > Workloads`:"Workloads"),e.createElement(p,{label:v.length,status:m.Unknown}))),e.createElement(Fe,{$borderRadius:"0 16px 16px 0"},v.length?v:e.createElement(b,{title:"Workloads not found",subTitle:"Please select a namespace to view workloads"})))},Ge=({formData:a,handleSourceChange:l,handleSelectAll:n,selectedArea:o,searchText:s,filters:k})=>{const C=i(),{isAll:v,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:n})=>n.map(({name:n,workloads:i,selected:b})=>{if(s&&!n.toLowerCase().includes(s.toLowerCase()))return null;const v=i.filter(({selected:e})=>e).length,x=v>0&&v===i.length,$=v>0&&v<i.length,S=b||!1;if(k.showOnlySelected&&!x&&!$&&!S)return null;const I=o.value.clusterId===t&&o.value.namespaceName===n,T=()=>o.setValue({clusterId:t,clusterName:a,namespaceName:n}),D=e=>{T(),l({clusterId:t,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return e.createElement(je,{key:`${t}#${n}`,$isSelected:I,onClick:T},e.createElement(r,{$gap:12},e.createElement(c,{partiallyChecked:$,value:x,onChange:e=>D({auto:e,all:e})}),e.createElement(d,{size:u.XS},`${a} > ${n}`)),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=>D({auto:e,all:e||void 0})})),e.createElement(r,{$gap:8},e.createElement(d,{variant:w.Span,size:u.XXXS,color:C.v2.colors.silver[200],align:"right"},"Selected"),e.createElement(p,{label:`${v}/${i.length}`,status:I?g.Default:m.Unknown,minWidth:"42px"}))))})),[a,o.value.clusterId,o.value.namespaceName,s,k]);return e.createElement(We,{$width:"50%"},e.createElement(r,{$padding:"0 12px 0 28px",$gap:12},e.createElement(h,{text:(v?"Unselect":"Select")+" all workloads in all namespaces"},e.createElement(c,{partiallyChecked:x,value:v,onChange:()=>n({boolean:!v}),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(Fe,{$borderRadius:"16px 0 0 16px"},$.length?$:e.createElement(b,{title:"Namespaces not found",subTitle:""})))},Ue="75vw",He=o.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
- `,Ye=o.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
- `,qe=o.div`
41
+ `,qe=i.div`
42
42
  display: flex;
43
43
  gap: 12px;
44
44
  padding: 16px;
45
- `,Be=o.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
- `,Xe=o.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
- `,Ke=({onClose:o,snapshots:s,selectedConnectionIds:c,setSelectedConnectionIds:p,persistSources:h})=>{const m=i(),{selectedStreamName:b}=k(),{progress:w,resetProgress:V}=C(),M=t(()=>b||v,[b]),[L,W]=a(""),[F,j]=a(x.Namespace),[E,G]=a({showOnlySelected:!1}),[U,H]=a(!1),[Y,q]=a(!1),[B,X]=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)))(s,c);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId);return a??t})})},[s,c]);const{formDiff:_,isFormDirty:ee}=t(()=>{const e=((e,t,a)=>{const l={};return e.forEach(e=>{e.namespaces.forEach(n=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),i=n.selected||!1,s=i!==o?.selected;if(s&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push({namespace:n.name,selected:i,currentStreamName:a}),i&&(l[e.clusterId]=l[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!s||!i){const t=((e,t,a)=>{const l=[];return t.workloads.forEach(n=>{const o=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==o?.selected&&l.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:a})}),l})(o,n,a);t.length>0&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push(...t))}})}),l})(Q,s.clusters,M);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[Q,s,M]),te=n(({clusterId:e,workloadId:t,selected:a,auto:l})=>{Z(n=>{const o=$(n),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const s=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===s)return o;if(t.kind&&t.name){const e=o[i].namespaces[s].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const l="boolean"==typeof a?a:!o[i].namespaces[s].workloads[e].selected;o[i].namespaces[s].workloads[e].selected=l,l?o[i].namespaces[s].workloads.every(e=>e.selected)&&(o[i].namespaces[s].selected=!0):o[i].namespaces[s].selected=!1}else{const e="boolean"==typeof l?l:!o[i].namespaces[s].selected;o[i].namespaces[s].selected=e,e?o[i].namespaces[s].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof a||a||o[i].namespaces[s].workloads.forEach(e=>{e.selected=!1})}return o})},[]),ae=n(({clusterId:e,namespaceName:t,boolean:a})=>{Z(l=>{const n=$(l);return n.forEach((l,o)=>{e&&l.clusterId!==e||l.namespaces.forEach(({name:e,workloads:l},i)=>{t&&e!==t||(n[o].namespaces[i].selected=a,l.forEach((e,t)=>{n[o].namespaces[i].workloads[t].selected=a}))})}),n})},[]),le=()=>{H(!1),o()};return e.createElement(S,{isOpen:!0,hideOverlay:!Y,width:Ue,header:{icon:me,title:"Manage Sources",onClose:o,onCloseDisabled:Y}},Y?e.createElement(I,{$height:"calc(100vh - 136px)"},e.createElement(Be,null,e.createElement(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:w[D.BulkInstrumenting]?.percentage||0}))):e.createElement(He,null,e.createElement(Ye,null,e.createElement(A,{icon:be,title:"Selected Clusters",badge:{label:c.length}}),e.createElement(P,{width:"300px",value:L,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(qe,null,e.createElement(Ge,{formData:Q,handleSourceChange:te,handleSelectAll:ae,selectedArea:{value:K,setValue:J},searchText:F===x.Namespace?L:"",filters:E}),e.createElement(Ee,{formData:Q,handleSourceChange:te,handleSelectAll:ae,selectedArea:{value:K,setValue:J},searchText:F===x.Source?L:"",filters:E}))),e.createElement(Xe,null,Y?null:B?e.createElement(z,{fullWidth:!0,status:g.Error,message:B}):ee?e.createElement(z,{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(z,{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(R,{fullWidth:!0,variant:N.Secondary,label:"Cancel",onClick:()=>ee?H(!0):le(),disabled:!ee||Y})),e.createElement("div",{style:{width:"150px"}},e.createElement(R,{fullWidth:!0,variant:N.Primary,label:"Save",onClick:async()=>{q(!0);const e=await h(_);V(D.BulkInstrumenting),q(!1),e?.error?X(e.error):(p([]),o())},disabled:!ee||Y})))),e.createElement(O,{isOpen:U,onClose:()=>H(!1),onApprove:le}))},Je="75vw",Qe=1.16,Ze=o.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
- `,_e=o.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
- `,et=o.div`
68
+ `,et=i.div`
69
69
  display: flex;
70
70
  gap: 12px;
71
71
  padding: 16px;
72
- `,tt=o(s)`
72
+ `,tt=i(s)`
73
73
  width: ${({$width:e})=>e};
74
74
  gap: 12px;
75
75
  justify-content: space-between;
76
- `,at=o.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 n}from"react"
84
84
  background-color: ${({theme:e})=>e.v2.colors.silver[900]};
85
85
  overflow-y: auto;
86
86
  overflow-x: hidden;
87
- `,lt=o.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 n}from"react"
95
95
  &:hover {
96
96
  background-color: ${({theme:e})=>e.v2.colors.silver[600]};
97
97
  }
98
- `,nt=o.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
- `,ot=({onClose:n,connections:o,selectedConnectionIds:s,setSelectedConnectionIds:h,getEffectiveConfig:w,onApply:k})=>{const C=i(),[v,x]=a(""),[$,I]=a({showOnlySelected:!1}),D=t(()=>{const e=[],t=[];for(const a of o){const l=V(a.odigosVersion,Qe),n=a.status===g.Success,o=s.includes(a.id),i=!$.showOnlySelected||o,r=!v||a.name.toLowerCase().includes(v.toLowerCase());l&&n&&i&&r?e.push(a):o&&t.push(a.id)}return t.length>0&&h(e=>e.filter(e=>!t.includes(e))),e},[o.length,s.length,v,$]),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),[B,X]=a(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]);l(()=>{1===s.length?(async e=>{if(Y)return;q(!0);const t=await w(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.createElement(S,{isOpen:!0,hideOverlay:!0,width:Je,header:{icon:fe,title:"Cluster Configuration",onClose:n}},e.createElement(Ze,null,e.createElement(_e,null,e.createElement(A,{icon:be,title:"Selected Clusters",badge:{label:s.length}}),e.createElement(P,{width:"300px",placeholder:"Search by cluster name",value:v,onChange:x}),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XXXS,color:C.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(et,null,e.createElement(tt,{$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:D.length,status:m.Unknown})),e.createElement(r,{$gap:8},e.createElement(d,{size:u.XXXS,color:C.v2.colors.silver[200],align:"right"},"Selected clusters"),e.createElement(p,{label:`${s.length}/${D.length}`,status:m.Unknown}))),e.createElement(at,{$borderRadius:"16px 0 0 16px"},D.length?D.map(t=>e.createElement(lt,{key:t.id,onClick:()=>W(t.id)},e.createElement(c,{value:s.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(tt,{$width:"60%"},e.createElement(r,{$padding:"0 12px"},e.createElement(d,{size:u.XS},"Configurations")),e.createElement(at,{$borderRadius:"0 16px 16px 0",$gap:12},Y?e.createElement(L,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(nt,null,Y?e.createElement(T,{icon:ye,title:"Fetching Configuration...",titleSize:u.XXS,withGradient:!0}):E?e.createElement(T,{icon:ye,title:"Applying Configurations...",titleSize:u.XXS,withGradient:!0}):U?e.createElement(z,{fullWidth:!0,status:g.Error,message:U}):_?e.createElement(z,{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(z,{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(R,{fullWidth:!0,variant:N.Secondary,label:"Cancel",onClick:()=>_?j(!0):te(),disabled:E})),e.createElement("div",{style:{width:"150px"}},e.createElement(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):(h([]),n())},disabled:!_||E})))),e.createElement(O,{isOpen:F,onClose:()=>j(!1),onApprove:te}))};var it,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"}(it||(it={})),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 a=e.find(e=>e.key===st.Id)?.rawValue;return t(a?.toString()||"")},dt=({tableRowsMaxHeight:o,connections:s,getConnections:r,onClickConnection:c,deleteConnection:d,getEffectiveConfig:u,applyConfigurations:h,getAllClusterSnapshots:b,persistSources:f})=>{const y=i(),{formatTimeAgo:w}=W(),[k,C]=a(!1),[v,x]=a(s||[]),[$,S]=a(!1),[I,T]=a(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)}},[]);l(()=>{v.length||D()},[v.length,D]),l(()=>{I||A()},[I,A]);const[P,z]=a(""),[R,O]=a(null),[M,L]=a([]),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 a=t===g.Success?"Connection live":"Connection lost",l=t===g.Success?ve:xe;return e.createElement(p,{status:t,label:a,leftIcon:l})})(t.status)},{key:st.OdigosVersion,rawValue:t.odigosVersion},{key:st.ConnectedSince,rawValue:t.connectedAt?w(t.connectedAt):"-"},{key:st.LastActivity,rawValue:t.lastSeenAt?w(t.lastSeenAt):"-"}],onClick:t.status===g.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!==g.Success||R===it.BulkConfig&&!V(t.odigosVersion,Qe)})),[v,M,P,R]),J=n(({cells:e})=>{if(!(e=>e.find(e=>e.key===st.Status)?.rawValue===g.Success)(e))return[{id:F(),label:"Delete Connection",rightIcon:we,onClick:()=>{ct(e,e=>{L([e]),O(it.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(it.BulkSource)})}}:null,u&&h?{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(it.BulkConfig)})}}:null]},[v.length,I]),Q=t(()=>[{id:F(),type:j.Button,buttonProps:{variant:N.Text,size:E.S,label:"Cancel",onClick:()=>L([])}},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:it.BulkSource,label:"Add Source",icon:me}]}}:null,u&&h?{id:F(),type:j.Button,buttonProps:{variant:N.Primary,size:E.S,label:"Manage Configurations",rightIcon:fe,onClick:()=>O(it.BulkConfig)}}:null],[I]);return e.createElement(U,null,e.createElement(H,{richTitle:{icon:ke,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:j.Button,buttonProps:{variant:N.Secondary,size:E.S,leftIcon:Ce,onClick:async()=>{await D(),await A()},disabled:k||$}}]},e.createElement(Y,{variant:q.Pretty,maxHeight:o,headerBackgroundColor:y.v2.colors.silver[1e3],isLoading:k,withCheckboxes:!0,columns:rt,rows:K,rowActionsPushRightPosition:R?`calc(${R===it.BulkConfig?Je:Ue} - 24px)`:void 0,getRowActions:J}),R===it.BulkConfig&&u&&h&&e.createElement(ot,{onClose:()=>O(null),connections:v,selectedConnectionIds:M,setSelectedConnectionIds:L,getEffectiveConfig:u,onApply:h}),R===it.BulkSource&&I&&f&&e.createElement(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.createElement(B,{target:"connection",isOpen:R===it.Delete,onClose:()=>{L([]),O(null)},onApprove:async()=>{const e=M[0];e&&(await d(e),await D())}}),e.createElement(X,{isOpen:!!M.length&&!R,richTitle:{icon:be,title:"Selected Clusters",badge:{label:M.length}},actions:Q})))},ut=o.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 n}from"react"
113
113
  &:hover {
114
114
  background: ${({theme:e})=>e.v2.colors.silver[700]};
115
115
  }
116
- `,pt=o.div`
117
- animation-name: ${K.animations.fade.in};
118
- `,gt=({pod:n,getExtendedPodInfo:o,onClose:i})=>{const{formatTimeAgo:r}=W(),[c,u]=a(null),[p,h]=a(!1);l(()=>{n?o(n.namespace,n.name).then(e=>u(e??null)):(u(null),h(!1))},[n]);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?be:$e,label:e.ready?"True":"False",invertColors:!0}},{id:F(),title:"Started",badge:{status:e.started?g.Success:g.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.createElement(S,{isOpen:!!n,header:{icon:Se,title:"Pod Information",onClose:i}},c?null:e.createElement(I,null,e.createElement(L,null)),c?e.createElement(e.Fragment,null,e.createElement(H,{richTitle:{icon:Se,title:c.name,withCopy:!0}},e.createElement(s,{$gap:24},e.createElement(Q,{cellsPerRow:2,items:m}),b.length>0&&e.createElement(s,{$gap:12},e.createElement(ut,{onClick:()=>h(e=>!e)},e.createElement(d,null,"Containers Overview"),e.createElement(Z,{icon:p?Ie:Te})),p&&b.map(({id:t,items:a})=>e.createElement(pt,{key:t},e.createElement(Q,{cellsPerRow:2,items:a})))))),e.createElement(H,{richTitle:{icon:De,title:"Kubectl Commands"}},e.createElement(s,{$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 ht;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(ht||(ht={}));const mt=[{key:ht.PodName,label:"Pod Name"},{key:ht.Status,label:"Status"},{key:ht.Restarts,label:"Restarts",textAlign:"right"},{key:ht.NodeName,label:"Node Name"},{key:ht.Age,label:"Age",textAlign:"right"},{key:ht.DockerImage,label:"Docker Image",textAlign:"right"}],bt=({isLoading:l,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:s})=>{const c=i(),{formatTimeAgo:u}=W(),[m,b]=a(null),f=t(()=>o.map(t=>({onClick:()=>b(t),cells:[{key:ht.PodName,rawValue:t.name},{key:ht.Status,rawValue:t.status,component:()=>{return a=t.status,e.createElement(p,{status:J(a),label:a});var a}},{key:ht.Restarts,rawValue:t.restartsCount.toString()},{key:ht.NodeName,rawValue:t.nodeName},{key:ht.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=t;if(!a)return e.createElement(d,null,"-");const l=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),n=l>0?Math.round((a?.metricsDroppedRps??0)/l*100):0,o=n>0?g.Error:g.Success,i=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),s=i>0?Math.round((a?.exporterFailedRps??0)/i*100):0,c=s>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:o,label:`Receiver ${n}%`,leftIcon:o===g.Error?Ae:Pe,useSecondaryTone:!0,invertColors:!0})),e.createElement(h,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`},e.createElement(p,{status:c,label:`Exporter ${s}%`,leftIcon:c===g.Error?Ae:Pe,useSecondaryTone:!0,invertColors:!0})))}},{key:ht.Age,rawValue:u(t.creationTimestamp)},{key:ht.DockerImage,rawValue:t.image}]})),[o,c]);return e.createElement(H,{richTitle:{icon:Se,title:"Pods"}},e.createElement(Y,{variant:q.Data,maxHeight:n,isLoading:l,columns:mt,rows:f}),e.createElement(gt,{pod:m,getExtendedPodInfo:s,onClose:()=>b(null)}))};var ft;!function(e){e.Gateway="gateway",e.Node="node"}(ft||(ft={}));const yt=[{value:ft.Gateway,label:"Gateway"},{value:ft.Node,label:"Node Collector"}],wt=o.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
- `,kt=({selectedTab:a,setSelectedTab:l,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:s})=>{const c=t(()=>{const e=[];return n&&e.push({id:F(),type:j.Button,buttonProps:{label:"Download Diagnose",leftIcon:ze,size:E.S,variant:N.Text,onClick:n,disabled:s}}),o&&e.push({id:F(),type:j.Button,buttonProps:{label:"Refresh",leftIcon:Ce,size:E.S,variant:N.Text,onClick:o,disabled:s,loading:i}}),e},[n,o,s,i]);return e.createElement(wt,null,e.createElement(r,{$gap:12},e.createElement(r,{$gap:8},e.createElement(Re,{size:32}),e.createElement(d,{size:u.M,weight:500},"Pipeline Collectors")),e.createElement(te,{options:yt,selected:a,setSelected:l,disabled:s})),e.createElement(ae,{actions:c}))},Ct=({isOpen:t,onClose:a,title:l,yaml:n})=>e.createElement(S,{isOpen:t,header:{icon:Ne,title:l,onClose:a}},e.createElement(ee,{yaml:n,defaultOpen:!0}));var vt;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(vt||(vt={}));const xt=({richTitle:t,statusCard:l,textCards:n,manifestYaml:o,configMapYaml:i})=>{const[s,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:vt.ManifestYaml,label:t.title,icon:Oe},{id:vt.ConfigMapYaml,label:"ConfigMap",icon:Oe}]}}]},e.createElement(r,{$gap:16},e.createElement(le,{...l}),n.map(t=>e.createElement(ne,{key:t.title,...t}))),e.createElement(Ct,{isOpen:s===vt.ManifestYaml,onClose:()=>c(null),title:t.title,yaml:o}),e.createElement(Ct,{isOpen:s===vt.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:i}))},$t=e=>{switch(e){case oe.Healthy:return"All desired replicas are updated, available, and ready";case oe.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case oe.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case oe.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case oe.Down:return"No available replicas";case oe.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},St=({tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:r,getNodeCollectorPods:c,getExtendedPodInfo:d})=>{const{formatTimeAgo:u}=W(),{isVersionSupported:p,version:h}=ie(1.12),[b,f]=a(!1),[y,w]=a(ft.Gateway),[k,C]=a(null),[v,x]=a([]),[$,S]=a(null),[I,T]=a([]),D=n(async()=>{f(!0);try{switch(y){case ft.Gateway:C(await i()??null),x(await s()??[]);break;case ft.Node:S(await r()??null),T(await c()??[])}}catch(e){}f(!1)},[y]);l(()=>{D()},[D]);const A=t(()=>(e=>{switch(e){case ft.Gateway:return"Deployment";case ft.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(y),[y]),P=t(()=>((e,t,a,l)=>{const n={status:m.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case ft.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case ft.Node:o=a?.rolloutInProgress??!1,i=a?.lastRolloutAt??null;break;default:return n}return o?{status:g.Info,label:"Rollout in progress",rightIcon:Ce,useSecondaryTone:!0}:i?{status:m.Disabled,label:`Last Rollout: ${l(i)}`}:n})(y,k,$,u),[k,$,y,u]),z=t(()=>((e,t,a,l)=>{let n=l?g.Info:m.Unknown,o=l?"Loading":oe.Unknown,i=l?"Fetching data...":$t(oe.Unknown);switch(e){case ft.Gateway:n=t?.status?J(t?.status):n,o=t?.status??o,i=t?.status?$t(t.status):i;break;case ft.Node:n=a?.status?J(a?.status):n,o=a?.status??o,i=a?.status?$t(a.status):i}return{status:n,title:o,description:i}})(y,k,$,b),[k,$,y,b]),R=t(()=>((e,t,a,l)=>{switch(e){case ft.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 ft.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,k,$,b),[k,$,y,b]),N=t(()=>(y===ft.Gateway?k?.manifestYAML:$?.manifestYAML)??"",[k,$,y]),O=t(()=>(y===ft.Gateway?k?.configMapYAML:$?.configMapYAML)??"",[k,$,y]),V=t(()=>y===ft.Gateway?v:I,[v,I,y]);return e.createElement(U,null,e.createElement(kt,{disabled:!p,loading:b,selectedTab:y,setSelectedTab:w,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e.createElement(se,null,e.createElement(xt,{richTitle:{icon:Ne,title:A,badge:P},statusCard:z,textCards:R,manifestYaml:N,configMapYaml:O}),e.createElement(bt,{isLoading:b,tableRowsMaxHeight:o,pods:V,getExtendedPodInfo:d}),!p&&e.createElement(re,{minSupportedVersion:1.12,currentVersion:h||""})))},It=({value:t,setValue:a,error:l})=>e.createElement(ce,{small:!0,maxWidth:"88px",type:"password",value:t,onChange:e=>a(e.target.value),autoFocus:!0,errorMessage:l}),Tt=({token:t,newToken:a,isLoading:l,isEditing:n,onEdit:o,onCancel:i,onSave:s})=>{const{CopyButton:c}=de();return l?e.createElement(r,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"center"},e.createElement(T,{title:"Saving...",withGradient:!0})):n?e.createElement(r,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"space-between"},e.createElement(R,{variant:N.Secondary,size:E.S,leftIcon:xe,onClick:i,disabled:l}),e.createElement(R,{variant:N.Primary,size:E.S,leftIcon:ve,onClick:s,disabled:l||!a})):e.createElement(r,{$width:"70px",$height:"32px",$alignItems:"center",$justifyContent:"space-between"},e.createElement(c,{value:t}),e.createElement(Z,{icon:Ve,onClick:o,disabled:l}))},Dt=({expiresAt:t})=>{const a=new Date(t).toDateString().split(" ").slice(1).join(" "),l=ue(t,0)?g.Error:ue(t,6048e5)?g.Warning:g.Success;return e.createElement(p,{label:a,status:l,invertColors:!0,useSecondaryTone:!0})},At=({tokens:l,updateToken:n})=>{const[o,i]=a(null),[s,r]=a(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}],[]),g=t(()=>l?.map((t,a)=>{const p=o===a,g=s===a;return{cells:[{key:"name",rawValue:t.name},{key:"expiresAt",rawValue:t.expiresAt,component:()=>e.createElement(Dt,{expiresAt:t.expiresAt})},{key:"token",rawValue:`${new Array(15).fill("•").join("")}`,component:p?()=>e.createElement(It,{value:c.newToken,setValue:e=>d("newToken",e.trim())}):void 0},{key:"actions",rawValue:"",component:()=>e.createElement(Tt,{token:t.token,newToken:c.newToken,isLoading:g,isEditing:p,onEdit:()=>i(a),onCancel:()=>(i(null),r(null),void d("newToken","")),onSave:()=>(async e=>{r(e),await n(l?.[e]?.token??"",c.newToken),r(null),i(null),u()})(a)})}]}})||[],[l,s,o,c.newToken]);return e.createElement(H,{richTitle:{icon:Me,title:"Authorization Tokens"}},e.createElement(Y,{variant:q.Pretty,columns:p,rows:g}))},Pt=o.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
- `,zt=({downloadDiagnose:t})=>{const l=i(),{namespaces:n}=pe(),[o,h]=a(null),{formData:m,handleFormChange:b,resetFormData:f}=M({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return e.createElement(H,{richTitle:{icon:Le,title:"Diagnose"}},o?e.createElement(Pt,null,e.createElement(T,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:o,withGradient:!0,withVisual:!0,visualIcon:ze})):e.createElement(s,{$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(s,{$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(ge,{alignX:G.Left,alignY:he.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.createElement(p,{label:m.sourceWorkloadNamespaces.length,status:g.Default}):void 0}}),e.createElement(r,{$justifyContent:"flex-end"},e.createElement(R,{label:"Download Diagnose",rightIcon:ze,variant:N.Primary,onClick:async()=>{h(Date.now()),await t(m),h(null),f()},disabled:null!==o}))))},Rt=({fetchDescribeOdigos:t})=>{const{platformType:n,version:o,tier:i}=ie(),[s,r]=a(null);return l(()=>{t().then(({data:e})=>r(e?.describeOdigos||null))},[]),e.createElement(H,{richTitle:{icon:De,title:"General Information"}},e.createElement(Q,{cellsPerRow:2,items:[{id:F(),title:"Odigos Version",label:o},{id:F(),title:`${n.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:F(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:F(),title:"Tier",label:i}]}))},Nt=({isOpen:t,onClose:a,tokens:l,updateToken:n,fetchDescribeOdigos:o,downloadDiagnose:i})=>e.createElement(S,{isOpen:t,header:{icon:De,title:"System Overview",onClose:a}},e.createElement(Rt,{fetchDescribeOdigos:o}),e.createElement(At,{tokens:l,updateToken:n}),e.createElement(zt,{downloadDiagnose:i}));export{dt as CentralConnections,St as PipelineCollectors,Nt 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};