@odigos/ui-kit 0.0.211 → 0.0.213
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 +22 -0
- package/lib/chunks/index-Bh2gKc3b.js +3 -0
- package/lib/chunks/ui-components-BliHHDta.js +2388 -0
- package/lib/chunks/vendor-C150cdxb.js +1 -0
- package/lib/components/_v2/badge/index.d.ts +2 -0
- package/lib/components/_v2/cards/section-card/index.d.ts +1 -0
- package/lib/components/_v2/checkbox/index.d.ts +5 -1
- package/lib/components/_v2/field-message/index.d.ts +1 -0
- package/lib/components/_v2/field-title/index.d.ts +2 -0
- package/lib/components/_v2/index.d.ts +1 -0
- package/lib/components/_v2/input/index.d.ts +4 -3
- package/lib/components/_v2/input-list/index.d.ts +5 -3
- package/lib/components/_v2/input-table/index.d.ts +5 -3
- package/lib/components/_v2/stepper/index.d.ts +11 -0
- package/lib/components/_v2/textarea/index.d.ts +4 -3
- package/lib/components/_v2/toggle/index.d.ts +5 -1
- package/lib/components/styled.d.ts +3 -6
- package/lib/components/tooltip/index.d.ts +1 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants/destinations/index.d.ts +5 -0
- package/lib/constants/strings/index.d.ts +12 -0
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/_drawers/add-action-drawer/index.d.ts +2 -2
- package/lib/containers/_v2/_drawers/add-destination-drawer/form-column/index.d.ts +4 -7
- package/lib/containers/_v2/_drawers/add-destination-drawer/helpers.d.ts +1 -9
- package/lib/containers/_v2/_drawers/add-destination-drawer/index.d.ts +10 -5
- package/lib/containers/_v2/_drawers/add-destination-drawer/lists-column/index.d.ts +3 -5
- package/lib/containers/_v2/_drawers/add-destination-drawer/types.d.ts +1 -6
- package/lib/containers/_v2/_drawers/add-rule-drawer/index.d.ts +3 -3
- package/lib/containers/_v2/_drawers/add-source-drawer/index.d.ts +7 -5
- package/lib/containers/_v2/_drawers/add-source-drawer/namespaces-column/index.d.ts +2 -1
- package/lib/containers/_v2/_drawers/add-source-drawer/namespaces-column/list/index.d.ts +1 -0
- package/lib/containers/_v2/_drawers/add-source-drawer/types.d.ts +3 -0
- package/lib/containers/_v2/_drawers/add-source-drawer/workloads-column/index.d.ts +2 -1
- package/lib/containers/_v2/_forms/add-action-form/context.d.ts +18 -0
- package/lib/containers/_v2/_forms/add-action-form/index.d.ts +2 -6
- package/lib/containers/_v2/_forms/add-destination-form/context.d.ts +36 -0
- package/lib/containers/_v2/_forms/add-destination-form/dynamic-fields/index.d.ts +1 -0
- package/lib/containers/_v2/_forms/add-destination-form/index.d.ts +4 -5
- package/lib/containers/_v2/_forms/add-rule-form/context.d.ts +18 -0
- package/lib/containers/_v2/_forms/add-rule-form/index.d.ts +2 -6
- package/lib/containers/_v2/_forms/add-source-form/context.d.ts +21 -0
- package/lib/containers/_v2/_forms/add-source-form/index.d.ts +1 -0
- package/lib/containers/_v2/_forms/index.d.ts +1 -0
- package/lib/containers/_v2/central-connections/index.d.ts +2 -1
- package/lib/containers/_v2/index.d.ts +1 -0
- package/lib/containers/_v2/onboarding/background/index.d.ts +7 -0
- package/lib/containers/_v2/onboarding/get-started/index.d.ts +5 -0
- package/lib/containers/_v2/onboarding/index.d.ts +14 -0
- package/lib/containers/_v2/onboarding/summary/index.d.ts +12 -0
- package/lib/containers/_v2/pipeline-collectors/general-info/yaml-drawer/index.d.ts +1 -1
- package/lib/containers/v2.js +91 -30
- package/lib/containers.js +131 -131
- package/lib/contexts.js +1 -1
- package/lib/functions/deep-values/index.d.ts +2 -0
- package/lib/functions/index.d.ts +1 -0
- package/lib/functions.js +1 -1
- package/lib/hooks/useGenericForm.d.ts +2 -0
- package/lib/hooks.js +1 -1
- package/lib/icons.js +1 -1
- package/lib/snippets/_v2/index.d.ts +1 -0
- package/lib/snippets/_v2/odigos-logo-text-by-tier/index.d.ts +5 -0
- package/lib/snippets/_v2/wide-drawer/column-list-item/index.d.ts +1 -0
- package/lib/snippets/_v2/yaml-section-card/index.d.ts +1 -0
- 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 +307 -3
- package/lib/types/destinations/index.d.ts +9 -8
- package/lib/types/snapshot/index.d.ts +4 -4
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +28 -28
- package/lib/chunks/index-BURQQLWb.js +0 -3
- package/lib/chunks/ui-components-B5U474B5.js +0 -2387
- package/lib/chunks/vendor-D99eCWta.js +0 -1
- package/lib/containers/_v2/_drawers/add-action-drawer/helpers.d.ts +0 -7
- package/lib/containers/_v2/_drawers/add-rule-drawer/helpers.d.ts +0 -7
package/lib/containers/v2.js
CHANGED
|
@@ -1,96 +1,103 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,Fragment as n,useState as o,useRef as i,forwardRef as r,useImperativeHandle as s,useMemo as c,Children as d,useCallback as u}from"react";import p,{useTheme as h}from"styled-components";import{A as m,F as g,a as b,C as f,b as C,I as y,c as v,i as k,d as w,K as S,T as $,e as x,f as I,D as N,g as T,B as A,h as D,j as O,k as V,l as F,W as R,m as M,M as P,V as L,S as E,n as z,N as j,o as q,L as H,p as K,R as B,q as W,r as _,s as G,t as J,u as U,v as Y,w as X,x as Z,y as Q,z as ee,E as te,G as le,H as ae,J as ne,O as oe,P as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as pe,$ as he,a0 as me,a1 as ge,a2 as be,a3 as fe,a4 as Ce,a5 as ye,a6 as ve,a7 as ke,a8 as we,a9 as Se,aa as $e,ab as xe,ac as Ie,ad as Ne,ae as Te,af as Ae,ag as De,ah as Oe,ai as Ve,aj as Fe,ak as Re,al as Me,am as Pe,an as Le,ao as Ee,ap as ze,aq as je,ar as qe,as as He,at as Ke,au as Be,av as We,aw as _e,ax as Ge,ay as Je,az as Ue,aA as Ye,aB as Xe,aC as Ze,aD as Qe,aE as et,aF as tt,aG as lt,aH as at,aI as nt,aJ as ot,aK as it,aL as rt,aM as st,aN as ct,aO as dt,aP as ut,aQ as pt,aR as ht,aS as mt}from"../chunks/ui-components-B5U474B5.js";import{TrashIcon as gt,PlusIcon as bt,VSquareIcon as ft,OdigosLogo as Ct,ArrowLeftIcon as yt,ArrowRightIcon as vt,BookIcon as kt,XSquareIcon as wt,GoLogo as St,JavaLogo as $t,ChevronRightIcon as xt,ActionIcon as It,DestinationIcon as Nt,ChevronUpIcon as Tt,ChevronDownIcon as At,InstrumentationRuleIcon as Dt,SourceIcon as Ot,SettingsIcon as Vt,XIcon as Ft,VIcon as Rt,EditIcon as Mt,ExclamationTriangleIcon as Pt,ExclamationCircleIcon as Lt,KeyIcon as Et,DiagnoseIcon as zt,DownloadIcon as jt,TerminalIcon as qt,DeleteIcon as Ht,RefreshIcon as Kt,ConnectionsIcon as Bt,PodIcon as Wt,ArrowDownSquareIcon as _t,ArrowUpSquareIcon as Gt,PipelineCollectorIcon as Jt,GatewayIcon as Ut,YamlIcon as Yt}from"../icons.js";import{Y as Xt}from"../chunks/index-BURQQLWb.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-D99eCWta.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Zt=[{id:"CREDIT_CARD",label:"Credit card"}],Qt=[{id:m.CollectContainerAttributes,label:"Collect container attributes"},{id:m.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:m.CollectWorkloadId,label:"Collect workload ID"},{id:m.CollectClusterId,label:"Collect cluster ID"}],el=[{id:S.Pod,label:S.Pod},{id:S.Namespace,label:S.Namespace},{id:S.Node,label:S.Node}],tl=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:el}],ll=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:el}],al=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:v.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:v.Number}],nl=m.UrlTemplatizationRulesGroups,ol=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],il=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:v.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:v.Number}],rl=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:v.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:V.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:V.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],sl={[F.K8sAttributes]:({value:n,setValue:o,formErrors:i})=>(a(()=>{n[m.CollectContainerAttributes]||n[m.CollectReplicaSetAttributes]||n[m.CollectWorkloadId]||n[m.CollectClusterId]||n[m.LabelsAttributes]?.length||n[m.AnnotationsAttributes]?.length||(o(m.CollectContainerAttributes,!0),o(m.CollectReplicaSetAttributes,!0),o(m.CollectWorkloadId,!0),o(m.CollectClusterId,!0),o(m.LabelsAttributes,[]),o(m.AnnotationsAttributes,[]))},[]),e(l,{children:[t(g,{$gap:6,children:Qt.map(({id:l,label:a})=>e(g,{children:[t(f,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(C,{errorMessage:i[l]})]},l))}),t(w,{label:"Label attributes",limitFieldsPerRow:2,columns:tl,values:n[m.LabelsAttributes]||[],setValues:e=>o(m.LabelsAttributes,e),errorMessage:i[m.LabelsAttributes]}),t(w,{label:"Annotation attributes",limitFieldsPerRow:2,columns:ll,values:n[m.AnnotationsAttributes]||[],setValues:e=>o(m.AnnotationsAttributes,e),errorMessage:i[m.AnnotationsAttributes]})]})),[F.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t($,{label:"Overwrite existing values",labelAlign:x.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[m.OverwriteExistingValues]||!1,onChange:e=>n(m.OverwriteExistingValues,e)}),t(w,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[m.ClusterAttributes]||[],setValues:e=>n(m.ClusterAttributes,e),errorMessage:o[m.ClusterAttributes]})]})},[F.DeleteAttributes]:({value:e,setValue:l,formErrors:a})=>t(I,{label:"Attributes to delete",values:e[m.AttributeNamesToDelete]||[],setValues:e=>l(m.AttributeNamesToDelete,e),errorMessage:a[m.AttributeNamesToDelete]}),[F.RenameAttributes]:({value:e,setValue:l,formErrors:a})=>t(w,{label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[m.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(m.Renames,t)},errorMessage:a[m.Renames]}),[F.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[m.PiiCategories]?.length||n(m.PiiCategories,Zt.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Zt.map(({id:e,label:a})=>t(f,{label:a,value:l[m.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[m.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(m.PiiCategories,o)}},e))}),t(C,{errorMessage:o[m.PiiCategories]})]})),[F.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.FallbackSamplingRatio],o=k(e[m.FallbackSamplingRatio])?"":String(e[m.FallbackSamplingRatio]);return t(y,{label:"Fallback sampling ratio",type:v.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[F.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.SamplingPercentage],o=k(e[m.SamplingPercentage])?"":String(e[m.SamplingPercentage]);return t(y,{label:"Sampling percentage",type:v.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(m.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[F.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.EndpointsFilters],o=e[m.EndpointsFilters]||[];return t(w,{limitFieldsPerRow:2,columns:al,values:o,setValues:e=>{l(m.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:l,fallbackSamplingRatio:a})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(l),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[F.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.ServicesNameFilters],o=e[m.ServicesNameFilters]||[];return t(w,{limitFieldsPerRow:2,columns:il,values:o,setValues:e=>{l(m.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:l})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(l)})))},errorMessage:n})},[F.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[m.AttributeFilters],o=(e[m.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a})=>{const n=Object.entries(a).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:n,operation:a[n]?.operation,expectedValue:a[n]?.expectedValue,jsonPath:a[n]?.jsonPath}});return t(w,{limitFieldsPerRow:2,columns:rl,values:o,setValues:e=>{l(m.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:l,condition:a,operation:n,expectedValue:o,jsonPath:i})=>{const r={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(l),condition:{[a]:{operation:n,expectedValue:o}}};return i&&(r.condition[a].jsonPath=i),r}))},errorMessage:n})},[F.URLTemplatization]:({value:a,setValue:o,formErrors:i})=>{const r=h(),s=a[nl]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(nl,e),d=(e,t)=>c(s.map((l,a)=>a===e?{...l,...t}:l));return e(l,{children:[s.map((l,a)=>e(n,{children:[t(N,{}),e(g,{$gap:12,children:[e(T,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${a+1}`}),t(A,{leftIcon:()=>t(gt,{fill:r.v2.colors.red[500]}),variant:O.Secondary,size:D.S,onClick:()=>{return e=a,c(s.filter((t,l)=>l!==e));var e},disabled:1===s.length})]}),t(y,{label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:l.filterK8sNamespace||"",onChange:e=>d(a,{filterK8sNamespace:e.target.value})}),t(w,{label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:ol,values:l.workloadFilters||[],setValues:e=>d(a,{workloadFilters:e})}),t(I,{label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:l.templatizationRules.map(e=>e.template),setValues:e=>d(a,{templatizationRules:e.map(e=>({template:e}))})})]}),t(C,{errorMessage:i[nl]})]},`url-templatization-group-${a}`)),t(A,{variant:O.Secondary,label:"Add rule group",leftIcon:bt,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(N,{})]})}},cl=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=sl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},dl=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(R,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:e,onClose:l,onDeny:a,denyLabel:"Keep editing",onApprove:n,approveLabel:"Discard changes"}),ul=({isOpen:e,onClose:l,onDeny:a,onApprove:n,action:o="delete",target:i})=>{const r=o.charAt(0).toUpperCase()+o.substring(1),s=i?.endsWith("s")?"these":"this";return t(R,{title:`${r}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${s} ${i}`:""}?`,isOpen:e,onClose:l,onDeny:a,denyLabel:"Go back",onApprove:n,approveLabel:r})},pl=(e,t)=>!t?.length||!!t?.find(t=>t===e),hl=({title:l="Signals",required:n,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d,disabled:u})=>{const[p,h]=o(1===c.length),m=i(JSON.stringify(c));return a(()=>{const e=M(c);e.length||P.forEach(({id:t})=>{pl(t,s)&&e.push(t)});const t=JSON.stringify(e);m.current!==t&&(m.current=t,d(e),h(1===e.length))},[s,c]),e(g,{$gap:12,children:[t(b,{label:l,required:n}),t(T,{$gap:12,children:P.map(e=>{const l=pl(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(f,{label:e.value,disabled:u||!l||p&&a,value:a,onChange:t=>((e,t)=>{const l=e,a=t?[...c,l]:c.filter(e=>e!==l);d(a),h(1===a.length)})(e.id,t)},e.id):null})}),t(C,{errorMessage:r})]})},ml=({minSupportedVersion:e,currentVersion:l})=>t(R,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>t(L,{scale:2.4,icon:()=>t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:t("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${e} or later.\nCurrent version: ${l}.`}),gl=p.div`
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{useState as n,useRef as l,useEffect as o,forwardRef as i,useImperativeHandle as s,Fragment as r,useCallback as c,useContext as d,createContext as u,useMemo as p,Children as m}from"react";import h,{useTheme as g}from"styled-components";import{W as b,u as f,T as v,d as y,M as C,F as S,a as k,b as w,C as D,c as I,V as N,S as T,e as A,N as x,D as $,L as E,f as R,R as O,g as F,h as M,i as L,B as P,j as V,k as _,l as B,A as U,I as z,m as X,n as j,o as G,K as H,p as W,q,r as K,s as Y,t as J,v as Q,w as Z,x as ee,y as te,z as ae,E as ne,G as le,H as oe,J as ie,O as se,P as re,Q as ce,U as de,X as ue,Y as pe,Z as me,_ as he,$ as ge,a0 as be,a1 as fe,a2 as ve,a3 as ye,a4 as Ce,a5 as Se,a6 as ke,a7 as we,a8 as De,a9 as Ie,aa as Ne,ab as Te,ac as Ae,ad as xe,ae as $e,af as Ee,ag as Re,ah as Oe,ai as Fe,aj as Me,ak as Le,al as Pe,am as Ve,an as _e,ao as Be,ap as Ue,aq as ze,ar as Xe,as as je,at as Ge,au as He,av as We,aw as qe,ax as Ke,ay as Ye,az as Je,aA as Qe,aB as Ze,aC as et,aD as tt,aE as at,aF as nt,aG as lt,aH as ot,aI as it,aJ as st,aK as rt,aL as ct,aM as dt,aN as ut,aO as pt,aP as mt,aQ as ht,aR as gt,aS as bt,aT as ft,aU as vt}from"../chunks/ui-components-BliHHDta.js";import{OdigosLogoTextEnterprise as yt,OdigosLogoTextCommunity as Ct,VSquareIcon as St,OdigosLogo as kt,ArrowLeftIcon as wt,ArrowRightIcon as Dt,ChevronRightIcon as It,TrashIcon as Nt,PlusIcon as Tt,BookIcon as At,XSquareIcon as xt,DeleteIcon as $t,EditIcon as Et,GoLogo as Rt,JavaLogo as Ot,ActionIcon as Ft,DestinationIcon as Mt,ChevronUpIcon as Lt,ChevronDownIcon as Pt,VIcon as Vt,XIcon as _t,InstrumentationRuleIcon as Bt,SourceIcon as Ut,SettingsIcon as zt,ExclamationTriangleIcon as Xt,ExclamationCircleIcon as jt,KeyIcon as Gt,DiagnoseIcon as Ht,DownloadIcon as Wt,TerminalIcon as qt,RefreshIcon as Kt,ConnectionsIcon as Yt,PodIcon as Jt,ArrowDownSquareIcon as Qt,ArrowUpSquareIcon as Zt,PipelineCollectorIcon as ea,GatewayIcon as ta,YamlIcon as aa}from"../icons.js";import{Y as na}from"../chunks/index-Bh2gKc3b.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const la=({isOpen:t,onClose:a,onDeny:n,onApprove:l})=>e(b,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:a,onDeny:n,denyLabel:"Keep editing",onApprove:l,approveLabel:"Discard changes"}),oa=({isOpen:t,onClose:a,onDeny:n,onApprove:l,action:o="delete",target:i})=>{const s=o.charAt(0).toUpperCase()+o.substring(1),r=i?.endsWith("s")?"these":"this";return e(b,{title:`${s}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${r} ${i}`:""}?`,isOpen:t,onClose:a,onDeny:n,denyLabel:"Go back",onApprove:l,approveLabel:s})},ia=({size:t=200})=>{const{tier:a}=f();return a===v.Onprem?e(yt,{size:t}):e(Ct,{size:t})},sa=(e,t)=>!t?.length||!!t?.find(t=>t===e),ra=({title:a="Signals",required:i,errorMessage:s,allowedSignals:r,selectedSignals:c,setSelectedSignals:d,disabled:u})=>{const[p,m]=n(1===c.length),h=l(JSON.stringify(c));o(()=>{const e=y(c);e.length||C.forEach(({id:t})=>{sa(t,r)&&e.push(t)});const t=JSON.stringify(e);h.current!==t&&(h.current=t,d(e),m(1===e.length))},[r,c]);return t(S,{$gap:12,children:[e(k,{label:a,required:i}),e(w,{$gap:12,children:C.map(t=>{const a=sa(t.id,r),n=((e,t)=>!!t?.find(t=>t===e))(t.id,c);return a?e(D,{label:t.value,disabled:u||!a||p&&n,value:n,onChange:e=>((e,t)=>{const a=e,n=t?[...c,a]:c.filter(e=>e!==a);d(n),m(1===n.length)})(t.id,e)},t.id):null})}),e(I,{errorMessage:s})]})},ca=({minSupportedVersion:t,currentVersion:a})=>e(b,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(N,{scale:2.4,icon:()=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:e("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${t} or later.\nCurrent version: ${a}.`}),da=h.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
justify-content: flex-end;
|
|
5
5
|
width: ${({$width:e})=>e};
|
|
6
6
|
gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
|
|
7
|
-
`,
|
|
7
|
+
`,ua=h.div`
|
|
8
8
|
display: flex;
|
|
9
9
|
align-items: center;
|
|
10
10
|
min-height: 24px;
|
|
11
11
|
padding: 12px;
|
|
12
12
|
border-radius: 16px 16px 0 0;
|
|
13
13
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
14
|
-
`,
|
|
14
|
+
`,pa=h.div`
|
|
15
15
|
display: flex;
|
|
16
16
|
flex-direction: column;
|
|
17
17
|
gap: ${({$gap:e})=>e}px;
|
|
18
18
|
padding: 12px 12px 0 12px;
|
|
19
19
|
width: calc(100% - 24px);
|
|
20
20
|
height: ${({$heightOffset:e,$columnHasHeader:t})=>`calc(100vh - 180px - ${e}px ${t?"- 48px":""})`};
|
|
21
|
-
border-radius: ${({$columnHasHeader:e,$isLeft:t,$isRight:
|
|
21
|
+
border-radius: ${({$columnHasHeader:e,$isLeft:t,$isRight:a})=>e?t?"0 0 0 16px":a?"0 16px 0 0":"0":t?"16px 0 0 16px":a?"0 16px 16px 0":"16px"};
|
|
22
22
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
23
23
|
overflow-y: auto;
|
|
24
24
|
overflow-x: hidden;
|
|
25
|
-
`,
|
|
25
|
+
`,ma=({isLeft:n,isRight:l,heightOffset:o=0,width:i,header:s,list:r})=>t(da,{$width:i,$columnHasHeader:!!s,children:[s&&e(ua,{children:s}),e(pa,{$gap:8,$isLeft:n,$isRight:l,$heightOffset:o,$columnHasHeader:!!s,children:r.length?r.length>1?e(T,{gap:8,elements:r}):e(a,{children:r[0]}):e(A,{$height:"100%",children:e(x,{})})})]}),ha="75vw",ga=h.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
flex-direction: column;
|
|
28
28
|
border-radius: 16px;
|
|
29
29
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
30
30
|
overflow: hidden;
|
|
31
|
-
`,
|
|
31
|
+
`,ba=h.div`
|
|
32
32
|
display: flex;
|
|
33
33
|
gap: 12px;
|
|
34
34
|
padding: 16px 16px 0 16px;
|
|
35
35
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
36
36
|
position: sticky;
|
|
37
37
|
top: 0;
|
|
38
|
-
`,
|
|
38
|
+
`,fa=h.div`
|
|
39
39
|
padding: 12px 12px 0 12px;
|
|
40
|
-
`,
|
|
40
|
+
`,va=h.div`
|
|
41
41
|
display: flex;
|
|
42
42
|
gap: 12px;
|
|
43
43
|
padding: 16px;
|
|
44
|
-
|
|
44
|
+
`,ya=h.div`
|
|
45
45
|
padding: 5vh 10vw;
|
|
46
46
|
border-radius: 12px;
|
|
47
47
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
48
|
-
`,
|
|
48
|
+
`,Ca=h.div`
|
|
49
49
|
display: flex;
|
|
50
50
|
align-items: center;
|
|
51
51
|
justify-content: flex-end;
|
|
52
52
|
gap: 16px;
|
|
53
53
|
padding: 0 12px;
|
|
54
54
|
margin-top: auto;
|
|
55
|
-
`,Il=r(({isOpen:l,onClose:a,onBack:n,onNext:i,nextIsSkip:r,onSave:c,disableSave:d,connectionIds:u,header:p,subHeader:h,leftColumn:m,rightColumn:g,search:b,filters:f,errorMessage:C,isFormDirty:y,hideDirtyNote:v,isFetching:k,progress:w},S)=>{const[$,x]=o(!1),[I,N]=o(!1),[D,V]=o(void 0);s(S,()=>({clearErrors:()=>V(void 0)}));const F=I,R=()=>{y&&!$?x(!0):(x(!1),a?.())},M=d||I||"boolean"==typeof y&&!y,P=!!b||!!u||!!f,L=!!h,E=(P?48:0)+(L?50:0);return e(q,{width:yl,isOpen:l,hideOverlay:!I,header:{...p,onClose:a?R:void 0,onCloseDisabled:F},children:[I?t(z,{$height:"calc(100vh - 136px)",children:t($l,{children:t(H,{titleSize:K.S,subTitleSize:K.XXXS,withGradient:!0,withSpinner:!0,...w})})}):e(vl,{children:[P&&e(kl,{children:[u&&t(B,{icon:ft,title:"Selected Clusters",badge:{label:u.value.length}}),b&&t(W,{width:"100%",...b}),f]}),L&&t(wl,{children:t(B,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),e(Sl,{children:[t(Cl,{isLeft:!0,heightOffset:E,...m}),t(Cl,{isRight:!0,heightOffset:E,...g})]})]}),e(xl,{children:[k?t(H,{icon:Ct,title:"Fetching Data...",titleSize:K.XXS,withGradient:!0}):I?w?null:t(H,{icon:Ct,title:"Saving Changes...",titleSize:K.XXS,withGradient:!0}):D||C?t(_,{fullWidth:!0,status:G.Error,message:D||C}):"boolean"==typeof y&&y&&!v?t(_,{fullWidth:!0,status:G.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof y||y||v?null:t(_,{fullWidth:!0,status:G.Success,message:"The values reflect the current configuration of the selected cluster."}),e(T,{$gap:8,children:[t("div",n?{style:{width:"150px"},children:t(A,{fullWidth:!0,variant:O.Secondary,label:"Back",leftIcon:yt,onClick:n})}:{style:{width:"150px"},children:t(A,{fullWidth:!0,variant:O.Secondary,label:"Cancel",onClick:R,disabled:F})}),t("div",i?{style:{width:"150px"},children:t(A,r?{fullWidth:!0,variant:O.Secondary,label:"Skip",rightIcon:vt,onClick:i}:{fullWidth:!0,variant:O.Primary,label:"Next",rightIcon:vt,onClick:i})}:{style:{width:"150px"},children:t(A,{fullWidth:!0,variant:O.Primary,label:"Save",onClick:async()=>{N(!0);const e=await c();N(!1),e?.error?V(e.error):(u?.setValue([]),a?.())},disabled:M})})]})]}),t(dl,{isOpen:$,onClose:()=>x(!1),onApprove:R})]})});Il.displayName=Il.name;const Nl=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(A,{label:"Docs",leftIcon:kt,variant:O.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:ft,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(hl,{title:"Signals for processing",allowedSignals:l.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>n("signals",e),errorMessage:o.signals}),t(y,{label:"Action name",placeholder:"Use a name that describes the action...",value:a.name||"",onChange:({target:{value:e}})=>n("name",e),errorMessage:o.name}),t(cl,{actionType:l.type,value:a.fields,setValue:(e,t)=>n(`fields.${e}`,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes||"",onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},Tl=({signals:l,fields:a,formData:n,handleFormChange:o,formErrors:i})=>a?.map(({renderCondition:a,componentType:r,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:b})=>{if(a&&!Z(a,l,n.fields))return null;const v=c,k=n.fields.find(e=>e.key===v),S=k?k.value:h;switch(r){case V.Input:return t(y,{name:v,type:s,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case V.MultiInput:return t(I,{label:d,tooltip:u,required:m,placeholder:p,values:ee(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case V.KeyValuePair:return t(w,{label:d,tooltip:u,required:m,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:ee(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case V.TextArea:return t(X,{name:v,label:d,tooltip:u,required:m,placeholder:p,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case V.Checkbox:return e(g,{children:[t(f,{label:d,value:"true"==S,onChange:e=>o(v,e.toString())}),t(C,{errorMessage:i[v]})]},v);case V.Dropdown:return t(Q,{name:v,label:d,withSearch:!0,values:S?[S]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>o(v,e[0]),errorMessage:i[v]},v);default:return null}}),Al=({option:l,dynamicFields:n,formData:o,handleFormChange:i,formErrors:r})=>{const s=h();return a(()=>{const e=n.map(e=>({key:e.name,value:e.value}));i("fields",e);const t=te(l.supportedSignals),a={logs:t.includes(le.Logs),metrics:t.includes(le.Metrics),traces:t.includes(le.Traces)};i("exportedSignals",a)},[n]),e(g,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(A,{label:"Docs",leftIcon:kt,variant:O.Text,size:D.S,onClick:()=>window.open(`${U}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(Y,{options:[{icon:ft,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(hl,{title:"This connection will monitor:",allowedSignals:te(l.supportedSignals),selectedSignals:ae(o.exportedSignals),setSelectedSignals:e=>i("exportedSignals",{logs:e.includes(le.Logs),metrics:e.includes(le.Metrics),traces:e.includes(le.Traces)}),errorMessage:r.exportedSignals}),t(y,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:o.name,onChange:({target:{value:e}})=>i("name",e),errorMessage:r.name}),t(Tl,{signals:ae(o.exportedSignals),fields:n,formData:o,handleFormChange:(e,t)=>{i("fields",o.fields.map(l=>l.key===e?{...l,value:t}:l))},formErrors:r})]})},Dl=[{id:ne.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:ne.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:ne.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Ol=[{id:ne.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:ne.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:ne.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Vl=["*"],Fl=[{id:re.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:re.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:re.DbQuery,label:"Collect DB query",tooltip:""},{id:re.Messaging,label:"Collect messaging",tooltip:""}],Rl={[de.Java]:[new ce("","")],[de.Golang]:[new se("")]},Ml={[ue.CodeAttributes]:({value:n,setValue:o,formErrors:i})=>{const r=h(),s=i.codeAttributes,d=c(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);a(()=>{if(!d.length&&!s){const e={[ne.FilePath]:!0,[ne.Function]:!0,[ne.LineNumber]:!0,[ne.Column]:null,[ne.Namespace]:null,[ne.StackTrace]:null};o("codeAttributes",e)}},[]);const u=(e,t)=>{const l=t?[...d,e]:d.filter(t=>t!==e),a=Object.values(ne).reduce((e,t)=>(e[t]=!!l.includes(t)||null,e),{});o("codeAttributes",a)};return e(l,{children:[e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:Dl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]}),e(g,{$gap:12,children:[t(J,{size:K.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:Ol.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(C,{errorMessage:s})]})]})},[ue.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,s=c(()=>(n?.customInstrumentations?.[de.Golang]||[]).map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=c(()=>(n?.customInstrumentations?.[de.Java]||[]).map(e=>new ce(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[de.Golang]:Rl[de.Golang],[de.Java]:Rl[de.Java]})},[]),e(l,{children:[e(g,{children:[e(T,{$gap:8,children:[t(St,{}),t(b,{label:"Golang custom probes"})]}),t(w,{columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:s,setValues:e=>{const t={};t[de.Golang]=e.map(e=>new se(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[de.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(g,{children:[e(T,{$gap:8,children:[t($t,{}),t(b,{label:"Java custom probes"})]}),t(w,{columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[de.Golang]=s,t[de.Java]=e.map(e=>new ce(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ue.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=c(()=>e?.headersCollection?.[ie.HeaderKeys]||[],[e]),r=e=>{const t={[ie.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(Vl)},[]),t(I,{label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:r,errorMessage:o})},[ue.PayloadCollection]:({value:l,setValue:n,formErrors:o})=>{const i=h(),r=o.payloadCollection,s=c(()=>Object.entries(l.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[l]);return a(()=>{if(!s.length&&!r){const e={[re.HttpRequest]:{},[re.HttpResponse]:{},[re.DbQuery]:{},[re.Messaging]:{}};n("payloadCollection",e)}},[]),e(g,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:Fl.map(({id:e,label:l,tooltip:a})=>t(oe,{text:a,withIcon:!0,children:t(f,{label:l,value:s.includes(e),onChange:t=>((e,t)=>{const l=t?[...s,e]:s.filter(t=>t!==e),a={[re.HttpRequest]:l.includes(re.HttpRequest)?{}:null,[re.HttpResponse]:l.includes(re.HttpResponse)?{}:null,[re.DbQuery]:l.includes(re.DbQuery)?{}:null,[re.Messaging]:l.includes(re.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(C,{errorMessage:r})]})},[ue.UnknownType]:null},Pl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Ml[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Ll=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(T,{$gap:12,$justifyContent:"space-between",children:[t(J,{size:K.XXS,children:l.docsDescription}),t(A,{label:"Docs",leftIcon:kt,variant:O.Text,size:D.S,onClick:()=>window.open(`${U}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(T,{$gap:12,children:[t(J,{size:K.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),l.supportedLanguages.map(e=>t(pe,{label:he[e],leftIcon:me(e),status:G.Default,useSecondaryTone:!0},e))]}),t(Y,{options:[{icon:ft,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(y,{label:"Rule name",placeholder:"Use a name that describes the rule...",value:a.ruleName,onChange:({target:{value:e}})=>n("ruleName",e),errorMessage:o.ruleName}),t(Pl,{ruleType:l.type,value:a,setValue:(e,t)=>n(e,t),formErrors:o}),t(X,{label:"Notes",placeholder:"Your personal notes...",value:a.notes,onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},El={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},zl=p.div`
|
|
55
|
+
`,Sa=i(({isOpen:a,onClose:l,onBack:o,onNext:i,nextIsSkip:r,onSave:c,disableSave:d,connectionIds:u,header:p,subHeader:m,leftColumn:h,rightColumn:g,search:b,filters:f,errorMessage:v,isFormDirty:y,hideDirtyNote:C,isFetching:S,progress:k},D)=>{const[I,N]=n(!1),[T,x]=n(!1),[_,B]=n(void 0);s(D,()=>({clearErrors:()=>B(void 0)}));const U=T,z=()=>{y&&!I?N(!0):(N(!1),l?.())},X=d||T||"boolean"==typeof y&&!y,j=!!b||!!u||!!f,G=!!m,H=(j?48:0)+(G?50:0);return t($,{width:ha,isOpen:a,hideOverlay:!T,header:{...p,onClose:l?z:void 0,onCloseDisabled:U},children:[T?e(A,{$height:"calc(100vh - 136px)",children:e(ya,{children:e(E,{titleSize:R.S,subTitleSize:R.XXXS,withGradient:!0,withSpinner:!0,...k})})}):t(ga,{children:[j&&t(ba,{children:[u&&e(O,{icon:St,title:"Selected Clusters",badge:{label:u.value.length}}),b&&e(F,{width:"100%",...b}),f]}),G&&e(fa,{children:e(O,{icon:m.icon,title:m.title,subTitle:m.description,badge:m.badge})}),t(va,{children:[e(ma,{isLeft:!0,heightOffset:H,...h}),e(ma,{isRight:!0,heightOffset:H,...g})]})]}),t(Ca,{children:[S?e(E,{icon:kt,title:"Fetching Data...",titleSize:R.XXS,withGradient:!0}):T?k?null:e(E,{icon:kt,title:"Saving Changes...",titleSize:R.XXS,withGradient:!0}):_||v?e(M,{fullWidth:!0,status:L.Error,message:_||v}):"boolean"==typeof y&&y&&!C?e(M,{fullWidth:!0,status:L.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof y||y||C?null:e(M,{fullWidth:!0,status:L.Success,message:"The values reflect the current configuration of the selected cluster."}),t(w,{$gap:8,children:[e("div",o?{style:{width:"150px"},children:e(P,{"data-id":"wide-drawer-back",fullWidth:!0,variant:V.Secondary,label:"Back",leftIcon:wt,onClick:o})}:{style:{width:"150px"},children:e(P,{"data-id":"wide-drawer-cancel",fullWidth:!0,variant:V.Secondary,label:"Cancel",onClick:z,disabled:U})}),e("div",i?{style:{width:"150px"},children:e(P,r?{"data-id":"wide-drawer-skip",fullWidth:!0,variant:V.Secondary,label:"Skip",rightIcon:Dt,onClick:i}:{"data-id":"wide-drawer-next",fullWidth:!0,variant:V.Primary,label:"Next",rightIcon:Dt,onClick:i})}:{style:{width:"150px"},children:e(P,{"data-id":"wide-drawer-save",fullWidth:!0,variant:V.Primary,label:"Save",onClick:async()=>{x(!0);const e=await c();x(!1),e?.error?B(e.error):(u?.setValue([]),l?.())},disabled:X})})]})]}),e(la,{isOpen:I,onClose:()=>N(!1),onApprove:z})]})});Sa.displayName=Sa.name;const ka=h.div`
|
|
56
56
|
display: flex;
|
|
57
57
|
align-items: center;
|
|
58
58
|
justify-content: space-between;
|
|
59
59
|
gap: 12px;
|
|
60
60
|
padding: 8px 12px;
|
|
61
61
|
border-radius: 12px;
|
|
62
|
-
background-color: ${({$isSelected:e,$purpleColors:t,theme:
|
|
62
|
+
background-color: ${({$isSelected:e,$purpleColors:t,theme:a})=>e?t?a.v2.colors.purple[800]:a.v2.colors.silver[600]:t?a.v2.colors.purple[900]:"transparent"};
|
|
63
63
|
cursor: ${({$disabled:e})=>e?"not-allowed":"pointer"};
|
|
64
64
|
opacity: ${({$disabled:e})=>e?.5:1};
|
|
65
65
|
&:hover {
|
|
66
|
-
background-color: ${({$isSelected:e,$purpleColors:t,theme:
|
|
66
|
+
background-color: ${({$isSelected:e,$purpleColors:t,theme:a})=>e?t?a.v2.colors.purple[700]:a.v2.colors.silver[600]:t?a.v2.colors.purple[800]:a.v2.colors.silver[700]};
|
|
67
67
|
}
|
|
68
|
-
`,
|
|
68
|
+
`,wa=h.div`
|
|
69
69
|
display: flex;
|
|
70
70
|
align-items: center;
|
|
71
71
|
justify-content: center;
|
|
72
72
|
padding: 8px;
|
|
73
73
|
border-radius: 8px;
|
|
74
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
75
|
-
`,ql=({icon:l,title:a,description:n,withCarret:o,purpleColors:i,disabled:r,children:s,isSelected:c,onClick:d,isChecked:u,isPartiallyChecked:p,onCheckboxChange:m})=>{const b=h();return e(zl,{$isSelected:c,$purpleColors:i,$disabled:r,onClick:()=>!c&&!r&&d(),children:[e(g,{$gap:4,children:[e(T,{$gap:12,children:[m&&t(f,{partiallyChecked:p||!1,value:u||!1,onChange:e=>m(e)}),l&&t(jl,{children:t(l,{size:20})}),t(J,{size:K.XS,children:a})]}),n&&t(J,{size:K.XXXS,color:b.v2.colors.silver[200],children:n})]}),(o||s)&&e(T,{$gap:8,children:[s,o&&t(xt,{size:18})]})]})},Hl=p.div`
|
|
74
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+B["004"]};
|
|
75
|
+
`,Da=({dataId:a,icon:n,title:l,description:o,withCarret:i,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:m,onCheckboxChange:h})=>{const b=g();return t(ka,{"data-id":a||`list-item-${l}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[t(S,{$gap:4,children:[t(w,{$gap:12,children:[h&&e(D,{partiallyChecked:m||!1,value:p||!1,onChange:e=>h(e)}),n&&e(wa,{children:e(n,{size:20})}),e(_,{size:R.XS,children:l})]}),o&&e(_,{size:R.XXXS,color:b.v2.colors.silver[200],children:o})]}),(i||c)&&t(w,{$gap:8,children:[c,i&&e(It,{size:18})]})]})},Ia=[{id:"CREDIT_CARD",label:"Credit card"}],Na=[{id:U.CollectContainerAttributes,label:"Collect container attributes"},{id:U.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:U.CollectWorkloadId,label:"Collect workload ID"},{id:U.CollectClusterId,label:"Collect cluster ID"}],Ta=[{id:H.Pod,label:H.Pod},{id:H.Namespace,label:H.Namespace},{id:H.Node,label:H.Node}],Aa=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Ta}],xa=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Ta}],$a=[{label:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered."},{label:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product."},{label:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",inputType:X.Number},{label:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",inputType:X.Number}],Ea=U.UrlTemplatizationRulesGroups,Ra=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],Oa=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans)."},{label:"Sampling ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",inputType:X.Number},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:X.Number}],Fa=[{label:"Service name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans)."},{label:"Attribute key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span."},{label:"Fallback sampling ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",inputType:X.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:Q.Dropdown,options:[{id:"stringCondition",label:"String condition"},{id:"numberCondition",label:"Number condition"},{id:"booleanCondition",label:"Boolean condition"},{id:"jsonCondition",label:"JSON condition"}]},{label:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",componentType:Q.Dropdown,options:[{id:"exists",label:"Exists"},{id:"equals",label:"Equals"},{id:"not_equals",label:"Not equals"},{id:"contains",label:"Contains"},{id:"not_contains",label:"Not contains"},{id:"regex",label:"Regex"},{id:"greater_than",label:"Greater than"},{id:"less_than",label:"Less than"},{id:"greater_than_or_equal",label:"Greater than or equal"},{id:"less_than_or_equal",label:"Less than or equal"},{id:"is_valid_json",label:"Is valid JSON"},{id:"is_invalid_json",label:"Is invalid JSON"},{id:"jsonpath_exists",label:"JSON path exists"},{id:"key_equals",label:"Key equals"},{id:"key_not_equals",label:"Key not equals"}]},{label:"Expected value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against."},{label:"JSON path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",renderCondition:e=>"jsonCondition"===e.condition}],Ma={[Z.K8sAttributes]:({value:n,setValue:l,formErrors:i})=>(o(()=>{n[U.CollectContainerAttributes]||n[U.CollectReplicaSetAttributes]||n[U.CollectWorkloadId]||n[U.CollectClusterId]||n[U.LabelsAttributes]?.length||n[U.AnnotationsAttributes]?.length||(l(U.CollectContainerAttributes,!0),l(U.CollectReplicaSetAttributes,!0),l(U.CollectWorkloadId,!0),l(U.CollectClusterId,!0),l(U.LabelsAttributes,[]),l(U.AnnotationsAttributes,[]))},[]),t(a,{children:[e(S,{$gap:6,children:Na.map(({id:a,label:o})=>t(S,{children:[e(D,{label:o,value:n[a]||!1,onChange:e=>l(a,e)}),e(I,{errorMessage:i[a]})]},a))}),e(G,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Aa,values:n[U.LabelsAttributes]||[],setValues:e=>l(U.LabelsAttributes,e),errorMessage:i[U.LabelsAttributes]}),e(G,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:xa,values:n[U.AnnotationsAttributes]||[],setValues:e=>l(U.AnnotationsAttributes,e),errorMessage:i[U.AnnotationsAttributes]})]})),[Z.AddClusterInfo]:({value:n,setValue:l,formErrors:o})=>{const i=g();return t(a,{children:[e(W,{label:"Overwrite existing values",labelAlign:q.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[U.OverwriteExistingValues]||!1,onChange:e=>l(U.OverwriteExistingValues,e)}),e(G,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[U.ClusterAttributes]||[],setValues:e=>l(U.ClusterAttributes,e),errorMessage:o[U.ClusterAttributes]})]})},[Z.DeleteAttributes]:({value:t,setValue:a,formErrors:n})=>e(K,{name:"attributeNamesToDelete",label:"Attributes to delete",values:t[U.AttributeNamesToDelete]||[],setValues:e=>a(U.AttributeNamesToDelete,e),errorMessage:n[U.AttributeNamesToDelete]}),[Z.RenameAttributes]:({value:t,setValue:a,formErrors:n})=>e(G,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(t[U.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(U.Renames,t)},errorMessage:n[U.Renames]}),[Z.PiiMasking]:({value:a,setValue:n,formErrors:l})=>(o(()=>{a[U.PiiCategories]?.length||n(U.PiiCategories,Ia.map(({id:e})=>e))},[]),t(S,{$gap:12,children:[e(k,{label:"Attributes to mask"}),e(S,{$gap:6,children:Ia.map(({id:t,label:l})=>e(D,{label:l,value:a[U.PiiCategories]?.includes(t)||!1,onChange:e=>{const l=a[U.PiiCategories]||[],o=e?[...l,t]:l.filter(e=>e!==t);n(U.PiiCategories,o)}},t))}),e(I,{errorMessage:l[U.PiiCategories]})]})),[Z.ErrorSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.FallbackSamplingRatio],o=j(t[U.FallbackSamplingRatio])?"":String(t[U.FallbackSamplingRatio]);return e(z,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:X.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(U.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:l})},[Z.ProbabilisticSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.SamplingPercentage],o=j(t[U.SamplingPercentage])?"":String(t[U.SamplingPercentage]);return e(z,{name:"samplingPercentage",label:"Sampling percentage",type:X.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(U.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:l})},[Z.LatencySampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.EndpointsFilters],o=t[U.EndpointsFilters]||[];return e(G,{name:"endpointsFilters",limitFieldsPerRow:2,columns:$a,values:o,setValues:e=>{a(U.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:l})},[Z.ServiceNameSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.ServicesNameFilters],o=t[U.ServicesNameFilters]||[];return e(G,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Oa,values:o,setValues:e=>{a(U.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:l})},[Z.SpanAttributeSampler]:({value:t,setValue:a,formErrors:n})=>{const l=n[U.AttributeFilters],o=(t[U.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const l=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:l,operation:n[l]?.operation,expectedValue:n[l]?.expectedValue,jsonPath:n[l]?.jsonPath}});return e(G,{name:"attributeFilters",limitFieldsPerRow:2,columns:Fa,values:o,setValues:e=>{a(U.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:l,expectedValue:o,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:l,expectedValue:o}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:l})},[Z.URLTemplatization]:({value:n,setValue:l,formErrors:o})=>{const i=g(),s=n[Ea]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Ea,e),d=(e,t)=>c(s.map((a,n)=>n===e?{...a,...t}:a));return t(a,{children:[s.map((a,n)=>t(r,{children:[e(Y,{}),t(S,{$gap:12,children:[t(w,{$justifyContent:"space-between",$alignItems:"center",children:[e(k,{label:`Rule Group ${n+1}`}),e(P,{leftIcon:()=>e(Nt,{fill:i.v2.colors.red[500]}),variant:V.Secondary,size:J.S,onClick:()=>{return e=n,c(s.filter((t,a)=>a!==e));var e},disabled:1===s.length})]}),e(z,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),e(G,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Ra,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),e(K,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),e(I,{errorMessage:o[Ea]})]},`url-templatization-group-${n}`)),e(P,{variant:V.Secondary,label:"Add rule group",leftIcon:Tt,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),e(Y,{})]})}},La=({actionType:t,value:a,setValue:n,formErrors:l})=>{if(!t)return null;const o=Ma[t];return o?e(o,{value:a,setValue:n,formErrors:l}):null},Pa={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Va=u({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:y(Pa)}),errorMessage:void 0}),_a=({children:t})=>{const[a,l]=n(null),[o,i]=n(void 0),s=ee(Pa),r=c(e=>{s.resetFormData(),s.handleErrorChange(void 0,void 0,{}),i(void 0),e?.type&&s.handleFormChange("type",e.type),l(e)},[]),d=c(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:y(Pa)};const e=(t=s.formData,y(t));var t;const n={};s.handleErrorChange(void 0,void 0,n);const l=Object.keys(n).length>0?"Invalid form values":void 0;return i(l),{errorMessage:l,preparedFormData:e}},[s,a]);return e(Va.Provider,{value:{selectedOption:a,onSelectOption:r,genericForm:s,validateFormData:d,errorMessage:o},children:t})},Ba=()=>d(Va),Ua=()=>{const a=g(),{selectedOption:n,genericForm:l}=Ba();if(!l||!n)return e(x,{title:"No active form"});const{formData:o,handleFormChange:i,formErrors:s}=l;return t(S,{$gap:24,children:[t(w,{$gap:12,$justifyContent:"space-between",children:[e(_,{size:R.XXS,children:n.docsDescription}),e(P,{label:"Docs",leftIcon:At,variant:V.Text,size:J.S,onClick:()=>window.open(`${te}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(ae,{options:[{icon:St,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:xt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),e(ra,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:o.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),e(z,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:o.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),e(La,{actionType:n.type,value:o.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),e(ne,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},za=({signals:a,fields:n,disabled:l,formData:o,handleFormChange:i,formErrors:s})=>n?.map(({renderCondition:n,componentType:r,type:c,name:d,title:u,tooltip:p,placeholder:m,value:h,required:g,options:b})=>{if(!(!n||le(n,a,o.fields)))return null;const f=d,v=o.fields.find(e=>e.key===f),y=v?v.value:h;switch(r){case Q.Input:return e(z,{name:f,type:c,label:u,tooltip:p,required:g,placeholder:m,value:y,onChange:e=>i(f,e.target.value),disabled:l,errorMessage:s[f]},f);case Q.MultiInput:return e(K,{label:u,tooltip:p,required:g,placeholder:m,values:ie(y,[]),setValues:e=>i(f,JSON.stringify(e)),disabled:l,errorMessage:s[f]},f);case Q.KeyValuePair:return e(G,{label:u,tooltip:p,required:g,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:ie(y,[]),setValues:e=>i(f,JSON.stringify(e)),disabled:l,errorMessage:s[f]},f);case Q.TextArea:return e(ne,{name:f,label:u,tooltip:p,required:g,placeholder:m,value:y,onChange:e=>i(f,e.target.value),disabled:l,errorMessage:s[f]},f);case Q.Checkbox:return t(S,{children:[e(D,{label:u,value:"true"==y,onChange:e=>i(f,e.toString()),disabled:l}),e(I,{errorMessage:s[f]})]},f);case Q.Dropdown:return e(oe,{name:f,label:u,withSearch:!0,values:y?[y]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>i(f,e[0]),disabled:l,errorMessage:s[f]},f);default:return null}}),Xa={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},ja={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:y(Xa)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Ga=u(ja),Ha=({children:t})=>{const{selectedStreamName:a}=se(),[l,i]=n(null),[s,r]=n(ja.unsavedDestinations),d=p(()=>"number"==typeof l?.unsavedIdx?s[l.unsavedIdx]:void 0,[l,s]),u=c(e=>{l&&(r(t=>[...t,{...e,option:l.option}]),i(null))},[l]),m=c((e,t)=>{l&&(r(a=>a.map((a,n)=>n===e?{...a,...t,option:l.option}:a)),i(null))},[l]),h=c(e=>{r(t=>t.filter((t,a)=>a!==e)),i(null)},[]),g=ee({...Xa,currentStreamName:a});o(()=>{if(l)if(d)g.handleFormChange(void 0,void 0,d.formData);else{g.handleFormChange("type",l.option.type),g.handleFormChange("name",l.option.displayName),g.handleFormChange("disabled",!1);const e=re(l.option.supportedSignals);g.handleFormChange("exportedSignals",{logs:e.includes(ce.Logs),metrics:e.includes(ce.Metrics),traces:e.includes(ce.Traces)}),g.handleFormChange("fields",l.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[l,d]);const b=c(e=>{var t;g.resetFormData(),g.handleErrorChange(void 0,void 0,{}),i(e?{...e,dynamicFields:e.option?.fields?(t=e.option.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:l,initialValue:o,renderCondition:i}=e,s=a===Q.Dropdown,r=ie(n,{});return{componentType:a,renderCondition:i,name:t,title:l,value:o,placeholder:r.placeholder||(s?"Select an option":void 0),options:s&&Array.isArray(r.values)?r.values.map(e=>({id:e,value:e})):void 0,...r}})):[]}:null)},[]),f=c(()=>{const e=y(g.formData),t={};l?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;j(n)&&(t[a]=ue.FIELD_IS_REQUIRED)}});de(e.exportedSignals).length||(t.exportedSignals=ue.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return g.handleErrorChange(void 0,void 0,t),i(e=>e?{...e,errorMessage:a}:null),{errorMessage:a,preparedFormData:e}},[g,l]);return e(Ga.Provider,{value:{activeForm:l,onChangeActiveForm:b,genericForm:g,validateFormData:f,unsavedDestinations:s,thisUnsavedDestination:d,setUnsavedDestinations:r,addUnsavedDestination:u,updateUnsavedDestination:m,deleteUnsavedDestination:h},children:t})},Wa=()=>d(Ga),qa=h(w)`
|
|
76
|
+
position: sticky;
|
|
77
|
+
bottom: 0;
|
|
78
|
+
margin-top: auto;
|
|
79
|
+
padding: 12px 0;
|
|
80
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
81
|
+
z-index: 1;
|
|
82
|
+
`,Ka=({testConnection:a})=>{const l=g(),{activeForm:i,genericForm:s,validateFormData:r,thisUnsavedDestination:c,addUnsavedDestination:d,updateUnsavedDestination:u,deleteUnsavedDestination:p}=Wa(),[m,h]=n(c?.testResult),[b,f]=n(!!c||!1);if(o(()=>{c?(h(c.testResult),f(!0)):(h(void 0),f(!1))},[c]),!s||!i)return e(x,{title:"No active form"});const v=async()=>{const e=await a(s.formData);return h(e),e};return t(S,{$gap:24,style:{minHeight:"100%"},children:[t(w,{$gap:12,$justifyContent:"space-between",children:[m?m.succeeded?e(M,{status:L.Success,message:m.message||"Connection OK",fullWidth:!0,smallIcon:!0}):e(M,{status:L.Error,message:m.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):e("div",{}),e(P,{"data-id":"dest-form-docs",label:"Docs",leftIcon:At,variant:V.Text,size:J.S,onClick:()=>window.open(`${te}/backends/${i.option.type}`,"_blank","noopener noreferrer")})]}),e(ae,{options:[{icon:St,label:"Enabled",value:!1,selectedBgColor:l.v2.colors.green[800]},{icon:xt,label:"Disabled",value:!0,selectedBgColor:l.v2.colors.red[800]}],selected:s.formData.disabled,setSelected:e=>s.handleFormChange("disabled",e),disabled:b}),e(ra,{title:"This connection will monitor:",allowedSignals:re(i.option.supportedSignals),selectedSignals:de(s.formData.exportedSignals),setSelectedSignals:e=>s.handleFormChange("exportedSignals",{logs:e.includes(ce.Logs),metrics:e.includes(ce.Metrics),traces:e.includes(ce.Traces)}),disabled:b,errorMessage:s.formErrors.exportedSignals}),e(z,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:s.formData.name,onChange:({target:{value:e}})=>s.handleFormChange("name",e),disabled:b,errorMessage:s.formErrors.name}),e(za,{signals:de(s.formData.exportedSignals),fields:i.dynamicFields,disabled:b,formData:s.formData,handleFormChange:(e,t)=>{s.handleFormChange("fields",s.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:s.formErrors}),t(qa,{$gap:8,$justifyContent:"flex-end",children:[c&&e("div",{style:{width:"150px"},children:e(P,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:$t,variant:V.Secondary,textColor:l.v2.colors.red[500],onClick:()=>p(i.unsavedIdx)})}),(!c||c&&!b)&&e("div",{style:{width:"150px"},children:e(P,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:V.Secondary,onClick:v})}),c&&e("div",b?{style:{width:"150px"},children:e(P,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Et,variant:V.Secondary,onClick:()=>f(!1)})}:{style:{width:"150px"},children:e(P,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:V.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=r();if(!e){const e=await v();u(i.unsavedIdx,{formData:t,testResult:e})}}})}),!c&&e("div",{style:{width:"150px"},children:e(P,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:V.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=r();if(!e){const e=await v();d({formData:t,testResult:e})}}})})]})]})},Ya=[{id:pe.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:pe.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:pe.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Ja=[{id:pe.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:pe.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:pe.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],Qa=["*"],Za=[{id:ge.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:ge.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:ge.DbQuery,label:"Collect DB query",tooltip:""},{id:ge.Messaging,label:"Collect messaging",tooltip:""}],en={[ve.Java]:[new fe("","")],[ve.Golang]:[new be("")]},tn={[ye.CodeAttributes]:({value:n,setValue:l,formErrors:i})=>{const s=g(),r=i.codeAttributes,c=p(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);o(()=>{if(!c.length&&!r){const e={[pe.FilePath]:!0,[pe.Function]:!0,[pe.LineNumber]:!0,[pe.Column]:null,[pe.Namespace]:null,[pe.StackTrace]:null};l("codeAttributes",e)}},[]);const d=(e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n=Object.values(pe).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",n)};return t(a,{children:[t(S,{$gap:12,children:[e(_,{size:R.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),e(S,{$gap:6,children:Ya.map(({id:t,label:a,tooltip:n})=>e(me,{text:n,withIcon:!0,children:e(D,{label:a,value:c.includes(t),onChange:e=>d(t,e)})},t))}),e(I,{errorMessage:r})]}),t(S,{$gap:12,children:[e(_,{size:R.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),e(S,{$gap:6,children:Ja.map(({id:t,label:a,tooltip:n})=>e(me,{text:n,withIcon:!0,children:e(D,{label:a,value:c.includes(t),onChange:e=>d(t,e)})},t))}),e(I,{errorMessage:r})]})]})},[ye.CustomInstrumentation]:({value:n,setValue:l,formErrors:i})=>{const s=i.customInstrumentations,r=p(()=>(n?.customInstrumentations?.[ve.Golang]||[]).map(e=>new be(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),c=p(()=>(n?.customInstrumentations?.[ve.Java]||[]).map(e=>new fe(e.className,e.methodName)),[n]);return o(()=>{n?.customInstrumentations||s||l("customInstrumentations",{[ve.Golang]:en[ve.Golang],[ve.Java]:en[ve.Java]})},[]),t(a,{children:[t(S,{children:[t(w,{$gap:8,children:[e(Rt,{}),e(k,{label:"Golang custom probes"})]}),e(G,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:r,setValues:e=>{const t={};t[ve.Golang]=e.map(e=>new be(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[ve.Java]=c,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),t(S,{children:[t(w,{$gap:8,children:[e(Ot,{}),e(k,{label:"Java custom probes"})]}),e(G,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:c,setValues:e=>{const t={};t[ve.Golang]=r,t[ve.Java]=e.map(e=>new fe(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ye.HeadersCollection]:({value:t,setValue:a,formErrors:n})=>{const l=n.headersCollection,i=p(()=>t?.headersCollection?.[he.HeaderKeys]||[],[t]),s=e=>{const t={[he.HeaderKeys]:e};a("headersCollection",t)};return o(()=>{i.length||l||s(Qa)},[]),e(K,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:s,errorMessage:l})},[ye.PayloadCollection]:({value:a,setValue:n,formErrors:l})=>{const i=g(),s=l.payloadCollection,r=p(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);o(()=>{if(!r.length&&!s){const e={[ge.HttpRequest]:{},[ge.HttpResponse]:{},[ge.DbQuery]:{},[ge.Messaging]:{}};n("payloadCollection",e)}},[]);return t(S,{$gap:12,children:[e(_,{size:R.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),e(S,{$gap:6,children:Za.map(({id:t,label:a,tooltip:l})=>e(me,{text:l,withIcon:!0,children:e(D,{label:a,value:r.includes(t),onChange:e=>((e,t)=>{const a=t?[...r,e]:r.filter(t=>t!==e),l={[ge.HttpRequest]:a.includes(ge.HttpRequest)?{}:null,[ge.HttpResponse]:a.includes(ge.HttpResponse)?{}:null,[ge.DbQuery]:a.includes(ge.DbQuery)?{}:null,[ge.Messaging]:a.includes(ge.Messaging)?{}:null};n("payloadCollection",l)})(t,e)})},t))}),e(I,{errorMessage:s})]})},[ye.UnknownType]:null},an=({ruleType:t,value:a,setValue:n,formErrors:l})=>{if(!t)return null;const o=tn[t];return o?e(o,{value:a,setValue:n,formErrors:l}):null},nn={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},ln=u({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:y(nn)}),errorMessage:void 0}),on=({children:t})=>{const[a,l]=n(null),[o,i]=n(void 0),s=ee(nn),r=c(e=>{s.resetFormData(),s.handleErrorChange(void 0,void 0,{}),i(void 0),l(e)},[]),d=c(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:y(nn)};const e=(e=>{const t=y(e);return t.headersCollection?.[he.HeaderKeys]?.length&&(t.headersCollection[he.HeaderKeys]=t.headersCollection[he.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[ve.Golang]?.length&&(t.customInstrumentations[ve.Golang]=t.customInstrumentations[ve.Golang].map(e=>new be(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[ve.Java]?.length&&(t.customInstrumentations[ve.Java]=t.customInstrumentations[ve.Java].map(e=>new fe(e.className,e.methodName)).filter(e=>e.Verify())),t})(s.formData),t={};switch(a.type){case ye.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case ye.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case ye.HeadersCollection:e.headersCollection?.[he.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case ye.CustomInstrumentation:e.customInstrumentations?.[ve.Golang]?.length||e.customInstrumentations?.[ve.Java]?.length||(t.customInstrumentations="Custom instrumentation are required")}s.handleErrorChange(void 0,void 0,t);const n=Object.keys(t).length>0?"Invalid form values":void 0;return i(n),{errorMessage:n,preparedFormData:e}},[s,a]);return e(ln.Provider,{value:{selectedOption:a,onSelectOption:r,genericForm:s,validateFormData:d,errorMessage:o},children:t})},sn=()=>d(ln),rn=()=>{const a=g(),{selectedOption:n,genericForm:l}=sn();if(!l||!n)return e(x,{title:"No active form"});const{formData:o,handleFormChange:i,formErrors:s}=l;return t(S,{$gap:24,children:[t(w,{$gap:12,$justifyContent:"space-between",children:[e(_,{size:R.XXS,children:n.docsDescription}),e(P,{label:"Docs",leftIcon:At,variant:V.Text,size:J.S,onClick:()=>window.open(`${te}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(w,{$gap:12,children:[e(_,{size:R.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(t=>e(Ce,{label:Se[t],leftIcon:ke(t),status:L.Default,useSecondaryTone:!0},t))]}),e(ae,{options:[{icon:St,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:xt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),e(z,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:o.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),e(an,{ruleType:n.type,value:o,setValue:(e,t)=>i(e,t),formErrors:s}),e(ne,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},cn=u({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),dn=({children:t,selectedConnectionIds:a,getAllClusterSnapshots:l,fetchNamespacesWithWorkloads:i,initialInputs:s})=>{const{tier:r}=f(),d=r===v.Onprem,{selectedStreamName:u}=se(),[m,h]=n(!1),[g,b]=n(null),C=c(async()=>{try{if(h(!0),l){const e=await l();e&&b(e)}else if(i){const e=await i();e.data?.length&&b({clusters:[{clusterId:De,clusterName:we,namespaces:e.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]})}}catch(e){}finally{h(!1)}},[]);o(()=>{C()},[]);const[S,k]=n([]);o(()=>{g&&k(e=>{const t=((e,t)=>y(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(g,a);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(s?.[t.clusterId]){const e=s[t.clusterId],a=y(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ie.has(e.kind)&&!d||(e.selected=!0)})}),a}return n})})},[g,a,s]);const{formDiff:w,isFormDirty:D}=p(()=>{const e=((e,t,a)=>{const n={};return e.forEach(e=>{e.namespaces.forEach(l=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===l.name),i=l.selected||!1,s=i!==o?.selected;if(s&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push({namespace:l.name,selected:i,currentStreamName:a}),i&&(n[e.clusterId]=n[e.clusterId].filter(e=>e.namespace!==l.name||e.namespace===l.name&&(!e.name||!e.kind)))),!s||!i){const t=((e,t,a)=>{const n=[];return t.workloads.forEach(l=>{const o=e?.workloads.find(e=>e.name===l.name&&e.kind===l.kind);l.selected!==o?.selected&&n.push({namespace:t.name,name:l.name,kind:l.kind,selected:l.selected||!1,currentStreamName:a})}),n})(o,l,a);t.length>0&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push(...t))}})}),n})(S,g?.clusters||[],u);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[S,g,u]),I=c(e=>!d&&Ie.has(e),[d]),N=c(({clusterId:e,workloadId:t,selected:a,auto:n})=>{k(l=>{const o=y(l),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const s=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===s)return o;if(t.kind&&t.name){const e=o[i].namespaces[s].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const n="boolean"==typeof a?a:!o[i].namespaces[s].workloads[e].selected;if(o[i].namespaces[s].workloads[e].selected=n,n){o[i].namespaces[s].workloads.filter(e=>!I(e.kind)).every(e=>e.selected)&&(o[i].namespaces[s].selected=!0)}else o[i].namespaces[s].selected=!1}else{const e="boolean"==typeof n?n:!o[i].namespaces[s].selected;o[i].namespaces[s].selected=e,e?o[i].namespaces[s].workloads.forEach(e=>{I(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||o[i].namespaces[s].workloads.forEach(e=>{e.selected=!1})}return o})},[I]),T=c(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:l="",filters:o})=>{k(i=>{const s=y(i),r=l===Ae.Namespace?n:"",c=l===Ae.Source?n:"",d=!!r||!!c||!!o?.showOnlySelected;return s.forEach((n,l)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},i)=>{if(!t||e===t)if(d)if(t){n.forEach((e,t)=>{a&&I(e.kind)||Ne(e,c,o||{showOnlySelected:!1})&&(s[l].namespaces[i].workloads[t].selected=a)});const e=s[l].namespaces[i].workloads.filter(e=>!I(e.kind)).every(e=>e.selected);s[l].namespaces[i].selected=e}else{if(!Te(s[l].namespaces[i],r,o||{showOnlySelected:!1}))return;s[l].namespaces[i].selected=a,n.forEach((e,t)=>{a&&I(e.kind)||(s[l].namespaces[i].workloads[t].selected=a)})}else s[l].namespaces[i].selected=a,n.forEach((e,t)=>{a&&I(e.kind)||(s[l].namespaces[i].workloads[t].selected=a)})})}),s})},[I]);return e(cn.Provider,{value:{isFetching:m,formData:S,handleSourceChange:N,handleSelectAll:T,formDiff:w,isFormDirty:D},children:t})},un=()=>d(cn),pn=h.div`
|
|
76
83
|
display: flex;
|
|
77
84
|
align-items: center;
|
|
78
85
|
gap: 8px;
|
|
79
86
|
padding: 8px;
|
|
80
|
-
`,
|
|
87
|
+
`,mn=({onClose:a,selectedConnectionIds:o,setSelectedConnectionIds:i,createAction:s})=>{const r=g(),[c,d]=n(""),u=l(null),{selectedOption:m,onSelectOption:h,genericForm:b,validateFormData:f,errorMessage:v}=Ba(),y=p(()=>(c?xe.filter(e=>e?.label?.toLowerCase().includes(c.toLowerCase())):xe).filter(e=>!!e),[c]),C=p(()=>(c?$e.filter(e=>e?.label?.toLowerCase().includes(c.toLowerCase())):$e).filter(e=>!!e),[c]),S=p(()=>{const a=(a,n)=>t(pn,{children:[e(_,{size:R.XS,color:r.v2.colors.silver[200],children:a}),e(Ce,{label:n.toString()})]},a),n=t=>{const a=m?.type===t.type;return e(Da,{dataId:t.type?`option-${t.type}`:void 0,title:t.label,description:t.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),h(t)}},t.type)};return[a("Attributes",y.length),...y.map(n),a("Samplers",C.length),...C.map(n)]},[r,m?.type,y.length,C.length,h]),k=p(()=>m?[e(Ua,{},m.type)]:[e(A,{$height:"100%",children:e(x,{icon:Ft,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[m]);return e(Sa,{ref:u,isOpen:!0,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=f();return e?Promise.resolve({error:e}):await s(t)},disableSave:!m||!b?.isFormDirty,isFormDirty:b?.isFormDirty,hideDirtyNote:!0,errorMessage:v,progress:{title:Ee.CREATING_ACTION,subTitle:Ee.CREATING_ACTION_SUBTITLE},header:{icon:Ft,title:Ee.ADD_ACTION,subTitle:Ee.ADD_ACTION_DESCRIPTION},connectionIds:o&&i?{value:o,setValue:i}:void 0,search:{value:c,onChange:d},leftColumn:{width:"40%",list:S},rightColumn:{width:"60%",list:k}})},hn=({testConnection:t})=>{const{activeForm:a}=Wa();return{width:"60%",list:a?[e(Ka,{testConnection:t},a.option.type)]:[e(A,{$height:"100%",children:e(x,{icon:Mt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},gn=h.div`
|
|
81
88
|
display: flex;
|
|
82
89
|
flex-direction: column;
|
|
83
90
|
padding: 8px;
|
|
84
91
|
border-radius: 16px;
|
|
85
92
|
border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
|
|
86
|
-
background-color: ${({$noBgColor:e,$purpleColors:t,theme:
|
|
87
|
-
`,
|
|
93
|
+
background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
|
|
94
|
+
`,bn=h.div`
|
|
88
95
|
display: flex;
|
|
89
96
|
align-items: center;
|
|
90
97
|
justify-content: space-between;
|
|
91
98
|
gap: 12px;
|
|
92
99
|
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
93
|
-
`,
|
|
100
|
+
`,fn=({title:a,tooltip:l,list:o,noBgColor:i,purpleColors:s})=>{const[r,c]=n(!0);return t(gn,{"data-id":`collapse-${a}`,$noBgColor:i,$purpleColors:s,children:[t(bn,{$isOpen:r,children:[t(w,{$gap:10,children:[e(_,{size:R.XS,children:a}),l&&e(me,{text:l,withIcon:!0}),e(Ce,{label:o.length,status:s?L.Default:void 0})]}),e(Re,{icon:r?Lt:Pt,size:Oe.M,onClick:()=>c(e=>!e)})]}),r?e(S,{children:o.length?m.toArray(o):e(A,{$padding:"12px 0",children:e(x,{})})}):null]})},vn=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||re(e.supportedSignals).includes(a.signalType))):e,yn=({option:t,formData:a,testResult:n,isSelected:l,onSelect:o})=>e(Da,{icon:Le(t.type).icon,title:a?.name||t.displayName,withCarret:!0,purpleColors:!!a,isSelected:l,onClick:()=>o(),children:n&&e(Ce,{status:n.succeeded?L.Success:L.Error,leftIcon:n.succeeded?Vt:_t})}),Cn=({listType:t,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:l,onChangeActiveForm:o}=Wa();return a?.length?e(fn,{title:Me[t].TITLE,tooltip:Me[t].DESCRIPTION,list:a.map(a=>e(yn,{option:a,isSelected:l?.option.type===a.type&&l?.listType===t,onSelect:()=>o({listType:t,option:a})},`${t}-${a.type}`))}):n?.length?e(fn,{purpleColors:!0,title:Me[t].TITLE,tooltip:Me[t].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:i},s)=>e(yn,{option:a,formData:n,testResult:i,isSelected:l?.unsavedIdx===s&&l?.listType===t,onSelect:()=>o({listType:t,option:a,unsavedIdx:s})},`${t}-${s}`))},t):void 0},Sn=({isFetching:t,destinationsByCategory:a,searchText:n,filters:l})=>{const{unsavedDestinations:o}=Wa(),i=p(()=>{const t=[];o.length&&t.push(e(Cn,{listType:Fe.UNSAVED,unsavedDestinations:o},"unsaved"));for(const o of Object.values(Fe)){if(l.categoryType&&l.categoryType!==o)continue;const i=vn(a[o],n,l);i.length&&t.push(e(Cn,{listType:o,destinationOptions:i},o))}return t},[o,a,n,l]);return{width:"40%",list:i.length?i:t?[e(A,{$height:"100%",children:e(E,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},kn=({destinationsByCategory:n,filters:l,setFilters:o})=>{const i=p(()=>Object.values(Fe).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=p(()=>{const e=Object.values(ce).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return t(a,{children:[e(oe,{placeholder:"Select category",options:i,values:l.categoryType?[l.categoryType]:[],setValues:e=>o({...l,categoryType:l.categoryType===e[0]?null:e[0]})}),e(ae,{size:Pe.S,options:s,selected:l.signalType,setSelected:e=>o({...l,signalType:e})})]})};var wn;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(wn||(wn={}));const Dn=({onClose:t,onBack:a,onNext:l,selectedConnectionIds:i,setSelectedConnectionIds:s,getDestinationCategories:r,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m})=>{const[h,g]=n(""),[b,f]=n({categoryType:null,signalType:null}),{activeForm:v,genericForm:C,unsavedDestinations:S,setUnsavedDestinations:k}=Wa();o(()=>{u&&k(u)},[u]);const[w,D]=n(!0),[I,N]=n({[Fe.ALL]:[],[Fe.UNSAVED]:[],[Fe.EXISTS]:[],[Fe.DETECTED]:[],[Fe.SELF_HOSTED]:[],[Fe.MANAGED]:[]}),T=c(async()=>{try{D(!0);const[e,t]=await Promise.all([r(),d()]),{detectedDestinations:a,selfHostedDestinations:n,managedDestinations:l}=((e,t)=>{const a=[],n=[],l=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===wn.SELF_HOSTED?n.push(...e.items):e.name===wn.MANAGED&&l.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=y(n),l=e.items.findIndex(e=>e.type===t.type);if(-1!==l){const n=ie(t.fields,{});Object.keys(n).length&&(e.items[l].fields=e.items[l].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[l]))}}}),{detectedDestinations:a,selfHostedDestinations:n,managedDestinations:l}})(e,t);N(e=>({...e,[Fe.DETECTED]:a,[Fe.SELF_HOSTED]:n,[Fe.MANAGED]:l}))}catch(e){}finally{D(!1)}},[]);o(()=>{T()},[]);const A=c(async()=>{const e=(await Promise.all(S.map(({formData:e})=>m(e,i)))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[S,i,m]);return e(Sa,{isOpen:!0,onClose:t,onBack:a?()=>a(S):void 0,onNext:l?()=>l(S):void 0,nextIsSkip:!S.length,onSave:A,disableSave:!v&&!S.length,isFetching:w,errorMessage:v?.errorMessage,isFormDirty:C?.isFormDirty,hideDirtyNote:!0,progress:{title:Ee.CREATING_DESTINATION,subTitle:Ee.CREATING_DESTINATION_SUBTITLE},header:{icon:Mt,title:Ee.ADD_DESTINATIONS,subTitle:Ee.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:i&&s?{value:i,setValue:s}:void 0,search:{value:h,onChange:g},filters:e(kn,{destinationsByCategory:I,filters:b,setFilters:f}),leftColumn:Sn({isFetching:w,destinationsByCategory:I,searchText:h,filters:b}),rightColumn:hn({testConnection:p})})},In=({onClose:t,selectedConnectionIds:a,setSelectedConnectionIds:o,createInstrumentationRule:i})=>{const[s,r]=n(""),c=l(null),{selectedOption:d,onSelectOption:u,genericForm:m,validateFormData:h,errorMessage:g}=sn(),b=p(()=>s?Ve.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Ve,[s]),f=p(()=>b.map(t=>{const a=d?.type===t.type;return e(Da,{dataId:`option-${t.type}`,title:t.label,description:t.description,withCarret:!0,isSelected:a,onClick:()=>{c.current?.clearErrors(),u(t)}},t.type)}),[d,b.length,u]),v=p(()=>d?[e(rn,{},d.type)]:[e(A,{$height:"100%",children:e(x,{icon:Bt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d]);return e(Sa,{ref:c,isOpen:!0,onClose:t,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=h();return e?Promise.resolve({error:e}):await i(t)},disableSave:!d||!m?.isFormDirty,isFormDirty:m?.isFormDirty,hideDirtyNote:!0,errorMessage:g,progress:{title:Ee.CREATING_INSTRUMENTATION_RULE,subTitle:Ee.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Bt,title:Ee.ADD_INSTRUMENTATION_RULE,subTitle:Ee.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&o?{value:a,setValue:o}:void 0,search:{value:s,onChange:r},leftColumn:{width:"40%",list:f},rightColumn:{width:"60%",list:v}})},Nn=h.div``,Tn=h.div`
|
|
94
101
|
visibility: hidden;
|
|
95
102
|
|
|
96
103
|
transition: visibility 0s;
|
|
@@ -98,19 +105,19 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
|
|
|
98
105
|
transition-duration: 0s;
|
|
99
106
|
}
|
|
100
107
|
|
|
101
|
-
${
|
|
108
|
+
${Nn}:hover & {
|
|
102
109
|
visibility: visible;
|
|
103
110
|
}
|
|
104
|
-
`,
|
|
111
|
+
`,An=({workloadName:t,workloadKind:a,isChecked:n,onToggle:l,disabled:o,disabledReason:i})=>{const s=g(),r=()=>{};return e(Nn,{children:e(Da,{dataId:`source-${t}`,title:t,disabled:o,onClick:o?r:l,isChecked:n,onCheckboxChange:o?r:l,children:o&&i?e(Ce,{label:i,status:L.Default,textSize:R.XXXS}):e(Tn,{children:e(Ce,{label:a,status:L.Info,textSize:R.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},xn=({formData:a,handleSourceChange:n,handleSelectAll:l,selectedArea:o,searchText:i,searchBy:s,filters:r})=>{const{tier:c}=f(),d=c===v.Onprem,u=p(()=>o.value.namespaceName?a.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0,[a,o.value.clusterId,o.value.namespaceName]),m=p(()=>u?[...u.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ne(e,i,r)):[],[u,i,r]),h=p(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=p(()=>{if(!u)return[];const{clusterId:t}=o.value,{name:a}=u;return m.map(({name:l,selected:o,kind:i})=>{const s=!d&&Ie.has(i);return e(An,{workloadName:l,workloadKind:i,isChecked:!s&&(o||!1),onToggle:()=>n({clusterId:t,workloadId:{namespace:a,name:l,kind:i}}),disabled:s,disabledReason:"Enterprise only"},`${t}#${a}#${l}#${i}`)})},[m,u,o.value.clusterId]),{withFilterCount:b,filteredCount:y,totalCount:C}=p(()=>{const e=u?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,u]);return{width:"40%",header:t(w,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(w,{$gap:8,children:[e(_,{size:R.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),e(me,{text:b?Ee.FILTERED_COUNT_TOOLTIP:void 0,children:e(Ce,{label:`${b?`${y} / ${C}`:C}`,status:_e.Unknown})})]}),e(_,{"data-id":"workloads-select-all",onClick:()=>l({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!h,searchText:i,searchBy:s,filters:r}),disabled:!g.length,size:R.XS,children:(h?"Unselect":"Select")+" all"})]}),list:u?g:[e(A,{$height:"100%",children:e(x,{icon:Ut,title:Ee.SELECT_NAMESPACE,subTitle:Ee.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},$n=h.div``,En=h.div`
|
|
105
112
|
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
106
113
|
|
|
107
114
|
transition: visibility 0s;
|
|
108
115
|
${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
|
|
109
116
|
|
|
110
|
-
${
|
|
117
|
+
${$n}:hover & {
|
|
111
118
|
visibility: visible;
|
|
112
119
|
}
|
|
113
|
-
`,da=({clusterId:l,namespaceName:a,checkbox:n,isFutureApps:o,selectedCounts:i,isActive:r,onActive:s,handleSourceChange:c})=>{const d=h(),u=e=>{s(),c({clusterId:l,workloadId:{namespace:a},auto:e.auto,selected:e.all})};return t(sa,{children:t(ql,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(T,{$gap:12,children:[t(ca,{$visible:r||o,children:t(oe,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t($,{label:"Auto",size:Re.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(T,{$gap:8,children:[t(J,{variant:Me.Span,size:K.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(pe,{label:`${i.sourced}/${i.total}`,status:r?G.Default:Ve.Unknown,minWidth:"42px"})]})]})})})},ua=({clusterId:e,clusterName:l,namespaces:a,selectedArea:n,setSelectedArea:o,handleSourceChange:i})=>{const r=c(()=>a.map(({name:a,totalWorkloads:r,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(da,{clusterId:e,namespaceName:a,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:r},isActive:n.clusterId===e&&n.namespaceName===a,onActive:()=>o({clusterId:e,clusterName:l,namespaceName:a}),handleSourceChange:i},`${e}#${a}`)),[e,l,a,n]);return t(Ul,{title:l,list:r,noBgColor:!0})},pa=({isFetching:l,formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,setSelectedArea:r,searchText:s,filters:d})=>{const u=c(()=>a.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Pe(e,s,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Le(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[a,s,d]),p=c(()=>{let e=!1;for(const{visibleNamespaces:t}of u)for(const{totalWorkloads:l,selectedCount:a}of t)if(e=!0,a!==l)return!1;return e},[u]),{list:h,withFilterCount:m,filteredCount:g,totalCount:b}=c(()=>{const e=u.map(({clusterId:e,clusterName:l,visibleNamespaces:a})=>a.length?t(ua,{clusterId:e,clusterName:l,namespaces:a,selectedArea:i,setSelectedArea:r,handleSourceChange:n},e):null),l=e.filter(e=>null!==e);return{list:l,withFilterCount:l.length!==e.length,filteredCount:l.length,totalCount:e.length}},[u,i]);return{width:"60%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(J,{size:K.XS,nowrap:!0,children:"Namespaces"}),t(oe,{text:m?ye.FILTERED_COUNT_TOOLTIP:void 0,children:t(pe,{label:`${m?`${g} / ${b}`:b}`,status:Ve.Unknown})})]}),t(J,{onClick:()=>o({boolean:!p}),disabled:!h.length,size:K.XS,children:(p?"Unselect":"Select")+" all"})]}),list:h.length?h:l?[t(z,{$height:"100%",children:t(H,{title:ye.FETCHING_NAMESPACES,subTitle:ye.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},ha=({onClose:l,selectedConnectionIds:n,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:s})=>{const d=h(),{tier:p}=Ae(),m=p===Fe.Onprem,{selectedStreamName:g}=Ne(),{progress:b,resetProgress:f}=Ee(),C=c(()=>g||ze,[g]),[y,v]=o(!1),[k,w]=o(null),S=u(async()=>{try{v(!0),w(await r()??null)}catch(e){}finally{v(!1)}},[]);a(()=>{S()},[]);const[x,I]=o(""),[N,A]=o(je.Namespace),[D,O]=o({showOnlySelected:!1}),[V,F]=o({clusterId:"",clusterName:"",namespaceName:""}),[R,P]=o([]);a(()=>{k&&P(e=>{const t=((e,t)=>M(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(k,n);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[k,n]);const{formDiff:L,isFormDirty:E}=c(()=>{const e=((e,t,l)=>{const a={};return e.forEach(e=>{e.namespaces.forEach(n=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),i=n.selected||!1,r=i!==o?.selected;if(r&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push({namespace:n.name,selected:i,currentStreamName:l}),i&&(a[e.clusterId]=a[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!r||!i){const t=((e,t,l)=>{const a=[];return t.workloads.forEach(n=>{const o=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==o?.selected&&a.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:l})}),a})(o,n,l);t.length>0&&(a[e.clusterId]||(a[e.clusterId]=[]),a[e.clusterId].push(...t))}})}),a})(R,k?.clusters||[],C);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[R,k,C]),z=u(e=>!m&&Oe.has(e),[m]),j=u(({clusterId:e,workloadId:t,selected:l,auto:a})=>{P(n=>{const o=M(n),i=o.findIndex(t=>t.clusterId===e);if(-1===i)return o;const r=o[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===r)return o;if(t.kind&&t.name){const e=o[i].namespaces[r].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return o;const a="boolean"==typeof l?l:!o[i].namespaces[r].workloads[e].selected;o[i].namespaces[r].workloads[e].selected=a,a?o[i].namespaces[r].workloads.filter(e=>!z(e.kind)).every(e=>e.selected)&&(o[i].namespaces[r].selected=!0):o[i].namespaces[r].selected=!1}else{const e="boolean"==typeof a?a:!o[i].namespaces[r].selected;o[i].namespaces[r].selected=e,e?o[i].namespaces[r].workloads.forEach(e=>{z(e.kind)||(e.selected=!0)}):"boolean"!=typeof l||l||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[z]),q=u(({clusterId:e,namespaceName:t,boolean:l})=>{P(a=>{const n=M(a),o=N===je.Namespace?x:"",i=N===je.Source?x:"",r=!!o||!!i||!!D?.showOnlySelected;return n.forEach((a,s)=>{e&&a.clusterId!==e||a.namespaces.forEach(({name:e,workloads:a},c)=>{if(!t||e===t)if(r)if(t){a.forEach((e,t)=>{l&&z(e.kind)||De(e,i,D)&&(n[s].namespaces[c].workloads[t].selected=l)});const e=n[s].namespaces[c].workloads.filter(e=>!z(e.kind)).every(e=>e.selected);n[s].namespaces[c].selected=e}else{if(!Pe(n[s].namespaces[c],o,D))return;n[s].namespaces[c].selected=l,a.forEach((e,t)=>{l&&z(e.kind)||(n[s].namespaces[c].workloads[t].selected=l)})}else n[s].namespaces[c].selected=l,a.forEach((e,t)=>{l&&z(e.kind)||(n[s].namespaces[c].workloads[t].selected=l)})})}),n})},[N,x,D,z]);return t(Il,{isOpen:!0,onClose:()=>{f(qe.BulkInstrumenting),l()},onSave:()=>s(L),header:{icon:Ot,title:ye.ADD_SOURCE,subTitle:ye.ADD_SOURCES_DESCRIPTION},connectionIds:{value:n,setValue:i},search:{value:x,onChange:e=>{I(e),N===je.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:je.Namespace},{label:"Source",value:je.Source}],selected:N,setSelected:A}},filters:e(T,{$gap:8,children:[t(J,{size:K.XXXS,color:d.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:Re.S,label:"Selected",value:D.showOnlySelected,onChange:e=>O(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:y,progress:{title:ye.CREATING_SOURCES,subTitle:ye.CREATING_SOURCES_SUBTITLE,percentage:b[qe.BulkInstrumenting]?.percentage||0},leftColumn:pa({isFetching:y,formData:R,handleSourceChange:j,handleSelectAll:q,selectedArea:V,setSelectedArea:F,searchText:N===je.Namespace?x:"",filters:D}),rightColumn:ra({formData:R,handleSourceChange:j,handleSelectAll:q,selectedArea:{value:V},searchText:N===je.Source?x:"",filters:D})})},ma=({onClose:l,connections:n,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:s,onApply:d})=>{const u=h(),[p,m]=o(""),[g,b]=o({showOnlySelected:!1}),f=c(()=>n.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[n.length,i.length,p,g]),C=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,v]=o(!1),[k,w]=o(void 0),{formData:S,handleFormChange:x,areFormValuesEqual:I,resetFormData:N}=Ce(k||{rollout:{automaticRolloutDisabled:!1}}),A=c(()=>i.length>1||void 0!==k&&!I(k,S),[i.length,k,S]);return a(()=>{1===i.length?(async e=>{if(y)return;v(!0);const t=await s(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};w(e),N(e)}v(!1)})(i[0]):w(void 0)},[i.length]),t(Il,{isOpen:!0,onClose:l,onSave:()=>d(S,i),header:{icon:Vt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(T,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t($,{size:Re.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,leftColumn:{width:"35%",header:e(T,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(T,{$gap:8,children:[t(J,{size:K.XS,children:"Clusters"}),t(pe,{label:f.length,status:Ve.Unknown})]}),e(T,{$gap:8,children:[t(J,{size:K.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(pe,{label:`${i.length}/${f.length}`,status:Ve.Unknown})]})]}),list:f.map(e=>t(ql,{title:e.name,isChecked:i.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(J,{size:K.XS,children:"Configurations"}),list:[t($,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},ga=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:h}=He(),m=!o||n||!c.newToken;return Ke({key:"Enter",active:!m},s),e(T,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(y,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(T,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(H,{title:"Saving...",withGradient:!0}):e(l,{children:[t(A,{variant:O.Secondary,size:D.S,leftIcon:Ft,onClick:r,disabled:n}),t(A,{variant:O.Primary,size:D.S,leftIcon:Rt,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(J,{size:K.XS,children:new Array(55).fill("•").join("")}),e(T,{$alignItems:"center",$justifyContent:"space-between",children:[t(h,{value:a}),t(ke,{icon:Mt,onClick:i})]})]})},ba=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Be(),i=c(()=>o(e),[e]),r=c(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),s=c(()=>We(e,0)?G.Error:We(e,2592e6)?G.Warning:G.Success,[e]),d=c(()=>s===G.Success?Rt:s===G.Warning?Pt:Lt,[s]);return a(()=>{s===G.Success?l():s===G.Error&&n()},[s]),t(oe,{text:r,children:t(pe,{leftIcon:d,label:i,status:s,invertColors:!0,useSecondaryTone:!0})})},fa=p.div`
|
|
120
|
+
`,Rn=({clusterId:a,namespaceName:n,checkbox:l,isFutureApps:o,selectedCounts:i,isActive:s,onActive:r,handleSourceChange:c})=>{const d=g(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return e($n,{children:e(Da,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:l.partial,isChecked:l.all,onCheckboxChange:e=>u({auto:e,all:e}),children:t(w,{$gap:12,children:[e(En,{$visible:s||o,children:e(me,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:e(W,{label:"Auto",size:Be.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),t(w,{$gap:8,children:[e(_,{variant:Ue.Span,size:R.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),e(Ce,{label:`${i.sourced}/${i.total}`,status:s?L.Default:_e.Unknown,minWidth:"42px"})]})]})})})},On=({withCollapse:t,clusterId:a,clusterName:n,namespaces:l,selectedArea:o,setSelectedArea:i,handleSourceChange:s})=>{const r=p(()=>l.map(({name:t,totalWorkloads:l,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>e(Rn,{clusterId:a,namespaceName:t,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:l},isActive:o.clusterId===a&&o.namespaceName===t,onActive:()=>i({clusterId:a,clusterName:n,namespaceName:t}),handleSourceChange:s},`${a}#${t}`)),[a,n,l,o]);return t?e(fn,{title:n,list:r,noBgColor:!0}):r},Fn=({isFetching:a,formData:n,handleSourceChange:l,handleSelectAll:o,selectedArea:i,setSelectedArea:s,searchText:r,searchBy:c,filters:d})=>{const u=p(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Te(e,r,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...ze(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,r,d]),m=p(()=>{let e=!1;for(const{visibleNamespaces:t}of u)for(const{totalWorkloads:a,selectedCount:n}of t)if(e=!0,n!==a)return!1;return e},[u]),{list:h,withFilterCount:g,filteredCount:b,totalCount:f}=p(()=>{const t=u.map(({clusterId:t,clusterName:a,visibleNamespaces:n})=>n.length?e(On,{withCollapse:u.length>1,clusterId:t,clusterName:a,namespaces:n,selectedArea:i,setSelectedArea:s,handleSourceChange:l},t):null),a=t.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==t.length,filteredCount:a.length,totalCount:t.length}},[u,i]);return{width:"60%",header:t(w,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(w,{$gap:8,children:[e(_,{size:R.XS,nowrap:!0,children:"Namespaces"}),e(me,{text:g?Ee.FILTERED_COUNT_TOOLTIP:void 0,children:e(Ce,{label:`${g?`${b} / ${f}`:f}`,status:_e.Unknown})})]}),e(_,{"data-id":"namespaces-select-all",onClick:()=>o({boolean:!m,searchText:r,searchBy:c,filters:d}),disabled:!h.length,size:R.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[e(A,{$height:"100%",children:e(E,{title:Ee.FETCHING_NAMESPACES,subTitle:Ee.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},Mn=({onClose:a,onBack:l,onNext:o,selectedConnectionIds:i,setSelectedConnectionIds:s,persistSources:r})=>{const c=g(),{progress:d,resetProgress:u}=Xe(),{isFetching:p,formData:m,handleSourceChange:h,handleSelectAll:b,formDiff:f,isFormDirty:v}=un(),[y,C]=n(""),[S,k]=n(Ae.Namespace),[D,I]=n({showOnlySelected:!1}),[N,T]=n({clusterId:"",clusterName:"",namespaceName:""});return e(Sa,{isOpen:!0,onClose:a?()=>{u(je.BulkInstrumenting),a()}:void 0,onBack:l?()=>l(f):void 0,onNext:o?()=>o(f):void 0,nextIsSkip:!v,onSave:()=>r(f),header:{icon:Ut,title:Ee.ADD_SOURCE,subTitle:Ee.ADD_SOURCES_DESCRIPTION},connectionIds:i&&s?{value:i,setValue:s}:void 0,search:{value:y,onChange:e=>{C(e),S===Ae.Namespace&&T({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ae.Namespace},{label:"Source",value:Ae.Source}],selected:S,setSelected:k}},filters:t(w,{$gap:8,children:[e(_,{size:R.XXXS,color:c.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),e(W,{size:Be.S,label:"Selected",value:D.showOnlySelected,onChange:e=>I(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:v,isFetching:p,progress:{title:Ee.CREATING_SOURCES,subTitle:Ee.CREATING_SOURCES_SUBTITLE,percentage:d[je.BulkInstrumenting]?.percentage||0},leftColumn:Fn({isFetching:p,formData:m,handleSourceChange:h,handleSelectAll:b,selectedArea:N,setSelectedArea:T,searchText:S===Ae.Namespace?y:"",searchBy:S,filters:D}),rightColumn:xn({formData:m,handleSourceChange:h,handleSelectAll:b,selectedArea:{value:N},searchText:S===Ae.Source?y:"",searchBy:S,filters:D})})},Ln=({onClose:a,connections:l,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:r,onApply:c})=>{const d=g(),[u,m]=n(""),[h,b]=n({showOnlySelected:!1}),f=p(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),a=!h.showOnlySelected||h.showOnlySelected&&i.includes(e.id);return t&&a}),[l.length,i.length,u,h]),v=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,C]=n(!1),[S,k]=n(void 0),{formData:D,handleFormChange:I,areFormValuesEqual:N,resetFormData:T}=ee(S||{rollout:{automaticRolloutDisabled:!1}}),A=p(()=>i.length>1||void 0!==S&&!N(S,D),[i.length,S,D]);return o(()=>{1===i.length?(async e=>{if(y)return;C(!0);const t=await r(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};k(e),T(e)}C(!1)})(i[0]):k(void 0)},[i.length]),e(Sa,{isOpen:!0,onClose:a,onSave:()=>c(D,i),header:{icon:zt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:u,onChange:m},filters:t(w,{$gap:8,children:[e(_,{size:R.XXXS,color:d.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),e(W,{size:Be.S,label:"Selected",value:h.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,leftColumn:{width:"35%",header:t(w,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(w,{$gap:8,children:[e(_,{size:R.XS,children:"Clusters"}),e(Ce,{label:f.length,status:_e.Unknown})]}),t(w,{$gap:8,children:[e(_,{size:R.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected clusters"}),e(Ce,{label:`${i.length}/${f.length}`,status:_e.Unknown})]})]}),list:f.map(t=>e(Da,{title:t.name,isChecked:i.includes(t.id),onClick:()=>v(t.id),onCheckboxChange:()=>v(t.id)},t.id))},rightColumn:{width:"65%",header:e(_,{size:R.XS,children:"Configurations"}),list:[e(W,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:D.rollout?.automaticRolloutDisabled||!1,onChange:e=>I("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Pn=({token:n,isLoading:l,isEditing:o,onEdit:i,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=Ge(),h=!o||l||!c.newToken;return He({key:"Enter",active:!h},r),t(w,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[e(z,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),e(w,{$margin:l?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:l?e(E,{title:"Saving...",withGradient:!0}):t(a,{children:[e(P,{variant:V.Secondary,size:J.S,leftIcon:_t,onClick:s,disabled:l}),e(P,{variant:V.Primary,size:J.S,leftIcon:Vt,onClick:r,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[e(_,{size:R.XS,children:new Array(55).fill("•").join("")}),t(w,{$alignItems:"center",$justifyContent:"space-between",children:[e(m,{value:n}),e(Re,{icon:Et,onClick:i})]})]})},Vn=({expiresAt:t,callbackValid:a,callbackExpired:n})=>{const{formatTimeAgo:l}=We(),i=p(()=>l(t),[t]),s=p(()=>new Date(t).toDateString().split(" ").slice(1).join(" "),[t]),r=p(()=>qe(t,0)?L.Error:qe(t,2592e6)?L.Warning:L.Success,[t]),c=p(()=>r===L.Success?Vt:r===L.Warning?Xt:jt,[r]);return o(()=>{r===L.Success?a():r===L.Error&&n()},[r]),e(me,{text:s,children:e(Ce,{leftIcon:c,label:i,status:r,invertColors:!0,useSecondaryTone:!0})})},_n=h.div`
|
|
114
121
|
display: flex;
|
|
115
122
|
flex-direction: column;
|
|
116
123
|
gap: 12px;
|
|
@@ -118,7 +125,7 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
|
|
|
118
125
|
border-radius: 12px;
|
|
119
126
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
120
127
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
121
|
-
`,
|
|
128
|
+
`,Bn=({children:t})=>{const a=g();return e(_,{size:R.XXXS,color:a.v2.colors.grey[150],children:t})},Un=({token:a,updateToken:l})=>{const[o,i]=n(!1),[s,r]=n(!1),[c,d]=n(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:g}=ee({newToken:""});return e(Ke,{richTitle:{icon:Gt,title:"Odigos Pro Token"},children:t(_n,{$isExpired:c,children:[t(w,{$justifyContent:"space-between",children:[t(S,{$gap:4,children:[e(Bn,{children:"Issued for"}),e(_,{size:R.XS,children:a.name||"N/A"})]}),t(S,{$gap:4,children:[e(Bn,{children:"Expiration"}),e(Vn,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),e(S,{})]}),e(w,{children:t(S,{children:[e(Bn,{children:"Token"}),e(Pn,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:o,onEdit:()=>i(!0),onCancel:()=>(i(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await l(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(i(!1),g())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},zn=h.div`
|
|
122
129
|
display: flex;
|
|
123
130
|
flex-direction: column;
|
|
124
131
|
align-items: center;
|
|
@@ -127,7 +134,61 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
|
|
|
127
134
|
padding: 12px 24px;
|
|
128
135
|
border-radius: 8px;
|
|
129
136
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
130
|
-
`,ka=({downloadDiagnose:l})=>{const a=h(),{progress:n}=Ee(),{namespaces:i}=Ge(),[r,s]=o(null),{formData:c,handleFormChange:d,resetFormData:u}=Ce({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(_e,{richTitle:{icon:zt,title:"Diagnose"},children:r?e(va,{children:[t(H,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof n[qe.DownloadingDiagnose]?.percentage,percentage:n[qe.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof n[qe.DownloadingDiagnose]?.percentage,visualIcon:jt,startedAt:r}),n[qe.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:n[qe.DownloadingDiagnose].list.map(l=>e(T,{$gap:4,$alignItems:"center",children:[l.status===G.Success?t(Rt,{size:16}):l.status===G.Error?t(Ft,{size:16}):t(H,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:l.label})]},l.label))})]}):e(g,{$gap:24,children:[t(J,{size:K.XXS,color:a.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(g,{$gap:16,children:[e(T,{$gap:8,children:[t(f,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(T,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(T,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(J,{size:K.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(Je,{alignX:Ye.Left,alignY:Ue.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:O.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(pe,{label:c.sourceWorkloadNamespaces.length,status:G.Default}):void 0}}),t(T,{$justifyContent:"flex-end",children:t(A,{label:"Download Diagnose",rightIcon:jt,variant:O.Primary,onClick:async()=>{s(Date.now()),await l(c),s(null),u()},disabled:null!==r})})]})})},wa=({fetchDescribeOdigos:e})=>{const{platformType:l,version:n,tier:i}=Ae(),[r,s]=o(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(_e,{richTitle:{icon:qt,title:"General Information"},children:t(Xe,{cellsPerRow:2,items:[{id:Ze(),title:"Odigos Version",label:n},{id:Ze(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ze(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ze(),title:"Tier",label:i}]})})},Sa=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(q,{isOpen:l,header:{icon:qt,title:"System Overview",onClose:a},children:[i&&t(wa,{fetchDescribeOdigos:i}),o&&n&&t(ya,{token:n,updateToken:o}),r&&t(ka,{downloadDiagnose:r})]});var $a,xa;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}($a||($a={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(xa||(xa={}));const Ia=[{key:xa.Name,label:"Name"},{key:xa.Type,label:"Type",textAlign:"right"},{key:xa.Status,label:"Status"},{key:xa.OdigosVersion,label:"Odigos Version"},{key:xa.ConnectedSince,label:"Connected Since"},{key:xa.LastActivity,label:"Last Activity"}],Na=(e,t)=>{const l=e.find(e=>e.key===xa.Id)?.rawValue;return t(l?.toString()||"")},Ta=({tableRowsMaxHeight:l,connections:n,getConnections:i,onClickConnection:r,deleteConnection:s,configMinSupportedVersion:d=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:C,getPotentialDestinations:y,createDestination:v,createAction:k,createInstrumentationRule:w})=>{const S=h(),{isVm:$}=Ae(),{formatTimeAgo:x}=Be(),[I,N]=o(!1),[T,A]=o(n||[]),V=u(async()=>{try{N(!0),A(await i()??[])}catch(e){}finally{N(!1)}},[]);a(()=>{T.length||V()},[]);const[F,R]=o(""),[M,P]=o(null),[L,E]=o([]),z=c(()=>M===$a.BulkConfig?d:M===$a.BulkSource?g:0,[M,d,g]),{supportedConnections:j,supportedConnectionIds:q}=c(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===G.Success,a=Qe(e.odigosVersion,t);return l&&a}))(T,z);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[T.length,z]);a(()=>{if(!M||M===$a.Delete)return;const e=L.filter(e=>!q.includes(e));e.length&&E(t=>t.filter(t=>!e.includes(t)))},[M,L.length,q.length]);const H=c(()=>T.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:xa.Id,rawValue:e.id},{key:xa.Name,rawValue:e.name},{key:xa.Type,rawValue:e.type},{key:xa.Status,rawValue:e.status,component:()=>(e=>{const l=e===G.Success?"Connection live":"Connection lost",a=e===G.Success?Rt:Ft;return t(pe,{status:e,label:l,leftIcon:a})})(e.status)},{key:xa.OdigosVersion,rawValue:e.odigosVersion},{key:xa.ConnectedSince,rawValue:e.connectedAt?x(e.connectedAt):"-"},{key:xa.LastActivity,rawValue:e.lastSeenAt?x(e.lastSeenAt):"-"}],onClick:e.status!==G.Success||M?void 0:()=>r(e),isSelected:L.includes(e.id),onSelect:()=>E(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>E(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==G.Success||M===$a.BulkConfig&&!Qe(e.odigosVersion,d)||M===$a.BulkSource&&!Qe(e.odigosVersion,g)})),[T,L,F,M,d,g]),K=c(()=>{const e=(e,t)=>{E([e]),P(t)};return(e=>{const{connections:t,configMinSupportedVersion:l,snapshotMinSupportedVersion:a,onDelete:n,onAddSource:o,onAddDestination:i,onAddAction:r,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===xa.Status)?.rawValue===G.Success)(e))return[{id:Ze(),label:"Delete Connection",rightIcon:Ht,onClick:()=>Na(e,n)}];const d=Na(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Qe(a.odigosVersion,l)}),u=Na(e,e=>{const l=t.find(t=>t.id===e);return!!l&&Qe(l.odigosVersion,a)}),p=[];return o&&p.push({id:Ze(),tooltip:u?ye.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:Ot,disabled:!u,onClick:()=>Na(e,o)}),i&&p.push({id:Ze(),tooltip:ye.ADD_DESTINATION,rightIcon:Nt,onClick:()=>Na(e,i)}),r&&p.push({id:Ze(),tooltip:ye.ADD_ACTION,rightIcon:It,onClick:()=>Na(e,r)}),s&&p.push({id:Ze(),tooltip:ye.ADD_INSTRUMENTATION_RULE,rightIcon:Dt,onClick:()=>Na(e,s)}),c&&p.push({id:Ze(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:Vt,disabled:!d,onClick:()=>Na(e,c)}),p}})({connections:T,configMinSupportedVersion:d,snapshotMinSupportedVersion:g,onDelete:t=>e(t,$a.Delete),onAddSource:!$&&b&&f?t=>e(t,$a.BulkSource):void 0,onAddDestination:!$&&C&&y&&v?t=>e(t,$a.BulkDestination):void 0,onAddAction:!$&&k?t=>e(t,$a.BulkAction):void 0,onAddInstrumentationRule:!$&&w?t=>e(t,$a.BulkInstrumentationRule):void 0,onEditConfiguration:!$&&p&&m?t=>e(t,$a.BulkConfig):void 0})},[$,T,d,p,m,g,b,f,C,y,v,k,w]),B=c(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ze(),type:et.Button,buttonProps:{variant:O.Primary,size:D.S,label:"Add Sources",rightIcon:Ot,onClick:l}});const s=[a?{id:$a.BulkDestination,label:ye.ADD_DESTINATION,icon:Nt}:null,n?{id:$a.BulkAction,label:ye.ADD_ACTION,icon:It}:null,o?{id:$a.BulkInstrumentationRule,label:ye.ADD_INSTRUMENTATION_RULE,icon:Dt}:null,i?{id:$a.BulkConfig,label:"Manage Configurations",icon:Vt}:null];return s.some(Boolean)&&r.push({id:Ze(),type:et.ButtonDropData,buttonProps:{variant:O.Secondary,size:D.S,label:"Bulk Operations",onClick:e=>{e===$a.BulkSource?l?.():e===$a.BulkDestination?a?.():e===$a.BulkAction?n?.():e===$a.BulkInstrumentationRule?o?.():e===$a.BulkConfig&&i?.()}},dropDataProps:{alignX:Ye.Left,items:s}}),r.push({id:Ze(),type:et.Button,buttonProps:{variant:O.Text,size:D.S,label:tt.CANCEL,onClick:t}}),r})({onCancel:()=>E([]),onAddSource:!$&&b&&f?()=>P($a.BulkSource):void 0,onAddDestination:!$&&C&&y&&v?()=>P($a.BulkDestination):void 0,onAddAction:!$&&k?()=>P($a.BulkAction):void 0,onAddInstrumentationRule:!$&&w?()=>P($a.BulkInstrumentationRule):void 0,onManageConfigurations:!$&&p&&m?()=>P($a.BulkConfig):void 0}),[$,p,m,b,f,C,y,v,k,w]);return t(lt,{children:e(_e,{richTitle:{icon:Bt,title:ye.CONNECTIONS,badge:{label:T.length.toString(),status:Ve.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>R(e),width:"300px"},actions:[{id:Ze(),type:et.Button,buttonProps:{variant:O.Secondary,size:D.S,leftIcon:Kt,onClick:V,disabled:I}}],children:[t(at,{variant:nt.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:I,withCheckboxes:!0,columns:Ia,rows:H,rowActionsPushRightPosition:M?`calc(${yl} - 24px)`:void 0,getRowActions:K}),M===$a.BulkConfig&&p&&m&&t(ma,{onClose:()=>P(null),connections:j,selectedConnectionIds:L,setSelectedConnectionIds:E,getEffectiveConfig:p,onApply:m}),M===$a.BulkSource&&b&&f&&t(ha,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),M===$a.BulkDestination&&C&&y&&v&&t(ta,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,getDestinationCategories:C,getPotentialDestinations:y,createDestination:e=>v(e,L)}),M===$a.BulkAction&&k&&t(Kl,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,createAction:e=>k(e,L)}),M===$a.BulkInstrumentationRule&&w&&t(aa,{onClose:()=>P(null),selectedConnectionIds:L,setSelectedConnectionIds:E,createInstrumentationRule:e=>w(e,L)}),t(ul,{target:"connection",isOpen:M===$a.Delete,onClose:()=>{E([]),P(null)},onApprove:async()=>{const e=L[0];e&&(await s(e),await V())}}),t(ot,{isOpen:!!L.length&&!M,richTitle:{icon:ft,title:"Selected Clusters",badge:{label:L.length}},actions:B})]})})},Aa=p.div`
|
|
137
|
+
`,Xn=({downloadDiagnose:a})=>{const l=g(),{progress:o}=Xe(),{namespaces:i}=Ye(),[s,r]=n(null),{formData:c,handleFormChange:d,resetFormData:u}=ee({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return e(Ke,{richTitle:{icon:Ht,title:"Diagnose"},children:s?t(zn,{children:[e(E,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[je.DownloadingDiagnose]?.percentage,percentage:o[je.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[je.DownloadingDiagnose]?.percentage,visualIcon:Wt,startedAt:s}),o[je.DownloadingDiagnose]?.list?.length&&e(S,{$width:"100%",children:o[je.DownloadingDiagnose].list.map(a=>t(w,{$gap:4,$alignItems:"center",children:[a.status===L.Success?e(Vt,{size:16}):a.status===L.Error?e(_t,{size:16}):e(E,{withSpinnerOld:!0,scaleSpinnerOld:.7}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:a.label})]},a.label))})]}):t(S,{$gap:24,children:[e(_,{size:R.XXS,color:l.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),t(S,{$gap:16,children:[t(w,{$gap:8,children:[e(D,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:"Include pprof profiles"})]}),t(w,{$gap:8,children:[e(D,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),t(w,{$gap:8,children:[e(D,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),e(_,{size:R.XXXS,color:l.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),e(Je,{alignX:Ze.Left,alignY:Qe.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:V.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>e(Ce,{label:c.sourceWorkloadNamespaces.length,status:L.Default}):void 0}}),e(w,{$justifyContent:"flex-end",children:e(P,{label:"Download Diagnose",rightIcon:Wt,variant:V.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},jn=({fetchDescribeOdigos:t})=>{const{platformType:a,version:l,tier:i}=f(),[s,r]=n(null);return o(()=>{t().then(({data:e})=>r(e?.describeOdigos||null))},[]),e(Ke,{richTitle:{icon:qt,title:"General Information"},children:e(et,{cellsPerRow:2,items:[{id:tt(),title:"Odigos Version",label:l},{id:tt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:tt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:tt(),title:"Tier",label:i}]})})},Gn=({isOpen:a,onClose:n,token:l,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:s})=>t($,{isOpen:a,header:{icon:qt,title:"System Overview",onClose:n},children:[i&&e(jn,{fetchDescribeOdigos:i}),o&&l&&e(Un,{token:l,updateToken:o}),s&&e(Xn,{downloadDiagnose:s})]});var Hn,Wn;!function(e){e.BulkConfig="bulk-config",e.BulkSource="bulk-source",e.BulkDestination="bulk-destination",e.BulkAction="bulk-action",e.BulkInstrumentationRule="bulk-instrumentation-rule",e.Delete="delete"}(Hn||(Hn={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Wn||(Wn={}));const qn=[{key:Wn.Name,label:"Name"},{key:Wn.Type,label:"Type",textAlign:"right"},{key:Wn.Status,label:"Status"},{key:Wn.OdigosVersion,label:"Odigos Version"},{key:Wn.ConnectedSince,label:"Connected Since"},{key:Wn.LastActivity,label:"Last Activity"}],Kn=(e,t)=>{const a=e.find(e=>e.key===Wn.Id)?.rawValue;return t(a?.toString()||"")},Yn=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:l,onAddSource:o,onAddDestination:i,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Wn.Status)?.rawValue===L.Success)(e))return[{id:tt(),label:"Delete Connection",rightIcon:$t,onClick:()=>Kn(e,l)}];const d=Kn(e,e=>{const n=t.find(t=>t.id===e);return!!n&&at(n.odigosVersion,a)}),u=Kn(e,e=>{const a=t.find(t=>t.id===e);return!!a&&at(a.odigosVersion,n)}),p=[];return o&&p.push({id:tt(),tooltip:u?Ee.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Ut,disabled:!u,onClick:()=>Kn(e,o)}),i&&p.push({id:tt(),tooltip:Ee.ADD_DESTINATION,rightIcon:Mt,onClick:()=>Kn(e,i)}),s&&p.push({id:tt(),tooltip:Ee.ADD_ACTION,rightIcon:Ft,onClick:()=>Kn(e,s)}),r&&p.push({id:tt(),tooltip:Ee.ADD_INSTRUMENTATION_RULE,rightIcon:Bt,onClick:()=>Kn(e,r)}),c&&p.push({id:tt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:zt,disabled:!d,onClick:()=>Kn(e,c)}),p}},Jn=({tableRowsMaxHeight:a,connections:l,getConnections:i,onClickConnection:s,deleteConnection:r,configMinSupportedVersion:d=0,getEffectiveConfig:u,applyConfigurations:m,snapshotMinSupportedVersion:h=0,getAllClusterSnapshots:b,persistSources:v,getDestinationCategories:y,getPotentialDestinations:C,testConnection:S,createDestination:k,createAction:w,createInstrumentationRule:D})=>{const I=g(),{isVm:N}=f(),{formatTimeAgo:T}=We(),[A,x]=n(!1),[$,E]=n(l||[]),R=c(async()=>{try{x(!0),E(await i()??[])}catch(e){}finally{x(!1)}},[]);o(()=>{$.length||R()},[]);const[O,F]=n(""),[M,P]=n(null),[_,B]=n([]),U=p(()=>M===Hn.BulkConfig?d:M===Hn.BulkSource?h:0,[M,d,h]),{supportedConnections:z,supportedConnectionIds:X}=p(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===L.Success,n=at(e.odigosVersion,t);return a&&n}))($,U);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[$.length,U]);o(()=>{if(!M||M===Hn.Delete)return;const e=_.filter(e=>!X.includes(e));e.length&&B(t=>t.filter(t=>!e.includes(t)))},[M,_.length,X.length]);const j=p(()=>$.filter(e=>!O||e.name.toLowerCase().includes(O.toLowerCase())).map(t=>({cells:[{key:Wn.Id,rawValue:t.id},{key:Wn.Name,rawValue:t.name},{key:Wn.Type,rawValue:t.type},{key:Wn.Status,rawValue:t.status,component:()=>(t=>{const a=t===L.Success?"Connection live":"Connection lost",n=t===L.Success?Vt:_t;return e(Ce,{status:t,label:a,leftIcon:n})})(t.status)},{key:Wn.OdigosVersion,rawValue:t.odigosVersion},{key:Wn.ConnectedSince,rawValue:t.connectedAt?T(t.connectedAt):"-"},{key:Wn.LastActivity,rawValue:t.lastSeenAt?T(t.lastSeenAt):"-"}],onClick:t.status!==L.Success||M?void 0:()=>s(t),isSelected:_.includes(t.id),onSelect:()=>B(e=>Array.from(new Set([...e,t.id]))),onDeselect:()=>B(e=>e.filter(e=>e!==t.id)),hideCheckbox:t.status!==L.Success||M===Hn.BulkConfig&&!at(t.odigosVersion,d)||M===Hn.BulkSource&&!at(t.odigosVersion,h)})),[$,_,O,M,d,h]),G=p(()=>{const e=(e,t)=>{B([e]),P(t)};return Yn({connections:$,configMinSupportedVersion:d,snapshotMinSupportedVersion:h,onDelete:t=>e(t,Hn.Delete),onAddSource:!N&&b&&v?t=>e(t,Hn.BulkSource):void 0,onAddDestination:!N&&y&&C&&k?t=>e(t,Hn.BulkDestination):void 0,onAddAction:!N&&w?t=>e(t,Hn.BulkAction):void 0,onAddInstrumentationRule:!N&&D?t=>e(t,Hn.BulkInstrumentationRule):void 0,onEditConfiguration:!N&&u&&m?t=>e(t,Hn.BulkConfig):void 0})},[N,$,d,u,m,h,b,v,y,C,k,w,D]),H=p(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:l,onAddInstrumentationRule:o,onManageConfigurations:i}=e,s=[];a&&s.push({id:tt(),type:nt.Button,buttonProps:{variant:V.Primary,size:J.S,label:"Add Sources",rightIcon:Ut,onClick:a}});const r=[n?{id:Hn.BulkDestination,label:Ee.ADD_DESTINATION,icon:Mt}:null,l?{id:Hn.BulkAction,label:Ee.ADD_ACTION,icon:Ft}:null,o?{id:Hn.BulkInstrumentationRule,label:Ee.ADD_INSTRUMENTATION_RULE,icon:Bt}:null,i?{id:Hn.BulkConfig,label:"Manage Configurations",icon:zt}:null];return r.some(Boolean)&&s.push({id:tt(),type:nt.ButtonDropData,buttonProps:{variant:V.Secondary,size:J.S,label:"Bulk Operations",onClick:e=>{e===Hn.BulkSource?a?.():e===Hn.BulkDestination?n?.():e===Hn.BulkAction?l?.():e===Hn.BulkInstrumentationRule?o?.():e===Hn.BulkConfig&&i?.()}},dropDataProps:{alignX:Ze.Left,items:r}}),s.push({id:tt(),type:nt.Button,buttonProps:{variant:V.Text,size:J.S,label:lt.CANCEL,onClick:t}}),s})({onCancel:()=>B([]),onAddSource:!N&&b&&v?()=>P(Hn.BulkSource):void 0,onAddDestination:!N&&y&&C&&k?()=>P(Hn.BulkDestination):void 0,onAddAction:!N&&w?()=>P(Hn.BulkAction):void 0,onAddInstrumentationRule:!N&&D?()=>P(Hn.BulkInstrumentationRule):void 0,onManageConfigurations:!N&&u&&m?()=>P(Hn.BulkConfig):void 0}),[N,u,m,b,v,y,C,k,w,D]);return e(ot,{children:t(Ke,{richTitle:{icon:Yt,title:Ee.CONNECTIONS,badge:{label:$.length.toString(),status:_e.Unknown}},search:{placeholder:"Search by cluster name",value:O,onChange:e=>F(e),width:"300px"},actions:[{id:tt(),type:nt.Button,buttonProps:{variant:V.Secondary,size:J.S,leftIcon:Kt,onClick:R,disabled:A}}],children:[e(it,{variant:st.Pretty,maxHeight:a,headerBackgroundColor:I.v2.colors.silver[1e3],isLoading:A,withCheckboxes:!0,columns:qn,rows:j,rowActionsPushRightPosition:M?`calc(${ha} - 24px)`:void 0,getRowActions:G}),M===Hn.BulkConfig&&u&&m&&e(Ln,{onClose:()=>P(null),connections:z,selectedConnectionIds:_,setSelectedConnectionIds:B,getEffectiveConfig:u,onApply:m}),M===Hn.BulkSource&&b&&v&&e(dn,{selectedConnectionIds:_,getAllClusterSnapshots:b,children:e(Mn,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,persistSources:async e=>await(v?.(e))})}),M===Hn.BulkDestination&&y&&C&&S&&k&&e(Ha,{children:e(Dn,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,getDestinationCategories:y,getPotentialDestinations:C,testConnection:e=>S(e,_),createDestination:e=>k(e,_)})}),M===Hn.BulkAction&&w&&e(_a,{children:e(mn,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,createAction:e=>w(e,_)})}),M===Hn.BulkInstrumentationRule&&D&&e(on,{children:e(In,{onClose:()=>P(null),selectedConnectionIds:_,setSelectedConnectionIds:B,createInstrumentationRule:e=>D(e,_)})}),e(oa,{target:"connection",isOpen:M===Hn.Delete,onClose:()=>{B([]),P(null)},onApprove:async()=>{const e=_[0];e&&(await r(e),await R())}}),e(rt,{isOpen:!!_.length&&!M,richTitle:{icon:St,title:"Selected Clusters",badge:{label:_.length}},actions:H})]})})},Qn=h.div`
|
|
138
|
+
display: flex;
|
|
139
|
+
align-items: center;
|
|
140
|
+
justify-content: space-between;
|
|
141
|
+
gap: 8px;
|
|
142
|
+
padding: 16px;
|
|
143
|
+
width: calc(100% - 32px);
|
|
144
|
+
border-radius: 16px;
|
|
145
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
146
|
+
`,Zn=h.div`
|
|
147
|
+
display: flex;
|
|
148
|
+
align-items: center;
|
|
149
|
+
justify-content: center;
|
|
150
|
+
padding: 8px;
|
|
151
|
+
border-radius: 8px;
|
|
152
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+B["004"]};
|
|
153
|
+
`,el=({setStep:a,onSave:n,sourcesPayload:l,destinationsPayload:o})=>{const i=g(),s=()=>a(2),r=()=>a(3),c=p(()=>Object.values(l||{}).flatMap((a,n)=>a.map((a,l)=>{if(!a.selected)return null;const o=a.kind||Ae.Namespace,s=o===Ae.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return t(Qn,{children:[e(_,{nowrap:!0,children:s}),e(Ce,{label:o,status:L.Info,backgroundColor:i.v2.colors.blue[900]})]},`source-${n}-${l}`)})).filter(Boolean),[l]),d=p(()=>o?.map((a,n)=>{const l=Le(a.option.type).icon;return t(Qn,{children:[t(w,{$gap:8,children:[l&&e(Zn,{children:e(l,{size:24})}),e(_,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&e(Ce,{status:a.testResult.succeeded?L.Success:L.Error,leftIcon:a.testResult.succeeded?Vt:_t})]},`destination-${n}`)})||[],[o]);return e(Sa,{isOpen:!0,onBack:()=>a(3),onSave:n,header:{icon:kt,title:Ee.SUMMARY,subTitle:Ee.REVIEW_SETUP},leftColumn:{width:"50%",header:t(w,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(w,{$gap:8,children:[e(Ut,{size:24}),e(_,{nowrap:!0,children:Ee.SELECTED_SOURCES}),e(Ce,{label:c.length})]}),e(P,{"data-id":"summary-edit-sources",leftIcon:Et,variant:V.Secondary,size:J.S,onClick:s})]}),list:c.length?c:[e(A,{$height:"100%",children:e(x,{icon:Ut,title:Ee.NO_SOURCES_SELECTED,subTitle:Ee.ADD_SOURCE_PROMPT,button:{leftIcon:Tt,label:Ee.ADD_SOURCE,onClick:s}})},"no-sources-data")]},rightColumn:{width:"50%",header:t(w,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[t(w,{$gap:8,children:[e(Mt,{size:24}),e(_,{nowrap:!0,children:Ee.SELECTED_DESTINATIONS}),e(Ce,{label:d.length})]}),e(P,{"data-id":"summary-edit-destinations",leftIcon:Et,variant:V.Secondary,size:J.S,onClick:r})]}),list:d.length?d:[e(A,{"data-id":"summary-no-destinations",$height:"100%",children:e(x,{icon:Mt,title:Ee.NO_DESTINATIONS_SELECTED,subTitle:Ee.ADD_DESTINATION_PROMPT,button:{leftIcon:Tt,label:Ee.ADD_DESTINATIONS,onClick:r}})},"no-destinations-data")]}})},tl=h.div`
|
|
154
|
+
position: relative;
|
|
155
|
+
overflow: hidden;
|
|
156
|
+
width: calc(100vw - ${({$paddingXAxis:e})=>e});
|
|
157
|
+
height: calc(100vh - ${({$paddingYAxis:e})=>e});
|
|
158
|
+
box-sizing: border-box;
|
|
159
|
+
`,al=h.svg`
|
|
160
|
+
position: absolute;
|
|
161
|
+
top: 50%;
|
|
162
|
+
left: 50%;
|
|
163
|
+
transform: translate(-50%, -50%);
|
|
164
|
+
z-index: -1;
|
|
165
|
+
`,nl=[{opacity:"0.1"},{offset:"0.31",opacity:"0.11"},{offset:"0.45",opacity:"0.14"},{offset:"0.56",opacity:"0.19"},{offset:"0.65",opacity:"0.26"},{offset:"0.73",opacity:"0.35"},{offset:"0.8",opacity:"0.46"},{offset:"0.86",opacity:"0.6"},{offset:"0.92",opacity:"0.76"},{offset:"0.98",opacity:"0.93"},{offset:"1"}],ll=[{width:1440,height:900,pathOpacity:.1,path:"M719.992 1169.99C322.351 1169.99 0 847.64 0 450C0 52.3591 322.351 -269.992 719.992 -269.992C1117.63 -269.992 1439.98 52.3591 1439.98 450C1439.98 847.64 1117.63 1169.99 719.992 1169.99Z",gradientTransform:"translate(814.309 444.011) rotate(180) scale(718.904)",stops:[{opacity:"0.1"},{offset:"0.41",opacity:"0.11"},{offset:"0.56",opacity:"0.13"},{offset:"0.67",opacity:"0.18"},{offset:"0.75",opacity:"0.25"},{offset:"0.83",opacity:"0.33"},{offset:"0.89",opacity:"0.44"},{offset:"0.95",opacity:"0.56"},{offset:"1",opacity:"0.7"}]},{width:1343,height:900,pathOpacity:.3,path:"M671.344 1121.34C300.571 1121.34 0 820.773 0 450C0 79.2264 300.571 -221.345 671.344 -221.345C1042.12 -221.345 1342.69 79.2264 1342.69 450C1342.69 820.773 1042.12 1121.34 671.344 1121.34Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:nl},{width:1163,height:900,pathOpacity:.5,path:"M581.31 1031.31C260.261 1031.31 0 771.048 0 449.999C0 128.951 260.261 -131.311 581.31 -131.311C902.358 -131.311 1162.62 128.951 1162.62 449.999C1162.62 771.048 902.358 1031.31 581.31 1031.31Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:nl},{width:798,height:798,pathOpacity:.7,path:"M398.581 797.162C178.451 797.162 0 618.711 0 398.581C0 178.451 178.451 0 398.581 0C618.711 0 797.162 178.451 797.162 398.581C797.162 618.711 618.711 797.162 398.581 797.162Z",gradientTransform:"translate(445.003 392.441) rotate(180) scale(398.23)",stops:nl}],ol=({paddingXAxis:a="0px",paddingYAxis:l="0px",children:i})=>{const[s,r]=n(window.innerWidth),c=p(()=>s/ll[0].width,[s]);return o(()=>{const e=()=>r(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),t(tl,{$paddingXAxis:a,$paddingYAxis:l,children:[ll.map(({width:a,height:n,pathOpacity:l,path:o,gradientTransform:i,stops:s},r)=>{const d=`purple-ring-${r}`;return t(al,{width:a*c,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[e("path",{opacity:l,d:o,fill:`url(#${d})`}),e("defs",{children:e("radialGradient",{id:d,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:i,children:s.map(({offset:t,opacity:a},n)=>e("stop",{offset:t,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},d)}),i]})},il=h.div`
|
|
166
|
+
display: flex;
|
|
167
|
+
flex-direction: column;
|
|
168
|
+
align-items: center;
|
|
169
|
+
justify-content: center;
|
|
170
|
+
gap: 32px;
|
|
171
|
+
padding: 32px;
|
|
172
|
+
max-width: 700px;
|
|
173
|
+
width: 50vw;
|
|
174
|
+
border-radius: 16px;
|
|
175
|
+
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
176
|
+
`,sl=h.div`
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
align-items: center;
|
|
180
|
+
justify-content: center;
|
|
181
|
+
gap: 24px;
|
|
182
|
+
max-width: 500px;
|
|
183
|
+
& * {
|
|
184
|
+
text-align: center;
|
|
185
|
+
}
|
|
186
|
+
`,rl=({onStart:a})=>e($,{width:"75vw",isOpen:!0,hideOverlay:!0,children:e(A,{$height:"100%",children:t(il,{children:[t(sl,{children:[e(_,{size:R.L,weight:500,children:Ee.GET_STARTED_WITH}),e(ia,{size:260}),e(_,{size:R.S,weight:400,children:Ee.GET_STARTED_DESCRIPTION})]}),e(P,{"data-id":"onboarding-get-started",label:lt.GET_STARTED,rightIcon:Dt,size:J.L,onClick:a})]})})}),cl=[{step:1,label:Ee.INSTALLATION,forceDoneBadge:!0},{step:2,label:Ee.SOURCES_SETUP},{step:3,label:Ee.DESTINATIONS_SETUP},{step:4,label:Ee.SUMMARY}],dl=h.div`
|
|
187
|
+
display: flex;
|
|
188
|
+
flex-direction: column;
|
|
189
|
+
gap: 32px;
|
|
190
|
+
padding: 64px;
|
|
191
|
+
`,ul=({pagePaddingXAxis:a,pagePaddingYAxis:l,fetchNamespacesWithWorkloads:o,persistSources:i,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,onDone:u})=>{const[p,m]=n(1),[h,g]=n(!1),[b,f]=n(null),[v,y]=n(null),C=()=>m(e=>e+1),S=()=>m(e=>e-1);return t(ol,{paddingXAxis:a,paddingYAxis:l,children:[t(dl,{children:[e(ia,{}),e(ct,{currentStep:p,data:cl,gap:32})]}),t(Ha,{children:[1===p&&e(rl,{onStart:C}),2===p&&e(dn,{fetchNamespacesWithWorkloads:o,initialInputs:b,children:e(Mn,{onBack:e=>{f(e),S()},onNext:e=>{f(e),C()},persistSources:i})}),3===p&&e(Dn,{onBack:e=>{y(e),S()},onNext:e=>{y(e),C()},getDestinationCategories:s,getPotentialDestinations:r,initialInputs:v,testConnection:c,createDestination:d}),4===p&&e(el,{setStep:m,onSave:async()=>{if(!h){g(!0);try{const e=[];b&&e.push(i(b)),v&&e.push(...v.map(e=>d(e.formData)));const t=await Promise.allSettled(e),a=[];for(const e of t)"rejected"===e.status?a.push(e.reason?.message||String(e.reason)):e.value?.error&&a.push(e.value.error);if(a.length)return{error:a.join("\n")};u()}catch(e){return g(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:b,destinationsPayload:v})]})]})},pl=h.div`
|
|
131
192
|
display: flex;
|
|
132
193
|
align-items: center;
|
|
133
194
|
justify-content: space-between;
|
|
@@ -139,10 +200,10 @@ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect
|
|
|
139
200
|
&:hover {
|
|
140
201
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
141
202
|
}
|
|
142
|
-
`,
|
|
143
|
-
animation-name: ${
|
|
144
|
-
`,
|
|
203
|
+
`,ml=h.div`
|
|
204
|
+
animation-name: ${mt.in};
|
|
205
|
+
`,hl=({pod:l,getExtendedPodInfo:i,onClose:s})=>{const{formatTimeAgo:r}=We(),[c,d]=n(null),[u,m]=n(!1);o(()=>{l?i(l.namespace,l.name).then(e=>d(e??null)):(d(null),m(!1))},[l]);const h=p(()=>[{id:tt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:tt(),title:"Status",badge:{status:dt(c?.status),label:c?.status??"-"}}],[c]),g=p(()=>c?.containers?.map(e=>({id:tt(),items:[{id:tt(),title:"Container",label:e.name??"-"},{id:tt(),title:"Status",label:e.startedAt?`${e.status} (since ${r(e.startedAt)})`:e.status},{id:tt(),title:"Ready",badge:{status:e.ready?L.Success:L.Error,leftIcon:e.ready?St:xt,label:e.ready?"True":"False",invertColors:!0}},{id:tt(),title:"Started",badge:{status:e.started?L.Success:L.Error,leftIcon:e.started?St:xt,label:e.started?"True":"False",invertColors:!0}},{id:tt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:tt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:tt(),title:"Restarts",label:e.restarts.toString()},{id:tt(),title:"State Reason",label:e.stateReason??"-"},{id:tt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:tt(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return t($,{isOpen:!!l,header:{icon:Jt,title:"Pod Information",onClose:s},children:[c?null:e(A,{children:e(ut,{})}),c?t(a,{children:[e(Ke,{richTitle:{icon:Jt,title:c.name,withCopy:!0},children:t(S,{$gap:24,children:[e(et,{cellsPerRow:2,items:h}),g.length>0&&t(S,{$gap:12,children:[t(pl,{onClick:()=>m(e=>!e),children:[e(_,{children:"Containers Overview"}),e(Re,{icon:u?Lt:Pt})]}),u&&g.map(({id:t,items:a})=>e(ml,{children:e(et,{cellsPerRow:2,items:a})},t))]})]})}),e(Ke,{richTitle:{icon:qt,title:"Kubectl Commands"},children:t(S,{$gap:12,children:[e(pt,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),e(pt,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),e(pt,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]})}),e(na,{yaml:c.manifestYAML,defaultOpen:!0})]}):null]})};var gl;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(gl||(gl={}));const bl=[{key:gl.PodName,label:"Pod Name"},{key:gl.Status,label:"Status"},{key:gl.Restarts,label:"Restarts",textAlign:"right"},{key:gl.NodeName,label:"Node Name"},{key:gl.Age,label:"Age",textAlign:"right"},{key:gl.DockerImage,label:"Docker Image",textAlign:"right"}],fl=({isLoading:a,tableRowsMaxHeight:l,pods:o,getExtendedPodInfo:i})=>{const s=g(),{formatTimeAgo:r}=We(),[c,d]=n(null),u=p(()=>o.map(a=>({onClick:()=>d(a),cells:[{key:gl.PodName,rawValue:a.name},{key:gl.Status,rawValue:a.status,component:()=>{return t=a.status,e(Ce,{status:dt(t),label:t});var t}},{key:gl.Restarts,rawValue:a.restartsCount.toString()},{key:gl.NodeName,rawValue:a.nodeName},{key:gl.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return e(_,{children:"-"});const l=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),o=l>0?Math.round((n?.metricsDroppedRps??0)/l*100):0,i=o>0?L.Error:L.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?L.Error:L.Success;return t(w,{$gap:4,children:[e(me,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:e(Ce,{status:i,label:`Receiver ${o}%`,leftIcon:i===L.Error?Qt:Zt,useSecondaryTone:!0,invertColors:!0})}),e(me,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:e(Ce,{status:c,label:`Exporter ${r}%`,leftIcon:c===L.Error?Qt:Zt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:gl.Age,rawValue:r(a.creationTimestamp)},{key:gl.DockerImage,rawValue:a.image}]})),[o,s]);return t(Ke,{richTitle:{icon:Jt,title:"Pods"},children:[e(it,{variant:st.Data,maxHeight:l,isLoading:a,columns:bl,rows:u}),e(hl,{pod:c,getExtendedPodInfo:i,onClose:()=>d(null)})]})};var vl;!function(e){e.Gateway="gateway",e.Node="node"}(vl||(vl={}));const yl=[{value:vl.Gateway,label:"Gateway"},{value:vl.Node,label:"Node Collector"}],Cl=h.div`
|
|
145
206
|
display: flex;
|
|
146
207
|
align-items: center;
|
|
147
208
|
justify-content: space-between;
|
|
148
|
-
`,
|
|
209
|
+
`,Sl=({selectedTab:a,setSelectedTab:n,onClickDownloadDiagnose:l,onClickRefresh:o,loading:i,disabled:s})=>{const r=p(()=>{const e=[];return l&&e.push({id:tt(),type:nt.Button,buttonProps:{label:"Download Diagnose",leftIcon:Wt,size:J.S,variant:V.Text,onClick:l,disabled:s}}),o&&e.push({id:tt(),type:nt.Button,buttonProps:{label:"Refresh",leftIcon:Kt,size:J.S,variant:V.Text,onClick:o,disabled:s,loading:i}}),e},[l,o,s,i]);return t(Cl,{children:[t(w,{$gap:12,children:[t(w,{$gap:8,children:[e(ea,{size:32}),e(_,{size:R.M,weight:500,children:"Pipeline Collectors"})]}),e(ae,{options:yl,selected:a,setSelected:n,disabled:s})]}),e(ht,{actions:r})]})},kl=({isOpen:t,onClose:a,title:n,yaml:l})=>e($,{isOpen:t,header:{icon:ta,title:n,onClose:a},children:e(na,{yaml:l,defaultOpen:!0})});var wl;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(wl||(wl={}));const Dl=({richTitle:a,statusCard:l,textCards:o,manifestYaml:i,configMapYaml:s})=>{const[r,c]=n(null);return t(Ke,{richTitle:a,actions:[{id:tt(),type:nt.ButtonDropData,buttonProps:{variant:V.Secondary,size:J.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:wl.ManifestYaml,label:a.title,icon:aa},{id:wl.ConfigMapYaml,label:"ConfigMap",icon:aa}]}}],children:[t(w,{$gap:16,children:[e(gt,{...l}),o.map(t=>e(bt,{...t},t.title))]}),e(kl,{isOpen:r===wl.ManifestYaml,onClose:()=>c(null),title:a.title,yaml:i}),e(kl,{isOpen:r===wl.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:s})]})},Il=e=>{switch(e){case ft.Healthy:return"All desired replicas are updated, available, and ready";case ft.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ft.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ft.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ft.Down:return"No available replicas";case ft.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Nl=({minSupportedVersion:a=0,tableRowsMaxHeight:l,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:r,getNodeCollectorPods:d,getExtendedPodInfo:u})=>{const{formatTimeAgo:m}=We(),{isVersionSupported:h,version:g}=f(a),[b,v]=n(!1),[y,C]=n(vl.Gateway),[S,k]=n(null),[w,D]=n([]),[I,N]=n(null),[T,A]=n([]),x=c(async()=>{v(!0);try{switch(y){case vl.Gateway:k(await i()??null),D(await s()??[]);break;case vl.Node:N(await r()??null),A(await d()??[])}}catch(e){}v(!1)},[y]);o(()=>{x()},[x]);const $=p(()=>(e=>{switch(e){case vl.Gateway:return"Deployment";case vl.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(y),[y]),E=p(()=>((e,t,a,n)=>{const l={status:_e.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case vl.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case vl.Node:o=a?.rolloutInProgress??!1,i=a?.lastRolloutAt??null;break;default:return l}return o?{status:L.Info,label:"Rollout in progress",rightIcon:Kt,useSecondaryTone:!0}:i?{status:_e.Disabled,label:`Last Rollout: ${n(i)}`}:l})(y,S,I,m),[S,I,y,m]),R=p(()=>((e,t,a,n)=>{let l=n?L.Info:_e.Unknown,o=n?"Loading":ft.Unknown,i=n?"Fetching data...":Il(ft.Unknown);switch(e){case vl.Gateway:l=t?.status?dt(t?.status):l,o=t?.status??o,i=t?.status?Il(t.status):i;break;case vl.Node:l=a?.status?dt(a?.status):l,o=a?.status??o,i=a?.status?Il(a.status):i}return{status:l,title:o,description:i}})(y,S,I,b),[S,I,y,b]),O=p(()=>((e,t,a,n)=>{switch(e){case vl.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:n},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:n},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:n},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:n}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:n},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:n}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:n},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:n}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:n}]}];case vl.Node:return[{title:"Nodes",cells:[{label:"Desired",value:a?.nodes?.desired.toString()??"-",isLoading:n},{label:"Ready",value:a?.nodes?.ready.toString()??"-",isLoading:n}]},{title:"Requests",cells:[{label:"CPU",value:a?.resources?.requests.cpu??"-",isLoading:n},{label:"Memory",value:a?.resources?.requests.memory??"-",isLoading:n}]},{title:"Limits",cells:[{label:"CPU",value:a?.resources?.limits.cpu??"-",isLoading:n},{label:"Memory",value:a?.resources?.limits.memory??"-",isLoading:n}]},{title:"Docker Image",cells:[{value:a?.imageVersion??"-",isLoading:n}]}];default:return[]}})(y,S,I,b),[S,I,y,b]),F=p(()=>(y===vl.Gateway?S?.manifestYAML:I?.manifestYAML)??"",[S,I,y]),M=p(()=>(y===vl.Gateway?S?.configMapYAML:I?.configMapYAML)??"",[S,I,y]),P=p(()=>y===vl.Gateway?w:T,[w,T,y]);return t(ot,{children:[e(Sl,{disabled:!h,loading:b,selectedTab:y,setSelectedTab:C,onClickDownloadDiagnose:void 0,onClickRefresh:x}),t(vt,{children:[e(Dl,{richTitle:{icon:ta,title:$,badge:E},statusCard:R,textCards:O,manifestYaml:F,configMapYaml:M}),e(fl,{isLoading:b,tableRowsMaxHeight:l,pods:P,getExtendedPodInfo:u}),!h&&e(ca,{minSupportedVersion:a,currentVersion:g||""})]})]})};export{mn as AddActionDrawer,Ua as AddActionForm,_a as AddActionFormContextProvider,Dn as AddDestinationDrawer,Ka as AddDestinationForm,Ha as AddDestinationFormContextProvider,In as AddRuleDrawer,rn as AddRuleForm,on as AddRuleFormContextProvider,Mn as AddSourceDrawer,dn as AddSourceFormContextProvider,Jn as CentralConnections,Ln as EditConfigDrawer,ul as Onboarding,Nl as PipelineCollectors,Gn as SystemDrawer,Ba as useAddActionFormContext,Wa as useAddDestinationFormContext,sn as useAddRuleFormContext,un as useAddSourceFormContext};
|