@odigos/ui-kit 0.0.151 → 0.0.153
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 +14 -0
- package/lib/chunks/{index-fe2a432e.js → index-e3f25476.js} +1 -1
- package/lib/chunks/{ui-components-92e29f4b.js → ui-components-e057d958.js} +347 -344
- package/lib/components/_v2/note/index.d.ts +1 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/central-connections/config-drawer/index.d.ts +3 -2
- package/lib/containers/_v2/central-connections/index.d.ts +3 -2
- package/lib/containers/v2.js +11 -11
- package/lib/containers.js +26 -26
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks/useActionFormData.d.ts +1 -1
- package/lib/hooks/useDataStreamFormData.d.ts +1 -1
- package/lib/hooks/useDestinationFormData.d.ts +1 -1
- package/lib/hooks/useGenericForm.d.ts +2 -1
- package/lib/hooks/useInstrumentationRuleFormData.d.ts +1 -1
- package/lib/hooks/useSourceFormData.d.ts +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/common/index.d.ts +5 -0
- package/lib/types.js +1 -1
- package/package.json +1 -1
package/lib/components/v2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{k as Badge,p as Button,B as ButtonSize,db as ButtonTab,dc as ButtonTabList,a as ButtonVariants,l as Checkbox,df as CheckboxList,de as CheckboxSize,x as CliCommand,w as DataCard,D as Drawer,dg as DropData,dh as Header,c1 as HoverActions,I as IconButton,cc as IconButtonSize,di as Input,L as Loader,dj as Modal,dk as Navbar,f as Note,dm as Radio,dn as RadioGroup,dl as RadioSize,e as Search,b as SectionCard,S as SectionCardActionType,dd as SectionCardSize,z as Segment,A as StatusCard,r as Table,s as TableVariant,dp as Tag,E as TextCard,n as Toggle,dr as ToggleLabelAlign,ds as ToggleList,o as ToggleSize,dq as ToggleVariant,T as Typography,j as TypographySize,dt as TypographyVariants,W as WarningModal}from"../chunks/ui-components-e057d958.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{aw as AutocompleteInput,aQ as Badge,aT as Button,ah as CancelWarning,c as CenterThis,R as Checkbox,C as Code,an as ConditionDetails,ao as DataCard,J as DataCardFieldTypes,bE as DataCardFields,c$ as DataFinger,aW as DataTab,ag as DeleteWarning,b$ as DescribeRow,ax as Divider,a7 as DocsButton,af as Drawer,d1 as DrawerFooter,d0 as DrawerHeader,bh as Dropdown,d2 as ErrorBoundary,bq as ExtendArrow,m as FadeLoader,V as FieldError,Q as FieldLabel,F as FlexColumn,i as FlexRow,d3 as Header,bp as IconButton,c9 as IconGroup,aL as IconTitleBadge,aG as IconWrapped,bX as IconsNav,d4 as ImageControlled,Y as Input,a2 as InputList,$ as InputTable,aO as InteractiveTable,a1 as KeyValueInputsList,aS as LoadingText,ar as Modal,at as ModalBody,a8 as MonitorsCheckboxes,aI as MonitorsIcons,as as NavigationButtons,N as NoDataFound,au as NotificationNote,da as Overlay,P as PageContent,bc as Popup,cd as PopupForm,ci as ScrollX,a_ as ScrollY,a6 as SectionTitle,a5 as Segment,bd as SelectionButton,b2 as SkeletonLoader,az as Status,bD as Stepper,d5 as TabList,aJ as TableContainer,aK as TableTitleWrap,aN as TableWrap,bN as Tag,a4 as Text,a9 as TextArea,a0 as Toggle,cg as ToggleCodeComponent,aB as Tooltip,aP as TraceLoader,U as UpgradeRequiredWrapper,be as VerticalScroll,d9 as WarningModal,d6 as getLinksFromText,d7 as getStrongsFromText,d8 as renderText}from"./chunks/ui-components-e057d958.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{al as ACTION_OPTIONS,ae as BUTTON_TEXTS,bo as DEFAULT_DATA_STREAM_NAME,bB as DESTINATION_CATEGORIES,bi as DISPLAY_LANGUAGES,H as DISPLAY_TITLES,av as FORM_ALERTS,bQ as INSTRUMENTATION_RULE_OPTIONS,cU as LANGUAGE_OPTIONS,bj as MONITORS_OPTIONS,bk as STORAGE_KEYS,cV as TOKEN_ABOUT_TO_EXPIRE}from"./chunks/ui-components-e057d958.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";
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { type FC, type Dispatch, type SetStateAction } from 'react';
|
|
2
|
-
import { type Connection } from '@/types';
|
|
2
|
+
import { type Connection, type ConnectionRemoteConfig } from '@/types';
|
|
3
3
|
import { DrawerProps } from '@/components/_v2';
|
|
4
4
|
export interface ConnectionConfigurationsFormData {
|
|
5
5
|
automaticRollout: boolean;
|
|
6
6
|
}
|
|
7
|
+
export type GetConnectionRemoteConfig = (id: string) => Promise<ConnectionRemoteConfig | undefined>;
|
|
7
8
|
export type ApplyConnectionsConfigurationsFunc = (connectionIds: string[], formData: ConnectionConfigurationsFormData) => Promise<{
|
|
8
9
|
error?: string;
|
|
9
10
|
}>;
|
|
10
11
|
export interface ConfigDrawerProps {
|
|
11
|
-
isOpen: boolean;
|
|
12
12
|
onClose: DrawerProps['header']['onClose'];
|
|
13
13
|
connections: Connection[];
|
|
14
14
|
selectedConnectionIds: string[];
|
|
15
15
|
setSelectedConnectionIds: Dispatch<SetStateAction<string[]>>;
|
|
16
|
+
getConnectionRemoteConfig: GetConnectionRemoteConfig;
|
|
16
17
|
onApply: ApplyConnectionsConfigurationsFunc;
|
|
17
18
|
}
|
|
18
19
|
export declare const CONFIG_DRAWER_WIDTH = "75vw";
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { type FC } from 'react';
|
|
2
2
|
import { CSSProperties } from 'styled-components';
|
|
3
3
|
import { type Connection } from '@/types';
|
|
4
|
-
import { type ApplyConnectionsConfigurationsFunc } from './config-drawer';
|
|
5
|
-
export { type ApplyConnectionsConfigurationsFunc, type ConnectionConfigurationsFormData } from './config-drawer';
|
|
4
|
+
import { type ApplyConnectionsConfigurationsFunc, GetConnectionRemoteConfig } from './config-drawer';
|
|
5
|
+
export { type ApplyConnectionsConfigurationsFunc, type ConnectionConfigurationsFormData, type GetConnectionRemoteConfig } from './config-drawer';
|
|
6
6
|
export interface CentralConnectionsProps {
|
|
7
7
|
tableRowsMaxHeight: CSSProperties['maxHeight'];
|
|
8
8
|
connections?: Connection[];
|
|
9
9
|
getConnections: () => Promise<Connection[]>;
|
|
10
10
|
onClickConnection: (connection: Connection) => void;
|
|
11
11
|
deleteConnection: (id: string) => Promise<void>;
|
|
12
|
+
getConnectionRemoteConfig: GetConnectionRemoteConfig;
|
|
12
13
|
applyConfigurations: ApplyConnectionsConfigurationsFunc;
|
|
13
14
|
}
|
|
14
15
|
export declare const CentralConnections: FC<CentralConnectionsProps>;
|
package/lib/containers/v2.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import e,{useState as t,useMemo as a,
|
|
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,d as c,D as d,e as u,f as g,h as p,i as b,T as m,j as y,k as h,O as f,l as v,m as w,n as C,o as k,L as x,p as $,a as R,q as A,P as L,b as P,g as I,S as D,B as S,r as V,s as z,t as M,v as O,c as T,w as j,I as N,x as E,y as U,z as W,A as F,E as q,G as H,U as Y}from"../chunks/ui-components-e057d958.js";import{ConnectionsIcon as G,OdigosLogo as K,RefreshIcon as B,SettingsIcon as J,DeleteIcon as Q,VIcon as X,XIcon as Z,PodIcon as _,ChevronUpIcon as ee,ChevronDownIcon as te,TerminalIcon as ae,VSquareIcon as le,XSquareIcon as oe,PipelineCollectorIcon as ne,DownloadIcon as ie,GatewayIcon as se,YamlIcon as re}from"../icons.js";import{Y as ce}from"../chunks/index-e3f25476.js";import{useOdigos as de}from"../contexts.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;
|
|
5
5
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
6
6
|
overflow: hidden;
|
|
7
|
-
`,
|
|
7
|
+
`,he=n.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
gap: 12px;
|
|
10
10
|
padding: 16px;
|
|
11
11
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
12
12
|
position: sticky;
|
|
13
13
|
top: 0;
|
|
14
|
-
`,
|
|
14
|
+
`,fe=n.div`
|
|
15
15
|
display: flex;
|
|
16
16
|
gap: 12px;
|
|
17
17
|
padding: 16px;
|
|
18
|
-
`,
|
|
18
|
+
`,ve=n(r)`
|
|
19
19
|
width: ${({$width:e})=>e};
|
|
20
20
|
gap: 12px;
|
|
21
21
|
justify-content: space-between;
|
|
22
|
-
`,
|
|
22
|
+
`,we=n.div`
|
|
23
23
|
display: flex;
|
|
24
24
|
flex-direction: column;
|
|
25
25
|
padding: 12px;
|
|
@@ -29,7 +29,7 @@ import e,{useState as t,useMemo as a,useCallback as l,useEffect as o}from"react"
|
|
|
29
29
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
30
30
|
overflow-y: auto;
|
|
31
31
|
overflow-x: hidden;
|
|
32
|
-
`,
|
|
32
|
+
`,Ce=n.div`
|
|
33
33
|
display: flex;
|
|
34
34
|
align-items: center;
|
|
35
35
|
gap: 12px;
|
|
@@ -46,7 +46,7 @@ import e,{useState as t,useMemo as a,useCallback as l,useEffect as o}from"react"
|
|
|
46
46
|
justify-content: flex-end;
|
|
47
47
|
gap: 16px;
|
|
48
48
|
padding: 0 24px;
|
|
49
|
-
`,
|
|
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,j]=t(!1),[N,E]=t(void 0),[U,W]=t(!1),[F,q]=t(void 0),{formData:H,handleFormChange:Y,areFormValuesEqual:B,resetFormData:J}=c({automaticRollout:!0}),Q=a(()=>s.length>1||void 0!==F&&!B(F,H),[s.length,F,H]);return l(()=>{1===s.length?(async e=>{if(U)return;W(!0);const t=await A(e);if(t){const e={automaticRollout:!t.rollout?.automaticRolloutDisabled};q(e),J(e)}W(!1)})(s[0]):q(void 0)},[s.length]),e.createElement(d,{isOpen:!0,hideOverlay:!0,width:me,header:{icon:G,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"},U?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:K,withGradient:!0,typographyProps:{size:y.XXS}}):N?e.createElement(m,{size:y.XXS,color:P.v2.colors.red[500]},N):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()=>{j(!0);const{error:e}=await L(s,H);j(!1),e?E(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",sortable:!0},{key:$e.Type,label:"Type",sortable:!0,textAlign:"right"},{key:$e.Status,label:"Status",sortable:!0},{key:$e.OdigosVersion,label:"Odigos Version",sortable:!0},{key:$e.ConnectedSince,label:"Connected Since",sortable:!0},{key:$e.LastActivity,label:"Last Activity",sortable:!0}],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,j]=t(!1),N=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?X: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:G,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:B,onClick:()=>k(),disabled:b}},{id:I(),type:D.Button,buttonProps:{variant:R.Primary,size:S.S,label:"Configurations",rightIcon:J,onClick:()=>j(!0)}}]},e.createElement(V,{variant:z.Pretty,maxHeight:n,isLoading:b,withCheckboxes:!0,columns:Re,rows:N,rowActionsPushRightPosition:T?`calc(${me} - 24px)`:void 0,getRowActions:({cells:e})=>[{id:I(),label:"Edit Configuration",rightIcon:J,onClick:async()=>{const t=e.find(e=>e.key===$e.Id)?.rawValue;t&&(O([t.toString()]),j(!0))}},{id:I(),label:"Delete Connection",rightIcon:Q,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:()=>j(!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;
|
|
@@ -58,10 +58,10 @@ import e,{useState as t,useMemo as a,useCallback as l,useEffect as o}from"react"
|
|
|
58
58
|
&:hover {
|
|
59
59
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
62
|
-
animation-name: ${
|
|
63
|
-
`,
|
|
61
|
+
`,Pe=n.div`
|
|
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:_,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:_,title:c.name,withCopyTitle:!0},e.createElement(r,{$gap:24},e.createElement(j,{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(N,{icon:g?ee:te})),g&&y.map(({id:t,items:a})=>e.createElement(Pe,{key:t},e.createElement(j,{cellsPerRow:2,items:a})))))),e.createElement(P,{icon:ae,title:"Kubectl Commands"},e.createElement(r,{$gap:12},e.createElement(E,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),e.createElement(E,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),e.createElement(E,{value:`kubectl logs ${c.name} -n ${c.namespace}`}))),e.createElement(ce,{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",sortable:!0},{key:De.Ready,label:"Ready",sortable:!0,textAlign:"right"},{key:De.Started,label:"Started",sortable:!0,textAlign:"right"},{key:De.Status,label:"Status",sortable:!0},{key:De.Restarts,label:"Restarts",sortable:!0,textAlign:"right"},{key:De.NodeName,label:"Node Name",sortable:!0},{key:De.Age,label:"Age",sortable:!0,textAlign:"right"},{key:De.DockerImage,label:"Docker Image",sortable:!0,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(le,{fill:U(r,p.Success,"500"),size:20}):e.createElement(oe,{fill:U(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:_,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
|
-
`,
|
|
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(ne,{size:32}),e.createElement(m,{size:y.M,weight:500},"Pipeline Collectors")),e.createElement(W,{options:Me,selected:t,setSelected:a,disabled:i})),e.createElement(b,{$gap:8},l&&e.createElement($,{label:"Download Diagnose",leftIcon:ie,size:S.S,variant:R.Text,onClick:l,disabled:i}),o&&e.createElement($,{label:"Refresh",leftIcon:B,size:S.S,variant:R.Text,onClick:o,loading:n,disabled:i}))),je=({isOpen:t,onClose:a,title:l,yaml:o})=>e.createElement(d,{isOpen:t,header:{icon:se,title:l,onClose:a}},e.createElement(ce,{yaml:o}));var Ne;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Ne||(Ne={}));const Ee=({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:Ne.ManifestYaml,label:l,icon:re},{id:Ne.ConfigMapYaml,label:"ConfigMap",icon:re}]}]},e.createElement(b,{$gap:16},e.createElement(F,{...n}),i.map(t=>e.createElement(q,{key:t.title,...t}))),e.createElement(je,{isOpen:c===Ne.ManifestYaml,onClose:()=>d(null),title:l,yaml:s}),e.createElement(je,{isOpen:c===Ne.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:r}))},Ue=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"}},We=({tableRowsMaxHeight:n,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:r,getNodeCollectorPods:c,getExtendedPodInfo:d})=>{const{formatTimeAgo:u}=A(),{isVersionSupported:g,version:b}=de(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:B,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...":Ue(H.Unknown);switch(e){case ze.Gateway:o=t?.status?O(t?.status):o,n=t?.status??n,i=t?.status?Ue(t.status):i;break;case ze.Node:o=a?.status?O(a?.status):o,n=a?.status??n,i=a?.status?Ue(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]),j=a(()=>(h===ze.Gateway?w?.configMapYAML:$?.configMapYAML)??"",[w,$,h]),N=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(Y,null,e.createElement(Ee,{icon:se,title:S,badge:V,statusCard:z,textCards:M,manifestYaml:T,configMapYaml:j}),e.createElement(Ve,{isLoading:m,tableRowsMaxHeight:n,pods:N,getExtendedPodInfo:d}),!g&&e.createElement(be,{minSupportedVersion:1.12,currentVersion:b||""})))};export{Ae as CentralConnections,We as PipelineCollectors};
|