@odigos/ui-kit 0.0.144 → 0.0.145
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.145](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.144...ui-kit-v0.0.145) (2025-12-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add restartPod functionality to SourceDrawer and Describe components ([#530](https://github.com/odigos-io/ui-kit/issues/530)) ([4b3eb3b](https://github.com/odigos-io/ui-kit/commit/4b3eb3b717d506c52bc6811206fa04192424431d))
|
|
9
|
+
|
|
3
10
|
## [0.0.144](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.143...ui-kit-v0.0.144) (2025-12-14)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -6,6 +6,7 @@ interface SourceDrawerProps {
|
|
|
6
6
|
persistSources: PersistSources;
|
|
7
7
|
updateSource: (sourceId: WorkloadId, payload: SourceFormData) => Promise<void>;
|
|
8
8
|
restartWorkloads: (sourceIds: WorkloadId[]) => Promise<void>;
|
|
9
|
+
restartPod: (namespace: string, name: string) => Promise<void>;
|
|
9
10
|
fetchSourceById: (id: WorkloadId, bypassPaginationLoader?: boolean) => Promise<Source | undefined>;
|
|
10
11
|
fetchSourceDescribe: DescribeProps['fetchSourceDescribe'];
|
|
11
12
|
fetchSourceLibraries: LibrariesProps['fetchSourceLibraries'];
|
package/lib/containers.js
CHANGED
|
@@ -466,7 +466,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
466
466
|
flex-direction: column;
|
|
467
467
|
gap: 24px;
|
|
468
468
|
padding: 4px;
|
|
469
|
-
`,Il=({formData:t,handleFormChange:a})=>e.createElement(Ol,null,e.createElement($,{name:"sourceName",title:"Source name",tooltip:"This overrides the default service name that runs in your cluster.",placeholder:"Use a name that overrides the source name",value:t.otelServiceName,onChange:({target:{value:e}})=>a("otelServiceName",e)})),Fl=({workloadOdigosHealthStatus:t})=>{if(!t)return null;const a=Gt(t.status),i=nt(t.reasonEnum),n=t.message;return e.createElement(de,{$alignItems:"center",$justifyContent:"center"},e.createElement(ce,{status:a,title:i,subtitle:n,withBackground:a!==me.Disabled,withBorder:!0,withIcon:!0,width:"calc(100% - 24px)"}))},Al=({source:i,fetchSourceDescribe:n})=>{const[
|
|
469
|
+
`,Il=({formData:t,handleFormChange:a})=>e.createElement(Ol,null,e.createElement($,{name:"sourceName",title:"Source name",tooltip:"This overrides the default service name that runs in your cluster.",placeholder:"Use a name that overrides the source name",value:t.otelServiceName,onChange:({target:{value:e}})=>a("otelServiceName",e)})),Fl=({workloadOdigosHealthStatus:t})=>{if(!t)return null;const a=Gt(t.status),i=nt(t.reasonEnum),n=t.message;return e.createElement(de,{$alignItems:"center",$justifyContent:"center"},e.createElement(ce,{status:a,title:i,subtitle:n,withBackground:a!==me.Disabled,withBorder:!0,withIcon:!0,width:"calc(100% - 24px)"}))},Al=({source:i,fetchSourceDescribe:n,restartPod:o})=>{const[l,r]=t(!1),[s,d]=t(null),{clickCopy:u,isCopied:p}=Yt();return a(()=>{i&&n({variables:{namespace:i.namespace,name:i.name,kind:i.kind}}).then(({data:e})=>{e?.describeSource?d(e.describeSource):r(!0)})},[n,i]),s||l?e.createElement(Q,{$gap:12},l?e.createElement(Te,{$height:"70vh"},e.createElement(De,{subTitle:"Could not fetch describe for this source"})):s?.pods?.length?s.pods.map(({podName:t,nodeName:a,phase:n,agentInjected:l,runningLatestWorkloadRevision:r,containers:d,manifestYAML:m})=>{const h=n.status!==W.Success||Xt(d)?W.Error:W.Success,g=[];return g.push(e.createElement(Zt,{value:`kubectl get pod ${t.value} -n ${s?.namespace?.value||i.namespace}`.toLowerCase()})),g.push(e.createElement(re,{length:"100%",margin:"0"})),g.push(e.createElement(Qt,{title:a.name,tooltip:a.explain||"",value:{status:a.status||void 0,text:a.value}})),g.push(e.createElement(re,{length:"100%",margin:"0"})),g.push(e.createElement(Qt,{title:n.name,tooltip:n.explain||"",value:{status:n.status||void 0,text:n.value}})),g.push(e.createElement(re,{length:"100%",margin:"0"})),g.push(e.createElement(Qt,{title:l.name,tooltip:l.explain||"",value:{status:l.status||void 0,text:l.value}})),g.push(e.createElement(re,{length:"100%",margin:"0"})),r?.name&&(g.push(e.createElement(Qt,{title:r.name,tooltip:r.explain||void 0,value:{status:r.status||void 0,text:r.value}})),g.push(e.createElement(re,{length:"100%",margin:"0"}))),d.forEach(t=>{g.push(e.createElement(ea,{key:t.containerName.value,...t}))}),m&&(g.push(e.createElement(re,{length:"100%",margin:"0"})),g.push(e.createElement(ta,{icon:Ja,title:"YAML",actions:[{id:aa(),type:ia.Button,buttonProps:{label:"",leftIcon:p?Ra:Ga,onClick:()=>u(m),disabled:p,size:na.S,variant:oa.Secondary}}]},e.createElement("div",{style:{padding:"0 12px"}},e.createElement(la,{code:m,language:"yaml",theme:"duotoneDark"}))))),e.createElement(X,{key:`pod-${t.value}`,title:`Pod: ${t.value}`,withExtend:!0,action:({hovered:a})=>e.createElement("div",{style:{position:"relative"}},e.createElement(ce,{status:h,title:h,withIcon:!0,withBorder:!0}),a&&e.createElement(ra,{isOpen:!0,positionRight:"calc(100% + 12px)",actions:[{id:aa(),label:"Restart",rightIcon:Ya,onClick:()=>o(s?.namespace?.value||i.namespace,t.value)}]}))},c.toArray(g))}):e.createElement(Te,{$height:"70vh"},e.createElement(De,{subTitle:"Check if you have any running pods and try again"}))):e.createElement(Te,{$height:"70vh"},e.createElement(Le,null))},Ml=d(de)`
|
|
470
470
|
width: 100%;
|
|
471
471
|
align-items: center;
|
|
472
472
|
justify-content: space-between;
|
|
@@ -480,7 +480,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
480
480
|
display: flex;
|
|
481
481
|
flex-direction: column;
|
|
482
482
|
gap: 12px;
|
|
483
|
-
`,ql=({persistSources:i,updateSource:o,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d})=>{const{isVm:
|
|
483
|
+
`,ql=({persistSources:i,updateSource:o,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d,restartPod:u})=>{const{isVm:p}=We(),{sources:h}=_(),{selectedStreamName:g}=_e(),{drawerType:y,drawerEntityId:v}=K(),b=l(()=>Ge(h,g),[h,g]),f=n(null),x=y===B.Source,[$,C]=t(!1),[k,S]=t(!1),[w,T]=t(Ll.Overview),[D,N]=t(null);a(()=>{x&&v&&s(v).then(e=>N(e||null))},[x,v]);const{formData:O,handleFormChange:I,resetFormData:F,loadFormWithDrawerItem:A}=da(),M=l(()=>{if(!x)return F();const e=(D&&JSON.stringify(zt(D))===JSON.stringify(zt(v))?D:null)||b?.find(e=>e.namespace===v.namespace&&e.name===v.name&&e.kind===v.kind);return e?A(e):F(),e},[x,v,b,D]),R=l(()=>{const e=M?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===me.Loading,containers:M?.containers||[]}},[M]),L=l(()=>{const e=[{label:Ll.Overview,onClick:()=>T(Ll.Overview),selected:w===Ll.Overview}];return Pl.includes(M?.kind)&&e.push({label:Ll.Pods,onClick:()=>T(Ll.Pods),selected:w===Ll.Pods}),M?.containers?.some(({language:e})=>Kl.includes(e))&&e.push({label:Ll.Libraries,onClick:()=>T(Ll.Libraries),selected:w===Ll.Libraries}),e},[w,M]);return M?e.createElement(Di,{ref:f,onClose:()=>{T(Ll.Overview),N(null)},title:M.otelServiceName||M.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:He(M.containers),isEdit:$,isFormDirty:k,onEdit:w===Ll.Overview?e=>{C("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=O.otelServiceName!==M.name?O.otelServiceName:"";I("otelServiceName",e),await o(v,{...O,otelServiceName:e}),N(null),S(!1),C(!1)},onDelete:w===Ll.Overview?async()=>{const{namespace:e}=M;i({[e]:[{...M,selected:!1,currentStreamName:g}]},{}),N(null),S(!1),C(!1),f.current?.closeDrawer()}:void 0,onCancel:()=>{S(!1),C(!1),I("otelServiceName",M.otelServiceName||M.name||"")},isLastItem:1===b.length,tabs:L,headerActionButtons:[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>r([v]),children:e.createElement(e.Fragment,null,e.createElement(Ka,null),e.createElement(E,{size:14,family:"secondary",decoration:"underline"},"Restart"))}]},w===Ll.Overview?$?e.createElement(jl,null,e.createElement(Il,{formData:O,handleFormChange:(...e)=>{S(!0),I(...e),I("currentStreamName",g)}})):e.createElement(Vl,null,e.createElement(Fl,{workloadOdigosHealthStatus:M.workloadOdigosHealthStatus}),e.createElement(Y,{conditions:M.conditions||[]}),e.createElement(X,{title:m.SOURCE_DETAILS,data:M?El(M,p):[]}),e.createElement(X,{title:p?m.DETECTED_PROCESSES:m.DETECTED_CONTAINERS,titleBadge:R.isLoading?me.Loading:R.containers.length,description:R.description||(p?m.DETECTED_PROCESSES_DESCRIPTION:m.DETECTED_CONTAINERS_DESCRIPTION)},R.containers.map(t=>e.createElement(ua,{key:`source-container-${t.containerName}`,...t,callbackRuntimeOverride:async e=>await o(v,e)})))):w===Ll.Pods?e.createElement(Al,{source:M,fetchSourceDescribe:c,restartPod:u}):e.createElement(Rl,{source:M,fetchSourceLibraries:d})):null},zl=d.div`
|
|
484
484
|
max-width: ${({$fullWidth:e})=>e?"unset":"420px"};
|
|
485
485
|
width: 100%;
|
|
486
486
|
`,Hl=i(({isModal:t,fetchSingleNamespace:a,onClickSummary:i},n)=>{const l=O.useTheme(),{isVm:r}=We(),s=ha({fetchSingleNamespace:a}),{selectedSources:c,fetchingNamespace:d,selectedAllNamespaces:u,onSelectAllNamespaces:p,getApiSourcesPayload:h,getApiFutureAppsPayload:g,searchText:y,setSearchText:v,searchBy:b,setSearchBy:f,showSelectedOnly:x,setShowSelectedOnly:C,showRunningOnly:k,setShowRunningOnly:S}=s;o(n,()=>({getFormValues:()=>({apps:h(),futureApps:g()})}));const T=Object.values(c).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return e.createElement(ie,{$isNotModal:!t},e.createElement(Q,{$gap:12},e.createElement(Q,{$gap:24},i&&e.createElement(yt,{onClick:i}),e.createElement(F,{title:m.SELECT_SOURCES,badgeLabel:T,description:m.SELECT_SOURCES_DESCRIPTION}),e.createElement(de,{$justifyContent:"space-between"},e.createElement(zl,{$fullWidth:r},e.createElement($,{placeholder:b===B.Source?m.SEARCH_SOURCES:m.SEARCH_NAMESPACES,icon:Fa,value:y,onChange:e=>v(e.target.value.toLowerCase())})),!r&&e.createElement(I,{options:[{label:m.SOURCE,value:B.Source,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary},{label:m.NAMESPACE,value:B.Namespace,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary}],selected:b,setSelected:f})),e.createElement(de,{$gap:36},e.createElement(w,{title:m.SELECT_ALL,initialValue:u,onChange:p,disabled:!!d}),e.createElement(w,{title:m.ONLY_SELECTED,initialValue:x,onChange:C}),e.createElement(w,{title:m.ONLY_RUNNING_INSTANCES,initialValue:k,onChange:S}))),e.createElement(re,null),e.createElement(Cl,{isModal:t,...s})))});Hl.displayName=Hl.name;const Bl=({fetchSingleNamespace:t,persistSources:a})=>{const{currentModal:i,setCurrentModal:o}=ee(),l=i===B.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();a(e,t),r()}},c=n(null);return j({key:"Enter",active:l},s),l?e.createElement(te,{isOpen:l,onClose:r,header:{title:"Add Source"},actionComponent:e.createElement(ae,{buttons:[{label:"DONE",variant:"primary",onClick:s}]})},e.createElement(Hl,{ref:c,isModal:!0,fetchSingleNamespace:t})):null},Wl=e=>{const t=[{key:"checkbox-and-icon",title:""},{key:"name",title:m.NAME,sortable:!0},{key:"kind",title:"Kind",sortable:!0}];return e||t.push({key:"namespace",title:m.NAMESPACE,sortable:!0}),t.push({key:"containers",title:m.DETECTED_CONTAINERS}),t.push({key:"conditions",title:"Conditions"}),t.push({key:"throughput",title:"Throughput",sortable:!0}),t},_l=({metrics:t,maxHeight:a,maxWidth:i})=>{const n=O.useTheme(),{isVm:o}=We(),r=ge(),{isThisPending:c}=L(),{selectedStreamName:d}=_e(),{sources:u,sourcesLoading:p}=_(),{setDrawerType:h,setDrawerEntityId:g}=K(),{selectedSources:y,setSelectedSources:v}=Ae(),{isAwaitingInstrumentation:f,sourcesToCreate:x,sourcesCreated:$,sourcesToDelete:C,sourcesDeleted:k}=Me(),S=l(()=>{const e=(e,t)=>e>0&&Math.floor(100/e*t)||1;return x?e(x,$):C?e(C,k):1},[x,$,C,k]),w=l(()=>Ge(u,d),[u,d]),T=l(()=>Pi({instrumentationRules:[],sources:Je(w,r),actions:[],destinations:[],searchText:r.searchText,selectedCategory:B.Source}).searchResults.find(({category:e})=>e===B.Source)?.entities||[],[w,r]),[D,N]=l(()=>{let e=0;return Object.values(y).forEach(t=>{e+=t.length}),[0!==e,e]},[y]),I=s(e=>{if(e){const e={};T.forEach(t=>{const a={namespace:t.namespace,name:t.name,kind:t.kind};c({entityType:B.Source,entityId:a})||(e[t.namespace]?e[t.namespace].push(t):e[t.namespace]=[t])}),v(e)}else v({})},[T]),F=s(e=>{const{namespace:t,name:a,kind:i}=e,n={...y};n[t]||(n[t]=[]);const o=n[t].findIndex(e=>e.name===a&&e.kind===i);-1===o?n[t].push(e):n[t].splice(o,1),v(n)},[y]),A=l(()=>T.map(a=>{const i=zt(a),o=JSON.stringify(i),{hasErrors:l,hasWarnings:r,hasDisableds:s}=se(a.conditions||[]),d=c({entityType:B.Source,entityId:i}),u=!!y[i.namespace]?.find(e=>e.namespace===i.namespace&&e.name===i.name&&e.kind===i.kind);return{status:l?W.Error:r?W.Warning:void 0,faded:s,onClick:()=>{h(B.Source),g(i)},cells:[{columnKey:"checkbox-and-icon",component:()=>e.createElement(de,{$gap:16},e.createElement(b,{disabled:d,value:u,onChange:()=>F(a)}),e.createElement(ga,{icons:He(a.containers),id:o}))},{columnKey:"name",value:be(a,B.Source,{extended:!0})},{columnKey:"kind",value:a.kind,textColor:n.text.info},{columnKey:"namespace",value:a.namespace,textColor:n.text.info},{columnKey:"throughput",value:je(Et(t,B.Source,i).throughput),textColor:n.text.info},{columnKey:"conditions",component:()=>e.createElement(Ri,{conditions:a.conditions||[],id:o})},{columnKey:"containers",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:W.Info,title:ya(a.containers),withBorder:!0}))}]}}),[T,y,t,F]),{badge:M,badgeTooltip:R}=l(()=>T.length!==w.length?{badge:`${T.length}/${w.length}`,badgeTooltip:m.FILTERED_COUNT_TOOLTIP}:{badge:w.length,badgeTooltip:void 0},[T,w]);return e.createElement(xe,{$maxWidth:i},e.createElement($e,null,e.createElement(b,{partiallyChecked:D&&T?.length!==N,value:D&&T?.length===N,onChange:I,disabled:!T?.length}),e.createElement(Ce,{icon:ke(B.Source),title:m.SOURCES,badge:M,badgeTooltip:R,loading:p||f})),e.createElement(Se,{$maxHeight:a},e.createElement(we,{columns:Wl(o),rows:A})),f&&!A.length?e.createElement(Te,{style:{marginTop:"2rem",gap:"24px"}},e.createElement(Ne,{width:420}),e.createElement(de,{$gap:16},e.createElement(E,{color:n.text.info},x?"Instrumenting":"Uninstrumenting"," workloads..."),e.createElement(Ee,{label:`${S}%`}))):A.length?null:e.createElement(Te,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Ul=({expiresAt:t})=>{const a=O.useTheme(),{formatTimeAgo:i}=Ht(),n=i(t),o=new Date(t).toDateString().split(" ").slice(1).join(" "),l=va(t,0)?a.text.error:va(t,6048e5)?a.text.warning:a.text.success;return e.createElement(E,{size:14,color:l},n," (",o,")")},Jl=d.div`
|