@odigos/ui-kit 0.0.227 → 0.0.228
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 +12 -0
- package/lib/chunks/{index-B0b5lJH3.js → index-DJZLguZq.js} +1 -1
- package/lib/chunks/{index-C-Z4QHpA.js → index-hLSQkKAv.js} +1 -1
- package/lib/chunks/{ui-components-C7i9zbc-.js → ui-components-B4xHrszQ.js} +270 -263
- package/lib/components/_v2/cards/data-card/index.d.ts +2 -1
- package/lib/components/_v2/index.d.ts +1 -0
- package/lib/components/_v2/typography/index.d.ts +2 -2
- package/lib/components/_v2/typography-truncatable/index.d.ts +21 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/_drawers/add-destination-drawer/helpers.d.ts +4 -3
- package/lib/containers/_v2/_drawers/add-destination-drawer/lists-column/index.d.ts +2 -3
- package/lib/containers/_v2/_drawers/edit-destination-drawer/helpers.d.ts +30 -3
- package/lib/containers/source-drawer/index.d.ts +1 -0
- package/lib/containers/v2.js +29 -29
- package/lib/containers.js +2 -2
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets/v2.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/common/index.d.ts +6 -0
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
package/lib/containers/v2.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as i,useState as l,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as N,l as A,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as L,t as M,v as V,S as B,w as z,x as _,y as U,z as X,E as j,G as H,H as W,J as G,L as K,M as Y,O as q,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as ie,_ as le,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ne,ah as Ae,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Le,as as Me,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as Xe,az as je,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,aK as tt,D as at,aL as nt,aM as ot,aN as it,aO as lt,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as Nt,b6 as At,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,bc as xt,bd as Ot,be as Pt,bf as Ft,u as Lt,bg as Mt,bh as Vt,bi as Bt,bj as zt,bk as _t,bl as Ut,g as Xt,bm as jt,A as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as ia,bB as la,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Na,bV as Aa,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as La,c4 as Ma,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as Xa}from"../chunks/ui-components-C7i9zbc-.js";import{TrashIcon as ja,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as Nn,GatewayIcon as An,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Ln,d as Mn,e as Vn,W as Bn,f as zn,g as _n,h as Un,U as Xn}from"../chunks/index-C-Z4QHpA.js";import{Y as jn}from"../chunks/index-B0b5lJH3.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Hn=[{id:"CREDIT_CARD",label:"Credit card"}],Wn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Gn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Kn=[{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:Gn}],Yn=[{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:Gn}],qn=[{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:C.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:C.Number}],Jn=h.UrlTemplatizationRulesGroups,Qn=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],Zn=[{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:C.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:C.Number}],eo=[{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:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.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:x.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}],to={[O.K8sAttributes]:({value:o,setValue:i,formErrors:l})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(i(h.CollectContainerAttributes,!0),i(h.CollectReplicaSetAttributes,!0),i(h.CollectWorkloadId,!0),i(h.CollectClusterId,!0),i(h.LabelsAttributes,[]),i(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Wn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>i(a,e)}),t(y,{errorMessage:l[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Kn,values:o[h.LabelsAttributes]||[],setValues:e=>i(h.LabelsAttributes,e),errorMessage:l[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Yn,values:o[h.AnnotationsAttributes]||[],setValues:e=>i(h.AnnotationsAttributes,e),errorMessage:l[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:i})=>{const l=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:N.Left,labelColor:l.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:i[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(A,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:i})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Hn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Hn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],i=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,i)}},e))}),t(y,{errorMessage:i[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],i=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:i,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],i=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:i,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],i=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:qn,values:i,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],i=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Zn,values:i,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],i=(e[h.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const o=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n[o]?.operation,expectedValue:n[o]?.expectedValue,jsonPath:n[o]?.jsonPath}});return t(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:eo,values:i,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:i,jsonPath:l})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:i}}};return l&&(s.condition[n].jsonPath=l),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:i,formErrors:l})=>{const s=m(),r=n[Jn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>i(Jn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(ja,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(w,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Qn,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(A,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(y,{errorMessage:l[Jn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},ao=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=to[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},no=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>l("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:i.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:s.name}),t(ao,{actionType:n.type,value:i.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},oo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:i,formErrors:l})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:l[b],dropdownOptions:g,value:y||"",setValue:e=>i(b,e)},b)}),io=p(D)`
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,forwardRef as l,useState as i,useImperativeHandle as s,useMemo as r,useCallback as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{c as h,F as g,d as b,e as f,f as y,I as v,h as C,i as S,j as w,K as k,T,k as N,l as A,m as I,n as D,o as E,B as $,a as R,p as x,q as O,r as P,N as F,s as L,t as M,v as V,S as B,w as z,x as _,y as U,z as j,E as X,G as H,H as W,J as G,L as K,M as Y,O as q,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as le,_ as ie,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ye,ab as ve,ac as Ce,ad as Se,ae as we,b as ke,af as Te,ag as Ne,ah as Ae,ai as Ie,aj as De,ak as Ee,al as $e,am as Re,an as xe,ao as Oe,ap as Pe,aq as Fe,ar as Le,as as Me,at as Ve,au as Be,av as ze,aw as _e,ax as Ue,ay as je,az as Xe,aA as He,aB as We,aC as Ge,aD as Ke,aE as Ye,aF as qe,aG as Je,aH as Qe,aI as Ze,aJ as et,aK as tt,D as at,aL as nt,aM as ot,aN as lt,aO as it,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as yt,a$ as vt,b0 as Ct,b1 as St,b2 as wt,b3 as kt,b4 as Tt,b5 as Nt,b6 as At,b7 as It,b8 as Dt,b9 as Et,ba as $t,bb as Rt,bc as xt,bd as Ot,be as Pt,bf as Ft,u as Lt,bg as Mt,bh as Vt,bi as Bt,bj as zt,bk as _t,bl as Ut,g as jt,bm as Xt,A as Ht,bn as Wt,bo as Gt,bp as Kt,bq as Yt,br as qt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as la,bB as ia,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as ya,bO as va,bP as Ca,bQ as Sa,bR as wa,bS as ka,bT as Ta,bU as Na,bV as Aa,bW as Ia,bX as Da,bY as Ea,bZ as $a,b_ as Ra,b$ as xa,c0 as Oa,c1 as Pa,c2 as Fa,c3 as La,c4 as Ma,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja}from"../chunks/ui-components-B4xHrszQ.js";import{TrashIcon as Xa,PlusIcon as Ha,BookIcon as Wa,VSquareIcon as Ga,XSquareIcon as Ka,DeleteIcon as Ya,EditIcon as qa,GoLogo as Ja,JavaLogo as Qa,ChevronRightIcon as Za,ActionIcon as en,DestinationIcon as tn,ChevronUpIcon as an,ChevronDownIcon as nn,VIcon as on,XIcon as ln,InstrumentationRuleIcon as sn,SourceIcon as rn,NamespacesIcon as cn,SettingsIcon as dn,SamplingIcon as un,ExclamationTriangleIcon as pn,ExclamationCircleIcon as mn,KeyIcon as hn,DiagnoseIcon as gn,DownloadIcon as bn,TerminalIcon as fn,RefreshIcon as yn,ConnectionsIcon as vn,OdigosLogo as Cn,ArrowRightIcon as Sn,PipelineCollectorIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as Nn,GatewayIcon as An,YamlIcon as In}from"../icons.js";import{S as Dn,D as En,A as $n,P as Rn,a as xn,b as On,R as Pn,c as Fn,O as Ln,d as Mn,e as Vn,W as Bn,f as zn,C as _n,g as Un,h as jn,U as Xn}from"../chunks/index-hLSQkKAv.js";import{Y as Hn}from"../chunks/index-DJZLguZq.js";import"zustand";import"javascript-time-ago";import"../chunks/vendor-C150cdxb.js";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";import"virtua";const Wn=[{id:"CREDIT_CARD",label:"Credit card"}],Gn=[{id:h.CollectContainerAttributes,label:"Collect container attributes"},{id:h.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:h.CollectWorkloadId,label:"Collect workload ID"},{id:h.CollectClusterId,label:"Collect cluster ID"}],Kn=[{id:k.Pod,label:k.Pod},{id:k.Namespace,label:k.Namespace},{id:k.Node,label:k.Node}],Yn=[{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:Kn}],qn=[{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:Kn}],Jn=[{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:C.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:C.Number}],Qn=h.UrlTemplatizationRulesGroups,Zn=[{keyName:"kind",label:"Kind",placeholder:"Any kind",componentType:"dropdown",options:[{id:"Deployment",label:"Deployment"},{id:"StatefulSet",label:"StatefulSet"},{id:"DaemonSet",label:"DaemonSet"}]},{keyName:"name",label:"Name",placeholder:"Any name"}],eo=[{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:C.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:C.Number}],to=[{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:C.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:x.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:x.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}],ao={[O.K8sAttributes]:({value:o,setValue:l,formErrors:i})=>(n(()=>{o[h.CollectContainerAttributes]||o[h.CollectReplicaSetAttributes]||o[h.CollectWorkloadId]||o[h.CollectClusterId]||o[h.LabelsAttributes]?.length||o[h.AnnotationsAttributes]?.length||(l(h.CollectContainerAttributes,!0),l(h.CollectReplicaSetAttributes,!0),l(h.CollectWorkloadId,!0),l(h.CollectClusterId,!0),l(h.LabelsAttributes,[]),l(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Gn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:o[a]||!1,onChange:e=>l(a,e)}),t(y,{errorMessage:i[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Yn,values:o[h.LabelsAttributes]||[],setValues:e=>l(h.LabelsAttributes,e),errorMessage:i[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:qn,values:o[h.AnnotationsAttributes]||[],setValues:e=>l(h.AnnotationsAttributes,e),errorMessage:i[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:o,formErrors:l})=>{const i=m();return e(a,{children:[t(T,{label:"Overwrite existing values",labelAlign:N.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[h.OverwriteExistingValues]||!1,onChange:e=>o(h.OverwriteExistingValues,e)}),t(w,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[h.ClusterAttributes]||[],setValues:e=>o(h.ClusterAttributes,e),errorMessage:l[h.ClusterAttributes]})]})},[O.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(A,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[h.AttributeNamesToDelete]||[],setValues:e=>a(h.AttributeNamesToDelete,e),errorMessage:n[h.AttributeNamesToDelete]}),[O.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(w,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[h.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(h.Renames,t)},errorMessage:n[h.Renames]}),[O.PiiMasking]:({value:a,setValue:o,formErrors:l})=>(n(()=>{a[h.PiiCategories]?.length||o(h.PiiCategories,Wn.map(({id:e})=>e))},[]),e(g,{$gap:12,children:[t(b,{label:"Attributes to mask"}),t(g,{$gap:6,children:Wn.map(({id:e,label:n})=>t(f,{label:n,value:a[h.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[h.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(h.PiiCategories,l)}},e))}),t(y,{errorMessage:l[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.FallbackSamplingRatio],l=S(e[h.FallbackSamplingRatio])?"":String(e[h.FallbackSamplingRatio]);return t(v,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.SamplingPercentage],l=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(h.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.EndpointsFilters],l=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Jn,values:l,setValues:e=>{a(h.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.ServicesNameFilters],l=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:eo,values:l,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[h.AttributeFilters],l=(e[h.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const o=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n[o]?.operation,expectedValue:n[o]?.expectedValue,jsonPath:n[o]?.jsonPath}});return t(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:to,values:l,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:l,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:l}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:o})},[O.URLTemplatization]:({value:n,setValue:l,formErrors:i})=>{const s=m(),r=n[Qn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Qn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(o,{children:[t(I,{}),e(g,{$gap:12,children:[e(D,{$justifyContent:"space-between",$alignItems:"center",children:[t(b,{label:`Rule Group ${n+1}`}),t(E,{leftIcon:()=>t(Xa,{fill:s.v2.colors.red[500]}),variant:R.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(v,{name:`urlGroup-${n}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>d(n,{filterK8sNamespace:e.target.value})}),t(w,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Zn,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(A,{name:`urlGroup-${n}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>d(n,{templatizationRules:e.map(e=>({template:e}))})})]}),t(y,{errorMessage:i[Qn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Ha,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},no=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=ao[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},oo=()=>{const a=m(),{selectedOption:n,genericForm:o}=P();if(!o||!n)return t(F,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(Dn,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),t(v,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),t(no,{actionType:n.type,value:l.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},lo=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:l,formErrors:i})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||_(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),y=f?f.value:m;return t(En,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:i[b],dropdownOptions:g,value:y||"",setValue:e=>l(b,e)},b)}),io=p(D)`
|
|
2
2
|
position: sticky;
|
|
3
3
|
bottom: 0;
|
|
4
4
|
margin-top: auto;
|
|
5
5
|
padding: 12px 0;
|
|
6
6
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
7
7
|
z-index: 1;
|
|
8
|
-
`,lo=i(({testConnection:a,isEdit:o},i)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:b,deleteUnsavedDestination:f}=U(),[y,C]=l(p?.testResult),[S,w]=l(!!p);n(()=>{p?(C(p.testResult),w(!0)):(C(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(K(d.formData));return C(e),e};return s(i,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(g,{$gap:24,style:{minHeight:"100%"},children:[e(D,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(X,{status:j.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(X,{status:j.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(E,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(Dn,{title:"This connection will monitor:",allowedSignals:G(c.option.supportedSignals),selectedSignals:W(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:S,errorMessage:d.formErrors.exportedSignals}),t(v,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:S,errorMessage:d.formErrors.name}),t(oo,{signals:W(d.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!o&&e(io,{$gap:8,$justifyContent:"flex-end",children:[p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Ya,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",S?{style:{width:"150px"},children:t(E,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:qa,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(E,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;b(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(F,{title:"No active form"})});lo.displayName="AddDestinationForm";const so=[{id:Y.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Y.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Y.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],ro=[{id:Y.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Y.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Y.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],co=["*"],uo=[{id:Q.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Q.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Q.DbQuery,label:"Collect DB query",tooltip:""},{id:Q.Messaging,label:"Collect messaging",tooltip:""}],po={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},mo={[ae.CodeAttributes]:({value:o,setValue:i,formErrors:l})=>{const s=m(),c=l.codeAttributes,d=r(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!c){const e={[Y.FilePath]:!0,[Y.Function]:!0,[Y.LineNumber]:!0,[Y.Column]:null,[Y.Namespace]:null,[Y.StackTrace]:null};i("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Y).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});i("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:so.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]}),e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:ro.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]})]})},[ae.CustomInstrumentation]:({value:o,setValue:i,formErrors:l})=>{const s=l.customInstrumentations,c=r(()=>(o?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=r(()=>(o?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||i("customInstrumentations",{[te.Golang]:po[te.Golang],[te.Java]:po[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Ja,{}),t(b,{label:"Golang custom probes"})]}),t(w,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[te.Golang]=e.map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[te.Java]=d,i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),t(b,{label:"Java custom probes"})]}),t(w,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[te.Golang]=c,t[te.Java]=e.map(e=>new ee(e.className,e.methodName)),i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const i=o.headersCollection,l=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{l.length||i||s(co)},[]),t(A,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:s,errorMessage:i})},[ae.PayloadCollection]:({value:a,setValue:o,formErrors:i})=>{const l=m(),s=i.payloadCollection,c=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!c.length&&!s){const e={[Q.HttpRequest]:{},[Q.HttpResponse]:{},[Q.DbQuery]:{},[Q.Messaging]:{}};o("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(L,{size:M.XS,color:l.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:uo.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:c.includes(e),onChange:t=>((e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n={[Q.HttpRequest]:a.includes(Q.HttpRequest)?{}:null,[Q.HttpResponse]:a.includes(Q.HttpResponse)?{}:null,[Q.DbQuery]:a.includes(Q.DbQuery)?{}:null,[Q.Messaging]:a.includes(Q.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},ho=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=mo[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},go=()=>{const a=m(),{selectedOption:n,genericForm:o}=ne();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(L,{size:M.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(oe,{label:ie[e],leftIcon:le(e),status:j.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:i.ruleName,onChange:({target:{value:e}})=>l("ruleName",e),errorMessage:s.ruleName}),t(ho,{ruleType:n.type,value:i,setValue:(e,t)=>l(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes,onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},bo=p.div`
|
|
8
|
+
`,so=l(({testConnection:a,isEdit:o},l)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:b,deleteUnsavedDestination:f}=U(),[y,C]=i(p?.testResult),[S,w]=i(!!p);n(()=>{p?(C(p.testResult),w(!0)):(C(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(K(d.formData));return C(e),e};return s(l,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(g,{$gap:24,style:{minHeight:"100%"},children:[e(D,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(j,{status:X.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(j,{status:X.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(E,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(Dn,{title:"This connection will monitor:",allowedSignals:G(c.option.supportedSignals),selectedSignals:W(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:S,errorMessage:d.formErrors.exportedSignals}),t(v,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:S,errorMessage:d.formErrors.name}),t(lo,{signals:W(d.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!o&&e(io,{$gap:8,$justifyContent:"flex-end",children:[p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Ya,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",S?{style:{width:"150px"},children:t(E,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:qa,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(E,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;b(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(F,{title:"No active form"})});so.displayName="AddDestinationForm";const ro=[{id:Y.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Y.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Y.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],co=[{id:Y.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Y.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Y.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],uo=["*"],po=[{id:Q.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Q.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Q.DbQuery,label:"Collect DB query",tooltip:""},{id:Q.Messaging,label:"Collect messaging",tooltip:""}],mo={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},ho={[ae.CodeAttributes]:({value:o,setValue:l,formErrors:i})=>{const s=m(),c=i.codeAttributes,d=r(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!c){const e={[Y.FilePath]:!0,[Y.Function]:!0,[Y.LineNumber]:!0,[Y.Column]:null,[Y.Namespace]:null,[Y.StackTrace]:null};l("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Y).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:ro.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]}),e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:co.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]})]})},[ae.CustomInstrumentation]:({value:o,setValue:l,formErrors:i})=>{const s=i.customInstrumentations,c=r(()=>(o?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=r(()=>(o?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||l("customInstrumentations",{[te.Golang]:mo[te.Golang],[te.Java]:mo[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Ja,{}),t(b,{label:"Golang custom probes"})]}),t(w,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[te.Golang]=e.map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[te.Java]=d,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),t(b,{label:"Java custom probes"})]}),t(w,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[te.Golang]=c,t[te.Java]=e.map(e=>new ee(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const l=o.headersCollection,i=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{i.length||l||s(uo)},[]),t(A,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:s,errorMessage:l})},[ae.PayloadCollection]:({value:a,setValue:o,formErrors:l})=>{const i=m(),s=l.payloadCollection,c=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!c.length&&!s){const e={[Q.HttpRequest]:{},[Q.HttpResponse]:{},[Q.DbQuery]:{},[Q.Messaging]:{}};o("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(L,{size:M.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:po.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:c.includes(e),onChange:t=>((e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n={[Q.HttpRequest]:a.includes(Q.HttpRequest)?{}:null,[Q.HttpResponse]:a.includes(Q.HttpResponse)?{}:null,[Q.DbQuery]:a.includes(Q.DbQuery)?{}:null,[Q.Messaging]:a.includes(Q.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},go=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=ho[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},bo=()=>{const a=m(),{selectedOption:n,genericForm:o}=ne();if(!o||!n)return t(F,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(L,{size:M.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(oe,{label:le[e],leftIcon:ie(e),status:X.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:l.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),t(go,{ruleType:n.type,value:l,setValue:(e,t)=>i(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},fo=p.div`
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
gap: 24px;
|
|
12
|
-
`,
|
|
12
|
+
`,yo=()=>{const e=se();switch(e.formType){case re.Create:return t(vo,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions});case re.View:return e.data?e.isEditing?t(vo,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions}):t(Co,{data:e.data}):null;case re.EditAutoNoisy:return t(So,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:fe,sectionTitle:be,sectionSubTitle:ge,presetLabel:he,customInputName:"sampling-auto-input-custom-percentage",percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage});case re.EditAutoCostReduction:return t(So,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:me,sectionTitle:pe,sectionSubTitle:ue,presetLabel:de,customInputName:"sampling-cr-auto-input-custom-percentage",percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage});case re.EditAutoHighlyRelevant:return t(fo,{children:t($n,{title:e.localEnabled?void 0:ce,summary:e.summary})})}},vo=({category:a,formData:n,onChange:o,sourceOptions:l,namespaceOptions:i})=>e(fo,{children:[t(On,{category:a,formState:n}),t(Pn,{category:a,formState:n,onChange:o}),t(Fn,{formState:n,onChange:o,sourceOptions:l,namespaceOptions:i}),t(Ln,{category:a,formState:n,onChange:o}),t(Mn,{category:a,formState:n,onChange:o}),"highlyRelevant"===a&&t(Vn,{ruleType:n.ruleType,formState:n,onChange:o})]}),Co=({data:a})=>e(fo,{children:[t(On,{readOnly:!0,summary:a.summary}),t(Pn,{readOnly:!0,data:a}),t(Fn,{readOnly:!0,scopes:a.rule.sourceScopes??[]}),t(Ln,{readOnly:!0,data:a}),t(Mn,{readOnly:!0,data:a}),"highlyRelevant"===a.category&&t(Vn,{readOnly:!0,rule:a.rule})]}),So=({enabled:a,summary:n,inactiveTitle:o,sectionTitle:l,sectionSubTitle:i,presetLabel:s,customInputName:r,percentagePreset:d,setPercentagePreset:u,customPercentage:p,setCustomPercentage:m})=>{const h=c(e=>u(e),[u]),g=c(e=>m(e.target.value),[m]);return e(fo,{children:[t($n,{title:a?void 0:o,summary:n}),t(ye,{richTitle:{title:l,subTitle:i},children:t(Rn,{description:s,options:xn,selected:d,onSelect:h,customName:r,customLabel:ve,customPlaceholder:"5%",customValue:p,onCustomChange:g})})]})},wo=p.div`
|
|
13
13
|
display: flex;
|
|
14
14
|
align-items: center;
|
|
15
15
|
justify-content: space-between;
|
|
@@ -22,32 +22,32 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
22
22
|
&:hover {
|
|
23
23
|
background-color: ${({$isSelected:e,$purpleColors:t,theme:a})=>e?t?a.v2.colors.purple[700]:a.v2.colors.silver[600]:t?a.v2.colors.purple[800]:a.v2.colors.silver[700]};
|
|
24
24
|
}
|
|
25
|
-
`,
|
|
25
|
+
`,ko=p.div`
|
|
26
26
|
display: flex;
|
|
27
27
|
align-items: center;
|
|
28
28
|
justify-content: center;
|
|
29
29
|
padding: 8px;
|
|
30
30
|
border-radius: 8px;
|
|
31
31
|
background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
|
|
32
|
-
`,
|
|
32
|
+
`,To=({dataId:a,icon:n,title:o,description:l,withCarret:i,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:h,onCheckboxChange:b})=>{const y=m();return e(wo,{"data-id":a||`list-item-${o}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[e(g,{$gap:4,children:[e(D,{$gap:12,children:[b&&t(f,{partiallyChecked:h||!1,value:p||!1,onChange:e=>b(e)}),n&&t(ko,{children:t(n,{size:20})}),t(L,{size:M.XS,children:o})]}),l&&t(L,{size:M.XXXS,color:y.v2.colors.silver[200],children:l})]}),(i||c)&&e(D,{$gap:8,children:[c,i&&t(Za,{size:18})]})]})},No=p.div`
|
|
33
33
|
display: flex;
|
|
34
34
|
align-items: center;
|
|
35
35
|
gap: 8px;
|
|
36
36
|
padding: 8px;
|
|
37
|
-
`,
|
|
37
|
+
`,Ao=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:o,createAction:l,withOverlay:s})=>{const c=m(),[u,p]=i(""),h=d(null),{selectedOption:g,onSelectOption:b,genericForm:f,validateFormData:y,errorMessage:v}=P(),C=r(()=>(u?Se.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):Se).filter(e=>!!e),[u]),S=r(()=>(u?we.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):we).filter(e=>!!e),[u]),w=r(()=>{const a=(a,n)=>e(No,{children:[t(L,{size:M.XS,color:c.v2.colors.silver[200],children:a}),t(oe,{label:n.toString()})]},a),n=e=>{const a=g?.type===e.type;return t(To,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),b(e)}},e.type)};return[a("Attributes",C.length),...C.map(n),a("Samplers",S.length),...S.map(n)]},[c,g?.type,C.length,S.length,b]),k=r(()=>g?[t(oo,{},g.type)]:[t(ke,{$height:"100%",children:t(F,{icon:en,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[g]);return t(Bn,{ref:h,isOpen:!0,withOverlay:s,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=y();return e?Promise.resolve({error:e}):await l(t)},disableSave:!g||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,errorMessage:v,progress:{title:Te.CREATING_ACTION,subTitle:Te.CREATING_ACTION_SUBTITLE},header:{icon:en,title:Te.ADD_ACTION,subTitle:Te.ADD_ACTION_DESCRIPTION},connectionIds:n&&o?{value:n,setValue:o}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:w},rightColumn:{width:"60%",list:k}})},Io=({testConnection:e})=>{const{activeForm:a}=U();return{width:"60%",list:a?[t(so,{testConnection:e},a.option.type)]:[t(ke,{$height:"100%",children:t(F,{icon:tn,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},Do=p.div`
|
|
38
38
|
display: flex;
|
|
39
39
|
flex-direction: column;
|
|
40
40
|
padding: 8px;
|
|
41
41
|
border-radius: 16px;
|
|
42
42
|
border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
|
|
43
43
|
background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
|
|
44
|
-
`,
|
|
44
|
+
`,Eo=p.div`
|
|
45
45
|
display: flex;
|
|
46
46
|
align-items: center;
|
|
47
47
|
justify-content: space-between;
|
|
48
48
|
gap: 12px;
|
|
49
49
|
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
50
|
-
|
|
50
|
+
`,$o=({title:a,tooltip:n,list:o,noBgColor:l,purpleColors:s})=>{const[r,c]=i(!0);return e(Do,{"data-id":`collapse-${a}`,$noBgColor:l,$purpleColors:s,children:[e(Eo,{$isOpen:r,children:[e(D,{$gap:10,children:[t(L,{size:M.XS,children:a}),n&&t(q,{text:n,withIcon:!0}),t(oe,{label:o.length,status:s?X.Default:void 0})]}),t(Ne,{icon:r?an:nn,size:Ae.M,onClick:()=>c(e=>!e)})]}),r?t(g,{children:o.length?u.toArray(o):t(ke,{$padding:"12px 0",children:t(F,{})})}):null]})},Ro=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,xo=({option:e,formData:a,testResult:n,isSelected:o,onSelect:l})=>t(To,{icon:$e(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>l(),children:n&&t(oe,{status:n.succeeded?X.Success:X.Error,leftIcon:n.succeeded?on:ln})}),Oo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:l}=U();return a?.length?t($o,{title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:a.map((a,n)=>t(xo,{option:a,isSelected:o?.listType===e&&"number"!=typeof o?.unsavedIdx&&(null!=a.id&&""!==a.id?o?.option.id===a.id:o?.option.type===a.type),onSelect:()=>l({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t($o,{purpleColors:!0,title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:i},s)=>t(xo,{option:a,formData:n,testResult:i,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0},Po=({isFetching:e,destinationsByCategory:a,searchText:n,filters:o})=>{const{unsavedDestinations:l}=U();return{width:"40%",list:r(()=>{const i=[];l.length&&i.push(t(Oo,{listType:Ie.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(Ie)){if(o.categoryType&&o.categoryType!==e)continue;const l=Ro(a[e],n,o);l.length&&i.push(t(Oo,{listType:e,destinationOptions:l},e))}return e&&i.push(t(ke,{children:t(De,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),i},[l,a,n,o,e])}},Fo=({destinationsByCategory:n,filters:o,setFilters:l})=>{const i=r(()=>Object.values(Ie).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>n[e.id]?.length),[n]),s=r(()=>{const e=Object.values(H).map(e=>({value:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()}));return e.unshift({value:null,label:"All"}),e},[]);return e(a,{children:[t(Re,{placeholder:"Select category",options:i,values:o.categoryType?[o.categoryType]:[],setValues:e=>l({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:xe.S,options:s,selected:o.signalType,setSelected:e=>l({...o,signalType:e})})]})};var Lo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Lo||(Lo={}));const Mo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Lo.SELF_HOSTED?n.push(...e.items):e.name===Lo.MANAGED&&o.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const n of e?.destinationCategories?.categories||[]){const e=Oe(n),o=e.items.findIndex(e=>e.type===t.type);if(-1!==o){const n=Pe(t.fields,{});Object.keys(n).length&&(e.items[o].fields=e.items[o].fields.map(e=>({...e,initialValue:n[e.name]})),a.push(e.items[o]))}}}),{[Ie.DETECTED]:a,[Ie.SELF_HOSTED]:n,[Ie.MANAGED]:o}},Vo=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:l,setSelectedConnectionIds:s,getDestinationCategories:r,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m,updateDestination:h,withOverlay:g,disableAnimation:b})=>{const[f,y]=i(""),[v,C]=i({categoryType:null,signalType:null}),{destinations:S}=Fe(),{activeForm:w,genericForm:k,formErrorMessage:T,unsavedDestinations:N,setUnsavedDestinations:A}=U();n(()=>{u&&A(u)},[u]);const[I,D]=i(!0),[E,$]=i([]),[R,x]=i({[Ie.ALL]:[],[Ie.UNSAVED]:[],[Ie.EXISTS]:[],[Ie.DETECTED]:[],[Ie.SELF_HOSTED]:[],[Ie.MANAGED]:[]});n(()=>{const e=S.map(e=>{let t;for(const a of E){const n=a.items.find(t=>t.type===e.destinationType.type);if(n){t=n;break}}const a=Pe(e.fields,{});return{id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:t?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:t?t.fields.map(e=>({...e,initialValue:a[e.name]??e.initialValue})):[]}});x(t=>({...t,[Ie.EXISTS]:e}))},[S,E]);const O=c(async()=>{try{D(!0);const[e,t]=await Promise.all([r(),d()]);e&&$(e.destinationCategories.categories),x(a=>({...a,...Mo(e,t)}))}catch(e){}finally{D(!1)}},[]);n(()=>{O()},[]);const P=c(async()=>{const e=(await Promise.all(N.map(({option:e,formData:t})=>{const a=K(t);if(e.id){const t=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),n=Object.fromEntries(a.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(t).some(e=>t[e]!==n[e]))return h(e.id,a,l)}return m(a,l)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,l,m,h]);return t(Bn,{isOpen:!0,withOverlay:g,disableAnimation:b,onClose:e,onBack:a?()=>a(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!N.length,onSave:P,disableSave:!w&&!N.length,isFetching:I,errorMessage:T,isFormDirty:k?.isFormDirty,hideDirtyNote:!0,progress:{title:Te.CREATING_DESTINATION,subTitle:Te.CREATING_DESTINATION_SUBTITLE},header:{icon:tn,title:Te.ADD_DESTINATIONS,subTitle:Te.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:l&&s?{value:l,setValue:s}:void 0,search:{value:f,onChange:y},filters:t(Fo,{destinationsByCategory:R,filters:v,setFilters:C}),leftColumn:Po({isFetching:I,destinationsByCategory:R,searchText:f,filters:v}),rightColumn:Io({testConnection:p})})},Bo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:l})=>{const[s,c]=i(""),u=d(null),{selectedOption:p,onSelectOption:m,genericForm:h,validateFormData:g,errorMessage:b}=ne(),f=r(()=>s?Le.filter(e=>e.label.toLowerCase().includes(s.toLowerCase())):Le,[s]),y=r(()=>f.map(e=>{const a=p?.type===e.type;return t(To,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{u.current?.clearErrors(),m(e)}},e.type)}),[p,f.length,m]),v=r(()=>p?[t(bo,{},p.type)]:[t(ke,{$height:"100%",children:t(F,{icon:sn,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[p]);return t(Bn,{ref:u,isOpen:!0,withOverlay:l,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=g();return e?Promise.resolve({error:e}):await o(t)},disableSave:!p||!h?.isFormDirty,isFormDirty:h?.isFormDirty,hideDirtyNote:!0,errorMessage:b,progress:{title:Te.CREATING_INSTRUMENTATION_RULE,subTitle:Te.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:sn,title:Te.ADD_INSTRUMENTATION_RULE,subTitle:Te.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&n?{value:a,setValue:n}:void 0,search:{value:s,onChange:c},leftColumn:{width:"40%",list:y},rightColumn:{width:"60%",list:v}})},zo=p.div``,_o=p.div`
|
|
51
51
|
visibility: hidden;
|
|
52
52
|
|
|
53
53
|
transition: visibility 0s;
|
|
@@ -55,10 +55,10 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
55
55
|
transition-duration: 0s;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
${
|
|
58
|
+
${zo}:hover & {
|
|
59
59
|
visibility: visible;
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
61
|
+
`,Uo=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:l,disabledReason:i})=>{const s=m(),r=()=>{};return t(zo,{children:t(To,{dataId:`source-${e}`,title:e,disabled:l,onClick:l?r:o,isChecked:n,onCheckboxChange:l?r:o,children:l&&i?t(oe,{label:i,status:X.Default,textSize:M.XXXS}):t(_o,{children:t(oe,{label:a,status:X.Info,textSize:M.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},jo=({formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:l,searchText:i,searchBy:s,filters:c})=>{const{tier:d}=Me(),u=d===_e.Onprem,p=r(()=>l.value.namespaceName?a.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[a,l.value.clusterId,l.value.namespaceName]),m=r(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ve(e,i,c)):[],[p,i,c]),h=r(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=r(()=>{if(!p)return[];const{clusterId:e}=l.value,{name:a}=p;return m.map(({name:o,selected:l,kind:i})=>{const s=!u&&Be.has(i);return t(Uo,{workloadName:o,workloadKind:i,isChecked:!s&&(l||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:o,kind:i}}),disabled:s,disabledReason:"Enterprise only"},`${e}#${a}#${o}#${i}`)})},[m,p,l.value.clusterId]),{withFilterCount:b,filteredCount:f,totalCount:y}=r(()=>{const e=p?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,p]);return{width:"40%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > Workloads`:"Workloads"}),t(q,{text:b?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${b?`${f} / ${y}`:y}`,status:ze.Unknown})})]}),t(L,{"data-id":"workloads-select-all",onClick:()=>o({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!h,searchText:i,searchBy:s,filters:c}),disabled:!g.length,size:M.XS,children:(h?"Unselect":"Select")+" all"})]}),list:g.length?g:[t(ke,{$height:"100%",children:t(F,p?i?{icon:rn,title:"No matches",subTitle:`No sources matched the filter '${i}'`}:{icon:rn,title:"No sources",subTitle:"No sources found in this namespace"}:{icon:rn,title:Te.SELECT_NAMESPACE,subTitle:Te.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},Xo=p.div``,Ho=p.div`
|
|
62
62
|
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
63
63
|
|
|
64
64
|
transition: visibility 0s;
|
|
@@ -67,7 +67,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
67
67
|
${Xo}:hover & {
|
|
68
68
|
visibility: visible;
|
|
69
69
|
}
|
|
70
|
-
`,Ho=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const d=m(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Xo,{children:t(ko,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:o.partial,isChecked:o.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(D,{$gap:12,children:[t(jo,{$visible:s||i,children:t(q,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(T,{label:"Auto",size:Ue.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(D,{$gap:8,children:[t(L,{variant:Xe.Span,size:M.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(oe,{label:`${l.sourced}/${l.total}`,status:s?j.Default:ze.Unknown,minWidth:"42px"})]})]})})})},Wo=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:i,setSelectedArea:l,handleSourceChange:s})=>{const c=r(()=>o.map(({name:e,totalWorkloads:o,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Ho,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:o},isActive:i.clusterId===a&&i.namespaceName===e,onActive:()=>l({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,o,i]);return e?t(Eo,{title:n,list:c,noBgColor:!0}):c},Go=({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:i,selectedArea:l,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const p=r(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>je(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...He(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=r(()=>{let e=!1;for(const{visibleNamespaces:t}of p)for(const{totalWorkloads:a,selectedCount:n}of t)if(e=!0,n!==a)return!1;return e},[p]),{list:h,withFilterCount:g,filteredCount:b,totalCount:f}=r(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(Wo,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:l,setSelectedArea:s,handleSourceChange:o},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[p,l]);return{width:"60%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,nowrap:!0,children:"Namespaces"}),t(q,{text:g?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${g?`${b} / ${f}`:f}`,status:ze.Unknown})})]}),t(L,{"data-id":"namespaces-select-all",onClick:()=>i({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!h.length,size:M.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(ke,{$height:"100%",children:t(De,{title:Te.FETCHING_NAMESPACES,subTitle:Te.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t(ke,{$height:"100%",children:t(F,c?{icon:cn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:cn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}},Ko=({onClose:a,onBack:o,onNext:i,selectedConnectionIds:s,setSelectedConnectionIds:r,persistSources:c,getAllClusterSnapshots:d,fetchNamespacesWithWorkloads:u,withOverlay:p,disableAnimation:h})=>{const g=m(),{progress:b,resetProgress:f}=We(),{isFetching:y,setIsFetching:v,setSnapshots:C,formData:S,handleSourceChange:w,handleSelectAll:k,formDiff:N,isFormDirty:A}=Ge();n(()=>{let e=!1;v(!0);return(async()=>{try{if(d){const t=await d();!e&&t&&C(t)}else if(u){const t=await u();if(!e&&t.data?.length){const e={clusters:[{clusterId:Je,clusterName:qe,namespaces:t.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]};C(e)}}}catch(e){}finally{e||v(!1)}})(),()=>{e=!0}},[]);const[I,E]=l(""),[$,R]=l(Ke.Namespace),[x,O]=l({showOnlySelected:!1}),[P,F]=l({clusterId:"",clusterName:"",namespaceName:""});return t(Bn,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:a?()=>{f(Ye.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(N):void 0,onNext:i?()=>i(N):void 0,nextIsSkip:!A,onSave:()=>c(N),header:{icon:rn,title:Te.ADD_SOURCE,subTitle:Te.ADD_SOURCES_DESCRIPTION},connectionIds:s&&r?{value:s,setValue:r}:void 0,search:{value:I,onChange:e=>{E(e),$===Ke.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ke.Namespace},{label:"Source",value:Ke.Source}],selected:$,setSelected:R}},filters:e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:g.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{name:"filter-selected",size:Ue.S,label:"Selected",value:x.showOnlySelected,onChange:e=>O(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,progress:{title:Te.CREATING_SOURCES,subTitle:Te.CREATING_SOURCES_SUBTITLE,percentage:b[Ye.BulkInstrumenting]?.percentage||0},leftColumn:Go({isFetching:y,formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:P,setSelectedArea:F,searchText:$===Ke.Namespace?I:"",searchBy:$,filters:x}),rightColumn:Uo({formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:{value:P},searchText:$===Ke.Source?I:"",searchBy:$,filters:x})})},Yo=({onClose:o,actionId:i,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Fe(),{selectedOption:h,loadAction:b,validateFormData:f}=P(),[y,v]=l(!1),[C,S]=l(!1),w=r(()=>p?.find(e=>Qe(e)===i),[i,p]),T=r(()=>Se.find(({type:e})=>e===w?.type)??we.find(({type:e})=>e===w?.type)??null,[w?.type]);n(()=>{w&&b(w)},[w]);const N=c(()=>{w&&v(!0)},[w]),A=c(()=>{w&&(b(w),v(!1))},[w,b]),I=c(async()=>{if(w){const{errorMessage:e,preparedFormData:t}=f();e||(await s(w.id,t),v(!1))}},[w,f,s]),D=c(()=>{w&&S(!0)},[w]),E=c(async()=>{w&&(await d(w.id,w.type),o())},[w,d,o]);if(!w||!T)return null;const $=(e=>{const t=[],{type:a,fields:n}=e,o=e=>({status:e?j.Success:ze.Unknown,label:e?"True":"False",invertColors:!0});return a===O.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:o(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:o(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:o(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:o(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:o,fromSources:i},l)=>{const s=i?.length?i.join(", "):o||k.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:a,from:o,fromSources:i},l)=>{const s=i?.length?i.join(", "):o||k.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),a===O.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:o(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:a},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:a})})),a===O.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,a)=>{t.push({id:`del-attr-${a}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,a],n)=>{t.push({id:`rename-${n}`,title:e,label:a})}),a===O.PiiMasking&&n.piiCategories?.forEach((e,a)=>{t.push({id:`pii-${a}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.ErrorSampler&&t.push({id:"fallbackSamplingRatio",title:"Sampling Ratio",label:String(n.fallbackSamplingRatio??"-")}),a===O.ProbabilisticSampler&&t.push({id:"samplingPercentage",title:"Sampling Percentage",label:String(n.samplingPercentage??"-")}),a===O.LatencySampler&&n.endpointsFilters?.forEach(({serviceName:e,httpRoute:a,minimumLatencyThreshold:o,fallbackSamplingRatio:i},l)=>{const s=(n.endpointsFilters?.length??0)>1?`Endpoint #${l+1} `:"Endpoint ";t.push({id:`endpoint-${l}-service`,title:`${s}Service Name`,label:e}),t.push({id:`endpoint-${l}-route`,title:`${s}HTTP Route`,label:a}),t.push({id:`endpoint-${l}-latency`,title:`${s}Min. Latency`,label:String(o)}),t.push({id:`endpoint-${l}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(i)})}),a===O.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:o},i)=>{const l=(n.servicesNameFilters?.length??0)>1?`Filter #${i+1} `:"Filter ";t.push({id:`service-${i}-name`,title:`${l}Service Name`,label:e}),t.push({id:`service-${i}-ratio`,title:`${l}Sampling Ratio`,label:String(a)}),t.push({id:`service-${i}-fallback`,title:`${l}Fallback Sampling Ratio`,label:String(o)})}),a===O.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:o,condition:i},l)=>{const s=Object.keys(i)[0],r=i[s],c=(n.attributeFilters?.length??0)>1?`Filter #${l+1} `:"Filter ";t.push({id:`attr-${l}-service`,title:`${c}Service Name`,label:e}),t.push({id:`attr-${l}-key`,title:`${c}Attribute Key`,label:a}),t.push({id:`attr-${l}-fallback`,title:`${c}Fallback Sampling Ratio`,label:String(o)}),t.push({id:`attr-${l}-condition`,title:`${c}Condition`,label:s}),t.push({id:`attr-${l}-operation`,title:`${c}Operation`,label:r?.operation??"-"}),t.push({id:`attr-${l}-expected`,title:`${c}Expected Value`,label:String(r?.expectedValue??"-")}),"jsonCondition"===s&&t.push({id:`attr-${l}-jsonpath`,title:`${c}JSON Path`,label:r?.jsonPath??"-"})}),a===O.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,a)=>{const o=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${o}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,i)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${a}-wf-${i}`,title:`${o}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${a}-templates`,title:`${o}Templates`,label:i}),e.notes&&t.push({id:`group-${a}-notes`,title:`${o}Notes`,label:e.notes})}),t})(w);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ot(w.type),title:T.label,onClose:o,actions:[{id:"edit-action-btn-edit",label:et.EDIT,icon:qa,active:y,onClick:N},{id:"edit-action-btn-delete",label:et.DELETE,icon:ja,color:u.v2.colors.red[500],active:C,onClick:D}]},footer:{actions:y?[{"data-id":"edit-action-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:A},{"data-id":"edit-action-btn-save",label:et.SAVE,variant:R.Primary,onClick:I}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:y&&h?t(no,{}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:w.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(x=w,F=T,[{id:"type",title:Te.TYPE,label:F.label},{id:"status",title:Te.STATUS,badge:{status:x.disabled?ze.Unknown:j.Success,label:x.disabled?Te.DISABLED:Te.ENABLED}},{id:"signals",title:Te.SIGNALS_FOR_PROCESSING,label:x.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:x.name||"-"},{id:"notes",title:Te.NOTES,label:x.notes||"-"}])})]}),!!$?.length&&t(at,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",cellsPerRow:2,items:$})})]})})})}),t(zn,{target:"action",isOpen:C,onClose:()=>S(!1),onApprove:E})]});var x,F},qo=({onClose:a,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=m(),[p,h]=l(""),[g,b]=l({showOnlySelected:!1}),f=r(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&i.includes(e.id);return t&&a}),[o.length,i.length,p,g]),y=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,C]=l(!1),[S,w]=l(void 0),{formData:k,handleFormChange:N,areFormValuesEqual:A,resetFormData:I}=it(S||{rollout:{automaticRolloutDisabled:!1}}),E=r(()=>i.length>1||void 0!==S&&!A(S,k),[i.length,S,k]);return n(()=>{1===i.length?(async e=>{if(v)return;C(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),I(e)}C(!1)})(i[0]):w(void 0)},[i.length]),t(Bn,{isOpen:!0,onClose:a,onSave:()=>d(k,i),header:{icon:dn,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{size:Ue.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:v,leftColumn:{width:"35%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,children:"Clusters"}),t(oe,{label:f.length,status:ze.Unknown})]}),e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(oe,{label:`${i.length}/${f.length}`,status:ze.Unknown})]})]}),list:f.map(e=>t(ko,{title:e.name,isChecked:i.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(L,{size:M.XS,children:"Configurations"}),list:[t(T,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:k.rollout?.automaticRolloutDisabled||!1,onChange:e=>N("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Jo=({onClose:o,destinationId:i,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const b=m(),{destinations:f}=Fe(),{selectedStreamName:y}=st(),{activeForm:v,loadDestination:C,validateFormData:S}=U(),w=d(null),[k,T]=l(!1),[N,A]=l(!1),[I,D]=l(null),[E,$]=l(!0),x=r(()=>rt(f,y),[f,y]),O=r(()=>x?.find(e=>Qe(e)===i),[i,x]);n(()=>{let e=!1;return $(!0),s().then(t=>{e||D(t?.destinationCategories.categories??[])}).catch(t=>{e||D([])}).finally(()=>{e||$(!1)}),()=>{e=!0}},[]),n(()=>{O&&I&&C(O,I)},[O,I]);const P=r(()=>O&&I?ct(I,O):[],[O,I]),F=c(()=>{O&&T(!0)},[O]),L=c(()=>{O&&I&&(C(O,I),T(!1))},[O,I,C]),M=c(async()=>{if(O){const{errorMessage:e,preparedFormData:t}=S();e||(await p(O.id,K(t)),T(!1))}},[O,S,p]),V=c(()=>{O&&A(!0)},[O]),B=c(async()=>{O&&(await h(O.id),o())},[O,h,o]);if(!O)return null;const{icon:z,iconSrc:X}=$e(O.destinationType.type),H=((e,t)=>{const a=[],n=lt(e,t),o=n.map(e=>({name:e.key,value:e.value})),i=W(e.exportedSignals);return n.forEach(({key:e,name:n,value:l})=>{const s=t.find(t=>t.name===e),{secret:r,componentProperties:c,hideFromReadData:d,customReadDataLabels:u}=s||{};if(d?.length&&_(d,i,o))return;const{type:p}=Pe(c,{type:""}),m=(r||"password"===p)&&l?.length?new Array(10).fill("•").join(""):"";u?.length?u.forEach(({condition:t,...n},o)=>{t==l&&a.push({id:`${e}-custom-${o}`,title:n.title,label:n.value})}):a.push({id:e,title:n,label:m||l||"-"})}),a})(O,P);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:z,iconSrc:X,title:O.name||O.destinationType.displayName,onClose:o,actions:[{id:"edit-destination-btn-edit",label:et.EDIT,icon:qa,active:k,onClick:F},{id:"edit-destination-btn-delete",label:et.DELETE,icon:ja,color:b.v2.colors.red[500],active:N,onClick:V}]},footer:{actions:k?[{"data-id":"edit-destination-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:L},...v?.option.testConnectionSupported?[{"data-id":"edit-destination-btn-test-connection",label:et.TEST_CONNECTION,variant:R.Secondary,onClick:()=>w.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:et.SAVE,variant:R.Primary,onClick:M}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:E?t(ke,{$height:"50vh",children:t(De,{withSpinner:!0})}):k&&v?t(lo,{ref:w,isEdit:!0,testConnection:u}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:O.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(G=O,[{id:"type",title:Te.TYPE,label:G.destinationType.displayName},{id:"status",title:Te.STATUS,badge:{status:G.disabled?ze.Unknown:j.Success,label:G.disabled?Te.DISABLED:Te.ENABLED}},{id:"monitors",title:Te.MONITORS,label:W(G.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:G.name||"-"}])})]}),!!H?.length&&t(at,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",cellsPerRow:2,items:H})})]})})})}),t(zn,{target:"destination",isOpen:N,onClose:()=>A(!1),onApprove:B})]});var G},Qo=({onClose:o,ruleId:i,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Fe(),{addNotification:h}=ut(),{selectedOption:b,loadRule:f,validateFormData:y}=ne(),[v,C]=l(!1),[S,w]=l(!1),k=r(()=>p?.find(e=>Qe(e)===i),[i,p]),T=r(()=>Le.find(({type:e})=>e===k?.type)??null,[k?.type]);n(()=>{k&&f(k)},[k]);const N=c(()=>{if(k){if(!k.mutable)return void h({type:j.Warning,title:pt.FORBIDDEN,message:pt.CANNOT_EDIT_RULE,crdType:Ke.InstrumentationRule,target:k.ruleId,hideFromHistory:!0});C(!0)}},[k,h]),A=c(()=>{k&&(f(k),C(!1))},[k,f]),I=c(async()=>{if(k){const{errorMessage:e,preparedFormData:t}=y();e||(await s(k.ruleId,t),C(!1))}},[k,y,s]),E=c(()=>{if(k){if(!k.mutable)return void h({type:j.Warning,title:pt.FORBIDDEN,message:pt.CANNOT_DELETE_RULE,crdType:Ke.InstrumentationRule,target:k.ruleId,hideFromHistory:!0});w(!0)}},[k,h]),$=c(async()=>{k&&(await d(k.ruleId),o())},[k,d,o]);if(!k||!T)return null;const x=((e,a)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,a])=>{a&&n.push(t(L,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(L,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.headersCollection?.[J.HeaderKeys]?.length&&e.headersCollection[J.HeaderKeys].forEach(e=>{e&&n.push(t(L,{size:M.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[te.Java]?.forEach((e,o)=>{const i=new ee(e.className,e.methodName);if(i.Verify()){0===o&&n.push(t(L,{size:M.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();n.push(t(L,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[te.Golang]?.forEach((e,o)=>{const i=new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===o&&n.push(t(L,{size:M.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();n.push(t(L,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}})),n})(k,u);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ht(k.type),title:T.label,onClose:o,actions:[{id:"edit-rule-btn-edit",label:et.EDIT,icon:qa,active:v,onClick:N},{id:"edit-rule-btn-delete",label:et.DELETE,icon:ja,color:u.v2.colors.red[500],active:S,onClick:E}]},footer:{actions:v?[{"data-id":"edit-rule-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:A},{"data-id":"edit-rule-btn-save",label:et.SAVE,variant:R.Primary,onClick:I}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:v&&b?t(go,{}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:k.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(O=k,P=T,[{id:"type",title:Te.TYPE,label:P.label},{id:"status",title:Te.STATUS,badge:{status:O.disabled?ze.Unknown:j.Success,label:O.disabled?Te.DISABLED:Te.ENABLED}},{id:"name",title:Te.NAME,label:O.ruleName||"-"},{id:"profile",title:Te.MANAGED_BY_PROFILE,label:O.profileName||"-"},{id:"notes",title:Te.NOTES,label:O.notes||"-"}])})]}),!!x.length&&t(at,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",children:x})}),!!T.supportedLanguages.length&&t(at,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",children:t(D,{$gap:12,$wrap:"wrap",children:T.supportedLanguages.map(e=>t(mt,{label:ie[e],leftIcon:le(e),flex:"0.5"},e))})})})]})})})}),t(zn,{target:"instrumentation rule",isOpen:S,onClose:()=>w(!1),onApprove:$})]});var O,P},Zo=p.div`
|
|
70
|
+
`,Wo=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:l,selectedCounts:i,isActive:s,onActive:r,handleSourceChange:c})=>{const d=m(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Xo,{children:t(To,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:o.partial,isChecked:o.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(D,{$gap:12,children:[t(Ho,{$visible:s||l,children:t(q,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(T,{label:"Auto",size:Ue.S,value:l,onChange:e=>u({auto:e,all:e||void 0})})})}),e(D,{$gap:8,children:[t(L,{variant:je.Span,size:M.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(oe,{label:`${i.sourced}/${i.total}`,status:s?X.Default:ze.Unknown,minWidth:"42px"})]})]})})})},Go=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:l,setSelectedArea:i,handleSourceChange:s})=>{const c=r(()=>o.map(({name:e,totalWorkloads:o,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Wo,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:o},isActive:l.clusterId===a&&l.namespaceName===e,onActive:()=>i({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,o,l]);return e?t($o,{title:n,list:c,noBgColor:!0}):c},Ko=({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:l,selectedArea:i,setSelectedArea:s,searchText:c,searchBy:d,filters:u})=>{const p=r(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Xe(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...He(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=r(()=>{let e=!1;for(const{visibleNamespaces:t}of p)for(const{totalWorkloads:a,selectedCount:n}of t)if(e=!0,n!==a)return!1;return e},[p]),{list:h,withFilterCount:g,filteredCount:b,totalCount:f}=r(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(Go,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:i,setSelectedArea:s,handleSourceChange:o},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[p,i]);return{width:"60%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,nowrap:!0,children:"Namespaces"}),t(q,{text:g?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(oe,{label:`${g?`${b} / ${f}`:f}`,status:ze.Unknown})})]}),t(L,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!h.length,size:M.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(ke,{$height:"100%",children:t(De,{title:Te.FETCHING_NAMESPACES,subTitle:Te.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t(ke,{$height:"100%",children:t(F,c?{icon:cn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:cn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}},Yo=({onClose:a,onBack:o,onNext:l,selectedConnectionIds:s,setSelectedConnectionIds:r,persistSources:c,getAllClusterSnapshots:d,fetchNamespacesWithWorkloads:u,withOverlay:p,disableAnimation:h})=>{const g=m(),{progress:b,resetProgress:f}=We(),{isFetching:y,setIsFetching:v,setSnapshots:C,formData:S,handleSourceChange:w,handleSelectAll:k,formDiff:N,isFormDirty:A}=Ge();n(()=>{let e=!1;v(!0);return(async()=>{try{if(d){const t=await d();!e&&t&&C(t)}else if(u){const t=await u();if(!e&&t.data?.length){const e={clusters:[{clusterId:Je,clusterName:qe,namespaces:t.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]};C(e)}}}catch(e){}finally{e||v(!1)}})(),()=>{e=!0}},[]);const[I,E]=i(""),[$,R]=i(Ke.Namespace),[x,O]=i({showOnlySelected:!1}),[P,F]=i({clusterId:"",clusterName:"",namespaceName:""});return t(Bn,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:a?()=>{f(Ye.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(N):void 0,onNext:l?()=>l(N):void 0,nextIsSkip:!A,onSave:()=>c(N),header:{icon:rn,title:Te.ADD_SOURCE,subTitle:Te.ADD_SOURCES_DESCRIPTION},connectionIds:s&&r?{value:s,setValue:r}:void 0,search:{value:I,onChange:e=>{E(e),$===Ke.Namespace&&F({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:Ke.Namespace},{label:"Source",value:Ke.Source}],selected:$,setSelected:R}},filters:e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:g.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{name:"filter-selected",size:Ue.S,label:"Selected",value:x.showOnlySelected,onChange:e=>O(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:A,isFetching:y,progress:{title:Te.CREATING_SOURCES,subTitle:Te.CREATING_SOURCES_SUBTITLE,percentage:b[Ye.BulkInstrumenting]?.percentage||0},leftColumn:Ko({isFetching:y,formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:P,setSelectedArea:F,searchText:$===Ke.Namespace?I:"",searchBy:$,filters:x}),rightColumn:jo({formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:{value:P},searchText:$===Ke.Source?I:"",searchBy:$,filters:x})})},qo=({onClose:o,actionId:l,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Fe(),{selectedOption:h,loadAction:b,validateFormData:f,errorMessage:y,genericForm:v}=P(),[C,S]=i(!1),[w,T]=i(!1),[N,A]=i(null),I=C&&!!v?.isFormDirty,D=r(()=>p?.find(e=>Qe(e)===l),[l,p]),E=r(()=>Se.find(({type:e})=>e===D?.type)??we.find(({type:e})=>e===D?.type)??null,[D?.type]);n(()=>{D&&b(D)},[D]);const $=c(()=>{D&&S(!0)},[D]),x=c(()=>{D&&(b(D),S(!1))},[D,b]),F=c(()=>{I?A("close"):o()},[I,o]),L=c(()=>{I?A("cancel"):x()},[I,x]),M=c(()=>{const e=N;A(null),"close"===e?(x(),o()):x()},[N,x,o]),V=c(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=f();e||(await s(D.id,t),S(!1))}},[D,f,s]),B=c(()=>{D&&T(!0)},[D]),z=c(async()=>{D&&(await d(D.id,D.type),o())},[D,d,o]);if(!D||!E)return null;const _=(e=>{const t=[],{type:a,fields:n}=e,o=e=>({status:e?X.Success:ze.Unknown,label:e?"True":"False",invertColors:!0});return a===O.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:o(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:o(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:o(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:o(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:o,fromSources:l},i)=>{const s=l?.length?l.join(", "):o||k.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${i+1} `:"Label ";t.push({id:`label-${i}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${i}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`label-${i}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:a,from:o,fromSources:l},i)=>{const s=l?.length?l.join(", "):o||k.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${i+1} `:"Annotation ";t.push({id:`annotation-${i}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${i}-attr`,title:`${r}Attribute Key`,label:a}),t.push({id:`annotation-${i}-from`,title:`${r}From`,label:s})})),a===O.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:o(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:a},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:a})})),a===O.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,a)=>{t.push({id:`del-attr-${a}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,a],n)=>{t.push({id:`rename-${n}`,title:e,label:a})}),a===O.PiiMasking&&n.piiCategories?.forEach((e,a)=>{t.push({id:`pii-${a}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${a+1}`:""),label:e})}),a===O.ErrorSampler&&t.push({id:"fallbackSamplingRatio",title:"Sampling Ratio",label:String(n.fallbackSamplingRatio??"-")}),a===O.ProbabilisticSampler&&t.push({id:"samplingPercentage",title:"Sampling Percentage",label:String(n.samplingPercentage??"-")}),a===O.LatencySampler&&n.endpointsFilters?.forEach(({serviceName:e,httpRoute:a,minimumLatencyThreshold:o,fallbackSamplingRatio:l},i)=>{const s=(n.endpointsFilters?.length??0)>1?`Endpoint #${i+1} `:"Endpoint ";t.push({id:`endpoint-${i}-service`,title:`${s}Service Name`,label:e}),t.push({id:`endpoint-${i}-route`,title:`${s}HTTP Route`,label:a}),t.push({id:`endpoint-${i}-latency`,title:`${s}Min. Latency`,label:String(o)}),t.push({id:`endpoint-${i}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(l)})}),a===O.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:o},l)=>{const i=(n.servicesNameFilters?.length??0)>1?`Filter #${l+1} `:"Filter ";t.push({id:`service-${l}-name`,title:`${i}Service Name`,label:e}),t.push({id:`service-${l}-ratio`,title:`${i}Sampling Ratio`,label:String(a)}),t.push({id:`service-${l}-fallback`,title:`${i}Fallback Sampling Ratio`,label:String(o)})}),a===O.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:o,condition:l},i)=>{const s=Object.keys(l)[0],r=l[s],c=(n.attributeFilters?.length??0)>1?`Filter #${i+1} `:"Filter ";t.push({id:`attr-${i}-service`,title:`${c}Service Name`,label:e}),t.push({id:`attr-${i}-key`,title:`${c}Attribute Key`,label:a}),t.push({id:`attr-${i}-fallback`,title:`${c}Fallback Sampling Ratio`,label:String(o)}),t.push({id:`attr-${i}-condition`,title:`${c}Condition`,label:s}),t.push({id:`attr-${i}-operation`,title:`${c}Operation`,label:r?.operation??"-"}),t.push({id:`attr-${i}-expected`,title:`${c}Expected Value`,label:String(r?.expectedValue??"-")}),"jsonCondition"===s&&t.push({id:`attr-${i}-jsonpath`,title:`${c}JSON Path`,label:r?.jsonPath??"-"})}),a===O.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,a)=>{const o=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${o}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,l)=>{const i=[n.kind,n.name].filter(Boolean).join("/");i&&t.push({id:`group-${a}-wf-${l}`,title:`${o}Workload${(e.workloadFilters?.length??0)>1?` #${l+1}`:""}`,label:i})});const l=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");l&&t.push({id:`group-${a}-templates`,title:`${o}Templates`,label:l}),e.notes&&t.push({id:`group-${a}-notes`,title:`${o}Notes`,label:e.notes})}),t})(D);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ot(D.type),title:E.label,onClose:F,actions:[{id:"edit-action-btn-edit",label:et.EDIT,icon:qa,active:C,onClick:$},{id:"edit-action-btn-delete",label:et.DELETE,icon:Xa,color:u.v2.colors.red[500],active:w,onClick:B}]},footer:{note:C&&y?{status:X.Error,message:y}:void 0,actions:C?[{"data-id":"edit-action-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:L},{"data-id":"edit-action-btn-save",label:et.SAVE,variant:R.Primary,onClick:V}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:C&&h?t(oo,{}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:D.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(U=D,j=E,[{id:"type",title:Te.TYPE,label:j.label},{id:"status",title:Te.STATUS,badge:{status:U.disabled?ze.Unknown:X.Success,label:U.disabled?Te.DISABLED:Te.ENABLED}},{id:"signals",title:Te.SIGNALS_FOR_PROCESSING,label:U.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:U.name||"-"},{id:"notes",title:Te.NOTES,label:U.notes||"-"}])})]}),!!_?.length&&t(at,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",cellsPerRow:2,items:_})})]})})})}),t(zn,{target:"action",isOpen:w,onClose:()=>T(!1),onApprove:z}),t(_n,{isOpen:null!==N,onClose:()=>A(null),onApprove:M})]});var U,j},Jo=({onClose:a,connections:o,selectedConnectionIds:l,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=m(),[p,h]=i(""),[g,b]=i({showOnlySelected:!1}),f=r(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&l.includes(e.id);return t&&a}),[o.length,l.length,p,g]),y=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[v,C]=i(!1),[S,w]=i(void 0),{formData:k,handleFormChange:N,areFormValuesEqual:A,resetFormData:I}=lt(S||{rollout:{automaticRolloutDisabled:!1}}),E=r(()=>l.length>1||void 0!==S&&!A(S,k),[l.length,S,k]);return n(()=>{1===l.length?(async e=>{if(v)return;C(!0);const t=await c(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),I(e)}C(!1)})(l[0]):w(void 0)},[l.length]),t(Bn,{isOpen:!0,onClose:a,onSave:()=>d(k,l),header:{icon:dn,title:"Cluster Configuration"},connectionIds:{value:l,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(T,{size:Ue.S,label:"Selected",value:g.showOnlySelected,onChange:e=>b(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:E,isFetching:v,leftColumn:{width:"35%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(L,{size:M.XS,children:"Clusters"}),t(oe,{label:f.length,status:ze.Unknown})]}),e(D,{$gap:8,children:[t(L,{size:M.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(oe,{label:`${l.length}/${f.length}`,status:ze.Unknown})]})]}),list:f.map(e=>t(To,{title:e.name,isChecked:l.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(L,{size:M.XS,children:"Configurations"}),list:[t(T,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:k.rollout?.automaticRolloutDisabled||!1,onChange:e=>N("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Qo=({onClose:o,destinationId:l,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const b=m(),{destinations:f}=Fe(),{selectedStreamName:y}=st(),{activeForm:v,loadDestination:C,validateFormData:S,formErrorMessage:w,genericForm:k}=U(),T=d(null),[N,A]=i(!1),[I,D]=i(!1),[E,$]=i(null),[O,P]=i(!0),[F,L]=i(null),M=N&&!!k?.isFormDirty,V=r(()=>rt(f,y),[f,y]),B=r(()=>V?.find(e=>Qe(e)===l),[l,V]);n(()=>{let e=!1;return P(!0),s().then(t=>{e||$(t?.destinationCategories.categories??[])}).catch(t=>{e||$([])}).finally(()=>{e||P(!1)}),()=>{e=!0}},[]),n(()=>{B&&E&&C(B,E)},[B,E]);const z=r(()=>B&&E?ct(E,B):[],[B,E]),j=c(()=>{B&&A(!0)},[B]),H=c(()=>{B&&E&&(C(B,E),A(!1))},[B,E,C]),G=c(()=>{M?L("close"):o()},[M,o]),Y=c(()=>{M?L("cancel"):H()},[M,H]),q=c(()=>{const e=F;L(null),"close"===e?(H(),o()):H()},[F,H,o]),J=c(async()=>{if(B){const{errorMessage:e,preparedFormData:t}=S();e||(await p(B.id,K(t)),A(!1))}},[B,S,p]),Q=c(()=>{B&&D(!0)},[B]),Z=c(async()=>{B&&(await h(B.id),o())},[B,h,o]);if(!B)return null;const{icon:ee,iconSrc:te}=$e(B.destinationType.type),ae=((e,t)=>{const a=[],n=it(e,t),o=n.map(e=>({name:e.key,value:e.value})),l=W(e.exportedSignals);let i=[];const s=()=>{i.length&&(a.push({kind:"cells",id:`cells-${a.length}`,items:i}),i=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:m,customReadDataLabels:h}=c||{};if(m?.length&&_(m,l,o))return;const{type:g}=Pe(p,{type:""}),b=d||"password"===g;if(h?.length)h.forEach(({condition:t,...a},n)=>{t==r&&i.push({id:`${e}-custom-${n}`,title:a.title,label:a.value})});else if(r)if(b)i.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===x.MultiInput){const t=Pe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"list",id:e,title:n,items:t.map((t,a)=>({id:`${e}-${a}`,label:String(t)}))})}if(u===x.KeyValuePair){const t=Pe(r,null);if(Array.isArray(t)&&t.length)return s(),void a.push({kind:"pairs",id:e,title:n,items:t.map((t,a)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${a}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}i.push({id:e,title:n,label:r})}else i.push({id:e,title:n,label:"-"})}),s(),a})(B,z);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ee,iconSrc:te,title:B.name||B.destinationType.displayName,onClose:G,actions:[{id:"edit-destination-btn-edit",label:et.EDIT,icon:qa,active:N,onClick:j},{id:"edit-destination-btn-delete",label:et.DELETE,icon:Xa,color:b.v2.colors.red[500],active:I,onClick:Q}]},footer:{note:N&&w?{status:X.Error,message:w}:void 0,actions:N?[{"data-id":"edit-destination-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:Y},...v?.option.testConnectionSupported?[{"data-id":"edit-destination-btn-test-connection",label:et.TEST_CONNECTION,variant:R.Secondary,onClick:()=>T.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:et.SAVE,variant:R.Primary,onClick:J}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:O?t(ke,{$height:"50vh",children:t(De,{withSpinner:!0})}):N&&v?t(so,{ref:T,isEdit:!0,testConnection:u}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:B.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(ne=B,[{id:"type",title:Te.TYPE,label:ne.destinationType.displayName},{id:"status",title:Te.STATUS,badge:{status:ne.disabled?ze.Unknown:X.Success,label:ne.disabled?Te.DISABLED:Te.ENABLED}},{id:"monitors",title:Te.MONITORS,label:W(ne.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ")||"-"},{id:"name",title:Te.NAME,label:ne.name||"-"}])})]}),!!ae.length&&t(at,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:ae.map(e=>"cells"===e.kind?t(at,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(at,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(zn,{target:"destination",isOpen:I,onClose:()=>D(!1),onApprove:Z}),t(_n,{isOpen:null!==F,onClose:()=>L(null),onApprove:q})]});var ne},Zo=({onClose:o,ruleId:l,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Fe(),{addNotification:h}=ut(),{selectedOption:b,loadRule:f,validateFormData:y,errorMessage:v,genericForm:C}=ne(),[S,w]=i(!1),[k,T]=i(!1),[N,A]=i(null),I=S&&!!C?.isFormDirty,E=r(()=>p?.find(e=>Qe(e)===l),[l,p]),$=r(()=>Le.find(({type:e})=>e===E?.type)??null,[E?.type]);n(()=>{E&&f(E)},[E]);const x=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:pt.FORBIDDEN,message:pt.CANNOT_EDIT_RULE,crdType:Ke.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});w(!0)}},[E,h]),O=c(()=>{E&&(f(E),w(!1))},[E,f]),P=c(()=>{I?A("close"):o()},[I,o]),F=c(()=>{I?A("cancel"):O()},[I,O]),V=c(()=>{const e=N;A(null),"close"===e?(O(),o()):O()},[N,O,o]),B=c(async()=>{if(E){const{errorMessage:e,preparedFormData:t}=y();e||(await s(E.ruleId,t),w(!1))}},[E,y,s]),z=c(()=>{if(E){if(!E.mutable)return void h({type:X.Warning,title:pt.FORBIDDEN,message:pt.CANNOT_DELETE_RULE,crdType:Ke.InstrumentationRule,target:E.ruleId,hideFromHistory:!0});T(!0)}},[E,h]),_=c(async()=>{E&&(await d(E.ruleId),o())},[E,d,o]);if(!E||!$)return null;const U=((e,a)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,a])=>{a&&n.push(t(L,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(L,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.headersCollection?.[J.HeaderKeys]?.length&&e.headersCollection[J.HeaderKeys].forEach(e=>{e&&n.push(t(L,{size:M.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[te.Java]?.forEach((e,o)=>{const l=new ee(e.className,e.methodName);if(l.Verify()){0===o&&n.push(t(L,{size:M.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=l.toString();n.push(t(L,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[te.Golang]?.forEach((e,o)=>{const l=new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(l.Verify()){0===o&&n.push(t(L,{size:M.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=l.toString();n.push(t(L,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}})),n})(E,u);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:ht(E.type),title:$.label,onClose:P,actions:[{id:"edit-rule-btn-edit",label:et.EDIT,icon:qa,active:S,onClick:x},{id:"edit-rule-btn-delete",label:et.DELETE,icon:Xa,color:u.v2.colors.red[500],active:k,onClick:z}]},footer:{note:S&&v?{status:X.Error,message:v}:void 0,actions:S?[{"data-id":"edit-rule-btn-cancel",label:et.CANCEL,variant:R.Secondary,onClick:F},{"data-id":"edit-rule-btn-save",label:et.SAVE,variant:R.Primary,onClick:B}]:[]},children:t(tt,{$padding:"4px 12px 12px",children:S&&b?t(bo,{}):t(g,{$gap:16,children:e(at,{bgTint:"1000",children:[e(at,{bgTint:"900",children:[t(nt,{conditions:E.conditions||[]}),t(at,{bgTint:"800",cellsPerRow:2,items:(j=E,H=$,[{id:"type",title:Te.TYPE,label:H.label},{id:"status",title:Te.STATUS,badge:{status:j.disabled?ze.Unknown:X.Success,label:j.disabled?Te.DISABLED:Te.ENABLED}},{id:"name",title:Te.NAME,label:j.ruleName||"-"},{id:"profile",title:Te.MANAGED_BY_PROFILE,label:j.profileName||"-"},{id:"notes",title:Te.NOTES,label:j.notes||"-"}])})]}),!!U.length&&t(at,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",children:U})}),!!$.supportedLanguages.length&&t(at,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(at,{bgTint:"800",children:t(D,{$gap:12,$wrap:"wrap",children:$.supportedLanguages.map(e=>t(mt,{label:le[e],leftIcon:ie(e),flex:"0.5"},e))})})})]})})})}),t(zn,{target:"instrumentation rule",isOpen:k,onClose:()=>T(!1),onApprove:_}),t(_n,{isOpen:null!==N,onClose:()=>A(null),onApprove:V})]});var j,H},el=p.div`
|
|
71
71
|
display: flex;
|
|
72
72
|
align-items: center;
|
|
73
73
|
gap: 8px;
|
|
@@ -77,9 +77,9 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
77
77
|
&:hover {
|
|
78
78
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
79
79
|
}
|
|
80
|
-
`,
|
|
80
|
+
`,tl=p.div`
|
|
81
81
|
flex: 1;
|
|
82
|
-
`,
|
|
82
|
+
`,al=({onClick:a})=>{const n=m().v2.colors.red[500];return e(el,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(L,{size:M.XS,weight:500,color:n,children:yt}),t(Xa,{size:16,fill:n})]})};function nl(n){if(n.isEditing){const{onCancelEdit:o,onSave:l,onDelete:i,duplicateWarning:s}=n;return{children:e(a,{children:[t(al,{onClick:i}),s&&t(j,{status:X.Warning,message:s.message,action:s.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:s.onViewRule}:void 0}),t(tl,{}),t(E,{"data-id":"sampling-view-edit-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:o}),t(E,{"data-id":"sampling-view-edit-btn-save",label:bt,variant:R.Primary,size:$.S,onClick:l,disabled:!!s})]})}}const{onDelete:o,onCancel:l,onEdit:i}=n;return{children:e(a,{children:[t(al,{onClick:o}),t(tl,{}),t(E,{"data-id":"sampling-view-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:l}),t(E,{"data-id":"sampling-view-btn-edit",label:ft,variant:R.Primary,size:$.S,onClick:i})]})}}const ol={[re.EditAutoNoisy]:{title:$t,subTitle:Et,toggleId:"sampling-toggle-rule-enabled",cancelId:"sampling-edit-auto-rule-btn-cancel",saveId:"sampling-edit-auto-rule-btn-save"},[re.EditAutoCostReduction]:{title:Dt,subTitle:It,toggleId:"sampling-cr-auto-toggle-enabled",cancelId:"sampling-edit-cost-reduction-auto-rule-btn-cancel",saveId:"sampling-edit-cost-reduction-auto-rule-btn-save"},[re.EditAutoHighlyRelevant]:{title:At,subTitle:Nt,toggleId:"sampling-hr-auto-toggle-enabled",cancelId:"sampling-edit-highly-relevant-auto-rule-btn-cancel",saveId:"sampling-edit-highly-relevant-auto-rule-btn-save"}};function ll(e){return{name:e.name,value:e.value,onChange:e.onChange,variant:Ft.SuccessError,size:Ue.S,label:e.value?Ot:Pt,labelAlign:N.Left}}const il=({isOpen:e,title:a,subTitle:n,onClose:o,toggleProps:l,footer:i,renderBody:s})=>t(Ze,{isOpen:e,width:xt,header:{icon:un,title:a,subTitle:n,onClose:o,toggleProps:l},footer:i,children:s?s():t(tt,{$padding:"12px",children:t(yo,{})})}),sl=({isOpen:e,onClose:a,onSubmit:o,validateForm:l,onNavigateToDuplicate:i})=>{const{category:s,formData:r,handleChange:d,resetForm:u,duplicateWarning:p,setDuplicateWarning:m}=se(re.Create);n(()=>{e&&u()},[e]);const h=c(()=>{if(l){const e=l(r);if(e)return void m(e)}o(r)},[r,o,l,m]),g={note:p?{status:X.Warning,message:p.message,action:i?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>i(p.ruleId)}:void 0}:void 0,actions:[{"data-id":"sampling-create-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:a},{"data-id":"sampling-create-btn-submit",label:kt,variant:R.Primary,size:$.S,onClick:h,disabled:!!p}]};return t(il,{isOpen:e,title:Tt[s],subTitle:Ct[s],onClose:a,toggleProps:ll({name:"sampling-toggle-rule-enabled",value:!r.disabled,onChange:e=>d({disabled:!e})}),footer:g})},rl=({onClose:e,onDelete:a,onSaveEdit:n,validateForm:o,onNavigateToDuplicate:l})=>{const{data:i,isEditing:s,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:m,setDuplicateWarning:h}=se(re.View),g=i?.rule.name||wt,b=s&&i?St[i.category]:`${g} preview`,f=c(()=>{if(i&&s){if(o){const e=o(d);if(e)return void h(e)}n(d,i.rule.ruleId,i.samplingId)}},[i,s,d,n,o,h]),y=c(()=>{i&&a(i.rule.ruleId,i.samplingId)},[i,a]),v=r(()=>{if(!i)return;const t=m?{message:m.message,onViewRule:l?()=>l(m.ruleId):void 0}:null;return nl(s?{isEditing:!0,onCancelEdit:p,onSave:f,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[i,s,m,p,f,y,u,e,l]);return t(il,{isOpen:!!i,title:b,subTitle:i?Ct[i.category]:"",onClose:e,footer:v})},cl=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:l,resolvedPercentage:i}=se(re.EditAutoNoisy),s=c(()=>n(o,i),[n,o,i]);return t(pl,{formType:re.EditAutoNoisy,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:l,onSave:s})},dl=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:l,resolvedPercentage:i}=se(re.EditAutoCostReduction),s=c(()=>n(o,i),[n,o,i]);return t(pl,{formType:re.EditAutoCostReduction,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:l,onSave:s})},ul=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:l}=se(re.EditAutoHighlyRelevant),i=c(()=>n(o),[n,o]);return t(pl,{formType:re.EditAutoHighlyRelevant,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:l,onSave:i})},pl=({formType:e,isOpen:a,onClose:n,localEnabled:o,setLocalEnabled:l,onSave:i})=>{const s=ol[e];return t(il,{isOpen:a,title:s.title,subTitle:s.subTitle,onClose:n,toggleProps:ll({name:s.toggleId,value:o,onChange:l}),footer:{actions:[{"data-id":s.cancelId,label:gt,variant:R.Secondary,size:$.S,onClick:n},{"data-id":s.saveId,label:Rt,variant:R.Primary,size:$.S,onClick:i}]}})},ml=e=>{switch(e.formType){case re.Create:return t(vt,{formType:re.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(sl,{...e})});case re.View:return t(vt,{formType:re.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(rl,{...e})});case re.EditAutoNoisy:return t(vt,{formType:re.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(cl,{...e})});case re.EditAutoCostReduction:return t(vt,{formType:re.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(dl,{...e})});case re.EditAutoHighlyRelevant:return t(vt,{formType:re.EditAutoHighlyRelevant,enabled:e.enabled,children:t(ul,{...e})})}},hl=({token:n,isLoading:o,isEditing:l,onEdit:i,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=Lt(),h=!l||o||!c.newToken;return Mt({key:"Enter",active:!h},r),e(D,l?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(v,{type:"password",value:c.newToken,onChange:e=>{d("newToken",e.target.value),u("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:p.newToken}),t(D,{$margin:o?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:o?t(De,{title:"Saving...",withGradient:!0}):e(a,{children:[t(E,{variant:R.Secondary,size:$.S,leftIcon:ln,onClick:s,disabled:o}),t(E,{variant:R.Primary,size:$.S,leftIcon:on,onClick:r,disabled:h})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(L,{size:M.XS,children:new Array(55).fill("•").join("")}),e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(m,{value:n}),t(Ne,{icon:qa,onClick:i})]})]})},gl=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:l}=Vt(),i=r(()=>l(e),[e]),s=r(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=r(()=>Bt(e,0)?X.Error:Bt(e,2592e6)?X.Warning:X.Success,[e]),d=r(()=>c===X.Success?on:c===X.Warning?pn:mn,[c]);return n(()=>{c===X.Success?a():c===X.Error&&o()},[c]),t(q,{text:s,children:t(oe,{leftIcon:d,label:i,status:c,invertColors:!0,useSecondaryTone:!0})})},bl=p.div`
|
|
83
83
|
display: flex;
|
|
84
84
|
flex-direction: column;
|
|
85
85
|
gap: 12px;
|
|
@@ -87,7 +87,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
87
87
|
border-radius: 12px;
|
|
88
88
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
89
89
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
90
|
-
`,
|
|
90
|
+
`,fl=({children:e})=>{const a=m();return t(L,{size:M.XXXS,color:a.v2.colors.grey[150],children:e})},yl=({token:a,updateToken:n})=>{const[o,l]=i(!1),[s,r]=i(!1),[c,d]=i(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:b}=lt({newToken:""});return t(ye,{richTitle:{icon:hn,title:"Odigos Pro Token"},children:e(bl,{$isExpired:c,children:[e(D,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(fl,{children:"Issued for"}),t(L,{size:M.XS,children:a.name||"N/A"})]}),e(g,{$gap:4,children:[t(fl,{children:"Expiration"}),t(gl,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(D,{children:e(g,{children:[t(fl,{children:"Token"}),t(hl,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:o,onEdit:()=>l(!0),onCancel:()=>(l(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await n(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(l(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},vl=p.div`
|
|
91
91
|
display: flex;
|
|
92
92
|
flex-direction: column;
|
|
93
93
|
align-items: center;
|
|
@@ -96,7 +96,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
96
96
|
padding: 12px 24px;
|
|
97
97
|
border-radius: 8px;
|
|
98
98
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
99
|
-
`,vi=({downloadDiagnose:a})=>{const n=m(),{progress:o}=We(),{namespaces:i}=Fe(),[s,r]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=it({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ye,{richTitle:{icon:gn,title:"Diagnose"},children:s?e(yi,{children:[t(De,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[Ye.DownloadingDiagnose]?.percentage,percentage:o[Ye.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[Ye.DownloadingDiagnose]?.percentage,visualIcon:bn,startedAt:s}),o[Ye.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:o[Ye.DownloadingDiagnose].list.map(a=>e(D,{$gap:4,$alignItems:"center",children:[a.status===j.Success?t(on,{size:16}):a.status===j.Error?t(ln,{size:16}):t(De,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(g,{$gap:24,children:[t(L,{size:M.XXS,color:n.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(g,{$gap:16,children:[e(D,{$gap:8,children:[t(f,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(D,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(D,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(zt,{alignX:Ut.Left,alignY:_t.Bottom,items:i.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:R.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(oe,{label:c.sourceWorkloadNamespaces.length,status:j.Default}):void 0}}),t(D,{$justifyContent:"flex-end",children:t(E,{label:"Download Diagnose",rightIcon:bn,variant:R.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},Ci=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:i}=Me(),[s,r]=l(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ye,{richTitle:{icon:fn,title:"General Information"},children:t(at,{cellsPerRow:2,items:[{id:Xt(),title:"Odigos Version",label:o},{id:Xt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:Xt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:Xt(),title:"Tier",label:i}]})})},Si=({isOpen:a,onClose:n,token:o,updateToken:i,fetchDescribeOdigos:l,downloadDiagnose:s})=>e(Ze,{isOpen:a,header:{icon:fn,title:"System Overview",onClose:n},children:[l&&t(Ci,{fetchDescribeOdigos:l}),i&&o&&t(fi,{token:o,updateToken:i}),s&&t(vi,{downloadDiagnose:s})]});var wi,ki;!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"}(wi||(wi={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(ki||(ki={}));const Ti=[{key:ki.Name,label:"Name"},{key:ki.Type,label:"Type",textAlign:"right"},{key:ki.Status,label:"Status"},{key:ki.OdigosVersion,label:"Odigos Version"},{key:ki.ConnectedSince,label:"Connected Since"},{key:ki.LastActivity,label:"Last Activity"}],Ni=(e,t)=>{const a=e.find(e=>e.key===ki.Id)?.rawValue;return t(a?.toString()||"")},Ai=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:i,onAddDestination:l,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===ki.Status)?.rawValue===j.Success)(e))return[{id:Xt(),label:"Delete Connection",rightIcon:Ya,onClick:()=>Ni(e,o)}];const d=Ni(e,e=>{const n=t.find(t=>t.id===e);return!!n&&jt(n.odigosVersion,a)}),u=Ni(e,e=>{const a=t.find(t=>t.id===e);return!!a&&jt(a.odigosVersion,n)}),p=[];return i&&p.push({id:Xt(),tooltip:u?Te.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:rn,disabled:!u,onClick:()=>Ni(e,i)}),l&&p.push({id:Xt(),tooltip:Te.ADD_DESTINATION,rightIcon:tn,onClick:()=>Ni(e,l)}),s&&p.push({id:Xt(),tooltip:Te.ADD_ACTION,rightIcon:en,onClick:()=>Ni(e,s)}),r&&p.push({id:Xt(),tooltip:Te.ADD_INSTRUMENTATION_RULE,rightIcon:sn,onClick:()=>Ni(e,r)}),c&&p.push({id:Xt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:dn,disabled:!d,onClick:()=>Ni(e,c)}),p}},Ii=({tableRowsMaxHeight:a,connections:o,getConnections:i,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:v,testConnection:C,createDestination:S,updateDestination:w,createAction:k,createInstrumentationRule:T})=>{const N=m(),{isVm:A}=Me(),{formatTimeAgo:I}=Vt(),[D,E]=l(!1),[x,O]=l(o||[]),P=c(async()=>{try{E(!0),O(await i()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||P()},[]);const[F,L]=l(""),[M,V]=l(null),[B,z]=l([]),_=r(()=>M===wi.BulkConfig?u:M===wi.BulkSource?g:0,[M,u,g]),{supportedConnections:U,supportedConnectionIds:X}=r(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===j.Success,n=jt(e.odigosVersion,t);return a&&n}))(x,_);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x.length,_]);n(()=>{if(!M||M===wi.Delete)return;const e=B.filter(e=>!X.includes(e));e.length&&z(t=>t.filter(t=>!e.includes(t)))},[M,B.length,X.length]);const H=r(()=>x.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:ki.Id,rawValue:e.id},{key:ki.Name,rawValue:e.name},{key:ki.Type,rawValue:e.type},{key:ki.Status,rawValue:e.status,component:()=>(e=>{const a=e===j.Success?"Connection live":"Connection lost",n=e===j.Success?on:ln;return t(oe,{status:e,label:a,leftIcon:n})})(e.status)},{key:ki.OdigosVersion,rawValue:e.odigosVersion},{key:ki.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:ki.LastActivity,rawValue:e.lastSeenAt?I(e.lastSeenAt):"-"}],onClick:e.status!==j.Success||M?void 0:()=>s(e),isSelected:B.includes(e.id),onSelect:()=>z(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>z(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==j.Success||M===wi.BulkConfig&&!jt(e.odigosVersion,u)||M===wi.BulkSource&&!jt(e.odigosVersion,g)})),[x,B,F,M,u,g]),W=r(()=>{const e=(e,t)=>{z([e]),V(t)};return Ai({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,wi.Delete),onAddSource:!A&&b&&f?t=>e(t,wi.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?t=>e(t,wi.BulkDestination):void 0,onAddAction:!A&&k?t=>e(t,wi.BulkAction):void 0,onAddInstrumentationRule:!A&&T?t=>e(t,wi.BulkInstrumentationRule):void 0,onEditConfiguration:!A&&p&&h?t=>e(t,wi.BulkConfig):void 0})},[A,x,u,p,h,g,b,f,y,v,S,k,T]),G=r(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:i,onManageConfigurations:l}=e,s=[];a&&s.push({id:Xt(),type:Ht.Button,buttonProps:{variant:R.Primary,size:$.S,label:"Add Sources",rightIcon:rn,onClick:a}});const r=[n?{id:wi.BulkDestination,label:Te.ADD_DESTINATION,icon:tn}:null,o?{id:wi.BulkAction,label:Te.ADD_ACTION,icon:en}:null,i?{id:wi.BulkInstrumentationRule,label:Te.ADD_INSTRUMENTATION_RULE,icon:sn}:null,l?{id:wi.BulkConfig,label:"Manage Configurations",icon:dn}:null];return r.some(Boolean)&&s.push({id:Xt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===wi.BulkSource?a?.():e===wi.BulkDestination?n?.():e===wi.BulkAction?o?.():e===wi.BulkInstrumentationRule?i?.():e===wi.BulkConfig&&l?.()}},dropDataProps:{alignX:Ut.Left,items:r}}),s.push({id:Xt(),type:Ht.Button,buttonProps:{variant:R.Text,size:$.S,label:et.CANCEL,onClick:t}}),s})({onCancel:()=>z([]),onAddSource:!A&&b&&f?()=>V(wi.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?()=>V(wi.BulkDestination):void 0,onAddAction:!A&&k?()=>V(wi.BulkAction):void 0,onAddInstrumentationRule:!A&&T?()=>V(wi.BulkInstrumentationRule):void 0,onManageConfigurations:!A&&p&&h?()=>V(wi.BulkConfig):void 0}),[A,p,h,b,f,y,v,S,k,T]);return t(Wt,{children:e(ye,{richTitle:{icon:vn,title:Te.CONNECTIONS,badge:{label:x.length.toString(),status:ze.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>L(e),width:"300px"},actions:[{id:Xt(),type:Ht.Button,buttonProps:{variant:R.Secondary,size:$.S,leftIcon:yn,onClick:P,disabled:D}}],children:[t(Gt,{variant:Kt.Pretty,maxHeight:a,headerBackgroundColor:N.v2.colors.silver[1e3],isLoading:D,withCheckboxes:!0,columns:Ti,rows:H,rowActionsPushRightPosition:M?`calc(${_n} - 24px)`:void 0,getRowActions:W}),M===wi.BulkConfig&&p&&h&&t(qo,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:z,getEffectiveConfig:p,onApply:h}),M===wi.BulkSource&&b&&f&&t(Yt,{selectedConnectionIds:B,children:t(Ko,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),M===wi.BulkDestination&&y&&v&&C&&S&&w&&t(qt,{children:t(Mo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getDestinationCategories:y,getPotentialDestinations:v,testConnection:e=>C(e,B),createDestination:e=>S(e,B),updateDestination:(e,t)=>w(e,t,B)})}),M===wi.BulkAction&&k&&t(Jt,{children:t(No,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createAction:e=>k(e,B)})}),M===wi.BulkInstrumentationRule&&T&&t(Qt,{children:t(Vo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createInstrumentationRule:e=>T(e,B)})}),t(zn,{target:"connection",isOpen:M===wi.Delete,onClose:()=>{z([]),V(null)},onApprove:async()=>{const e=B[0];e&&(await d(e),await P())}}),t(Zt,{isOpen:!!B.length&&!M,richTitle:{icon:Ga,title:"Selected Clusters",badge:{label:B.length}},actions:G})]})})},Di=p.div`
|
|
99
|
+
`,Cl=({downloadDiagnose:a})=>{const n=m(),{progress:o}=We(),{namespaces:l}=Fe(),[s,r]=i(null),{formData:c,handleFormChange:d,resetFormData:u}=lt({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ye,{richTitle:{icon:gn,title:"Diagnose"},children:s?e(vl,{children:[t(De,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof o[Ye.DownloadingDiagnose]?.percentage,percentage:o[Ye.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof o[Ye.DownloadingDiagnose]?.percentage,visualIcon:bn,startedAt:s}),o[Ye.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:o[Ye.DownloadingDiagnose].list.map(a=>e(D,{$gap:4,$alignItems:"center",children:[a.status===X.Success?t(on,{size:16}):a.status===X.Error?t(ln,{size:16}):t(De,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(g,{$gap:24,children:[t(L,{size:M.XXS,color:n.v2.colors.silver[200],children:"Download a tar.gz file with diagnostics from this cluster. Select which data to include before downloading, and share the file with the Odigos support team for troubleshooting."}),e(g,{$gap:16,children:[e(D,{$gap:8,children:[t(f,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(D,{$gap:8,children:[t(f,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(D,{$gap:8,children:[t(f,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(L,{size:M.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(zt,{alignX:Ut.Left,alignY:_t.Bottom,items:l.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:c.sourceWorkloadNamespaces,setSelectedIds:e=>d("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(c.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:R.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(oe,{label:c.sourceWorkloadNamespaces.length,status:X.Default}):void 0}}),t(D,{$justifyContent:"flex-end",children:t(E,{label:"Download Diagnose",rightIcon:bn,variant:R.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},Sl=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:l}=Me(),[s,r]=i(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ye,{richTitle:{icon:fn,title:"General Information"},children:t(at,{cellsPerRow:2,items:[{id:jt(),title:"Odigos Version",label:o},{id:jt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:jt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:jt(),title:"Tier",label:l}]})})},wl=({isOpen:a,onClose:n,token:o,updateToken:l,fetchDescribeOdigos:i,downloadDiagnose:s})=>e(Ze,{isOpen:a,header:{icon:fn,title:"System Overview",onClose:n},children:[i&&t(Sl,{fetchDescribeOdigos:i}),l&&o&&t(yl,{token:o,updateToken:l}),s&&t(Cl,{downloadDiagnose:s})]});var kl,Tl;!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"}(kl||(kl={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(Tl||(Tl={}));const Nl=[{key:Tl.Name,label:"Name"},{key:Tl.Type,label:"Type",textAlign:"right"},{key:Tl.Status,label:"Status"},{key:Tl.OdigosVersion,label:"Odigos Version"},{key:Tl.ConnectedSince,label:"Connected Since"},{key:Tl.LastActivity,label:"Last Activity"}],Al=(e,t)=>{const a=e.find(e=>e.key===Tl.Id)?.rawValue;return t(a?.toString()||"")},Il=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:l,onAddDestination:i,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===Tl.Status)?.rawValue===X.Success)(e))return[{id:jt(),label:"Delete Connection",rightIcon:Ya,onClick:()=>Al(e,o)}];const d=Al(e,e=>{const n=t.find(t=>t.id===e);return!!n&&Xt(n.odigosVersion,a)}),u=Al(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Xt(a.odigosVersion,n)}),p=[];return l&&p.push({id:jt(),tooltip:u?Te.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:rn,disabled:!u,onClick:()=>Al(e,l)}),i&&p.push({id:jt(),tooltip:Te.ADD_DESTINATION,rightIcon:tn,onClick:()=>Al(e,i)}),s&&p.push({id:jt(),tooltip:Te.ADD_ACTION,rightIcon:en,onClick:()=>Al(e,s)}),r&&p.push({id:jt(),tooltip:Te.ADD_INSTRUMENTATION_RULE,rightIcon:sn,onClick:()=>Al(e,r)}),c&&p.push({id:jt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:dn,disabled:!d,onClick:()=>Al(e,c)}),p}},Dl=({tableRowsMaxHeight:a,connections:o,getConnections:l,onClickConnection:s,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:y,getPotentialDestinations:v,testConnection:C,createDestination:S,updateDestination:w,createAction:k,createInstrumentationRule:T})=>{const N=m(),{isVm:A}=Me(),{formatTimeAgo:I}=Vt(),[D,E]=i(!1),[x,O]=i(o||[]),P=c(async()=>{try{E(!0),O(await l()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||P()},[]);const[F,L]=i(""),[M,V]=i(null),[B,z]=i([]),_=r(()=>M===kl.BulkConfig?u:M===kl.BulkSource?g:0,[M,u,g]),{supportedConnections:U,supportedConnectionIds:j}=r(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===X.Success,n=Xt(e.odigosVersion,t);return a&&n}))(x,_);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x.length,_]);n(()=>{if(!M||M===kl.Delete)return;const e=B.filter(e=>!j.includes(e));e.length&&z(t=>t.filter(t=>!e.includes(t)))},[M,B.length,j.length]);const H=r(()=>x.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:Tl.Id,rawValue:e.id},{key:Tl.Name,rawValue:e.name},{key:Tl.Type,rawValue:e.type},{key:Tl.Status,rawValue:e.status,component:()=>(e=>{const a=e===X.Success?"Connection live":"Connection lost",n=e===X.Success?on:ln;return t(oe,{status:e,label:a,leftIcon:n})})(e.status)},{key:Tl.OdigosVersion,rawValue:e.odigosVersion},{key:Tl.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:Tl.LastActivity,rawValue:e.lastSeenAt?I(e.lastSeenAt):"-"}],onClick:e.status!==X.Success||M?void 0:()=>s(e),isSelected:B.includes(e.id),onSelect:()=>z(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>z(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==X.Success||M===kl.BulkConfig&&!Xt(e.odigosVersion,u)||M===kl.BulkSource&&!Xt(e.odigosVersion,g)})),[x,B,F,M,u,g]),W=r(()=>{const e=(e,t)=>{z([e]),V(t)};return Il({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,kl.Delete),onAddSource:!A&&b&&f?t=>e(t,kl.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?t=>e(t,kl.BulkDestination):void 0,onAddAction:!A&&k?t=>e(t,kl.BulkAction):void 0,onAddInstrumentationRule:!A&&T?t=>e(t,kl.BulkInstrumentationRule):void 0,onEditConfiguration:!A&&p&&h?t=>e(t,kl.BulkConfig):void 0})},[A,x,u,p,h,g,b,f,y,v,S,k,T]),G=r(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:l,onManageConfigurations:i}=e,s=[];a&&s.push({id:jt(),type:Ht.Button,buttonProps:{variant:R.Primary,size:$.S,label:"Add Sources",rightIcon:rn,onClick:a}});const r=[n?{id:kl.BulkDestination,label:Te.ADD_DESTINATION,icon:tn}:null,o?{id:kl.BulkAction,label:Te.ADD_ACTION,icon:en}:null,l?{id:kl.BulkInstrumentationRule,label:Te.ADD_INSTRUMENTATION_RULE,icon:sn}:null,i?{id:kl.BulkConfig,label:"Manage Configurations",icon:dn}:null];return r.some(Boolean)&&s.push({id:jt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===kl.BulkSource?a?.():e===kl.BulkDestination?n?.():e===kl.BulkAction?o?.():e===kl.BulkInstrumentationRule?l?.():e===kl.BulkConfig&&i?.()}},dropDataProps:{alignX:Ut.Left,items:r}}),s.push({id:jt(),type:Ht.Button,buttonProps:{variant:R.Text,size:$.S,label:et.CANCEL,onClick:t}}),s})({onCancel:()=>z([]),onAddSource:!A&&b&&f?()=>V(kl.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?()=>V(kl.BulkDestination):void 0,onAddAction:!A&&k?()=>V(kl.BulkAction):void 0,onAddInstrumentationRule:!A&&T?()=>V(kl.BulkInstrumentationRule):void 0,onManageConfigurations:!A&&p&&h?()=>V(kl.BulkConfig):void 0}),[A,p,h,b,f,y,v,S,k,T]);return t(Wt,{children:e(ye,{richTitle:{icon:vn,title:Te.CONNECTIONS,badge:{label:x.length.toString(),status:ze.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>L(e),width:"300px"},actions:[{id:jt(),type:Ht.Button,buttonProps:{variant:R.Secondary,size:$.S,leftIcon:yn,onClick:P,disabled:D}}],children:[t(Gt,{variant:Kt.Pretty,maxHeight:a,headerBackgroundColor:N.v2.colors.silver[1e3],isLoading:D,withCheckboxes:!0,columns:Nl,rows:H,rowActionsPushRightPosition:M?`calc(${Un} - 24px)`:void 0,getRowActions:W}),M===kl.BulkConfig&&p&&h&&t(Jo,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:z,getEffectiveConfig:p,onApply:h}),M===kl.BulkSource&&b&&f&&t(Yt,{selectedConnectionIds:B,children:t(Yo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),M===kl.BulkDestination&&y&&v&&C&&S&&w&&t(qt,{children:t(Vo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getDestinationCategories:y,getPotentialDestinations:v,testConnection:e=>C(e,B),createDestination:e=>S(e,B),updateDestination:(e,t)=>w(e,t,B)})}),M===kl.BulkAction&&k&&t(Jt,{children:t(Ao,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createAction:e=>k(e,B)})}),M===kl.BulkInstrumentationRule&&T&&t(Qt,{children:t(Bo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createInstrumentationRule:e=>T(e,B)})}),t(zn,{target:"connection",isOpen:M===kl.Delete,onClose:()=>{z([]),V(null)},onApprove:async()=>{const e=B[0];e&&(await d(e),await P())}}),t(Zt,{isOpen:!!B.length&&!M,richTitle:{icon:Ga,title:"Selected Clusters",badge:{label:B.length}},actions:G})]})})},El=p.div`
|
|
100
100
|
display: flex;
|
|
101
101
|
align-items: center;
|
|
102
102
|
justify-content: space-between;
|
|
@@ -105,26 +105,26 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
105
105
|
width: calc(100% - 32px);
|
|
106
106
|
border-radius: 16px;
|
|
107
107
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
108
|
-
|
|
108
|
+
`,$l=p.div`
|
|
109
109
|
display: flex;
|
|
110
110
|
align-items: center;
|
|
111
111
|
justify-content: center;
|
|
112
112
|
padding: 8px;
|
|
113
113
|
border-radius: 8px;
|
|
114
114
|
background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
|
|
115
|
-
|
|
115
|
+
`,Rl=({setStep:a,onSave:n,sourcesPayload:o,destinationsPayload:l,disableAnimation:i})=>{const s=m(),c=()=>a(2),d=()=>a(3),u=r(()=>Object.values(o||{}).flatMap((a,n)=>a.map((a,o)=>{if(!a.selected)return null;const l=a.kind||Ke.Namespace,i=l===Ke.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(El,{children:[t(L,{nowrap:!0,children:i}),t(oe,{label:l,status:X.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${o}`)})).filter(Boolean),[o]),p=r(()=>l?.map((a,n)=>{const o=$e(a.option.type).icon;return e(El,{children:[e(D,{$gap:8,children:[o&&t($l,{children:t(o,{size:24})}),t(L,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(oe,{status:a.testResult.succeeded?X.Success:X.Error,leftIcon:a.testResult.succeeded?on:ln})]},`destination-${n}`)})||[],[l]);return t(Bn,{isOpen:!0,disableAnimation:i,onBack:()=>a(3),onSave:n,header:{icon:Cn,title:Te.SUMMARY,subTitle:Te.REVIEW_SETUP},leftColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(rn,{size:24}),t(L,{nowrap:!0,children:Te.SELECTED_SOURCES}),t(oe,{label:u.length})]}),t(E,{"data-id":"summary-edit-sources",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:c})]}),list:u.length?u:[t(ke,{$height:"100%",children:t(F,{icon:rn,title:Te.NO_SOURCES_SELECTED,subTitle:Te.ADD_SOURCE_PROMPT,button:{leftIcon:Ha,label:Te.ADD_SOURCE,onClick:c}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(D,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(D,{$gap:8,children:[t(tn,{size:24}),t(L,{nowrap:!0,children:Te.SELECTED_DESTINATIONS}),t(oe,{label:p.length})]}),t(E,{"data-id":"summary-edit-destinations",leftIcon:qa,variant:R.Secondary,size:$.S,onClick:d})]}),list:p.length?p:[t(ke,{"data-id":"summary-no-destinations",$height:"100%",children:t(F,{icon:tn,title:Te.NO_DESTINATIONS_SELECTED,subTitle:Te.ADD_DESTINATION_PROMPT,button:{leftIcon:Ha,label:Te.ADD_DESTINATIONS,onClick:d}})},"no-destinations-data")]}})},xl=p.div`
|
|
116
116
|
position: relative;
|
|
117
117
|
overflow: hidden;
|
|
118
118
|
width: calc(100vw - ${({$paddingXAxis:e})=>e});
|
|
119
119
|
height: calc(100vh - ${({$paddingYAxis:e})=>e});
|
|
120
120
|
box-sizing: border-box;
|
|
121
|
-
`,
|
|
121
|
+
`,Ol=p.svg`
|
|
122
122
|
position: absolute;
|
|
123
123
|
top: 50%;
|
|
124
124
|
left: 50%;
|
|
125
125
|
transform: translate(-50%, -50%);
|
|
126
126
|
z-index: -1;
|
|
127
|
-
`,
|
|
127
|
+
`,Pl=[{opacity:"0.1"},{offset:"0.31",opacity:"0.11"},{offset:"0.45",opacity:"0.14"},{offset:"0.56",opacity:"0.19"},{offset:"0.65",opacity:"0.26"},{offset:"0.73",opacity:"0.35"},{offset:"0.8",opacity:"0.46"},{offset:"0.86",opacity:"0.6"},{offset:"0.92",opacity:"0.76"},{offset:"0.98",opacity:"0.93"},{offset:"1"}],Fl=[{width:1440,height:900,pathOpacity:.1,path:"M719.992 1169.99C322.351 1169.99 0 847.64 0 450C0 52.3591 322.351 -269.992 719.992 -269.992C1117.63 -269.992 1439.98 52.3591 1439.98 450C1439.98 847.64 1117.63 1169.99 719.992 1169.99Z",gradientTransform:"translate(814.309 444.011) rotate(180) scale(718.904)",stops:[{opacity:"0.1"},{offset:"0.41",opacity:"0.11"},{offset:"0.56",opacity:"0.13"},{offset:"0.67",opacity:"0.18"},{offset:"0.75",opacity:"0.25"},{offset:"0.83",opacity:"0.33"},{offset:"0.89",opacity:"0.44"},{offset:"0.95",opacity:"0.56"},{offset:"1",opacity:"0.7"}]},{width:1343,height:900,pathOpacity:.3,path:"M671.344 1121.34C300.571 1121.34 0 820.773 0 450C0 79.2264 300.571 -221.345 671.344 -221.345C1042.12 -221.345 1342.69 79.2264 1342.69 450C1342.69 820.773 1042.12 1121.34 671.344 1121.34Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:Pl},{width:1163,height:900,pathOpacity:.5,path:"M581.31 1031.31C260.261 1031.31 0 771.048 0 449.999C0 128.951 260.261 -131.311 581.31 -131.311C902.358 -131.311 1162.62 128.951 1162.62 449.999C1162.62 771.048 902.358 1031.31 581.31 1031.31Z",gradientTransform:"translate(644.026 441.551) rotate(180) scale(581.31)",stops:Pl},{width:798,height:798,pathOpacity:.7,path:"M398.581 797.162C178.451 797.162 0 618.711 0 398.581C0 178.451 178.451 0 398.581 0C618.711 0 797.162 178.451 797.162 398.581C797.162 618.711 618.711 797.162 398.581 797.162Z",gradientTransform:"translate(445.003 392.441) rotate(180) scale(398.23)",stops:Pl}],Ll=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:l})=>{const[s,c]=i(window.innerWidth),d=r(()=>s/Fl[0].width,[s]);return n(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(xl,{$paddingXAxis:a,$paddingYAxis:o,children:[Fl.map(({width:a,height:n,pathOpacity:o,path:l,gradientTransform:i,stops:s},r)=>{const c=`purple-ring-${r}`;return e(Ol,{width:a*d,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[t("path",{opacity:o,d:l,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:i,children:s.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),l]})},Ml=p.div`
|
|
128
128
|
display: flex;
|
|
129
129
|
flex-direction: column;
|
|
130
130
|
align-items: center;
|
|
@@ -135,7 +135,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
135
135
|
width: 50vw;
|
|
136
136
|
border-radius: 16px;
|
|
137
137
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
138
|
-
`,
|
|
138
|
+
`,Vl=p.div`
|
|
139
139
|
display: flex;
|
|
140
140
|
flex-direction: column;
|
|
141
141
|
align-items: center;
|
|
@@ -145,17 +145,17 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
145
145
|
& * {
|
|
146
146
|
text-align: center;
|
|
147
147
|
}
|
|
148
|
-
`,
|
|
148
|
+
`,Bl=({onStart:a})=>t(Ze,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ke,{$height:"100%",children:e(Ml,{children:[e(Vl,{children:[t(L,{size:M.L,weight:500,children:Te.GET_STARTED_WITH}),t(jn,{size:260}),t(L,{size:M.S,weight:400,children:Te.GET_STARTED_DESCRIPTION})]}),t(E,{"data-id":"onboarding-get-started",label:et.GET_STARTED,rightIcon:Sn,size:$.L,onClick:a})]})})}),zl=[{step:1,label:Te.INSTALLATION,forceDoneBadge:!0},{step:2,label:Te.SOURCES_SETUP},{step:3,label:Te.DESTINATIONS_SETUP},{step:4,label:Te.SUMMARY}],_l=p.div`
|
|
149
149
|
display: flex;
|
|
150
150
|
flex-direction: column;
|
|
151
151
|
gap: 32px;
|
|
152
152
|
padding: 64px;
|
|
153
|
-
`,
|
|
153
|
+
`,Ul=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:o,persistSources:l,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=i(1),[g,b]=i(!1),[f,y]=i(null),[v,C]=i(null),S=()=>h(e=>e+1),w=()=>h(e=>e-1);return e(Ll,{paddingXAxis:a,paddingYAxis:n,children:[e(_l,{children:[t(jn,{}),t(ea,{currentStep:m,data:zl,gap:32})]}),t(Yt,{initialInputs:f,children:e(qt,{children:[1===m&&t(Bl,{onStart:S}),2===m&&t(Yo,{disableAnimation:!0,onBack:e=>{y(e),w()},onNext:e=>{y(e),S()},fetchNamespacesWithWorkloads:o,persistSources:l}),3===m&&t(Vo,{disableAnimation:!0,onBack:e=>{C(e),w()},onNext:e=>{C(e),S()},getDestinationCategories:s,getPotentialDestinations:r,initialInputs:v,testConnection:c,createDestination:d,updateDestination:u}),4===m&&t(Rl,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){b(!0);try{const e=[];f&&e.push(l(f)),v&&e.push(...v.map(e=>d(e.formData)));const t=await Promise.allSettled(e),a=[];for(const e of t)"rejected"===e.status?a.push(e.reason?.message||String(e.reason)):e.value?.error&&a.push(e.value.error);if(a.length)return{error:a.join("\n")};p()}catch(e){return b(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:v})]})})]})};var jl;!function(e){e.Gateway="gateway",e.Node="node"}(jl||(jl={}));const Xl=({onClickDownloadDiagnose:a,onClickRefresh:n,loading:o,disabled:l})=>{const i=r(()=>{const e=[];return a&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Download Diagnose",leftIcon:bn,size:$.S,variant:R.Text,onClick:a,disabled:l}}),n&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:n,disabled:l,loading:o}}),e},[a,n,l,o]);return e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(ta,{icon:wn,title:"Collectors Pipeline"}),t(aa,{actions:i})]})},Hl=({pod:a,getExtendedPodInfo:o,onClose:l})=>{const{formatTimeAgo:s}=Vt(),[c,d]=i(null);n(()=>{a?o(a.namespace,a.name).then(e=>d(e??null)):d(null)},[a]);const u=r(()=>[{id:jt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:jt(),title:"Status",badge:{status:na(c?.status),label:c?.status??"-"}}],[c]),p=r(()=>c?.containers?.map(e=>({id:jt(),items:[{id:jt(),title:"Container",label:e.name??"-"},{id:jt(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:jt(),title:"Ready",badge:{status:e.ready?X.Success:X.Error,leftIcon:e.ready?Ga:Ka,label:e.ready?"True":"False",invertColors:!0}},{id:jt(),title:"Started",badge:{status:e.started?X.Success:X.Error,leftIcon:e.started?Ga:Ka,label:e.started?"True":"False",invertColors:!0}},{id:jt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:jt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:jt(),title:"Restarts",label:e.restarts.toString()},{id:jt(),title:"State Reason",label:e.stateReason??"-"},{id:jt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:jt(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return t(Ze,{isOpen:!!a,header:{icon:kn,title:"Pod Information",onClose:l},children:c?e(at,{bgTint:"1000",richTitle:{icon:kn,title:c.name,withCopy:!0},children:[t(at,{bgTint:"900",cellsPerRow:2,items:u}),e(at,{bgTint:"900",richTitle:{icon:fn,title:"Kubectl Commands"},withCollapse:!0,collapseIsDefaultOpen:!0,children:[t(oa,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(oa,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(oa,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]}),t(at,{bgTint:"900",richTitle:{title:"Containers Overview"},withCollapse:!0,collapseIsDefaultOpen:!0,children:p.length?p.map(({id:e,items:a})=>t(at,{bgTint:"800",cellsPerRow:2,items:a},e)):t(F,{title:"No containers",subTitle:"Pod has no containers"})}),t(Hn,{bgTint:"900",yaml:c.manifestYAML,defaultOpen:!0})]}):t(ke,{$height:"50vh",children:t(De,{withSpinner:!0})})})};var Wl;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Wl||(Wl={}));const Gl=[{key:Wl.PodName,label:"Pod Name"},{key:Wl.Status,label:"Status"},{key:Wl.Restarts,label:"Restarts"},{key:Wl.NodeName,label:"Node Name"},{key:Wl.Age,label:"Age"},{key:Wl.DockerImage,label:"Collector Version"}],Kl=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:l})=>{const s=m(),{formatTimeAgo:c}=Vt(),[d,u]=i(null),p=r(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:Wl.PodName,rawValue:a.name},{key:Wl.Status,rawValue:a.status,component:()=>{return e=a.status,t(oe,{status:na(e),label:e});var e}},{key:Wl.Restarts,rawValue:a.restartsCount.toString()},{key:Wl.NodeName,rawValue:a.nodeName},{key:Wl.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(L,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),l=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,i=l>0?X.Error:X.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?X.Error:X.Success;return e(D,{$gap:4,children:[t(q,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(oe,{status:i,label:`Receiver ${l}%`,leftIcon:i===X.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})}),t(q,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(oe,{status:c,label:`Exporter ${r}%`,leftIcon:c===X.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Wl.Age,rawValue:c(a.creationTimestamp)},{key:Wl.DockerImage,rawValue:a.image}]})),[o,s]);return e(at,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:kn,title:"Pods"},children:[t(Gt,{variant:Kt.Data,maxHeight:n,isLoading:a,columns:Gl,rows:p}),t(Hl,{pod:d,getExtendedPodInfo:l,onClose:()=>u(null)})]})},Yl=({isOpen:e,onClose:a,title:n,yaml:o})=>t(Ze,{isOpen:e,header:{icon:An,title:n,onClose:a},children:t(Hn,{yaml:o,defaultOpen:!0})}),ql=e=>{switch(e){case la.Healthy:return"All desired replicas are updated, available, and ready";case la.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case la.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case la.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case la.Down:return"No available replicas";case la.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var Jl;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Jl||(Jl={}));const Ql=p.div`
|
|
154
154
|
flex: 0.5;
|
|
155
155
|
padding: 12px;
|
|
156
156
|
border-radius: 12px;
|
|
157
157
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
158
|
-
`,
|
|
158
|
+
`,Zl=({selectedTab:a,gatewayInfo:n,nodeCollectorInfo:o,isLoading:l})=>{const{formatTimeAgo:s}=Vt(),[c,d]=i(null),u=r(()=>(e=>{switch(e){case jl.Gateway:return"Deployment";case jl.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(a),[a]),p=r(()=>((e,t,a,n)=>{const o={status:ze.Disabled,label:"No rollouts yet"};let l=!1,i=null;switch(e){case jl.Gateway:l=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case jl.Node:l=a?.rolloutInProgress??!1,i=a?.lastRolloutAt??null;break;default:return o}return l?{status:X.Info,label:"Rollout in progress",rightIcon:yn,useSecondaryTone:!0}:i?{status:ze.Disabled,label:`Last Rollout: ${n(i)}`}:o})(a,n,o,s),[n,o,a,s]),m=r(()=>((e,t,a,n)=>{let o=n?X.Info:ze.Unknown,l=n?"Loading":la.Unknown,i=n?"Fetching data...":ql(la.Unknown);switch(e){case jl.Gateway:o=t?.status?na(t?.status):o,l=t?.status??l,i=t?.status?ql(t.status):i;break;case jl.Node:o=a?.status?na(a?.status):o,l=a?.status??l,i=a?.status?ql(a.status):i}return{status:o,title:l,description:i}})(a,n,o,l),[n,o,a,l]),h=r(()=>((e,t,a)=>{switch(e){case jl.Gateway:return[{gaugeWidth:128,min:0,max:t?.hpa?.max??0,current:t?.hpa?.current??0,title:"HPA Spec",primaryLabel:"Current replicas",secondaryLabel:"Max replicas"}];case jl.Node:return[{gaugeWidth:128,min:0,max:a?.nodes?.desired??0,current:a?.nodes?.ready??0,title:"Nodes",primaryLabel:"Ready nodes",secondaryLabel:"Desired nodes"}];default:return[]}})(a,n,o),[n,o,a]),g=r(()=>((e,t,a,n)=>{switch(e){case jl.Gateway:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${t?.resources?.requests.cpu}/${t?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${t?.resources?.requests.memory}/${t?.resources?.limits.memory}`,isLoading:n}]}];case jl.Node:return[{title:"Resources (request/limit)",cells:[{label:"CPU",value:`${a?.resources?.requests.cpu}/${a?.resources?.limits.cpu}`,isLoading:n},{label:"Memory",value:`${a?.resources?.requests.memory}/${a?.resources?.limits.memory}`,isLoading:n}]}];default:return[]}})(a,n,o,l),[n,o,a,l]),b=r(()=>(a===jl.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,a]),f=r(()=>(a===jl.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,a]);return e(at,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:An,title:u,badge:p},actions:[{id:jt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:Jl.ManifestYaml,label:u,icon:In},{id:Jl.ConfigMapYaml,label:"ConfigMap",icon:In}]}}],children:[e(D,{$gap:16,children:[t("div",{children:t(ia,{...m})}),h.map(e=>t(Ql,{children:t("div",{children:t(sa,{...e})})},e.title)),g.map(e=>t(ra,{...e},e.title))]}),t(Yl,{isOpen:c===Jl.ManifestYaml,onClose:()=>d(null),title:u,yaml:b}),t(Yl,{isOpen:c===Jl.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:f})]})},ei=[{value:jl.Gateway,label:"Gateway"},{value:jl.Node,label:"Node Collector"}],ti=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:l,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{isVersionSupported:m,version:h}=Me(a),[b,f]=i(!1),[y,v]=i(jl.Gateway),[C,S]=i(null),[w,k]=i([]),[T,N]=i(null),[A,I]=i([]),D=c(async()=>{f(!0);try{switch(y){case jl.Gateway:S(await l()??null),k(await s()??[]);break;case jl.Node:N(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{D()},[D]);const E=r(()=>y===jl.Gateway?w:A,[w,A,y]);return e(Wt,{children:[t(Xl,{disabled:!m,loading:b,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e(ca,{children:[e(g,{children:[t(B,{variant:da.Underline,options:ei,selected:y,setSelected:v}),t(Zl,{selectedTab:y,gatewayInfo:C,nodeCollectorInfo:T,isLoading:b})]}),t(Kl,{isLoading:b,tableRowsMaxHeight:o,pods:E,getExtendedPodInfo:p}),!m&&t(Xn,{minSupportedVersion:a,currentVersion:h||""})]})]})},ai=p.div`
|
|
159
159
|
display: inline-flex;
|
|
160
160
|
align-items: center;
|
|
161
161
|
padding: 4px 8px;
|
|
@@ -165,7 +165,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
165
165
|
overflow: hidden;
|
|
166
166
|
white-space: pre;
|
|
167
167
|
text-overflow: ellipsis;
|
|
168
|
-
`,
|
|
168
|
+
`,ni=p.div`
|
|
169
169
|
display: inline-flex;
|
|
170
170
|
align-items: center;
|
|
171
171
|
gap: 24px;
|
|
@@ -175,24 +175,24 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
175
175
|
overflow: hidden;
|
|
176
176
|
white-space: pre;
|
|
177
177
|
text-overflow: ellipsis;
|
|
178
|
-
`,
|
|
178
|
+
`,oi=p(D)`
|
|
179
179
|
flex-shrink: 0;
|
|
180
180
|
gap: 6px;
|
|
181
181
|
align-items: center;
|
|
182
182
|
min-height: 22px;
|
|
183
|
-
`;const
|
|
183
|
+
`;const li=[{key:"name",label:"Name",noSort:!0,noFilter:!0,flex:"0 0 156px",withTooltip:!0},{key:"summary",label:"Summary",noSort:!0,noFilter:!0},{key:"badges",label:"Type",noSort:!0,noFilter:!0,flex:"0 0 128px"}],ii=[{value:"all",label:ma},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],si=({title:a,items:n,isLoading:o,showTypeFilter:l,tableRowsMaxHeight:s,onRuleClick:d,onCreateRule:u,onEditRule:p,onDeleteRule:h})=>{const g=m(),[b,f]=i(""),[y,v]=i("all"),C=r(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,y,l);return e=function(e,t){if(!t.trim())return e;const a=t.toLowerCase();return e.filter(e=>{const t=e.name?.toLowerCase().includes(a),n=e.summary.map(e=>e.text).join("").toLowerCase();return t||n.includes(a)})}(e,b),e},[n,y,l,b]),S=r(()=>C.map(a=>{const n=a.typeBadge?function(e,t){const a=e.v2.colors;switch(t){case"Relevance":return{bg:a.blue[700],text:a.white[500]};case"Duration":return{bg:a.purple[700],text:a.white[500]};case"Error":return{bg:a.red[500],text:a.black[500]}}}(g,a.typeBadge):void 0;return{cells:[{key:"name",rawValue:a.name||"",component:()=>t(ni,{$disabled:a.disabled,children:a.name&&t(L,{size:M.XXS,color:g.v2.colors.white[500],nowrap:!0,children:a.name})})},{key:"summary",rawValue:a.summary.map(e=>e.text).join(""),component:()=>t(ni,{$disabled:a.disabled,children:t(ai,{children:t(ua,{parts:a.summary})})})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(oi,{children:[a.disabled&&t(oe,{label:pa,textSize:M.XXXS,backgroundColor:g.v2.colors.grey[700],textColor:g.v2.colors.grey[300]}),a.typeBadge&&n&&t(oe,{label:a.typeBadge,textSize:M.XXXS,backgroundColor:n.bg,textColor:n.text})]})}],onClick:()=>d(a)}}),[C,g,d]),w=r(()=>{const e=e=>t(Ya,{...e,fill:g.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[g]),k=c(e=>{const t=S.indexOf(e);if(t<0)return[];const a=C[t];return a?[{id:"edit","data-id":"sampling-rule-action-edit",label:ft,leftIcon:qa,onClick:()=>p(a.ruleId,a.samplingId)},{id:"delete","data-id":"sampling-rule-action-delete",label:"",leftIcon:w,onClick:()=>h(a.ruleId,a.samplingId)}]:[]},[S,C,p,h,w]);return t(ye,{fullHeight:!0,richTitle:{icon:un,title:a,badge:{label:n.length,backgroundColor:g.v2.colors.silver[600],textColor:g.v2.colors.white[500]}},search:{"data-id":"sampling-search-rules",value:b,onChange:f,placeholder:"Search..",width:"500px",...l?{segment:{"data-id":"sampling-segment-type-filter",options:ii,selected:y,setSelected:v}}:{}},children:t(Gt,{variant:Kt.Pretty,hideHeader:!0,maxHeight:s,isLoading:o,noDataProps:{hideIcon:!0,title:"No Rules Exist",button:{label:"Create your first rule",onClick:u}},columns:li,rows:S,getRowActions:k})})},ri=a=>{const{workloads:o,samplingRules:l,k8sHealthProbesConfig:s,loading:u,tableRowsMaxHeight:p,fetchSamplingRules:m,createNoisyOperationRule:h,updateNoisyOperationRule:b,createHighlyRelevantOperationRule:f,updateHighlyRelevantOperationRule:y,createCostReductionRule:v,updateCostReductionRule:C,deleteSamplingRule:S,updateK8sHealthProbesConfig:w}=a,k=r(()=>o.map(({id:e})=>({id:`${e.namespace}/${e.kind}/${e.name}`,label:`${e.namespace} / ${e.kind} / ${e.name}`})),[o]),T=r(()=>Array.from(new Set(o.map(({id:e})=>e.namespace))).sort().map(e=>({id:e,label:e})),[o]),[N,A]=i(ha.Noisy),[I,x]=i(null),[O,P]=i(!1),[F,L]=i(!1),[M,V]=i(null),[z,_]=i(!1),[U,H]=i(!1),[W,G]=i(!1),K=r(()=>ga(s),[s]),Y=r(()=>ba(l),[l]),q=r(()=>fa(Y?.rule??null),[Y]),J=r(()=>ya(l),[l]),Q=r(()=>va(J?.rule??null),[J]),Z=d(I);Z.current=I,n(()=>{const e=Z.current;if(!e)return;const t=Ca(l,e);t?x(t):(x(null),P(!1))},[l]);const ee=r(()=>{const e=new Set;return Y&&e.add(Y.rule.ruleId),J&&e.add(J.rule.ruleId),e},[Y,J]),te=r(()=>Sa(l,N,ee),[l,N,ee]),ae=c(()=>L(!0),[]),ne=c(()=>L(!1),[]),oe=c(e=>{const t=l[0]?.id??"default";switch(Ia[N]){case"noisy":h(t,Ta(e));break;case"highlyRelevant":f(t,ka(e));break;case"costReduction":v(t,wa(e))}L(!1)},[l,N,h,f,v]),le=c(e=>{const t=Na(l,e);t&&(P(!1),x(t))},[l]),ie=c(()=>{x(null),P(!1)},[]),se=c((e,t)=>{const a=I;if(a&&a.rule.ruleId===e&&a.samplingId===t)P(!0),x({...a});else for(const a of l){if(a.id!==t)continue;const n=[...a.noisyOperations.map(e=>({category:"noisy",rule:e})),...a.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...a.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(n)return P(!0),void x({category:n.category,rule:n.rule,samplingId:t,summary:Aa(n.category,n.rule)})}},[I,l]),de=c((e,t,a)=>{const n=I?.category;if(n){switch(n){case"noisy":b(a,t,Ta(e));break;case"highlyRelevant":y(a,t,ka(e));break;case"costReduction":C(a,t,wa(e))}P(!1)}},[I,b,y,C]),ue=c((e,t)=>{V({ruleId:e,samplingId:t})},[]),pe=c(()=>{if(!M)return;const{ruleId:e,samplingId:t}=M,a=I?.category||Ia[N];S(t,e,a),x(null),P(!1),V(null)},[M,I,N,S]),he=c(()=>V(null),[]),ge=c((e,t)=>{w(e,t),_(!1)},[w]),be=c(e=>{const t=l[0]?.id??"default",a=Y;a?y(a.samplingId,a.rule.ruleId,{name:a.rule.name,disabled:!e,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null,notes:a.rule.notes}):e&&f(t,{name:"Auto - Keep All Error Traces",disabled:!1,error:!0,sourceScopes:[],operation:null,percentageAtLeast:null}),H(!1)},[l,Y,f,y]),ye=c((e,t)=>{const a=l[0]?.id??"default",n=J;n?C(n.samplingId,n.rule.ruleId,{name:n.rule.name,disabled:!e,sourceScopes:[],operation:null,percentageAtMost:t,notes:n.rule.notes}):e&&v(a,{name:"Auto - Drop Traces Cluster-Wide",disabled:!1,sourceScopes:[],operation:null,percentageAtMost:t}),G(!1)},[l,J,v,C]),ve=c(e=>{const t=Ia[N];let a=null;switch(t){case"noisy":{const n=Ta(e);a=Da(l,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=ka(e);a=Da(l,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=wa(e);a=Da(l,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:Ea,ruleId:a}:null},[l,N]),Ce=c(e=>{const t=I?.category,a=I?.rule.ruleId;if(!t)return null;let n=null;switch(t){case"noisy":{const o=Ta(e);n=Da(l,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}case"highlyRelevant":{const o=ka(e);n=Da(l,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs},a);break}case"costReduction":{const o=wa(e);n=Da(l,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}}return n?{message:Ea,ruleId:n}:null},[l,I]),Se=c(e=>{L(!1);for(const t of l){const a=[...t.noisyOperations.map(e=>({category:"noisy",rule:e})),...t.highlyRelevantOperations.map(e=>({category:"highlyRelevant",rule:e})),...t.costReductionRules.map(e=>({category:"costReduction",rule:e}))].find(t=>t.rule.ruleId===e);if(a)return P(!0),void x({category:a.category,rule:a.rule,samplingId:t.id,summary:Aa(a.category,a.rule)})}},[l]),we=r(()=>{const e=[];return a.docsUrl&&e.push({id:jt(),type:Ht.Button,buttonProps:{"data-id":"sampling-btn-docs",label:$a,leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")}}),e.push({id:jt(),type:Ht.Button,buttonProps:{"data-id":"sampling-btn-refresh",label:Ra,leftIcon:yn,size:$.S,variant:R.Text,onClick:m,loading:u}}),e.push({id:jt(),type:Ht.Button,buttonProps:{"data-id":"sampling-btn-create-rule",label:xa,rightIcon:Ha,size:$.S,variant:R.Primary,onClick:ae}}),e},[a.docsUrl,m,u,ae]);return e(Wt,{children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(ta,{icon:un,title:Pa,subTitle:Oa}),t(aa,{actions:we})]}),e(g,{$gap:12,children:[t(B,{variant:da.Underline,options:Fa,selected:N,setSelected:A}),e(D,{$justifyContent:"space-between",children:[t(j,{status:X.Default,message:La[N]}),a.docsUrl&&t(E,{"data-id":"sampling-btn-docs-banner",label:"Docs",leftIcon:Wa,size:$.S,variant:R.Text,onClick:()=>window.open(a.docsUrl,"_blank")})]}),N===ha.Noisy?t($n,{title:fe,summary:K,onEdit:()=>_(!0)}):N===ha.HighlyRelevant?t($n,{title:ce,summary:q,onEdit:()=>H(!0)}):N===ha.CostReduction?t($n,{title:me,summary:Q,onEdit:()=>G(!0)}):null,t(si,{title:Ma[N],items:te,isLoading:u,showTypeFilter:N===ha.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:le,onCreateRule:ae,onEditRule:se,onDeleteRule:ue})]}),t(ml,{formType:re.View,data:I,defaultEditMode:O,onClose:ie,onDelete:ue,onSaveEdit:de,sourceOptions:k,namespaceOptions:T,validateForm:Ce,onNavigateToDuplicate:Se}),t(ml,{formType:re.Create,isOpen:F,category:Ia[N],onClose:ne,onSubmit:oe,sourceOptions:k,namespaceOptions:T,validateForm:ve,onNavigateToDuplicate:Se}),t(ml,{formType:re.EditAutoNoisy,isOpen:z,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>_(!1),onSave:ge}),t(ml,{formType:re.EditAutoHighlyRelevant,isOpen:U,enabled:!!Y&&!Y.rule.disabled,onClose:()=>H(!1),onSave:be}),t(ml,{formType:re.EditAutoCostReduction,isOpen:W,enabled:!!J&&!J.rule.disabled,dropPercentage:J?.rule.percentageAtMost??25,onClose:()=>G(!1),onSave:ye}),t(Va,{title:Ua,description:_a,isOpen:!!M,onClose:he,onApprove:pe,approveLabel:za,denyLabel:Ba})]})},ci=p.div`
|
|
184
184
|
display: flex;
|
|
185
185
|
align-items: center;
|
|
186
186
|
justify-content: space-between;
|
|
187
187
|
padding: 0 12px;
|
|
188
|
-
`,
|
|
188
|
+
`,di=({disabled:a,loading:n,tabs:o,selectedTab:l,setSelectedTab:s,onClickReset:c,onClickRefresh:d})=>{const[u,p]=i(!1),m=r(()=>{const e=[];return c&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Reset",leftIcon:Xa,size:$.S,variant:R.Text,onClick:()=>p(!0),disabled:a}}),d&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:d,disabled:a,loading:n}}),e},[a,n,d]);return e(ci,{children:[e(D,{$gap:12,$alignItems:"center",children:[t(ta,{icon:dn,title:"Odigos Settings"}),t(Re,{width:"350px",options:o,values:[l],setValues:e=>s(e[0]),disabled:a})]}),t(aa,{actions:m}),t(Va,{isOpen:u,onClose:()=>p(!1),onDeny:()=>p(!1),onApprove:c,title:"Reset Settings",description:"Are you sure you want to reset the settings? This will clear the odigos-local-ui-config and reset the settings to the default values."})]})},ui=p(D)`
|
|
189
189
|
flex: 1;
|
|
190
190
|
min-height: 0;
|
|
191
191
|
width: 100%;
|
|
192
192
|
align-self: stretch;
|
|
193
|
-
`,
|
|
193
|
+
`,pi=p(g)`
|
|
194
194
|
flex: 1;
|
|
195
195
|
min-height: 0;
|
|
196
196
|
height: 100%;
|
|
197
197
|
overflow-y: auto;
|
|
198
|
-
`,
|
|
198
|
+
`,mi=e=>"general"===e.name?0:"advanced"===e.name?2:1,hi=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:l,configYamlsLoading:s,effectiveConfig:c,effectiveConfigLoading:d,refetch:u,factoryReset:p,onSave:m,saveLoading:h})=>{const{isVersionSupported:b,version:f,isEnterprise:y}=Me(a),v=r(()=>{if(!c)return{};const{manifestYAML:e,provenance:t,...a}=c;return a},[c]),{formData:C,handleFormChange:S,getNestedValue:w,getFormDiff:k,isFormDirty:T}=lt(v);n(()=>{"{}"!==JSON.stringify(v)&&"{}"===JSON.stringify(C)&&S(void 0,void 0,v)},[v,C]);const N=r(()=>[...l].sort((e,t)=>mi(e)-mi(t)),[l]),A=r(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(c?.provenance),[c?.provenance]),I=r(()=>{const e=new Set;for(const t of l)for(const a of t.fields)a.componentType===x.Dropdown&&e.add(a.helmValuePath);return e},[l]),[D,E]=i(!1),O=r(()=>[{id:jt(),type:Ht.Button,buttonProps:{"data-id":"settings-save",variant:R.Primary,size:$.S,label:"Save Changes",leftIcon:on,loading:h,onClick:()=>E(!0)}},{id:jt(),type:Ht.Button,buttonProps:{"data-id":"settings-cancel",variant:R.Secondary,size:$.S,label:"Cancel",leftIcon:ln,onClick:()=>S(void 0,void 0,v)}}],[h,k,v,C,S]),P=r(()=>N.map(e=>({id:e.name,label:e.displayName})),[N]),L=r(()=>N.map(e=>e.name),[N]),{selectedSection:M,setSelectedSection:V,setSectionRef:B,setScrollContainerRef:z}=ja({sectionNames:L});return e(Wt,{$heightOffset:o,$gap:12,children:[t(di,{disabled:!b,loading:s||d,tabs:P,selectedTab:M,setSelectedTab:V,onClickReset:p?()=>p().then(()=>u?.()):void 0,onClickRefresh:u?()=>u():void 0}),e(ca,{children:[!b&&t(Xn,{minSupportedVersion:a,currentVersion:f||""}),t(Zt,{isOpen:T,richTitle:{icon:dn,title:"Config Settings"},actions:O}),t(Va,{isOpen:D,title:"Save Changes via UI?",description:"We recommend updating via your Helm values.yaml to ensure changes are version-controlled and go through a proper review process.",onClose:()=>E(!1),approveLabel:"Save changes",onApprove:async()=>{const e=((e,t)=>{const a=(e,t,a)=>{for(let a=0;a<t.length-1;a++){const n=t[a];n in e&&"object"==typeof e[n]&&null!==e[n]||(e[n]={}),e=e[n]}e[t[t.length-1]]=a},n=JSON.parse(JSON.stringify(e));for(const e of t){const t=e.split(".");let o=n;for(const e of t){if(null==o||"object"!=typeof o){o=void 0;break}o=o[e]}"string"==typeof o&&a(n,t,o.replaceAll("-","_"))}return n})(k(v,C),I);await(m?.(e)),S(void 0,void 0,{})},denyLabel:"Keep editing",onDeny:()=>E(!1)}),e(ui,{$gap:24,$alignItems:"stretch",children:[t(pi,{ref:z,$gap:24,$width:"100%",children:l.length?N.map(a=>t(ye,{id:a.name,ref:e=>B(a.name,e),richTitle:{icon:dn,title:a.displayName},children:a.fields.map(a=>{if(a.isEnterpriseOnly&&!y)return null;const n=Pe(a.componentProps||"{}",{}),o=A[a.helmValuePath];return e(g,{$gap:4,children:[t(En,{componentType:a.componentType,inputType:n.type,name:a.helmValuePath,label:a.displayName,tooltip:a.description,badge:o?{status:"odigos-local-ui-config"===o?X.Warning:ze.Unknown,label:o,tooltip:`This field is reconciled from the following resource: ${o}`}:void 0,disabled:a.isHelmOnly||h,value:w("formData",a.helmValuePath),setValue:e=>S(a.helmValuePath,e),dropdownOptions:n.options?.map(e=>({id:e,value:e})),dropdownNoSearch:!0,dropdownNoCheckbox:!0},a.helmValuePath),a.isHelmOnly?t(j,{status:X.Info,smallIcon:!0,message:"This field can only be updated via Helm values.yaml file"}):null]},a.helmValuePath)})},a.name)):s?t(ke,{$height:"30vh",children:t(De,{withSpinner:!0})}):t(ye,{richTitle:{icon:dn,title:"Config Settings"},children:t(F,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),t(pi,{children:d&&!c?.manifestYAML?t(ke,{$height:"30vh",children:t(De,{withSpinner:!0})}):t(Hn,{title:"Effective Config YAML",yaml:c?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})]})};export{Ao as AddActionDrawer,oo as AddActionForm,Vo as AddDestinationDrawer,so as AddDestinationForm,Bo as AddRuleDrawer,bo as AddRuleForm,Yo as AddSourceDrawer,Dl as CentralConnections,qo as EditActionDrawer,Jo as EditConfigDrawer,Qo as EditDestinationDrawer,Zo as EditRuleDrawer,Ul as Onboarding,ti as PipelineCollectors,ml as SamplingRuleDrawer,yo as SamplingRuleForm,ri as SamplingRules,hi as Settings,wl as SystemDrawer,ei as TABS};
|