@odigos/ui-kit 0.0.158 → 0.0.159
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 +7 -0
- package/lib/chunks/index-f8b63983.js +3 -0
- package/lib/chunks/ui-components-f482fcd2.js +2227 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/v2.js +4 -4
- package/lib/containers.js +23 -23
- package/lib/contexts/odigos-context.d.ts +6 -4
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks/useConnection.d.ts +0 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store/useSelectedStore.d.ts +1 -3
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-2b728335.js +0 -3
- package/lib/chunks/ui-components-8250476f.js +0 -2227
package/lib/components/v2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{B as Badge,g as Button,m as ButtonSize,dc as ButtonTab,dd as ButtonTabList,h as ButtonVariants,C as Checkbox,dg as CheckboxList,df as CheckboxSize,t as CliCommand,s as DataCard,D as Drawer,di as DropData,dh as DropDataAlign,dj as Header,b$ as HoverActions,I as IconButton,cb as IconButtonSize,dk as Input,L as Loader,dl as Modal,dm as Navbar,N as Note,dp as Radio,dq as RadioGroup,dn as RadioSize,S as Search,j as SectionCard,l as SectionCardActionType,de as SectionCardSize,w as Segment,x as StatusCard,n as Table,o as TableVariant,dr as Tag,y as TextCard,e as Toggle,dt as ToggleLabelAlign,du as ToggleList,f as ToggleSize,ds as ToggleVariant,T as Typography,c as TypographySize,dv as TypographyVariants,W as WarningModal}from"../chunks/ui-components-f482fcd2.js";import"../icons.js";import"react";import"styled-components";import"zustand";import"javascript-time-ago";import"../chunks/vendor-55cc654c.js";import"react-dom";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|
package/lib/components.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{av as AutocompleteInput,aQ as Badge,aT as Button,af as CancelWarning,r as CenterThis,M as Checkbox,ci as Code,am as ConditionDetails,an as DataCard,G as DataCardFieldTypes,bD as DataCardFields,d0 as DataFinger,aW as DataTab,ae as DeleteWarning,bZ as DescribeRow,aw as Divider,a5 as DocsButton,ad as Drawer,d2 as DrawerFooter,d1 as DrawerHeader,bg as Dropdown,d3 as ErrorBoundary,bp as ExtendArrow,d as FadeLoader,Q as FieldError,J as FieldLabel,F as FlexColumn,b as FlexRow,d4 as Header,bo as IconButton,c7 as IconGroup,aK as IconTitleBadge,aF as IconWrapped,bV as IconsNav,d5 as ImageControlled,V as Input,a0 as InputList,Z as InputTable,aN as InteractiveTable,$ as KeyValueInputsList,aS as LoadingText,aq as Modal,as as ModalBody,a6 as MonitorsCheckboxes,aH as MonitorsIcons,ar as NavigationButtons,aO as NoDataFound,at as NotificationNote,db as Overlay,P as PageContent,bb as Popup,cc as PopupForm,ch as ScrollX,aZ as ScrollY,a4 as SectionTitle,a3 as Segment,bc as SelectionButton,b1 as SkeletonLoader,ay as Status,bC as Stepper,d6 as TabList,aI as TableContainer,aJ as TableTitleWrap,aM as TableWrap,bM as Tag,a2 as Text,a7 as TextArea,_ as Toggle,cf as ToggleCodeComponent,aA as Tooltip,aP as TraceLoader,U as UpgradeRequiredWrapper,bd as VerticalScroll,da as WarningModal,d7 as getLinksFromText,d8 as getStrongsFromText,d9 as renderText}from"./chunks/ui-components-f482fcd2.js";import"./icons.js";import"react";import"styled-components";import"zustand";import"javascript-time-ago";import"./chunks/vendor-55cc654c.js";import"react-dom";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|
package/lib/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{ak as ACTION_OPTIONS,ac as BUTTON_TEXTS,bn as DEFAULT_DATA_STREAM_NAME,bA as DESTINATION_CATEGORIES,bh as DISPLAY_LANGUAGES,E as DISPLAY_TITLES,au as FORM_ALERTS,bP as INSTRUMENTATION_RULE_OPTIONS,cU as LANGUAGE_OPTIONS,bi as MONITORS_OPTIONS,bj as STORAGE_KEYS,cV as TOKEN_ABOUT_TO_EXPIRE}from"./chunks/ui-components-f482fcd2.js";import"./icons.js";import"react";import"styled-components";import"zustand";import"javascript-time-ago";import"./chunks/vendor-55cc654c.js";import"react-dom";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|
package/lib/containers/v2.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useState as t,useMemo as a,useEffect as l,useCallback as o}from"react";import n,{useTheme as i}from"styled-components";import{W as s,F as r,
|
|
1
|
+
import e,{useState as t,useMemo as a,useEffect as l,useCallback as o}from"react";import n,{useTheme as i}from"styled-components";import{W as s,F as r,u as c,D as d,S as u,N as g,a as p,b,T as m,c as y,B as h,O as f,C as v,d as w,e as C,f as k,L as x,g as $,h as R,i as A,P as L,j as P,k as I,l as D,m as S,n as V,o as z,p as M,q as O,r as T,s as N,I as j,t as U,v as W,w as E,x as F,y as q,z as H,A as Y,U as G}from"../chunks/ui-components-f482fcd2.js";import{ConnectionsIcon as K,OdigosLogo as B,RefreshIcon as J,SettingsIcon as Q,DeleteIcon as X,VIcon as Z,XIcon as _,PodIcon as ee,ChevronUpIcon as te,ChevronDownIcon as ae,TerminalIcon as le,VSquareIcon as oe,XSquareIcon as ne,PipelineCollectorIcon as ie,DownloadIcon as se,GatewayIcon as re,YamlIcon as ce}from"../icons.js";import{Y as de}from"../chunks/index-f8b63983.js";import{V as ue}from"../chunks/index-64bb5a64.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-55cc654c.js";import"react-dom";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";const ge=({onDeny:t,onApprove:a})=>e.createElement(s,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",onDeny:t,denyLabel:"Keep editing",onApprove:a,approveLabel:"Discard changes"}),pe=({onDeny:t,onApprove:a,action:l="delete",target:o})=>{const n=l.charAt(0).toUpperCase()+l.substring(1),i=o?.endsWith("s")?"these":"this";return e.createElement(s,{title:`${n}${o?` ${o}`:""}?`,description:`Are you sure you want to ${l}${o?` ${i} ${o}`:""}?`,onDeny:t,denyLabel:"Go back",onApprove:a,approveLabel:n})},be=({minSupportedVersion:t,currentVersion:a})=>e.createElement(s,{relativeToParent:!0,visual:ue,title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${t} or later.\nCurrent version: ${a}.`}),me="75vw",ye=n.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
border-radius: 16px;
|
|
@@ -46,7 +46,7 @@ import e,{useState as t,useMemo as a,useEffect as l,useCallback as o}from"react"
|
|
|
46
46
|
justify-content: flex-end;
|
|
47
47
|
gap: 16px;
|
|
48
48
|
padding: 0 24px;
|
|
49
|
-
`,xe=({onClose:o,connections:n,selectedConnectionIds:s,setSelectedConnectionIds:r,getConnectionRemoteConfig:A,onApply:L})=>{const P=i(),[I,D]=t(""),S=a(()=>n.filter(e=>!I||e.name.toLowerCase().includes(I.toLowerCase())),[n,I]),V=s.length>0,z=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[M,O]=t(!1),[T,
|
|
49
|
+
`,xe=({onClose:o,connections:n,selectedConnectionIds:s,setSelectedConnectionIds:r,getConnectionRemoteConfig:A,onApply:L})=>{const P=i(),[I,D]=t(""),S=a(()=>n.filter(e=>!I||e.name.toLowerCase().includes(I.toLowerCase())),[n,I]),V=s.length>0,z=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[M,O]=t(!1),[T,N]=t(!1),[j,U]=t(void 0),[W,E]=t(!1),[F,q]=t(void 0),{formData:H,handleFormChange:Y,areFormValuesEqual:G,resetFormData:J}=c({automaticRollout:!0}),Q=a(()=>s.length>1||void 0!==F&&!G(F,H),[s.length,F,H]);return l(()=>{1===s.length?(async e=>{if(W)return;E(!0);const t=await A(e);if(t){const e={automaticRollout:!t.rollout?.automaticRolloutDisabled};q(e),J(e)}E(!1)})(s[0]):q(void 0)},[s.length]),e.createElement(d,{isOpen:!0,hideOverlay:!0,width:me,header:{icon:K,title:"Cluster Configuration",onClose:o}},e.createElement(ye,null,e.createElement(he,null,e.createElement(u,{width:"40%",value:I,onChange:D}),Q?e.createElement(g,{fullWidth:!0,status:p.Info,message:'The values don\'t reflect the current configuration of the selected clusters.\n"Apply" will override the current configurations.'}):1===s.length&&void 0!==F?e.createElement(g,{fullWidth:!0,status:p.Success,message:"The values reflect the current configuration of the selected cluster."}):null),e.createElement(fe,null,e.createElement(ve,{$width:"40%"},e.createElement(b,{$padding:"0 12px",$justifyContent:"space-between"},e.createElement(b,{$gap:8},e.createElement(m,{size:y.XS},"Clusters"),e.createElement(h,{label:n.length,status:f.Unknown})),e.createElement(b,{$gap:8},e.createElement(m,{size:y.XXXS,color:P.v2.colors.silver[200]},"Selected"),e.createElement(h,{label:`${s.length}/${n.length}`,status:f.Unknown}))),e.createElement(we,{$isFooterOpen:V,$borderRadius:"16px 0 0 16px"},S.map(t=>e.createElement(Ce,{key:t.id,onClick:()=>z(t.id)},e.createElement(v,{value:s.includes(t.id),onChange:()=>z(t.id)}),e.createElement(m,{size:y.XS},t.name))))),e.createElement(ve,{$width:"60%"},e.createElement(b,{$padding:"2px 12px"},e.createElement(m,{size:y.XS},"Configurations")),e.createElement(we,{$isFooterOpen:V,$borderRadius:"0 16px 16px 0"},W?e.createElement(w,null):e.createElement(b,{$gap:12},e.createElement(C,{size:k.S,label:"Automatic Rollout "+(H.automaticRollout?"Enabled":"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 enabled, Odigos will proactively restart workloads as needed to apply updated instrumentation. Users do not need to manually trigger rollouts after adding or removing sources. Any new pods created after enabling or disabling the agent (via automatic rollout, autoscaling, etc.) will still have the agent injected, regardless of this setting. When set to false, additional configurations related to automated rollouts or rollbacks take effect.",value:H.automaticRollout,onChange:e=>Y("automaticRollout",e)})))))),V&&e.createElement(ke,null,T?e.createElement(x,{label:"Applying configurations...",icon:B,withGradient:!0,typographyProps:{size:y.XXS}}):j?e.createElement(m,{size:y.XXS,color:P.v2.colors.red[500]},j):null,e.createElement("div",{style:{width:"150px"}},e.createElement($,{variant:R.Secondary,label:"Cancel",fullWidth:!0,onClick:()=>O(!0),disabled:T})),e.createElement("div",{style:{width:"150px"}},e.createElement($,{variant:R.Primary,label:"Apply",fullWidth:!0,onClick:async()=>{N(!0);const{error:e}=await L(s,H);N(!1),e?U(e):(r([]),o())},disabled:T}))),M&&e.createElement(ge,{onDeny:()=>O(!1),onApprove:()=>{O(!1),r([]),o()}}))};var $e;!function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}($e||($e={}));const Re=[{key:$e.Name,label:"Name"},{key:$e.Type,label:"Type",textAlign:"right"},{key:$e.Status,label:"Status"},{key:$e.OdigosVersion,label:"Odigos Version"},{key:$e.ConnectedSince,label:"Connected Since"},{key:$e.LastActivity,label:"Last Activity"}],Ae=({tableRowsMaxHeight:n,connections:i,getConnections:s,onClickConnection:r,deleteConnection:c,getConnectionRemoteConfig:d,applyConfigurations:u})=>{const{formatTimeAgo:g}=A(),[b,m]=t(!1),[y,v]=t(i||[]),[w,C]=t(""),k=o(async()=>{try{m(!0),v(await s()??[])}catch(e){}finally{m(!1)}},[]);l(()=>{y.length||k()},[y.length,k]);const[x,$]=t(null),[M,O]=t([]),[T,N]=t(!1),j=a(()=>y.filter(e=>!w||e.name.toLowerCase().includes(w.toLowerCase())).map(t=>({onClick:()=>r(t),isSelected:M.includes(t.id),onSelect:()=>O(e=>[...e,t.id]),onDeselect:()=>O(e=>e.filter(e=>e!==t.id)),cells:[{key:$e.Id,rawValue:t.id},{key:$e.Name,rawValue:t.name},{key:$e.Type,rawValue:t.type},{key:$e.Status,rawValue:t.status,component:()=>(t=>{const a=t===p.Success?"Connection live":"Connection lost",l=t===p.Success?Z:_;return e.createElement(h,{status:t,label:a,leftIcon:l})})(t.status)},{key:$e.OdigosVersion,rawValue:t.odigosVersion},{key:$e.ConnectedSince,rawValue:t.connectedAt?g(t.connectedAt):"-"},{key:$e.LastActivity,rawValue:t.lastSeenAt?g(t.lastSeenAt):"-"}]})),[y,M,w]);return e.createElement(L,null,e.createElement(P,{backgroundWeight:"1000",icon:K,title:"Connections",badge:{label:y.length.toString(),status:f.Unknown},search:{placeholder:"Search by cluster name",value:w,onChange:e=>C(e)},actions:[{id:I(),type:D.Button,buttonProps:{variant:R.Secondary,size:S.S,leftIcon:J,onClick:()=>k(),disabled:b}},{id:I(),type:D.Button,buttonProps:{variant:R.Primary,size:S.S,label:"Configurations",rightIcon:Q,onClick:()=>N(!0)}}]},e.createElement(V,{variant:z.Pretty,maxHeight:n,isLoading:b,withCheckboxes:!0,columns:Re,rows:j,rowActionsPushRightPosition:T?`calc(${me} - 24px)`:void 0,getRowActions:({cells:e})=>[{id:I(),label:"Edit Configuration",rightIcon:Q,onClick:async()=>{const t=e.find(e=>e.key===$e.Id)?.rawValue;t&&(O([t.toString()]),N(!0))}},{id:I(),label:"Delete Connection",rightIcon:X,disabled:e.find(e=>e.key===$e.Status)?.rawValue===p.Success,onClick:()=>{const t=e.find(e=>e.key===$e.Id)?.rawValue;t&&$(t.toString())}}]}),T&&e.createElement(xe,{onClose:()=>N(!1),connections:y,selectedConnectionIds:M,setSelectedConnectionIds:O,getConnectionRemoteConfig:d,onApply:u}),x&&e.createElement(pe,{target:"connection",onDeny:()=>$(null),onApprove:async()=>{x&&(await c(x),k())}})))},Le=n.div`
|
|
50
50
|
display: flex;
|
|
51
51
|
align-items: center;
|
|
52
52
|
justify-content: space-between;
|
|
@@ -60,8 +60,8 @@ import e,{useState as t,useMemo as a,useEffect as l,useCallback as o}from"react"
|
|
|
60
60
|
}
|
|
61
61
|
`,Pe=n.div`
|
|
62
62
|
animation-name: ${M.animations.fade.in};
|
|
63
|
-
`,Ie=({pod:o,getExtendedPodInfo:n,onClose:i})=>{const{formatTimeAgo:s}=A(),[c,u]=t(null),[g,p]=t(!1);l(()=>{o?n(o.namespace,o.name).then(e=>u(e??null)):(u(null),p(!1))},[o]);const b=a(()=>[{id:I(),title:"Node",label:c?.node??"-",withCopy:!0},{id:I(),title:"Status",badge:{status:O(c?.status),label:c?.status??"-"}}],[c]),y=a(()=>c?.containers?.map(e=>({id:I(),items:[{id:I(),title:"Container",label:e.name??"-"},{id:I(),title:"Status",badge:{status:O(e.status),label:e.status??"-"},label:e.startedAt?`(since ${s(e.startedAt)})`:""},{id:I(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:I(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:I(),title:"Restarts",label:e.restarts.toString()},{id:I(),title:"State Reason",label:e.stateReason??"-"},{id:I(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:I(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return e.createElement(d,{isOpen:!!o,header:{icon:
|
|
63
|
+
`,Ie=({pod:o,getExtendedPodInfo:n,onClose:i})=>{const{formatTimeAgo:s}=A(),[c,u]=t(null),[g,p]=t(!1);l(()=>{o?n(o.namespace,o.name).then(e=>u(e??null)):(u(null),p(!1))},[o]);const b=a(()=>[{id:I(),title:"Node",label:c?.node??"-",withCopy:!0},{id:I(),title:"Status",badge:{status:O(c?.status),label:c?.status??"-"}}],[c]),y=a(()=>c?.containers?.map(e=>({id:I(),items:[{id:I(),title:"Container",label:e.name??"-"},{id:I(),title:"Status",badge:{status:O(e.status),label:e.status??"-"},label:e.startedAt?`(since ${s(e.startedAt)})`:""},{id:I(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:I(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:I(),title:"Restarts",label:e.restarts.toString()},{id:I(),title:"State Reason",label:e.stateReason??"-"},{id:I(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:I(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return e.createElement(d,{isOpen:!!o,header:{icon:ee,title:"Pod Information",onClose:i}},c?null:e.createElement(T,null,e.createElement(w,null)),c?e.createElement(e.Fragment,null,e.createElement(P,{icon:ee,title:c.name,withCopyTitle:!0},e.createElement(r,{$gap:24},e.createElement(N,{cellsPerRow:2,items:b}),y.length>0&&e.createElement(r,{$gap:12},e.createElement(Le,{onClick:()=>p(e=>!e)},e.createElement(m,null,"Containers Overview"),e.createElement(j,{icon:g?te:ae})),g&&y.map(({id:t,items:a})=>e.createElement(Pe,{key:t},e.createElement(N,{cellsPerRow:2,items:a})))))),e.createElement(P,{icon:le,title:"Kubectl Commands"},e.createElement(r,{$gap:12},e.createElement(U,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),e.createElement(U,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),e.createElement(U,{value:`kubectl logs ${c.name} -n ${c.namespace}`}))),e.createElement(de,{yaml:c.manifestYAML})):null)};var De;!function(e){e.PodName="podName",e.Ready="ready",e.Started="started",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.Age="age",e.DockerImage="dockerImage"}(De||(De={}));const Se=[{key:De.PodName,label:"Pod Name"},{key:De.Ready,label:"Ready",textAlign:"right"},{key:De.Started,label:"Started",textAlign:"right"},{key:De.Status,label:"Status"},{key:De.Restarts,label:"Restarts",textAlign:"right"},{key:De.NodeName,label:"Node Name"},{key:De.Age,label:"Age",textAlign:"right"},{key:De.DockerImage,label:"Docker Image",textAlign:"right"}],Ve=({isLoading:l,tableRowsMaxHeight:o,pods:n,getExtendedPodInfo:s})=>{const r=i(),{formatTimeAgo:c}=A(),[d,u]=t(null),g=a(()=>{const t=t=>t?e.createElement(oe,{fill:W(r,p.Success,"500"),size:20}):e.createElement(ne,{fill:W(r,p.Error,"500"),size:20});return n.map(a=>({onClick:()=>u(a),cells:[{key:De.PodName,rawValue:a.name},{key:De.Ready,rawValue:a.ready,component:()=>t(a.ready)},{key:De.Started,rawValue:a.started,component:()=>t(a.started)},{key:De.Status,rawValue:a.status,component:()=>{return t=a.status,e.createElement(h,{status:O(t),label:t});var t}},{key:De.Restarts,rawValue:a.restartsCount.toString()},{key:De.NodeName,rawValue:a.nodeName},{key:De.Age,rawValue:c(a.creationTimestamp)},{key:De.DockerImage,rawValue:a.image}]}))},[n,r]);return e.createElement(P,{icon:ee,title:"Pods"},e.createElement(V,{variant:z.Data,maxHeight:o,isLoading:l,columns:Se,rows:g}),e.createElement(Ie,{pod:d,getExtendedPodInfo:s,onClose:()=>u(null)}))};var ze;!function(e){e.Gateway="gateway",e.Node="node"}(ze||(ze={}));const Me=[{value:ze.Gateway,label:"Gateway"},{value:ze.Node,label:"Node Collector"}],Oe=n.div`
|
|
64
64
|
display: flex;
|
|
65
65
|
align-items: center;
|
|
66
66
|
justify-content: space-between;
|
|
67
|
-
`,Te=({selectedTab:t,setSelectedTab:a,onClickDownloadDiagnose:l,onClickRefresh:o,loading:n,disabled:i})=>e.createElement(Oe,null,e.createElement(b,{$gap:12},e.createElement(b,{$gap:8},e.createElement(
|
|
67
|
+
`,Te=({selectedTab:t,setSelectedTab:a,onClickDownloadDiagnose:l,onClickRefresh:o,loading:n,disabled:i})=>e.createElement(Oe,null,e.createElement(b,{$gap:12},e.createElement(b,{$gap:8},e.createElement(ie,{size:32}),e.createElement(m,{size:y.M,weight:500},"Pipeline Collectors")),e.createElement(E,{options:Me,selected:t,setSelected:a,disabled:i})),e.createElement(b,{$gap:8},l&&e.createElement($,{label:"Download Diagnose",leftIcon:se,size:S.S,variant:R.Text,onClick:l,disabled:i}),o&&e.createElement($,{label:"Refresh",leftIcon:J,size:S.S,variant:R.Text,onClick:o,loading:n,disabled:i}))),Ne=({isOpen:t,onClose:a,title:l,yaml:o})=>e.createElement(d,{isOpen:t,header:{icon:re,title:l,onClose:a}},e.createElement(de,{yaml:o}));var je;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(je||(je={}));const Ue=({icon:a,title:l,badge:o,statusCard:n,textCards:i,manifestYaml:s,configMapYaml:r})=>{const[c,d]=t(null);return e.createElement(P,{icon:a,title:l,badge:o,actions:[{id:I(),type:D.ButtonDropData,buttonProps:{variant:R.Secondary,size:S.S,label:"View YAML",onClick:e=>d(e)},dropDataItems:[{id:je.ManifestYaml,label:l,icon:ce},{id:je.ConfigMapYaml,label:"ConfigMap",icon:ce}]}]},e.createElement(b,{$gap:16},e.createElement(F,{...n}),i.map(t=>e.createElement(q,{key:t.title,...t}))),e.createElement(Ne,{isOpen:c===je.ManifestYaml,onClose:()=>d(null),title:l,yaml:s}),e.createElement(Ne,{isOpen:c===je.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:r}))},We=e=>{switch(e){case H.Healthy:return"All desired replicas are updated, available, and ready";case H.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case H.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case H.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case H.Down:return"No available replicas";case H.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Ee=({tableRowsMaxHeight:n,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:r,getNodeCollectorPods:c,getExtendedPodInfo:d})=>{const{formatTimeAgo:u}=A(),{isVersionSupported:g,version:b}=Y(1.12),[m,y]=t(!1),[h,v]=t(ze.Gateway),[w,C]=t(null),[k,x]=t([]),[$,R]=t(null),[P,I]=t([]),D=o(async()=>{y(!0);try{switch(h){case ze.Gateway:C(await i()??null),x(await s()??[]);break;case ze.Node:R(await r()??null),I(await c()??[])}}catch(e){}y(!1)},[h]);l(()=>{D()},[D]);const S=a(()=>(e=>{switch(e){case ze.Gateway:return"Deployment";case ze.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(h),[h]),V=a(()=>((e,t,a,l)=>{const o={status:f.Disabled,label:"No rollouts yet"};let n=!1,i=null;switch(e){case ze.Gateway:n=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case ze.Node:n=a?.rolloutInProgress??!1,i=a?.lastRolloutAt??null;break;default:return o}return n?{status:p.Info,label:"Rollout in progress",rightIcon:J,useSecondaryTone:!0}:i?{status:f.Disabled,label:`Last Rollout: ${l(i)}`}:o})(h,w,$,u),[w,$,h,u]),z=a(()=>((e,t,a,l)=>{let o=l?p.Info:f.Unknown,n=l?"Loading":H.Unknown,i=l?"Fetching data...":We(H.Unknown);switch(e){case ze.Gateway:o=t?.status?O(t?.status):o,n=t?.status??n,i=t?.status?We(t.status):i;break;case ze.Node:o=a?.status?O(a?.status):o,n=a?.status??n,i=a?.status?We(a.status):i}return{status:o,title:n,description:i}})(h,w,$,m),[w,$,h,m]),M=a(()=>((e,t,a,l)=>{switch(e){case ze.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 ze.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[]}})(h,w,$,m),[w,$,h,m]),T=a(()=>(h===ze.Gateway?w?.manifestYAML:$?.manifestYAML)??"",[w,$,h]),N=a(()=>(h===ze.Gateway?w?.configMapYAML:$?.configMapYAML)??"",[w,$,h]),j=a(()=>h===ze.Gateway?k:P,[k,P,h]);return e.createElement(L,null,e.createElement(Te,{disabled:!g,loading:m,selectedTab:h,setSelectedTab:v,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e.createElement(G,null,e.createElement(Ue,{icon:re,title:S,badge:V,statusCard:z,textCards:M,manifestYaml:T,configMapYaml:N}),e.createElement(Ve,{isLoading:m,tableRowsMaxHeight:n,pods:j,getExtendedPodInfo:d}),!g&&e.createElement(be,{minSupportedVersion:1.12,currentVersion:b||""})))};export{Ae as CentralConnections,Ee as PipelineCollectors};
|