@odigos/ui-kit 0.0.228 → 0.0.229

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.229](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.228...ui-kit-v0.0.229) (2026-05-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * remove releaseProfiling prop ([#848](https://github.com/odigos-io/ui-kit/issues/848)) ([17f2729](https://github.com/odigos-io/ui-kit/commit/17f2729ae374c562e3208db828a68038ac9da88d))
9
+
3
10
  ## [0.0.228](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.227...ui-kit-v0.0.228) (2026-05-04)
4
11
 
5
12
 
@@ -17,7 +17,6 @@ interface SourceDrawerProps {
17
17
  profilingEnabled?: boolean;
18
18
  fetchProfilingSlots?: ProfilingProps['fetchProfilingSlots'];
19
19
  enableProfiling?: ProfilingProps['enableProfiling'];
20
- releaseProfiling?: ProfilingProps['releaseProfiling'];
21
20
  fetchSourceProfiling?: ProfilingProps['fetchSourceProfiling'];
22
21
  }
23
22
  declare const SourceDrawer: FC<SourceDrawerProps>;
@@ -1,10 +1,5 @@
1
1
  import { type FC } from 'react';
2
- import { type Source } from '@/types';
3
- interface SourceIdentifier {
4
- namespace: string;
5
- kind: string;
6
- name: string;
7
- }
2
+ import { type WorkloadId, type Source } from '@/types';
8
3
  interface ProfilingSlots {
9
4
  activeKeys: string[];
10
5
  keysWithData: string[];
@@ -25,10 +20,9 @@ interface EnableOrReleaseProfilingResult {
25
20
  }
26
21
  export interface ProfilingProps {
27
22
  source: Source;
23
+ enableProfiling: (source: WorkloadId) => Promise<EnableOrReleaseProfilingResult | undefined>;
28
24
  fetchProfilingSlots: () => Promise<ProfilingSlots | undefined>;
29
- enableProfiling: (source: SourceIdentifier) => Promise<EnableOrReleaseProfilingResult | undefined>;
30
- releaseProfiling: (source: SourceIdentifier) => Promise<EnableOrReleaseProfilingResult | undefined>;
31
- fetchSourceProfiling: (source: SourceIdentifier) => Promise<SourceProfilingResult | undefined>;
25
+ fetchSourceProfiling: (source: WorkloadId) => Promise<SourceProfilingResult | undefined>;
32
26
  /** Forwarded from the inner FlameGraphCanvas; lets the embedding container (e.g. SourceDrawer) react to fullscreen toggles. */
33
27
  onFlameFullscreenChange?: (isFullscreen: boolean) => void;
34
28
  }
package/lib/containers.js CHANGED
@@ -556,7 +556,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState
556
556
  flex-shrink: 0;
557
557
  `,ls=h.div`
558
558
  padding: 12px;
559
- `;function ss(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const cs=({source:n,fetchProfilingSlots:r,enableProfiling:s,releaseProfiling:u,fetchSourceProfiling:p,onFlameFullscreenChange:h})=>{const m=g(),f=c(()=>({namespace:n.namespace,kind:n.kind,name:n.name}),[n.namespace,n.kind,n.name]),[v,y]=i(!0),[b,S]=i(null),[x,C]=i(null),[w,k]=i(0),[T,E]=i(Zl.Both),[$,N]=i(""),D=l(null),I=d(async()=>{try{const e=[r()];v&&e.push(p(f));const[t,n]=await Promise.all(e);t&&S(t),n?.profileJson&&C(n.profileJson)}finally{k(e=>e+1)}},[r,p,f]);o(()=>{let e=!1;return(async()=>{await s(f),e||(await I(),e||(D.current=setInterval(I,3e3)))})(),()=>{e=!0,D.current&&clearInterval(D.current),u(f)}},[s,u,I,f]);const A=c(()=>function(e){if(!e?.trim())return null;try{const t=JSON.parse(e),n=t.flamebearer;return!n?.names?.length||!Array.isArray(n.levels)||"number"!=typeof n.numTicks||n.numTicks<=0?null:{flamebearer:n,units:t.metadata?.units}}catch{return null}}(x),[x]),R=c(()=>A?function(e){const t=new Map;for(let n=0;n<e.levels.length;n++){const i=e.levels[n];for(let n=0;n+3<i.length;n+=4){const o=i[n+1],a=i[n+2],r=Ll(e,i[n+3]);if(!r)continue;const l=t.get(r);(!l||o>l.total)&&t.set(r,{self:a,total:o})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)}(A.flamebearer):[],[A]),M=c(()=>{const e=$.trim().toLowerCase();return e?R.filter(t=>t.name.toLowerCase().includes(e)):R},[R,$]),F=T===Zl.Table||T===Zl.Both,L=T===Zl.Flame||T===Zl.Both,P=F&&L;return w<2?t(Re,{$height:"70vh",children:t(Cn,{withSpinner:!0})}):e(es,{$gap:0,$width:"100%",children:[e(ts,{children:[t(be,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:t(ns,{children:t(mn,{size:gn.S,weight:500,color:m.v2.colors.white[500],nowrap:!0,children:"CPU Profiling"})})}),e(O,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(wn,{value:$,onChange:N,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:m.v2.colors.silver[900],emphasizeBackgroundColor:m.v2.colors.silver[800]})}),t(bn,{size:xn.S,variant:Sn.Filled,options:[{value:Zl.Table,label:"Top table"},{value:Zl.Flame,label:"Flame graph"},{value:Zl.Both,label:"Both"}],selected:T,setSelected:E}),t(fn,v?{variant:yn.Secondary,size:vn.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>t(Ii,{...e,size:8,fill:m.v2.colors.green[500]})}:{variant:yn.Secondary,size:vn.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(Ii,{...e,size:8,fill:m.v2.colors.red[500]})})]})]}),t(is,{$gap:F&&L?16:0,children:A?e(a,{children:[F&&e(os,{$splitWithFlame:P,children:[t(rs,{$justifyContent:"flex-end",children:t(fn,{variant:yn.Secondary,size:vn.S,label:"Download snapshot",rightIcon:Ai,onClick:()=>{if(!x)return;const e=new Blob([x],{type:"application/json"}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=`cpu-profile-${n.namespace}-${n.kind}-${n.name}.json`,i.click(),URL.revokeObjectURL(t)},disabled:!x})}),t(Gl,{rows:M,languages:n.detectedLanguages||n.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??"")})]}),L&&e(as,{$splitWithTable:P,children:[e(rs,{$justifyContent:"space-between",children:[t(Tn,{label:A?`Total in view ${Pl(A.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:m.v2.colors.silver[750],textColor:m.v2.colors.silver[200],textSize:gn.XXS}),e(O,{$gap:12,children:[!v&&t(fn,{variant:yn.Secondary,size:vn.S,label:"Refresh",leftIcon:li,onClick:I}),t(En,{label:"Auto refresh",labelAlign:Nn.Left,size:$n.S,value:v,onChange:y})]})]}),t(Ql,{flamebearer:A.flamebearer,maxRowPx:24,searchQuery:$,minHostHeight:280,onFullscreenChange:h},T)]})]}):t(Re,{children:t(kn,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),b&&t(ls,{children:t(mn,{size:gn.XXXS,color:m.v2.colors.silver[300],children:`${b.activeKeys.length} / ${b.maxSlots} profiling slots · ${ss(b.totalBytesUsed)} / ${ss(b.maxTotalBytesBudget)} budget · TTL ${b.slotTtlSeconds}s`})})]})},ds=(e,t)=>{const{name:n,kind:i,namespace:o}=e,a=[{title:f.KIND,value:i},{title:f.NAME,value:n,tooltip:"Resource name"}];return t||(a.unshift({title:f.NAMESPACE,value:o}),a.push({type:v.Divider}),a.push({type:v.CopyText,value:`kubectl get ${i} ${n} -n ${o}`.toLowerCase()})),a},us=h.div`
559
+ `;function ss(e){return e>=1073741824?`${(e/1073741824).toFixed(1)} GiB`:e>=1048576?`${(e/1048576).toFixed(1)} MiB`:e>=1024?`${(e/1024).toFixed(1)} KiB`:`${e} B`}const cs=({source:n,fetchProfilingSlots:r,enableProfiling:s,fetchSourceProfiling:u,onFlameFullscreenChange:p})=>{const h=g(),m=c(()=>({namespace:n.namespace,kind:n.kind,name:n.name}),[n.namespace,n.kind,n.name]),[f,v]=i(!0),[y,b]=i(null),[S,x]=i(null),[C,w]=i(0),[k,T]=i(Zl.Both),[E,$]=i(""),N=l(null),D=d(async()=>{try{const e=[r()];f&&e.push(u(m));const[t,n]=await Promise.all(e);t&&b(t),n?.profileJson&&x(n.profileJson)}finally{w(e=>e+1)}},[r,u,m]);o(()=>{let e=!1;return(async()=>{await s(m),e||(await D(),e||(N.current=setInterval(D,3e3)))})(),()=>{e=!0,N.current&&clearInterval(N.current)}},[s,D,m]);const I=c(()=>function(e){if(!e?.trim())return null;try{const t=JSON.parse(e),n=t.flamebearer;return!n?.names?.length||!Array.isArray(n.levels)||"number"!=typeof n.numTicks||n.numTicks<=0?null:{flamebearer:n,units:t.metadata?.units}}catch{return null}}(S),[S]),A=c(()=>I?function(e){const t=new Map;for(let n=0;n<e.levels.length;n++){const i=e.levels[n];for(let n=0;n+3<i.length;n+=4){const o=i[n+1],a=i[n+2],r=Ll(e,i[n+3]);if(!r)continue;const l=t.get(r);(!l||o>l.total)&&t.set(r,{self:a,total:o})}}return[...t.entries()].map(([e,t])=>({name:e,self:t.self,total:t.total})).sort((e,t)=>t.self-e.self)}(I.flamebearer):[],[I]),R=c(()=>{const e=E.trim().toLowerCase();return e?A.filter(t=>t.name.toLowerCase().includes(e)):A},[A,E]),M=k===Zl.Table||k===Zl.Both,F=k===Zl.Flame||k===Zl.Both,L=M&&F;return C<2?t(Re,{$height:"70vh",children:t(Cn,{withSpinner:!0})}):e(es,{$gap:0,$width:"100%",children:[e(ts,{children:[t(be,{text:"Live CPU profile collected from the workload agent. Search symbols, switch between the table and flame graph, or download a JSON snapshot.",withIcon:!0,children:t(ns,{children:t(mn,{size:gn.S,weight:500,color:h.v2.colors.white[500],nowrap:!0,children:"CPU Profiling"})})}),e(O,{style:{flex:1,minWidth:200,gap:10,alignItems:"center",flexWrap:"wrap"},children:[t("div",{style:{flex:"1 1 220px",minWidth:180},children:t(wn,{value:E,onChange:$,placeholder:"Search by symbol name",width:"100%",idleBackgroundColor:h.v2.colors.silver[900],emphasizeBackgroundColor:h.v2.colors.silver[800]})}),t(bn,{size:xn.S,variant:Sn.Filled,options:[{value:Zl.Table,label:"Top table"},{value:Zl.Flame,label:"Flame graph"},{value:Zl.Both,label:"Both"}],selected:k,setSelected:T}),t(fn,f?{variant:yn.Secondary,size:vn.S,label:"Live",tooltip:"Odigos profiler works in-memory and doesn't store any data on disk, to keep minimum memory footprint we store only last 10 minutes of data on demand",leftIcon:e=>t(Ii,{...e,size:8,fill:h.v2.colors.green[500]})}:{variant:yn.Secondary,size:vn.S,label:"Paused",tooltip:"Odigos profiler is still collecting data, but the UI is not updating in real time",leftIcon:e=>t(Ii,{...e,size:8,fill:h.v2.colors.red[500]})})]})]}),t(is,{$gap:M&&F?16:0,children:I?e(a,{children:[M&&e(os,{$splitWithFlame:L,children:[t(rs,{$justifyContent:"flex-end",children:t(fn,{variant:yn.Secondary,size:vn.S,label:"Download snapshot",rightIcon:Ai,onClick:()=>{if(!S)return;const e=new Blob([S],{type:"application/json"}),t=URL.createObjectURL(e),i=document.createElement("a");i.href=t,i.download=`cpu-profile-${n.namespace}-${n.kind}-${n.name}.json`,i.click(),URL.revokeObjectURL(t)},disabled:!S})}),t(Gl,{rows:R,languages:n.detectedLanguages||n.containers?.map(e=>e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language??"")})]}),F&&e(as,{$splitWithTable:L,children:[e(rs,{$justifyContent:"space-between",children:[t(Tn,{label:I?`Total in view ${Pl(I.flamebearer.numTicks)}`:"No profile sample yet",backgroundColor:h.v2.colors.silver[750],textColor:h.v2.colors.silver[200],textSize:gn.XXS}),e(O,{$gap:12,children:[!f&&t(fn,{variant:yn.Secondary,size:vn.S,label:"Refresh",leftIcon:li,onClick:D}),t(En,{label:"Auto refresh",labelAlign:Nn.Left,size:$n.S,value:f,onChange:v})]})]}),t(Ql,{flamebearer:I.flamebearer,maxRowPx:24,searchQuery:E,minHostHeight:280,onFullscreenChange:p},k)]})]}):t(Re,{children:t(kn,{title:"No profile samples yet",subTitle:"Dynamically collecting profiling samples — keep this tab open while the agent sends OTLP profiles."})})}),y&&t(ls,{children:t(mn,{size:gn.XXXS,color:h.v2.colors.silver[300],children:`${y.activeKeys.length} / ${y.maxSlots} profiling slots · ${ss(y.totalBytesUsed)} / ${ss(y.maxTotalBytesBudget)} budget · TTL ${y.slotTtlSeconds}s`})})]})},ds=(e,t)=>{const{name:n,kind:i,namespace:o}=e,a=[{title:f.KIND,value:i},{title:f.NAME,value:n,tooltip:"Resource name"}];return t||(a.unshift({title:f.NAMESPACE,value:o}),a.push({type:v.Divider}),a.push({type:v.CopyText,value:`kubectl get ${i} ${n} -n ${o}`.toLowerCase()})),a},us=h.div`
560
560
  display: flex;
561
561
  flex-direction: column;
562
562
  gap: 24px;
@@ -586,7 +586,7 @@ import{jsxs as e,jsx as t,Fragment as n}from"react/jsx-runtime";import{useState
586
586
  display: flex;
587
587
  flex-direction: column;
588
588
  gap: 12px;
589
- `;var Ds;!function(e){e.Workload="Workload",e.Pod="Pod"}(Ds||(Ds={}));const Is=({persistSources:a,updateSource:r,restartWorkloads:s,fetchSourceById:d,fetchSourceDescribe:u,fetchSourceLibraries:p,fetchPeerSources:h,restartPod:m,recoverFromRollback:g,profilingEnabled:v,fetchProfilingSlots:y,enableProfiling:b,releaseProfiling:S,fetchSourceProfiling:x})=>{const{isVm:C}=ae(),w=X(e=>e.sources),{selectedStreamName:k}=Ze(),{drawerType:T,drawerEntityId:E}=W(),$=c(()=>tt(w,k),[w,k]),N=l(null),D=T===J.Source,[I,A]=i(!1),[R,O]=i(!1),[M,F]=i(ws.Overview),[L,P]=i(null),[_,z]=i(!1);o(()=>{D&&E&&d(E).then(e=>P(e||null))},[D,E]);const{formData:K,handleFormChange:j,resetFormData:V,loadFormWithDrawerItem:U}=_n(),H=c(()=>{if(E)return L&&JSON.stringify(Zt(L))===JSON.stringify(Zt(E))?L:$?.find(e=>JSON.stringify(Zt(e))===JSON.stringify(Zt(E)))},[E,$,L]);o(()=>{D&&H?U(H):V()},[D,H]);const q=c(()=>{const e=H?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===ve.Loading,containers:H?.containers||[]}},[H]),G=c(()=>!!H?.rollbackOccurred,[H?.rollbackOccurred]),Y=c(()=>{const e=[{label:ws.Overview,onClick:()=>F(ws.Overview),selected:M===ws.Overview}];return C||(ks.includes(H?.kind)&&e.push({label:ws.Pods,onClick:()=>F(ws.Pods),selected:M===ws.Pods}),H?.containers?.some(e=>Es.includes(e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language))&&e.push({label:ws.Libraries,onClick:()=>F(ws.Libraries),selected:M===ws.Libraries}),e.push({label:ws.PeerSources,onClick:()=>F(ws.PeerSources),selected:M===ws.PeerSources}),v&&y&&b&&S&&x&&e.push({label:ws.Profiling,onClick:()=>F(ws.Profiling),selected:M===ws.Profiling})),e},[M,H,C,v,y,b,S,x]),Q=Ts.includes(H?.kind),[Z,ee]=i({openFor:null,workloadId:void 0,podNamespace:void 0,podName:void 0});if(!H)return null;return e(po,{ref:N,width:_?"95vw":M===ws.Profiling?"80vw":void 0,onClose:()=>{F(ws.Overview),P(null),z(!1)},title:H.otelServiceName||H.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:jn(H.containers),isEdit:I,isFormDirty:R,onEdit:M===ws.Overview?e=>{A("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=K.otelServiceName!==H.name?K.otelServiceName:"";j("otelServiceName",e),await r(E,{...K,otelServiceName:e}),P(null),O(!1),A(!1)},onDelete:M===ws.Overview?async()=>{const{namespace:e}=H;a({[e]:[{...H,selected:!1,currentStreamName:k}]},{}),P(null),O(!1),A(!1),N.current?.closeDrawer()}:void 0,onCancel:()=>{O(!1),A(!1),j("otelServiceName",H.otelServiceName||H.name||"")},isLastItem:1===$.length,tabs:Y,headerActionButtons:C?[]:Q?[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>ee({openFor:Ds.Workload,workloadId:E}),children:e(n,{children:[t(mi,{}),t(B,{size:14,family:"secondary",decoration:"underline",children:"Restart"})]})}]:[],children:[M===ws.Overview?I?t($s,{children:t(ps,{formData:K,handleFormChange:(...e)=>{O(!0),j(...e),j("currentStreamName",k)}})}):e(Ns,{children:[t(hs,{workloadOdigosHealthStatus:H.workloadOdigosHealthStatus}),G&&t(de,{type:ue.Warning,message:f.ROLLBACK_OCCURRED_MESSAGE,action:{label:f.ROLLBACK_RECOVER,onClick:async()=>{await g(E);const e=await d(E);e&&P(e)}}}),t(te,{conditions:H.conditions||[]}),t(ne,{title:f.SOURCE_DETAILS,data:H?ds(H,C):[]}),t(ne,{title:C?f.DETECTED_PROCESSES:f.DETECTED_CONTAINERS,titleBadge:q.isLoading?ve.Loading:q.containers.length,description:q.description||(C?f.DETECTED_PROCESSES_DESCRIPTION:f.DETECTED_CONTAINERS_DESCRIPTION),children:q.containers.map(e=>t(Kn,{...e,callbackRuntimeOverride:e=>r(E,e)},`source-container-${e.containerName}`))}),H.manifestYAML&&t(Ki,{title:`${H.kind} YAML`,yaml:H.manifestYAML,defaultOpen:!H.instrumentationConfigYAML}),H.instrumentationConfigYAML&&t(Ki,{title:"Instrumentation Config YAML",yaml:H.instrumentationConfigYAML,defaultOpen:!H.manifestYAML})]}):M===ws.Pods?t(ms,{source:H,fetchSourceDescribe:u,onClickRestartPod:Q?(e,t)=>ee({openFor:Ds.Pod,podNamespace:e,podName:t}):void 0}):M===ws.Libraries?t(fs,{source:H,fetchSourceLibraries:p}):M===ws.PeerSources?t(Cs,{source:H,fetchPeerSources:h}):M===ws.Profiling&&v&&y&&b&&S&&x?t(cs,{source:H,fetchProfilingSlots:y,enableProfiling:b,releaseProfiling:S,fetchSourceProfiling:x,onFlameFullscreenChange:z}):null,t(Xt,{isOpen:!!Z.openFor,title:`Rollout Restart ${Z.openFor}`,description:`Are you sure you want to rollout restart this ${Z.openFor?.toLowerCase()}?`,approveButton:{text:"Confirm",variant:ue.Warning,onClick:()=>{Z.openFor===Ds.Workload&&Z.workloadId?s([Z.workloadId]):Z.openFor===Ds.Pod&&Z.podNamespace&&Z.podName&&m(Z.podNamespace,Z.podName),ee({openFor:null})}},denyButton:{text:"Go Back",onClick:()=>{ee({openFor:null})}}})]})},As=h.div`
589
+ `;var Ds;!function(e){e.Workload="Workload",e.Pod="Pod"}(Ds||(Ds={}));const Is=({persistSources:a,updateSource:r,restartWorkloads:s,fetchSourceById:d,fetchSourceDescribe:u,fetchSourceLibraries:p,fetchPeerSources:h,restartPod:m,recoverFromRollback:g,profilingEnabled:v,fetchProfilingSlots:y,enableProfiling:b,fetchSourceProfiling:S})=>{const{isVm:x}=ae(),C=X(e=>e.sources),{selectedStreamName:w}=Ze(),{drawerType:k,drawerEntityId:T}=W(),E=c(()=>tt(C,w),[C,w]),$=l(null),N=k===J.Source,[D,I]=i(!1),[A,R]=i(!1),[O,M]=i(ws.Overview),[F,L]=i(null),[P,_]=i(!1);o(()=>{N&&T&&d(T).then(e=>L(e||null))},[N,T]);const{formData:z,handleFormChange:K,resetFormData:j,loadFormWithDrawerItem:V}=_n(),U=c(()=>{if(T)return F&&JSON.stringify(Zt(F))===JSON.stringify(Zt(T))?F:E?.find(e=>JSON.stringify(Zt(e))===JSON.stringify(Zt(T)))},[T,E,F]);o(()=>{N&&U?V(U):j()},[N,U]);const H=c(()=>{const e=U?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===ve.Loading,containers:U?.containers||[]}},[U]),q=c(()=>!!U?.rollbackOccurred,[U?.rollbackOccurred]),G=c(()=>{const e=[{label:ws.Overview,onClick:()=>M(ws.Overview),selected:O===ws.Overview}];return x||(ks.includes(U?.kind)&&e.push({label:ws.Pods,onClick:()=>M(ws.Pods),selected:O===ws.Pods}),U?.containers?.some(e=>Es.includes(e.overrides?.runtimeInfo?.language??e.runtimeInfo?.language))&&e.push({label:ws.Libraries,onClick:()=>M(ws.Libraries),selected:O===ws.Libraries}),e.push({label:ws.PeerSources,onClick:()=>M(ws.PeerSources),selected:O===ws.PeerSources}),v&&y&&b&&S&&e.push({label:ws.Profiling,onClick:()=>M(ws.Profiling),selected:O===ws.Profiling})),e},[O,U,x,v,y,b,S]),Y=Ts.includes(U?.kind),[Q,Z]=i({openFor:null,workloadId:void 0,podNamespace:void 0,podName:void 0});if(!U)return null;return e(po,{ref:$,width:P?"95vw":O===ws.Profiling?"80vw":void 0,onClose:()=>{M(ws.Overview),L(null),_(!1)},title:U.otelServiceName||U.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:jn(U.containers),isEdit:D,isFormDirty:A,onEdit:O===ws.Overview?e=>{I("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=z.otelServiceName!==U.name?z.otelServiceName:"";K("otelServiceName",e),await r(T,{...z,otelServiceName:e}),L(null),R(!1),I(!1)},onDelete:O===ws.Overview?async()=>{const{namespace:e}=U;a({[e]:[{...U,selected:!1,currentStreamName:w}]},{}),L(null),R(!1),I(!1),$.current?.closeDrawer()}:void 0,onCancel:()=>{R(!1),I(!1),K("otelServiceName",U.otelServiceName||U.name||"")},isLastItem:1===E.length,tabs:G,headerActionButtons:x?[]:Y?[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>Z({openFor:Ds.Workload,workloadId:T}),children:e(n,{children:[t(mi,{}),t(B,{size:14,family:"secondary",decoration:"underline",children:"Restart"})]})}]:[],children:[O===ws.Overview?D?t($s,{children:t(ps,{formData:z,handleFormChange:(...e)=>{R(!0),K(...e),K("currentStreamName",w)}})}):e(Ns,{children:[t(hs,{workloadOdigosHealthStatus:U.workloadOdigosHealthStatus}),q&&t(de,{type:ue.Warning,message:f.ROLLBACK_OCCURRED_MESSAGE,action:{label:f.ROLLBACK_RECOVER,onClick:async()=>{await g(T);const e=await d(T);e&&L(e)}}}),t(te,{conditions:U.conditions||[]}),t(ne,{title:f.SOURCE_DETAILS,data:U?ds(U,x):[]}),t(ne,{title:x?f.DETECTED_PROCESSES:f.DETECTED_CONTAINERS,titleBadge:H.isLoading?ve.Loading:H.containers.length,description:H.description||(x?f.DETECTED_PROCESSES_DESCRIPTION:f.DETECTED_CONTAINERS_DESCRIPTION),children:H.containers.map(e=>t(Kn,{...e,callbackRuntimeOverride:e=>r(T,e)},`source-container-${e.containerName}`))}),U.manifestYAML&&t(Ki,{title:`${U.kind} YAML`,yaml:U.manifestYAML,defaultOpen:!U.instrumentationConfigYAML}),U.instrumentationConfigYAML&&t(Ki,{title:"Instrumentation Config YAML",yaml:U.instrumentationConfigYAML,defaultOpen:!U.manifestYAML})]}):O===ws.Pods?t(ms,{source:U,fetchSourceDescribe:u,onClickRestartPod:Y?(e,t)=>Z({openFor:Ds.Pod,podNamespace:e,podName:t}):void 0}):O===ws.Libraries?t(fs,{source:U,fetchSourceLibraries:p}):O===ws.PeerSources?t(Cs,{source:U,fetchPeerSources:h}):O===ws.Profiling&&v&&y&&b&&S?t(cs,{source:U,fetchProfilingSlots:y,enableProfiling:b,fetchSourceProfiling:S,onFlameFullscreenChange:_}):null,t(Xt,{isOpen:!!Q.openFor,title:`Rollout Restart ${Q.openFor}`,description:`Are you sure you want to rollout restart this ${Q.openFor?.toLowerCase()}?`,approveButton:{text:"Confirm",variant:ue.Warning,onClick:()=>{Q.openFor===Ds.Workload&&Q.workloadId?s([Q.workloadId]):Q.openFor===Ds.Pod&&Q.podNamespace&&Q.podName&&m(Q.podNamespace,Q.podName),Z({openFor:null})}},denyButton:{text:"Go Back",onClick:()=>{Z({openFor:null})}}})]})},As=h.div`
590
590
  max-width: ${({$fullWidth:e})=>e?"unset":"420px"};
591
591
  width: 100%;
592
592
  `,Rs=r(({isModal:n,fetchNamespacesWithWorkloads:i,onClickSummary:o},a)=>{const r=g(),{isVm:l}=ae(),c=Vn({fetchNamespacesWithWorkloads:i}),{selectedSources:d,loading:u,selectedAllNamespaces:p,onSelectAllNamespaces:h,getApiSourcesPayload:m,getApiFutureAppsPayload:v,searchText:y,setSearchText:b,searchBy:S,setSearchBy:x,showSelectedOnly:C,setShowSelectedOnly:w,showRunningOnly:T,setShowRunningOnly:E}=c;s(a,()=>({getFormValues:()=>({apps:m(),futureApps:v()})}));const $=Object.values(d).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return t(ce,{$isNotModal:!n,children:e(R,{$gap:12,children:[e(R,{$gap:24,children:[o&&t(xt,{onClick:o}),t(z,{title:f.SELECT_SOURCES,badgeLabel:$,description:f.SELECT_SOURCES_DESCRIPTION}),e(O,{$justifyContent:"space-between",children:[t(As,{$fullWidth:l,children:t(k,{placeholder:S===J.Source?f.SEARCH_SOURCES:f.SEARCH_NAMESPACES,icon:si,value:y,onChange:e=>b(e.target.value.toLowerCase())})}),!l&&t(P,{options:[{label:f.SOURCE,value:J.Source,selectedBgColor:r.text.secondary,selectedTextColor:r.text.primary},{label:f.NAMESPACE,value:J.Namespace,selectedBgColor:r.text.secondary,selectedTextColor:r.text.primary}],selected:S,setSelected:x})]}),e(O,{$gap:36,children:[t(N,{title:f.SELECT_ALL,initialValue:p,onChange:h,disabled:u}),t(N,{title:f.ONLY_SELECTED,initialValue:C,onChange:w}),t(N,{title:f.ONLY_RUNNING_INSTANCES,initialValue:T,onChange:E})]})]}),t(A,{}),t(Dl,{isModal:n,...c})]})})});Rs.displayName=Rs.name;const Os=({fetchNamespacesWithWorkloads:e,persistSources:n})=>{const{currentModal:i,setCurrentModal:o}=re(),a=i===J.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();n(e,t),r()}},c=l(null);return U({key:"Enter",active:a},s),a?t(se,{isOpen:a,onClose:r,header:{title:"Add Source"},actionComponent:t(me,{buttons:[{label:"DONE",variant:"primary",onClick:s}]}),children:t(Rs,{ref:c,isModal:!0,fetchNamespacesWithWorkloads:e})}):null},Ms=e=>{const t=[{key:"checkbox-and-icon",title:""},{key:"name",title:f.NAME,sortable:!0},{key:"kind",title:"Kind",sortable:!0}];return e||t.push({key:"namespace",title:f.NAMESPACE,sortable:!0}),t.push({key:"containers",title:f.DETECTED_CONTAINERS}),t.push({key:"conditions",title:"Conditions"}),t.push({key:"throughput",title:"Throughput",sortable:!0}),t},Fs=({metrics:n,maxHeight:i,maxWidth:o})=>{const a=g(),{isVm:r}=ae(),l=xe(),{selectedStreamName:s}=Ze(),u=X(e=>e.sources),p=X(e=>e.sourcesLoading),{setDrawerType:h,setDrawerEntityId:m}=W(),{selectedSources:v,setSelectedSources:y}=ze(),{progress:b}=Je(),S=c(()=>b[Xe.Instrumenting]||b[Xe.Uninstrumenting]?b[Xe.Instrumenting]?.percentage||b[Xe.Uninstrumenting]?.percentage||0:void 0,[b[Xe.Instrumenting],b[Xe.Uninstrumenting]]),x=c(()=>tt(u,s),[u,s]),w=c(()=>Co({instrumentationRules:[],sources:it(x,l),actions:[],destinations:[],searchText:l.searchText,selectedCategory:J.Source}).searchResults.find(({category:e})=>e===J.Source)?.entities||[],[x,l]),[k,T]=c(()=>{let e=0;return Object.values(v).forEach(t=>{e+=t.length}),[0!==e,e]},[v]),E=d(e=>{if(e){const e={};w.forEach(t=>{const{namespace:n}=t;e[n]?e[n].push(t):e[n]=[t]}),y(e)}else y({})},[w]),$=d(e=>{const{namespace:t,name:n,kind:i}=e,o={...v};o[t]||(o[t]=[]);const a=o[t].findIndex(e=>e.name===n&&e.kind===i);-1===a?o[t].push(e):o[t].splice(a,1),y(o)},[v]),N=c(()=>w.map(i=>{const o=Zt(i),r=Be(o),{hasErrors:l,hasWarnings:s,hasDisableds:c}=ge(i.conditions||[]),d=!!v[o.namespace]?.find(e=>e.namespace===o.namespace&&e.name===o.name&&e.kind===o.kind);return{status:l?ue.Error:s?ue.Warning:void 0,faded:c,onClick:()=>{h(J.Source),m(o)},cells:[{columnKey:"checkbox-and-icon",component:()=>e(O,{$gap:16,children:[t(C,{value:d,onChange:()=>$(i)}),t(Bn,{icons:Ye(i),id:r})]})},{columnKey:"name",value:ke(i,J.Source,{extended:!0})},{columnKey:"kind",value:i.kind,textColor:a.text.info},{columnKey:"namespace",value:i.namespace,textColor:a.text.info},{columnKey:"throughput",value:He(Pt(n,J.Source,o).throughput),textColor:a.text.info},{columnKey:"conditions",component:()=>t(So,{conditions:i.conditions||[],id:r})},{columnKey:"containers",component:()=>t("div",{style:{lineHeight:1},children:t(fe,{status:ue.Info,title:Wn(i.containers),withBorder:!0})})}]}}),[w,v,n,$]),{badge:D,badgeTooltip:I}=c(()=>w.length!==x.length?{badge:`${w.length}/${x.length}`,badgeTooltip:f.FILTERED_COUNT_TOOLTIP}:{badge:x.length,badgeTooltip:void 0},[w,x]);return e(Ee,{$maxWidth:o,children:[e($e,{children:[t(C,{partiallyChecked:k&&w?.length!==T,value:k&&w?.length===T,onChange:E,disabled:!w?.length}),t(Ne,{icon:De(J.Source),title:f.SOURCES,badge:D,badgeTooltip:I,loading:p||"number"==typeof S})]}),t(Ie,{$maxHeight:i,children:t(Ae,{columns:Ms(r),rows:N})}),"number"!=typeof S||N.length?N.length?null:t(Re,{style:{marginTop:"2rem"},children:t(Oe,{})}):e(Re,{style:{marginTop:"2rem",gap:"24px"},children:[t(Me,{width:420}),e(O,{$gap:16,children:[e(B,{color:a.text.info,children:[b[Xe.Instrumenting]?"Instrumenting":"Uninstrumenting"," workloads..."]}),t(Fe,{label:`${S}%`})]})]})]})},Ls=({expiresAt:t})=>{const n=g(),{formatTimeAgo:i}=en(),o=i(t),a=new Date(t).toDateString().split(" ").slice(1).join(" "),r=Un(t,0)?n.text.error:Un(t,6048e5)?n.text.warning:n.text.success;return e(B,{size:14,color:r,children:[o," (",a,")"]})},Ps=h.div`
@@ -1,10 +1,8 @@
1
1
  import type { ProfilingProps } from '@/containers/source-drawer/profiling';
2
2
  type ProfilingSlots = Awaited<ReturnType<ProfilingProps['fetchProfilingSlots']>>;
3
3
  type EnableProfilingResult = Awaited<ReturnType<ProfilingProps['enableProfiling']>>;
4
- type ReleaseProfilingResult = Awaited<ReturnType<ProfilingProps['releaseProfiling']>>;
5
4
  type SourceProfilingResult = Awaited<ReturnType<ProfilingProps['fetchSourceProfiling']>>;
6
5
  export declare const MOCK_PROFILING_SLOTS: ProfilingSlots;
7
6
  export declare const MOCK_ENABLE_PROFILING_RESULT: EnableProfilingResult;
8
- export declare const MOCK_RELEASE_PROFILING_RESULT: ReleaseProfilingResult;
9
7
  export declare const MOCK_SOURCE_PROFILING_RESULT: SourceProfilingResult;
10
8
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odigos/ui-kit",
3
- "version": "0.0.228",
3
+ "version": "0.0.229",
4
4
  "author": "Odigos",
5
5
  "license": "MIT",
6
6
  "repository": {