@odigos/ui-kit 0.0.225 → 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 +28 -0
- package/lib/chunks/index-B0b5lJH3.js +3 -0
- package/lib/chunks/index-C-Z4QHpA.js +149 -0
- package/lib/chunks/ui-components-C7i9zbc-.js +2652 -0
- package/lib/components/_v2/cards/data-card/index.d.ts +16 -3
- 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/condition/index.d.ts +13 -0
- package/lib/components/_v2/conditions/index.d.ts +8 -0
- package/lib/components/_v2/drawer/header/index.d.ts +6 -1
- package/lib/components/_v2/drop-data/index.d.ts +1 -0
- package/lib/components/_v2/icon-button/index.d.ts +1 -0
- package/lib/components/_v2/index.d.ts +3 -0
- package/lib/components/_v2/tag/index.d.ts +2 -1
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/_drawers/add-destination-drawer/index.d.ts +1 -1
- package/lib/containers/_v2/_drawers/add-source-drawer/index.d.ts +3 -1
- package/lib/containers/_v2/_drawers/edit-action-drawer/helpers.d.ts +12 -0
- package/lib/containers/_v2/_drawers/edit-action-drawer/index.d.ts +9 -0
- package/lib/containers/_v2/_drawers/edit-destination-drawer/helpers.d.ts +11 -0
- package/lib/containers/_v2/_drawers/edit-destination-drawer/index.d.ts +11 -0
- package/lib/containers/_v2/_drawers/edit-rule-drawer/helpers.d.ts +13 -0
- package/lib/containers/_v2/_drawers/edit-rule-drawer/index.d.ts +9 -0
- package/lib/containers/_v2/_drawers/index.d.ts +3 -0
- package/lib/containers/_v2/_forms/add-action-form/index.d.ts +0 -1
- package/lib/containers/_v2/_forms/add-destination-form/index.d.ts +8 -4
- package/lib/containers/_v2/_forms/add-rule-form/index.d.ts +0 -1
- package/lib/containers/_v2/_forms/index.d.ts +0 -1
- package/lib/containers/_v2/onboarding/summary/index.d.ts +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 +43 -56
- package/lib/containers.js +45 -45
- package/lib/contexts/action-form-context.d.ts +19 -0
- package/lib/{containers/_v2/_forms/add-destination-form/context.d.ts → contexts/destination-form-context.d.ts} +5 -4
- package/lib/contexts/index.d.ts +4 -0
- package/lib/contexts/rule-form-context.d.ts +19 -0
- package/lib/contexts/source-instrument-form-context.d.ts +22 -0
- package/lib/contexts.js +1 -1
- package/lib/functions/get-status-color/index.d.ts +2 -2
- package/lib/functions/get-status-icon/index.d.ts +2 -2
- 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-BMJ_MZzY.js +0 -149
- package/lib/chunks/index-Dlnglk_e.js +0 -3
- package/lib/chunks/ui-components-BqdkaDt2.js +0 -2543
- package/lib/components/_v2/cards/section-part-card/index.d.ts +0 -11
- package/lib/containers/_v2/_forms/add-action-form/context.d.ts +0 -18
- package/lib/containers/_v2/_forms/add-rule-form/context.d.ts +0 -18
- package/lib/containers/_v2/_forms/add-source-form/context.d.ts +0 -21
- package/lib/containers/_v2/_forms/add-source-form/index.d.ts +0 -1
package/lib/containers/v2.js
CHANGED
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect as n,Fragment as o,useState as l,useCallback as i,useContext as s,createContext as r,useMemo as c,useRef as d,Children as u}from"react";import p,{useTheme as m}from"styled-components";import{F as h,c as g,d as b,T as f,e as v,h as y,f as C,i as S,j as k,I as w,k as I,l as D,m as T,K as N,n as A,o as E,p as x,D as R,q as O,B as $,a as P,r as F,s as M,t as L,v as V,N as B,w as _,x as z,y as U,z as j,E as X,G as H,H as W,J as G,L as q,M as K,O as Y,P as J,Q,R as Z,U as ee,V as te,W as ae,X as ne,Y as oe,Z as le,_ as ie,$ as se,a0 as re,a1 as ce,a2 as de,a3 as ue,a4 as pe,a5 as me,a6 as he,a7 as ge,a8 as be,a9 as fe,aa as ve,ab as ye,ac as Ce,ad as Se,ae as ke,af as we,ag as Ie,ah as De,ai as Te,aj as Ne,ak as Ae,al as Ee,S as xe,am as Re,an as Oe,ao as $e,b as Pe,ap as Fe,aq as Me,ar as Le,as as Ve,at as Be,au as _e,av as ze,aw as Ue,ax as je,ay as Xe,az as He,aA as We,aB as Ge,aC as qe,aD as Ke,aE as Ye,aF as Je,aG as Qe,aH as Ze,aI as et,aJ as tt,aK as at,aL as nt,aM as ot,aN as lt,aO as it,aP as st,aQ as rt,aR as ct,aS as dt,aT as ut,aU as pt,aV as mt,aW as ht,aX as gt,aY as bt,aZ as ft,a_ as vt,a$ as yt,u as Ct,b0 as St,b1 as kt,b2 as wt,b3 as It,b4 as Dt,b5 as Tt,b6 as Nt,g as At,b7 as Et,A as xt,b8 as Rt,b9 as Ot,ba as $t,bb as Pt,bc as Ft,bd as Mt,be as Lt,bf as Vt,bg as Bt,bh as _t,bi as zt,bj as Ut,bk as jt,bl as Xt,bm as Ht,bn as Wt,bo as Gt,bp as qt,bq as Kt,br as Yt,bs as Jt,bt as Qt,bu as Zt,bv as ea,bw as ta,bx as aa,by as na,bz as oa,bA as la,bB as ia,bC as sa,bD as ra,bE as ca,bF as da,bG as ua,bH as pa,bI as ma,bJ as ha,bK as ga,bL as ba,bM as fa,bN as va,bO as ya,bP as Ca,bQ as Sa,bR as ka,bS as wa,bT as Ia,bU as Da,bV as Ta}from"../chunks/ui-components-BqdkaDt2.js";import{ChevronRightIcon as Na,TrashIcon as Aa,PlusIcon as Ea,BookIcon as xa,VSquareIcon as Ra,XSquareIcon as Oa,DeleteIcon as $a,EditIcon as Pa,GoLogo as Fa,JavaLogo as Ma,ActionIcon as La,DestinationIcon as Va,ChevronUpIcon as Ba,ChevronDownIcon as _a,VIcon as za,XIcon as Ua,InstrumentationRuleIcon as ja,SourceIcon as Xa,NamespacesIcon as Ha,SettingsIcon as Wa,SamplingIcon as Ga,ExclamationTriangleIcon as qa,ExclamationCircleIcon as Ka,KeyIcon as Ya,DiagnoseIcon as Ja,DownloadIcon as Qa,TerminalIcon as Za,RefreshIcon as en,ConnectionsIcon as tn,OdigosLogo as an,ArrowRightIcon as nn,PodIcon as on,ArrowDownSquareIcon as ln,ArrowUpSquareIcon as sn,PipelineCollectorIcon as rn,GatewayIcon as cn,YamlIcon as dn}from"../icons.js";import{S as un,D as pn,A as mn,P as hn,a as gn,b as bn,R as fn,c as vn,O as yn,d as Cn,e as Sn,W as kn,f as wn,g as In,h as Dn,U as Tn}from"../chunks/index-BMJ_MZzY.js";import{Y as Nn}from"../chunks/index-Dlnglk_e.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 An=p.div`
|
|
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
|
+
position: sticky;
|
|
3
|
+
bottom: 0;
|
|
4
|
+
margin-top: auto;
|
|
5
|
+
padding: 12px 0;
|
|
6
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
7
|
+
z-index: 1;
|
|
8
|
+
`,lo=i(({testConnection:a,isEdit:o},i)=>{const r=m(),{activeForm:c,genericForm:d,validateFormData:u,thisUnsavedDestination:p,addUnsavedDestination:h,updateUnsavedDestination:b,deleteUnsavedDestination:f}=U(),[y,C]=l(p?.testResult),[S,w]=l(!!p);n(()=>{p?(C(p.testResult),w(!0)):(C(void 0),w(!1))},[p]);const k=async()=>{if(!c?.option.testConnectionSupported||!d)return;const e=await a(K(d.formData));return C(e),e};return s(i,()=>({testConnection:k,testConnectionSupported:!!c?.option.testConnectionSupported}),[c?.option.testConnectionSupported,d,a]),d&&c?e(g,{$gap:24,style:{minHeight:"100%"},children:[e(D,{$gap:12,$justifyContent:"space-between",children:[y?y.succeeded?t(X,{status:j.Success,message:y.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(X,{status:j.Error,message:y.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(E,{"data-id":"dest-form-docs",label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}/backends/${c.option.type}`,"_blank","noopener noreferrer")})]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:r.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:r.v2.colors.red[800]}],selected:d.formData.disabled,setSelected:e=>d.handleFormChange("disabled",e),disabled:S}),t(Dn,{title:"This connection will monitor:",allowedSignals:G(c.option.supportedSignals),selectedSignals:W(d.formData.exportedSignals),setSelectedSignals:e=>d.handleFormChange("exportedSignals",{logs:e.includes(H.Logs),metrics:e.includes(H.Metrics),traces:e.includes(H.Traces)}),disabled:S,errorMessage:d.formErrors.exportedSignals}),t(v,{name:"destinationName",label:"Destination name",placeholder:"Use a name that describes the destination...",value:d.formData.name,onChange:({target:{value:e}})=>d.handleFormChange("name",e),disabled:S,errorMessage:d.formErrors.name}),t(oo,{signals:W(d.formData.exportedSignals),fields:c.dynamicFields,disabled:S,formData:d.formData,handleFormChange:(e,t)=>{d.handleFormChange("fields",d.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:d.formErrors}),!o&&e(io,{$gap:8,$justifyContent:"flex-end",children:[p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:Ya,variant:R.Secondary,textColor:r.v2.colors.red[500],onClick:()=>f(c.unsavedIdx)})}),(!p||p.option.testConnectionSupported&&!S)&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:R.Secondary,onClick:k})}),p&&t("div",S?{style:{width:"150px"},children:t(E,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:qa,variant:R.Secondary,onClick:()=>w(!1)})}:{style:{width:"150px"},children:t(E,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;b(c.unsavedIdx,{formData:t,testResult:e},a)}}})}),!p&&t("div",{style:{width:"150px"},children:t(E,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:R.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=u();if(!e){const e=await k(),a=!!e&&!e.succeeded;h({formData:t,testResult:e},a)}}})})]})]}):t(F,{title:"No active form"})});lo.displayName="AddDestinationForm";const so=[{id:Y.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Y.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Y.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],ro=[{id:Y.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Y.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Y.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],co=["*"],uo=[{id:Q.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:Q.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:Q.DbQuery,label:"Collect DB query",tooltip:""},{id:Q.Messaging,label:"Collect messaging",tooltip:""}],po={[te.Java]:[new ee("","")],[te.Golang]:[new Z("")]},mo={[ae.CodeAttributes]:({value:o,setValue:i,formErrors:l})=>{const s=m(),c=l.codeAttributes,d=r(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!c){const e={[Y.FilePath]:!0,[Y.Function]:!0,[Y.LineNumber]:!0,[Y.Column]:null,[Y.Namespace]:null,[Y.StackTrace]:null};i("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(Y).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});i("codeAttributes",n)};return e(a,{children:[e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(g,{$gap:6,children:so.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]}),e(g,{$gap:12,children:[t(L,{size:M.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(g,{$gap:6,children:ro.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(y,{errorMessage:c})]})]})},[ae.CustomInstrumentation]:({value:o,setValue:i,formErrors:l})=>{const s=l.customInstrumentations,c=r(()=>(o?.customInstrumentations?.[te.Golang]||[]).map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=r(()=>(o?.customInstrumentations?.[te.Java]||[]).map(e=>new ee(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||i("customInstrumentations",{[te.Golang]:po[te.Golang],[te.Java]:po[te.Java]})},[]),e(a,{children:[e(g,{children:[e(D,{$gap:8,children:[t(Ja,{}),t(b,{label:"Golang custom probes"})]}),t(w,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:c,setValues:e=>{const t={};t[te.Golang]=e.map(e=>new Z(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[te.Java]=d,i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(g,{children:[e(D,{$gap:8,children:[t(Qa,{}),t(b,{label:"Java custom probes"})]}),t(w,{name:"javaProbes",columns:[{keyName:"className",label:"Class name",placeholder:"e.g. com.example.MyClass",tooltip:"The name of the class to be instrumented."},{keyName:"methodName",label:"Method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented."}],values:d,setValues:e=>{const t={};t[te.Golang]=c,t[te.Java]=e.map(e=>new ee(e.className,e.methodName)),i("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[ae.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const i=o.headersCollection,l=r(()=>e?.headersCollection?.[J.HeaderKeys]||[],[e]),s=e=>{const t={[J.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{l.length||i||s(co)},[]),t(A,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:s,errorMessage:i})},[ae.PayloadCollection]:({value:a,setValue:o,formErrors:i})=>{const l=m(),s=i.payloadCollection,c=r(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!c.length&&!s){const e={[Q.HttpRequest]:{},[Q.HttpResponse]:{},[Q.DbQuery]:{},[Q.Messaging]:{}};o("payloadCollection",e)}},[]);return e(g,{$gap:12,children:[t(L,{size:M.XS,color:l.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(g,{$gap:6,children:uo.map(({id:e,label:a,tooltip:n})=>t(q,{text:n,withIcon:!0,children:t(f,{label:a,value:c.includes(e),onChange:t=>((e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),n={[Q.HttpRequest]:a.includes(Q.HttpRequest)?{}:null,[Q.HttpResponse]:a.includes(Q.HttpResponse)?{}:null,[Q.DbQuery]:a.includes(Q.DbQuery)?{}:null,[Q.Messaging]:a.includes(Q.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(y,{errorMessage:s})]})},[ae.UnknownType]:null},ho=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const i=mo[e];return i?t(i,{value:a,setValue:n,formErrors:o}):null},go=()=>{const a=m(),{selectedOption:n,genericForm:o}=ne();if(!o||!n)return t(F,{title:"No active form"});const{formData:i,handleFormChange:l,formErrors:s}=o;return e(g,{$gap:24,children:[e(D,{$gap:12,$justifyContent:"space-between",children:[t(L,{size:M.XXS,children:n.docsDescription}),t(E,{label:"Docs",leftIcon:Wa,variant:R.Text,size:$.S,onClick:()=>window.open(`${V}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(D,{$gap:12,children:[t(L,{size:M.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(oe,{label:ie[e],leftIcon:le(e),status:j.Default,useSecondaryTone:!0},e))]}),t(B,{options:[{icon:Ga,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Ka,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:i.disabled,setSelected:e=>l("disabled",e)}),t(v,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:i.ruleName,onChange:({target:{value:e}})=>l("ruleName",e),errorMessage:s.ruleName}),t(ho,{ruleType:n.type,value:i,setValue:(e,t)=>l(e,t),formErrors:s}),t(z,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:i.notes,onChange:({target:{value:e}})=>l("notes",e),errorMessage:s.notes})]})},bo=p.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
gap: 24px;
|
|
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`
|
|
2
13
|
display: flex;
|
|
3
14
|
align-items: center;
|
|
4
15
|
justify-content: space-between;
|
|
@@ -11,43 +22,32 @@ import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import{useEffect
|
|
|
11
22
|
&:hover {
|
|
12
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]};
|
|
13
24
|
}
|
|
14
|
-
`,
|
|
25
|
+
`,wo=p.div`
|
|
15
26
|
display: flex;
|
|
16
27
|
align-items: center;
|
|
17
28
|
justify-content: center;
|
|
18
29
|
padding: 8px;
|
|
19
30
|
border-radius: 8px;
|
|
20
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
21
|
-
`,xn=({dataId:a,icon:n,title:o,description:l,withCarret:i,purpleColors:s,disabled:r,children:c,isSelected:d,onClick:u,isChecked:p,isPartiallyChecked:y,onCheckboxChange:C})=>{const S=m();return e(An,{"data-id":a||`list-item-${o}`,$isSelected:d,$purpleColors:s,$disabled:r,onClick:()=>!d&&!r&&u(),children:[e(h,{$gap:4,children:[e(g,{$gap:12,children:[C&&t(b,{partiallyChecked:y||!1,value:p||!1,onChange:e=>C(e)}),n&&t(En,{children:t(n,{size:20})}),t(f,{size:v.XS,children:o})]}),l&&t(f,{size:v.XXXS,color:S.v2.colors.silver[200],children:l})]}),(i||c)&&e(g,{$gap:8,children:[c,i&&t(Na,{size:18})]})]})},Rn=[{id:"CREDIT_CARD",label:"Credit card"}],On=[{id:C.CollectContainerAttributes,label:"Collect container attributes"},{id:C.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:C.CollectWorkloadId,label:"Collect workload ID"},{id:C.CollectClusterId,label:"Collect cluster ID"}],$n=[{id:N.Pod,label:N.Pod},{id:N.Namespace,label:N.Namespace},{id:N.Node,label:N.Node}],Pn=[{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:$n}],Fn=[{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:$n}],Mn=[{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:I.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:I.Number}],Ln=C.UrlTemplatizationRulesGroups,Vn=[{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"}],Bn=[{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:I.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:I.Number}],_n=[{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:I.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:F.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:F.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}],zn={[M.K8sAttributes]:({value:o,setValue:l,formErrors:i})=>(n(()=>{o[C.CollectContainerAttributes]||o[C.CollectReplicaSetAttributes]||o[C.CollectWorkloadId]||o[C.CollectClusterId]||o[C.LabelsAttributes]?.length||o[C.AnnotationsAttributes]?.length||(l(C.CollectContainerAttributes,!0),l(C.CollectReplicaSetAttributes,!0),l(C.CollectWorkloadId,!0),l(C.CollectClusterId,!0),l(C.LabelsAttributes,[]),l(C.AnnotationsAttributes,[]))},[]),e(a,{children:[t(h,{$gap:6,children:On.map(({id:a,label:n})=>e(h,{children:[t(b,{label:n,value:o[a]||!1,onChange:e=>l(a,e)}),t(k,{errorMessage:i[a]})]},a))}),t(T,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Pn,values:o[C.LabelsAttributes]||[],setValues:e=>l(C.LabelsAttributes,e),errorMessage:i[C.LabelsAttributes]}),t(T,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Fn,values:o[C.AnnotationsAttributes]||[],setValues:e=>l(C.AnnotationsAttributes,e),errorMessage:i[C.AnnotationsAttributes]})]})),[M.AddClusterInfo]:({value:n,setValue:o,formErrors:l})=>{const i=m();return e(a,{children:[t(A,{label:"Overwrite existing values",labelAlign:E.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:n[C.OverwriteExistingValues]||!1,onChange:e=>o(C.OverwriteExistingValues,e)}),t(T,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:n[C.ClusterAttributes]||[],setValues:e=>o(C.ClusterAttributes,e),errorMessage:l[C.ClusterAttributes]})]})},[M.DeleteAttributes]:({value:e,setValue:a,formErrors:n})=>t(x,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[C.AttributeNamesToDelete]||[],setValues:e=>a(C.AttributeNamesToDelete,e),errorMessage:n[C.AttributeNamesToDelete]}),[M.RenameAttributes]:({value:e,setValue:a,formErrors:n})=>t(T,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[C.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(C.Renames,t)},errorMessage:n[C.Renames]}),[M.PiiMasking]:({value:a,setValue:o,formErrors:l})=>(n(()=>{a[C.PiiCategories]?.length||o(C.PiiCategories,Rn.map(({id:e})=>e))},[]),e(h,{$gap:12,children:[t(S,{label:"Attributes to mask"}),t(h,{$gap:6,children:Rn.map(({id:e,label:n})=>t(b,{label:n,value:a[C.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[C.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(C.PiiCategories,l)}},e))}),t(k,{errorMessage:l[C.PiiCategories]})]})),[M.ErrorSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[C.FallbackSamplingRatio],l=D(e[C.FallbackSamplingRatio])?"":String(e[C.FallbackSamplingRatio]);return t(w,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:I.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(C.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[M.ProbabilisticSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[C.SamplingPercentage],l=D(e[C.SamplingPercentage])?"":String(e[C.SamplingPercentage]);return t(w,{name:"samplingPercentage",label:"Sampling percentage",type:I.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(C.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:o})},[M.LatencySampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[C.EndpointsFilters],l=e[C.EndpointsFilters]||[];return t(T,{name:"endpointsFilters",limitFieldsPerRow:2,columns:Mn,values:l,setValues:e=>{a(C.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:n})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(n)})))},errorMessage:o})},[M.ServiceNameSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[C.ServicesNameFilters],l=e[C.ServicesNameFilters]||[];return t(T,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Bn,values:l,setValues:e=>{a(C.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:o})},[M.SpanAttributeSampler]:({value:e,setValue:a,formErrors:n})=>{const o=n[C.AttributeFilters],l=(e[C.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(T,{name:"attributeFilters",limitFieldsPerRow:2,columns:_n,values:l,setValues:e=>{a(C.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o,expectedValue:l,jsonPath:i})=>{const s={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[n]:{operation:o,expectedValue:l}}};return i&&(s.condition[n].jsonPath=i),s}))},errorMessage:o})},[M.URLTemplatization]:({value:n,setValue:l,formErrors:i})=>{const s=m(),r=n[Ln]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Ln,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(R,{}),e(h,{$gap:12,children:[e(g,{$justifyContent:"space-between",$alignItems:"center",children:[t(S,{label:`Rule Group ${n+1}`}),t(O,{leftIcon:()=>t(Aa,{fill:s.v2.colors.red[500]}),variant:P.Secondary,size:$.S,onClick:()=>{return e=n,c(r.filter((t,a)=>a!==e));var e},disabled:1===r.length})]}),t(w,{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(T,{name:`urlGroup-${n}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:Vn,values:a.workloadFilters||[],setValues:e=>d(n,{workloadFilters:e})}),t(x,{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(k,{errorMessage:i[Ln]})]},`url-templatization-group-${n}`)),t(O,{variant:P.Secondary,label:"Add rule group",leftIcon:Ea,onClick:()=>c([...r,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(R,{})]})}},Un=({actionType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=zn[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},jn={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Xn=r({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:V(jn)}),errorMessage:void 0}),Hn=({children:e})=>{const[a,n]=l(null),[o,s]=l(void 0),r=L(jn),c=i(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),s(void 0),e?.type&&r.handleFormChange("type",e.type),n(e)},[]),d=i(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:V(jn)};const e=(t=r.formData,V(t));var t;const n={};r.handleErrorChange(void 0,void 0,n);const o=Object.keys(n).length>0?"Invalid form values":void 0;return s(o),{errorMessage:o,preparedFormData:e}},[r,a]);return t(Xn.Provider,{value:{selectedOption:a,onSelectOption:c,genericForm:r,validateFormData:d,errorMessage:o},children:e})},Wn=()=>s(Xn),Gn=()=>{const a=m(),{selectedOption:n,genericForm:o}=Wn();if(!o||!n)return t(B,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(h,{$gap:24,children:[e(g,{$gap:12,$justifyContent:"space-between",children:[t(f,{size:v.XXS,children:n.docsDescription}),t(O,{label:"Docs",leftIcon:xa,variant:P.Text,size:$.S,onClick:()=>window.open(`${_}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(z,{options:[{icon:Ra,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Oa,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(un,{title:"Signals for processing",allowedSignals:n.allowedSignals,selectedSignals:l.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),t(w,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:l.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),t(Un,{actionType:n.type,value:l.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),t(U,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},qn=({signals:e,fields:a,disabled:n,formData:o,handleFormChange:l,formErrors:i})=>a?.map(({renderCondition:a,componentType:s,type:r,name:c,title:d,tooltip:u,placeholder:p,value:m,required:h,options:g})=>{if(!(!a||j(a,e,o.fields)))return null;const b=c,f=o.fields.find(e=>e.key===b),v=f?f.value:m;return t(pn,{componentType:s,inputType:r,name:b,label:d,tooltip:u,disabled:n,required:h,placeholder:p,errorMessage:i[b],dropdownOptions:g,value:v||"",setValue:e=>l(b,e)},b)}),Kn={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},Yn={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,formErrorMessage:void 0,validateFormData:()=>({isOk:!1,preparedFormData:V(Kn)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Jn=r(Yn),Qn=({children:e})=>{const{selectedStreamName:a}=X(),[o,s]=l(null),[r,d]=l(),[u,p]=l(Yn.unsavedDestinations),m=c(()=>"number"==typeof o?.unsavedIdx?u[o.unsavedIdx]:void 0,[o,u]),h=i((e,t)=>{o&&(p(t=>[...t,{...e,option:o.option}]),s(t?e=>e?{...e,listType:H.UNSAVED,unsavedIdx:u.length}:null:null))},[o,u.length]),g=i((e,t,a)=>{o&&(p(a=>a.map((a,n)=>n===e?{...a,...t,option:o.option}:a)),s(a?e=>e?{...e,listType:H.UNSAVED}:null:null))},[o]),b=i(e=>{p(t=>t.filter((t,a)=>a!==e)),s(null)},[]),f=L({...Kn,currentStreamName:a});n(()=>{if(o)if(m)f.handleFormChange(void 0,void 0,m.formData);else{f.handleFormChange("type",o.option.type),f.handleFormChange("name",o.option.displayName),f.handleFormChange("disabled",!1);const e=W(o.option.supportedSignals);f.handleFormChange("exportedSignals",{logs:e.includes(G.Logs),metrics:e.includes(G.Metrics),traces:e.includes(G.Traces)}),f.handleFormChange("fields",o.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[o,m]);const v=i(e=>{var t;f.resetFormData(),f.handleErrorChange(void 0,void 0,{}),d(void 0),s(e?{...e,dynamicFields:e.option?.fields?(t=e.option.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:o,initialValue:l,renderCondition:i}=e,s=a===F.Dropdown,r=K(n,{});return{componentType:a,renderCondition:i,name:t,title:o,value:l,placeholder:r.placeholder||(s?"Select an option":void 0),options:s&&Array.isArray(r.values)?r.values.map(e=>({id:e,value:e})):void 0,...r}})):[]}:null)},[]),y=i(()=>{const e=V(f.formData),t={};o?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;D(n)&&(t[a]=Y.FIELD_IS_REQUIRED)}});q(e.exportedSignals).length||(t.exportedSignals=Y.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return f.handleErrorChange(void 0,void 0,t),d(a),{errorMessage:a,preparedFormData:e}},[f,o]);return t(Jn.Provider,{value:{activeForm:o,onChangeActiveForm:v,genericForm:f,formErrorMessage:r,validateFormData:y,unsavedDestinations:u,thisUnsavedDestination:m,setUnsavedDestinations:p,addUnsavedDestination:h,updateUnsavedDestination:g,deleteUnsavedDestination:b},children:e})},Zn=()=>s(Jn),eo=p(g)`
|
|
22
|
-
position: sticky;
|
|
23
|
-
bottom: 0;
|
|
24
|
-
margin-top: auto;
|
|
25
|
-
padding: 12px 0;
|
|
26
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
27
|
-
z-index: 1;
|
|
28
|
-
`,to=({testConnection:a})=>{const o=m(),{activeForm:i,genericForm:s,validateFormData:r,thisUnsavedDestination:c,addUnsavedDestination:d,updateUnsavedDestination:u,deleteUnsavedDestination:p}=Zn(),[b,f]=l(c?.testResult),[v,y]=l(!!c);if(n(()=>{c?(f(c.testResult),y(!0)):(f(void 0),y(!1))},[c]),!s||!i)return t(B,{title:"No active form"});const C=async()=>{if(!i.option.testConnectionSupported)return;const e=await a(Z(s.formData));return f(e),e};return e(h,{$gap:24,style:{minHeight:"100%"},children:[e(g,{$gap:12,$justifyContent:"space-between",children:[b?b.succeeded?t(J,{status:Q.Success,message:b.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(J,{status:Q.Error,message:b.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(O,{"data-id":"dest-form-docs",label:"Docs",leftIcon:xa,variant:P.Text,size:$.S,onClick:()=>window.open(`${_}/backends/${i.option.type}`,"_blank","noopener noreferrer")})]}),t(z,{options:[{icon:Ra,label:"Enabled",value:!1,selectedBgColor:o.v2.colors.green[800]},{icon:Oa,label:"Disabled",value:!0,selectedBgColor:o.v2.colors.red[800]}],selected:s.formData.disabled,setSelected:e=>s.handleFormChange("disabled",e),disabled:v}),t(un,{title:"This connection will monitor:",allowedSignals:W(i.option.supportedSignals),selectedSignals:q(s.formData.exportedSignals),setSelectedSignals:e=>s.handleFormChange("exportedSignals",{logs:e.includes(G.Logs),metrics:e.includes(G.Metrics),traces:e.includes(G.Traces)}),disabled:v,errorMessage:s.formErrors.exportedSignals}),t(w,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:s.formData.name,onChange:({target:{value:e}})=>s.handleFormChange("name",e),disabled:v,errorMessage:s.formErrors.name}),t(qn,{signals:q(s.formData.exportedSignals),fields:i.dynamicFields,disabled:v,formData:s.formData,handleFormChange:(e,t)=>{s.handleFormChange("fields",s.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:s.formErrors}),e(eo,{$gap:8,$justifyContent:"flex-end",children:[c&&t("div",{style:{width:"150px"},children:t(O,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:$a,variant:P.Secondary,textColor:o.v2.colors.red[500],onClick:()=>p(i.unsavedIdx)})}),(!c||c.option.testConnectionSupported&&!v)&&t("div",{style:{width:"150px"},children:t(O,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:P.Secondary,onClick:C})}),c&&t("div",v?{style:{width:"150px"},children:t(O,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Pa,variant:P.Secondary,onClick:()=>y(!1)})}:{style:{width:"150px"},children:t(O,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:P.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=r();if(!e){const e=await C(),a=!!e&&!e.succeeded;u(i.unsavedIdx,{formData:t,testResult:e},a)}}})}),!c&&t("div",{style:{width:"150px"},children:t(O,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:P.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=r();if(!e){const e=await C(),a=!!e&&!e.succeeded;d({formData:t,testResult:e},a)}}})})]})]})},ao=[{id:ee.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:ee.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:ee.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],no=[{id:ee.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:ee.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:ee.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],oo=["*"],lo=[{id:ne.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:ne.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:ne.DbQuery,label:"Collect DB query",tooltip:""},{id:ne.Messaging,label:"Collect messaging",tooltip:""}],io={[ie.Java]:[new le("","")],[ie.Golang]:[new oe("")]},so={[se.CodeAttributes]:({value:o,setValue:l,formErrors:i})=>{const s=m(),r=i.codeAttributes,d=c(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);n(()=>{if(!d.length&&!r){const e={[ee.FilePath]:!0,[ee.Function]:!0,[ee.LineNumber]:!0,[ee.Column]:null,[ee.Namespace]:null,[ee.StackTrace]:null};l("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...d,e]:d.filter(t=>t!==e),n=Object.values(ee).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",n)};return e(a,{children:[e(h,{$gap:12,children:[t(f,{size:v.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(h,{$gap:6,children:ao.map(({id:e,label:a,tooltip:n})=>t(te,{text:n,withIcon:!0,children:t(b,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(k,{errorMessage:r})]}),e(h,{$gap:12,children:[t(f,{size:v.XS,color:s.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(h,{$gap:6,children:no.map(({id:e,label:a,tooltip:n})=>t(te,{text:n,withIcon:!0,children:t(b,{label:a,value:d.includes(e),onChange:t=>u(e,t)})},e))}),t(k,{errorMessage:r})]})]})},[se.CustomInstrumentation]:({value:o,setValue:l,formErrors:i})=>{const s=i.customInstrumentations,r=c(()=>(o?.customInstrumentations?.[ie.Golang]||[]).map(e=>new oe(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=c(()=>(o?.customInstrumentations?.[ie.Java]||[]).map(e=>new le(e.className,e.methodName)),[o]);return n(()=>{o?.customInstrumentations||s||l("customInstrumentations",{[ie.Golang]:io[ie.Golang],[ie.Java]:io[ie.Java]})},[]),e(a,{children:[e(h,{children:[e(g,{$gap:8,children:[t(Fa,{}),t(S,{label:"Golang custom probes"})]}),t(T,{name:"golangProbes",columns:[{keyName:"packageName",label:"Package name",placeholder:"e.g. github.com/my-org/my-package",tooltip:"The full import path of the package containing the function or method to be instrumented."},{keyName:"functionName",label:"Function name",placeholder:"e.g. myFunction",tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{keyName:"receiverName",label:"Receiver name",placeholder:"e.g. myReceiver",tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{keyName:"receiverMethodName",label:"Receiver method name",placeholder:"e.g. myMethod",tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],values:r,setValues:e=>{const t={};t[ie.Golang]=e.map(e=>new oe(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[ie.Java]=d,l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(h,{children:[e(g,{$gap:8,children:[t(Ma,{}),t(S,{label:"Java custom probes"})]}),t(T,{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[ie.Golang]=r,t[ie.Java]=e.map(e=>new le(e.className,e.methodName)),l("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[se.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const l=o.headersCollection,i=c(()=>e?.headersCollection?.[ae.HeaderKeys]||[],[e]),s=e=>{const t={[ae.HeaderKeys]:e};a("headersCollection",t)};return n(()=>{i.length||l||s(oo)},[]),t(x,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:i,setValues:s,errorMessage:l})},[se.PayloadCollection]:({value:a,setValue:o,formErrors:l})=>{const i=m(),s=l.payloadCollection,r=c(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);n(()=>{if(!r.length&&!s){const e={[ne.HttpRequest]:{},[ne.HttpResponse]:{},[ne.DbQuery]:{},[ne.Messaging]:{}};o("payloadCollection",e)}},[]);return e(h,{$gap:12,children:[t(f,{size:v.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(h,{$gap:6,children:lo.map(({id:e,label:a,tooltip:n})=>t(te,{text:n,withIcon:!0,children:t(b,{label:a,value:r.includes(e),onChange:t=>((e,t)=>{const a=t?[...r,e]:r.filter(t=>t!==e),n={[ne.HttpRequest]:a.includes(ne.HttpRequest)?{}:null,[ne.HttpResponse]:a.includes(ne.HttpResponse)?{}:null,[ne.DbQuery]:a.includes(ne.DbQuery)?{}:null,[ne.Messaging]:a.includes(ne.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(k,{errorMessage:s})]})},[se.UnknownType]:null},ro=({ruleType:e,value:a,setValue:n,formErrors:o})=>{if(!e)return null;const l=so[e];return l?t(l,{value:a,setValue:n,formErrors:o}):null},co={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},uo=r({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:V(co)}),errorMessage:void 0}),po=({children:e})=>{const[a,n]=l(null),[o,s]=l(void 0),r=L(co),c=i(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),s(void 0),n(e)},[]),d=i(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:V(co)};const e=(e=>{const t=V(e);return t.headersCollection?.[ae.HeaderKeys]?.length&&(t.headersCollection[ae.HeaderKeys]=t.headersCollection[ae.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[ie.Golang]?.length&&(t.customInstrumentations[ie.Golang]=t.customInstrumentations[ie.Golang].map(e=>new oe(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[ie.Java]?.length&&(t.customInstrumentations[ie.Java]=t.customInstrumentations[ie.Java].map(e=>new le(e.className,e.methodName)).filter(e=>e.Verify())),t})(r.formData),t={};switch(a.type){case se.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case se.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case se.HeadersCollection:e.headersCollection?.[ae.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case se.CustomInstrumentation:e.customInstrumentations?.[ie.Golang]?.length||e.customInstrumentations?.[ie.Java]?.length||(t.customInstrumentations="Custom instrumentation are required")}r.handleErrorChange(void 0,void 0,t);const n=Object.keys(t).length>0?"Invalid form values":void 0;return s(n),{errorMessage:n,preparedFormData:e}},[r,a]);return t(uo.Provider,{value:{selectedOption:a,onSelectOption:c,genericForm:r,validateFormData:d,errorMessage:o},children:e})},mo=()=>s(uo),ho=()=>{const a=m(),{selectedOption:n,genericForm:o}=mo();if(!o||!n)return t(B,{title:"No active form"});const{formData:l,handleFormChange:i,formErrors:s}=o;return e(h,{$gap:24,children:[e(g,{$gap:12,$justifyContent:"space-between",children:[t(f,{size:v.XXS,children:n.docsDescription}),t(O,{label:"Docs",leftIcon:xa,variant:P.Text,size:$.S,onClick:()=>window.open(`${_}${n.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(g,{$gap:12,children:[t(f,{size:v.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),n.supportedLanguages.map(e=>t(re,{label:ce[e],leftIcon:de(e),status:Q.Default,useSecondaryTone:!0},e))]}),t(z,{options:[{icon:Ra,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:Oa,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:l.disabled,setSelected:e=>i("disabled",e)}),t(w,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:l.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),t(ro,{ruleType:n.type,value:l,setValue:(e,t)=>i(e,t),formErrors:s}),t(U,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:l.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},go=r({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),bo=({children:e,selectedConnectionIds:a,getAllClusterSnapshots:o,fetchNamespacesWithWorkloads:s,initialInputs:r})=>{const{tier:d}=ue(),u=d===fe.Onprem,{selectedStreamName:p}=X(),[m,h]=l(!1),[g,b]=l(null),f=i(async()=>{try{if(h(!0),o){const e=await o();e&&b(e)}else if(s){const e=await s();e.data?.length&&b({clusters:[{clusterId:me,clusterName:pe,namespaces:e.data.map(e=>({name:e.name,selected:e.selected,workloads:e.sources?.map(e=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:e.selected}))||[]}))}]})}}catch(e){}finally{h(!1)}},[]);n(()=>{f()},[]);const[v,y]=l([]);n(()=>{g&&y(e=>{const t=((e,t)=>V(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(g,a);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(r?.[t.clusterId]){const e=r[t.clusterId],a=V(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{he.has(e.kind)&&!u||(e.selected=!0)})}),a}return n})})},[g,a,r]);const{formDiff:C,isFormDirty:S}=c(()=>{const e=((e,t,a)=>{const n={};return e.forEach(e=>{e.namespaces.forEach(o=>{const l=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===o.name),i=o.selected||!1,s=i!==l?.selected;if(s&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push({namespace:o.name,selected:i,currentStreamName:a}),i&&(n[e.clusterId]=n[e.clusterId].filter(e=>e.namespace!==o.name||e.namespace===o.name&&(!e.name||!e.kind)))),!s||!i){const t=((e,t,a)=>{const n=[];return t.workloads.forEach(o=>{const l=e?.workloads.find(e=>e.name===o.name&&e.kind===o.kind);o.selected!==l?.selected&&n.push({namespace:t.name,name:o.name,kind:o.kind,selected:o.selected||!1,currentStreamName:a})}),n})(l,o,a);t.length>0&&(n[e.clusterId]||(n[e.clusterId]=[]),n[e.clusterId].push(...t))}})}),n})(v,g?.clusters||[],p);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[v,g,p]),k=i(e=>!u&&he.has(e),[u]),w=i(({clusterId:e,workloadId:t,selected:a,auto:n})=>{y(o=>{const l=V(o),i=l.findIndex(t=>t.clusterId===e);if(-1===i)return l;const s=l[i].namespaces.findIndex(e=>e.name===t.namespace);if(-1===s)return l;if(t.kind&&t.name){const e=l[i].namespaces[s].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return l;const n="boolean"==typeof a?a:!l[i].namespaces[s].workloads[e].selected;if(l[i].namespaces[s].workloads[e].selected=n,n){l[i].namespaces[s].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(l[i].namespaces[s].selected=!0)}else l[i].namespaces[s].selected=!1}else{const e="boolean"==typeof n?n:!l[i].namespaces[s].selected;l[i].namespaces[s].selected=e,e?l[i].namespaces[s].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||l[i].namespaces[s].workloads.forEach(e=>{e.selected=!1})}return l})},[k]),I=i(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:o="",filters:l})=>{y(i=>{const s=V(i),r=o===ve.Namespace?n:"",c=o===ve.Source?n:"",d=!!r||!!c||!!l?.showOnlySelected;return s.forEach((n,o)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},i)=>{if(!t||e===t)if(d)if(t){n.forEach((e,t)=>{a&&k(e.kind)||ge(e,c,l||{showOnlySelected:!1})&&(s[o].namespaces[i].workloads[t].selected=a)});const e=s[o].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);s[o].namespaces[i].selected=e}else{if(!be(s[o].namespaces[i],r,l||{showOnlySelected:!1}))return;s[o].namespaces[i].selected=a,n.forEach((e,t)=>{a&&k(e.kind)||(s[o].namespaces[i].workloads[t].selected=a)})}else s[o].namespaces[i].selected=a,n.forEach((e,t)=>{a&&k(e.kind)||(s[o].namespaces[i].workloads[t].selected=a)})})}),s})},[k]);return t(go.Provider,{value:{isFetching:m,formData:v,handleSourceChange:w,handleSelectAll:I,formDiff:C,isFormDirty:S},children:e})},fo=()=>s(go),vo=p.div`
|
|
29
|
-
display: flex;
|
|
30
|
-
flex-direction: column;
|
|
31
|
-
gap: 24px;
|
|
32
|
-
`,yo=()=>{const e=ye();switch(e.formType){case Ce.Create:return t(Co,{category:e.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions});case Ce.View:return e.data?e.isEditing?t(Co,{category:e.data.category,formData:e.formData,onChange:e.handleChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions}):t(So,{data:e.data}):null;case Ce.EditAutoNoisy:return t(ko,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:Ee,sectionTitle:Ae,sectionSubTitle:Ne,presetLabel:Te,customInputName:"sampling-auto-input-custom-percentage",percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage});case Ce.EditAutoCostReduction:return t(ko,{enabled:e.localEnabled,summary:e.summary,inactiveTitle:De,sectionTitle:Ie,sectionSubTitle:we,presetLabel:ke,customInputName:"sampling-cr-auto-input-custom-percentage",percentagePreset:e.percentagePreset,setPercentagePreset:e.setPercentagePreset,customPercentage:e.customPercentage,setCustomPercentage:e.setCustomPercentage});case Ce.EditAutoHighlyRelevant:return t(vo,{children:t(mn,{title:e.localEnabled?void 0:Se,summary:e.summary})})}},Co=({category:a,formData:n,onChange:o,sourceOptions:l,namespaceOptions:i})=>e(vo,{children:[t(bn,{category:a,formState:n}),t(fn,{category:a,formState:n,onChange:o}),t(vn,{formState:n,onChange:o,sourceOptions:l,namespaceOptions:i}),t(yn,{category:a,formState:n,onChange:o}),t(Cn,{category:a,formState:n,onChange:o}),"highlyRelevant"===a&&t(Sn,{ruleType:n.ruleType,formState:n,onChange:o})]}),So=({data:a})=>e(vo,{children:[t(bn,{readOnly:!0,summary:a.summary}),t(fn,{readOnly:!0,data:a}),t(vn,{readOnly:!0,scopes:a.rule.sourceScopes??[]}),t(yn,{readOnly:!0,data:a}),t(Cn,{readOnly:!0,data:a}),"highlyRelevant"===a.category&&t(Sn,{readOnly:!0,rule:a.rule})]}),ko=({enabled:a,summary:n,inactiveTitle:o,sectionTitle:l,sectionSubTitle:s,presetLabel:r,customInputName:c,percentagePreset:d,setPercentagePreset:u,customPercentage:p,setCustomPercentage:m})=>{const h=i(e=>u(e),[u]),g=i(e=>m(e.target.value),[m]);return e(vo,{children:[t(mn,{title:a?void 0:o,summary:n}),t(xe,{richTitle:{title:l,subTitle:s},children:t(hn,{description:r,options:gn,selected:d,onSelect:h,customName:c,customLabel:Re,customPlaceholder:"5%",customValue:p,onCustomChange:g})})]})},wo=p.div`
|
|
31
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
|
|
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
|
-
`,_o=({workloadName:e,workloadKind:a,isChecked:n,onToggle:o,disabled:
|
|
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
|
-
`,Xo=({clusterId:a,namespaceName:n,checkbox:o,isFutureApps:l,selectedCounts:i,isActive:s,onActive:r,handleSourceChange:c})=>{const d=m(),u=e=>{r(),c({clusterId:a,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Uo,{children:t(xn,{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(g,{$gap:12,children:[t(jo,{$visible:s||l,children:t(te,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(A,{label:"Auto",size:We.S,value:l,onChange:e=>u({auto:e,all:e||void 0})})})}),e(g,{$gap:8,children:[t(f,{variant:Ge.Span,size:v.XXXS,color:d.v2.colors.silver[200],align:"right",children:"Selected"}),t(re,{label:`${i.sourced}/${i.total}`,status:s?Q.Default:He.Unknown,minWidth:"42px"})]})]})})})},Ho=({withCollapse:e,clusterId:a,clusterName:n,namespaces:o,selectedArea:l,setSelectedArea:i,handleSourceChange:s})=>{const r=c(()=>o.map(({name:e,totalWorkloads:o,selectedCount:r,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Xo,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:r,total:o},isActive:l.clusterId===a&&l.namespaceName===e,onActive:()=>i({clusterId:a,clusterName:n,namespaceName:e}),handleSourceChange:s},`${a}#${e}`)),[a,n,o,l]);return e?t(Ao,{title:n,list:r,noBgColor:!0}):r},Wo=({isFetching:a,formData:n,handleSourceChange:o,handleSelectAll:l,selectedArea:i,setSelectedArea:s,searchText:r,searchBy:d,filters:u})=>{const p=c(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>be(e,r,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...qe(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,r,u]),m=c(()=>{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:b,filteredCount:y,totalCount:C}=c(()=>{const e=p.map(({clusterId:e,clusterName:a,visibleNamespaces:n})=>n.length?t(Ho,{withCollapse:p.length>1,clusterId:e,clusterName:a,namespaces:n,selectedArea:i,setSelectedArea:s,handleSourceChange:o},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[p,i]);return{width:"60%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(f,{size:v.XS,nowrap:!0,children:"Namespaces"}),t(te,{text:b?Fe.FILTERED_COUNT_TOOLTIP:void 0,children:t(re,{label:`${b?`${y} / ${C}`:C}`,status:He.Unknown})})]}),t(f,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:r,searchBy:d,filters:u}),disabled:!h.length,size:v.XS,children:(m?"Unselect":"Select")+" all"})]}),list:h.length?h:a?[t(Pe,{$height:"100%",children:t(Ve,{title:Fe.FETCHING_NAMESPACES,subTitle:Fe.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[t(Pe,{$height:"100%",children:t(B,r?{icon:Ha,title:"No matches",subTitle:`No namespace matched the filter '${r}'`}:{icon:Ha,title:"No namespaces",subTitle:"No namespaces found in this cluster"})},"no-data")]}},Go=({onClose:a,onBack:n,onNext:o,selectedConnectionIds:i,setSelectedConnectionIds:s,persistSources:r,withOverlay:c,disableAnimation:d})=>{const u=m(),{progress:p,resetProgress:h}=Ke(),{isFetching:b,formData:y,handleSourceChange:C,handleSelectAll:S,formDiff:k,isFormDirty:w}=fo(),[I,D]=l(""),[T,N]=l(ve.Namespace),[E,x]=l({showOnlySelected:!1}),[R,O]=l({clusterId:"",clusterName:"",namespaceName:""});return t(kn,{isOpen:!0,withOverlay:c,disableAnimation:d,onClose:a?()=>{h(Ye.BulkInstrumenting),a()}:void 0,onBack:n?()=>n(k):void 0,onNext:o?()=>o(k):void 0,nextIsSkip:!w,onSave:()=>r(k),header:{icon:Xa,title:Fe.ADD_SOURCE,subTitle:Fe.ADD_SOURCES_DESCRIPTION},connectionIds:i&&s?{value:i,setValue:s}:void 0,search:{value:I,onChange:e=>{D(e),T===ve.Namespace&&O({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:ve.Namespace},{label:"Source",value:ve.Source}],selected:T,setSelected:N}},filters:e(g,{$gap:8,children:[t(f,{size:v.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(A,{name:"filter-selected",size:We.S,label:"Selected",value:E.showOnlySelected,onChange:e=>x(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:w,isFetching:b,progress:{title:Fe.CREATING_SOURCES,subTitle:Fe.CREATING_SOURCES_SUBTITLE,percentage:p[Ye.BulkInstrumenting]?.percentage||0},leftColumn:Wo({isFetching:b,formData:y,handleSourceChange:C,handleSelectAll:S,selectedArea:R,setSelectedArea:O,searchText:T===ve.Namespace?I:"",searchBy:T,filters:E}),rightColumn:zo({formData:y,handleSourceChange:C,handleSelectAll:S,selectedArea:{value:R},searchText:T===ve.Source?I:"",searchBy:T,filters:E})})},qo=({onClose:a,connections:o,selectedConnectionIds:i,setSelectedConnectionIds:s,getEffectiveConfig:r,onApply:d})=>{const u=m(),[p,h]=l(""),[b,y]=l({showOnlySelected:!1}),C=c(()=>o.filter(e=>{const t=!p||e.name.toLowerCase().includes(p.toLowerCase()),a=!b.showOnlySelected||b.showOnlySelected&&i.includes(e.id);return t&&a}),[o.length,i.length,p,b]),S=e=>{s(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[k,w]=l(!1),[I,D]=l(void 0),{formData:T,handleFormChange:N,areFormValuesEqual:E,resetFormData:x}=L(I||{rollout:{automaticRolloutDisabled:!1}}),R=c(()=>i.length>1||void 0!==I&&!E(I,T),[i.length,I,T]);return n(()=>{1===i.length?(async e=>{if(k)return;w(!0);const t=await r(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};D(e),x(e)}w(!1)})(i[0]):D(void 0)},[i.length]),t(kn,{isOpen:!0,onClose:a,onSave:()=>d(T,i),header:{icon:Wa,title:"Cluster Configuration"},connectionIds:{value:i,setValue:s},search:{placeholder:"Search by cluster name",value:p,onChange:h},filters:e(g,{$gap:8,children:[t(f,{size:v.XXXS,color:u.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(A,{size:We.S,label:"Selected",value:b.showOnlySelected,onChange:e=>y(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:R,isFetching:k,leftColumn:{width:"35%",header:e(g,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(g,{$gap:8,children:[t(f,{size:v.XS,children:"Clusters"}),t(re,{label:C.length,status:He.Unknown})]}),e(g,{$gap:8,children:[t(f,{size:v.XXXS,color:u.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(re,{label:`${i.length}/${C.length}`,status:He.Unknown})]})]}),list:C.map(e=>t(xn,{title:e.name,isChecked:i.includes(e.id),onClick:()=>S(e.id),onCheckboxChange:()=>S(e.id)},e.id))},rightColumn:{width:"65%",header:t(f,{size:v.XS,children:"Configurations"}),list:[t(A,{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:T.rollout?.automaticRolloutDisabled||!1,onChange:e=>N("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Ko=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
|
-
`,gl=({downloadDiagnose:a})=>{const n=m(),{progress:o}=Ke(),{namespaces:i}=je(),[s,r]=l(null),{formData:c,handleFormChange:d,resetFormData:u}=L({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(xe,{richTitle:{icon:Ja,title:"Diagnose"},children:s?e(hl,{children:[t(Ve,{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:Qa,startedAt:s}),o[Ye.DownloadingDiagnose]?.list?.length&&t(h,{$width:"100%",children:o[Ye.DownloadingDiagnose].list.map(a=>e(g,{$gap:4,$alignItems:"center",children:[a.status===Q.Success?t(za,{size:16}):a.status===Q.Error?t(Ua,{size:16}):t(Ve,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(f,{size:v.XXXS,color:n.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(h,{$gap:24,children:[t(f,{size:v.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(h,{$gap:16,children:[e(g,{$gap:8,children:[t(b,{label:"Profiles",value:c.includeProfiles,onChange:e=>d("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(f,{size:v.XXXS,color:n.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(g,{$gap:8,children:[t(b,{label:"Metrics",value:c.includeMetrics,onChange:e=>d("includeMetrics",e)}),t(f,{size:v.XXXS,color:n.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(g,{$gap:8,children:[t(b,{label:"Source Workloads",value:c.includeSourceWorkloads,onChange:e=>{d("includeSourceWorkloads",e),e&&d("sourceWorkloadNamespaces",[])}}),t(f,{size:v.XXXS,color:n.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t(It,{alignX:Tt.Left,alignY:Dt.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:P.Secondary,disabled:c.includeSourceWorkloads,leftIcon:c.sourceWorkloadNamespaces.length?()=>t(re,{label:c.sourceWorkloadNamespaces.length,status:Q.Default}):void 0}}),t(g,{$justifyContent:"flex-end",children:t(O,{label:"Download Diagnose",rightIcon:Qa,variant:P.Primary,onClick:async()=>{r(Date.now()),await a(c),r(null),u()},disabled:null!==s})})]})})},bl=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:i}=ue(),[s,r]=l(null);return n(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(xe,{richTitle:{icon:Za,title:"General Information"},children:t(Nt,{cellsPerRow:2,items:[{id:At(),title:"Odigos Version",label:o},{id:At(),title:`${a.toUpperCase()} Version`,label:s?.kubernetesVersion?.value||"-"},{id:At(),title:"Installation Method",label:s?.installationMethod?.value||"-"},{id:At(),title:"Tier",label:i}]})})},fl=({isOpen:a,onClose:n,token:o,updateToken:l,fetchDescribeOdigos:i,downloadDiagnose:s})=>e(ht,{isOpen:a,header:{icon:Za,title:"System Overview",onClose:n},children:[i&&t(bl,{fetchDescribeOdigos:i}),l&&o&&t(ml,{token:o,updateToken:l}),s&&t(gl,{downloadDiagnose:s})]});var vl,yl;!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"}(vl||(vl={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(yl||(yl={}));const Cl=[{key:yl.Name,label:"Name"},{key:yl.Type,label:"Type",textAlign:"right"},{key:yl.Status,label:"Status"},{key:yl.OdigosVersion,label:"Odigos Version"},{key:yl.ConnectedSince,label:"Connected Since"},{key:yl.LastActivity,label:"Last Activity"}],Sl=(e,t)=>{const a=e.find(e=>e.key===yl.Id)?.rawValue;return t(a?.toString()||"")},kl=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:n,onDelete:o,onAddSource:l,onAddDestination:i,onAddAction:s,onAddInstrumentationRule:r,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===yl.Status)?.rawValue===Q.Success)(e))return[{id:At(),label:"Delete Connection",rightIcon:$a,onClick:()=>Sl(e,o)}];const d=Sl(e,e=>{const n=t.find(t=>t.id===e);return!!n&&Et(n.odigosVersion,a)}),u=Sl(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Et(a.odigosVersion,n)}),p=[];return l&&p.push({id:At(),tooltip:u?Fe.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${n} or later.`,rightIcon:Xa,disabled:!u,onClick:()=>Sl(e,l)}),i&&p.push({id:At(),tooltip:Fe.ADD_DESTINATION,rightIcon:Va,onClick:()=>Sl(e,i)}),s&&p.push({id:At(),tooltip:Fe.ADD_ACTION,rightIcon:La,onClick:()=>Sl(e,s)}),r&&p.push({id:At(),tooltip:Fe.ADD_INSTRUMENTATION_RULE,rightIcon:ja,onClick:()=>Sl(e,r)}),c&&p.push({id:At(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:Wa,disabled:!d,onClick:()=>Sl(e,c)}),p}},wl=({tableRowsMaxHeight:a,connections:o,getConnections:s,onClickConnection:r,deleteConnection:d,configMinSupportedVersion:u=0,getEffectiveConfig:p,applyConfigurations:h,snapshotMinSupportedVersion:g=0,getAllClusterSnapshots:b,persistSources:f,getDestinationCategories:v,getPotentialDestinations:y,testConnection:C,createDestination:S,updateDestination:k,createAction:w,createInstrumentationRule:I})=>{const D=m(),{isVm:T}=ue(),{formatTimeAgo:N}=kt(),[A,E]=l(!1),[x,R]=l(o||[]),O=i(async()=>{try{E(!0),R(await s()??[])}catch(e){}finally{E(!1)}},[]);n(()=>{x.length||O()},[]);const[F,M]=l(""),[L,V]=l(null),[B,_]=l([]),z=c(()=>L===vl.BulkConfig?u:L===vl.BulkSource?g:0,[L,u,g]),{supportedConnections:U,supportedConnectionIds:j}=c(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===Q.Success,n=Et(e.odigosVersion,t);return a&&n}))(x,z);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[x.length,z]);n(()=>{if(!L||L===vl.Delete)return;const e=B.filter(e=>!j.includes(e));e.length&&_(t=>t.filter(t=>!e.includes(t)))},[L,B.length,j.length]);const X=c(()=>x.filter(e=>!F||e.name.toLowerCase().includes(F.toLowerCase())).map(e=>({cells:[{key:yl.Id,rawValue:e.id},{key:yl.Name,rawValue:e.name},{key:yl.Type,rawValue:e.type},{key:yl.Status,rawValue:e.status,component:()=>(e=>{const a=e===Q.Success?"Connection live":"Connection lost",n=e===Q.Success?za:Ua;return t(re,{status:e,label:a,leftIcon:n})})(e.status)},{key:yl.OdigosVersion,rawValue:e.odigosVersion},{key:yl.ConnectedSince,rawValue:e.connectedAt?N(e.connectedAt):"-"},{key:yl.LastActivity,rawValue:e.lastSeenAt?N(e.lastSeenAt):"-"}],onClick:e.status!==Q.Success||L?void 0:()=>r(e),isSelected:B.includes(e.id),onSelect:()=>_(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>_(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==Q.Success||L===vl.BulkConfig&&!Et(e.odigosVersion,u)||L===vl.BulkSource&&!Et(e.odigosVersion,g)})),[x,B,F,L,u,g]),H=c(()=>{const e=(e,t)=>{_([e]),V(t)};return kl({connections:x,configMinSupportedVersion:u,snapshotMinSupportedVersion:g,onDelete:t=>e(t,vl.Delete),onAddSource:!T&&b&&f?t=>e(t,vl.BulkSource):void 0,onAddDestination:!T&&v&&y&&S?t=>e(t,vl.BulkDestination):void 0,onAddAction:!T&&w?t=>e(t,vl.BulkAction):void 0,onAddInstrumentationRule:!T&&I?t=>e(t,vl.BulkInstrumentationRule):void 0,onEditConfiguration:!T&&p&&h?t=>e(t,vl.BulkConfig):void 0})},[T,x,u,p,h,g,b,f,v,y,S,w,I]),W=c(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:n,onAddAction:o,onAddInstrumentationRule:l,onManageConfigurations:i}=e,s=[];a&&s.push({id:At(),type:xt.Button,buttonProps:{variant:P.Primary,size:$.S,label:"Add Sources",rightIcon:Xa,onClick:a}});const r=[n?{id:vl.BulkDestination,label:Fe.ADD_DESTINATION,icon:Va}:null,o?{id:vl.BulkAction,label:Fe.ADD_ACTION,icon:La}:null,l?{id:vl.BulkInstrumentationRule,label:Fe.ADD_INSTRUMENTATION_RULE,icon:ja}:null,i?{id:vl.BulkConfig,label:"Manage Configurations",icon:Wa}:null];return r.some(Boolean)&&s.push({id:At(),type:xt.ButtonDropData,buttonProps:{variant:P.Secondary,size:$.S,label:"Bulk Operations",onClick:e=>{e===vl.BulkSource?a?.():e===vl.BulkDestination?n?.():e===vl.BulkAction?o?.():e===vl.BulkInstrumentationRule?l?.():e===vl.BulkConfig&&i?.()}},dropDataProps:{alignX:Tt.Left,items:r}}),s.push({id:At(),type:xt.Button,buttonProps:{variant:P.Text,size:$.S,label:Rt.CANCEL,onClick:t}}),s})({onCancel:()=>_([]),onAddSource:!T&&b&&f?()=>V(vl.BulkSource):void 0,onAddDestination:!T&&v&&y&&S?()=>V(vl.BulkDestination):void 0,onAddAction:!T&&w?()=>V(vl.BulkAction):void 0,onAddInstrumentationRule:!T&&I?()=>V(vl.BulkInstrumentationRule):void 0,onManageConfigurations:!T&&p&&h?()=>V(vl.BulkConfig):void 0}),[T,p,h,b,f,v,y,S,w,I]);return t(Ot,{children:e(xe,{richTitle:{icon:tn,title:Fe.CONNECTIONS,badge:{label:x.length.toString(),status:He.Unknown}},search:{placeholder:"Search by cluster name",value:F,onChange:e=>M(e),width:"300px"},actions:[{id:At(),type:xt.Button,buttonProps:{variant:P.Secondary,size:$.S,leftIcon:en,onClick:O,disabled:A}}],children:[t($t,{variant:Pt.Pretty,maxHeight:a,headerBackgroundColor:D.v2.colors.silver[1e3],isLoading:A,withCheckboxes:!0,columns:Cl,rows:X,rowActionsPushRightPosition:L?`calc(${wn} - 24px)`:void 0,getRowActions:H}),L===vl.BulkConfig&&p&&h&&t(qo,{onClose:()=>V(null),connections:U,selectedConnectionIds:B,setSelectedConnectionIds:_,getEffectiveConfig:p,onApply:h}),L===vl.BulkSource&&b&&f&&t(bo,{selectedConnectionIds:B,getAllClusterSnapshots:b,children:t(Go,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:_,persistSources:async e=>await(f?.(e))})}),L===vl.BulkDestination&&v&&y&&C&&S&&k&&t(Qn,{children:t(Mo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:_,getDestinationCategories:v,getPotentialDestinations:y,testConnection:e=>C(e,B),createDestination:e=>S(e,B),updateDestination:(e,t)=>k(e,t,B)})}),L===vl.BulkAction&&w&&t(Hn,{children:t(Io,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:_,createAction:e=>w(e,B)})}),L===vl.BulkInstrumentationRule&&I&&t(po,{children:t(Lo,{onClose:()=>V(null),selectedConnectionIds:B,setSelectedConnectionIds:_,createInstrumentationRule:e=>I(e,B)})}),t(In,{target:"connection",isOpen:L===vl.Delete,onClose:()=>{_([]),V(null)},onApprove:async()=>{const e=B[0];e&&(await d(e),await O())}}),t(Ft,{isOpen:!!B.length&&!L,richTitle:{icon:Ra,title:"Selected Clusters",badge:{label:B.length}},actions:W})]})})},Il=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
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
115
|
-
|
|
114
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+Ce["004"]};
|
|
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
|
-
`,Bl=p.div`
|
|
166
|
-
animation-name: ${_t.in};
|
|
167
|
-
`,_l=({pod:o,getExtendedPodInfo:i,onClose:s})=>{const{formatTimeAgo:r}=kt(),[d,u]=l(null),[p,m]=l(!1);n(()=>{o?i(o.namespace,o.name).then(e=>u(e??null)):(u(null),m(!1))},[o]);const g=c(()=>[{id:At(),title:"Node",label:d?.node??"-",withCopy:!0},{id:At(),title:"Status",badge:{status:Lt(d?.status),label:d?.status??"-"}}],[d]),b=c(()=>d?.containers?.map(e=>({id:At(),items:[{id:At(),title:"Container",label:e.name??"-"},{id:At(),title:"Status",label:e.startedAt?`${e.status} (since ${r(e.startedAt)})`:e.status},{id:At(),title:"Ready",badge:{status:e.ready?Q.Success:Q.Error,leftIcon:e.ready?Ra:Oa,label:e.ready?"True":"False",invertColors:!0}},{id:At(),title:"Started",badge:{status:e.started?Q.Success:Q.Error,leftIcon:e.started?Ra:Oa,label:e.started?"True":"False",invertColors:!0}},{id:At(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:At(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:At(),title:"Restarts",label:e.restarts.toString()},{id:At(),title:"State Reason",label:e.stateReason??"-"},{id:At(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:At(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[d]);return e(ht,{isOpen:!!o,header:{icon:on,title:"Pod Information",onClose:s},children:[d?null:t(Pe,{children:t(Vt,{})}),d?e(a,{children:[t(xe,{richTitle:{icon:on,title:d.name,withCopy:!0},children:e(h,{$gap:24,children:[t(Nt,{cellsPerRow:2,items:g}),b.length>0&&e(h,{$gap:12,children:[e(Vl,{onClick:()=>m(e=>!e),children:[t(f,{children:"Containers Overview"}),t(Me,{icon:p?Ba:_a})]}),p&&b.map(({id:e,items:a})=>t(Bl,{children:t(Nt,{cellsPerRow:2,items:a})},e))]})]})}),t(xe,{richTitle:{icon:Za,title:"Kubectl Commands"},children:e(h,{$gap:12,children:[t(Bt,{value:`kubectl get pod ${d.name} -n ${d.namespace} -o yaml`}),t(Bt,{value:`kubectl describe pod ${d.name} -n ${d.namespace}`}),t(Bt,{value:`kubectl logs ${d.name} -n ${d.namespace}`})]})}),t(Nn,{yaml:d.manifestYAML,defaultOpen:!0})]}):null]})};var zl;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(zl||(zl={}));const Ul=[{key:zl.PodName,label:"Pod Name"},{key:zl.Status,label:"Status"},{key:zl.Restarts,label:"Restarts",textAlign:"right"},{key:zl.NodeName,label:"Node Name"},{key:zl.Age,label:"Age",textAlign:"right"},{key:zl.DockerImage,label:"Docker Image",textAlign:"right"}],jl=({isLoading:a,tableRowsMaxHeight:n,pods:o,getExtendedPodInfo:i})=>{const s=m(),{formatTimeAgo:r}=kt(),[d,u]=l(null),p=c(()=>o.map(a=>({onClick:()=>u(a),cells:[{key:zl.PodName,rawValue:a.name},{key:zl.Status,rawValue:a.status,component:()=>{return e=a.status,t(re,{status:Lt(e),label:e});var e}},{key:zl.Restarts,rawValue:a.restartsCount.toString()},{key:zl.NodeName,rawValue:a.nodeName},{key:zl.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:n}=a;if(!n)return t(f,{children:"-"});const o=(n?.metricsAcceptedRps??0)+(n?.metricsDroppedRps??0),l=o>0?Math.round((n?.metricsDroppedRps??0)/o*100):0,i=l>0?Q.Error:Q.Success,s=(n?.exporterSuccessRps??0)+(n?.exporterFailedRps??0),r=s>0?Math.round((n?.exporterFailedRps??0)/s*100):0,c=r>0?Q.Error:Q.Success;return e(g,{$gap:4,children:[t(te,{text:`Accepted: ${n.metricsAcceptedRps.toLocaleString()}, Dropped: ${n.metricsDroppedRps.toLocaleString()}`,children:t(re,{status:i,label:`Receiver ${l}%`,leftIcon:i===Q.Error?ln:sn,useSecondaryTone:!0,invertColors:!0})}),t(te,{text:`Success: ${n.exporterSuccessRps.toLocaleString()}, Failed: ${n.exporterFailedRps.toLocaleString()}`,children:t(re,{status:c,label:`Exporter ${r}%`,leftIcon:c===Q.Error?ln:sn,useSecondaryTone:!0,invertColors:!0})})]})}},{key:zl.Age,rawValue:r(a.creationTimestamp)},{key:zl.DockerImage,rawValue:a.image}]})),[o,s]);return e(xe,{richTitle:{icon:on,title:"Pods"},children:[t($t,{variant:Pt.Data,maxHeight:n,isLoading:a,columns:Ul,rows:p}),t(_l,{pod:d,getExtendedPodInfo:i,onClose:()=>u(null)})]})};var Xl;!function(e){e.Gateway="gateway",e.Node="node"}(Xl||(Xl={}));const Hl=[{value:Xl.Gateway,label:"Gateway"},{value:Xl.Node,label:"Node Collector"}],Wl=p.div`
|
|
168
|
-
display: flex;
|
|
169
|
-
align-items: center;
|
|
170
|
-
justify-content: space-between;
|
|
171
|
-
`,Gl=({selectedTab:a,setSelectedTab:n,onClickDownloadDiagnose:o,onClickRefresh:l,loading:i,disabled:s})=>{const r=c(()=>{const e=[];return o&&e.push({id:At(),type:xt.Button,buttonProps:{label:"Download Diagnose",leftIcon:Qa,size:$.S,variant:P.Text,onClick:o,disabled:s}}),l&&e.push({id:At(),type:xt.Button,buttonProps:{label:"Refresh",leftIcon:en,size:$.S,variant:P.Text,onClick:l,disabled:s,loading:i}}),e},[o,l,s,i]);return e(Wl,{children:[e(g,{$gap:12,$alignItems:"center",children:[t(zt,{icon:rn,title:"Pipeline Collectors"}),t(z,{options:Hl,selected:a,setSelected:n,disabled:s})]}),t(Ut,{actions:r})]})},ql=({isOpen:e,onClose:a,title:n,yaml:o})=>t(ht,{isOpen:e,header:{icon:cn,title:n,onClose:a},children:t(Nn,{yaml:o,defaultOpen:!0})});var Kl;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(Kl||(Kl={}));const Yl=({richTitle:a,statusCard:n,textCards:o,manifestYaml:i,configMapYaml:s})=>{const[r,c]=l(null);return e(xe,{richTitle:a,actions:[{id:At(),type:xt.ButtonDropData,buttonProps:{variant:P.Secondary,size:$.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:Kl.ManifestYaml,label:a?.title??"",icon:dn},{id:Kl.ConfigMapYaml,label:"ConfigMap",icon:dn}]}}],children:[e(g,{$gap:16,children:[t(jt,{...n}),o.map(e=>t(Xt,{...e},e.title))]}),t(ql,{isOpen:r===Kl.ManifestYaml,onClose:()=>c(null),title:a?.title??"",yaml:i}),t(ql,{isOpen:r===Kl.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:s})]})},Jl=e=>{switch(e){case Ht.Healthy:return"All desired replicas are updated, available, and ready";case Ht.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case Ht.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case Ht.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case Ht.Down:return"No available replicas";case Ht.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},Ql=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:s,getGatewayPods:r,getNodeCollectorInfo:d,getNodeCollectorPods:u,getExtendedPodInfo:p})=>{const{formatTimeAgo:m}=kt(),{isVersionSupported:h,version:g}=ue(a),[b,f]=l(!1),[v,y]=l(Xl.Gateway),[C,S]=l(null),[k,w]=l([]),[I,D]=l(null),[T,N]=l([]),A=i(async()=>{f(!0);try{switch(v){case Xl.Gateway:S(await s()??null),w(await r()??[]);break;case Xl.Node:D(await d()??null),N(await u()??[])}}catch(e){}f(!1)},[v]);n(()=>{A()},[A]);const E=c(()=>(e=>{switch(e){case Xl.Gateway:return"Deployment";case Xl.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(v),[v]),x=c(()=>((e,t,a,n)=>{const o={status:He.Disabled,label:"No rollouts yet"};let l=!1,i=null;switch(e){case Xl.Gateway:l=t?.rolloutInProgress??!1,i=t?.lastRolloutAt??null;break;case Xl.Node:l=a?.rolloutInProgress??!1,i=a?.lastRolloutAt??null;break;default:return o}return l?{status:Q.Info,label:"Rollout in progress",rightIcon:en,useSecondaryTone:!0}:i?{status:He.Disabled,label:`Last Rollout: ${n(i)}`}:o})(v,C,I,m),[C,I,v,m]),R=c(()=>((e,t,a,n)=>{let o=n?Q.Info:He.Unknown,l=n?"Loading":Ht.Unknown,i=n?"Fetching data...":Jl(Ht.Unknown);switch(e){case Xl.Gateway:o=t?.status?Lt(t?.status):o,l=t?.status??l,i=t?.status?Jl(t.status):i;break;case Xl.Node:o=a?.status?Lt(a?.status):o,l=a?.status??l,i=a?.status?Jl(a.status):i}return{status:o,title:l,description:i}})(v,C,I,b),[C,I,v,b]),O=c(()=>((e,t,a,n)=>{switch(e){case Xl.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 Xl.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[]}})(v,C,I,b),[C,I,v,b]),$=c(()=>(v===Xl.Gateway?C?.manifestYAML:I?.manifestYAML)??"",[C,I,v]),P=c(()=>(v===Xl.Gateway?C?.configMapYAML:I?.configMapYAML)??"",[C,I,v]),F=c(()=>v===Xl.Gateway?k:T,[k,T,v]);return e(Ot,{children:[t(Gl,{disabled:!h,loading:b,selectedTab:v,setSelectedTab:y,onClickDownloadDiagnose:void 0,onClickRefresh:A}),e(Wt,{children:[t(Yl,{richTitle:{icon:cn,title:E,badge:x},statusCard:R,textCards:O,manifestYaml:$,configMapYaml:P}),t(jl,{isLoading:b,tableRowsMaxHeight:o,pods:F,getExtendedPodInfo:p}),!h&&t(Tn,{minSupportedVersion:a,currentVersion:g||""})]})]})},Zl=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};
|