@odigos/ui-kit 0.0.226 → 0.0.227
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/chunks/index-B0b5lJH3.js +3 -0
- package/lib/chunks/{index-BWi3du_1.js → index-C-Z4QHpA.js} +9 -9
- package/lib/chunks/{ui-components-B4LvruCJ.js → ui-components-C7i9zbc-.js} +415 -383
- package/lib/components/_v2/charts/gauge-chart/index.d.ts +18 -0
- package/lib/components/_v2/charts/index.d.ts +1 -0
- package/lib/components/_v2/index.d.ts +1 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/pipeline-collectors/enum.d.ts +4 -0
- package/lib/containers/_v2/pipeline-collectors/{helpers → general-info/helpers}/get-general-badge.d.ts +1 -1
- package/lib/containers/_v2/pipeline-collectors/general-info/helpers/get-general-gauge-cards.d.ts +4 -0
- package/lib/containers/_v2/pipeline-collectors/{helpers → general-info/helpers}/get-general-status-card.d.ts +1 -1
- package/lib/containers/_v2/pipeline-collectors/{helpers → general-info/helpers}/get-general-text-cards.d.ts +1 -1
- package/lib/containers/_v2/pipeline-collectors/{helpers → general-info/helpers}/get-general-title.d.ts +1 -1
- package/lib/containers/_v2/pipeline-collectors/{helpers → general-info/helpers}/index.d.ts +2 -1
- package/lib/containers/_v2/pipeline-collectors/general-info/index.d.ts +7 -6
- package/lib/containers/_v2/pipeline-collectors/index.d.ts +5 -0
- package/lib/containers/_v2/pipeline-collectors/toolbar/index.d.ts +1 -11
- package/lib/containers/source-drawer/profiling/flamebearer.d.ts +5 -0
- package/lib/containers/v2.js +32 -45
- package/lib/containers.js +4 -4
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets/_v2/yaml-section-card/index.d.ts +2 -0
- 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 +36 -0
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-BYYemmZD.js +0 -3
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 i,forwardRef as o,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,D as I,m as D,n as E,B as $,a as R,o as x,p as O,q as P,N as L,r as F,s as M,t as V,v 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 ie,Z as oe,_ 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,S as ye,aa as ve,ab as Ce,ac as Se,ad as we,b as ke,ae as Te,af as Ne,ag as Ae,ah as Ie,ai as De,aj as Ee,ak as $e,al as Re,am as xe,an as Oe,ao as Pe,ap as Le,aq as Fe,ar as Me,as as Ve,at as Be,au as ze,av as _e,aw as Ue,ax as je,ay as Xe,az as He,aA as We,aB as Ge,aC as Ke,aD as Ye,aE as qe,aF as Je,aG as Qe,aH as Ze,aI as et,aJ as tt,aK as at,aL as nt,aM as it,aN as ot,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 Lt,u as Ft,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 ia,bA as oa,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 La,c3 as Fa,c4 as Ma,c5 as Va,c6 as Ba,c7 as za,c8 as _a,c9 as Ua,ca as ja,cb as Xa}from"../chunks/ui-components-B4LvruCJ.js";import{TrashIcon as Ha,PlusIcon as Wa,BookIcon as Ga,VSquareIcon as Ka,XSquareIcon as Ya,DeleteIcon as qa,EditIcon as Ja,GoLogo as Qa,JavaLogo as Za,ChevronRightIcon as en,ActionIcon as tn,DestinationIcon as an,ChevronUpIcon as nn,ChevronDownIcon as on,VIcon as ln,XIcon as sn,InstrumentationRuleIcon as rn,SourceIcon as cn,NamespacesIcon as dn,SettingsIcon as un,SamplingIcon as pn,ExclamationTriangleIcon as mn,ExclamationCircleIcon as hn,KeyIcon as gn,DiagnoseIcon as bn,DownloadIcon as fn,TerminalIcon as yn,RefreshIcon as vn,ConnectionsIcon as Cn,OdigosLogo as Sn,ArrowRightIcon as wn,PodIcon as kn,ArrowDownSquareIcon as Tn,ArrowUpSquareIcon as Nn,PipelineCollectorIcon as An,GatewayIcon as In,YamlIcon as Dn}from"../icons.js";import{S as En,D as $n,A as Rn,P as xn,a as On,b as Pn,R as Ln,c as Fn,O as Mn,d as Vn,e as Bn,W as zn,f as _n,g as Un,h as jn,U as Xn}from"../chunks/index-BWi3du_1.js";import{Y as Hn}from"../chunks/index-BYYemmZD.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"}],ei=[{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}],ti=[{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}],ai={[O.K8sAttributes]:({value:i,setValue:o,formErrors:l})=>(n(()=>{i[h.CollectContainerAttributes]||i[h.CollectReplicaSetAttributes]||i[h.CollectWorkloadId]||i[h.CollectClusterId]||i[h.LabelsAttributes]?.length||i[h.AnnotationsAttributes]?.length||(o(h.CollectContainerAttributes,!0),o(h.CollectReplicaSetAttributes,!0),o(h.CollectWorkloadId,!0),o(h.CollectClusterId,!0),o(h.LabelsAttributes,[]),o(h.AnnotationsAttributes,[]))},[]),e(a,{children:[t(g,{$gap:6,children:Gn.map(({id:a,label:n})=>e(g,{children:[t(f,{label:n,value:i[a]||!1,onChange:e=>o(a,e)}),t(y,{errorMessage:l[a]})]},a))}),t(w,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Yn,values:i[h.LabelsAttributes]||[],setValues:e=>o(h.LabelsAttributes,e),errorMessage:l[h.LabelsAttributes]}),t(w,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:qn,values:i[h.AnnotationsAttributes]||[],setValues:e=>o(h.AnnotationsAttributes,e),errorMessage:l[h.AnnotationsAttributes]})]})),[O.AddClusterInfo]:({value:n,setValue:i,formErrors:o})=>{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=>i(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=>i(h.ClusterAttributes,e),errorMessage:o[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:i,formErrors:o})=>(n(()=>{a[h.PiiCategories]?.length||i(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]||[],o=t?[...n,e]:n.filter(t=>t!==e);i(h.PiiCategories,o)}},e))}),t(y,{errorMessage:o[h.PiiCategories]})]})),[O.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[h.FallbackSamplingRatio],o=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:o,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:i})},[O.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[h.SamplingPercentage],o=S(e[h.SamplingPercentage])?"":String(e[h.SamplingPercentage]);return t(v,{name:"samplingPercentage",label:"Sampling percentage",type:C.Number,min:0,max:100,value:o,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:i})},[O.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[h.EndpointsFilters],o=e[h.EndpointsFilters]||[];return t(w,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Jn,values:o,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:i})},[O.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[h.ServicesNameFilters],o=e[h.ServicesNameFilters]||[];return t(w,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:ei,values:o,setValues:e=>{a(h.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:i})},[O.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const i=n[h.AttributeFilters],o=(e[h.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n})=>{const i=Object.entries(n).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i,operation:n[i]?.operation,expectedValue:n[i]?.expectedValue,jsonPath:n[i]?.jsonPath}});return t(w,{name:"attributeFilters",limitFieldsPerRow:2,columns:ti,values:o,setValues:e=>{a(h.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:i,expectedValue:o,jsonPath:l})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:i,expectedValue:o}}};return l&&(s.condition[n].jsonPath=l),s}))},errorMessage:i})},[O.URLTemplatization]:({value:n,setValue:o,formErrors:l})=>{const s=m(),r=n[Qn]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>o(Qn,e),d=(e,t)=>c(r.map((a,n)=>n===e?{...a,...t}:a));return e(a,{children:[r.map((a,n)=>e(i,{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(Ha,{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:l[Qn]})]},`url-templatization-group-${n}`)),t(E,{variant:R.Secondary,label:"Add rule group",leftIcon:Wa,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(I,{})]})}},ni=({actionType:e,value:a,setValue:n,formErrors:i})=>{if(!e)return null;const o=ai[e];return o?t(o,{value:a,setValue:n,formErrors:i}):null},ii=()=>{const a=m(),{selectedOption:n,genericForm:i}=P();if(!i||!n)return t(L,{title:"No active form"});const{formData:o,handleFormChange:l,formErrors:s}=i;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(F,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Ga,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ka,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ya,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>l("disabled",e)}),t(En,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:o.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:o.name||"",onChange:({target:{value:e}})=>l("name",e),errorMessage:s.name}),t(ni,{actionType:n.type,value:o.fields,setValue:(e,t)=>l(`fields.${e}`,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes||"",onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},oi=({signals:e,fields:a,disabled:n,formData:i,handleFormChange:o,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,i.fields)))return null;const b=c,f=i.fields.find(e=>e.key===b),y=f?f.value:m;return t($n,{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=>o(b,e)},b)}),li=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 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)`
|
|
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
|
-
`,si=o(({testConnection:a,isEdit:i},o)=>{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(o,()=>({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:Ga,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ka,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ya,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(En,{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(oi,{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}),!i&&e(li,{$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:qa,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:Ja,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(L,{title:"No active form"})});si.displayName="AddDestinationForm";const ri=[{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."}],ci=[{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."}],di=["*"],ui=[{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:""}],pi={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},mi={[ae.CodeAttributes]:({value:i,setValue:o,formErrors:l})=>{const s=m(),c=l.codeAttributes,d=r(()=>Object.entries(i.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]);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};o("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),{});o("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(F,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:ri.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(F,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:ci.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:i,setValue:o,formErrors:l})=>{const s=l.customInstrumentations,c=r(()=>(i?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[i]),d=r(()=>(i?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[i]);return n(()=>{i?.customInstrumentations||s||o("customInstrumentations",{[te.Golang]:pi[te.Golang],[te.Java]:pi[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),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,o("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Za,{}),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)),o("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:i})=>{const o=i.headersCollection,l=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{l.length||o||s(di)},[]),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:o})},[ae.PayloadCollection]:({value:a,setValue:i,formErrors:o})=>{const l=m(),s=o.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]:{}};i("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(F,{size:M.XS,color:l.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:ui.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};i("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},hi=({ruleType:e,value:a,setValue:n,formErrors:i})=>{if(!e)return null;const o=mi[e];return o?t(o,{value:a,setValue:n,formErrors:i}):null},gi=()=>{const a=m(),{selectedOption:n,genericForm:i}=ne();if(!i||!n)return t(L,{title:"No active form"});const{formData:o,handleFormChange:l,formErrors:s}=i;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(F,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Ga,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(F,{size:M.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(ie,{label:oe[e],leftIcon:le(e),status:X.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ka,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ya,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:o.disabled,setSelected:e=>l("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:o.ruleName,onChange:({target:{value:e}})=>l("ruleName",e),errorMessage:s.ruleName}),t(hi,{ruleType:n.type,value:o,setValue:(e,t)=>l(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:o.notes,onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},bi=p.div`
|
|
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`
|
|
9
9
|
display: flex;
|
|
10
10
|
flex-direction: column;
|
|
11
11
|
gap: 24px;
|
|
12
|
-
`,
|
|
12
|
+
`,fo=()=>{const e=se();switch(e.formType){case re.Create:return t(yo,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions});case re.View:return e.data?e.isEditing?t(yo,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions}):t(vo,{data:e.data}):null;case re.EditAutoNoisy:return t(Co,{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(Co,{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(bo,{children:t($n,{title:e.localEnabled?void 0:ce,summary:e.summary})})}},yo=({category:a,formData:n,onChange:o,sourceOptions:i,namespaceOptions:l})=>e(bo,{children:[t(On,{category:a,formState:n}),t(Pn,{category:a,formState:n,onChange:o}),t(Fn,{formState:n,onChange:o,sourceOptions:i,namespaceOptions:l}),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})]}),vo=({data:a})=>e(bo,{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})]}),Co=({enabled:a,summary:n,inactiveTitle:o,sectionTitle:i,sectionSubTitle:l,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(bo,{children:[t($n,{title:a?void 0:o,summary:n}),t(ye,{richTitle:{title:i,subTitle:l},children:t(Rn,{description:s,options:xn,selected:d,onSelect:h,customName:r,customLabel:ve,customPlaceholder:"5%",customValue:p,onCustomChange:g})})]})},So=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
|
+
`,wo=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
|
+
`,ko=({dataId:a,icon:n,title:o,description:i,withCarret:l,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:h,onCheckboxChange:b})=>{const y=m();return e(So,{"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(wo,{children:t(n,{size:20})}),t(L,{size:M.XS,children:o})]}),i&&t(L,{size:M.XXXS,color:y.v2.colors.silver[200],children:i})]}),(l||c)&&e(D,{$gap:8,children:[c,l&&t(Za,{size:18})]})]})},To=p.div`
|
|
33
33
|
display: flex;
|
|
34
34
|
align-items: center;
|
|
35
35
|
gap: 8px;
|
|
36
36
|
padding: 8px;
|
|
37
|
-
`,
|
|
37
|
+
`,No=({onClose:a,selectedConnectionIds:n,setSelectedConnectionIds:o,createAction:i,withOverlay:s})=>{const c=m(),[u,p]=l(""),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(To,{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(ko,{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(no,{},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 i(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}})},Ao=({testConnection:e})=>{const{activeForm:a}=U();return{width:"60%",list:a?[t(lo,{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")]}},Io=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
|
+
`,Do=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
|
+
`,Eo=({title:a,tooltip:n,list:o,noBgColor:i,purpleColors:s})=>{const[r,c]=l(!0);return e(Io,{"data-id":`collapse-${a}`,$noBgColor:i,$purpleColors:s,children:[e(Do,{$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?j.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]})},$o=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||G(e.supportedSignals).includes(a.signalType))):e,Ro=({option:e,formData:a,testResult:n,isSelected:o,onSelect:i})=>t(ko,{icon:$e(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:o,onClick:()=>i(),children:n&&t(oe,{status:n.succeeded?j.Success:j.Error,leftIcon:n.succeeded?on:ln})}),xo=({listType:e,destinationOptions:a,unsavedDestinations:n})=>{const{activeForm:o,onChangeActiveForm:i}=U();return a?.length?t(Eo,{title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:a.map((a,n)=>t(Ro,{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:()=>i({listType:e,option:a})},`${e}-${a.id??a.type}-${n}`))}):n?.length?t(Eo,{purpleColors:!0,title:Ee[e].TITLE,tooltip:Ee[e].DESCRIPTION,list:n.map(({option:a,formData:n,testResult:l},s)=>t(Ro,{option:a,formData:n,testResult:l,isSelected:o?.unsavedIdx===s&&o?.listType===e,onSelect:()=>i({listType:e,option:a,unsavedIdx:s})},`${e}-${s}`))},e):void 0},Oo=({isFetchingCategories:e,isFetchingPotentialDestinations:a,destinationsByCategory:n,searchText:o,filters:i})=>{const{unsavedDestinations:l}=U();return{width:"40%",list:r(()=>{const s=[];l.length&&s.push(t(xo,{listType:Ie.UNSAVED,unsavedDestinations:l},"unsaved"));for(const e of Object.values(Ie)){if(i.categoryType&&i.categoryType!==e)continue;const a=$o(n[e],o,i);a.length&&s.push(t(xo,{listType:e,destinationOptions:a},e))}return(e||a)&&s.push(t(ke,{children:t(De,{title:"Fetching destinations",withSpinner:!0})},"loading-more")),s},[l,n,o,i,e,a])}},Po=({destinationsByCategory:n,filters:o,setFilters:i})=>{const l=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:l,values:o.categoryType?[o.categoryType]:[],setValues:e=>i({...o,categoryType:o.categoryType===e[0]?null:e[0]})}),t(B,{size:xe.S,options:s,selected:o.signalType,setSelected:e=>i({...o,signalType:e})})]})};var Fo;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(Fo||(Fo={}));const Lo=(e,t)=>{const a=[],n=[],o=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===Fo.SELF_HOSTED?n.push(...e.items):e.name===Fo.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]))}}}),{detectedDestinations:a,selfHostedDestinations:n,managedDestinations:o}},Mo=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getDestinationCategories:r,getPotentialDestinations:d,initialInputs:u,testConnection:p,createDestination:m,updateDestination:h,withOverlay:g,disableAnimation:b})=>{const[f,y]=l(""),[v,C]=l({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]=l(!0),[E,$]=l(!0),[R,x]=l([]),[O,P]=l({[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 R){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})):[]}});P(t=>({...t,[Ie.EXISTS]:e}))},[S,R]);const F=c(async()=>{try{D(!0),$(!0);const e=await r();e&&x(e.destinationCategories.categories);const{selfHostedDestinations:t,managedDestinations:a}=Lo(e);P(e=>({...e,[Ie.SELF_HOSTED]:t,[Ie.MANAGED]:a})),D(!1);const n=await d(),{detectedDestinations:o}=Lo(e,n);P(e=>({...e,[Ie.DETECTED]:o}))}catch(e){}finally{D(!1),$(!1)}},[]);n(()=>{F()},[]);const L=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,i)}return m(a,i)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[N,i,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:L,disableSave:!w&&!N.length,isFetching:I||E,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:i&&s?{value:i,setValue:s}:void 0,search:{value:f,onChange:y},filters:t(Po,{destinationsByCategory:O,filters:v,setFilters:C}),leftColumn:Oo({isFetchingCategories:I,isFetchingPotentialDestinations:E,destinationsByCategory:O,searchText:f,filters:v}),rightColumn:Ao({testConnection:p})})},Vo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:n,createInstrumentationRule:o,withOverlay:i})=>{const[s,c]=l(""),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(ko,{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(go,{},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:i,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}})},Bo=p.div``,zo=p.div`
|
|
51
51
|
visibility: hidden;
|
|
52
52
|
|
|
53
53
|
transition: visibility 0s;
|
|
@@ -55,19 +55,19 @@ 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
|
+
${Bo}:hover & {
|
|
59
59
|
visibility: visible;
|
|
60
60
|
}
|
|
61
|
-
`,
|
|
61
|
+
`,_o=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:i,disabledReason:l})=>{const s=m(),r=()=>{};return t(Bo,{children:t(ko,{dataId:`source-${e}`,title:e,disabled:i,onClick:i?r:o,isChecked:n,onCheckboxChange:i?r:o,children:i&&l?t(oe,{label:l,status:j.Default,textSize:M.XXXS}):t(zo,{children:t(oe,{label:a,status:j.Info,textSize:M.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},Uo=({formData:a,handleSourceChange:n,handleSelectAll:o,selectedArea:i,searchText:l,searchBy:s,filters:c})=>{const{tier:d}=Me(),u=d===_e.Onprem,p=r(()=>i.value.namespaceName?a.find(({clusterId:e})=>e===i.value.clusterId)?.namespaces.find(({name:e})=>e===i.value.namespaceName):void 0,[a,i.value.clusterId,i.value.namespaceName]),m=r(()=>p?[...p.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ve(e,l,c)):[],[p,l,c]),h=r(()=>!!m.length&&m.every(({selected:e})=>e),[m]),g=r(()=>{if(!p)return[];const{clusterId:e}=i.value,{name:a}=p;return m.map(({name:o,selected:i,kind:l})=>{const s=!u&&Be.has(l);return t(_o,{workloadName:o,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:a,name:o,kind:l}}),disabled:s,disabledReason:"Enterprise only"},`${e}#${a}#${o}#${l}`)})},[m,p,i.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:i.value.namespaceName?`${i.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:i.value.clusterId,namespaceName:i.value.namespaceName,boolean:!h,searchText:l,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?l?{icon:rn,title:"No matches",subTitle:`No sources matched the filter '${l}'`}:{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``,jo=p.div`
|
|
62
62
|
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
63
63
|
|
|
64
64
|
transition: visibility 0s;
|
|
65
65
|
${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
|
|
66
66
|
|
|
67
|
-
${
|
|
67
|
+
${Xo}:hover & {
|
|
68
68
|
visibility: visible;
|
|
69
69
|
}
|
|
70
|
-
`,Hi=({clusterId:a,namespaceName:n,checkbox:i,isFutureApps:o,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(ji,{children:t(ki,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:i.partial,isChecked:i.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(D,{$gap:12,children:[t(Xi,{$visible:s||o,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:o,onChange:e=>u({auto:e,all:e||void 0})})})}),e(D,{$gap:8,children:[t(F,{variant:je.Span,size:M.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(ie,{label:`${l.sourced}/${l.total}`,status:s?X.Default:ze.Unknown,minWidth:"42px"})]})]})})})},Wi=({withCollapse:e,clusterId:a,clusterName:n,namespaces:i,selectedArea:o,setSelectedArea:l,handleSourceChange:s})=>{const c=r(()=>i.map(({name:e,totalWorkloads:i,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Hi,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:i},isActive:o.clusterId===a&&o.namespaceName===e,onActive:()=>l({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,i,o]);return e?t(Ei,{title:n,list:c,noBgColor:!0}):c},Gi=({isFetching:a,formData:n,handleSourceChange:i,handleSelectAll:o,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=>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(Wi,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:l,setSelectedArea:s,handleSourceChange:i},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(F,{size:M.XS,nowrap:!0,children:"Namespaces"}),t(q,{text:g?Te.FILTERED_COUNT_TOOLTIP:void 0,children:t(ie,{label:`${g?`${b} / ${f}`:f}`,status:ze.Unknown})})]}),t(F,{"data-id":"namespaces-select-all",onClick:()=>o({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(L,c?{icon:dn,title:"No matches",subTitle:`No namespace matched the filter '${c}'`}:{icon:dn,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}},Ki=({onClose:a,onBack:i,onNext:o,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,L]=l({clusterId:"",clusterName:"",namespaceName:""});return t(zn,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:a?()=>{f(Ye.BulkInstrumenting),a()}:void 0,onBack:i?()=>i(N):void 0,onNext:o?()=>o(N):void 0,nextIsSkip:!A,onSave:()=>c(N),header:{icon:cn,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&&L({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(F,{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:Gi({isFetching:y,formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:P,setSelectedArea:L,searchText:$===Ke.Namespace?I:"",searchBy:$,filters:x}),rightColumn:Ui({formData:S,handleSourceChange:w,handleSelectAll:k,selectedArea:{value:P},searchText:$===Ke.Source?I:"",searchBy:$,filters:x})})},Yi=({onClose:i,actionId:o,updateAction:s,deleteAction:d})=>{const u=m(),{actions:p}=Le(),{selectedOption:h,loadAction:b,validateFormData:f}=P(),[y,v]=l(!1),[C,S]=l(!1),w=r(()=>p?.find(e=>Qe(e)===o),[o,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),i())},[w,d,i]);if(!w||!T)return null;const $=(e=>{const t=[],{type:a,fields:n}=e,i=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:i(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:i(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:i(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:i(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:a,from:i,fromSources:o},l)=>{const s=o?.length?o.join(", "):i||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:i,fromSources:o},l)=>{const s=o?.length?o.join(", "):i||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:i(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:i,fallbackSamplingRatio:o},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(i)}),t.push({id:`endpoint-${l}-fallback`,title:`${s}Fallback Sampling Ratio`,label:String(o)})}),a===O.ServiceNameSampler&&n.servicesNameFilters?.forEach(({serviceName:e,samplingRatio:a,fallbackSamplingRatio:i},o)=>{const l=(n.servicesNameFilters?.length??0)>1?`Filter #${o+1} `:"Filter ";t.push({id:`service-${o}-name`,title:`${l}Service Name`,label:e}),t.push({id:`service-${o}-ratio`,title:`${l}Sampling Ratio`,label:String(a)}),t.push({id:`service-${o}-fallback`,title:`${l}Fallback Sampling Ratio`,label:String(i)})}),a===O.SpanAttributeSampler&&n.attributeFilters?.forEach(({serviceName:e,attributeKey:a,fallbackSamplingRatio:i,condition:o},l)=>{const s=Object.keys(o)[0],r=o[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(i)}),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 i=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${a+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${a}-ns`,title:`${i}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,o)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${a}-wf-${o}`,title:`${i}Workload${(e.workloadFilters?.length??0)>1?` #${o+1}`:""}`,label:l})});const o=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");o&&t.push({id:`group-${a}-templates`,title:`${i}Templates`,label:o}),e.notes&&t.push({id:`group-${a}-notes`,title:`${i}Notes`,label:e.notes})}),t})(w);return e(a,{children:[t(Ze,{isOpen:!0,header:{icon:it(w.type),title:T.label,onClose:i,actions:[{id:"edit-action-btn-edit",label:et.EDIT,icon:Ja,active:y,onClick:N},{id:"edit-action-btn-delete",label:et.DELETE,icon:Ha,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(ii,{}):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,L=T,[{id:"type",title:Te.TYPE,label:L.label},{id:"status",title:Te.STATUS,badge:{status:x.disabled?ze.Unknown:X.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(_n,{target:"action",isOpen:C,onClose:()=>S(!1),onApprove:E})]});var x,L},qi=({onClose:a,connections:i,selectedConnectionIds:o,setSelectedConnectionIds:s,getEffectiveConfig:c,onApply:d})=>{const u=m(),[p,h]=l(""),[g,b]=l({showOnlySelected:!1}),f=r(()=>i.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&o.includes(e.id);return t&&a}),[i.length,o.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}=ot(S||{rollout:{automaticRolloutDisabled:!1}}),E=r(()=>o.length>1||void 0!==S&&!A(S,k),[o.length,S,k]);return n(()=>{1===o.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)})(o[0]):w(void 0)},[o.length]),t(zn,{isOpen:!0,onClose:a,onSave:()=>d(k,o),header:{icon:un,title:"Cluster Configuration"},connectionIds:{value:o,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(D,{$gap:8,children:[t(F,{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(F,{size:M.XS,children:"Clusters"}),t(ie,{label:f.length,status:ze.Unknown})]}),e(D,{$gap:8,children:[t(F,{size:M.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(ie,{label:`${o.length}/${f.length}`,status:ze.Unknown})]})]}),list:f.map(e=>t(ki,{title:e.name,isChecked:o.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(F,{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")]}})},Ji=({onClose:i,destinationId:o,getDestinationCategories:s,testConnection:u,updateDestination:p,deleteDestination:h})=>{const b=m(),{destinations:f}=Le(),{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)===o),[o,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]),L=c(()=>{O&&T(!0)},[O]),F=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),i())},[O,h,i]);if(!O)return null;const{icon:z,iconSrc:j}=$e(O.destinationType.type),H=((e,t)=>{const a=[],n=lt(e,t),i=n.map(e=>({name:e.key,value:e.value})),o=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,o,i))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},i)=>{t==l&&a.push({id:`${e}-custom-${i}`,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:j,title:O.name||O.destinationType.displayName,onClose:i,actions:[{id:"edit-destination-btn-edit",label:et.EDIT,icon:Ja,active:k,onClick:L},{id:"edit-destination-btn-delete",label:et.DELETE,icon:Ha,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:F},...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(si,{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:X.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(_n,{target:"destination",isOpen:N,onClose:()=>A(!1),onApprove:B})]});var G},Qi=({onClose:i,ruleId:o,updateInstrumentationRule:s,deleteInstrumentationRule:d})=>{const u=m(),{instrumentationRules:p}=Le(),{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)===o),[o,p]),T=r(()=>Fe.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:X.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:X.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),i())},[k,d,i]);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(F,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,a])=>{a&&n.push(t(F,{size:M.XS,children:`• ${dt(e).toLowerCase()}`},e))}),e.headersCollection?.[J.HeaderKeys]?.length&&e.headersCollection[J.HeaderKeys].forEach(e=>{e&&n.push(t(F,{size:M.XS,children:e},e))}),e.customInstrumentations&&(e.customInstrumentations[te.Java]?.forEach((e,i)=>{const o=new ee(e.className,e.methodName);if(o.Verify()){0===i&&n.push(t(F,{size:M.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=o.toString();n.push(t(F,{size:M.XXS,color:a.v2.colors.grey[200],children:`• ${e}`},e))}}),e.customInstrumentations[te.Golang]?.forEach((e,i)=>{const o=new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(o.Verify()){0===i&&n.push(t(F,{size:M.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=o.toString();n.push(t(F,{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:i,actions:[{id:"edit-rule-btn-edit",label:et.EDIT,icon:Ja,active:v,onClick:N},{id:"edit-rule-btn-delete",label:et.DELETE,icon:Ha,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(gi,{}):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:X.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:oe[e],leftIcon:le(e),flex:"0.5"},e))})})})]})})})}),t(_n,{target:"instrumentation rule",isOpen:S,onClose:()=>w(!1),onApprove:$})]});var O,P},Zi=p.div`
|
|
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`
|
|
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
|
+
`,ei=p.div`
|
|
81
81
|
flex: 1;
|
|
82
|
-
`,
|
|
82
|
+
`,ti=({onClick:a})=>{const n=m().v2.colors.red[500];return e(Zo,{"data-id":"sampling-view-btn-delete",onClick:a,children:[t(L,{size:M.XS,weight:500,color:n,children:yt}),t(ja,{size:16,fill:n})]})};function ai(n){if(n.isEditing){const{onCancelEdit:o,onSave:i,onDelete:l,duplicateWarning:s}=n;return{children:e(a,{children:[t(ti,{onClick:l}),s&&t(X,{status:j.Warning,message:s.message,action:s.onViewRule?{"data-id":"sampling-view-edit-btn-view-duplicate",label:"View rule",onClick:s.onViewRule}:void 0}),t(ei,{}),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:i,disabled:!!s})]})}}const{onDelete:o,onCancel:i,onEdit:l}=n;return{children:e(a,{children:[t(ti,{onClick:o}),t(ei,{}),t(E,{"data-id":"sampling-view-btn-cancel",label:gt,variant:R.Secondary,size:$.S,onClick:i}),t(E,{"data-id":"sampling-view-btn-edit",label:ft,variant:R.Primary,size:$.S,onClick:l})]})}}const ni={[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 oi(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 ii=({isOpen:e,title:a,subTitle:n,onClose:o,toggleProps:i,footer:l,renderBody:s})=>t(Ze,{isOpen:e,width:xt,header:{icon:un,title:a,subTitle:n,onClose:o,toggleProps:i},footer:l,children:s?s():t(tt,{$padding:"12px",children:t(fo,{})})}),li=({isOpen:e,onClose:a,onSubmit:o,validateForm:i,onNavigateToDuplicate:l})=>{const{category:s,formData:r,handleChange:d,resetForm:u,duplicateWarning:p,setDuplicateWarning:m}=se(re.Create);n(()=>{e&&u()},[e]);const h=c(()=>{if(i){const e=i(r);if(e)return void m(e)}o(r)},[r,o,i,m]),g={note:p?{status:j.Warning,message:p.message,action:l?{"data-id":"sampling-create-btn-view-duplicate",label:"View rule",onClick:()=>l(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(ii,{isOpen:e,title:Tt[s],subTitle:Ct[s],onClose:a,toggleProps:oi({name:"sampling-toggle-rule-enabled",value:!r.disabled,onChange:e=>d({disabled:!e})}),footer:g})},si=({onClose:e,onDelete:a,onSaveEdit:n,validateForm:o,onNavigateToDuplicate:i})=>{const{data:l,isEditing:s,formData:d,handleEdit:u,handleCancelEdit:p,duplicateWarning:m,setDuplicateWarning:h}=se(re.View),g=l?.rule.name||wt,b=s&&l?St[l.category]:`${g} preview`,f=c(()=>{if(l&&s){if(o){const e=o(d);if(e)return void h(e)}n(d,l.rule.ruleId,l.samplingId)}},[l,s,d,n,o,h]),y=c(()=>{l&&a(l.rule.ruleId,l.samplingId)},[l,a]),v=r(()=>{if(!l)return;const t=m?{message:m.message,onViewRule:i?()=>i(m.ruleId):void 0}:null;return ai(s?{isEditing:!0,onCancelEdit:p,onSave:f,onDelete:y,duplicateWarning:t}:{isEditing:!1,onDelete:y,onCancel:e,onEdit:u})},[l,s,m,p,f,y,u,e,i]);return t(ii,{isOpen:!!l,title:b,subTitle:l?Ct[l.category]:"",onClose:e,footer:v})},ri=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:i,resolvedPercentage:l}=se(re.EditAutoNoisy),s=c(()=>n(o,l),[n,o,l]);return t(ui,{formType:re.EditAutoNoisy,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:i,onSave:s})},ci=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:i,resolvedPercentage:l}=se(re.EditAutoCostReduction),s=c(()=>n(o,l),[n,o,l]);return t(ui,{formType:re.EditAutoCostReduction,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:i,onSave:s})},di=({isOpen:e,onClose:a,onSave:n})=>{const{localEnabled:o,setLocalEnabled:i}=se(re.EditAutoHighlyRelevant),l=c(()=>n(o),[n,o]);return t(ui,{formType:re.EditAutoHighlyRelevant,isOpen:e,onClose:a,localEnabled:o,setLocalEnabled:i,onSave:l})},ui=({formType:e,isOpen:a,onClose:n,localEnabled:o,setLocalEnabled:i,onSave:l})=>{const s=ni[e];return t(ii,{isOpen:a,title:s.title,subTitle:s.subTitle,onClose:n,toggleProps:oi({name:s.toggleId,value:o,onChange:i}),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:l}]}})},pi=e=>{switch(e.formType){case re.Create:return t(vt,{formType:re.Create,category:e.category,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(li,{...e})});case re.View:return t(vt,{formType:re.View,data:e.data,defaultEditMode:e.defaultEditMode,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions,children:t(si,{...e})});case re.EditAutoNoisy:return t(vt,{formType:re.EditAutoNoisy,enabled:e.enabled,keepPercentage:e.keepPercentage,children:t(ri,{...e})});case re.EditAutoCostReduction:return t(vt,{formType:re.EditAutoCostReduction,enabled:e.enabled,dropPercentage:e.dropPercentage,children:t(ci,{...e})});case re.EditAutoHighlyRelevant:return t(vt,{formType:re.EditAutoHighlyRelevant,enabled:e.enabled,children:t(di,{...e})})}},mi=({token:n,isLoading:o,isEditing:i,onEdit:l,onCancel:s,onSave:r,formData:c,handleFormChange:d,handleErrorChange:u,formErrors:p})=>{const{CopyButton:m}=Lt(),h=!i||o||!c.newToken;return Mt({key:"Enter",active:!h},r),e(D,i?{$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:l})]})]})},hi=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:i}=Vt(),l=r(()=>i(e),[e]),s=r(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),c=r(()=>Bt(e,0)?j.Error:Bt(e,2592e6)?j.Warning:j.Success,[e]),d=r(()=>c===j.Success?on:c===j.Warning?pn:mn,[c]);return n(()=>{c===j.Success?a():c===j.Error&&o()},[c]),t(q,{text:s,children:t(oe,{leftIcon:d,label:l,status:c,invertColors:!0,useSecondaryTone:!0})})},gi=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
|
+
`,bi=({children:e})=>{const a=m();return t(L,{size:M.XXXS,color:a.v2.colors.grey[150],children:e})},fi=({token:a,updateToken:n})=>{const[o,i]=l(!1),[s,r]=l(!1),[c,d]=l(!1),{formData:u,handleFormChange:p,formErrors:m,handleErrorChange:h,resetFormData:b}=it({newToken:""});return t(ye,{richTitle:{icon:hn,title:"Odigos Pro Token"},children:e(gi,{$isExpired:c,children:[e(D,{$justifyContent:"space-between",children:[e(g,{$gap:4,children:[t(bi,{children:"Issued for"}),t(L,{size:M.XS,children:a.name||"N/A"})]}),e(g,{$gap:4,children:[t(bi,{children:"Expiration"}),t(hi,{expiresAt:a.expiresAt,callbackValid:()=>d(!1),callbackExpired:()=>d(!0)})]}),t(g,{})]}),t(D,{children:e(g,{children:[t(bi,{children:"Token"}),t(mi,{token:a.token,newToken:u.newToken,isLoading:s,isEditing:o,onEdit:()=>i(!0),onCancel:()=>(i(!1),r(!1),void p("newToken","")),onSave:()=>(async()=>{r(!0);const e=await n(u.newToken.trim());r(!1),e?.error?h("newToken",e.error):(i(!1),b())})(),formData:u,handleFormChange:p,handleErrorChange:h,formErrors:m})]})})]})})},yi=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
|
-
`,Co=({downloadDiagnose:a})=>{const n=m(),{progress:i}=We(),{namespaces:o}=Le(),[s,r]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=ot({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ye,{richTitle:{icon:bn,title:"Diagnose"},children:s?e(vo,{children:[t(De,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof i[Ye.DownloadingDiagnose]?.percentage,percentage:i[Ye.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof i[Ye.DownloadingDiagnose]?.percentage,visualIcon:fn,startedAt:s}),i[Ye.DownloadingDiagnose]?.list?.length&&t(g,{$width:"100%",children:i[Ye.DownloadingDiagnose].list.map(a=>e(D,{$gap:4,$alignItems:"center",children:[a.status===X.Success?t(ln,{size:16}):a.status===X.Error?t(sn,{size:16}):t(De,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(F,{size:M.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(g,{$gap:24,children:[t(F,{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(F,{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(F,{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(F,{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:o.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(ie,{label:c.sourceWorkloadNamespaces.length,status:X.Default}):void 0}}),t(D,{$justifyContent:"flex-end",children:t(E,{label:"Download Diagnose",rightIcon:fn,variant:R.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},So=({fetchDescribeOdigos:e})=>{const{platformType:a,version:i,tier:o}=Me(),[s,r]=l(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ye,{richTitle:{icon:yn,title:"General Information"},children:t(at,{cellsPerRow:2,items:[{id:jt(),title:"Odigos Version",label:i},{id:jt(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:jt(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:jt(),title:"Tier",label:o}]})})},wo=({isOpen:a,onClose:n,token:i,updateToken:o,fetchDescribeOdigos:l,downloadDiagnose:s})=>e(Ze,{isOpen:a,header:{icon:yn,title:"System Overview",onClose:n},children:[l&&t(So,{fetchDescribeOdigos:l}),o&&i&&t(yo,{token:i,updateToken:o}),s&&t(Co,{downloadDiagnose:s})]});var ko,To;!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"}(ko||(ko={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(To||(To={}));const No=[{key:To.Name,label:"Name"},{key:To.Type,label:"Type",textAlign:"right"},{key:To.Status,label:"Status"},{key:To.OdigosVersion,label:"Odigos Version"},{key:To.ConnectedSince,label:"Connected Since"},{key:To.LastActivity,label:"Last Activity"}],Ao=(e,t)=>{const a=e.find(e=>e.key===To.Id)?.rawValue;return t(a?.toString()||"")},Io=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:i,onAddSource:o,onAddDestination:l,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===To.Status)?.rawValue===X.Success)(e))return[{id:jt(),label:"Delete Connection",rightIcon:qa,onClick:()=>Ao(e,i)}];const d=Ao(e,e=>{const n=t.find(t=>t.id===e);return!!n&&Xt(n.odigosVersion,a)}),u=Ao(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Xt(a.odigosVersion,n)}),p=[];return o&&p.push({id:jt(),tooltip:u?Te.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:cn,disabled:!u,onClick:()=>Ao(e,o)}),l&&p.push({id:jt(),tooltip:Te.ADD_DESTINATION,rightIcon:an,onClick:()=>Ao(e,l)}),s&&p.push({id:jt(),tooltip:Te.ADD_ACTION,rightIcon:tn,onClick:()=>Ao(e,s)}),r&&p.push({id:jt(),tooltip:Te.ADD_INSTRUMENTATION_RULE,rightIcon:rn,onClick:()=>Ao(e,r)}),c&&p.push({id:jt(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:un,disabled:!d,onClick:()=>Ao(e,c)}),p}},Do=({tableRowsMaxHeight:a,connections:i,getConnections:o,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(i||[]),P=c(async()=>{try{E(!0),O(await o()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||P()},[]);const[L,F]=l(""),[M,V]=l(null),[B,z]=l([]),_=r(()=>M===ko.BulkConfig?u:M===ko.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===ko.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=>!L||e.name.toLowerCase().includes(L.toLowerCase())).map(e=>({cells:[{key:To.Id,rawValue:e.id},{key:To.Name,rawValue:e.name},{key:To.Type,rawValue:e.type},{key:To.Status,rawValue:e.status,component:()=>(e=>{const a=e===X.Success?"Connection live":"Connection lost",n=e===X.Success?ln:sn;return t(ie,{status:e,label:a,leftIcon:n})})(e.status)},{key:To.OdigosVersion,rawValue:e.odigosVersion},{key:To.ConnectedSince,rawValue:e.connectedAt?I(e.connectedAt):"-"},{key:To.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===ko.BulkConfig&&!Xt(e.odigosVersion,u)||M===ko.BulkSource&&!Xt(e.odigosVersion,g)})),[x,B,L,M,u,g]),W=r(()=>{const e=(e,t)=>{z([e]),V(t)};return Io({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,ko.Delete),onAddSource:!A&&b&&f?t=>e(t,ko.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?t=>e(t,ko.BulkDestination):void 0,onAddAction:!A&&k?t=>e(t,ko.BulkAction):void 0,onAddInstrumentationRule:!A&&T?t=>e(t,ko.BulkInstrumentationRule):void 0,onEditConfiguration:!A&&p&&h?t=>e(t,ko.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:i,onAddInstrumentationRule:o,onManageConfigurations:l}=e,s=[];a&&s.push({id:jt(),type:Ht.Button,buttonProps:{variant:R.Primary,size:$.S,label:"Add Sources",rightIcon:cn,onClick:a}});const r=[n?{id:ko.BulkDestination,label:Te.ADD_DESTINATION,icon:an}:null,i?{id:ko.BulkAction,label:Te.ADD_ACTION,icon:tn}:null,o?{id:ko.BulkInstrumentationRule,label:Te.ADD_INSTRUMENTATION_RULE,icon:rn}:null,l?{id:ko.BulkConfig,label:"Manage Configurations",icon:un}:null];return r.some(Boolean)&&s.push({id:jt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===ko.BulkSource?a?.():e===ko.BulkDestination?n?.():e===ko.BulkAction?i?.():e===ko.BulkInstrumentationRule?o?.():e===ko.BulkConfig&&l?.()}},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(ko.BulkSource):void 0,onAddDestination:!A&&y&&v&&S?()=>V(ko.BulkDestination):void 0,onAddAction:!A&&k?()=>V(ko.BulkAction):void 0,onAddInstrumentationRule:!A&&T?()=>V(ko.BulkInstrumentationRule):void 0,onManageConfigurations:!A&&p&&h?()=>V(ko.BulkConfig):void 0}),[A,p,h,b,f,y,v,S,k,T]);return t(Wt,{children:e(ye,{richTitle:{icon:Cn,title:Te.CONNECTIONS,badge:{label:x.length.toString(),status:ze.Unknown}},search:{placeholder:"Search by cluster name",value:L,onChange:e=>F(e),width:"300px"},actions:[{id:jt(),type:Ht.Button,buttonProps:{variant:R.Secondary,size:$.S,leftIcon:vn,onClick:P,disabled:D}}],children:[t(Gt,{variant:Kt.Pretty,maxHeight:a,headerBackgroundColor:N.v2.colors.silver[1e3],isLoading:D,withCheckboxes:!0,columns:No,rows:H,rowActionsPushRightPosition:M?`calc(${Un} - 24px)`:void 0,getRowActions:W}),M===ko.BulkConfig&&p&&h&&t(qi,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:z,getEffectiveConfig:p,onApply:h}),M===ko.BulkSource&&b&&f&&t(Yt,{selectedConnectionIds:B,children:t(Ki,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,getAllClusterSnapshots:b,persistSources:async e=>await(f?.(e))})}),M===ko.BulkDestination&&y&&v&&C&&S&&w&&t(qt,{children:t(Mi,{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===ko.BulkAction&&k&&t(Jt,{children:t(Ni,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createAction:e=>k(e,B)})}),M===ko.BulkInstrumentationRule&&T&&t(Qt,{children:t(Vi,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:z,createInstrumentationRule:e=>T(e,B)})}),t(_n,{target:"connection",isOpen:M===ko.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:Ka,title:"Selected Clusters",badge:{label:B.length}},actions:G})]})})},Eo=p.div`
|
|
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`
|
|
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
|
+
`,Ei=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
|
+
`,$i=({setStep:a,onSave:n,sourcesPayload:o,destinationsPayload:i,disableAnimation:l})=>{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 i=a.kind||Ke.Namespace,l=i===Ke.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(Di,{children:[t(L,{nowrap:!0,children:l}),t(oe,{label:i,status:j.Info,backgroundColor:s.v2.colors.blue[900]})]},`source-${n}-${o}`)})).filter(Boolean),[o]),p=r(()=>i?.map((a,n)=>{const o=$e(a.option.type).icon;return e(Di,{children:[e(D,{$gap:8,children:[o&&t(Ei,{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?j.Success:j.Error,leftIcon:a.testResult.succeeded?on:ln})]},`destination-${n}`)})||[],[i]);return t(Bn,{isOpen:!0,disableAnimation:l,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")]}})},Ri=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
|
+
`,xi=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
|
+
`,Oi=[{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"}],Pi=[{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:Oi},{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:Oi},{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:Oi}],Fi=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:i})=>{const[s,c]=l(window.innerWidth),d=r(()=>s/Pi[0].width,[s]);return n(()=>{const e=()=>c(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(Ri,{$paddingXAxis:a,$paddingYAxis:o,children:[Pi.map(({width:a,height:n,pathOpacity:o,path:i,gradientTransform:l,stops:s},r)=>{const c=`purple-ring-${r}`;return e(xi,{width:a*d,height:"100%",viewBox:`0 0 ${a} ${n}`,fill:"none",children:[t("path",{opacity:o,d:i,fill:`url(#${c})`}),t("defs",{children:t("radialGradient",{id:c,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:l,children:s.map(({offset:e,opacity:a},n)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},n))})})]},c)}),i]})},Li=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
|
+
`,Mi=p.div`
|
|
139
139
|
display: flex;
|
|
140
140
|
flex-direction: column;
|
|
141
141
|
align-items: center;
|
|
@@ -145,30 +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
|
+
`,Vi=({onStart:a})=>t(Ze,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ke,{$height:"100%",children:e(Li,{children:[e(Mi,{children:[t(L,{size:M.L,weight:500,children:Te.GET_STARTED_WITH}),t(Un,{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})]})})}),Bi=[{step:1,label:Te.INSTALLATION,forceDoneBadge:!0},{step:2,label:Te.SOURCES_SETUP},{step:3,label:Te.DESTINATIONS_SETUP},{step:4,label:Te.SUMMARY}],zi=p.div`
|
|
149
149
|
display: flex;
|
|
150
150
|
flex-direction: column;
|
|
151
151
|
gap: 32px;
|
|
152
152
|
padding: 64px;
|
|
153
|
-
`,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
justify-content: space-between;
|
|
157
|
-
width: calc(100% - 24px);
|
|
158
|
-
padding: 8px 12px;
|
|
153
|
+
`,_i=({pagePaddingXAxis:a,pagePaddingYAxis:n,fetchNamespacesWithWorkloads:o,persistSources:i,getDestinationCategories:s,getPotentialDestinations:r,testConnection:c,createDestination:d,updateDestination:u,onDone:p})=>{const[m,h]=l(1),[g,b]=l(!1),[f,y]=l(null),[v,C]=l(null),S=()=>h(e=>e+1),w=()=>h(e=>e-1);return e(Fi,{paddingXAxis:a,paddingYAxis:n,children:[e(zi,{children:[t(Un,{}),t(ea,{currentStep:m,data:Bi,gap:32})]}),t(Yt,{initialInputs:f,children:e(qt,{children:[1===m&&t(Vi,{onStart:S}),2===m&&t(Ko,{disableAnimation:!0,onBack:e=>{y(e),w()},onNext:e=>{y(e),S()},fetchNamespacesWithWorkloads:o,persistSources:i}),3===m&&t(Mo,{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($i,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!g){b(!0);try{const e=[];f&&e.push(i(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 Ui;!function(e){e.Gateway="gateway",e.Node="node"}(Ui||(Ui={}));const Xi=({onClickDownloadDiagnose:a,onClickRefresh:n,loading:o,disabled:i})=>{const l=r(()=>{const e=[];return a&&e.push({id:Xt(),type:Ht.Button,buttonProps:{label:"Download Diagnose",leftIcon:bn,size:$.S,variant:R.Text,onClick:a,disabled:i}}),n&&e.push({id:Xt(),type:Ht.Button,buttonProps:{label:"Refresh",leftIcon:yn,size:$.S,variant:R.Text,onClick:n,disabled:i,loading:o}}),e},[a,n,i,o]);return e(D,{$alignItems:"center",$justifyContent:"space-between",children:[t(ta,{icon:wn,title:"Collectors Pipeline"}),t(aa,{actions:l})]})},ji=({pod:a,getExtendedPodInfo:o,onClose:i})=>{const{formatTimeAgo:s}=Vt(),[c,d]=l(null);n(()=>{a?o(a.namespace,a.name).then(e=>d(e??null)):d(null)},[a]);const u=r(()=>[{id:Xt(),title:"Node",label:c?.node??"-",withCopy:!0},{id:Xt(),title:"Status",badge:{status:na(c?.status),label:c?.status??"-"}}],[c]),p=r(()=>c?.containers?.map(e=>({id:Xt(),items:[{id:Xt(),title:"Container",label:e.name??"-"},{id:Xt(),title:"Status",label:e.startedAt?`${e.status} (since ${s(e.startedAt)})`:e.status},{id:Xt(),title:"Ready",badge:{status:e.ready?j.Success:j.Error,leftIcon:e.ready?Ga:Ka,label:e.ready?"True":"False",invertColors:!0}},{id:Xt(),title:"Started",badge:{status:e.started?j.Success:j.Error,leftIcon:e.started?Ga:Ka,label:e.started?"True":"False",invertColors:!0}},{id:Xt(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Xt(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Xt(),title:"Restarts",label:e.restarts.toString()},{id:Xt(),title:"State Reason",label:e.stateReason??"-"},{id:Xt(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Xt(),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:i},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(jn,{bgTint:"900",yaml:c.manifestYAML,defaultOpen:!0})]}):t(ke,{$height:"50vh",children:t(De,{withSpinner:!0})})})};var Hi;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Hi||(Hi={}));const Wi=[{key:Hi.PodName,label:"Pod Name"},{key:Hi.Status,label:"Status"},{key:Hi.Restarts,label:"Restarts"},{key:Hi.NodeName,label:"Node Name"},{key:Hi.Age,label:"Age"},{key:Hi.DockerImage,label:"Collector Version"}],Gi=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:i})=>{const s=m(),{formatTimeAgo:c}=Vt(),[d,u]=l(null),p=r(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:Hi.PodName,rawValue:a.name},{key:Hi.Status,rawValue:a.status,component:()=>{return e=a.status,t(oe,{status:na(e),label:e});var e}},{key:Hi.Restarts,rawValue:a.restartsCount.toString()},{key:Hi.NodeName,rawValue:a.nodeName},{key:Hi.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(L,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),i=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,l=i>0?j.Error:j.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?j.Error:j.Success;return e(D,{$gap:4,children:[t(q,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(oe,{status:l,label:`Receiver ${i}%`,leftIcon:l===j.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===j.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Hi.Age,rawValue:c(a.creationTimestamp)},{key:Hi.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:Wi,rows:p}),t(ji,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})},Ki=({isOpen:e,onClose:a,title:n,yaml:o})=>t(Ze,{isOpen:e,header:{icon:An,title:n,onClose:a},children:t(jn,{yaml:o,defaultOpen:!0})}),Yi=e=>{switch(e){case ia.Healthy:return"All desired replicas are updated, available, and ready";case ia.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ia.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ia.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ia.Down:return"No available replicas";case ia.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}};var qi;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(qi||(qi={}));const Ji=p.div`
|
|
154
|
+
flex: 0.5;
|
|
155
|
+
padding: 12px;
|
|
159
156
|
border-radius: 12px;
|
|
160
157
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
161
|
-
|
|
162
|
-
&:hover {
|
|
163
|
-
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
164
|
-
}
|
|
165
|
-
`,Xo=p.div`
|
|
166
|
-
animation-name: ${ia.in};
|
|
167
|
-
`,Ho=({pod:i,getExtendedPodInfo:o,onClose:s})=>{const{formatTimeAgo:c}=Vt(),[d,u]=l(null),[p,m]=l(!1);n(()=>{i?o(i.namespace,i.name).then(e=>u(e??null)):(u(null),m(!1))},[i]);const h=r(()=>[{id:jt(),title:"Node",label:d?.node??"-",withCopy:!0},{id:jt(),title:"Status",badge:{status:ta(d?.status),label:d?.status??"-"}}],[d]),b=r(()=>d?.containers?.map(e=>({id:jt(),items:[{id:jt(),title:"Container",label:e.name??"-"},{id:jt(),title:"Status",label:e.startedAt?`${e.status} (since ${c(e.startedAt)})`:e.status},{id:jt(),title:"Ready",badge:{status:e.ready?X.Success:X.Error,leftIcon:e.ready?Ka:Ya,label:e.ready?"True":"False",invertColors:!0}},{id:jt(),title:"Started",badge:{status:e.started?X.Success:X.Error,leftIcon:e.started?Ka:Ya,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}`}]}))||[],[d]);return e(Ze,{isOpen:!!i,header:{icon:kn,title:"Pod Information",onClose:s},children:[d?null:t(ke,{children:t(aa,{})}),d?e(a,{children:[t(ye,{richTitle:{icon:kn,title:d.name,withCopy:!0},children:e(g,{$gap:24,children:[t(at,{cellsPerRow:2,items:h}),b.length>0&&e(g,{$gap:12,children:[e(jo,{onClick:()=>m(e=>!e),children:[t(F,{children:"Containers Overview"}),t(Ne,{icon:p?nn:on})]}),p&&b.map(({id:e,items:a})=>t(Xo,{children:t(at,{cellsPerRow:2,items:a})},e))]})]})}),t(ye,{richTitle:{icon:yn,title:"Kubectl Commands"},children:e(g,{$gap:12,children:[t(na,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(na,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(na,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(Hn,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var Wo;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Wo||(Wo={}));const Go=[{key:Wo.PodName,label:"Pod Name"},{key:Wo.Status,label:"Status"},{key:Wo.Restarts,label:"Restarts",textAlign:"right"},{key:Wo.NodeName,label:"Node Name"},{key:Wo.Age,label:"Age",textAlign:"right"},{key:Wo.DockerImage,label:"Docker Image",textAlign:"right"}],Ko=({isLoading:a,tableRowsMaxHeight:n,pods:i,getExtendedPodInfo:o})=>{const s=m(),{formatTimeAgo:c}=Vt(),[d,u]=l(null),p=r(()=>i.map(a=>({onClick:()=>u(a),cells:[{key:Wo.PodName,rawValue:a.name},{key:Wo.Status,rawValue:a.status,component:()=>{return e=a.status,t(ie,{status:ta(e),label:e});var e}},{key:Wo.Restarts,rawValue:a.restartsCount.toString()},{key:Wo.NodeName,rawValue:a.nodeName},{key:Wo.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(F,{children:"-"});const i=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),o=i>0?Math.round((n?.metricsDroppedRps??0)/i*100):0,l=o>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(ie,{status:l,label:`Receiver ${o}%`,leftIcon:l===X.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})}),t(q,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(ie,{status:c,label:`Exporter ${r}%`,leftIcon:c===X.Error?Tn:Nn,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Wo.Age,rawValue:c(a.creationTimestamp)},{key:Wo.DockerImage,rawValue:a.image}]})),[i,s]);return e(ye,{richTitle:{icon:kn,title:"Pods"},children:[t(Gt,{variant:Kt.Data,maxHeight:n,isLoading:a,columns:Go,rows:p}),t(Ho,{pod:d,getExtendedPodInfo:o,onClose:()=>u(null)})]})};var Yo;!function(e){e.Gateway="gateway",e.Node="node"}(Yo||(Yo={}));const qo=[{value:Yo.Gateway,label:"Gateway"},{value:Yo.Node,label:"Node Collector"}],Jo=p.div`
|
|
168
|
-
display: flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
justify-content: space-between;
|
|
171
|
-
`,Qo=({selectedTab:a,setSelectedTab:n,onClickDownloadDiagnose:i,onClickRefresh:o,loading:l,disabled:s})=>{const c=r(()=>{const e=[];return i&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Download Diagnose",leftIcon:fn,size:$.S,variant:R.Text,onClick:i,disabled:s}}),o&&e.push({id:jt(),type:Ht.Button,buttonProps:{label:"Refresh",leftIcon:vn,size:$.S,variant:R.Text,onClick:o,disabled:s,loading:l}}),e},[i,o,s,l]);return e(Jo,{children:[e(D,{$gap:12,$alignItems:"center",children:[t(oa,{icon:An,title:"Pipeline Collectors"}),t(B,{options:qo,selected:a,setSelected:n,disabled:s})]}),t(la,{actions:c})]})},Zo=({isOpen:e,onClose:a,title:n,yaml:i})=>t(Ze,{isOpen:e,header:{icon:In,title:n,onClose:a},children:t(Hn,{yaml:i,defaultOpen:!0})});var el;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(el||(el={}));const tl=({richTitle:a,statusCard:n,textCards:i,manifestYaml:o,configMapYaml:s})=>{const[r,c]=l(null);return e(ye,{richTitle:a,actions:[{id:jt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:el.ManifestYaml,label:a?.title??"",icon:Dn},{id:el.ConfigMapYaml,label:"ConfigMap",icon:Dn}]}}],children:[e(D,{$gap:16,children:[t(sa,{...n}),i.map(e=>t(ra,{...e},e.title))]}),t(Zo,{isOpen:r===el.ManifestYaml,onClose:()=>c(null),title:a?.title??"",yaml:o}),t(Zo,{isOpen:r===el.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:s})]})},al=e=>{switch(e){case ca.Healthy:return"All desired replicas are updated, available, and ready";case ca.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case ca.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case ca.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case ca.Down:return"No available replicas";case ca.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},nl=({minSupportedVersion:a=0,tableRowsMaxHeight:i,getGatewayInfo:o,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{formatTimeAgo:m}=Vt(),{isVersionSupported:h,version:g}=Me(a),[b,f]=l(!1),[y,v]=l(Yo.Gateway),[C,S]=l(null),[w,k]=l([]),[T,N]=l(null),[A,I]=l([]),D=c(async()=>{f(!0);try{switch(y){case Yo.Gateway:S(await o()??null),k(await s()??[]);break;case Yo.Node:N(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{D()},[D]);const E=r(()=>(e=>{switch(e){case Yo.Gateway:return"Deployment";case Yo.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(y),[y]),$=r(()=>((e,t,a,n)=>{const i={status:ze.Disabled,label:"No rollouts yet"};let o=!1,l=null;switch(e){case Yo.Gateway:o=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case Yo.Node:o=a?.rolloutInProgress??!1,l=a?.lastRolloutAt??null;break;default:return i}return o?{status:X.Info,label:"Rollout in progress",rightIcon:vn,useSecondaryTone:!0}:l?{status:ze.Disabled,label:`Last Rollout: ${n(l)}`}:i})(y,C,T,m),[C,T,y,m]),R=r(()=>((e,t,a,n)=>{let i=n?X.Info:ze.Unknown,o=n?"Loading":ca.Unknown,l=n?"Fetching data...":al(ca.Unknown);switch(e){case Yo.Gateway:i=t?.status?ta(t?.status):i,o=t?.status??o,l=t?.status?al(t.status):l;break;case Yo.Node:i=a?.status?ta(a?.status):i,o=a?.status??o,l=a?.status?al(a.status):l}return{status:i,title:o,description:l}})(y,C,T,b),[C,T,y,b]),x=r(()=>((e,t,a,n)=>{switch(e){case Yo.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:n},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:n},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:n},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:n}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:n},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:n}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:n},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:n}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:n}]}];case Yo.Node:return[{title:"Nodes",cells:[{label:"Desired",value:a?.nodes?.desired.toString()??"-",isLoading:n},{label:"Ready",value:a?.nodes?.ready.toString()??"-",isLoading:n}]},{title:"Requests",cells:[{label:"CPU",value:a?.resources?.requests.cpu??"-",isLoading:n},{label:"Memory",value:a?.resources?.requests.memory??"-",isLoading:n}]},{title:"Limits",cells:[{label:"CPU",value:a?.resources?.limits.cpu??"-",isLoading:n},{label:"Memory",value:a?.resources?.limits.memory??"-",isLoading:n}]},{title:"Docker Image",cells:[{value:a?.imageVersion??"-",isLoading:n}]}];default:return[]}})(y,C,T,b),[C,T,y,b]),O=r(()=>(y===Yo.Gateway?C?.manifestYAML:T?.manifestYAML)??"",[C,T,y]),P=r(()=>(y===Yo.Gateway?C?.configMapYAML:T?.configMapYAML)??"",[C,T,y]),L=r(()=>y===Yo.Gateway?w:A,[w,A,y]);return e(Wt,{children:[t(Qo,{disabled:!h,loading:b,selectedTab:y,setSelectedTab:v,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e(da,{children:[t(tl,{richTitle:{icon:In,title:E,badge:$},statusCard:R,textCards:x,manifestYaml:O,configMapYaml:P}),t(Ko,{isLoading:b,tableRowsMaxHeight:i,pods:L,getExtendedPodInfo:p}),!h&&t(Xn,{minSupportedVersion:a,currentVersion:g||""})]})]})},il=p.div`
|
|
158
|
+
`,Qi=({selectedTab:a,gatewayInfo:n,nodeCollectorInfo:o,isLoading:i})=>{const{formatTimeAgo:s}=Vt(),[c,d]=l(null),u=r(()=>(e=>{switch(e){case Ui.Gateway:return"Deployment";case Ui.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 i=!1,l=null;switch(e){case Ui.Gateway:i=t?.rolloutInProgress??!1,l=t?.lastRolloutAt??null;break;case Ui.Node:i=a?.rolloutInProgress??!1,l=a?.lastRolloutAt??null;break;default:return o}return i?{status:j.Info,label:"Rollout in progress",rightIcon:yn,useSecondaryTone:!0}:l?{status:ze.Disabled,label:`Last Rollout: ${n(l)}`}:o})(a,n,o,s),[n,o,a,s]),m=r(()=>((e,t,a,n)=>{let o=n?j.Info:ze.Unknown,i=n?"Loading":ia.Unknown,l=n?"Fetching data...":Yi(ia.Unknown);switch(e){case Ui.Gateway:o=t?.status?na(t?.status):o,i=t?.status??i,l=t?.status?Yi(t.status):l;break;case Ui.Node:o=a?.status?na(a?.status):o,i=a?.status??i,l=a?.status?Yi(a.status):l}return{status:o,title:i,description:l}})(a,n,o,i),[n,o,a,i]),h=r(()=>((e,t,a)=>{switch(e){case Ui.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 Ui.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 Ui.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 Ui.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,i),[n,o,a,i]),b=r(()=>(a===Ui.Gateway?n?.manifestYAML:o?.manifestYAML)??"",[n,o,a]),f=r(()=>(a===Ui.Gateway?n?.configMapYAML:o?.configMapYAML)??"",[n,o,a]);return e(at,{bgTint:"1000",moreSpacing:!0,richTitle:{icon:An,title:u,badge:p},actions:[{id:Xt(),type:Ht.ButtonDropData,buttonProps:{variant:R.Secondary,size:$.S,label:"View YAML",onClick:e=>d(e)},dropDataProps:{items:[{id:qi.ManifestYaml,label:u,icon:In},{id:qi.ConfigMapYaml,label:"ConfigMap",icon:In}]}}],children:[e(D,{$gap:16,children:[t("div",{children:t(la,{...m})}),h.map(e=>t(Ji,{children:t("div",{children:t(sa,{...e})})},e.title)),g.map(e=>t(ra,{...e},e.title))]}),t(Ki,{isOpen:c===qi.ManifestYaml,onClose:()=>d(null),title:u,yaml:b}),t(Ki,{isOpen:c===qi.ConfigMapYaml,onClose:()=>d(null),title:"ConfigMap",yaml:f})]})},Zi=[{value:Ui.Gateway,label:"Gateway"},{value:Ui.Node,label:"Node Collector"}],el=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:i,getGatewayPods:s,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{isVersionSupported:m,version:h}=Me(a),[b,f]=l(!1),[y,v]=l(Ui.Gateway),[C,S]=l(null),[w,k]=l([]),[T,N]=l(null),[A,I]=l([]),D=c(async()=>{f(!0);try{switch(y){case Ui.Gateway:S(await i()??null),k(await s()??[]);break;case Ui.Node:N(await d()??null),I(await u()??[])}}catch(e){}f(!1)},[y]);n(()=>{D()},[D]);const E=r(()=>y===Ui.Gateway?w:A,[w,A,y]);return e(Wt,{children:[t(Xi,{disabled:!m,loading:b,onClickDownloadDiagnose:void 0,onClickRefresh:D}),e(ca,{children:[e(g,{children:[t(B,{variant:da.Underline,options:Zi,selected:y,setSelected:v}),t(Qi,{selectedTab:y,gatewayInfo:C,nodeCollectorInfo:T,isLoading:b})]}),t(Gi,{isLoading:b,tableRowsMaxHeight:o,pods:E,getExtendedPodInfo:p}),!m&&t(Xn,{minSupportedVersion:a,currentVersion:h||""})]})]})},tl=p.div`
|
|
172
159
|
display: inline-flex;
|
|
173
160
|
align-items: center;
|
|
174
161
|
padding: 4px 8px;
|
|
@@ -178,7 +165,7 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
178
165
|
overflow: hidden;
|
|
179
166
|
white-space: pre;
|
|
180
167
|
text-overflow: ellipsis;
|
|
181
|
-
`,
|
|
168
|
+
`,al=p.div`
|
|
182
169
|
display: inline-flex;
|
|
183
170
|
align-items: center;
|
|
184
171
|
gap: 24px;
|
|
@@ -188,24 +175,24 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
188
175
|
overflow: hidden;
|
|
189
176
|
white-space: pre;
|
|
190
177
|
text-overflow: ellipsis;
|
|
191
|
-
`,
|
|
178
|
+
`,nl=p(D)`
|
|
192
179
|
flex-shrink: 0;
|
|
193
180
|
gap: 6px;
|
|
194
181
|
align-items: center;
|
|
195
182
|
min-height: 22px;
|
|
196
|
-
`;const
|
|
183
|
+
`;const ol=[{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"}],il=[{value:"all",label:ma},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],ll=({title:a,items:n,isLoading:o,showTypeFilter:i,tableRowsMaxHeight:s,onRuleClick:d,onCreateRule:u,onEditRule:p,onDeleteRule:h})=>{const g=m(),[b,f]=l(""),[y,v]=l("all"),C=r(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,y,i);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,i,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(al,{$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(al,{$disabled:a.disabled,children:t(tl,{children:t(ua,{parts:a.summary})})})},{key:"badges",rawValue:a.typeBadge||"",component:()=>e(nl,{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",...i?{segment:{"data-id":"sampling-segment-type-filter",options:il,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:ol,rows:S,getRowActions:k})})},sl=a=>{const{workloads:o,samplingRules:i,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]=l(ha.Noisy),[I,x]=l(null),[O,P]=l(!1),[F,L]=l(!1),[M,V]=l(null),[z,_]=l(!1),[U,H]=l(!1),[W,G]=l(!1),K=r(()=>ga(s),[s]),Y=r(()=>ba(i),[i]),q=r(()=>fa(Y?.rule??null),[Y]),J=r(()=>ya(i),[i]),Q=r(()=>va(J?.rule??null),[J]),Z=d(I);Z.current=I,n(()=>{const e=Z.current;if(!e)return;const t=Ca(i,e);t?x(t):(x(null),P(!1))},[i]);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(i,N,ee),[i,N,ee]),ae=c(()=>L(!0),[]),ne=c(()=>L(!1),[]),oe=c(e=>{const t=i[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)},[i,N,h,f,v]),ie=c(e=>{const t=Na(i,e);t&&(P(!1),x(t))},[i]),le=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 i){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,i]),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=i[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)},[i,Y,f,y]),ye=c((e,t)=>{const a=i[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)},[i,J,v,C]),ve=c(e=>{const t=Ia[N];let a=null;switch(t){case"noisy":{const n=Ta(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}case"highlyRelevant":{const n=ka(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation,error:n.error??!1,durationAtLeastMs:n.durationAtLeastMs});break}case"costReduction":{const n=wa(e);a=Da(i,t,{sourceScopes:n.sourceScopes,operation:n.operation});break}}return a?{message:Ea,ruleId:a}:null},[i,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(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}case"highlyRelevant":{const o=ka(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation,error:o.error??!1,durationAtLeastMs:o.durationAtLeastMs},a);break}case"costReduction":{const o=wa(e);n=Da(i,t,{sourceScopes:o.sourceScopes,operation:o.operation},a);break}}return n?{message:Ea,ruleId:n}:null},[i,I]),Se=c(e=>{L(!1);for(const t of i){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)})}},[i]),we=r(()=>{const e=[];return a.docsUrl&&e.push({id:Xt(),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:Xt(),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:Xt(),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(X,{status:j.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(ll,{title:Ma[N],items:te,isLoading:u,showTypeFilter:N===ha.HighlyRelevant,tableRowsMaxHeight:p,onRuleClick:ie,onCreateRule:ae,onEditRule:se,onDeleteRule:ue})]}),t(pi,{formType:re.View,data:I,defaultEditMode:O,onClose:le,onDelete:ue,onSaveEdit:de,sourceOptions:k,namespaceOptions:T,validateForm:Ce,onNavigateToDuplicate:Se}),t(pi,{formType:re.Create,isOpen:F,category:Ia[N],onClose:ne,onSubmit:oe,sourceOptions:k,namespaceOptions:T,validateForm:ve,onNavigateToDuplicate:Se}),t(pi,{formType:re.EditAutoNoisy,isOpen:z,enabled:s?.enabled??!1,keepPercentage:s?.keepPercentage??0,onClose:()=>_(!1),onSave:ge}),t(pi,{formType:re.EditAutoHighlyRelevant,isOpen:U,enabled:!!Y&&!Y.rule.disabled,onClose:()=>H(!1),onSave:be}),t(pi,{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})]})},rl=p.div`
|
|
197
184
|
display: flex;
|
|
198
185
|
align-items: center;
|
|
199
186
|
justify-content: space-between;
|
|
200
187
|
padding: 0 12px;
|
|
201
|
-
`,
|
|
188
|
+
`,cl=({disabled:a,loading:n,tabs:o,selectedTab:i,setSelectedTab:s,onClickReset:c,onClickRefresh:d})=>{const[u,p]=l(!1),m=r(()=>{const e=[];return c&&e.push({id:Xt(),type:Ht.Button,buttonProps:{label:"Reset",leftIcon:ja,size:$.S,variant:R.Text,onClick:()=>p(!0),disabled:a}}),d&&e.push({id:Xt(),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(rl,{children:[e(D,{$gap:12,$alignItems:"center",children:[t(ta,{icon:dn,title:"Odigos Settings"}),t(Re,{width:"350px",options:o,values:[i],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."})]})},dl=p(D)`
|
|
202
189
|
flex: 1;
|
|
203
190
|
min-height: 0;
|
|
204
191
|
width: 100%;
|
|
205
192
|
align-self: stretch;
|
|
206
|
-
`,
|
|
193
|
+
`,ul=p(g)`
|
|
207
194
|
flex: 1;
|
|
208
195
|
min-height: 0;
|
|
209
196
|
height: 100%;
|
|
210
197
|
overflow-y: auto;
|
|
211
|
-
`,
|
|
198
|
+
`,pl=e=>"general"===e.name?0:"advanced"===e.name?2:1,ml=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:i,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}=it(v);n(()=>{"{}"!==JSON.stringify(v)&&"{}"===JSON.stringify(C)&&S(void 0,void 0,v)},[v,C]);const N=r(()=>[...i].sort((e,t)=>pl(e)-pl(t)),[i]),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 i)for(const a of t.fields)a.componentType===x.Dropdown&&e.add(a.helmValuePath);return e},[i]),[D,E]=l(!1),O=r(()=>[{id:Xt(),type:Ht.Button,buttonProps:{"data-id":"settings-save",variant:R.Primary,size:$.S,label:"Save Changes",leftIcon:on,loading:h,onClick:()=>E(!0)}},{id:Xt(),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}=Xa({sectionNames:L});return e(Wt,{$heightOffset:o,$gap:12,children:[t(cl,{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(dl,{$gap:24,$alignItems:"stretch",children:[t(ul,{ref:z,$gap:24,$width:"100%",children:i.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?j.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(X,{status:j.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(ul,{children:d&&!c?.manifestYAML?t(ke,{$height:"30vh",children:t(De,{withSpinner:!0})}):t(jn,{title:"Effective Config YAML",yaml:c?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})})]})]})]})};export{No as AddActionDrawer,no as AddActionForm,Mo as AddDestinationDrawer,lo as AddDestinationForm,Vo as AddRuleDrawer,go as AddRuleForm,Ko as AddSourceDrawer,Ii as CentralConnections,Yo as EditActionDrawer,qo as EditConfigDrawer,Jo as EditDestinationDrawer,Qo as EditRuleDrawer,_i as Onboarding,el as PipelineCollectors,pi as SamplingRuleDrawer,fo as SamplingRuleForm,sl as SamplingRules,ml as Settings,Si as SystemDrawer,Zi as TABS};
|