@odigos/ui-kit 0.0.194 → 0.0.196
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 +24 -0
- package/lib/chunks/index-CjudHPMe.js +3 -0
- package/lib/chunks/ui-components-OrgB9V7b.js +2381 -0
- package/lib/chunks/vendor-DUWBN0Mg.js +1 -0
- package/lib/components/_v2/drawer/header/index.d.ts +1 -0
- package/lib/components/_v2/index.d.ts +1 -0
- package/lib/components/_v2/loader/index.d.ts +1 -0
- package/lib/components/_v2/no-data/index.d.ts +10 -0
- package/lib/components/_v2/table/styled.d.ts +5 -8
- package/lib/components/_v2/table/table-rows/index.d.ts +1 -1
- package/lib/components/_v2/typography/index.d.ts +2 -0
- package/lib/components/scroll-y/index.d.ts +5 -3
- package/lib/components/styled.d.ts +1 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants/actions/index.d.ts +2 -0
- package/lib/constants/destinations/index.d.ts +10 -4
- package/lib/constants/sources/index.d.ts +1 -1
- package/lib/constants/strings/index.d.ts +16 -0
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/_drawers/add-action-drawer/helpers.d.ts +7 -0
- package/lib/containers/_v2/_drawers/add-action-drawer/index.d.ts +10 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/form-column/index.d.ts +9 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/helpers.d.ts +14 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/index.d.ts +12 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/lists-column/index.d.ts +13 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/lists-filters/index.d.ts +9 -0
- package/lib/containers/_v2/_drawers/add-destination-drawer/types.d.ts +11 -0
- package/lib/containers/_v2/_drawers/add-source-drawer/index.d.ts +2 -2
- package/lib/containers/_v2/_drawers/add-source-drawer/namespaces-column/index.d.ts +6 -7
- package/lib/containers/_v2/_drawers/add-source-drawer/namespaces-column/list/index.d.ts +12 -0
- package/lib/containers/_v2/_drawers/add-source-drawer/namespaces-column/list/list-item/index.d.ts +20 -0
- package/lib/containers/_v2/_drawers/add-source-drawer/utils.d.ts +15 -0
- package/lib/containers/_v2/_drawers/index.d.ts +2 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/add-cluster-info/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/delete-attributes/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/error-sampler/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/index.d.ts +7 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/k8s-attributes/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/latency-sampler/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/pii-masking/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/probabilistic-sampler/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/rename-attributes/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/service-name-sampler/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/custom-fields/span-attribute-sampler/index.d.ts +5 -0
- package/lib/containers/_v2/_forms/add-action-form/index.d.ts +7 -0
- package/lib/containers/_v2/_forms/add-destination-form/dynamic-fields/index.d.ts +8 -0
- package/lib/containers/_v2/_forms/add-destination-form/index.d.ts +8 -0
- package/lib/containers/_v2/_forms/index.d.ts +2 -0
- package/lib/containers/_v2/central-connections/index.d.ts +5 -1
- package/lib/containers/v2.js +76 -27
- package/lib/containers.js +111 -121
- package/lib/contexts.js +1 -1
- package/lib/functions/compare-condition/index.d.ts +2 -1
- package/lib/functions.js +1 -1
- package/lib/hooks/index.d.ts +0 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets/_v2/wide-drawer/column/index.d.ts +0 -1
- package/lib/snippets/_v2/wide-drawer/column-list-collapse/index.d.ts +8 -0
- package/lib/snippets/_v2/wide-drawer/column-list-item/index.d.ts +2 -0
- package/lib/snippets/_v2/wide-drawer/index.d.ts +6 -5
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/actions/index.d.ts +4 -1
- package/lib/types/destinations/index.d.ts +28 -11
- package/lib/types/enum/index.d.ts +0 -1
- package/lib/types/instrumentation-rules/index.d.ts +1 -1
- package/lib/types/snapshot/index.d.ts +2 -1
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +12 -12
- package/lib/chunks/index-CAnSZt6a.js +0 -3
- package/lib/chunks/ui-components-DzbQmwE9.js +0 -2365
- package/lib/chunks/vendor-C-kwkNJP.js +0 -1
- package/lib/hooks/useInfiniteScroll.d.ts +0 -10
package/lib/containers/v2.js
CHANGED
|
@@ -1,68 +1,117 @@
|
|
|
1
|
-
import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{useMemo as l,useEffect as a,Children as o,forwardRef as i,useState as r,useImperativeHandle as s,useRef as c,useCallback as d}from"react";import u,{useTheme as h,css as p}from"styled-components";import{F as g,T as m,a as b,C as f,b as C,c as w,d as v,H as y,I as k,P as $,G as x,J as S,e as I,f as D,g as T,h as A,i as L,B as P,j as M,k as R,D as O,l as V,S as N,m as z,n as E,o as F,p as j,q as H,W,V as G,N as q,r as U,s as Y,L as B,R as K,t as X,u as Z,v as J,w as Q,x as _,y as ee,O as te,z as ne,A as le,E as ae,K as oe,M as ie,Q as re,U as se,X as ce,Y as de,Z as ue,_ as he,$ as pe,a0 as ge,a1 as me,a2 as be,a3 as fe,a4 as Ce,a5 as we,a6 as ve,a7 as ye,a8 as ke,a9 as $e,aa as xe,ab as Se,ac as Ie,ad as De,ae as Te,af as Ae,ag as Le,ah as Pe,ai as Me,aj as Re,ak as Oe,al as Ve,am as Ne,an as ze,ao as Ee}from"../chunks/ui-components-DzbQmwE9.js";import{GoLogo as Fe,JavaLogo as je,BookIcon as He,VSquareIcon as We,XSquareIcon as Ge,OdigosLogo as qe,ChevronRightIcon as Ue,InstrumentationRuleIcon as Ye,SourceIcon as Be,SettingsIcon as Ke,XIcon as Xe,VIcon as Ze,EditIcon as Je,ExclamationTriangleIcon as Qe,ExclamationCircleIcon as _e,KeyIcon as et,DiagnoseIcon as tt,DownloadIcon as nt,TerminalIcon as lt,DeleteIcon as at,DestinationIcon as ot,ActionIcon as it,RefreshIcon as rt,ConnectionsIcon as st,PodIcon as ct,ChevronUpIcon as dt,ChevronDownIcon as ut,ArrowDownSquareIcon as ht,ArrowUpSquareIcon as pt,PipelineCollectorIcon as gt,GatewayIcon as mt,YamlIcon as bt}from"../icons.js";import{Y as ft}from"../chunks/index-CAnSZt6a.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C-kwkNJP.js";import"react-dom";import"@xyflow/react";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";const Ct=[{id:f.FilePath,label:"Collect File Path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:f.Function,label:"Collect Function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:f.LineNumber,label:"Collect Line Number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],wt=[{id:f.Column,label:"Collect Column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:f.Namespace,label:"Collect Namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:f.StackTrace,label:"Collect Stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],vt=["*"],yt=[{id:$.HttpRequest,label:"Collect HTTP Request",tooltip:""},{id:$.HttpResponse,label:"Collect HTTP Response",tooltip:""},{id:$.DbQuery,label:"Collect DB Query",tooltip:""},{id:$.Messaging,label:"Collect Messaging",tooltip:""}],kt={[I.Java]:[new S("","")],[I.Golang]:[new x("")]},$t={[L.CodeAttributes]:({value:o,setValue:i,formErrors:r})=>{const s=h(),c=r.codeAttributes,d=l(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);a(()=>{if(!d.length&&!c){const e={[f.FilePath]:!0,[f.Function]:!0,[f.LineNumber]:!0,[f.Column]:null,[f.Namespace]:null,[f.StackTrace]:null};i("codeAttributes",e)}},[]);const u=(e,t)=>{const n=t?[...d,e]:d.filter(t=>t!==e),l=Object.values(f).reduce((e,t)=>(e[t]=!!n.includes(t)||null,e),{});i("codeAttributes",l)};return e(t,{children:[e(g,{$gap:12,children:[n(m,{size:b.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),n(g,{$gap:6,children:Ct.map(({id:e,label:t,tooltip:l})=>n(C,{text:l,withIcon:!0,children:n(w,{label:t,value:d.includes(e),onChange:t=>u(e,t)})},e))}),n(v,{errorMessage:c})]}),e(g,{$gap:12,children:[n(m,{size:b.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),n(g,{$gap:6,children:wt.map(({id:e,label:t,tooltip:l})=>n(C,{text:l,withIcon:!0,children:n(w,{label:t,value:d.includes(e),onChange:t=>u(e,t)})},e))}),n(v,{errorMessage:c})]})]})},[L.CustomInstrumentation]:({value:o,setValue:i,formErrors:r})=>{const s=r.customInstrumentations,c=l(()=>(o?.customInstrumentations?.[I.Golang]||[]).map(e=>new x(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=l(()=>(o?.customInstrumentations?.[I.Java]||[]).map(e=>new S(e.className,e.methodName)),[o]);return a(()=>{o?.customInstrumentations||s||i("customInstrumentations",{[I.Golang]:kt[I.Golang],[I.Java]:kt[I.Java]})},[]),e(t,{children:[e(g,{children:[e(D,{$gap:8,children:[n(Fe,{}),n(T,{label:"Golang Custom Probes"})]}),n(A,{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:c,setValues:e=>{const t={};t[I.Golang]=e.map(e=>new x(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[I.Java]=d,i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[n(je,{}),n(T,{label:"Java Custom Probes"})]}),n(A,{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[I.Golang]=c,t[I.Java]=e.map(e=>new S(e.className,e.methodName)),i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[L.HeadersCollection]:({value:e,setValue:t,formErrors:o})=>{const i=o.headersCollection,r=l(()=>e?.headersCollection?.[y.HeaderKeys]||[],[e]),s=e=>{const n={[y.HeaderKeys]:e};t("headersCollection",n)};return a(()=>{r.length||i||s(vt)},[]),n(k,{label:"Header Keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:r,setValues:s,errorMessage:i})},[L.PayloadCollection]:({value:t,setValue:o,formErrors:i})=>{const r=h(),s=i.payloadCollection,c=l(()=>Object.entries(t.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[t]);return a(()=>{if(!c.length&&!s){const e={[$.HttpRequest]:{},[$.HttpResponse]:{},[$.DbQuery]:{},[$.Messaging]:{}};o("payloadCollection",e)}},[]),e(g,{$gap:12,children:[n(m,{size:b.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),n(g,{$gap:6,children:yt.map(({id:e,label:t,tooltip:l})=>n(C,{text:l,withIcon:!0,children:n(w,{label:t,value:c.includes(e),onChange:t=>((e,t)=>{const n=t?[...c,e]:c.filter(t=>t!==e),l={[$.HttpRequest]:n.includes($.HttpRequest)?{}:null,[$.HttpResponse]:n.includes($.HttpResponse)?{}:null,[$.DbQuery]:n.includes($.DbQuery)?{}:null,[$.Messaging]:n.includes($.Messaging)?{}:null};o("payloadCollection",l)})(e,t)})},e))}),n(v,{errorMessage:s})]})},[L.UnknownType]:null},xt=({ruleType:e,value:t,setValue:l,formErrors:a})=>{if(!e)return null;const o=$t[e];return o?n(o,{value:t,setValue:l,formErrors:a}):null},St=({option:t,formData:l,handleFormChange:a,formErrors:o})=>{const i=h();return e(g,{$gap:24,children:[e(D,{$gap:12,$alignItems:"flex-start",children:[n(m,{size:b.XXS,children:t.docsDescription}),n(P,{label:"Docs",leftIcon:He,variant:R.Secondary,size:M.S,onClick:()=>window.open(`${O}${t.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[n(m,{size:b.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),t.supportedLanguages.map(e=>n(V,{label:z[e],leftIcon:E(e),status:N.Default,useSecondaryTone:!0},e))]}),n(F,{options:[{icon:We,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:Ge,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>a("disabled",e)}),n(j,{label:"Rule name",placeholder:"Use a name that describes the rule...",value:l.ruleName,onChange:({target:{value:e}})=>a("ruleName",e),errorMessage:o.ruleName}),n(xt,{ruleType:t.type,value:l,setValue:(e,t)=>a(e,t),formErrors:o}),n(H,{label:"Notes",placeholder:"Your personal notes...",value:l.notes,onChange:({target:{value:e}})=>a("notes",e),errorMessage:o.notes})]})},It=({isOpen:e,onClose:t,onDeny:l,onApprove:a})=>n(W,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:e,onClose:t,onDeny:l,denyLabel:"Keep editing",onApprove:a,approveLabel:"Discard changes"}),Dt=({isOpen:e,onClose:t,onDeny:l,onApprove:a,action:o="delete",target:i})=>{const r=o.charAt(0).toUpperCase()+o.substring(1),s=i?.endsWith("s")?"these":"this";return n(W,{title:`${r}${i?` ${i}`:""}?`,description:`Are you sure you want to ${o}${i?` ${s} ${i}`:""}?`,isOpen:e,onClose:t,onDeny:l,denyLabel:"Go back",onApprove:a,approveLabel:r})},Tt=({minSupportedVersion:e,currentVersion:t})=>n(W,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>n(G,{scale:2.4,icon:()=>n("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:n("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: ${t}.`}),At=u.div`
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{useEffect as a,useState as n,useRef as o,forwardRef as i,useImperativeHandle as r,useMemo as s,Children as c,useCallback as d}from"react";import u,{useTheme as h}from"styled-components";import{A as p,F as m,a as g,C as b,b as f,I as C,c as y,i as v,d as w,K as k,T as S,e as $,f as x,g as I,h as T,W as A,j as N,M as D,k as O,V,S as F,l as M,N as R,D as P,L,m as E,R as z,n as j,o as q,p as H,B as _,q as B,r as K,s as W,t as G,u as J,v as U,w as Y,x as X,y as Z,z as Q,E as ee,G as te,H as le,J as ae,O as ne,P as oe,Q as ie,U as re,X as se,Y as ce,Z as de,_ as ue,$ as he,a0 as pe,a1 as me,a2 as ge,a3 as be,a4 as fe,a5 as Ce,a6 as ye,a7 as ve,a8 as we,a9 as ke,aa as Se,ab as $e,ac as xe,ad as Ie,ae as Te,af as Ae,ag as Ne,ah as De,ai as Oe,aj as Ve,ak as Fe,al as Me,am as Re,an as Pe,ao as Le,ap as Ee,aq as ze,ar as je,as as qe,at as He,au as _e,av as Be,aw as Ke,ax as We,ay as Ge,az as Je,aA as Ue,aB as Ye,aC as Xe,aD as Ze,aE as Qe,aF as et,aG as tt,aH as lt,aI as at,aJ as nt,aK as ot,aL as it,aM as rt}from"../chunks/ui-components-OrgB9V7b.js";import{VSquareIcon as st,OdigosLogo as ct,BookIcon as dt,XSquareIcon as ut,GoLogo as ht,JavaLogo as pt,ChevronRightIcon as mt,ActionIcon as gt,DestinationIcon as bt,ChevronUpIcon as ft,ChevronDownIcon as Ct,InstrumentationRuleIcon as yt,SourceIcon as vt,SettingsIcon as wt,XIcon as kt,VIcon as St,EditIcon as $t,ExclamationTriangleIcon as xt,ExclamationCircleIcon as It,KeyIcon as Tt,DiagnoseIcon as At,DownloadIcon as Nt,TerminalIcon as Dt,DeleteIcon as Ot,RefreshIcon as Vt,ConnectionsIcon as Ft,PodIcon as Mt,ArrowDownSquareIcon as Rt,ArrowUpSquareIcon as Pt,PipelineCollectorIcon as Lt,GatewayIcon as Et,YamlIcon as zt}from"../icons.js";import{Y as jt}from"../chunks/index-CjudHPMe.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-DUWBN0Mg.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const qt=[{id:"CREDIT_CARD",label:"Credit card"}],Ht=[{id:p.CollectContainerAttributes,label:"Collect container attributes"},{id:p.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:p.CollectWorkloadId,label:"Collect workload ID"},{id:p.CollectClusterId,label:"Collect cluster ID"}],_t=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Bt=[{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:_t}],Kt=[{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:_t}],Wt=[{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:y.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:y.Number}],Gt=[{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:y.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:y.Number}],Jt=[{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:y.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:I.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:I.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}],Ut={[T.K8sAttributes]:({value:n,setValue:o,formErrors:i})=>(a(()=>{n[p.CollectContainerAttributes]||n[p.CollectReplicaSetAttributes]||n[p.CollectWorkloadId]||n[p.CollectClusterId]||n[p.LabelsAttributes]?.length||n[p.AnnotationsAttributes]?.length||(o(p.CollectContainerAttributes,!0),o(p.CollectReplicaSetAttributes,!0),o(p.CollectWorkloadId,!0),o(p.CollectClusterId,!0),o(p.LabelsAttributes,[]),o(p.AnnotationsAttributes,[]))},[]),e(l,{children:[t(m,{$gap:6,children:Ht.map(({id:l,label:a})=>e(m,{children:[t(b,{label:a,value:n[l]||!1,onChange:e=>o(l,e)}),t(f,{errorMessage:i[l]})]},l))}),t(w,{label:"Label attributes",limitFieldsPerRow:2,columns:Bt,values:n[p.LabelsAttributes]||[],setValues:e=>o(p.LabelsAttributes,e),errorMessage:i[p.LabelsAttributes]}),t(w,{label:"Annotation attributes",limitFieldsPerRow:2,columns:Kt,values:n[p.AnnotationsAttributes]||[],setValues:e=>o(p.AnnotationsAttributes,e),errorMessage:i[p.AnnotationsAttributes]})]})),[T.AddClusterInfo]:({value:a,setValue:n,formErrors:o})=>{const i=h();return e(l,{children:[t(S,{label:"Overwrite existing values",labelAlign:$.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:a[p.OverwriteExistingValues]||!1,onChange:e=>n(p.OverwriteExistingValues,e)}),t(w,{label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:a[p.ClusterAttributes]||[],setValues:e=>n(p.ClusterAttributes,e),errorMessage:o[p.ClusterAttributes]})]})},[T.DeleteAttributes]:({value:e,setValue:l,formErrors:a})=>t(x,{label:"Attributes to delete",values:e[p.AttributeNamesToDelete]||[],setValues:e=>l(p.AttributeNamesToDelete,e),errorMessage:a[p.AttributeNamesToDelete]}),[T.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[p.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),l(p.Renames,t)},errorMessage:a[p.Renames]}),[T.PiiMasking]:({value:l,setValue:n,formErrors:o})=>(a(()=>{l[p.PiiCategories]?.length||n(p.PiiCategories,qt.map(({id:e})=>e))},[]),e(m,{$gap:12,children:[t(g,{label:"Attributes to mask"}),t(m,{$gap:6,children:qt.map(({id:e,label:a})=>t(b,{label:a,value:l[p.PiiCategories]?.includes(e)||!1,onChange:t=>{const a=l[p.PiiCategories]||[],o=t?[...a,e]:a.filter(t=>t!==e);n(p.PiiCategories,o)}},e))}),t(f,{errorMessage:o[p.PiiCategories]})]})),[T.ErrorSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.FallbackSamplingRatio],o=v(e[p.FallbackSamplingRatio])?"":String(e[p.FallbackSamplingRatio]);return t(C,{label:"Fallback sampling ratio",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(p.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[T.ProbabilisticSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.SamplingPercentage],o=v(e[p.SamplingPercentage])?"":String(e[p.SamplingPercentage]);return t(C,{label:"Sampling percentage",type:y.Number,min:0,max:100,value:o,placeholder:"0-100",onChange:e=>{return t=e.target.value,l(p.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[T.LatencySampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.EndpointsFilters],o=e[p.EndpointsFilters]||[];return t(w,{limitFieldsPerRow:2,columns:Wt,values:o,setValues:e=>{l(p.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:l,fallbackSamplingRatio:a})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(l),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[T.ServiceNameSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.ServicesNameFilters],o=e[p.ServicesNameFilters]||[];return t(w,{limitFieldsPerRow:2,columns:Gt,values:o,setValues:e=>{l(p.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:l})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(l)})))},errorMessage:n})},[T.SpanAttributeSampler]:({value:e,setValue:l,formErrors:a})=>{const n=a[p.AttributeFilters],o=(e[p.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:Jt,values:o,setValues:e=>{l(p.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})}},Yt=({actionType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=Ut[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},Xt=({isOpen:e,onClose:l,onDeny:a,onApprove:n})=>t(A,{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"}),Zt=({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(A,{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})},Qt=(e,t)=>!t?.length||!!t?.find(t=>t===e),el=({title:l="Signals",required:i,errorMessage:r,allowedSignals:s,selectedSignals:c,setSelectedSignals:d})=>{const[u,h]=n(1===c.length),p=o(JSON.stringify(c));return a(()=>{const e=N(c);e.length||D.forEach(({id:t})=>{Qt(t,s)&&e.push(t)});const t=JSON.stringify(e);p.current!==t&&(p.current=t,d(e),h(1===e.length))},[s,c]),e(m,{$gap:12,children:[t(g,{label:l,required:i}),t(O,{$gap:12,children:D.map(e=>{const l=Qt(e.id,s),a=((e,t)=>!!t?.find(t=>t===e))(e.id,c);return l?t(b,{label:e.value,disabled:!l||u&&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(f,{errorMessage:r})]})},tl=({minSupportedVersion:e,currentVersion:l})=>t(A,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>t(V,{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}.`}),ll=u.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
justify-content: flex-end;
|
|
5
5
|
width: ${({$width:e})=>e};
|
|
6
|
-
gap: 12px;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
gap: ${({$withHeader:e})=>e?"0":"12px"};
|
|
7
|
+
`,al=u.div`
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
min-height: 24px;
|
|
11
|
+
padding: 12px;
|
|
12
|
+
border-radius: 16px 16px 0 0;
|
|
13
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
14
|
+
`,nl=u.div`
|
|
13
15
|
display: flex;
|
|
14
16
|
flex-direction: column;
|
|
15
17
|
gap: ${({$gap:e})=>e}px;
|
|
16
18
|
padding: 12px;
|
|
17
19
|
width: calc(100% - 24px);
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
|
|
21
|
+
// TODO: This is a hack to make the list height dynamic and scrollable. We need to find a better way to do this.
|
|
22
|
+
height: ${({$withHeader:e,$withSubHeader:t})=>`calc(100vh - 288px${e&&t?" - 56px":e||t?e||t?" - 12px":"":" + 36px"})`};
|
|
23
|
+
|
|
24
|
+
border-radius: ${({$withHeader:e,$isLeft:t,$isRight:l})=>e?t?"0 0 0 16px":l?"0 16px 0 0":"0":t?"16px 0 0 16px":l?"0 16px 16px 0":"16px"};
|
|
20
25
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
21
26
|
overflow-y: auto;
|
|
22
27
|
overflow-x: hidden;
|
|
23
|
-
`,
|
|
28
|
+
`,ol=({isLeft:a,isRight:n,parentHasSubHeader:o,width:i,header:r,list:s})=>e(ll,{$width:i,$withHeader:!!r,children:[r&&t(al,{children:r}),t(nl,{$gap:8,$isLeft:a,$isRight:n,$withHeader:!!r,$withSubHeader:!!o,children:s.length?s.length>1?t(F,{gap:8,elements:s}):t(l,{children:s[0]}):t(M,{$height:"100%",children:t(R,{})})})]}),il="75vw",rl=u.div`
|
|
24
29
|
display: flex;
|
|
25
30
|
flex-direction: column;
|
|
26
31
|
border-radius: 16px;
|
|
27
32
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
28
33
|
overflow: hidden;
|
|
29
|
-
`,
|
|
34
|
+
`,sl=u.div`
|
|
30
35
|
display: flex;
|
|
31
36
|
gap: 12px;
|
|
32
37
|
padding: 16px;
|
|
33
|
-
margin-bottom: 12px;
|
|
34
38
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
35
39
|
position: sticky;
|
|
36
40
|
top: 0;
|
|
37
|
-
`,
|
|
41
|
+
`,cl=u.div`
|
|
38
42
|
padding: 0 12px;
|
|
39
|
-
`,
|
|
43
|
+
`,dl=u.div`
|
|
40
44
|
display: flex;
|
|
41
45
|
gap: 12px;
|
|
42
46
|
padding: 16px;
|
|
43
|
-
`,
|
|
47
|
+
`,ul=u.div`
|
|
44
48
|
padding: 5vh 10vw;
|
|
45
49
|
border-radius: 12px;
|
|
46
50
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
47
|
-
`,
|
|
51
|
+
`,hl=u.div`
|
|
48
52
|
display: flex;
|
|
49
53
|
align-items: center;
|
|
50
54
|
justify-content: flex-end;
|
|
51
55
|
gap: 16px;
|
|
52
56
|
padding: 0 12px;
|
|
53
|
-
|
|
57
|
+
margin-top: auto;
|
|
58
|
+
`,pl=i(({isOpen:l,onClose:a,onSave:o,disableSave:i,connectionIds:s,header:c,subHeader:d,leftColumn:u,rightColumn:h,search:p,filters:m,isFormDirty:g,hideDirtyNote:b,isFetching:f,progress:C},y)=>{const[v,w]=n(!1),[k,S]=n(!1),[$,x]=n(void 0);r(y,()=>({clearErrors:()=>x(void 0)}));const I=k,T=()=>{g&&!v?w(!0):(w(!1),a())},A=i||k||"boolean"==typeof g&&!g;return e(P,{width:il,isOpen:l,hideOverlay:!k,header:{...c,onClose:T,onCloseDisabled:I},children:[k?t(M,{$height:"calc(100vh - 136px)",children:t(ul,{children:t(L,{titleSize:E.S,subTitleSize:E.XXXS,withGradient:!0,withSpinner:!0,...C})})}):e(rl,{children:[e(sl,{children:[s&&t(z,{icon:st,title:"Selected Clusters",badge:{label:s.value.length}}),t(j,{width:"100%",...p}),m]}),d&&t(cl,{children:t(z,{icon:d.icon,title:d.title,subTitle:d.description,badge:d.badge})}),e(dl,{children:[t(ol,{isLeft:!0,parentHasSubHeader:!!d,...u}),t(ol,{isRight:!0,parentHasSubHeader:!!d,...h})]})]}),e(hl,{children:[f?t(L,{icon:ct,title:"Fetching Data...",titleSize:E.XXS,withGradient:!0}):k?C?null:t(L,{icon:ct,title:"Saving Changes...",titleSize:E.XXS,withGradient:!0}):$?t(q,{fullWidth:!0,status:H.Error,message:$}):"boolean"==typeof g&&g&&!b?t(q,{fullWidth:!0,status:H.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof g||g||b?null:t(q,{fullWidth:!0,status:H.Success,message:"The values reflect the current configuration of the selected cluster."}),e(O,{$gap:8,children:[t("div",{style:{width:"150px"},children:t(_,{fullWidth:!0,variant:B.Secondary,label:"Cancel",onClick:T,disabled:I})}),t("div",{style:{width:"150px"},children:t(_,{fullWidth:!0,variant:B.Primary,label:"Save",onClick:async()=>{S(!0);const e=await o();S(!1),e?.error?x(e.error):(s?.setValue([]),a())},disabled:A})})]})]}),t(Xt,{isOpen:v,onClose:()=>w(!1),onApprove:T})]})});pl.displayName=pl.name;const ml=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(m,{$gap:24,children:[e(O,{$gap:12,$justifyContent:"space-between",children:[t(K,{size:E.XXS,children:l.docsDescription}),t(_,{label:"Docs",leftIcon:dt,variant:B.Text,size:W.S,onClick:()=>window.open(`${G}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(J,{options:[{icon:st,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ut,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(el,{title:"Signals for processing",allowedSignals:l.allowedSignals,selectedSignals:a.signals||[],setSelectedSignals:e=>n("signals",e),errorMessage:o.signals}),t(C,{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(Yt,{actionType:l.type,value:a.fields,setValue:(e,t)=>n(`fields.${e}`,t),formErrors:o}),t(U,{label:"Notes",placeholder:"Your personal notes...",value:a.notes||"",onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},gl=({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:h,value:p,required:g,options:y})=>{if(a&&!Y(a,l,n.fields))return null;const v=c,k=n.fields.find(e=>e.key===v),S=k?k.value:p;switch(r){case I.Input:return t(C,{name:v,type:s,label:d,tooltip:u,required:g,placeholder:h,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case I.MultiInput:return t(x,{label:d,tooltip:u,required:g,placeholder:h,values:Z(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case I.KeyValuePair:return t(w,{label:d,tooltip:u,required:g,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:Z(S,[]),setValues:e=>o(v,JSON.stringify(e)),errorMessage:i[v]},v);case I.TextArea:return t(U,{name:v,label:d,tooltip:u,required:g,placeholder:h,value:S,onChange:e=>o(v,e.target.value),errorMessage:i[v]},v);case I.Checkbox:return e(m,{children:[t(b,{label:d,value:"true"==S,onChange:e=>o(v,e.toString())}),t(f,{errorMessage:i[v]})]},v);case I.Dropdown:return t(X,{name:v,label:d,withSearch:!0,values:S?[S]:[],options:y?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>o(v,e[0]),errorMessage:i[v]},v);default:return null}}),bl=({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=Q(l.supportedSignals),a={logs:t.includes(ee.Logs),metrics:t.includes(ee.Metrics),traces:t.includes(ee.Traces)};i("exportedSignals",a)},[n]),e(m,{$gap:24,children:[e(O,{$gap:12,$justifyContent:"space-between",children:[t("div",{}),t(_,{label:"Docs",leftIcon:dt,variant:B.Text,size:W.S,onClick:()=>window.open(`${G}/backends/${l.type}`,"_blank","noopener noreferrer")})]}),t(J,{options:[{icon:st,label:"Enabled",value:!1,selectedBgColor:s.v2.colors.green[800]},{icon:ut,label:"Disabled",value:!0,selectedBgColor:s.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>i("disabled",e)}),t(el,{title:"This connection will monitor:",allowedSignals:Q(l.supportedSignals),selectedSignals:te(o.exportedSignals),setSelectedSignals:e=>i("exportedSignals",{logs:e.includes(ee.Logs),metrics:e.includes(ee.Metrics),traces:e.includes(ee.Traces)}),errorMessage:r.exportedSignals}),t(C,{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(gl,{signals:te(o.exportedSignals),fields:n,formData:o,handleFormChange:(e,t)=>{i("fields",o.fields.map(l=>l.key===e?{...l,value:t}:l))},formErrors:r})]})},fl=[{id:le.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:le.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:le.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Cl=[{id:le.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:le.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:le.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],yl=["*"],vl=[{id:oe.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:oe.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:oe.DbQuery,label:"Collect DB query",tooltip:""},{id:oe.Messaging,label:"Collect messaging",tooltip:""}],wl={[se.Java]:[new re("","")],[se.Golang]:[new ie("")]},kl={[ce.CodeAttributes]:({value:n,setValue:o,formErrors:i})=>{const r=h(),c=i.codeAttributes,d=s(()=>Object.entries(n.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[n]);a(()=>{if(!d.length&&!c){const e={[le.FilePath]:!0,[le.Function]:!0,[le.LineNumber]:!0,[le.Column]:null,[le.Namespace]:null,[le.StackTrace]:null};o("codeAttributes",e)}},[]);const u=(e,t)=>{const l=t?[...d,e]:d.filter(t=>t!==e),a=Object.values(le).reduce((e,t)=>(e[t]=!!l.includes(t)||null,e),{});o("codeAttributes",a)};return e(l,{children:[e(m,{$gap:12,children:[t(K,{size:E.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(m,{$gap:6,children:fl.map(({id:e,label:l,tooltip:a})=>t(ae,{text:a,withIcon:!0,children:t(b,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(f,{errorMessage:c})]}),e(m,{$gap:12,children:[t(K,{size:E.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(m,{$gap:6,children:Cl.map(({id:e,label:l,tooltip:a})=>t(ae,{text:a,withIcon:!0,children:t(b,{label:l,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(f,{errorMessage:c})]})]})},[ce.CustomInstrumentation]:({value:n,setValue:o,formErrors:i})=>{const r=i.customInstrumentations,c=s(()=>(n?.customInstrumentations?.[se.Golang]||[]).map(e=>new ie(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[n]),d=s(()=>(n?.customInstrumentations?.[se.Java]||[]).map(e=>new re(e.className,e.methodName)),[n]);return a(()=>{n?.customInstrumentations||r||o("customInstrumentations",{[se.Golang]:wl[se.Golang],[se.Java]:wl[se.Java]})},[]),e(l,{children:[e(m,{children:[e(O,{$gap:8,children:[t(ht,{}),t(g,{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:c,setValues:e=>{const t={};t[se.Golang]=e.map(e=>new ie(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[se.Java]=d,o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),e(m,{children:[e(O,{$gap:8,children:[t(pt,{}),t(g,{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[se.Golang]=c,t[se.Java]=e.map(e=>new re(e.className,e.methodName)),o("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[ce.HeadersCollection]:({value:e,setValue:l,formErrors:n})=>{const o=n.headersCollection,i=s(()=>e?.headersCollection?.[ne.HeaderKeys]||[],[e]),r=e=>{const t={[ne.HeaderKeys]:e};l("headersCollection",t)};return a(()=>{i.length||o||r(yl)},[]),t(x,{label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:r,errorMessage:o})},[ce.PayloadCollection]:({value:l,setValue:n,formErrors:o})=>{const i=h(),r=o.payloadCollection,c=s(()=>Object.entries(l.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[l]);return a(()=>{if(!c.length&&!r){const e={[oe.HttpRequest]:{},[oe.HttpResponse]:{},[oe.DbQuery]:{},[oe.Messaging]:{}};n("payloadCollection",e)}},[]),e(m,{$gap:12,children:[t(K,{size:E.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(m,{$gap:6,children:vl.map(({id:e,label:l,tooltip:a})=>t(ae,{text:a,withIcon:!0,children:t(b,{label:l,value:c.includes(e),onChange:t=>((e,t)=>{const l=t?[...c,e]:c.filter(t=>t!==e),a={[oe.HttpRequest]:l.includes(oe.HttpRequest)?{}:null,[oe.HttpResponse]:l.includes(oe.HttpResponse)?{}:null,[oe.DbQuery]:l.includes(oe.DbQuery)?{}:null,[oe.Messaging]:l.includes(oe.Messaging)?{}:null};n("payloadCollection",a)})(e,t)})},e))}),t(f,{errorMessage:r})]})},[ce.UnknownType]:null},Sl=({ruleType:e,value:l,setValue:a,formErrors:n})=>{if(!e)return null;const o=kl[e];return o?t(o,{value:l,setValue:a,formErrors:n}):null},$l=({option:l,formData:a,handleFormChange:n,formErrors:o})=>{const i=h();return e(m,{$gap:24,children:[e(O,{$gap:12,$justifyContent:"space-between",children:[t(K,{size:E.XXS,children:l.docsDescription}),t(_,{label:"Docs",leftIcon:dt,variant:B.Text,size:W.S,onClick:()=>window.open(`${G}${l.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(O,{$gap:12,children:[t(K,{size:E.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),l.supportedLanguages.map(e=>t(de,{label:ue[e],leftIcon:he(e),status:H.Default,useSecondaryTone:!0},e))]}),t(J,{options:[{icon:st,label:"Enabled",value:!1,selectedBgColor:i.v2.colors.green[800]},{icon:ut,label:"Disabled",value:!0,selectedBgColor:i.v2.colors.red[800]}],selected:a.disabled,setSelected:e=>n("disabled",e)}),t(C,{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(Sl,{ruleType:l.type,value:a,setValue:(e,t)=>n(e,t),formErrors:o}),t(U,{label:"Notes",placeholder:"Your personal notes...",value:a.notes,onChange:({target:{value:e}})=>n("notes",e),errorMessage:o.notes})]})},xl={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Il=u.div`
|
|
54
59
|
display: flex;
|
|
55
60
|
align-items: center;
|
|
56
61
|
justify-content: space-between;
|
|
57
62
|
gap: 12px;
|
|
58
|
-
padding: 12px
|
|
63
|
+
padding: 8px 12px;
|
|
59
64
|
border-radius: 12px;
|
|
60
65
|
background-color: ${({$isSelected:e,theme:t})=>e?t.v2.colors.silver[600]:"transparent"};
|
|
61
66
|
cursor: pointer;
|
|
62
67
|
&:hover {
|
|
63
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[
|
|
68
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
69
|
+
}
|
|
70
|
+
`,Tl=u.div`
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
padding: 8px;
|
|
75
|
+
border-radius: 8px;
|
|
76
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+pe["004"]};
|
|
77
|
+
`,Al=({icon:l,title:a,description:n,withCarret:o,children:i,isSelected:r,onClick:s,isChecked:c,isPartiallyChecked:d,onCheckboxChange:u})=>{const p=h();return e(Il,{$isSelected:r,onClick:()=>!r&&s(),children:[e(m,{$gap:4,children:[e(O,{$gap:12,children:[u&&t(b,{partiallyChecked:d||!1,value:c||!1,onChange:e=>u(e)}),l&&t(Tl,{children:t(l,{size:20})}),t(K,{size:E.XS,children:a})]}),n&&t(K,{size:E.XXXS,color:p.v2.colors.silver[200],children:n})]}),i,o&&t("div",{children:t(mt,{size:18})})]})},Nl=u.div`
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
gap: 8px;
|
|
81
|
+
padding: 8px;
|
|
82
|
+
`,Dl=({onClose:l,selectedConnectionIds:a,setSelectedConnectionIds:i,createAction:r})=>{const c=h(),[d,u]=n(""),[p,m]=n(null),g=s(()=>(d?me.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):me).filter(e=>!!e),[d]),b=s(()=>(d?ge.filter(e=>e?.label?.toLowerCase().includes(d.toLowerCase())):ge).filter(e=>!!e),[d]),f=be(xl),C=o(null),y=s(()=>{const l=(l,a)=>e(Nl,{children:[t(K,{size:E.XS,color:c.v2.colors.silver[200],children:l}),t(de,{label:a.toString()})]},l),a=e=>{const l=p?.type===e.type;return t(Al,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{f.resetFormData(),C.current?.clearErrors(),m(e)}},e.type)};return[l("Attributes",g.length),...g.map(a),l("Samplers",b.length),...b.map(a)]},[c,p?.type,g.length,b.length,f]),v=s(()=>p?[t(ml,{option:p,...f},p?.type)]:[t(M,{$height:"100%",children:t(R,{icon:gt,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[p,f]);return t(pl,{ref:C,isOpen:!0,onClose:l,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:N(xl)};const l=(a=t.formData,N(a));var a;const n={};return t.handleErrorChange(void 0,void 0,n),{isOk:0===Object.keys(n).length,preparedFormData:l}})(p,f);return e?await r(t):Promise.resolve({error:"Invalid form values"})},disableSave:!p||!f.isFormDirty,isFormDirty:f.isFormDirty,hideDirtyNote:!0,progress:{title:fe.CREATING_ACTION,subTitle:fe.CREATING_ACTION_SUBTITLE},header:{icon:gt,title:fe.ADD_ACTION,subTitle:fe.ADD_ACTION_DESCRIPTION},connectionIds:{value:a,setValue:i},search:{value:d,onChange:u},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},Ol=({selectedArea:e,genericForm:l})=>({width:"60%",list:e?[t(bl,{option:e.option,dynamicFields:e.dynamicFields,...l},e?.option.type)]:[t(M,{$height:"100%",children:t(R,{icon:bt,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]});var Vl;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Vl||(Vl={}));const Fl=e=>({type:"",disabled:!1,name:"",currentStreamName:e,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]}),Ml=u.div`
|
|
83
|
+
display: flex;
|
|
84
|
+
flex-direction: column;
|
|
85
|
+
padding: 8px;
|
|
86
|
+
border-radius: 16px;
|
|
87
|
+
background-color: ${({$noBgColor:e,theme:t})=>e?"transparent":t.v2.colors.silver[800]};
|
|
88
|
+
`,Rl=u.div`
|
|
89
|
+
display: flex;
|
|
90
|
+
align-items: center;
|
|
91
|
+
justify-content: space-between;
|
|
92
|
+
gap: 12px;
|
|
93
|
+
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
94
|
+
`,Pl=({title:l,tooltip:a,list:o,noBgColor:i})=>{const[r,s]=n(!0);return e(Ml,{$noBgColor:i,children:[e(Rl,{$isOpen:r,children:[e(O,{$gap:10,children:[t(K,{size:E.XS,children:l}),a&&t(ae,{text:a,withIcon:!0}),t(de,{label:o.length})]}),t(ye,{icon:r?ft:Ct,size:ve.M,onClick:()=>s(e=>!e)})]}),r?t(m,{children:o.length?c.toArray(o):t(M,{$padding:"12px 0",children:t(R,{})})}):null]})},Ll=(e,t,l)=>t||l.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!l.signalType||Q(e.supportedSignals).includes(l.signalType))):e,El=({listType:e,dest:l,isSelected:a,onSelect:n})=>t(Al,{icon:Se(l.type).icon,title:l.displayName,withCarret:!0,isSelected:a,onClick:()=>{n()}},`${e}-${l.type}`),zl=({listType:e,destinations:l,selectedArea:a,onSelect:n})=>t(Pl,{title:ke[e].TITLE,tooltip:ke[e].DESCRIPTION,list:l.map(l=>t(El,{listType:e,dest:l,isSelected:a?.option.type===l.type&&a?.listType===e,onSelect:()=>{return n({listType:e,option:l,dynamicFields:(t=l.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:l,componentProperties:a,displayName:n,initialValue:o,renderCondition:i}=e,r=l===I.Dropdown,s=Z(a,{});return{componentType:l,renderCondition:i,name:t,title:n,value:o,placeholder:s.placeholder||(r?"Select an option":void 0),options:r&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}}))});var t}},`${e}-${l.type}`))},e),jl=({isFetching:e,destinationsByCategory:l,searchText:a,filters:n,selectedArea:o,onSelect:i})=>{const r=s(()=>{const e=[];for(const r of Object.values(we)){if(n.categoryType&&n.categoryType!==r)continue;const s=Ll(l[r],a,n);s.length&&e.push(t(zl,{listType:r,destinations:s,selectedArea:o,onSelect:i},r))}return e},[l,a,n,o,i]);return{width:"40%",list:r.length?r:e?[t(M,{$height:"100%",children:t(L,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},ql=({destinationsByCategory:a,filters:n,setFilters:o})=>{const i=s(()=>Object.values(we).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>a[e.id]?.length),[a]),r=s(()=>{const e=Object.values(ee).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(l,{children:[t(X,{placeholder:"Select category",options:i,values:n.categoryType?[n.categoryType]:[],setValues:e=>o({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t(J,{size:$e.S,options:r,selected:n.signalType,setSelected:e=>o({...n,signalType:e})})]})},Hl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:i,getDestinationCategories:r,getPotentialDestinations:s,createDestination:c})=>{const[u,h]=n(""),[p,m]=n({categoryType:null,signalType:null}),[g,b]=n(null),[f,C]=n(!0),[y,w]=n({[we.EXISTS]:[],[we.DETECTED]:[],[we.SELF_HOSTED]:[],[we.MANAGED]:[]}),k=d(async()=>{try{C(!0);const[e,t]=await Promise.all([r(),s()]),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}=((e,t)=>{const l=[],a=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Vl.SELF_HOSTED?a.push(...e.items):e.name===Vl.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const a of e?.destinationCategories?.categories||[]){const e=N(a),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const a=Z(t.fields,[]);a.length&&(e.items[n].fields=e.items[n].fields.map(e=>{const t=a.find(t=>t.name===e.name)?.initialValue;return{...e,initialValue:t}}),l.push(e.items[n]))}}}),{detectedDestinations:l,selfHostedDestinations:a,managedDestinations:n}})(e,t);w(e=>({...e,[we.DETECTED]:l,[we.SELF_HOSTED]:a,[we.MANAGED]:n}))}catch(e){}finally{C(!1)}},[]);a(()=>{k()},[]);const{selectedStreamName:S}=xe(),$=be(Fl(S)),x=o(null);return t(pl,{ref:x,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:N(Fl(t.formData.currentStreamName))};const l=N(t.formData),a={};return e.dynamicFields.forEach(({name:e,required:t})=>{if(t){const t=l.fields.find(t=>t.key===e)?.value;v(t)&&(a[e]=Ce.FIELD_IS_REQUIRED)}}),te(l.exportedSignals).length||(a.exportedSignals=Ce.FIELD_IS_REQUIRED),t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(g,$);return e?await c(t):Promise.resolve({error:"Invalid form values"})},disableSave:!g,isFetching:f,isFormDirty:$.isFormDirty,hideDirtyNote:!0,progress:{title:fe.CREATING_DESTINATION,subTitle:fe.CREATING_DESTINATION_SUBTITLE},header:{icon:bt,title:fe.ADD_DESTINATIONS,subTitle:fe.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:{value:l,setValue:i},search:{value:u,onChange:h},filters:t(ql,{destinationsByCategory:y,filters:p,setFilters:m}),leftColumn:jl({isFetching:f,destinationsByCategory:y,searchText:u,filters:p,selectedArea:g,onSelect:e=>{$.resetFormData(),x.current?.clearErrors(),b(e)}}),rightColumn:Ol({selectedArea:g,genericForm:$})})},_l={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},Bl=({onClose:e,selectedConnectionIds:l,setSelectedConnectionIds:a,createInstrumentationRule:i})=>{const[r,c]=n(""),[d,u]=n(null),h=s(()=>r?Ie.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ie,[r]),p=be(_l),m=o(null),g=s(()=>h.map(e=>{const l=d?.type===e.type;return t(Al,{title:e.label,description:e.description,withCarret:!0,isSelected:l,onClick:()=>{p.resetFormData(),m.current?.clearErrors(),u(e)}},e.type)}),[d,h.length,p]),b=s(()=>d?[t($l,{option:d,...p},d?.type)]:[t(M,{$height:"100%",children:t(R,{icon:yt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[d,p]);return t(pl,{ref:m,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:N(_l)};const l=(e=>{const t=N(e);return t.headersCollection?.[ne.HeaderKeys]?.length&&(t.headersCollection[ne.HeaderKeys]=t.headersCollection[ne.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[se.Golang]?.length&&(t.customInstrumentations[se.Golang]=t.customInstrumentations[se.Golang].map(e=>new ie(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[se.Java]?.length&&(t.customInstrumentations[se.Java]=t.customInstrumentations[se.Java].map(e=>new re(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),a={};switch(e.type){case ce.CodeAttributes:Object.values(l.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case ce.PayloadCollection:Object.values(l.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case ce.HeadersCollection:l.headersCollection?.[ne.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case ce.CustomInstrumentation:l.customInstrumentations?.[se.Golang]?.length||l.customInstrumentations?.[se.Java]?.length||(a.customInstrumentations="Custom instrumentation are required")}return t.handleErrorChange(void 0,void 0,a),{isOk:0===Object.keys(a).length,preparedFormData:l}})(d,p);return e?await i(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d||!p.isFormDirty,isFormDirty:p.isFormDirty,hideDirtyNote:!0,progress:{title:fe.CREATING_INSTRUMENTATION_RULE,subTitle:fe.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:yt,title:fe.ADD_INSTRUMENTATION_RULE,subTitle:fe.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:{value:l,setValue:a},search:{value:r,onChange:c},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:b}})},Kl=e=>{const t=e.workloads.filter(({selected:e})=>e).length,l=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===l,isSomeSourced:t>0&&t<l,isFutureApps:e.selected||!1}},Wl=(e,t,l)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(l.showOnlySelected){const{isAllSourced:t,isSomeSourced:l,isFutureApps:a}=Kl(e);return t||l||a}return!0},Gl=(e,t,l)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!l.showOnlySelected||e.selected),Jl=u.div``,Ul=u.div`
|
|
95
|
+
visibility: hidden;
|
|
96
|
+
|
|
97
|
+
transition: visibility 0s;
|
|
98
|
+
& * {
|
|
99
|
+
transition-duration: 0s;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
${Jl}:hover & {
|
|
103
|
+
visibility: visible;
|
|
104
|
+
}
|
|
105
|
+
`,Yl=({workloadName:e,workloadKind:l,isChecked:a,onToggle:n})=>{const o=h();return t(Jl,{children:t(Al,{title:e,onClick:n,isChecked:a,onCheckboxChange:n,children:t(Ul,{children:t(de,{label:l,status:H.Info,textSize:E.XXXS,backgroundColor:o.v2.colors.blue[900]})})})})},Xl=({formData:l,handleSourceChange:a,handleSelectAll:n,selectedArea:o,searchText:i,filters:r})=>{const c=s(()=>o.value.clusterId&&o.value.namespaceName?l.find(({clusterId:e})=>e===o.value.clusterId)?.namespaces.find(({name:e})=>e===o.value.namespaceName):void 0,[l,o.value.clusterId,o.value.namespaceName]),d=s(()=>c?[...c.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Gl(e,i,r)):[],[c,i,r]),u=s(()=>!!d.length&&d.every(({selected:e})=>e),[d]),h=s(()=>{if(!c)return[];const{clusterId:e}=o.value,{name:l}=c;return d.map(({name:n,selected:o,kind:i})=>t(Yl,{workloadName:n,workloadKind:i,isChecked:o||!1,onToggle:()=>a({clusterId:e,workloadId:{namespace:l,name:n,kind:i}})},`${e}#${l}#${n}#${i}`))},[d,c,o.value.clusterId]),{withFilterCount:p,filteredCount:m,totalCount:g}=s(()=>{const e=c?.workloads.length??0;return{withFilterCount:d.length!==e,filteredCount:d.length,totalCount:e}},[d,c]);return{width:"40%",header:e(O,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(O,{$gap:8,children:[t(K,{size:E.XS,nowrap:!0,children:o.value.namespaceName?`${o.value.namespaceName} > Workloads`:"Workloads"}),t(ae,{text:p?fe.FILTERED_COUNT_TOOLTIP:void 0,children:t(de,{label:`${p?`${m} / ${g}`:g}`,status:Te.Unknown})})]}),t(K,{onClick:()=>n({clusterId:o.value.clusterId,namespaceName:o.value.namespaceName,boolean:!u}),disabled:!h.length,size:E.XS,children:(u?"Unselect":"Select")+" all"})]}),list:c?h:[t(M,{$height:"100%",children:t(R,{icon:vt,title:fe.SELECT_NAMESPACE,subTitle:fe.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},Zl=u.div``,Ql=u.div`
|
|
106
|
+
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
107
|
+
|
|
108
|
+
transition: visibility 0s;
|
|
109
|
+
${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
|
|
110
|
+
|
|
111
|
+
${Zl}:hover & {
|
|
112
|
+
visibility: visible;
|
|
64
113
|
}
|
|
65
|
-
`,Wt=({title:t,description:l,withCarret:a,children:o,isSelected:i,onClick:r,isChecked:s,isPartiallyChecked:c,onCheckboxChange:d})=>{const u=h();return e(Ht,{$isSelected:i,onClick:()=>!i&&r(),children:[e(g,{$gap:4,children:[e(D,{$gap:12,children:[d&&n(w,{partiallyChecked:c||!1,value:s||!1,onChange:e=>d(e)}),n(m,{size:b.XS,children:t})]}),l&&n(m,{size:b.XXXS,color:u.v2.colors.silver[200],children:l})]}),o,a&&n("div",{children:n(Ue,{size:18})})]})},Gt=({onClose:e,selectedConnectionIds:t,setSelectedConnectionIds:a,createInstrumentationRule:o})=>{const[i,s]=r(""),[d,u]=r(null),h=l(()=>i?Q.filter(e=>e.label.toLowerCase().includes(i.toLowerCase())):Q,[i]),p=_(jt),g=c(null);return n(Ft,{ref:g,isOpen:!0,onClose:e,onSave:async()=>{const{isOk:e,preparedFormData:t}=((e,t)=>{if(!e)return{isOk:!1,preparedFormData:J(jt)};const n=(e=>{const t=J(e);return t.headersCollection?.[y.HeaderKeys]?.length&&(t.headersCollection[y.HeaderKeys]=t.headersCollection[y.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[I.Golang]?.length&&(t.customInstrumentations[I.Golang]=t.customInstrumentations[I.Golang].map(e=>new x(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[I.Java]?.length&&(t.customInstrumentations[I.Java]=t.customInstrumentations[I.Java].map(e=>new S(e.className,e.methodName)).filter(e=>e.Verify())),t})(t.formData),l={};switch(e.type){case L.CodeAttributes:Object.values(n.codeAttributes||{}).some(e=>null!=e)||(l.codeAttributes="Code attributes are required");break;case L.PayloadCollection:Object.values(n.payloadCollection||{}).some(e=>null!=e)||(l.payloadCollection="Payload collection are required");break;case L.HeadersCollection:n.headersCollection?.[y.HeaderKeys]?.length||(l.headersCollection="Header keys are required");break;case L.CustomInstrumentation:n.customInstrumentations?.[I.Golang]?.length||n.customInstrumentations?.[I.Java]?.length||(l.customInstrumentations="Custom instrumentation are required")}return t.handleErrorChange(void 0,void 0,l),{isOk:0===Object.keys(l).length,preparedFormData:n}})(d,p);return e?await o(t):Promise.resolve({error:"Invalid form values"})},disableSave:!d,progress:{title:"Creating instrumentation rule",subTitle:"Please wait while we create the instrumentation rule"},header:{icon:Ye,title:ee.ADD_INSTRUMENTATION_RULE},subHeader:{icon:Ye,title:ee.INSTRUMENTATION_RULES,description:"Define how telemetry is recorded from your application. Choose a rule type and configure the details.",badge:{label:h.length.toString()}},connectionIds:{value:t,setValue:a},search:{value:i,onChange:s},leftColumn:{width:"40%",list:h.map(e=>{const t=d?.type===e.type;return n(Wt,{title:e.label,description:e.description,withCarret:!0,isSelected:t,onClick:()=>{p.resetFormData(),g.current?.clearErrors(),u(e)}},e.type)})},rightColumn:{width:"60%",list:d?[n(St,{option:d,...p},d?.type)]:[n(q,{title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"},"no-data")]}})},qt=({formData:t,handleSourceChange:a,handleSelectAll:o,selectedArea:i,searchText:r,filters:s})=>{const c=h(),{activeNamespace:d,isAll:u,isSome:p}=l(()=>{const e=i.value.clusterId&&i.value.namespaceName?t.find(({clusterId:e})=>e===i.value.clusterId)?.namespaces.find(({name:e})=>e===i.value.namespaceName):void 0;if(!e)return{activeNamespace:void 0,isAll:!1,isSome:!1};const n=e.workloads.filter(({selected:e})=>e).length;return{activeNamespace:e,isAll:n>0&&n===e.workloads.length,isSome:n>0&&n<e.workloads.length}},[t,i.value.clusterId,i.value.namespaceName]),g=l(()=>{if(!d)return[];const{clusterId:e}=i.value,{name:t,workloads:l}=d;return l.map(({name:l,selected:o,kind:i})=>{if(r&&!l.toLowerCase().includes(r.toLowerCase()))return null;const d=o||!1;if(s.showOnlySelected&&!d)return null;const u=()=>a({clusterId:e,workloadId:{namespace:t,name:l,kind:i}});return n(Wt,{title:l,onClick:u,isChecked:d,onCheckboxChange:u,children:n(V,{label:i,status:N.Info,textSize:b.XXXS,backgroundColor:c.v2.colors.blue[900]})},`${e}#${t}#${l}#${i}`)})},[t,i.value.clusterId,d,r,s]);return{width:"50%",header:e(D,{$gap:12,$padding:"0 0 0 28px",children:[n(C,{text:(u?"Unselect":"Select")+" all workloads in the selected namespace",children:n(w,{partiallyChecked:p,value:u,onChange:()=>o({clusterId:i.value.clusterId,namespaceName:i.value.namespaceName,boolean:!u}),disabled:!g.length})}),e(D,{$gap:8,children:[n(m,{size:b.XS,nowrap:!0,children:i.value.clusterId?`${i.value.clusterName} > ${i.value.namespaceName} > Workloads`:"Workloads"}),n(V,{label:g.length,status:te.Unknown})]})]}),list:g}},Ut=({formData:t,handleSourceChange:a,handleSelectAll:o,selectedArea:i,searchText:r,filters:s})=>{const c=h(),{isAll:d,isSome:u}=l(()=>{const e=t.length>0&&t.every(({namespaces:e})=>e.every(({workloads:e})=>e.every(({selected:e})=>e)));return{isAll:e,isSome:!e&&t.length>0&&t.some(({namespaces:e})=>e.some(({workloads:e})=>e.some(({selected:e})=>e)))}},[t]),p=l(()=>t.flatMap(({clusterId:t,clusterName:l,namespaces:o})=>o.map(({name:o,workloads:d,selected:u})=>{if(r&&!o.toLowerCase().includes(r.toLowerCase()))return null;const h=d.filter(({selected:e})=>e).length,p=h>0&&h===d.length,g=h>0&&h<d.length,f=u||!1;if(s.showOnlySelected&&!p&&!g&&!f)return null;const w=i.value.clusterId===t&&i.value.namespaceName===o,v=()=>i.setValue({clusterId:t,clusterName:l,namespaceName:o}),y=e=>{v(),a({clusterId:t,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return n(Wt,{title:`${l} > ${o}`,isSelected:w,onClick:v,isPartiallyChecked:g,isChecked:p,onCheckboxChange:e=>y({auto:e,all:e}),children:e(D,{$gap:12,children:[n(C,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:n(ne,{label:"Auto",size:le.S,value:f,onChange:e=>y({auto:e,all:e||void 0})})}),e(D,{$gap:8,children:[n(m,{variant:ae.Span,size:b.XXXS,color:c.v2.colors.silver[200],align:"right",children:"Selected"}),n(V,{label:`${h}/${d.length}`,status:w?N.Default:te.Unknown,minWidth:"42px"})]})]})},`${t}#${o}`)})),[t,i.value.clusterId,i.value.namespaceName,r,s]);return{width:"50%",header:e(D,{$gap:12,$padding:"0 0 0 28px",children:[n(C,{text:(d?"Unselect":"Select")+" all workloads in all namespaces",children:n(w,{partiallyChecked:u,value:d,onChange:()=>o({boolean:!d}),disabled:!p.length})}),e(D,{$gap:8,children:[n(m,{size:b.XS,nowrap:!0,children:"Namespaces"}),n(V,{label:p.length,status:te.Unknown})]})]}),list:p}},Yt=({onClose:t,selectedConnectionIds:o,setSelectedConnectionIds:i,snapshots:s,persistSources:c})=>{const u=h(),{selectedStreamName:p}=oe(),{progress:g,resetProgress:f}=ie(),C=l(()=>p||re,[p]),[w,v]=r(""),[y,k]=r(se.Namespace),[$,x]=r({showOnlySelected:!1}),[S,I]=r({clusterId:"",clusterName:"",namespaceName:""}),[T,A]=r([]);a(()=>{A(e=>{const t=((e,t)=>J(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(s,o);return t.map(t=>{const n=e?.find(e=>e.clusterId===t.clusterId);return n??t})})},[s,o]);const{formDiff:L,isFormDirty:P}=l(()=>{const e=((e,t,n)=>{const l={};return e.forEach(e=>{e.namespaces.forEach(a=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===a.name),i=a.selected||!1,r=i!==o?.selected;if(r&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push({namespace:a.name,selected:i,currentStreamName:n}),i&&(l[e.clusterId]=l[e.clusterId].filter(e=>e.namespace!==a.name||e.namespace===a.name&&(!e.name||!e.kind)))),!r||!i){const t=((e,t,n)=>{const l=[];return t.workloads.forEach(a=>{const o=e?.workloads.find(e=>e.name===a.name&&e.kind===a.kind);a.selected!==o?.selected&&l.push({namespace:t.name,name:a.name,kind:a.kind,selected:a.selected||!1,currentStreamName:n})}),l})(o,a,n);t.length>0&&(l[e.clusterId]||(l[e.clusterId]=[]),l[e.clusterId].push(...t))}})}),l})(T,s.clusters,C);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[T,s,C]),M=d(({clusterId:e,workloadId:t,selected:n,auto:l})=>{A(a=>{const o=J(a),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 l="boolean"==typeof n?n:!o[i].namespaces[r].workloads[e].selected;o[i].namespaces[r].workloads[e].selected=l,l?o[i].namespaces[r].workloads.every(e=>e.selected)&&(o[i].namespaces[r].selected=!0):o[i].namespaces[r].selected=!1}else{const e="boolean"==typeof l?l:!o[i].namespaces[r].selected;o[i].namespaces[r].selected=e,e?o[i].namespaces[r].workloads.forEach(e=>{e.selected=!0}):"boolean"!=typeof n||n||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[]),R=d(({clusterId:e,namespaceName:t,boolean:n})=>{A(l=>{const a=J(l);return a.forEach((l,o)=>{e&&l.clusterId!==e||l.namespaces.forEach(({name:e,workloads:l},i)=>{t&&e!==t||(a[o].namespaces[i].selected=n,l.forEach((e,t)=>{a[o].namespaces[i].workloads[t].selected=n}))})}),a})},[]);return n(Ft,{isOpen:!0,onClose:()=>{f(ce.BulkInstrumenting),t()},onSave:()=>c(L),header:{icon:Be,title:"Manage Sources"},connectionIds:{value:o,setValue:i},search:{width:"400px",value:w,onChange:v,segment:{options:[{label:"Namespace",value:se.Namespace},{label:"Source",value:se.Source}],selected:y,setSelected:k}},filters:e(D,{$gap:8,children:[n(m,{size:b.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),n(ne,{size:le.S,label:"Selected",value:$.showOnlySelected,onChange:e=>x(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,progress:{title:"Creating Sources...",subTitle:"This may take a few moments while sources are being created.",percentage:g[ce.BulkInstrumenting]?.percentage||0},leftColumn:Ut({formData:T,handleSourceChange:M,handleSelectAll:R,selectedArea:{value:S,setValue:I},searchText:y===se.Namespace?w:"",filters:$}),rightColumn:qt({formData:T,handleSourceChange:M,handleSelectAll:R,selectedArea:{value:S},searchText:y===se.Source?w:"",filters:$})})},Bt=({onClose:t,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=h(),[p,g]=r(""),[f,C]=r({showOnlySelected:!1}),w=l(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),n=!f.showOnlySelected||f.showOnlySelected&&i.includes(e.id);return t&&n}),[o.length,i.length,p,f]),v=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,k]=r(!1),[$,x]=r(void 0),{formData:S,handleFormChange:I,areFormValuesEqual:T,resetFormData:A}=_($||{rollout:{automaticRolloutDisabled:!1}}),L=l(()=>i.length>1||void 0!==$&&!T($,S),[i.length,$,S]);return a(()=>{1===i.length?(async e=>{if(y)return;k(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};x(e),A(e)}k(!1)})(i[0]):x(void 0)},[i.length]),n(Ft,{isOpen:!0,onClose:t,onSave:()=>d(S,i),header:{icon:Ke,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:g},filters:e(D,{$gap:8,children:[n(m,{size:b.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),n(ne,{size:le.S,label:"Selected",value:f.showOnlySelected,onChange:e=>C(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:L,isFetching:y,leftColumn:{width:"35%",header:e(D,{$gap:12,$padding:"0 12px",$justifyContent:"space-between",children:[e(D,{$gap:8,children:[n(m,{size:b.XS,children:"Clusters"}),n(V,{label:w.length,status:te.Unknown})]}),e(D,{$gap:8,children:[n(m,{size:b.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),n(V,{label:`${i.length}/${w.length}`,status:te.Unknown})]})]}),list:w.map(e=>n(Wt,{title:e.name,isChecked:i.includes(e.id),onClick:()=>v(e.id),onCheckboxChange:()=>v(e.id)},e.id))},rightColumn:{width:"65%",header:n(D,{$gap:12,$padding:"0 12px",children:n(m,{size:b.XS,children:"Configurations"})}),list:[n(ne,{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=>I("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Kt=({token:l,isLoading:a,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:h})=>{const{CopyButton:p}=de(),g=!o||a||!c.newToken;return ue({key:"Enter",active:!g},s),e(D,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[n(j,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:h.newToken}),n(D,{$margin:a?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:a?n(B,{title:"Saving...",withGradient:!0}):e(t,{children:[n(P,{variant:R.Secondary,size:M.S,leftIcon:Xe,onClick:r,disabled:a}),n(P,{variant:R.Primary,size:M.S,leftIcon:Ze,onClick:s,disabled:g})]})})]}:{$justifyContent:"space-between",$gap:12,children:[n(m,{size:b.XS,children:new Array(55).fill("•").join("")}),e(D,{$alignItems:"center",$justifyContent:"space-between",children:[n(p,{value:l}),n(he,{icon:Je,onClick:i})]})]})},Xt=({expiresAt:e,callbackValid:t,callbackExpired:o})=>{const{formatTimeAgo:i}=pe(),r=l(()=>i(e),[e]),s=l(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=l(()=>ge(e,0)?N.Error:ge(e,2592e6)?N.Warning:N.Success,[e]),d=l(()=>c===N.Success?Ze:c===N.Warning?Qe:_e,[c]);return a(()=>{c===N.Success?t():c===N.Error&&o()},[c]),n(C,{text:s,children:n(V,{leftIcon:d,label:r,status:c,invertColors:!0,useSecondaryTone:!0})})},Zt=u.div`
|
|
114
|
+
`,ea=({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(Zl,{children:t(Al,{title:a,isSelected:r,onClick:s,isPartiallyChecked:n.partial,isChecked:n.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(O,{$gap:12,children:[t(Ql,{$visible:r||o,children:t(ae,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(S,{label:"Auto",size:Ae.S,value:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(O,{$gap:8,children:[t(K,{variant:Ne.Span,size:E.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(de,{label:`${i.sourced}/${i.total}`,status:r?H.Default:Te.Unknown,minWidth:"42px"})]})]})})})},ta=({clusterId:e,clusterName:l,namespaces:a,selectedArea:n,setSelectedArea:o,handleSourceChange:i})=>{const r=s(()=>a.map(({name:a,totalWorkloads:r,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(ea,{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(Pl,{title:l,list:r,noBgColor:!0})},la=({isFetching:l,formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,setSelectedArea:r,searchText:c,filters:d})=>{const u=s(()=>a.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Wl(e,c,d)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Kl(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[a,c,d]),h=s(()=>{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:p,withFilterCount:m,filteredCount:g,totalCount:b}=s(()=>{const e=u.map(({clusterId:e,clusterName:l,visibleNamespaces:a})=>a.length?t(ta,{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(O,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(O,{$gap:8,children:[t(K,{size:E.XS,nowrap:!0,children:"Namespaces"}),t(ae,{text:m?fe.FILTERED_COUNT_TOOLTIP:void 0,children:t(de,{label:`${m?`${g} / ${b}`:b}`,status:Te.Unknown})})]}),t(K,{onClick:()=>o({boolean:!h}),disabled:!p.length,size:E.XS,children:(h?"Unselect":"Select")+" all"})]}),list:p.length?p:l?[t(M,{$height:"100%",children:t(L,{title:fe.FETCHING_NAMESPACES,subTitle:fe.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},aa=({onClose:l,selectedConnectionIds:o,setSelectedConnectionIds:i,getAllClusterSnapshots:r,persistSources:c})=>{const u=h(),{selectedStreamName:p}=xe(),{progress:m,resetProgress:g}=De(),b=s(()=>p||Oe,[p]),[f,C]=n(!1),[y,v]=n(null),w=d(async()=>{try{C(!0),v(await r()??null)}catch(e){}finally{C(!1)}},[]);a(()=>{w()},[]);const[k,$]=n(""),[x,I]=n(Ve.Namespace),[T,A]=n({showOnlySelected:!1}),[D,V]=n({clusterId:"",clusterName:"",namespaceName:""}),[F,M]=n([]);a(()=>{y&&M(e=>{const t=((e,t)=>N(((e,t)=>e.clusters.filter(({clusterId:e})=>t.includes(e)))(e,t)))(y,o);return t.map(t=>{const l=e?.find(e=>e.clusterId===t.clusterId);return l??t})})},[y,o]);const{formDiff:R,isFormDirty:P}=s(()=>{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})(F,y?.clusters||[],b);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[F,y,b]),L=d(({clusterId:e,workloadId:t,selected:l,auto:a})=>{M(n=>{const o=N(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.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=>{e.selected=!0}):"boolean"!=typeof l||l||o[i].namespaces[r].workloads.forEach(e=>{e.selected=!1})}return o})},[]),z=d(({clusterId:e,namespaceName:t,boolean:l})=>{M(a=>{const n=N(a),o=x===Ve.Namespace?k:"",i=x===Ve.Source?k:"",r=!!o||!!i||!!T?.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)=>{Gl(e,i,T)&&(n[s].namespaces[c].workloads[t].selected=l)});const e=n[s].namespaces[c].workloads.every(e=>e.selected);n[s].namespaces[c].selected=e}else{if(!Wl(n[s].namespaces[c],o,T))return;n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})}else n[s].namespaces[c].selected=l,a.forEach((e,t)=>{n[s].namespaces[c].workloads[t].selected=l})})}),n})},[x,k,T]);return t(pl,{isOpen:!0,onClose:()=>{g(Fe.BulkInstrumenting),l()},onSave:()=>c(R),header:{icon:vt,title:fe.ADD_SOURCE,subTitle:fe.ADD_SOURCES_DESCRIPTION},connectionIds:{value:o,setValue:i},search:{value:k,onChange:e=>{$(e),x===Ve.Namespace&&V({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ve.Namespace},{label:"Source",value:Ve.Source}],selected:x,setSelected:I}},filters:e(O,{$gap:8,children:[t(K,{size:E.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(S,{size:Ae.S,label:"Selected",value:T.showOnlySelected,onChange:e=>A(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:f,progress:{title:fe.CREATING_SOURCES,subTitle:fe.CREATING_SOURCES_SUBTITLE,percentage:m[Fe.BulkInstrumenting]?.percentage||0},leftColumn:la({isFetching:f,formData:F,handleSourceChange:L,handleSelectAll:z,selectedArea:D,setSelectedArea:V,searchText:x===Ve.Namespace?k:"",filters:T}),rightColumn:Xl({formData:F,handleSourceChange:L,handleSelectAll:z,selectedArea:{value:D},searchText:x===Ve.Source?k:"",filters:T})})},na=({onClose:l,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:r,getEffectiveConfig:c,onApply:d})=>{const u=h(),[p,m]=n(""),[g,b]=n({showOnlySelected:!1}),f=s(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),l=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&l}),[o.length,i.length,p,g]),C=e=>{r(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[y,v]=n(!1),[w,k]=n(void 0),{formData:$,handleFormChange:x,areFormValuesEqual:I,resetFormData:T}=be(w||{rollout:{automaticRolloutDisabled:!1}}),A=s(()=>i.length>1||void 0!==w&&!I(w,$),[i.length,w,$]);return a(()=>{1===i.length?(async e=>{if(y)return;v(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled||!1}};k(e),T(e)}v(!1)})(i[0]):k(void 0)},[i.length]),t(pl,{isOpen:!0,onClose:l,onSave:()=>d($,i),header:{icon:wt,title:"Cluster Configuration"},connectionIds:{value:i,setValue:r},search:{placeholder:"Search by cluster name",value:p,onChange:m},filters:e(O,{$gap:8,children:[t(K,{size:E.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(S,{size:Ae.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,leftColumn:{width:"35%",header:e(O,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(O,{$gap:8,children:[t(K,{size:E.XS,children:"Clusters"}),t(de,{label:f.length,status:Te.Unknown})]}),e(O,{$gap:8,children:[t(K,{size:E.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(de,{label:`${i.length}/${f.length}`,status:Te.Unknown})]})]}),list:f.map(e=>t(Al,{title:e.name,isChecked:i.includes(e.id),onClick:()=>C(e.id),onCheckboxChange:()=>C(e.id)},e.id))},rightColumn:{width:"65%",header:t(K,{size:E.XS,children:"Configurations"}),list:[t(S,{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:$.rollout?.automaticRolloutDisabled||!1,onChange:e=>x("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},oa=({token:a,isLoading:n,isEditing:o,onEdit:i,onCancel:r,onSave:s,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:h})=>{const{CopyButton:p}=Me(),m=!o||n||!c.newToken;return Re({key:"Enter",active:!m},s),e(O,o?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(C,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:h.newToken}),t(O,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(L,{title:"Saving...",withGradient:!0}):e(l,{children:[t(_,{variant:B.Secondary,size:W.S,leftIcon:kt,onClick:r,disabled:n}),t(_,{variant:B.Primary,size:W.S,leftIcon:St,onClick:s,disabled:m})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(K,{size:E.XS,children:new Array(55).fill("•").join("")}),e(O,{$alignItems:"center",$justifyContent:"space-between",children:[t(p,{value:a}),t(ye,{icon:$t,onClick:i})]})]})},ia=({expiresAt:e,callbackValid:l,callbackExpired:n})=>{const{formatTimeAgo:o}=Pe(),i=s(()=>o(e),[e]),r=s(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=s(()=>Le(e,0)?H.Error:Le(e,2592e6)?H.Warning:H.Success,[e]),d=s(()=>c===H.Success?St:c===H.Warning?xt:It,[c]);return a(()=>{c===H.Success?l():c===H.Error&&n()},[c]),t(ae,{text:r,children:t(de,{leftIcon:d,label:i,status:c,invertColors:!0,useSecondaryTone:!0})})},ra=u.div`
|
|
66
115
|
display: flex;
|
|
67
116
|
flex-direction: column;
|
|
68
117
|
gap: 12px;
|
|
@@ -70,14 +119,14 @@ import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{useMemo a
|
|
|
70
119
|
border-radius: 12px;
|
|
71
120
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
72
121
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
73
|
-
`,
|
|
122
|
+
`,sa=({children:e})=>{const l=h();return t(K,{size:E.XXXS,color:l.v2.colors.grey[150],children:e})},ca=({token:l,updateToken:a})=>{const[o,i]=n(!1),[r,s]=n(!1),[c,d]=n(!1),{formData:u,handleFormChange:h,formErrors:p,handleErrorChange:g,resetFormData:b}=be({newToken:""});return t(Ee,{richTitle:{icon:Tt,title:"Odigos Pro Token"},children:e(ra,{$isExpired:c,children:[e(O,{$justifyContent:"space-between",children:[e(m,{$gap:4,children:[t(sa,{children:"Issued for"}),t(K,{size:E.XS,children:l.name||"N/A"})]}),e(m,{$gap:4,children:[t(sa,{children:"Expiration"}),t(ia,{expiresAt:l.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(m,{})]}),t(O,{children:e(m,{children:[t(sa,{children:"Token"}),t(oa,{token:l.token,newToken:u.newToken,isLoading:r,isEditing:o,onEdit:()=>i(!0),onCancel:()=>(i(!1),s(!1),void h("newToken","")),onSave:()=>(async()=>{s(!0);const e=await a(u.newToken.trim());s(!1),e?.error?g("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:h,handleErrorChange:g,formErrors:p})]})})]})})},da=u.div`
|
|
74
123
|
display: flex;
|
|
75
124
|
align-items: center;
|
|
76
125
|
justify-content: center;
|
|
77
126
|
padding: 12px 24px;
|
|
78
127
|
border-radius: 8px;
|
|
79
128
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
80
|
-
`,
|
|
129
|
+
`,ua=({downloadDiagnose:l})=>{const a=h(),{namespaces:o}=ze(),[i,r]=n(null),{formData:s,handleFormChange:c,resetFormData:d}=be({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(Ee,{richTitle:{icon:At,title:"Diagnose"},children:i?t(da,{children:t(L,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",startedAt:i,withGradient:!0,withVisual:!0,visualIcon:Nt})}):e(m,{$gap:24,children:[t(K,{size:E.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(m,{$gap:16,children:[e(O,{$gap:8,children:[t(b,{label:"Profiles",value:s.includeProfiles,onChange:e=>c("includeProfiles",e)}),t(K,{size:E.XXXS,color:a.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(O,{$gap:8,children:[t(b,{label:"Metrics",value:s.includeMetrics,onChange:e=>c("includeMetrics",e)}),t(K,{size:E.XXXS,color:a.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(O,{$gap:8,children:[t(b,{label:"Source Workloads",value:s.includeSourceWorkloads,onChange:e=>{c("includeSourceWorkloads",e),e&&c("sourceWorkloadNamespaces",[])}}),t(K,{size:E.XXXS,color:a.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(je,{alignX:He.Left,alignY:qe.Bottom,items:o.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:s.sourceWorkloadNamespaces,setSelectedIds:e=>c("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(s.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:B.Secondary,disabled:s.includeSourceWorkloads,leftIcon:s.sourceWorkloadNamespaces.length?()=>t(de,{label:s.sourceWorkloadNamespaces.length,status:H.Default}):void 0}}),t(O,{$justifyContent:"flex-end",children:t(_,{label:"Download Diagnose",rightIcon:Nt,variant:B.Primary,onClick:async()=>{r(Date.now()),await l(s),r(null),d()},disabled:null!==i})})]})})},ha=({fetchDescribeOdigos:e})=>{const{platformType:l,version:o,tier:i}=_e(),[r,s]=n(null);return a(()=>{e().then(({data:e})=>s(e?.describeOdigos||null))},[]),t(Ee,{richTitle:{icon:Dt,title:"General Information"},children:t(Be,{cellsPerRow:2,items:[{id:Ke(),title:"Odigos Version",label:o},{id:Ke(),title:`${l.toUpperCase()} Version`,label:r?.kubernetesVersion?.value||"-"},{id:Ke(),title:"Installation Method",label:r?.installationMethod?.value||"-"},{id:Ke(),title:"Tier",label:i}]})})},pa=({isOpen:l,onClose:a,token:n,updateToken:o,fetchDescribeOdigos:i,downloadDiagnose:r})=>e(P,{isOpen:l,header:{icon:Dt,title:"System Overview",onClose:a},children:[i&&t(ha,{fetchDescribeOdigos:i}),o&&n&&t(ca,{token:n,updateToken:o}),r&&t(ua,{downloadDiagnose:r})]});var ma,ga;!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"}(ma||(ma={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(ga||(ga={}));const ba=[{key:ga.Name,label:"Name"},{key:ga.Type,label:"Type",textAlign:"right"},{key:ga.Status,label:"Status"},{key:ga.OdigosVersion,label:"Odigos Version"},{key:ga.ConnectedSince,label:"Connected Since"},{key:ga.LastActivity,label:"Last Activity"}],fa=(e,t)=>{const l=e.find(e=>e.key===ga.Id)?.rawValue;return t(l?.toString()||"")},Ca=({tableRowsMaxHeight:l,connections:o,getConnections:i,onClickConnection:r,deleteConnection:c,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:m,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:C,getPotentialDestinations:y,createDestination:v,createAction:w,createInstrumentationRule:k})=>{const S=h(),{formatTimeAgo:$}=Pe(),[x,I]=n(!1),[T,A]=n(o||[]),N=d(async()=>{try{I(!0),A(await i()??[])}catch(e){}finally{I(!1)}},[]);a(()=>{T.length||N()},[]);const[D,O]=n(""),[V,F]=n(null),[M,R]=n([]),P=s(()=>V===ma.BulkConfig?u:V===ma.BulkSource?g:0,[V,u,g]),{supportedConnections:L,supportedConnectionIds:E}=s(()=>{const e=((e,t)=>e.filter(e=>{const l=e.status===H.Success,a=We(e.odigosVersion,t);return l&&a}))(T,P);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[T.length,P]);a(()=>{if(!V||V===ma.Delete)return;const e=M.filter(e=>!E.includes(e));e.length&&R(t=>t.filter(t=>!e.includes(t)))},[V,M.length,E.length]);const z=s(()=>T.filter(e=>!D||e.name.toLowerCase().includes(D.toLowerCase())).map(e=>({cells:[{key:ga.Id,rawValue:e.id},{key:ga.Name,rawValue:e.name},{key:ga.Type,rawValue:e.type},{key:ga.Status,rawValue:e.status,component:()=>(e=>{const l=e===H.Success?"Connection live":"Connection lost",a=e===H.Success?St:kt;return t(de,{status:e,label:l,leftIcon:a})})(e.status)},{key:ga.OdigosVersion,rawValue:e.odigosVersion},{key:ga.ConnectedSince,rawValue:e.connectedAt?$(e.connectedAt):"-"},{key:ga.LastActivity,rawValue:e.lastSeenAt?$(e.lastSeenAt):"-"}],onClick:e.status!==H.Success||V?void 0:()=>r(e),isSelected:M.includes(e.id),onSelect:()=>R(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>R(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==H.Success||V===ma.BulkConfig&&!We(e.odigosVersion,u)||V===ma.BulkSource&&!We(e.odigosVersion,g)})),[T,M,D,V,u,g]),j=s(()=>{const e=(e,t)=>{R([e]),F(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===ga.Status)?.rawValue===H.Success)(e))return[{id:Ke(),label:"Delete Connection",rightIcon:Ot,onClick:()=>fa(e,n)}];const d=fa(e,e=>{const a=t.find(t=>t.id===e);return!!a&&We(a.odigosVersion,l)}),u=fa(e,e=>{const l=t.find(t=>t.id===e);return!!l&&We(l.odigosVersion,a)}),h=[];return o&&h.push({id:Ke(),tooltip:u?fe.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:vt,disabled:!u,onClick:()=>fa(e,o)}),i&&h.push({id:Ke(),tooltip:fe.ADD_DESTINATION,rightIcon:bt,onClick:()=>fa(e,i)}),r&&h.push({id:Ke(),tooltip:fe.ADD_ACTION,rightIcon:gt,onClick:()=>fa(e,r)}),s&&h.push({id:Ke(),tooltip:fe.ADD_INSTRUMENTATION_RULE,rightIcon:yt,onClick:()=>fa(e,s)}),c&&h.push({id:Ke(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${l} or later.`,rightIcon:wt,disabled:!d,onClick:()=>fa(e,c)}),h}})({connections:T,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,ma.Delete),onAddSource:b&&f?t=>e(t,ma.BulkSource):void 0,onAddDestination:C&&y&&v?t=>e(t,ma.BulkDestination):void 0,onAddAction:w?t=>e(t,ma.BulkAction):void 0,onAddInstrumentationRule:k?t=>e(t,ma.BulkInstrumentationRule):void 0,onEditConfiguration:p&&m?t=>e(t,ma.BulkConfig):void 0})},[T,u,p,m,g,b,f,C,y,v,w,k]),q=s(()=>(e=>{const{onCancel:t,onAddSource:l,onAddDestination:a,onAddAction:n,onAddInstrumentationRule:o,onManageConfigurations:i}=e,r=[];l&&r.push({id:Ke(),type:Ge.Button,buttonProps:{variant:B.Primary,size:W.S,label:"Add Sources",rightIcon:vt,onClick:l}});const s=[a?{id:ma.BulkDestination,label:fe.ADD_DESTINATION,icon:bt}:null,n?{id:ma.BulkAction,label:fe.ADD_ACTION,icon:gt}:null,o?{id:ma.BulkInstrumentationRule,label:fe.ADD_INSTRUMENTATION_RULE,icon:yt}:null,i?{id:ma.BulkConfig,label:"Manage Configurations",icon:wt}:null];return s.some(Boolean)&&r.push({id:Ke(),type:Ge.ButtonDropData,buttonProps:{variant:B.Secondary,size:W.S,label:"Bulk Actions",onClick:e=>{e===ma.BulkSource?l?.():e===ma.BulkDestination?a?.():e===ma.BulkAction?n?.():e===ma.BulkInstrumentationRule?o?.():e===ma.BulkConfig&&i?.()}},dropDataProps:{alignX:He.Left,items:s}}),r.push({id:Ke(),type:Ge.Button,buttonProps:{variant:B.Text,size:W.S,label:Je.CANCEL,onClick:t}}),r})({onCancel:()=>R([]),onAddSource:b&&f?()=>F(ma.BulkSource):void 0,onAddDestination:C&&y&&v?()=>F(ma.BulkDestination):void 0,onAddAction:w?()=>F(ma.BulkAction):void 0,onAddInstrumentationRule:k?()=>F(ma.BulkInstrumentationRule):void 0,onManageConfigurations:p&&m?()=>F(ma.BulkConfig):void 0}),[p,m,b,f,C,y,v,w,k]);return t(Ue,{children:e(Ee,{richTitle:{icon:Ft,title:fe.CONNECTIONS,badge:{label:T.length.toString(),status:Te.Unknown}},search:{placeholder:"Search by cluster name",value:D,onChange:e=>O(e),width:"300px"},actions:[{id:Ke(),type:Ge.Button,buttonProps:{variant:B.Secondary,size:W.S,leftIcon:Vt,onClick:N,disabled:x}}],children:[t(Ye,{variant:Xe.Pretty,maxHeight:l,headerBackgroundColor:S.v2.colors.silver[1e3],isLoading:x,withCheckboxes:!0,columns:ba,rows:z,rowActionsPushRightPosition:V?`calc(${il} - 24px)`:void 0,getRowActions:j}),V===ma.BulkConfig&&p&&m&&t(na,{onClose:()=>F(null),connections:L,selectedConnectionIds:M,setSelectedConnectionIds:R,getEffectiveConfig:p,onApply:m}),V===ma.BulkSource&&b&&f&&t(aa,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))}),V===ma.BulkDestination&&C&&y&&v&&t(Hl,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,getDestinationCategories:C,getPotentialDestinations:y,createDestination:v}),V===ma.BulkAction&&w&&t(Dl,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,createAction:e=>w(e,M)}),V===ma.BulkInstrumentationRule&&k&&t(Bl,{onClose:()=>F(null),selectedConnectionIds:M,setSelectedConnectionIds:R,createInstrumentationRule:e=>k(e,M)}),t(Zt,{target:"connection",isOpen:V===ma.Delete,onClose:()=>{R([]),F(null)},onApprove:async()=>{const e=M[0];e&&(await c(e),await N())}}),t(Ze,{isOpen:!!M.length&&!V,richTitle:{icon:st,title:"Selected Clusters",badge:{label:M.length}},actions:q})]})})},ya=u.div`
|
|
81
130
|
display: flex;
|
|
82
131
|
align-items: center;
|
|
83
132
|
justify-content: space-between;
|
|
@@ -89,10 +138,10 @@ import{jsxs as e,Fragment as t,jsx as n}from"react/jsx-runtime";import{useMemo a
|
|
|
89
138
|
&:hover {
|
|
90
139
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
91
140
|
}
|
|
92
|
-
`,
|
|
93
|
-
animation-name: ${
|
|
94
|
-
`,
|
|
141
|
+
`,va=u.div`
|
|
142
|
+
animation-name: ${lt.in};
|
|
143
|
+
`,wa=({pod:o,getExtendedPodInfo:i,onClose:r})=>{const{formatTimeAgo:c}=Pe(),[d,u]=n(null),[h,p]=n(!1);a(()=>{o?i(o.namespace,o.name).then(e=>u(e??null)):(u(null),p(!1))},[o]);const g=s(()=>[{id:Ke(),title:"Node",label:d?.node??"-",withCopy:!0},{id:Ke(),title:"Status",badge:{status:Qe(d?.status),label:d?.status??"-"}}],[d]),b=s(()=>d?.containers?.map(e=>({id:Ke(),items:[{id:Ke(),title:"Container",label:e.name??"-"},{id:Ke(),title:"Status",label:e.startedAt?`${e.status} (since ${c(e.startedAt)})`:e.status},{id:Ke(),title:"Ready",badge:{status:e.ready?H.Success:H.Error,leftIcon:e.ready?st:ut,label:e.ready?"True":"False",invertColors:!0}},{id:Ke(),title:"Started",badge:{status:e.started?H.Success:H.Error,leftIcon:e.started?st:ut,label:e.started?"True":"False",invertColors:!0}},{id:Ke(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Ke(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Ke(),title:"Restarts",label:e.restarts.toString()},{id:Ke(),title:"State Reason",label:e.stateReason??"-"},{id:Ke(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Ke(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(P,{isOpen:!!o,header:{icon:Mt,title:"Pod Information",onClose:r},children:[d?null:t(M,{children:t(et,{})}),d?e(l,{children:[t(Ee,{richTitle:{icon:Mt,title:d.name,withCopy:!0},children:e(m,{$gap:24,children:[t(Be,{cellsPerRow:2,items:g}),b.length>0&&e(m,{$gap:12,children:[e(ya,{onClick:()=>p(e=>!e),children:[t(K,{children:"Containers Overview"}),t(ye,{icon:h?ft:Ct})]}),h&&b.map(({id:e,items:l})=>t(va,{children:t(Be,{cellsPerRow:2,items:l})},e))]})]})}),t(Ee,{richTitle:{icon:Dt,title:"Kubectl Commands"},children:e(m,{$gap:12,children:[t(tt,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(tt,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(tt,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(jt,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var ka;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(ka||(ka={}));const Sa=[{key:ka.PodName,label:"Pod Name"},{key:ka.Status,label:"Status"},{key:ka.Restarts,label:"Restarts",textAlign:"right"},{key:ka.NodeName,label:"Node Name"},{key:ka.Age,label:"Age",textAlign:"right"},{key:ka.DockerImage,label:"Docker Image",textAlign:"right"}],$a=({isLoading:l,tableRowsMaxHeight:a,pods:o,getExtendedPodInfo:i})=>{const r=h(),{formatTimeAgo:c}=Pe(),[d,u]=n(null),p=s(()=>o.map(l=>({onClick:()=>u(l),cells:[{key:ka.PodName,rawValue:l.name},{key:ka.Status,rawValue:l.status,component:()=>{return e=l.status,t(de,{status:Qe(e),label:e});var e}},{key:ka.Restarts,rawValue:l.restartsCount.toString()},{key:ka.NodeName,rawValue:l.nodeName},{key:ka.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:a}=l;if(!a)return t(K,{children:"-"});const n=(a?.metricsAcceptedRps??0)+(a?.metricsDroppedRps??0),o=n>0?Math.round((a?.metricsDroppedRps??0)/n*100):0,i=o>0?H.Error:H.Success,r=(a?.exporterSuccessRps??0)+(a?.exporterFailedRps??0),s=r>0?Math.round((a?.exporterFailedRps??0)/r*100):0,c=s>0?H.Error:H.Success;return e(O,{$gap:4,children:[t(ae,{text:`Accepted: ${a.metricsAcceptedRps.toLocaleString()}, Dropped: ${a.metricsDroppedRps.toLocaleString()}`,children:t(de,{status:i,label:`Receiver ${o}%`,leftIcon:i===H.Error?Rt:Pt,useSecondaryTone:!0,invertColors:!0})}),t(ae,{text:`Success: ${a.exporterSuccessRps.toLocaleString()}, Failed: ${a.exporterFailedRps.toLocaleString()}`,children:t(de,{status:c,label:`Exporter ${s}%`,leftIcon:c===H.Error?Rt:Pt,useSecondaryTone:!0,invertColors:!0})})]})}},{key:ka.Age,rawValue:c(l.creationTimestamp)},{key:ka.DockerImage,rawValue:l.image}]})),[o,r]);return e(Ee,{richTitle:{icon:Mt,title:"Pods"},children:[t(Ye,{variant:Xe.Data,maxHeight:a,isLoading:l,columns:Sa,rows:p}),t(wa,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var xa;!function(e){e.Gateway="gateway",e.Node="node"}(xa||(xa={}));const Ia=[{value:xa.Gateway,label:"Gateway"},{value:xa.Node,label:"Node Collector"}],Ta=u.div`
|
|
95
144
|
display: flex;
|
|
96
145
|
align-items: center;
|
|
97
146
|
justify-content: space-between;
|
|
98
|
-
`,
|
|
147
|
+
`,Aa=({selectedTab:l,setSelectedTab:a,onClickDownloadDiagnose:n,onClickRefresh:o,loading:i,disabled:r})=>{const c=s(()=>{const e=[];return n&&e.push({id:Ke(),type:Ge.Button,buttonProps:{label:"Download Diagnose",leftIcon:Nt,size:W.S,variant:B.Text,onClick:n,disabled:r}}),o&&e.push({id:Ke(),type:Ge.Button,buttonProps:{label:"Refresh",leftIcon:Vt,size:W.S,variant:B.Text,onClick:o,disabled:r,loading:i}}),e},[n,o,r,i]);return e(Ta,{children:[e(O,{$gap:12,children:[e(O,{$gap:8,children:[t(Lt,{size:32}),t(K,{size:E.M,weight:500,children:"Pipeline Collectors"})]}),t(J,{options:Ia,selected:l,setSelected:a,disabled:r})]}),t(at,{actions:c})]})},Na=({isOpen:e,onClose:l,title:a,yaml:n})=>t(P,{isOpen:e,header:{icon:Et,title:a,onClose:l},children:t(jt,{yaml:n,defaultOpen:!0})});var Da;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Da||(Da={}));const Oa=({richTitle:l,statusCard:a,textCards:o,manifestYaml:i,configMapYaml:r})=>{const[s,c]=n(null);return e(Ee,{richTitle:l,actions:[{id:Ke(),type:Ge.ButtonDropData,buttonProps:{variant:B.Secondary,size:W.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:Da.ManifestYaml,label:l.title,icon:zt},{id:Da.ConfigMapYaml,label:"ConfigMap",icon:zt}]}}],children:[e(O,{$gap:16,children:[t(nt,{...a}),o.map(e=>t(ot,{...e},e.title))]}),t(Na,{isOpen:s===Da.ManifestYaml,onClose:()=>c(null),title:l.title,yaml:i}),t(Na,{isOpen:s===Da.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:r})]})},Va=e=>{switch(e){case it.Healthy:return"All desired replicas are updated, available, and ready";case it.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case it.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case it.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case it.Down:return"No available replicas";case it.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Fa=({minSupportedVersion:l=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:r,getNodeCollectorInfo:c,getNodeCollectorPods:u,getExtendedPodInfo:h})=>{const{formatTimeAgo:p}=Pe(),{isVersionSupported:m,version:g}=_e(l),[b,f]=n(!1),[C,y]=n(xa.Gateway),[v,w]=n(null),[k,S]=n([]),[$,x]=n(null),[I,T]=n([]),A=d(async()=>{f(!0);try{switch(C){case xa.Gateway:w(await i()??null),S(await r()??[]);break;case xa.Node:x(await c()??null),T(await u()??[])}}catch(e){}f(!1)},[C]);a(()=>{A()},[A]);const N=s(()=>(e=>{switch(e){case xa.Gateway:return"Deployment";case xa.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(C),[C]),D=s(()=>((e,t,l,a)=>{const n={status:Te.Disabled,label:"No rollouts yet"};let o=!1,i=null;switch(e){case xa.Gateway:o=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case xa.Node:o=l?.rolloutInProgress??!1,i=l?.lastRolloutAt??null;break;default:return n}return o?{status:H.Info,label:"Rollout in progress",rightIcon:Vt,useSecondaryTone:!0}:i?{status:Te.Disabled,label:`Last Rollout: ${a(i)}`}:n})(C,v,$,p),[v,$,C,p]),O=s(()=>((e,t,l,a)=>{let n=a?H.Info:Te.Unknown,o=a?"Loading":it.Unknown,i=a?"Fetching data...":Va(it.Unknown);switch(e){case xa.Gateway:n=t?.status?Qe(t?.status):n,o=t?.status??o,i=t?.status?Va(t.status):i;break;case xa.Node:n=l?.status?Qe(l?.status):n,o=l?.status??o,i=l?.status?Va(l.status):i}return{status:n,title:o,description:i}})(C,v,$,b),[v,$,C,b]),V=s(()=>((e,t,l,a)=>{switch(e){case xa.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:a},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:a},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:a},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:a}]}];case xa.Node:return[{title:"Nodes",cells:[{label:"Desired",value:l?.nodes?.desired.toString()??"-",isLoading:a},{label:"Ready",value:l?.nodes?.ready.toString()??"-",isLoading:a}]},{title:"Requests",cells:[{label:"CPU",value:l?.resources?.requests.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.requests.memory??"-",isLoading:a}]},{title:"Limits",cells:[{label:"CPU",value:l?.resources?.limits.cpu??"-",isLoading:a},{label:"Memory",value:l?.resources?.limits.memory??"-",isLoading:a}]},{title:"Docker Image",cells:[{value:l?.imageVersion??"-",isLoading:a}]}];default:return[]}})(C,v,$,b),[v,$,C,b]),F=s(()=>(C===xa.Gateway?v?.manifestYAML:$?.manifestYAML)??"",[v,$,C]),M=s(()=>(C===xa.Gateway?v?.configMapYAML:$?.configMapYAML)??"",[v,$,C]),R=s(()=>C===xa.Gateway?k:I,[k,I,C]);return e(Ue,{children:[t(Aa,{disabled:!m,loading:b,selectedTab:C,setSelectedTab:y,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(rt,{children:[t(Oa,{richTitle:{icon:Et,title:N,badge:D},statusCard:O,textCards:V,manifestYaml:F,configMapYaml:M}),t($a,{isLoading:b,tableRowsMaxHeight:o,pods:R,getExtendedPodInfo:h}),!m&&t(tl,{minSupportedVersion:l,currentVersion:g||""})]})]})};export{Dl as AddActionDrawer,ml as AddActionForm,Hl as AddDestinationDrawer,bl as AddDestinationForm,Bl as AddRuleDrawer,$l as AddRuleForm,aa as AddSourceDrawer,Ca as CentralConnections,na as EditConfigDrawer,Fa as PipelineCollectors,pa as SystemDrawer};
|