@odigos/ui-kit 0.0.216 → 0.0.217
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 +7 -0
- package/lib/chunks/index-eGTPcqRB.js +3 -0
- package/lib/chunks/{ui-components-DvThY8Em.js → ui-components-DaRAAytB.js} +2 -2
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/index.d.ts +1 -1
- package/lib/containers/_v2/settings/index.d.ts +13 -0
- package/lib/containers/v2.js +102 -156
- package/lib/containers.js +1 -1
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/mock-data/config/index.d.ts +3 -0
- package/lib/snippets/_v2/dynamic-field/index.d.ts +19 -0
- package/lib/snippets/_v2/index.d.ts +1 -0
- package/lib/snippets/v2.js +55 -0
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/config/index.d.ts +78 -0
- package/lib/types/destinations/index.d.ts +2 -2
- package/lib/types/index.d.ts +1 -0
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +10 -5
- package/lib/chunks/index-3rwrQKyF.js +0 -3
package/lib/containers/v2.js
CHANGED
|
@@ -1,58 +1,4 @@
|
|
|
1
|
-
import{
|
|
2
|
-
display: flex;
|
|
3
|
-
flex-direction: column;
|
|
4
|
-
justify-content: flex-end;
|
|
5
|
-
width: ${({$width:e})=>e};
|
|
6
|
-
gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
|
|
7
|
-
`,va=o.div`
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
min-height: 24px;
|
|
11
|
-
padding: 12px;
|
|
12
|
-
border-radius: 16px 16px 0 0;
|
|
13
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
14
|
-
`,ya=o.div`
|
|
15
|
-
display: flex;
|
|
16
|
-
flex-direction: column;
|
|
17
|
-
gap: ${({$gap:e})=>e}px;
|
|
18
|
-
padding: 12px 12px 0 12px;
|
|
19
|
-
width: calc(100% - 24px);
|
|
20
|
-
height: ${({$heightOffset:e,$columnHasHeader:t})=>`calc(100vh - 180px - ${e}px ${t?"- 48px":""})`};
|
|
21
|
-
border-radius: ${({$columnHasHeader:e,$isLeft:t,$isRight:a})=>e?t?"0 0 0 16px":a?"0 16px 0 0":"0":t?"16px 0 0 16px":a?"0 16px 16px 0":"16px"};
|
|
22
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
23
|
-
overflow-y: auto;
|
|
24
|
-
overflow-x: hidden;
|
|
25
|
-
`,ba=({isLeft:o,isRight:n,heightOffset:l=0,width:r,header:i,list:s})=>t(fa,{$width:r,$columnHasHeader:!!i,children:[i&&e(va,{children:i}),e(ya,{$gap:8,$isLeft:o,$isRight:n,$heightOffset:l,$columnHasHeader:!!i,children:s.length?s.length>1?e(f,{gap:8,elements:s}):e(a,{children:s[0]}):e(v,{$height:"100%",children:e(y,{})})})]}),Sa="75vw",Ca=o.div`
|
|
26
|
-
display: flex;
|
|
27
|
-
flex-direction: column;
|
|
28
|
-
border-radius: 16px;
|
|
29
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
30
|
-
overflow: hidden;
|
|
31
|
-
`,ka=o.div`
|
|
32
|
-
display: flex;
|
|
33
|
-
gap: 12px;
|
|
34
|
-
padding: 16px 16px 0 16px;
|
|
35
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
36
|
-
position: sticky;
|
|
37
|
-
top: 0;
|
|
38
|
-
`,wa=o.div`
|
|
39
|
-
padding: 12px 12px 0 12px;
|
|
40
|
-
`,xa=o.div`
|
|
41
|
-
display: flex;
|
|
42
|
-
gap: 12px;
|
|
43
|
-
padding: 16px;
|
|
44
|
-
`,Ta=o.div`
|
|
45
|
-
padding: 5vh 10vw;
|
|
46
|
-
border-radius: 12px;
|
|
47
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
48
|
-
`,Na=o.div`
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: center;
|
|
51
|
-
justify-content: flex-end;
|
|
52
|
-
gap: 16px;
|
|
53
|
-
padding: 0 12px;
|
|
54
|
-
margin-top: auto;
|
|
55
|
-
`,Da=ta(({isOpen:a,withOverlay:o,disableAnimation:n,onClose:l,onBack:r,onNext:i,nextIsSkip:s,onSave:c,disableSave:d,connectionIds:u,header:h,subHeader:m,leftColumn:g,rightColumn:f,search:y,filters:A,errorMessage:I,isFormDirty:$,hideDirtyNote:R,isFetching:E,progress:P},O)=>{const[M,L]=Qt(!1),[F,z]=Qt(!1),[X,V]=Qt(void 0);aa(O,()=>({clearErrors:()=>V(void 0)}));const _=F,B=()=>{$&&!M?L(!0):(L(!1),l?.())},U=d||F||"boolean"==typeof $&&!$,H=!!y||!!u||!!A,j=!!m,K=(H?48:0)+(j?50:0);return t(b,{width:Sa,isOpen:a,disableAnimation:n,hideOverlay:!F&&!o,header:{...h,onClose:l?B:void 0,onCloseDisabled:_},children:[F?e(v,{$height:"calc(100vh - 136px)",children:e(Ta,{children:e(S,{titleSize:C.S,subTitleSize:C.XXXS,withGradient:!0,withSpinner:!0,...P})})}):t(Ca,{children:[H&&t(ka,{children:[u&&e(k,{icon:gt,title:"Selected Clusters",badge:{label:u.value.length}}),y&&e(w,{width:"100%",...y}),A]}),j&&e(wa,{children:e(k,{icon:m.icon,title:m.title,subTitle:m.description,badge:m.badge})}),t(xa,{children:[e(ba,{isLeft:!0,heightOffset:K,...g}),e(ba,{isRight:!0,heightOffset:K,...f})]})]}),t(Na,{children:[E?e(S,{icon:ft,title:"Fetching Data...",titleSize:C.XXS,withGradient:!0}):F?P?null:e(S,{icon:ft,title:"Saving Changes...",titleSize:C.XXS,withGradient:!0}):X||I?e(x,{fullWidth:!0,status:T.Error,message:X||I}):"boolean"==typeof $&&$&&!R?e(x,{fullWidth:!0,status:T.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}):"boolean"!=typeof $||$||R?null:e(x,{fullWidth:!0,status:T.Success,message:"The values reflect the current configuration of the selected cluster."}),t(p,{$gap:8,children:[e("div",r?{style:{width:"150px"},children:e(N,{"data-id":"wide-drawer-back",fullWidth:!0,variant:D.Secondary,label:"Back",leftIcon:vt,onClick:r})}:{style:{width:"150px"},children:e(N,{"data-id":"wide-drawer-cancel",fullWidth:!0,variant:D.Secondary,label:"Cancel",onClick:B,disabled:_})}),e("div",i?{style:{width:"150px"},children:e(N,s?{"data-id":"wide-drawer-skip",fullWidth:!0,variant:D.Secondary,label:"Skip",rightIcon:yt,onClick:i}:{"data-id":"wide-drawer-next",fullWidth:!0,variant:D.Primary,label:"Next",rightIcon:yt,onClick:i})}:{style:{width:"150px"},children:e(N,{"data-id":"wide-drawer-save",fullWidth:!0,variant:D.Primary,label:"Save",onClick:async()=>{z(!0);const e=await c();z(!1),e?.error?V(e.error):(u?.setValue([]),l?.())},disabled:U})})]})]}),e(da,{isOpen:M,onClose:()=>L(!1),onApprove:B})]})});Da.displayName=Da.name;const Aa=o.div`
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as a}from"react/jsx-runtime";import o,{useTheme as n}from"styled-components";import{F as l,c as r,d as i,T as s,e as c,h as d,f as u,i as p,j as h,I as m,k as g,l as f,m as v,K as y,n as b,o as S,p as C,D as k,q as w,B as x,a as T,r as N,s as D,t as A,v as I,N as E,w as R,x as $,y as P,z as O,E as M,G as F,H as L,J as z,L as X,M as V,O as _,P as B,Q as U,R as j,U as H,V as K,W as G,X as W,Y as q,Z as Y,_ as J,$ as Q,a0 as Z,a1 as ee,a2 as te,a3 as ae,a4 as oe,a5 as ne,a6 as le,a7 as re,a8 as ie,a9 as se,aa as ce,ab as de,b as ue,ac as pe,ad as he,ae as me,af as ge,ag as fe,ah as ve,ai as ye,aj as be,ak as Se,al as Ce,am as ke,an as we,ao as xe,ap as Te,aq as Ne,ar as De,as as Ae,at as Ie,au as Ee,av as Re,aw as $e,ax as Pe,u as Oe,ay as Me,az as Fe,aA as Le,S as ze,aB as Xe,aC as Ve,aD as _e,g as Be,aE as Ue,A as je,aF as He,aG as Ke,aH as Ge,aI as We,aJ as qe,aK as Ye,aL as Je,aM as Qe,aN as Ze,aO as et,aP as tt,aQ as at,aR as ot,aS as nt,aT as lt,aU as rt,aV as it,aW as st}from"../chunks/ui-components-DaRAAytB.js";import{ChevronRightIcon as ct,TrashIcon as dt,PlusIcon as ut,BookIcon as pt,VSquareIcon as ht,XSquareIcon as mt,DeleteIcon as gt,EditIcon as ft,GoLogo as vt,JavaLogo as yt,ActionIcon as bt,DestinationIcon as St,ChevronUpIcon as Ct,ChevronDownIcon as kt,VIcon as wt,XIcon as xt,InstrumentationRuleIcon as Tt,SourceIcon as Nt,SamplingIcon as Dt,SettingsIcon as At,ExclamationTriangleIcon as It,ExclamationCircleIcon as Et,KeyIcon as Rt,DiagnoseIcon as $t,DownloadIcon as Pt,TerminalIcon as Ot,RefreshIcon as Mt,ConnectionsIcon as Ft,OdigosLogo as Lt,ArrowRightIcon as zt,PodIcon as Xt,ArrowDownSquareIcon as Vt,ArrowUpSquareIcon as _t,PipelineCollectorIcon as Bt,GatewayIcon as Ut,YamlIcon as jt}from"../icons.js";import{useEffect as Ht,Fragment as Kt,useState as Gt,useCallback as Wt,useContext as qt,createContext as Yt,useMemo as Jt,useRef as Qt,Children as Zt}from"react";import{SignalsCheckboxList as ea,DynamicField as ta,WideDrawer as aa,WIDE_DRAWER_WIDTH as oa,DeleteModal as na,OdigosLogoTextByTier as la,UpgradeModal as ra}from"../snippets/v2.js";import{Y as ia}from"../chunks/index-eGTPcqRB.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 sa=o.div`
|
|
56
2
|
display: flex;
|
|
57
3
|
align-items: center;
|
|
58
4
|
justify-content: space-between;
|
|
@@ -65,39 +11,39 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
65
11
|
&:hover {
|
|
66
12
|
background-color: ${({$isSelected:e,$purpleColors:t,theme:a})=>e?t?a.v2.colors.purple[700]:a.v2.colors.silver[600]:t?a.v2.colors.purple[800]:a.v2.colors.silver[700]};
|
|
67
13
|
}
|
|
68
|
-
`,
|
|
14
|
+
`,ca=o.div`
|
|
69
15
|
display: flex;
|
|
70
16
|
align-items: center;
|
|
71
17
|
justify-content: center;
|
|
72
18
|
padding: 8px;
|
|
73
19
|
border-radius: 8px;
|
|
74
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
75
|
-
`,$a=({dataId:a,icon:o,title:l,description:r,withCarret:i,purpleColors:s,disabled:c,children:u,isSelected:m,onClick:g,isChecked:f,isPartiallyChecked:v,onCheckboxChange:y})=>{const b=n();return t(Aa,{"data-id":a||`list-item-${l}`,$isSelected:m,$purpleColors:s,$disabled:c,onClick:()=>!m&&!c&&g(),children:[t(d,{$gap:4,children:[t(p,{$gap:12,children:[y&&e(h,{partiallyChecked:v||!1,value:f||!1,onChange:e=>y(e)}),o&&e(Ia,{children:e(o,{size:20})}),e(A,{size:C.XS,children:l})]}),r&&e(A,{size:C.XXXS,color:b.v2.colors.silver[200],children:r})]}),(i||u)&&t(p,{$gap:8,children:[u,i&&e(bt,{size:18})]})]})},Ra=[{id:"CREDIT_CARD",label:"Credit card"}],Ea=[{id:$.CollectContainerAttributes,label:"Collect container attributes"},{id:$.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:$.CollectWorkloadId,label:"Collect workload ID"},{id:$.CollectClusterId,label:"Collect cluster ID"}],Pa=[{id:M.Pod,label:M.Pod},{id:M.Namespace,label:M.Namespace},{id:M.Node,label:M.Node}],Oa=[{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:Pa}],Ma=[{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:Pa}],La=[{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:E.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:E.Number}],Fa=$.UrlTemplatizationRulesGroups,za=[{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"}],Xa=[{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:E.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:E.Number}],Va=[{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:E.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:_.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:_.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}],_a={[B.K8sAttributes]:({value:o,setValue:n,formErrors:l})=>(ea(()=>{o[$.CollectContainerAttributes]||o[$.CollectReplicaSetAttributes]||o[$.CollectWorkloadId]||o[$.CollectClusterId]||o[$.LabelsAttributes]?.length||o[$.AnnotationsAttributes]?.length||(n($.CollectContainerAttributes,!0),n($.CollectReplicaSetAttributes,!0),n($.CollectWorkloadId,!0),n($.CollectClusterId,!0),n($.LabelsAttributes,[]),n($.AnnotationsAttributes,[]))},[]),t(a,{children:[e(d,{$gap:6,children:Ea.map(({id:a,label:r})=>t(d,{children:[e(h,{label:r,value:o[a]||!1,onChange:e=>n(a,e)}),e(m,{errorMessage:l[a]})]},a))}),e(O,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:Oa,values:o[$.LabelsAttributes]||[],setValues:e=>n($.LabelsAttributes,e),errorMessage:l[$.LabelsAttributes]}),e(O,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:Ma,values:o[$.AnnotationsAttributes]||[],setValues:e=>n($.AnnotationsAttributes,e),errorMessage:l[$.AnnotationsAttributes]})]})),[B.AddClusterInfo]:({value:o,setValue:l,formErrors:r})=>{const i=n();return t(a,{children:[e(L,{label:"Overwrite existing values",labelAlign:F.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:o[$.OverwriteExistingValues]||!1,onChange:e=>l($.OverwriteExistingValues,e)}),e(O,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:o[$.ClusterAttributes]||[],setValues:e=>l($.ClusterAttributes,e),errorMessage:r[$.ClusterAttributes]})]})},[B.DeleteAttributes]:({value:t,setValue:a,formErrors:o})=>e(z,{name:"attributeNamesToDelete",label:"Attributes to delete",values:t[$.AttributeNamesToDelete]||[],setValues:e=>a($.AttributeNamesToDelete,e),errorMessage:o[$.AttributeNamesToDelete]}),[B.RenameAttributes]:({value:t,setValue:a,formErrors:o})=>e(O,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(t[$.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a($.Renames,t)},errorMessage:o[$.Renames]}),[B.PiiMasking]:({value:a,setValue:o,formErrors:n})=>(ea(()=>{a[$.PiiCategories]?.length||o($.PiiCategories,Ra.map(({id:e})=>e))},[]),t(d,{$gap:12,children:[e(u,{label:"Attributes to mask"}),e(d,{$gap:6,children:Ra.map(({id:t,label:n})=>e(h,{label:n,value:a[$.PiiCategories]?.includes(t)||!1,onChange:e=>{const n=a[$.PiiCategories]||[],l=e?[...n,t]:n.filter(e=>e!==t);o($.PiiCategories,l)}},t))}),e(m,{errorMessage:n[$.PiiCategories]})]})),[B.ErrorSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.FallbackSamplingRatio],l=P(t[$.FallbackSamplingRatio])?"":String(t[$.FallbackSamplingRatio]);return e(R,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:E.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a($.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[B.ProbabilisticSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.SamplingPercentage],l=P(t[$.SamplingPercentage])?"":String(t[$.SamplingPercentage]);return e(R,{name:"samplingPercentage",label:"Sampling percentage",type:E.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a($.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[B.LatencySampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.EndpointsFilters],l=t[$.EndpointsFilters]||[];return e(O,{name:"endpointsFilters",limitFieldsPerRow:2,columns:La,values:l,setValues:e=>{a($.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:o})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(o)})))},errorMessage:n})},[B.ServiceNameSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.ServicesNameFilters],l=t[$.ServicesNameFilters]||[];return e(O,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:Xa,values:l,setValues:e=>{a($.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[B.SpanAttributeSampler]:({value:t,setValue:a,formErrors:o})=>{const n=o[$.AttributeFilters],l=(t[$.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o})=>{const n=Object.entries(o).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o[n]?.operation,expectedValue:o[n]?.expectedValue,jsonPath:o[n]?.jsonPath}});return e(O,{name:"attributeFilters",limitFieldsPerRow:2,columns:Va,values:l,setValues:e=>{a($.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n,expectedValue:l,jsonPath:r})=>{const i={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[o]:{operation:n,expectedValue:l}}};return r&&(i.condition[o].jsonPath=r),i}))},errorMessage:n})},[B.URLTemplatization]:({value:o,setValue:l,formErrors:r})=>{const i=n(),s=o[Fa]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],c=e=>l(Fa,e),h=(e,t)=>c(s.map((a,o)=>o===e?{...a,...t}:a));return t(a,{children:[s.map((a,o)=>t(oa,{children:[e(X,{}),t(d,{$gap:12,children:[t(p,{$justifyContent:"space-between",$alignItems:"center",children:[e(u,{label:`Rule Group ${o+1}`}),e(N,{leftIcon:()=>e(St,{fill:i.v2.colors.red[500]}),variant:D.Secondary,size:V.S,onClick:()=>{return e=o,c(s.filter((t,a)=>a!==e));var e},disabled:1===s.length})]}),e(R,{name:`urlGroup-${o}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>h(o,{filterK8sNamespace:e.target.value})}),e(O,{name:`urlGroup-${o}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:za,values:a.workloadFilters||[],setValues:e=>h(o,{workloadFilters:e})}),e(z,{name:`urlGroup-${o}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>h(o,{templatizationRules:e.map(e=>({template:e}))})})]}),e(m,{errorMessage:r[Fa]})]},`url-templatization-group-${o}`)),e(N,{variant:D.Secondary,label:"Add rule group",leftIcon:Ct,onClick:()=>c([...s,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),e(X,{})]})}},Ba=({actionType:t,value:a,setValue:o,formErrors:n})=>{if(!t)return null;const l=_a[t];return l?e(l,{value:a,setValue:o,formErrors:n}):null},Ua={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},Ha=ra({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:s(Ua)}),errorMessage:void 0}),ja=({children:t})=>{const[a,o]=Qt(null),[n,l]=Qt(void 0),r=U(Ua),i=na(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),e?.type&&r.handleFormChange("type",e.type),o(e)},[]),c=na(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:s(Ua)};const e=(t=r.formData,s(t));var t;const o={};r.handleErrorChange(void 0,void 0,o);const n=Object.keys(o).length>0?"Invalid form values":void 0;return l(n),{errorMessage:n,preparedFormData:e}},[r,a]);return e(Ha.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:c,errorMessage:n},children:t})},Ka=()=>la(Ha),Ga=()=>{const a=n(),{selectedOption:o,genericForm:l}=Ka();if(!l||!o)return e(y,{title:"No active form"});const{formData:r,handleFormChange:i,formErrors:s}=l;return t(d,{$gap:24,children:[t(p,{$gap:12,$justifyContent:"space-between",children:[e(A,{size:C.XXS,children:o.docsDescription}),e(N,{label:"Docs",leftIcon:kt,variant:D.Text,size:V.S,onClick:()=>window.open(`${H}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(j,{options:[{icon:gt,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:r.disabled,setSelected:e=>i("disabled",e)}),e(ma,{title:"Signals for processing",allowedSignals:o.allowedSignals,selectedSignals:r.signals||[],setSelectedSignals:e=>i("signals",e),errorMessage:s.signals}),e(R,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:r.name||"",onChange:({target:{value:e}})=>i("name",e),errorMessage:s.name}),e(Ba,{actionType:o.type,value:r.fields,setValue:(e,t)=>i(`fields.${e}`,t),formErrors:s}),e(K,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:r.notes||"",onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},Wa=({signals:a,fields:o,disabled:n,formData:l,handleFormChange:r,formErrors:i})=>o?.map(({renderCondition:o,componentType:s,type:c,name:u,title:p,tooltip:g,placeholder:f,value:v,required:y,options:b})=>{if(!(!o||G(o,a,l.fields)))return null;const S=u,C=l.fields.find(e=>e.key===S),k=C?C.value:v;switch(s){case _.Input:return e(R,{name:S,type:c,label:p,tooltip:g,required:y,placeholder:f,value:k,onChange:e=>r(S,e.target.value),disabled:n,errorMessage:i[S]},S);case _.MultiInput:return e(z,{label:p,tooltip:g,required:y,placeholder:f,values:q(k,[]),setValues:e=>r(S,JSON.stringify(e)),disabled:n,errorMessage:i[S]},S);case _.KeyValuePair:return e(O,{label:p,tooltip:g,required:y,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:q(k,[]),setValues:e=>r(S,JSON.stringify(e)),disabled:n,errorMessage:i[S]},S);case _.TextArea:return e(K,{name:S,label:p,tooltip:g,required:y,placeholder:f,value:k,onChange:e=>r(S,e.target.value),disabled:n,errorMessage:i[S]},S);case _.Checkbox:return t(d,{children:[e(h,{label:p,value:"true"==k,onChange:e=>r(S,e.toString()),disabled:n}),e(m,{errorMessage:i[S]})]},S);case _.Dropdown:return e(W,{name:S,label:p,withSearch:!0,values:k?[k]:[],options:b?.map(e=>({id:e.id||"",label:e.value||""}))||[],setValues:e=>r(S,e[0]),disabled:n,errorMessage:i[S]},S);default:return null}}),qa={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},Ja={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,formErrorMessage:void 0,validateFormData:()=>({isOk:!1,preparedFormData:s(qa)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Ya=ra(Ja),Qa=({children:t})=>{const{selectedStreamName:a}=J(),[o,n]=Qt(null),[l,r]=Qt(),[i,c]=Qt(Ja.unsavedDestinations),d=ia(()=>"number"==typeof o?.unsavedIdx?i[o.unsavedIdx]:void 0,[o,i]),u=na((e,t)=>{o&&(c(t=>[...t,{...e,option:o.option}]),n(t?e=>e?{...e,unsavedIdx:i.length}:null:null))},[o,i.length]),p=na((e,t,a)=>{o&&(c(a=>a.map((a,n)=>n===e?{...a,...t,option:o.option}:a)),a||n(null))},[o]),h=na(e=>{c(t=>t.filter((t,a)=>a!==e)),n(null)},[]),m=U({...qa,currentStreamName:a});ea(()=>{if(o)if(d)m.handleFormChange(void 0,void 0,d.formData);else{m.handleFormChange("type",o.option.type),m.handleFormChange("name",o.option.displayName),m.handleFormChange("disabled",!1);const e=Y(o.option.supportedSignals);m.handleFormChange("exportedSignals",{logs:e.includes(Q.Logs),metrics:e.includes(Q.Metrics),traces:e.includes(Q.Traces)}),m.handleFormChange("fields",o.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[o,d]);const g=na(e=>{var t;m.resetFormData(),m.handleErrorChange(void 0,void 0,{}),r(void 0),n(e?{...e,dynamicFields:e.option?.fields?(t=e.option.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:o,displayName:n,initialValue:l,renderCondition:r}=e,i=a===_.Dropdown,s=q(o,{});return{componentType:a,renderCondition:r,name:t,title:n,value:l,placeholder:s.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}})):[]}:null)},[]),f=na(()=>{const e=s(m.formData),t={};o?.dynamicFields.forEach(({name:a,required:o})=>{if(o){const o=e.fields.find(e=>e.key===a)?.value;P(o)&&(t[a]=ee.FIELD_IS_REQUIRED)}});Z(e.exportedSignals).length||(t.exportedSignals=ee.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return m.handleErrorChange(void 0,void 0,t),r(a),{errorMessage:a,preparedFormData:e}},[m,o]);return e(Ya.Provider,{value:{activeForm:o,onChangeActiveForm:g,genericForm:m,formErrorMessage:l,validateFormData:f,unsavedDestinations:i,thisUnsavedDestination:d,setUnsavedDestinations:c,addUnsavedDestination:u,updateUnsavedDestination:p,deleteUnsavedDestination:h},children:t})},Za=()=>la(Ya),eo=o(p)`
|
|
20
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+d["004"]};
|
|
21
|
+
`,da=({dataId:a,icon:o,title:d,description:u,withCarret:p,purpleColors:h,disabled:m,children:g,isSelected:f,onClick:v,isChecked:y,isPartiallyChecked:b,onCheckboxChange:S})=>{const C=n();return e(sa,{"data-id":a||`list-item-${d}`,$isSelected:f,$purpleColors:h,$disabled:m,onClick:()=>!f&&!m&&v(),children:[e(l,{$gap:4,children:[e(r,{$gap:12,children:[S&&t(i,{partiallyChecked:b||!1,value:y||!1,onChange:e=>S(e)}),o&&t(ca,{children:t(o,{size:20})}),t(s,{size:c.XS,children:d})]}),u&&t(s,{size:c.XXXS,color:C.v2.colors.silver[200],children:u})]}),(p||g)&&e(r,{$gap:8,children:[g,p&&t(ct,{size:18})]})]})},ua=[{id:"CREDIT_CARD",label:"Credit card"}],pa=[{id:u.CollectContainerAttributes,label:"Collect container attributes"},{id:u.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:u.CollectWorkloadId,label:"Collect workload ID"},{id:u.CollectClusterId,label:"Collect cluster ID"}],ha=[{id:y.Pod,label:y.Pod},{id:y.Namespace,label:y.Namespace},{id:y.Node,label:y.Node}],ma=[{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:ha}],ga=[{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:ha}],fa=[{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:g.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:g.Number}],va=u.UrlTemplatizationRulesGroups,ya=[{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"}],ba=[{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:g.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:g.Number}],Sa=[{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:g.Number},{label:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",componentType:N.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:N.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}],Ca={[D.K8sAttributes]:({value:o,setValue:n,formErrors:r})=>(Ht(()=>{o[u.CollectContainerAttributes]||o[u.CollectReplicaSetAttributes]||o[u.CollectWorkloadId]||o[u.CollectClusterId]||o[u.LabelsAttributes]?.length||o[u.AnnotationsAttributes]?.length||(n(u.CollectContainerAttributes,!0),n(u.CollectReplicaSetAttributes,!0),n(u.CollectWorkloadId,!0),n(u.CollectClusterId,!0),n(u.LabelsAttributes,[]),n(u.AnnotationsAttributes,[]))},[]),e(a,{children:[t(l,{$gap:6,children:pa.map(({id:a,label:s})=>e(l,{children:[t(i,{label:s,value:o[a]||!1,onChange:e=>n(a,e)}),t(h,{errorMessage:r[a]})]},a))}),t(v,{name:"labelsAttributes",label:"Label attributes",limitFieldsPerRow:2,columns:ma,values:o[u.LabelsAttributes]||[],setValues:e=>n(u.LabelsAttributes,e),errorMessage:r[u.LabelsAttributes]}),t(v,{name:"annotationsAttributes",label:"Annotation attributes",limitFieldsPerRow:2,columns:ga,values:o[u.AnnotationsAttributes]||[],setValues:e=>n(u.AnnotationsAttributes,e),errorMessage:r[u.AnnotationsAttributes]})]})),[D.AddClusterInfo]:({value:o,setValue:l,formErrors:r})=>{const i=n();return e(a,{children:[t(b,{label:"Overwrite existing values",labelAlign:S.Left,labelColor:i.v2.colors.silver[200],tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",value:o[u.OverwriteExistingValues]||!1,onChange:e=>l(u.OverwriteExistingValues,e)}),t(v,{name:"clusterAttributes",label:"Resource attributes",limitFieldsPerRow:2,columns:[{keyName:"attributeName",label:"Attribute name"},{keyName:"attributeStringValue",label:"Attribute value"}],values:o[u.ClusterAttributes]||[],setValues:e=>l(u.ClusterAttributes,e),errorMessage:r[u.ClusterAttributes]})]})},[D.DeleteAttributes]:({value:e,setValue:a,formErrors:o})=>t(C,{name:"attributeNamesToDelete",label:"Attributes to delete",values:e[u.AttributeNamesToDelete]||[],setValues:e=>a(u.AttributeNamesToDelete,e),errorMessage:o[u.AttributeNamesToDelete]}),[D.RenameAttributes]:({value:e,setValue:a,formErrors:o})=>t(v,{name:"renames",label:"Attributes to rename",limitFieldsPerRow:2,columns:[{keyName:"oldKey",label:"Old key"},{keyName:"newKey",label:"New key"}],values:Object.entries(e[u.Renames]||{}).map(([e,t])=>({oldKey:e,newKey:t})),setValues:e=>{const t={};e.forEach(e=>t[e.oldKey]=e.newKey),a(u.Renames,t)},errorMessage:o[u.Renames]}),[D.PiiMasking]:({value:a,setValue:o,formErrors:n})=>(Ht(()=>{a[u.PiiCategories]?.length||o(u.PiiCategories,ua.map(({id:e})=>e))},[]),e(l,{$gap:12,children:[t(p,{label:"Attributes to mask"}),t(l,{$gap:6,children:ua.map(({id:e,label:n})=>t(i,{label:n,value:a[u.PiiCategories]?.includes(e)||!1,onChange:t=>{const n=a[u.PiiCategories]||[],l=t?[...n,e]:n.filter(t=>t!==e);o(u.PiiCategories,l)}},e))}),t(h,{errorMessage:n[u.PiiCategories]})]})),[D.ErrorSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.FallbackSamplingRatio],l=f(e[u.FallbackSamplingRatio])?"":String(e[u.FallbackSamplingRatio]);return t(m,{name:"fallbackSamplingRatio",label:"Fallback sampling ratio",type:g.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(u.FallbackSamplingRatio,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[D.ProbabilisticSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.SamplingPercentage],l=f(e[u.SamplingPercentage])?"":String(e[u.SamplingPercentage]);return t(m,{name:"samplingPercentage",label:"Sampling percentage",type:g.Number,min:0,max:100,value:l,placeholder:"0-100",onChange:e=>{return t=e.target.value,a(u.SamplingPercentage,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[D.LatencySampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.EndpointsFilters],l=e[u.EndpointsFilters]||[];return t(v,{name:"endpointsFilters",limitFieldsPerRow:2,columns:fa,values:l,setValues:e=>{a(u.EndpointsFilters,e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:o})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(o)})))},errorMessage:n})},[D.ServiceNameSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.ServicesNameFilters],l=e[u.ServicesNameFilters]||[];return t(v,{name:"servicesNameFilters",limitFieldsPerRow:2,columns:ba,values:l,setValues:e=>{a(u.ServicesNameFilters,e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)})))},errorMessage:n})},[D.SpanAttributeSampler]:({value:e,setValue:a,formErrors:o})=>{const n=o[u.AttributeFilters],l=(e[u.AttributeFilters]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o})=>{const n=Object.entries(o).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:o[n]?.operation,expectedValue:o[n]?.expectedValue,jsonPath:o[n]?.jsonPath}});return t(v,{name:"attributeFilters",limitFieldsPerRow:2,columns:Sa,values:l,setValues:e=>{a(u.AttributeFilters,e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:o,operation:n,expectedValue:l,jsonPath:r})=>{const i={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[o]:{operation:n,expectedValue:l}}};return r&&(i.condition[o].jsonPath=r),i}))},errorMessage:n})},[D.URLTemplatization]:({value:o,setValue:i,formErrors:s})=>{const c=n(),d=o[va]||[{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}],u=e=>i(va,e),g=(e,t)=>u(d.map((a,o)=>o===e?{...a,...t}:a));return e(a,{children:[d.map((a,o)=>e(Kt,{children:[t(k,{}),e(l,{$gap:12,children:[e(r,{$justifyContent:"space-between",$alignItems:"center",children:[t(p,{label:`Rule Group ${o+1}`}),t(w,{leftIcon:()=>t(dt,{fill:c.v2.colors.red[500]}),variant:T.Secondary,size:x.S,onClick:()=>{return e=o,u(d.filter((t,a)=>a!==e));var e},disabled:1===d.length})]}),t(m,{name:`urlGroup-${o}-namespace`,label:"Namespace",placeholder:"All namespaces",tooltip:"Filter rules to a specific Kubernetes namespace.",value:a.filterK8sNamespace||"",onChange:e=>g(o,{filterK8sNamespace:e.target.value})}),t(v,{name:`urlGroup-${o}-workloadFilters`,label:"Workload filters",tooltip:"Optionally scope templates to specific workloads.",columns:ya,values:a.workloadFilters||[],setValues:e=>g(o,{workloadFilters:e})}),t(C,{name:`urlGroup-${o}-templates`,label:"Templates",required:!0,placeholder:"e.g. /user/{id}",values:a.templatizationRules.map(e=>e.template),setValues:e=>g(o,{templatizationRules:e.map(e=>({template:e}))})})]}),t(h,{errorMessage:s[va]})]},`url-templatization-group-${o}`)),t(w,{variant:T.Secondary,label:"Add rule group",leftIcon:ut,onClick:()=>u([...d,{filterK8sNamespace:"",workloadFilters:[],templatizationRules:[{template:""}],notes:""}])}),t(k,{})]})}},ka=({actionType:e,value:a,setValue:o,formErrors:n})=>{if(!e)return null;const l=Ca[e];return l?t(l,{value:a,setValue:o,formErrors:n}):null},wa={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},xa=Yt({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:I(wa)}),errorMessage:void 0}),Ta=({children:e})=>{const[a,o]=Gt(null),[n,l]=Gt(void 0),r=A(wa),i=Wt(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),e?.type&&r.handleFormChange("type",e.type),o(e)},[]),s=Wt(()=>{if(!a)return{errorMessage:"No action type selected",preparedFormData:I(wa)};const e=(t=r.formData,I(t));var t;const o={};r.handleErrorChange(void 0,void 0,o);const n=Object.keys(o).length>0?"Invalid form values":void 0;return l(n),{errorMessage:n,preparedFormData:e}},[r,a]);return t(xa.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:s,errorMessage:n},children:e})},Na=()=>qt(xa),Da=()=>{const a=n(),{selectedOption:o,genericForm:i}=Na();if(!i||!o)return t(E,{title:"No active form"});const{formData:d,handleFormChange:u,formErrors:p}=i;return e(l,{$gap:24,children:[e(r,{$gap:12,$justifyContent:"space-between",children:[t(s,{size:c.XXS,children:o.docsDescription}),t(w,{label:"Docs",leftIcon:pt,variant:T.Text,size:x.S,onClick:()=>window.open(`${R}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t($,{options:[{icon:ht,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:mt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:d.disabled,setSelected:e=>u("disabled",e)}),t(ea,{title:"Signals for processing",allowedSignals:o.allowedSignals,selectedSignals:d.signals||[],setSelectedSignals:e=>u("signals",e),errorMessage:p.signals}),t(m,{name:"actionName",label:"Action name",placeholder:"Use a name that describes the action...",value:d.name||"",onChange:({target:{value:e}})=>u("name",e),errorMessage:p.name}),t(ka,{actionType:o.type,value:d.fields,setValue:(e,t)=>u(`fields.${e}`,t),formErrors:p}),t(P,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:d.notes||"",onChange:({target:{value:e}})=>u("notes",e),errorMessage:p.notes})]})},Aa=({signals:e,fields:a,disabled:o,formData:n,handleFormChange:l,formErrors:r})=>a?.map(({renderCondition:a,componentType:i,type:s,name:c,title:d,tooltip:u,placeholder:p,value:h,required:m,options:g})=>{if(!(!a||O(a,e,n.fields)))return null;const f=c,v=n.fields.find(e=>e.key===f),y=v?v.value:h;return t(ta,{componentType:i,inputType:s,name:f,label:d,tooltip:u,disabled:o,required:m,placeholder:p,errorMessage:r[f],dropdownOptions:g,value:y||"",setValue:e=>l(f,e)},f)}),Ia={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1},fields:[]},Ea={activeForm:null,onChangeActiveForm:()=>{},genericForm:void 0,formErrorMessage:void 0,validateFormData:()=>({isOk:!1,preparedFormData:I(Ia)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},Ra=Yt(Ea),$a=({children:e})=>{const{selectedStreamName:a}=M(),[o,n]=Gt(null),[l,r]=Gt(),[i,s]=Gt(Ea.unsavedDestinations),c=Jt(()=>"number"==typeof o?.unsavedIdx?i[o.unsavedIdx]:void 0,[o,i]),d=Wt((e,t)=>{o&&(s(t=>[...t,{...e,option:o.option}]),n(t?e=>e?{...e,listType:F.UNSAVED,unsavedIdx:i.length}:null:null))},[o,i.length]),u=Wt((e,t,a)=>{o&&(s(a=>a.map((a,n)=>n===e?{...a,...t,option:o.option}:a)),n(a?e=>e?{...e,listType:F.UNSAVED}:null:null))},[o]),p=Wt(e=>{s(t=>t.filter((t,a)=>a!==e)),n(null)},[]),h=A({...Ia,currentStreamName:a});Ht(()=>{if(o)if(c)h.handleFormChange(void 0,void 0,c.formData);else{h.handleFormChange("type",o.option.type),h.handleFormChange("name",o.option.displayName),h.handleFormChange("disabled",!1);const e=L(o.option.supportedSignals);h.handleFormChange("exportedSignals",{logs:e.includes(z.Logs),metrics:e.includes(z.Metrics),traces:e.includes(z.Traces)}),h.handleFormChange("fields",o.dynamicFields.map(e=>({key:e.name,value:e.value})))}},[o,c]);const m=Wt(e=>{var t;h.resetFormData(),h.handleErrorChange(void 0,void 0,{}),r(void 0),n(e?{...e,dynamicFields:e.option?.fields?(t=e.option.fields,t.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:o,displayName:n,initialValue:l,renderCondition:r}=e,i=a===N.Dropdown,s=V(o,{});return{componentType:a,renderCondition:r,name:t,title:n,value:l,placeholder:s.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(s.values)?s.values.map(e=>({id:e,value:e})):void 0,...s}})):[]}:null)},[]),g=Wt(()=>{const e=I(h.formData),t={};o?.dynamicFields.forEach(({name:a,required:o})=>{if(o){const o=e.fields.find(e=>e.key===a)?.value;f(o)&&(t[a]=_.FIELD_IS_REQUIRED)}});X(e.exportedSignals).length||(t.exportedSignals=_.FIELD_IS_REQUIRED);const a=0===Object.keys(t).length?void 0:"Invalid form values";return h.handleErrorChange(void 0,void 0,t),r(a),{errorMessage:a,preparedFormData:e}},[h,o]);return t(Ra.Provider,{value:{activeForm:o,onChangeActiveForm:m,genericForm:h,formErrorMessage:l,validateFormData:g,unsavedDestinations:i,thisUnsavedDestination:c,setUnsavedDestinations:s,addUnsavedDestination:d,updateUnsavedDestination:u,deleteUnsavedDestination:p},children:e})},Pa=()=>qt(Ra),Oa=o(r)`
|
|
76
22
|
position: sticky;
|
|
77
23
|
bottom: 0;
|
|
78
24
|
margin-top: auto;
|
|
79
25
|
padding: 12px 0;
|
|
80
26
|
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
81
27
|
z-index: 1;
|
|
82
|
-
`,to=({testConnection:a})=>{const o=n(),{activeForm:l,genericForm:r,validateFormData:i,thisUnsavedDestination:s,addUnsavedDestination:c,updateUnsavedDestination:u,deleteUnsavedDestination:h}=Za(),[m,g]=Qt(s?.testResult),[f,v]=Qt(!!s||!1);if(ea(()=>{if(s){g(s.testResult);const e=s.testResult&&!s.testResult.succeeded;v(!e)}else g(void 0),v(!1)},[s]),!r||!l)return e(y,{title:"No active form"});const b=async()=>{if(!l.option.testConnectionSupported)return;const e=await a(r.formData);return g(e),e};return t(d,{$gap:24,style:{minHeight:"100%"},children:[t(p,{$gap:12,$justifyContent:"space-between",children:[m?m.succeeded?e(x,{status:T.Success,message:m.message||"Connection OK",fullWidth:!0,smallIcon:!0}):e(x,{status:T.Error,message:m.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):e("div",{}),e(N,{"data-id":"dest-form-docs",label:"Docs",leftIcon:kt,variant:D.Text,size:V.S,onClick:()=>window.open(`${H}/backends/${l.option.type}`,"_blank","noopener noreferrer")})]}),e(j,{options:[{icon:gt,label:"Enabled",value:!1,selectedBgColor:o.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:o.v2.colors.red[800]}],selected:r.formData.disabled,setSelected:e=>r.handleFormChange("disabled",e),disabled:f}),e(ma,{title:"This connection will monitor:",allowedSignals:Y(l.option.supportedSignals),selectedSignals:Z(r.formData.exportedSignals),setSelectedSignals:e=>r.handleFormChange("exportedSignals",{logs:e.includes(Q.Logs),metrics:e.includes(Q.Metrics),traces:e.includes(Q.Traces)}),disabled:f,errorMessage:r.formErrors.exportedSignals}),e(R,{label:"Destination name",placeholder:"Use a name that describes the destination...",value:r.formData.name,onChange:({target:{value:e}})=>r.handleFormChange("name",e),disabled:f,errorMessage:r.formErrors.name}),e(Wa,{signals:Z(r.formData.exportedSignals),fields:l.dynamicFields,disabled:f,formData:r.formData,handleFormChange:(e,t)=>{r.handleFormChange("fields",r.formData.fields.map(a=>a.key===e?{...a,value:t}:a))},formErrors:r.formErrors}),t(eo,{$gap:8,$justifyContent:"flex-end",children:[s&&e("div",{style:{width:"150px"},children:e(N,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:xt,variant:D.Secondary,textColor:o.v2.colors.red[500],onClick:()=>h(l.unsavedIdx)})}),(!s||s.option.testConnectionSupported&&!f)&&e("div",{style:{width:"150px"},children:e(N,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:D.Secondary,onClick:b})}),s&&e("div",f?{style:{width:"150px"},children:e(N,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:Tt,variant:D.Secondary,onClick:()=>v(!1)})}:{style:{width:"150px"},children:e(N,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:D.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=i();if(!e){const e=await b(),a=!!e&&!e.succeeded;u(l.unsavedIdx,{formData:t,testResult:e},a)}}})}),!s&&e("div",{style:{width:"150px"},children:e(N,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:D.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=i();if(!e){const e=await b(),a=!!e&&!e.succeeded;c({formData:t,testResult:e},a)}}})})]})]})},ao=[{id:te.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:te.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:te.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],oo=[{id:te.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:te.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:te.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],no=["*"],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:""}],ro={[ie.Java]:[new re("","")],[ie.Golang]:[new le("")]},io={[se.CodeAttributes]:({value:o,setValue:l,formErrors:r})=>{const i=n(),s=r.codeAttributes,c=ia(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);ea(()=>{if(!c.length&&!s){const e={[te.FilePath]:!0,[te.Function]:!0,[te.LineNumber]:!0,[te.Column]:null,[te.Namespace]:null,[te.StackTrace]:null};l("codeAttributes",e)}},[]);const u=(e,t)=>{const a=t?[...c,e]:c.filter(t=>t!==e),o=Object.values(te).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});l("codeAttributes",o)};return t(a,{children:[t(d,{$gap:12,children:[e(A,{size:C.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),e(d,{$gap:6,children:ao.map(({id:t,label:a,tooltip:o})=>e(ae,{text:o,withIcon:!0,children:e(h,{label:a,value:c.includes(t),onChange:e=>u(t,e)})},t))}),e(m,{errorMessage:s})]}),t(d,{$gap:12,children:[e(A,{size:C.XS,color:i.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),e(d,{$gap:6,children:oo.map(({id:t,label:a,tooltip:o})=>e(ae,{text:o,withIcon:!0,children:e(h,{label:a,value:c.includes(t),onChange:e=>u(t,e)})},t))}),e(m,{errorMessage:s})]})]})},[se.CustomInstrumentation]:({value:o,setValue:n,formErrors:l})=>{const r=l.customInstrumentations,i=ia(()=>(o?.customInstrumentations?.[ie.Golang]||[]).map(e=>new le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),s=ia(()=>(o?.customInstrumentations?.[ie.Java]||[]).map(e=>new re(e.className,e.methodName)),[o]);return ea(()=>{o?.customInstrumentations||r||n("customInstrumentations",{[ie.Golang]:ro[ie.Golang],[ie.Java]:ro[ie.Java]})},[]),t(a,{children:[t(d,{children:[t(p,{$gap:8,children:[e(Nt,{}),e(u,{label:"Golang custom probes"})]}),e(O,{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:i,setValues:e=>{const t={};t[ie.Golang]=e.map(e=>new le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[ie.Java]=s,n("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]}),t(d,{children:[t(p,{$gap:8,children:[e(Dt,{}),e(u,{label:"Java custom probes"})]}),e(O,{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:s,setValues:e=>{const t={};t[ie.Golang]=i,t[ie.Java]=e.map(e=>new re(e.className,e.methodName)),n("customInstrumentations",t)},errorMessage:r,limitFieldsPerRow:2})]})]})},[se.HeadersCollection]:({value:t,setValue:a,formErrors:o})=>{const n=o.headersCollection,l=ia(()=>t?.headersCollection?.[oe.HeaderKeys]||[],[t]),r=e=>{const t={[oe.HeaderKeys]:e};a("headersCollection",t)};return ea(()=>{l.length||n||r(no)},[]),e(z,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:r,errorMessage:n})},[se.PayloadCollection]:({value:a,setValue:o,formErrors:l})=>{const r=n(),i=l.payloadCollection,s=ia(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);ea(()=>{if(!s.length&&!i){const e={[ne.HttpRequest]:{},[ne.HttpResponse]:{},[ne.DbQuery]:{},[ne.Messaging]:{}};o("payloadCollection",e)}},[]);return t(d,{$gap:12,children:[e(A,{size:C.XS,color:r.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),e(d,{$gap:6,children:lo.map(({id:t,label:a,tooltip:n})=>e(ae,{text:n,withIcon:!0,children:e(h,{label:a,value:s.includes(t),onChange:e=>((e,t)=>{const a=t?[...s,e]:s.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)})(t,e)})},t))}),e(m,{errorMessage:i})]})},[se.UnknownType]:null},so=({ruleType:t,value:a,setValue:o,formErrors:n})=>{if(!t)return null;const l=io[t];return l?e(l,{value:a,setValue:o,formErrors:n}):null},co={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},uo=ra({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:s(co)}),errorMessage:void 0}),po=({children:t})=>{const[a,o]=Qt(null),[n,l]=Qt(void 0),r=U(co),i=na(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),o(e)},[]),c=na(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:s(co)};const e=(e=>{const t=s(e);return t.headersCollection?.[oe.HeaderKeys]?.length&&(t.headersCollection[oe.HeaderKeys]=t.headersCollection[oe.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[ie.Golang]?.length&&(t.customInstrumentations[ie.Golang]=t.customInstrumentations[ie.Golang].map(e=>new le(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 re(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?.[oe.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 o=Object.keys(t).length>0?"Invalid form values":void 0;return l(o),{errorMessage:o,preparedFormData:e}},[r,a]);return e(uo.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:c,errorMessage:n},children:t})},ho=()=>la(uo),mo=()=>{const a=n(),{selectedOption:o,genericForm:l}=ho();if(!l||!o)return e(y,{title:"No active form"});const{formData:r,handleFormChange:i,formErrors:s}=l;return t(d,{$gap:24,children:[t(p,{$gap:12,$justifyContent:"space-between",children:[e(A,{size:C.XXS,children:o.docsDescription}),e(N,{label:"Docs",leftIcon:kt,variant:D.Text,size:V.S,onClick:()=>window.open(`${H}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),t(p,{$gap:12,children:[e(A,{size:C.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),o.supportedLanguages.map(t=>e(ce,{label:de[t],leftIcon:ue(t),status:T.Default,useSecondaryTone:!0},t))]}),e(j,{options:[{icon:gt,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:wt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:r.disabled,setSelected:e=>i("disabled",e)}),e(R,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:r.ruleName,onChange:({target:{value:e}})=>i("ruleName",e),errorMessage:s.ruleName}),e(so,{ruleType:o.type,value:r,setValue:(e,t)=>i(e,t),formErrors:s}),e(K,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:r.notes,onChange:({target:{value:e}})=>i("notes",e),errorMessage:s.notes})]})},go=ra({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),fo=({children:t,selectedConnectionIds:a,getAllClusterSnapshots:o,fetchNamespacesWithWorkloads:n,initialInputs:l})=>{const{tier:c}=r(),d=c===i.Onprem,{selectedStreamName:u}=J(),[p,h]=Qt(!1),[m,g]=Qt(null),f=na(async()=>{try{if(h(!0),o){const e=await o();e&&g(e)}else if(n){const e=await n();e.data?.length&&g({clusters:[{clusterId:he,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)}},[]);ea(()=>{f()},[]);const[v,y]=Qt([]);ea(()=>{m&&y(e=>{const t=((e,t)=>s(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(m,a);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),o=a??t;if(l?.[t.clusterId]){const e=l[t.clusterId],a=s(o);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=>{me.has(e.kind)&&!d||(e.selected=!0)})}),a}return o})})},[m,a,l]);const{formDiff:b,isFormDirty:S}=ia(()=>{const e=((e,t,a)=>{const o={};return e.forEach(e=>{e.namespaces.forEach(n=>{const l=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),r=n.selected||!1,i=r!==l?.selected;if(i&&(o[e.clusterId]||(o[e.clusterId]=[]),o[e.clusterId].push({namespace:n.name,selected:r,currentStreamName:a}),r&&(o[e.clusterId]=o[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!i||!r){const t=((e,t,a)=>{const o=[];return t.workloads.forEach(n=>{const l=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==l?.selected&&o.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:a})}),o})(l,n,a);t.length>0&&(o[e.clusterId]||(o[e.clusterId]=[]),o[e.clusterId].push(...t))}})}),o})(v,m?.clusters||[],u);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[v,m,u]),C=na(e=>!d&&me.has(e),[d]),k=na(({clusterId:e,workloadId:t,selected:a,auto:o})=>{y(n=>{const l=s(n),r=l.findIndex(t=>t.clusterId===e);if(-1===r)return l;const i=l[r].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return l;if(t.kind&&t.name){const e=l[r].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return l;const o="boolean"==typeof a?a:!l[r].namespaces[i].workloads[e].selected;if(l[r].namespaces[i].workloads[e].selected=o,o){l[r].namespaces[i].workloads.filter(e=>!C(e.kind)).every(e=>e.selected)&&(l[r].namespaces[i].selected=!0)}else l[r].namespaces[i].selected=!1}else{const e="boolean"==typeof o?o:!l[r].namespaces[i].selected;l[r].namespaces[i].selected=e,e?l[r].namespaces[i].workloads.forEach(e=>{C(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||l[r].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return l})},[C]),w=na(({clusterId:e,namespaceName:t,boolean:a,searchText:o="",searchBy:n="",filters:l})=>{y(r=>{const i=s(r),c=n===ve.Namespace?o:"",d=n===ve.Source?o:"",u=!!c||!!d||!!l?.showOnlySelected;return i.forEach((o,n)=>{e&&o.clusterId!==e||o.namespaces.forEach(({name:e,workloads:o},r)=>{if(!t||e===t)if(u)if(t){o.forEach((e,t)=>{a&&C(e.kind)||ge(e,d,l||{showOnlySelected:!1})&&(i[n].namespaces[r].workloads[t].selected=a)});const e=i[n].namespaces[r].workloads.filter(e=>!C(e.kind)).every(e=>e.selected);i[n].namespaces[r].selected=e}else{if(!fe(i[n].namespaces[r],c,l||{showOnlySelected:!1}))return;i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&C(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})}else i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&C(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})})}),i})},[C]);return e(go.Provider,{value:{isFetching:p,formData:v,handleSourceChange:k,handleSelectAll:w,formDiff:b,isFormDirty:S},children:t})},vo=()=>la(go),yo=o.div`
|
|
28
|
+
`,Ma=({testConnection:a})=>{const o=n(),{activeForm:i,genericForm:s,validateFormData:c,thisUnsavedDestination:d,addUnsavedDestination:u,updateUnsavedDestination:p,deleteUnsavedDestination:h}=Pa(),[g,f]=Gt(d?.testResult),[v,y]=Gt(!!d);if(Ht(()=>{d?(f(d.testResult),y(!0)):(f(void 0),y(!1))},[d]),!s||!i)return t(E,{title:"No active form"});const b=async()=>{if(!i.option.testConnectionSupported)return;const e=await a(s.formData);return f(e),e};return e(l,{$gap:24,style:{minHeight:"100%"},children:[e(r,{$gap:12,$justifyContent:"space-between",children:[g?g.succeeded?t(B,{status:U.Success,message:g.message||"Connection OK",fullWidth:!0,smallIcon:!0}):t(B,{status:U.Error,message:g.message||"Connection Failed",fullWidth:!0,smallIcon:!0}):t("div",{}),t(w,{"data-id":"dest-form-docs",label:"Docs",leftIcon:pt,variant:T.Text,size:x.S,onClick:()=>window.open(`${R}/backends/${i.option.type}`,"_blank","noopener noreferrer")})]}),t($,{options:[{icon:ht,label:"Enabled",value:!1,selectedBgColor:o.v2.colors.green[800]},{icon:mt,label:"Disabled",value:!0,selectedBgColor:o.v2.colors.red[800]}],selected:s.formData.disabled,setSelected:e=>s.handleFormChange("disabled",e),disabled:v}),t(ea,{title:"This connection will monitor:",allowedSignals:L(i.option.supportedSignals),selectedSignals:X(s.formData.exportedSignals),setSelectedSignals:e=>s.handleFormChange("exportedSignals",{logs:e.includes(z.Logs),metrics:e.includes(z.Metrics),traces:e.includes(z.Traces)}),disabled:v,errorMessage:s.formErrors.exportedSignals}),t(m,{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(Aa,{signals:X(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(Oa,{$gap:8,$justifyContent:"flex-end",children:[d&&t("div",{style:{width:"150px"},children:t(w,{"data-id":"dest-form-delete",fullWidth:!0,label:"Delete",rightIcon:gt,variant:T.Secondary,textColor:o.v2.colors.red[500],onClick:()=>h(i.unsavedIdx)})}),(!d||d.option.testConnectionSupported&&!v)&&t("div",{style:{width:"150px"},children:t(w,{"data-id":"dest-form-test-connection",fullWidth:!0,label:"Test Connection",variant:T.Secondary,onClick:b})}),d&&t("div",v?{style:{width:"150px"},children:t(w,{"data-id":"dest-form-edit",fullWidth:!0,label:"Edit",rightIcon:ft,variant:T.Secondary,onClick:()=>y(!1)})}:{style:{width:"150px"},children:t(w,{"data-id":"dest-form-save",fullWidth:!0,label:"Save Changes",variant:T.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=c();if(!e){const e=await b(),a=!!e&&!e.succeeded;p(i.unsavedIdx,{formData:t,testResult:e},a)}}})}),!d&&t("div",{style:{width:"150px"},children:t(w,{"data-id":"dest-form-add",fullWidth:!0,label:"Add Destination",variant:T.Primary,onClick:async()=>{const{errorMessage:e,preparedFormData:t}=c();if(!e){const e=await b(),a=!!e&&!e.succeeded;u({formData:t,testResult:e},a)}}})})]})]})},Fa=[{id:j.FilePath,label:"Collect file path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:j.Function,label:"Collect function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:j.LineNumber,label:"Collect line number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],La=[{id:j.Column,label:"Collect column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:j.Namespace,label:"Collect namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:j.StackTrace,label:"Collect stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],za=["*"],Xa=[{id:G.HttpRequest,label:"Collect HTTP request",tooltip:""},{id:G.HttpResponse,label:"Collect HTTP response",tooltip:""},{id:G.DbQuery,label:"Collect DB query",tooltip:""},{id:G.Messaging,label:"Collect messaging",tooltip:""}],Va={[Y.Java]:[new q("","")],[Y.Golang]:[new W("")]},_a={[J.CodeAttributes]:({value:o,setValue:r,formErrors:d})=>{const u=n(),p=d.codeAttributes,m=Jt(()=>Object.entries(o.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[o]);Ht(()=>{if(!m.length&&!p){const e={[j.FilePath]:!0,[j.Function]:!0,[j.LineNumber]:!0,[j.Column]:null,[j.Namespace]:null,[j.StackTrace]:null};r("codeAttributes",e)}},[]);const g=(e,t)=>{const a=t?[...m,e]:m.filter(t=>t!==e),o=Object.values(j).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});r("codeAttributes",o)};return e(a,{children:[e(l,{$gap:12,children:[t(s,{size:c.XS,color:u.v2.colors.silver[200],nowrap:!0,children:"Recommended data to collect"}),t(l,{$gap:6,children:Fa.map(({id:e,label:a,tooltip:o})=>t(H,{text:o,withIcon:!0,children:t(i,{label:a,value:m.includes(e),onChange:t=>g(e,t)})},e))}),t(h,{errorMessage:p})]}),e(l,{$gap:12,children:[t(s,{size:c.XS,color:u.v2.colors.silver[200],nowrap:!0,children:"Verbose data to collect"}),t(l,{$gap:6,children:La.map(({id:e,label:a,tooltip:o})=>t(H,{text:o,withIcon:!0,children:t(i,{label:a,value:m.includes(e),onChange:t=>g(e,t)})},e))}),t(h,{errorMessage:p})]})]})},[J.CustomInstrumentation]:({value:o,setValue:n,formErrors:i})=>{const s=i.customInstrumentations,c=Jt(()=>(o?.customInstrumentations?.[Y.Golang]||[]).map(e=>new W(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[o]),d=Jt(()=>(o?.customInstrumentations?.[Y.Java]||[]).map(e=>new q(e.className,e.methodName)),[o]);return Ht(()=>{o?.customInstrumentations||s||n("customInstrumentations",{[Y.Golang]:Va[Y.Golang],[Y.Java]:Va[Y.Java]})},[]),e(a,{children:[e(l,{children:[e(r,{$gap:8,children:[t(vt,{}),t(p,{label:"Golang custom probes"})]}),t(v,{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[Y.Golang]=e.map(e=>new W(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),t[Y.Java]=d,n("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]}),e(l,{children:[e(r,{$gap:8,children:[t(yt,{}),t(p,{label:"Java custom probes"})]}),t(v,{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[Y.Golang]=c,t[Y.Java]=e.map(e=>new q(e.className,e.methodName)),n("customInstrumentations",t)},errorMessage:s,limitFieldsPerRow:2})]})]})},[J.HeadersCollection]:({value:e,setValue:a,formErrors:o})=>{const n=o.headersCollection,l=Jt(()=>e?.headersCollection?.[K.HeaderKeys]||[],[e]),r=e=>{const t={[K.HeaderKeys]:e};a("headersCollection",t)};return Ht(()=>{l.length||n||r(za)},[]),t(C,{name:"headerKeys",label:"Header keys",tooltip:"Specify which headers you want to collect",helpMessage:"Asterisk (*) will collect all headers",values:l,setValues:r,errorMessage:n})},[J.PayloadCollection]:({value:a,setValue:o,formErrors:r})=>{const d=n(),u=r.payloadCollection,p=Jt(()=>Object.entries(a.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[a]);Ht(()=>{if(!p.length&&!u){const e={[G.HttpRequest]:{},[G.HttpResponse]:{},[G.DbQuery]:{},[G.Messaging]:{}};o("payloadCollection",e)}},[]);return e(l,{$gap:12,children:[t(s,{size:c.XS,color:d.v2.colors.silver[200],nowrap:!0,children:"Type of data to collect"}),t(l,{$gap:6,children:Xa.map(({id:e,label:a,tooltip:n})=>t(H,{text:n,withIcon:!0,children:t(i,{label:a,value:p.includes(e),onChange:t=>((e,t)=>{const a=t?[...p,e]:p.filter(t=>t!==e),n={[G.HttpRequest]:a.includes(G.HttpRequest)?{}:null,[G.HttpResponse]:a.includes(G.HttpResponse)?{}:null,[G.DbQuery]:a.includes(G.DbQuery)?{}:null,[G.Messaging]:a.includes(G.Messaging)?{}:null};o("payloadCollection",n)})(e,t)})},e))}),t(h,{errorMessage:u})]})},[J.UnknownType]:null},Ba=({ruleType:e,value:a,setValue:o,formErrors:n})=>{if(!e)return null;const l=_a[e];return l?t(l,{value:a,setValue:o,formErrors:n}):null},Ua={disabled:!1,ruleName:"",notes:"",workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},ja=Yt({selectedOption:null,onSelectOption:()=>{},genericForm:void 0,validateFormData:()=>({preparedFormData:I(Ua)}),errorMessage:void 0}),Ha=({children:e})=>{const[a,o]=Gt(null),[n,l]=Gt(void 0),r=A(Ua),i=Wt(e=>{r.resetFormData(),r.handleErrorChange(void 0,void 0,{}),l(void 0),o(e)},[]),s=Wt(()=>{if(!a)return{errorMessage:"No rule type selected",preparedFormData:I(Ua)};const e=(e=>{const t=I(e);return t.headersCollection?.[K.HeaderKeys]?.length&&(t.headersCollection[K.HeaderKeys]=t.headersCollection[K.HeaderKeys].map(e=>e.trim()).filter(e=>e)),t.customInstrumentations?.[Y.Golang]?.length&&(t.customInstrumentations[Y.Golang]=t.customInstrumentations[Y.Golang].map(e=>new W(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify())),t.customInstrumentations?.[Y.Java]?.length&&(t.customInstrumentations[Y.Java]=t.customInstrumentations[Y.Java].map(e=>new q(e.className,e.methodName)).filter(e=>e.Verify())),t})(r.formData),t={};switch(a.type){case J.CodeAttributes:Object.values(e.codeAttributes||{}).some(e=>null!=e)||(t.codeAttributes="Code attributes are required");break;case J.PayloadCollection:Object.values(e.payloadCollection||{}).some(e=>null!=e)||(t.payloadCollection="Payload collection are required");break;case J.HeadersCollection:e.headersCollection?.[K.HeaderKeys]?.length||(t.headersCollection="Header keys are required");break;case J.CustomInstrumentation:e.customInstrumentations?.[Y.Golang]?.length||e.customInstrumentations?.[Y.Java]?.length||(t.customInstrumentations="Custom instrumentation are required")}r.handleErrorChange(void 0,void 0,t);const o=Object.keys(t).length>0?"Invalid form values":void 0;return l(o),{errorMessage:o,preparedFormData:e}},[r,a]);return t(ja.Provider,{value:{selectedOption:a,onSelectOption:i,genericForm:r,validateFormData:s,errorMessage:n},children:e})},Ka=()=>qt(ja),Ga=()=>{const a=n(),{selectedOption:o,genericForm:i}=Ka();if(!i||!o)return t(E,{title:"No active form"});const{formData:d,handleFormChange:u,formErrors:p}=i;return e(l,{$gap:24,children:[e(r,{$gap:12,$justifyContent:"space-between",children:[t(s,{size:c.XXS,children:o.docsDescription}),t(w,{label:"Docs",leftIcon:pt,variant:T.Text,size:x.S,onClick:()=>window.open(`${R}${o.docsEndpoint}`,"_blank","noopener noreferrer")})]}),e(r,{$gap:12,children:[t(s,{size:c.XS,color:a.v2.colors.silver[200],nowrap:!0,children:"Supported Languages:"}),o.supportedLanguages.map(e=>t(Q,{label:Z[e],leftIcon:ee(e),status:U.Default,useSecondaryTone:!0},e))]}),t($,{options:[{icon:ht,label:"Enabled",value:!1,selectedBgColor:a.v2.colors.green[800]},{icon:mt,label:"Disabled",value:!0,selectedBgColor:a.v2.colors.red[800]}],selected:d.disabled,setSelected:e=>u("disabled",e)}),t(m,{name:"ruleName",label:"Rule name",placeholder:"Use a name that describes the rule...",value:d.ruleName,onChange:({target:{value:e}})=>u("ruleName",e),errorMessage:p.ruleName}),t(Ba,{ruleType:o.type,value:d,setValue:(e,t)=>u(e,t),formErrors:p}),t(P,{name:"notes",label:"Notes",placeholder:"Your personal notes...",value:d.notes,onChange:({target:{value:e}})=>u("notes",e),errorMessage:p.notes})]})},Wa=Yt({isFetching:!1,formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),qa=({children:e,selectedConnectionIds:a,getAllClusterSnapshots:o,fetchNamespacesWithWorkloads:n,initialInputs:l})=>{const{tier:r}=te(),i=r===ie.Onprem,{selectedStreamName:s}=M(),[c,d]=Gt(!1),[u,p]=Gt(null),h=Wt(async()=>{try{if(d(!0),o){const e=await o();e&&p(e)}else if(n){const e=await n();e.data?.length&&p({clusters:[{clusterId:oe,clusterName:ae,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{d(!1)}},[]);Ht(()=>{h()},[]);const[m,g]=Gt([]);Ht(()=>{u&&g(e=>{const t=((e,t)=>I(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(u,a);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),o=a??t;if(l?.[t.clusterId]){const e=l[t.clusterId],a=I(o);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=>{ne.has(e.kind)&&!i||(e.selected=!0)})}),a}return o})})},[u,a,l]);const{formDiff:f,isFormDirty:v}=Jt(()=>{const e=((e,t,a)=>{const o={};return e.forEach(e=>{e.namespaces.forEach(n=>{const l=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===n.name),r=n.selected||!1,i=r!==l?.selected;if(i&&(o[e.clusterId]||(o[e.clusterId]=[]),o[e.clusterId].push({namespace:n.name,selected:r,currentStreamName:a}),r&&(o[e.clusterId]=o[e.clusterId].filter(e=>e.namespace!==n.name||e.namespace===n.name&&(!e.name||!e.kind)))),!i||!r){const t=((e,t,a)=>{const o=[];return t.workloads.forEach(n=>{const l=e?.workloads.find(e=>e.name===n.name&&e.kind===n.kind);n.selected!==l?.selected&&o.push({namespace:t.name,name:n.name,kind:n.kind,selected:n.selected||!1,currentStreamName:a})}),o})(l,n,a);t.length>0&&(o[e.clusterId]||(o[e.clusterId]=[]),o[e.clusterId].push(...t))}})}),o})(m,u?.clusters||[],s);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[m,u,s]),y=Wt(e=>!i&&ne.has(e),[i]),b=Wt(({clusterId:e,workloadId:t,selected:a,auto:o})=>{g(n=>{const l=I(n),r=l.findIndex(t=>t.clusterId===e);if(-1===r)return l;const i=l[r].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return l;if(t.kind&&t.name){const e=l[r].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return l;const o="boolean"==typeof a?a:!l[r].namespaces[i].workloads[e].selected;if(l[r].namespaces[i].workloads[e].selected=o,o){l[r].namespaces[i].workloads.filter(e=>!y(e.kind)).every(e=>e.selected)&&(l[r].namespaces[i].selected=!0)}else l[r].namespaces[i].selected=!1}else{const e="boolean"==typeof o?o:!l[r].namespaces[i].selected;l[r].namespaces[i].selected=e,e?l[r].namespaces[i].workloads.forEach(e=>{y(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||l[r].namespaces[i].workloads.forEach(e=>{e.selected=!1})}return l})},[y]),S=Wt(({clusterId:e,namespaceName:t,boolean:a,searchText:o="",searchBy:n="",filters:l})=>{g(r=>{const i=I(r),s=n===se.Namespace?o:"",c=n===se.Source?o:"",d=!!s||!!c||!!l?.showOnlySelected;return i.forEach((o,n)=>{e&&o.clusterId!==e||o.namespaces.forEach(({name:e,workloads:o},r)=>{if(!t||e===t)if(d)if(t){o.forEach((e,t)=>{a&&y(e.kind)||le(e,c,l||{showOnlySelected:!1})&&(i[n].namespaces[r].workloads[t].selected=a)});const e=i[n].namespaces[r].workloads.filter(e=>!y(e.kind)).every(e=>e.selected);i[n].namespaces[r].selected=e}else{if(!re(i[n].namespaces[r],s,l||{showOnlySelected:!1}))return;i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&y(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})}else i[n].namespaces[r].selected=a,o.forEach((e,t)=>{a&&y(e.kind)||(i[n].namespaces[r].workloads[t].selected=a)})})}),i})},[y]);return t(Wa.Provider,{value:{isFetching:c,formData:m,handleSourceChange:b,handleSelectAll:S,formDiff:f,isFormDirty:v},children:e})},Ya=()=>qt(Wa),Ja=o.div`
|
|
83
29
|
display: flex;
|
|
84
30
|
align-items: center;
|
|
85
31
|
gap: 8px;
|
|
86
32
|
padding: 8px;
|
|
87
|
-
`,
|
|
33
|
+
`,Qa=({onClose:a,selectedConnectionIds:o,setSelectedConnectionIds:l,createAction:r,withOverlay:i})=>{const d=n(),[u,p]=Gt(""),h=Qt(null),{selectedOption:m,onSelectOption:g,genericForm:f,validateFormData:v,errorMessage:y}=Na(),b=Jt(()=>(u?ce.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):ce).filter(e=>!!e),[u]),S=Jt(()=>(u?de.filter(e=>e?.label?.toLowerCase().includes(u.toLowerCase())):de).filter(e=>!!e),[u]),C=Jt(()=>{const a=(a,o)=>e(Ja,{children:[t(s,{size:c.XS,color:d.v2.colors.silver[200],children:a}),t(Q,{label:o.toString()})]},a),o=e=>{const a=m?.type===e.type;return t(da,{dataId:e.type?`option-${e.type}`:void 0,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{h.current?.clearErrors(),g(e)}},e.type)};return[a("Attributes",b.length),...b.map(o),a("Samplers",S.length),...S.map(o)]},[d,m?.type,b.length,S.length,g]),k=Jt(()=>m?[t(Da,{},m.type)]:[t(ue,{$height:"100%",children:t(E,{icon:bt,title:"Action not selected",subTitle:"Please select an action to add"})},"no-data")],[m]);return t(aa,{ref:h,isOpen:!0,withOverlay:i,onClose:a,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=v();return e?Promise.resolve({error:e}):await r(t)},disableSave:!m||!f?.isFormDirty,isFormDirty:f?.isFormDirty,hideDirtyNote:!0,errorMessage:y,progress:{title:pe.CREATING_ACTION,subTitle:pe.CREATING_ACTION_SUBTITLE},header:{icon:bt,title:pe.ADD_ACTION,subTitle:pe.ADD_ACTION_DESCRIPTION},connectionIds:o&&l?{value:o,setValue:l}:void 0,search:{value:u,onChange:p},leftColumn:{width:"40%",list:C},rightColumn:{width:"60%",list:k}})},Za=({testConnection:e})=>{const{activeForm:a}=Pa();return{width:"60%",list:a?[t(Ma,{testConnection:e},a.option.type)]:[t(ue,{$height:"100%",children:t(E,{icon:St,title:"Select destination from the list",subTitle:"Add destination so your data has somewhere to go."})},"no-data")]}},eo=o.div`
|
|
88
34
|
display: flex;
|
|
89
35
|
flex-direction: column;
|
|
90
36
|
padding: 8px;
|
|
91
37
|
border-radius: 16px;
|
|
92
38
|
border: ${({$purpleColors:e,theme:t})=>e?`1px solid ${t.v2.colors.purple[500]}`:"1px solid transparent"};
|
|
93
39
|
background-color: ${({$noBgColor:e,$purpleColors:t,theme:a})=>e?"transparent":t?a.v2.colors.purple[900]:a.v2.colors.silver[800]};
|
|
94
|
-
`,
|
|
40
|
+
`,to=o.div`
|
|
95
41
|
display: flex;
|
|
96
42
|
align-items: center;
|
|
97
43
|
justify-content: space-between;
|
|
98
44
|
gap: 12px;
|
|
99
45
|
padding: ${({$isOpen:e})=>e?"2px 12px 8px 12px":"2px 12px"};
|
|
100
|
-
`,
|
|
46
|
+
`,ao=({title:a,tooltip:o,list:n,noBgColor:i,purpleColors:d})=>{const[u,p]=Gt(!0);return e(eo,{"data-id":`collapse-${a}`,$noBgColor:i,$purpleColors:d,children:[e(to,{$isOpen:u,children:[e(r,{$gap:10,children:[t(s,{size:c.XS,children:a}),o&&t(H,{text:o,withIcon:!0}),t(Q,{label:n.length,status:d?U.Default:void 0})]}),t(he,{icon:u?Ct:kt,size:me.M,onClick:()=>p(e=>!e)})]}),u?t(l,{children:n.length?Zt.toArray(n):t(ue,{$padding:"12px 0",children:t(E,{})})}):null]})},oo=(e,t,a)=>t||a.signalType?e.filter(e=>e.displayName.toLowerCase().includes(t.toLowerCase())&&(!a.signalType||L(e.supportedSignals).includes(a.signalType))):e,no=({option:e,formData:a,testResult:o,isSelected:n,onSelect:l})=>t(da,{icon:ve(e.type).icon,title:a?.name||e.displayName,withCarret:!0,purpleColors:!!a,isSelected:n,onClick:()=>l(),children:o&&t(Q,{status:o.succeeded?U.Success:U.Error,leftIcon:o.succeeded?wt:xt})}),lo=({listType:e,destinationOptions:a,unsavedDestinations:o})=>{const{activeForm:n,onChangeActiveForm:l}=Pa();return a?.length?t(ao,{title:fe[e].TITLE,tooltip:fe[e].DESCRIPTION,list:a.map((a,o)=>t(no,{option:a,isSelected:n?.listType===e&&"number"!=typeof n?.unsavedIdx&&(null!=a.id&&""!==a.id?n?.option.id===a.id:n?.option.type===a.type),onSelect:()=>l({listType:e,option:a})},`${e}-${a.id??a.type}-${o}`))}):o?.length?t(ao,{purpleColors:!0,title:fe[e].TITLE,tooltip:fe[e].DESCRIPTION,list:o.map(({option:a,formData:o,testResult:r},i)=>t(no,{option:a,formData:o,testResult:r,isSelected:n?.unsavedIdx===i&&n?.listType===e,onSelect:()=>l({listType:e,option:a,unsavedIdx:i})},`${e}-${i}`))},e):void 0},ro=({isFetching:e,destinationsByCategory:a,searchText:o,filters:n})=>{const{unsavedDestinations:l}=Pa(),r=Jt(()=>{const e=[];l.length&&e.push(t(lo,{listType:F.UNSAVED,unsavedDestinations:l},"unsaved"));for(const l of Object.values(F)){if(n.categoryType&&n.categoryType!==l)continue;const r=oo(a[l],o,n);r.length&&e.push(t(lo,{listType:l,destinationOptions:r},l))}return e},[l,a,o,n]);return{width:"40%",list:r.length?r:e?[t(ue,{$height:"100%",children:t(ge,{title:"Fetching destinations",subTitle:"Please wait while we fetch the destinations",withSpinner:!0})},"loading")]:[]}},io=({destinationsByCategory:o,filters:n,setFilters:l})=>{const r=Jt(()=>Object.values(F).map(e=>({id:e,label:e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()})).filter(e=>o[e.id]?.length),[o]),i=Jt(()=>{const e=Object.values(z).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(ye,{placeholder:"Select category",options:r,values:n.categoryType?[n.categoryType]:[],setValues:e=>l({...n,categoryType:n.categoryType===e[0]?null:e[0]})}),t($,{size:be.S,options:i,selected:n.signalType,setSelected:e=>l({...n,signalType:e})})]})};var so;!function(e){e.SELF_HOSTED="self hosted",e.MANAGED="managed"}(so||(so={}));const co=({onClose:e,onBack:a,onNext:o,selectedConnectionIds:n,setSelectedConnectionIds:l,getDestinationCategories:r,getPotentialDestinations:i,initialInputs:s,testConnection:c,createDestination:d,updateDestination:u,withOverlay:p,disableAnimation:h})=>{const[m,g]=Gt(""),[f,v]=Gt({categoryType:null,signalType:null}),{destinations:y}=Se(),{activeForm:b,genericForm:S,formErrorMessage:C,unsavedDestinations:k,setUnsavedDestinations:w}=Pa();Ht(()=>{s&&w(s)},[s]);const[x,T]=Gt(!0),[N,D]=Gt([]),[A,E]=Gt({[F.ALL]:[],[F.UNSAVED]:[],[F.EXISTS]:[],[F.DETECTED]:[],[F.SELF_HOSTED]:[],[F.MANAGED]:[]});Ht(()=>{const e=y.map(e=>{let t;for(const a of N){const o=a.items.find(t=>t.type===e.destinationType.type);if(o){t=o;break}}const a=V(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})):[]}});E(t=>({...t,[F.EXISTS]:e}))},[y,N]);const R=Wt(async()=>{try{T(!0);const[e,t]=await Promise.all([r(),i()]);e&&D(e.destinationCategories.categories);const{detectedDestinations:a,selfHostedDestinations:o,managedDestinations:n}=((e,t)=>{const a=[],o=[],n=[];return e&&e.destinationCategories.categories.forEach(e=>{e.name===so.SELF_HOSTED?o.push(...e.items):e.name===so.MANAGED&&n.push(...e.items)}),t&&t?.potentialDestinations.forEach(t=>{for(const o of e?.destinationCategories?.categories||[]){const e=I(o),n=e.items.findIndex(e=>e.type===t.type);if(-1!==n){const o=V(t.fields,{});Object.keys(o).length&&(e.items[n].fields=e.items[n].fields.map(e=>({...e,initialValue:o[e.name]})),a.push(e.items[n]))}}}),{detectedDestinations:a,selfHostedDestinations:o,managedDestinations:n}})(e,t);E(e=>({...e,[F.DETECTED]:a,[F.SELF_HOSTED]:o,[F.MANAGED]:n}))}catch(e){}finally{T(!1)}},[]);Ht(()=>{R()},[]);const $=Wt(async()=>{const e=(await Promise.all(k.map(({option:e,formData:t})=>{if(e.id){const a=Object.fromEntries(e.fields.map(e=>[e.name,e.initialValue??""])),o=Object.fromEntries(t.fields.map(e=>[e.key,e.value??""]));if(!Object.keys(a).some(e=>a[e]!==o[e]))return u(e.id,t,n)}return d(t,n)}))).filter(e=>e?.error);if(e.length)return{error:e.map(e=>e?.error).join("\n")}},[k,n,d,u]);return t(aa,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:e,onBack:a?()=>a(k):void 0,onNext:o?()=>o(k):void 0,nextIsSkip:!k.length,onSave:$,disableSave:!b&&!k.length,isFetching:x,errorMessage:C,isFormDirty:S?.isFormDirty,hideDirtyNote:!0,progress:{title:pe.CREATING_DESTINATION,subTitle:pe.CREATING_DESTINATION_SUBTITLE},header:{icon:St,title:pe.ADD_DESTINATIONS,subTitle:pe.ADD_DESTINATION_DRAWER_DESCRIPTION},connectionIds:n&&l?{value:n,setValue:l}:void 0,search:{value:m,onChange:g},filters:t(io,{destinationsByCategory:A,filters:f,setFilters:v}),leftColumn:ro({isFetching:x,destinationsByCategory:A,searchText:m,filters:f}),rightColumn:Za({testConnection:c})})},uo=({onClose:e,selectedConnectionIds:a,setSelectedConnectionIds:o,createInstrumentationRule:n,withOverlay:l})=>{const[r,i]=Gt(""),s=Qt(null),{selectedOption:c,onSelectOption:d,genericForm:u,validateFormData:p,errorMessage:h}=Ka(),m=Jt(()=>r?Ce.filter(e=>e.label.toLowerCase().includes(r.toLowerCase())):Ce,[r]),g=Jt(()=>m.map(e=>{const a=c?.type===e.type;return t(da,{dataId:`option-${e.type}`,title:e.label,description:e.description,withCarret:!0,isSelected:a,onClick:()=>{s.current?.clearErrors(),d(e)}},e.type)}),[c,m.length,d]),f=Jt(()=>c?[t(Ga,{},c.type)]:[t(ue,{$height:"100%",children:t(E,{icon:Tt,title:"Instrumentation rule not selected",subTitle:"Please select an instrumentation rule to add"})},"no-data")],[c]);return t(aa,{ref:s,isOpen:!0,withOverlay:l,onClose:e,onSave:async()=>{const{errorMessage:e,preparedFormData:t}=p();return e?Promise.resolve({error:e}):await n(t)},disableSave:!c||!u?.isFormDirty,isFormDirty:u?.isFormDirty,hideDirtyNote:!0,errorMessage:h,progress:{title:pe.CREATING_INSTRUMENTATION_RULE,subTitle:pe.CREATING_INSTRUMENTATION_RULE_SUBTITLE},header:{icon:Tt,title:pe.ADD_INSTRUMENTATION_RULE,subTitle:pe.ADD_INSTRUMENTATION_RULE_DESCRIPTION},connectionIds:a&&o?{value:a,setValue:o}:void 0,search:{value:r,onChange:i},leftColumn:{width:"40%",list:g},rightColumn:{width:"60%",list:f}})},po=o.div``,ho=o.div`
|
|
101
47
|
visibility: hidden;
|
|
102
48
|
|
|
103
49
|
transition: visibility 0s;
|
|
@@ -105,31 +51,31 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
105
51
|
transition-duration: 0s;
|
|
106
52
|
}
|
|
107
53
|
|
|
108
|
-
${
|
|
54
|
+
${po}:hover & {
|
|
109
55
|
visibility: visible;
|
|
110
56
|
}
|
|
111
|
-
`,
|
|
57
|
+
`,mo=({workloadName:e,workloadKind:a,isChecked:o,onToggle:l,disabled:r,disabledReason:i})=>{const s=n(),d=()=>{};return t(po,{children:t(da,{dataId:`source-${e}`,title:e,disabled:r,onClick:r?d:l,isChecked:o,onCheckboxChange:r?d:l,children:r&&i?t(Q,{label:i,status:U.Default,textSize:c.XXXS}):t(ho,{children:t(Q,{label:a,status:U.Info,textSize:c.XXXS,backgroundColor:s.v2.colors.blue[900]})})})})},go=({formData:a,handleSourceChange:o,handleSelectAll:n,selectedArea:l,searchText:i,searchBy:d,filters:u})=>{const{tier:p}=te(),h=p===ie.Onprem,m=Jt(()=>l.value.namespaceName?a.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[a,l.value.clusterId,l.value.namespaceName]),g=Jt(()=>m?[...m.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>le(e,i,u)):[],[m,i,u]),f=Jt(()=>!!g.length&&g.every(({selected:e})=>e),[g]),v=Jt(()=>{if(!m)return[];const{clusterId:e}=l.value,{name:a}=m;return g.map(({name:n,selected:l,kind:r})=>{const i=!h&&ne.has(r);return t(mo,{workloadName:n,workloadKind:r,isChecked:!i&&(l||!1),onToggle:()=>o({clusterId:e,workloadId:{namespace:a,name:n,kind:r}}),disabled:i,disabledReason:"Enterprise only"},`${e}#${a}#${n}#${r}`)})},[g,m,l.value.clusterId]),{withFilterCount:y,filteredCount:b,totalCount:S}=Jt(()=>{const e=m?.workloads.length??0;return{withFilterCount:g.length!==e,filteredCount:g.length,totalCount:e}},[g,m]);return{width:"40%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(s,{size:c.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > Workloads`:"Workloads"}),t(H,{text:y?pe.FILTERED_COUNT_TOOLTIP:void 0,children:t(Q,{label:`${y?`${b} / ${S}`:S}`,status:ke.Unknown})})]}),t(s,{"data-id":"workloads-select-all",onClick:()=>n({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:i,searchBy:d,filters:u}),disabled:!v.length,size:c.XS,children:(f?"Unselect":"Select")+" all"})]}),list:m?v:[t(ue,{$height:"100%",children:t(E,{icon:Nt,title:pe.SELECT_NAMESPACE,subTitle:pe.SELECT_NAMESPACE_SUBTITLE})},"no-data")]}},fo=o.div``,vo=o.div`
|
|
112
58
|
visibility: ${({$visible:e})=>e?"visible":"hidden"};
|
|
113
59
|
|
|
114
60
|
transition: visibility 0s;
|
|
115
61
|
${({$visible:e})=>!e&&"& * {\n transition-duration: 0s !important;\n }"}
|
|
116
62
|
|
|
117
|
-
${
|
|
63
|
+
${fo}:hover & {
|
|
118
64
|
visibility: visible;
|
|
119
65
|
}
|
|
120
|
-
`,
|
|
66
|
+
`,yo=({clusterId:a,namespaceName:o,checkbox:l,isFutureApps:i,selectedCounts:d,isActive:u,onActive:p,handleSourceChange:h})=>{const m=n(),g=e=>{p(),h({clusterId:a,workloadId:{namespace:o},auto:e.auto,selected:e.all})};return t(fo,{children:t(da,{dataId:`namespace-${o}`,withCarret:!0,title:o,isSelected:u,onClick:p,isPartiallyChecked:l.partial,isChecked:l.all,onCheckboxChange:e=>g({auto:e,all:e}),children:e(r,{$gap:12,children:[t(vo,{$visible:u||i,children:t(H,{text:"Automatically instrument all workloads currently in the namespace, and all workloads that will be deployed to this namespace in the future",children:t(b,{label:"Auto",size:we.S,value:i,onChange:e=>g({auto:e,all:e||void 0})})})}),e(r,{$gap:8,children:[t(s,{variant:xe.Span,size:c.XXXS,color:m.v2.colors.silver[200],align:"right",children:"Selected"}),t(Q,{label:`${d.sourced}/${d.total}`,status:u?U.Default:ke.Unknown,minWidth:"42px"})]})]})})})},bo=({withCollapse:e,clusterId:a,clusterName:o,namespaces:n,selectedArea:l,setSelectedArea:r,handleSourceChange:i})=>{const s=Jt(()=>n.map(({name:e,totalWorkloads:n,selectedCount:s,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(yo,{clusterId:a,namespaceName:e,isFutureApps:u,checkbox:{all:c,partial:d},selectedCounts:{sourced:s,total:n},isActive:l.clusterId===a&&l.namespaceName===e,onActive:()=>r({clusterId:a,clusterName:o,namespaceName:e}),handleSourceChange:i},`${a}#${e}`)),[a,o,n,l]);return e?t(ao,{title:o,list:s,noBgColor:!0}):s},So=({isFetching:a,formData:o,handleSourceChange:n,handleSelectAll:l,selectedArea:i,setSelectedArea:d,searchText:u,searchBy:p,filters:h})=>{const m=Jt(()=>o.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>re(e,u,h)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Te(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[o,u,h]),g=Jt(()=>{let e=!1;for(const{visibleNamespaces:t}of m)for(const{totalWorkloads:a,selectedCount:o}of t)if(e=!0,o!==a)return!1;return e},[m]),{list:f,withFilterCount:v,filteredCount:y,totalCount:b}=Jt(()=>{const e=m.map(({clusterId:e,clusterName:a,visibleNamespaces:o})=>o.length?t(bo,{withCollapse:m.length>1,clusterId:e,clusterName:a,namespaces:o,selectedArea:i,setSelectedArea:d,handleSourceChange:n},e):null),a=e.filter(e=>null!==e);return{list:a,withFilterCount:a.length!==e.length,filteredCount:a.length,totalCount:e.length}},[m,i]);return{width:"60%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(s,{size:c.XS,nowrap:!0,children:"Namespaces"}),t(H,{text:v?pe.FILTERED_COUNT_TOOLTIP:void 0,children:t(Q,{label:`${v?`${y} / ${b}`:b}`,status:ke.Unknown})})]}),t(s,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!g,searchText:u,searchBy:p,filters:h}),disabled:!f.length,size:c.XS,children:(g?"Unselect":"Select")+" all"})]}),list:f.length?f:a?[t(ue,{$height:"100%",children:t(ge,{title:pe.FETCHING_NAMESPACES,subTitle:pe.FETCHING_NAMESPACES_SUBTITLE,withSpinner:!0})},"loading")]:[]}},Co=({onClose:a,onBack:o,onNext:l,selectedConnectionIds:i,setSelectedConnectionIds:d,persistSources:u,withOverlay:p,disableAnimation:h})=>{const m=n(),{progress:g,resetProgress:f}=Ne(),{isFetching:v,formData:y,handleSourceChange:S,handleSelectAll:C,formDiff:k,isFormDirty:w}=Ya(),[x,T]=Gt(""),[N,D]=Gt(se.Namespace),[A,I]=Gt({showOnlySelected:!1}),[E,R]=Gt({clusterId:"",clusterName:"",namespaceName:""});return t(aa,{isOpen:!0,withOverlay:p,disableAnimation:h,onClose:a?()=>{f(De.BulkInstrumenting),a()}:void 0,onBack:o?()=>o(k):void 0,onNext:l?()=>l(k):void 0,nextIsSkip:!w,onSave:()=>u(k),header:{icon:Nt,title:pe.ADD_SOURCE,subTitle:pe.ADD_SOURCES_DESCRIPTION},connectionIds:i&&d?{value:i,setValue:d}:void 0,search:{value:x,onChange:e=>{T(e),N===se.Namespace&&R({clusterId:"",clusterName:"",namespaceName:""})},segment:{options:[{label:"Namespace",value:se.Namespace},{label:"Source",value:se.Source}],selected:N,setSelected:D}},filters:e(r,{$gap:8,children:[t(s,{size:c.XXXS,color:m.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(b,{name:"filter-selected",size:we.S,label:"Selected",value:A.showOnlySelected,onChange:e=>I(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:w,isFetching:v,progress:{title:pe.CREATING_SOURCES,subTitle:pe.CREATING_SOURCES_SUBTITLE,percentage:g[De.BulkInstrumenting]?.percentage||0},leftColumn:So({isFetching:v,formData:y,handleSourceChange:S,handleSelectAll:C,selectedArea:E,setSelectedArea:R,searchText:N===se.Namespace?x:"",searchBy:N,filters:A}),rightColumn:go({formData:y,handleSourceChange:S,handleSelectAll:C,selectedArea:{value:E},searchText:N===se.Source?x:"",searchBy:N,filters:A})})},ko=["action","endpoint","scope","duration"],wo=o.span`
|
|
121
67
|
font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
|
|
122
68
|
font-size: ${({theme:e})=>e.v2.text.size.xxxs}px;
|
|
123
69
|
line-height: 20px;
|
|
124
70
|
color: ${({theme:e,$variant:t})=>{const a=e.v2.colors;switch(t){case"action":return a.green[400];case"endpoint":return a.purple[300];case"scope":return a.yellow[400];case"duration":return a.orange[600];default:return a.white[500]}}};
|
|
125
|
-
`,
|
|
71
|
+
`,xo=({parts:e})=>t(a,{children:e.map((e,a)=>t(wo,{$variant:e.variant,$isMono:ko.includes(e.variant),children:e.text},a))});var To;!function(e){e.Noisy="noisy",e.HighlyRelevant="highly-relevant",e.CostReduction="cost-reduction"}(To||(To={}));const No=[{value:To.Noisy,label:"Noisy Operations",tooltip:"Rules that reduce noise from high-volume, low-value operations"},{value:To.HighlyRelevant,label:"Highly Relevant Operations",tooltip:"Rules that prioritize important traces for retention"},{value:To.CostReduction,label:"Cost Reduction",tooltip:"Rules that optimize costs by sampling less critical data"}],Do={[To.Noisy]:"This is the most efficient way to sample (with Head Sampling). Prefer to use it where possible.",[To.HighlyRelevant]:'Any trace from the "Noisy Operations" category is sampled prior to checking highly relevance.',[To.CostReduction]:"Cost reduction rules use Tail Sampling to drop traces that are unlikely to be useful for debugging or monitoring."},Ao={[To.Noisy]:"Noisy Operations rules list",[To.HighlyRelevant]:"Highly Relevant Operations rules list",[To.CostReduction]:"Cost Reduction rules list"},Io={[To.Noisy]:"noisy",[To.HighlyRelevant]:"highlyRelevant",[To.CostReduction]:"costReduction"};function Eo(e){if(e.workloadName){const t=e.workloadKind?.toLowerCase()||"deployment";return e.workloadNamespace?`${t} '${e.workloadName}' in namespace '${e.workloadNamespace}'`:`${t} '${e.workloadName}'`}return e.workloadNamespace?`namespace '${e.workloadNamespace}'`:e.workloadLanguage?`${e.workloadLanguage} services`:""}function Ro(e){if(!e?.length)return[{text:" for ",variant:"default"},{text:"entire cluster",variant:"scope"}];const t=e.map(Eo).filter(Boolean);if(!t.length)return[{text:" for ",variant:"default"},{text:"entire cluster",variant:"scope"}];const a=[{text:" for ",variant:"default"}],o=t.slice(0,2),n=t.length-2;return o.forEach((e,t)=>{t>0&&a.push({text:", ",variant:"default"}),a.push({text:e,variant:"scope"})}),n>0&&a.push({text:` + ${n} more`,variant:"default"}),a}function $o(e,t){if(!e)return[];const a=[{text:" starting at ",variant:"default"}];return t?a.push({text:`${t} /${e}`,variant:"endpoint"}):a.push({text:`endpoint /${e}`,variant:"endpoint"}),a}function Po(e){const t=[];if(null!=e.percentageAtMost?(t.push({text:`Drop ${100-e.percentageAtMost}%`,variant:"action"}),t.push({text:" of traces",variant:"default"})):t.push({text:"Drop all traces",variant:"action"}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,o=e.operation.httpServer?.method||e.operation.httpClient?.method;t.push(...$o(a,o));const n=e.operation.httpClient,l=n?.templatedPath||n?.templatedPathPrefix,r=n?.serverAddress;if((l||r)&&!a){const e=l&&r?`${r}/${l}`:l||r;t.push({text:" to ",variant:"default"}),o?t.push({text:`${o} /${e}`,variant:"endpoint"}):t.push({text:`/${e}`,variant:"endpoint"})}}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Ro(e.sourceScopes)),t}function Oo(e){const t=[];if(null!=e.percentageAtLeast?(t.push({text:`Keep at least ${e.percentageAtLeast}%`,variant:"action"}),t.push({text:" of traces",variant:"default"})):t.push({text:"Keep all traces",variant:"action"}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,o=e.operation.httpServer?.method;t.push(...$o(a,o))}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Ro(e.sourceScopes)),!e.error&&null!=e.durationAtLeastMs&&e.durationAtLeastMs>0&&(t.push({text:" with duration > ",variant:"default"}),t.push({text:`${e.durationAtLeastMs}ms`,variant:"duration"})),t}function Mo(e){const t=[];if(t.push({text:`Drop ${e.percentageAtMost}%`,variant:"action"}),t.push({text:" of traces",variant:"default"}),e.operation){const a=e.operation.httpServer?.route||e.operation.httpServer?.routePrefix,o=e.operation.httpServer?.method;t.push(...$o(a,o));const n=e.operation.kafkaConsumer?.kafkaTopic;n&&!a&&(t.push({text:" from ",variant:"default"}),t.push({text:`topic '${n}'`,variant:"endpoint"}))}else t.push({text:" on ",variant:"default"}),t.push({text:"any operation",variant:"endpoint"});return t.push(...Ro(e.sourceScopes)),t}function Fo(e){return e.error?"Error":null!=e.durationAtLeastMs?"Duration":"Relevance"}function Lo(e,t,a){const o=Io[t],n=[];for(const l of e)switch(t){case To.Noisy:for(const e of l.noisyOperations)a?.has(e.ruleId)||n.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Po(e),category:o});break;case To.HighlyRelevant:for(const e of l.highlyRelevantOperations)a?.has(e.ruleId)||n.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Oo(e),category:o,typeBadge:Fo(e)});break;case To.CostReduction:for(const e of l.costReductionRules)a?.has(e.ruleId)||n.push({ruleId:e.ruleId,samplingId:l.id,name:e.name??null,disabled:e.disabled,notes:e.notes??null,summary:Mo(e),category:o})}return n}function zo(e,t){switch(e){case"noisy":return Po(t);case"highlyRelevant":return Oo(t);case"costReduction":return Mo(t)}}function Xo(e,t,a,o){for(const n of e)if(n.id===t)switch(o){case"noisy":{const e=n.noisyOperations.find(e=>e.ruleId===a);if(e)return{category:"noisy",samplingId:n.id,rule:e};break}case"highlyRelevant":{const e=n.highlyRelevantOperations.find(e=>e.ruleId===a);if(e)return{category:"highlyRelevant",samplingId:n.id,rule:e};break}case"costReduction":{const e=n.costReductionRules.find(e=>e.ruleId===a);if(e)return{category:"costReduction",samplingId:n.id,rule:e};break}}return null}function Vo(e,t){const a=Xo(e,t.samplingId,t.rule.ruleId,t.category);return a?{...a,summary:zo(a.category,a.rule)}:null}function _o(e,t){const a=Xo(e,t.samplingId,t.ruleId,t.category);return a?{...a,summary:t.summary}:null}function Bo(e){return null==e||Array.isArray(e)&&0===e.length?null:e}function Uo(e,t){return JSON.stringify({sourceScopes:Bo(e),operation:Bo(t)})}function jo(e,t,a,o){return JSON.stringify({sourceScopes:Bo(e),error:t??!1,durationAtLeastMs:Bo(a),operation:Bo(o)})}function Ho(e,t){return JSON.stringify({sourceScopes:Bo(e),operation:Bo(t)})}function Ko(e,t,a,o){switch(t){case"noisy":{const t=Uo(a.sourceScopes,a.operation);for(const a of e)for(const e of a.noisyOperations)if((!o||e.ruleId!==o)&&Uo(e.sourceScopes,e.operation)===t)return e.ruleId;return null}case"highlyRelevant":{const t=jo(a.sourceScopes,a.error,a.durationAtLeastMs,a.operation);for(const a of e)for(const e of a.highlyRelevantOperations)if((!o||e.ruleId!==o)&&jo(e.sourceScopes,e.error,e.durationAtLeastMs,e.operation)===t)return e.ruleId;return null}case"costReduction":{const t=Ho(a.sourceScopes,a.operation);for(const a of e)for(const e of a.costReductionRules)if((!o||e.ruleId!==o)&&Ho(e.sourceScopes,e.operation)===t)return e.ruleId;return null}}}function Go(e){if(!e.sourceScopes.length)return;const t=[];for(const a of e.sourceScopes)if("source"===a.scopeType&&a.workloadName){const e={workloadName:a.workloadName};a.workloadKind&&(e.workloadKind=a.workloadKind),a.workloadNamespace&&(e.workloadNamespace=a.workloadNamespace),t.push(e)}else"namespace"===a.scopeType&&a.workloadNamespace?t.push({workloadNamespace:a.workloadNamespace}):"language"===a.scopeType&&a.workloadLanguage&&t.push({workloadLanguage:a.workloadLanguage});return t.length?t:void 0}function Wo(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function qo(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function Yo(e){return{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}}function Jo(e){return"all"===e.operationType?null:"httpServer"===e.operationType?Yo(e):"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function Qo(e){return"all"===e.operationType?null:"httpServer"===e.operationType?Yo(e):"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}const Zo="Unnamed rule",en="Edit rule",tn="Cancel",an="Sampling Preview",on="Source Scope",nn="Operation",ln="Duration",rn="Errors",sn="Rule name",cn="Rule type",dn="Note",un="HTTP route",pn="Method",hn="Keep Percentage",mn="Drop Percentage",gn="Keep traces with duration larger than",fn="Keep traces with errors",vn="Keep at least this percentage of matching traces",yn="Keep at most this percentage of matching traces",bn={noisy:"Rules that reduce noise from high-volume, low-value operations using Head Sampling.",highlyRelevant:"Add a rule to identify highly relevant operations. Traces with errors, long duration, or from critical endpoints and key workflows will be retained so important transactions are always available for analysis.",costReduction:"Rules that optimize costs by sampling less critical data using Tail Sampling."},Sn="60vw",Cn="Type here",kn={noisy:"Create 'Noisy Operations' sampling rule",highlyRelevant:"Create 'Highly Relevant Operations' sampling rule",costReduction:"Create 'Cost Reduction' sampling rule"},wn=o.div`
|
|
126
72
|
display: flex;
|
|
127
73
|
flex-direction: column;
|
|
128
74
|
gap: 8px;
|
|
129
|
-
`,
|
|
75
|
+
`,xn=o(r)`
|
|
130
76
|
align-items: center;
|
|
131
77
|
gap: 8px;
|
|
132
|
-
`,
|
|
78
|
+
`,Tn=o.div`
|
|
133
79
|
flex: 1;
|
|
134
80
|
min-width: 0;
|
|
135
81
|
padding: 8px 16px;
|
|
@@ -137,45 +83,45 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
137
83
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
138
84
|
white-space: pre;
|
|
139
85
|
overflow-x: auto;
|
|
140
|
-
`,
|
|
86
|
+
`,Nn=({category:a,formState:o,onChange:l})=>{const r=n(),i=Jt(()=>{switch(a){case"noisy":return Po({ruleId:"",name:(e=o).name||null,disabled:!1,notes:e.notes||null,sourceScopes:Go(e)??null,percentageAtMost:Wo(e),operation:Jo(e)});case"highlyRelevant":return Oo(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:Go(e)??null,error:e.keepErrors,durationAtLeastMs:"Duration"===e.ruleType?qo(e):null,percentageAtLeast:Wo(e),operation:Qo(e)}}(o));case"costReduction":return Mo(function(e){return{ruleId:"",name:e.name||null,disabled:!1,notes:e.notes||null,sourceScopes:Go(e)??null,percentageAtMost:Wo(e)??0,operation:Qo(e)}}(o))}var e},[a,o]),d=1===i.length&&"default"===i[0].variant;return e(wn,{children:[t(s,{size:c.XXS,color:r.v2.colors.silver[200],children:an}),e(xn,{children:[t(Tn,{children:d?t(s,{size:c.XXXS,color:r.v2.colors.grey[500],children:"No preview available"}):t(xo,{parts:i})}),l&&t(b,{value:!o.disabled,onChange:e=>l({disabled:!e}),size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]})},Dn=o.div`
|
|
141
87
|
display: flex;
|
|
142
88
|
flex-direction: column;
|
|
143
89
|
gap: 16px;
|
|
144
90
|
padding: 16px;
|
|
145
91
|
border-radius: 16px;
|
|
146
92
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
147
|
-
`,
|
|
93
|
+
`,An=o(Dn)`
|
|
148
94
|
flex: 1;
|
|
149
|
-
`,
|
|
95
|
+
`,In=o.div`
|
|
150
96
|
display: flex;
|
|
151
97
|
gap: 32px;
|
|
152
|
-
`,
|
|
98
|
+
`,En=o.div`
|
|
153
99
|
display: flex;
|
|
154
100
|
flex-direction: column;
|
|
155
101
|
gap: 4px;
|
|
156
|
-
`,
|
|
102
|
+
`,Rn=o.div`
|
|
157
103
|
display: flex;
|
|
158
104
|
align-items: flex-end;
|
|
159
105
|
gap: 16px;
|
|
160
|
-
|
|
106
|
+
`,$n=o.div`
|
|
161
107
|
width: 280px;
|
|
162
108
|
flex-shrink: 0;
|
|
163
|
-
`,
|
|
109
|
+
`,Pn=o.div`
|
|
164
110
|
display: flex;
|
|
165
111
|
flex-direction: column;
|
|
166
112
|
gap: 4px;
|
|
167
|
-
`,
|
|
113
|
+
`,On=o.div`
|
|
168
114
|
flex: 1;
|
|
169
115
|
min-width: 0;
|
|
170
|
-
`,
|
|
116
|
+
`,Mn=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Fn=({category:a,formState:o,onChange:n})=>{const l=Wt(e=>n({name:e.target.value}),[n]),r=Wt(e=>n({notes:e.target.value}),[n]),i=Wt(e=>{n({ruleType:e,keepErrors:"Error"===e})},[n]);return t(Dn,{children:e(Rn,{children:[t($n,{children:t(m,{label:sn,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:"Type rule name",value:o.name,onChange:l})}),"highlyRelevant"===a&&e(Pn,{children:[t(p,{label:cn}),t($,{size:be.S,options:Mn,selected:o.ruleType,setSelected:i})]}),t(On,{children:t(m,{label:dn,tooltip:"Optional notes (not used by the system). Add any context or details for this sampling rule.",placeholder:"Add note here...",value:o.notes,onChange:r})})]})})},Ln=o.div`
|
|
171
117
|
display: flex;
|
|
172
118
|
flex-direction: column;
|
|
173
119
|
gap: 4px;
|
|
174
|
-
`,
|
|
120
|
+
`,zn=o.div`
|
|
175
121
|
display: flex;
|
|
176
122
|
flex-wrap: wrap;
|
|
177
123
|
gap: 8px;
|
|
178
|
-
`,
|
|
124
|
+
`,Xn=o.div`
|
|
179
125
|
display: flex;
|
|
180
126
|
align-items: center;
|
|
181
127
|
gap: 8px;
|
|
@@ -188,18 +134,18 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
188
134
|
&:hover {
|
|
189
135
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
190
136
|
}
|
|
191
|
-
`,
|
|
137
|
+
`,Vn=o.div`
|
|
192
138
|
display: flex;
|
|
193
139
|
width: 32px;
|
|
194
140
|
height: 32px;
|
|
195
141
|
justify-content: center;
|
|
196
142
|
align-items: center;
|
|
197
143
|
flex-shrink: 0;
|
|
198
|
-
`,
|
|
144
|
+
`,_n=o.div`
|
|
199
145
|
display: flex;
|
|
200
146
|
flex-wrap: wrap;
|
|
201
147
|
gap: 8px;
|
|
202
|
-
`,
|
|
148
|
+
`,Bn=o.div`
|
|
203
149
|
display: flex;
|
|
204
150
|
align-items: center;
|
|
205
151
|
gap: 6px;
|
|
@@ -207,7 +153,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
207
153
|
border-radius: 8px;
|
|
208
154
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
209
155
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
210
|
-
`,
|
|
156
|
+
`,Un=o.div`
|
|
211
157
|
display: flex;
|
|
212
158
|
align-items: center;
|
|
213
159
|
cursor: pointer;
|
|
@@ -215,86 +161,86 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
215
161
|
&:hover {
|
|
216
162
|
opacity: 1;
|
|
217
163
|
}
|
|
218
|
-
`,
|
|
164
|
+
`,jn={[Ee.JavaScript]:"Node.js",[Ee.DotNet]:".NET",[Ee.Php]:"PHP"},Hn=[Ee.Python,Ee.Java,Ee.JavaScript,Ee.DotNet,Ee.Php,Ee.Ruby,Ee.Go].map(e=>({id:e,label:jn[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:ee(e)})),Kn=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific programming language"}];function Gn(e){if("source"===e.scopeType){return[e.workloadNamespace,e.workloadKind,e.workloadName].filter(Boolean).join(" / ")}if("namespace"===e.scopeType)return`namespace: ${e.workloadNamespace}`;if("language"===e.scopeType){return`language: ${jn[e.workloadLanguage]??e.workloadLanguage}`}return"Entire Cluster"}const Wn=({formState:a,onChange:o,sourceOptions:l=[],namespaceOptions:r=[]})=>{const d=n(),[u,p]=Gt("all"),h=a.sourceScopes.length>0,m=Jt(()=>Kn.map(e=>({...e,disabled:"all"===e.value&&h})),[h]),g=Wt(e=>{p(e)},[]),f=Wt(e=>{if(!e)return;const t=function(e){const t=e.split("/");return 3!==t.length?null:{namespace:t[0],kind:t[1],name:t[2]}}(e.id);if(!t)return;const n={scopeType:"source",workloadName:t.name,workloadKind:t.kind,workloadNamespace:t.namespace,workloadLanguage:""};o({sourceScopes:[...a.sourceScopes,n]})},[a.sourceScopes,o]),v=Wt(e=>{if(!e)return;const t={scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e.id,workloadLanguage:""};o({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,o]),y=Wt(e=>{const t={scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:e};o({sourceScopes:[...a.sourceScopes,t]})},[a.sourceScopes,o]),b=Wt(e=>{const t=a.sourceScopes.filter((t,a)=>a!==e);o({sourceScopes:t})},[a.sourceScopes,o]),S=Jt(()=>{const e=new Set(a.sourceScopes.filter(e=>"source"===e.scopeType).map(e=>{return t=e.workloadNamespace,a=e.workloadKind,o=e.workloadName,`${t}/${a}/${o}`;var t,a,o}));return l.filter(t=>!e.has(t.id))},[l,a.sourceScopes]),C=Jt(()=>{const e=new Set(a.sourceScopes.filter(e=>"namespace"===e.scopeType).map(e=>e.workloadNamespace));return r.filter(t=>!e.has(t.id))},[r,a.sourceScopes]),k=Jt(()=>{const e=new Set(a.sourceScopes.filter(e=>"language"===e.scopeType).map(e=>e.workloadLanguage));return Hn.filter(t=>!e.has(t.id))},[a.sourceScopes]),w=!h&&"all"===u;return e(Dn,{children:[e(Ln,{children:[t(s,{size:c.XS,weight:500,children:on}),t(s,{size:c.XXXS,color:d.v2.colors.grey[400],children:"Define which operations this rule applies to. You can target specific endpoints or requests, or apply the rule to all operations in the selected services."})]}),h&&t(_n,{children:a.sourceScopes.map((a,o)=>e(Bn,{children:[t(s,{size:c.XXXS,color:d.v2.colors.white[500],nowrap:!0,children:Gn(a)}),t(Un,{onClick:()=>b(o),children:t(xt,{size:12,fill:d.v2.colors.grey[400]})})]},o))}),t($,{size:be.S,options:m,selected:u,setSelected:g}),w&&t(B,{status:U.Default,message:"Rule will apply to all sources in the cluster",fullWidth:!0}),"source"===u&&t(Ae,{options:S,value:"",onSelect:f,placeholder:"Search source name"}),"namespace"===u&&t(Ae,{options:C,value:"",onSelect:v,placeholder:"Search namespace"}),"language"===u&&t(zn,{children:k.map(({id:a,label:o,Icon:n})=>e(Xn,{$selected:!1,onClick:()=>y(a),children:[t(i,{size:Ie.S,value:!1,onChange:()=>y(a)}),t(Vn,{children:t(n,{size:20})}),t(s,{size:c.XS,nowrap:!0,children:o})]},a))})]})},qn=o.div`
|
|
219
165
|
display: flex;
|
|
220
166
|
flex-direction: column;
|
|
221
167
|
gap: 4px;
|
|
222
|
-
`,
|
|
168
|
+
`,Yn=o.div`
|
|
223
169
|
display: flex;
|
|
224
170
|
flex-wrap: wrap;
|
|
225
171
|
align-items: flex-end;
|
|
226
172
|
gap: 16px;
|
|
227
|
-
`,
|
|
173
|
+
`,Jn=o.div`
|
|
228
174
|
display: flex;
|
|
229
175
|
align-items: flex-end;
|
|
230
176
|
gap: 16px;
|
|
231
177
|
padding: 12px 16px;
|
|
232
178
|
border-radius: 8px;
|
|
233
179
|
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
234
|
-
`,
|
|
180
|
+
`,Qn=o.div`
|
|
235
181
|
display: flex;
|
|
236
182
|
align-items: flex-end;
|
|
237
183
|
gap: 10px;
|
|
238
184
|
flex: 1;
|
|
239
|
-
`,
|
|
185
|
+
`,Zn=o.div`
|
|
240
186
|
display: flex;
|
|
241
187
|
align-items: center;
|
|
242
188
|
height: 32px;
|
|
243
|
-
`,
|
|
189
|
+
`,el=o.div`
|
|
244
190
|
display: flex;
|
|
245
191
|
align-items: center;
|
|
246
192
|
height: 32px;
|
|
247
|
-
`,
|
|
193
|
+
`,tl=()=>t(el,{children:t(s,{size:c.XS,weight:500,children:"And"})}),al=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"httpClient",label:"HTTP client"}],ol=[{value:"all",label:"All operations"},{value:"httpServer",label:"HTTP server"},{value:"kafkaConsumer",label:"Kafka consumer"},{value:"kafkaProducer",label:"Kafka producer"}],nl=[{id:"",label:"Any method"},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],ll=({category:o,formState:l,onChange:r})=>{const i=n(),d=Jt(()=>"noisy"===o?al:ol,[o]),u=Wt(e=>r({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[r]),p=Wt(e=>t=>{t&&r({routeType:e,route:""})},[r]),h=Wt(e=>r({route:e.target.value}),[r]),g=Wt(e=>r({serverAddress:e.target.value}),[r]),f=Wt(e=>r({method:e[0]||""}),[r]),v=Wt(e=>r({kafkaTopic:e.target.value}),[r]),y="httpServer"===l.operationType||"httpClient"===l.operationType,b="kafkaConsumer"===l.operationType||"kafkaProducer"===l.operationType,S="httpClient"===l.operationType?"Templated path":un,C="httpClient"===l.operationType?"Templated path prefix":"HTTP route prefix";return e(Dn,{children:[e(qn,{children:[t(s,{size:c.XS,weight:500,children:nn}),t(s,{size:c.XXXS,color:i.v2.colors.grey[400],children:"Define which operations this rule applies to. You can target specific endpoints or requests, or apply the rule to all operations in the selected services."})]}),t($,{size:be.S,options:d,selected:l.operationType,setSelected:u}),y&&e(Yn,{children:["httpClient"===l.operationType&&e(a,{children:[t("div",{style:{flex:1},children:t(m,{label:"Server address",placeholder:"e.g. collector.my.vendor.com",value:l.serverAddress,onChange:g})}),t(tl,{})]}),e(Jn,{children:[e(Qn,{children:[t(Zn,{children:t(Re,{value:"route"===l.routeType,onChange:p("route")})}),t(m,{label:S,placeholder:Cn,value:"route"===l.routeType?l.route:"",onChange:h,disabled:"route"!==l.routeType})]}),e(Qn,{children:[t(Zn,{children:t(Re,{value:"routePrefix"===l.routeType,onChange:p("routePrefix")})}),t(m,{label:C,placeholder:Cn,value:"routePrefix"===l.routeType?l.route:"",onChange:h,disabled:"routePrefix"!==l.routeType})]})]}),t(tl,{}),t($e,{items:nl,selectedIds:[l.method||""],setSelectedIds:e=>f(e),buttonProps:{label:nl.find(e=>e.id===l.method)?.label||"Any method",size:x.S,variant:T.Secondary}})]}),b&&t(m,{label:"Kafka topic",placeholder:"Type kafka topic",value:l.kafkaTopic,onChange:v,width:"320px"})]})},rl=o.div`
|
|
248
194
|
display: flex;
|
|
249
195
|
gap: 12px;
|
|
250
|
-
`,
|
|
196
|
+
`,il=o.div`
|
|
251
197
|
display: flex;
|
|
252
198
|
flex-direction: column;
|
|
253
199
|
gap: 4px;
|
|
254
|
-
`,
|
|
200
|
+
`,sl=o.div`
|
|
255
201
|
display: flex;
|
|
256
202
|
align-items: flex-end;
|
|
257
203
|
gap: 16px;
|
|
258
|
-
`,
|
|
204
|
+
`,cl=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],dl=()=>{},ul=({ruleType:a,formState:o,onChange:l})=>{const r=n(),i=Wt(e=>l({durationPreset:e}),[l]),d=Wt(e=>l({customDurationMs:e.target.value}),[l]);return"Relevance"===a?null:e(rl,{children:["Duration"===a&&e(An,{children:[e(il,{children:[t(s,{size:c.XS,weight:500,children:ln}),t(s,{size:c.XXXS,color:r.v2.colors.grey[400],children:"Define a duration threshold for this rule. Traces with a duration longer than the specified value will be considered important and retained."})]}),t(s,{size:c.XXXS,children:gn}),e(sl,{children:[t($,{size:be.S,options:cl,selected:o.durationPreset,setSelected:i}),"custom"===o.durationPreset&&t(m,{label:"Custom duration (ms)",placeholder:"200ms",type:g.Number,value:o.customDurationMs,onChange:d,width:160})]})]}),"Error"===a&&e(An,{children:[e(il,{children:[t(s,{size:c.XS,weight:500,children:rn}),t(s,{size:c.XXXS,color:r.v2.colors.grey[400],children:"Retain traces with errors from the selected services and operations."})]}),t(b,{value:!0,onChange:dl,size:we.S,label:fn,labelAlign:S.Right})]})]})},pl=o.div`
|
|
259
205
|
display: flex;
|
|
260
206
|
flex-direction: column;
|
|
261
207
|
gap: 4px;
|
|
262
|
-
`,
|
|
208
|
+
`,hl=o.div`
|
|
263
209
|
display: flex;
|
|
264
210
|
align-items: flex-end;
|
|
265
211
|
gap: 16px;
|
|
266
|
-
`,
|
|
212
|
+
`,ml=[{value:"all",label:"drop all"},{value:"sample",label:"sample"}],gl=[{value:"all",label:"keep all"},{value:"sample",label:"sample"}],fl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],vl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],yl=({category:o,formState:l,onChange:r})=>{const i=n(),d="highlyRelevant"===o,u=d?gl:ml,p=d?hn:mn,h=d?"Specify the exact percentage of matching traces to keep":"Specify the exact percentage of matching traces to drop",f=d?vn:yn,v="noisy"===o?vl:fl,y=Wt(e=>r({percentageMode:e}),[r]),b=Wt(e=>r({percentagePreset:e}),[r]),S=Wt(e=>r({customPercentage:e.target.value}),[r]);return e(Dn,{children:[e(pl,{children:[t(s,{size:c.XS,weight:500,children:p}),t(s,{size:c.XXXS,color:i.v2.colors.grey[400],children:h})]}),"costReduction"!==o&&t($,{size:be.S,options:u,selected:l.percentageMode,setSelected:y}),("costReduction"===o||"sample"===l.percentageMode)&&e(a,{children:[t(s,{size:c.XXXS,children:f}),e(hl,{children:[t($,{size:be.S,options:v,selected:l.percentagePreset,setSelected:b}),"custom"===l.percentagePreset&&t(m,{label:"Custom percentage",placeholder:"5%",type:g.Number,value:l.customPercentage,onChange:S,width:160})]})]})]})};function bl(e){return{name:"",notes:"",disabled:!1,ruleType:"Relevance",sourceScopes:[],operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:"",durationPreset:"500",customDurationMs:"",keepErrors:!1,percentageMode:"costReduction"===e?"sample":"all",percentagePreset:"noisy"===e?"10":"50",customPercentage:""}}function Sl(e){if(!e.sourceScopes.length)return null;const t=[];for(const a of e.sourceScopes)if("source"===a.scopeType&&a.workloadName){const e={workloadName:a.workloadName};a.workloadKind&&(e.workloadKind=a.workloadKind),a.workloadNamespace&&(e.workloadNamespace=a.workloadNamespace),t.push(e)}else"namespace"===a.scopeType&&a.workloadNamespace?t.push({workloadNamespace:a.workloadNamespace}):"language"===a.scopeType&&a.workloadLanguage&&t.push({workloadLanguage:a.workloadLanguage});return t.length?t:null}function Cl(e){if("all"===e.percentageMode)return null;if("custom"===e.percentagePreset){const t=parseFloat(e.customPercentage);return isNaN(t)?null:t}return parseFloat(e.percentagePreset)}function kl(e){if("custom"===e.durationPreset){const t=parseFloat(e.customDurationMs);return isNaN(t)?null:t}return parseInt(e.durationPreset,10)}function wl(e){return"all"===e.operationType?null:"httpServer"===e.operationType?{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}:"httpClient"===e.operationType?{httpClient:{serverAddress:e.serverAddress||null,["route"===e.routeType?"templatedPath":"templatedPathPrefix"]:e.route||null,method:e.method||null}}:null}function xl(e){return"all"===e.operationType?null:"httpServer"===e.operationType?{httpServer:{[e.routeType]:e.route||null,method:e.method||null}}:"kafkaConsumer"===e.operationType?{kafkaConsumer:{kafkaTopic:e.kafkaTopic||null}}:"kafkaProducer"===e.operationType?{kafkaProducer:{kafkaTopic:e.kafkaTopic||null}}:null}function Tl(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Sl(e),operation:wl(e),percentageAtMost:Cl(e),notes:e.notes||null}}function Nl(e){return{name:e.name||null,disabled:e.disabled,sourceScopes:Sl(e),error:"Error"===e.ruleType,durationAtLeastMs:"Duration"===e.ruleType?kl(e):null,operation:xl(e),percentageAtLeast:Cl(e),notes:e.notes||null}}function Dl(e){const t=Cl(e);return{name:e.name||null,disabled:e.disabled,sourceScopes:Sl(e),operation:xl(e),percentageAtMost:t??0,notes:e.notes||null}}const Al=o.div`
|
|
267
213
|
display: flex;
|
|
268
214
|
flex-direction: column;
|
|
269
215
|
gap: 16px;
|
|
270
216
|
padding: 28px;
|
|
271
217
|
flex: 1;
|
|
272
218
|
overflow-y: auto;
|
|
273
|
-
`,
|
|
219
|
+
`,Il=o.div`
|
|
274
220
|
display: flex;
|
|
275
221
|
align-items: center;
|
|
276
222
|
gap: 8px;
|
|
277
223
|
padding: 16px 28px;
|
|
278
224
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
279
|
-
`,
|
|
225
|
+
`,El=o.div`
|
|
280
226
|
flex: 1;
|
|
281
|
-
`,
|
|
227
|
+
`,Rl=({isOpen:a,category:o,onClose:n,onSubmit:l,sourceOptions:r,namespaceOptions:i,validateForm:s,onNavigateToDuplicate:c})=>{const{formData:d,handleFormChange:u,resetFormData:p}=A(bl(o)),[h,m]=Gt(null);Ht(()=>{a&&(p(),m(null))},[a,o]);const g=Wt(e=>{m(null),u(void 0,void 0,{...d,...e})},[d,u]),f=Wt(()=>{if(s){const e=s(d);if(e)return void m(e)}l(d)},[d,l,s]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:kn[o],subTitle:bn[o],onClose:n},children:[e(Al,{children:[t(Nn,{category:o,formState:d}),t(Fn,{category:o,formState:d,onChange:g}),t(Wn,{formState:d,onChange:g,sourceOptions:r,namespaceOptions:i}),t(ll,{category:o,formState:d,onChange:g}),"highlyRelevant"===o&&t(ul,{ruleType:d.ruleType,formState:d,onChange:g}),t(yl,{category:o,formState:d,onChange:g})]}),e(Il,{children:[h&&t(B,{status:U.Warning,message:h.message,action:c?{label:"View rule",onClick:()=>c(h.ruleId)}:void 0}),t(El,{}),t(w,{label:tn,variant:T.Secondary,size:x.S,onClick:n}),t(w,{label:"Create rule",variant:T.Primary,size:x.S,onClick:f,disabled:!!h})]})]})};function $l(e){if(!e||!e.enabled)return[{text:"Auto rule is ",variant:"default"},{text:"disabled",variant:"action"}];return[{text:`Keep ${e.keepPercentage??0}%`,variant:"action"},{text:" of ",variant:"default"},{text:"traces for kubelet health probes in the entire cluster",variant:"scope"}]}function Pl(e){return!(!0!==e.error||e.sourceScopes&&0!==e.sourceScopes.length||e.operation||null!=e.percentageAtLeast&&100!==e.percentageAtLeast)}function Ol(e){for(const t of e){const e=t.highlyRelevantOperations.find(Pl);if(e)return{rule:e,samplingId:t.id}}return null}function Ml(e){return!e||e.disabled?[{text:"Auto rule is ",variant:"default"},{text:"disabled",variant:"action"}]:[{text:"Keep 100%",variant:"action"},{text:" of ",variant:"default"},{text:"error traces across the entire cluster",variant:"scope"}]}function Fl(e){return!(e.sourceScopes&&0!==e.sourceScopes.length||e.operation)}function Ll(e){for(const t of e){const e=t.costReductionRules.find(Fl);if(e)return{rule:e,samplingId:t.id}}return null}function zl(e){return!e||e.disabled?[{text:"Auto rule is ",variant:"default"},{text:"disabled",variant:"action"}]:[{text:`Drop ${e.percentageAtMost}%`,variant:"action"},{text:" of ",variant:"default"},{text:"traces across the entire cluster",variant:"scope"}]}const Xl=o.div`
|
|
282
228
|
display: flex;
|
|
283
229
|
flex-direction: column;
|
|
284
230
|
gap: 12px;
|
|
285
231
|
padding: 12px 16px;
|
|
286
232
|
flex: 1;
|
|
287
233
|
overflow-y: auto;
|
|
288
|
-
`,
|
|
234
|
+
`,Vl=o.div`
|
|
289
235
|
display: flex;
|
|
290
236
|
flex-direction: column;
|
|
291
237
|
gap: 8px;
|
|
292
238
|
padding: 16px;
|
|
293
239
|
border-radius: 8px;
|
|
294
|
-
`,
|
|
240
|
+
`,_l=o(r)`
|
|
295
241
|
align-items: center;
|
|
296
242
|
gap: 8px;
|
|
297
|
-
`,
|
|
243
|
+
`,Bl=o.div`
|
|
298
244
|
flex: 1;
|
|
299
245
|
min-width: 0;
|
|
300
246
|
padding: 8px 16px;
|
|
@@ -302,44 +248,44 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
302
248
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
303
249
|
white-space: pre;
|
|
304
250
|
overflow-x: auto;
|
|
305
|
-
`,
|
|
251
|
+
`,Ul=o.div`
|
|
306
252
|
display: flex;
|
|
307
253
|
flex-direction: column;
|
|
308
254
|
gap: 16px;
|
|
309
255
|
padding: 16px;
|
|
310
256
|
border-radius: 16px;
|
|
311
257
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
312
|
-
`,
|
|
258
|
+
`,jl=o.div`
|
|
313
259
|
display: flex;
|
|
314
260
|
flex-direction: column;
|
|
315
261
|
gap: 4px;
|
|
316
|
-
`,
|
|
262
|
+
`,Hl=o.div`
|
|
317
263
|
display: flex;
|
|
318
264
|
align-items: flex-end;
|
|
319
265
|
gap: 16px;
|
|
320
|
-
`,
|
|
266
|
+
`,Kl=o.div`
|
|
321
267
|
display: flex;
|
|
322
268
|
justify-content: flex-end;
|
|
323
269
|
gap: 8px;
|
|
324
270
|
padding: 16px 28px;
|
|
325
271
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
326
|
-
`,
|
|
272
|
+
`,Gl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}];function Wl(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const ql=({isOpen:a,enabled:o,keepPercentage:l,onClose:r,onSave:i})=>{const d=n(),[u,p]=Gt(o),[h,f]=Gt(()=>Wl(l)),[v,y]=Gt(()=>"custom"===Wl(l)?String(l):"");Ht(()=>{if(a){p(o);const e=Wl(l);f(e),y("custom"===e?String(l):"")}},[a,o,l]);const C=Jt(()=>"custom"===h?Number(v)||0:Number(h),[h,v]),k=Jt(()=>$l({enabled:u,keepPercentage:C}),[u,C]),N=Wt(e=>f(e),[]),D=Wt(e=>y(e.target.value),[]),A=Wt(()=>{i(u,C)},[u,C,i]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:"Edit 'Noisy Operation' auto rule",subTitle:"Automatically detect and sample health probe traces across the cluster.",onClose:r},children:[e(Xl,{children:[e(Vl,{children:[t(s,{size:c.XXS,color:d.v2.colors.silver[200],children:"Auto rule - Kubernetes Health Probes"}),e(_l,{children:[t(Bl,{children:t(xo,{parts:k})}),t(b,{value:u,onChange:p,size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]}),e(Ul,{children:[e(jl,{children:[t(s,{size:c.XS,weight:500,children:"Keep Percentage"}),t(s,{size:c.XXXS,color:d.v2.colors.grey[400],children:"Specify the exact percentage of matching traces to keep"})]}),t(s,{size:c.XXXS,children:"Keep at least this percentage of matching traces"}),e(Hl,{children:[t($,{size:be.S,options:Gl,selected:h,setSelected:N}),"custom"===h&&t(m,{label:"Custom percentage",placeholder:"5%",type:g.Number,value:v,onChange:D,width:160})]})]})]}),e(Kl,{children:[t(w,{label:"Cancel",variant:T.Secondary,size:x.S,onClick:r}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:A})]})]})},Yl=o.div`
|
|
327
273
|
display: flex;
|
|
328
274
|
flex-direction: column;
|
|
329
275
|
gap: 12px;
|
|
330
276
|
padding: 12px 16px;
|
|
331
277
|
flex: 1;
|
|
332
278
|
overflow-y: auto;
|
|
333
|
-
`,
|
|
279
|
+
`,Jl=o.div`
|
|
334
280
|
display: flex;
|
|
335
281
|
flex-direction: column;
|
|
336
282
|
gap: 8px;
|
|
337
283
|
padding: 16px;
|
|
338
284
|
border-radius: 8px;
|
|
339
|
-
`,
|
|
285
|
+
`,Ql=o(r)`
|
|
340
286
|
align-items: center;
|
|
341
287
|
gap: 8px;
|
|
342
|
-
`,
|
|
288
|
+
`,Zl=o.div`
|
|
343
289
|
flex: 1;
|
|
344
290
|
min-width: 0;
|
|
345
291
|
padding: 8px 16px;
|
|
@@ -347,29 +293,29 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
347
293
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
348
294
|
white-space: pre;
|
|
349
295
|
overflow-x: auto;
|
|
350
|
-
`,
|
|
296
|
+
`,er=o.div`
|
|
351
297
|
display: flex;
|
|
352
298
|
justify-content: flex-end;
|
|
353
299
|
gap: 8px;
|
|
354
300
|
padding: 16px 28px;
|
|
355
301
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
356
|
-
`,
|
|
302
|
+
`,tr=({isOpen:a,enabled:o,onClose:l,onSave:r})=>{const i=n(),[d,u]=Gt(o);Ht(()=>{a&&u(o)},[a,o]);const p=Jt(()=>Ml(d?{disabled:!1}:null),[d]),h=Wt(()=>{r(d)},[d,r]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:"Edit 'Highly Relevant' auto rule",subTitle:"Automatically keep all error traces across the entire cluster.",onClose:l},children:[t(Yl,{children:e(Jl,{children:[t(s,{size:c.XXS,color:i.v2.colors.silver[200],children:"Auto rule - Keep All Error Traces"}),e(Ql,{children:[t(Zl,{children:t(xo,{parts:p})}),t(b,{value:d,onChange:u,size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]})}),e(er,{children:[t(w,{label:"Cancel",variant:T.Secondary,size:x.S,onClick:l}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:h})]})]})},ar=o.div`
|
|
357
303
|
display: flex;
|
|
358
304
|
flex-direction: column;
|
|
359
305
|
gap: 12px;
|
|
360
306
|
padding: 12px 16px;
|
|
361
307
|
flex: 1;
|
|
362
308
|
overflow-y: auto;
|
|
363
|
-
`,
|
|
309
|
+
`,or=o.div`
|
|
364
310
|
display: flex;
|
|
365
311
|
flex-direction: column;
|
|
366
312
|
gap: 8px;
|
|
367
313
|
padding: 16px;
|
|
368
314
|
border-radius: 8px;
|
|
369
|
-
`,
|
|
315
|
+
`,nr=o(r)`
|
|
370
316
|
align-items: center;
|
|
371
317
|
gap: 8px;
|
|
372
|
-
`,
|
|
318
|
+
`,lr=o.div`
|
|
373
319
|
flex: 1;
|
|
374
320
|
min-width: 0;
|
|
375
321
|
padding: 8px 16px;
|
|
@@ -377,28 +323,28 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
377
323
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
378
324
|
white-space: pre;
|
|
379
325
|
overflow-x: auto;
|
|
380
|
-
`,
|
|
326
|
+
`,rr=o.div`
|
|
381
327
|
display: flex;
|
|
382
328
|
flex-direction: column;
|
|
383
329
|
gap: 16px;
|
|
384
330
|
padding: 16px;
|
|
385
331
|
border-radius: 16px;
|
|
386
332
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
387
|
-
`,
|
|
333
|
+
`,ir=o.div`
|
|
388
334
|
display: flex;
|
|
389
335
|
flex-direction: column;
|
|
390
336
|
gap: 4px;
|
|
391
|
-
`,
|
|
337
|
+
`,sr=o.div`
|
|
392
338
|
display: flex;
|
|
393
339
|
align-items: flex-end;
|
|
394
340
|
gap: 16px;
|
|
395
|
-
`,
|
|
341
|
+
`,cr=o.div`
|
|
396
342
|
display: flex;
|
|
397
343
|
justify-content: flex-end;
|
|
398
344
|
gap: 8px;
|
|
399
345
|
padding: 16px 28px;
|
|
400
346
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
401
|
-
|
|
347
|
+
`,dr=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}];function ur(e){const t=String(e);return"50"===t||"25"===t||"10"===t||"1"===t?t:"custom"}const pr=({isOpen:a,enabled:o,dropPercentage:l,onClose:r,onSave:i})=>{const d=n(),[u,p]=Gt(o),[h,f]=Gt(()=>ur(l)),[v,y]=Gt(()=>"custom"===ur(l)?String(l):"");Ht(()=>{if(a){p(o);const e=ur(l);f(e),y("custom"===e?String(l):"")}},[a,o,l]);const C=Jt(()=>"custom"===h?Number(v)||0:Number(h),[h,v]),k=Jt(()=>zl(u?{disabled:!1,percentageAtMost:C}:null),[u,C]),N=Wt(e=>f(e),[]),D=Wt(e=>y(e.target.value),[]),A=Wt(()=>{i(u,C)},[u,C,i]);return e(Pe,{isOpen:a,width:Sn,header:{icon:Dt,title:"Edit 'Cost Reduction' auto rule",subTitle:"Automatically drop a percentage of traces across the entire cluster.",onClose:r},children:[e(ar,{children:[e(or,{children:[t(s,{size:c.XXS,color:d.v2.colors.silver[200],children:"Auto rule - Drop Traces Cluster-Wide"}),e(nr,{children:[t(lr,{children:t(xo,{parts:k})}),t(b,{value:u,onChange:p,size:we.S,label:"Rule Enabled",labelAlign:S.Right})]})]}),e(rr,{children:[e(ir,{children:[t(s,{size:c.XS,weight:500,children:"Drop Percentage"}),t(s,{size:c.XXXS,color:d.v2.colors.grey[400],children:"Specify the exact percentage of matching traces to drop"})]}),t(s,{size:c.XXXS,children:"Drop at most this percentage of matching traces"}),e(sr,{children:[t($,{size:be.S,options:dr,selected:h,setSelected:N}),"custom"===h&&t(m,{label:"Custom percentage",placeholder:"5%",type:g.Number,value:v,onChange:D,width:160})]})]})]}),e(cr,{children:[t(w,{label:"Cancel",variant:T.Secondary,size:x.S,onClick:r}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:A})]})]})},hr=({onClose:a,connections:o,selectedConnectionIds:l,setSelectedConnectionIds:i,getEffectiveConfig:d,onApply:u})=>{const p=n(),[h,m]=Gt(""),[g,f]=Gt({showOnlySelected:!1}),v=Jt(()=>o.filter(e=>{const t=!h||e.name.toLowerCase().includes(h.toLowerCase()),a=!g.showOnlySelected||g.showOnlySelected&&l.includes(e.id);return t&&a}),[o.length,l.length,h,g]),y=e=>{i(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},[S,C]=Gt(!1),[k,w]=Gt(void 0),{formData:x,handleFormChange:T,areFormValuesEqual:N,resetFormData:D}=A(k||{rollout:{automaticRolloutDisabled:!1}}),I=Jt(()=>l.length>1||void 0!==k&&!N(k,x),[l.length,k,x]);return Ht(()=>{1===l.length?(async e=>{if(S)return;C(!0);const t=await d(e);if(t){const e={rollout:{automaticRolloutDisabled:t.rollout?.automaticRolloutDisabled??!1}};w(e),D(e)}C(!1)})(l[0]):w(void 0)},[l.length]),t(aa,{isOpen:!0,onClose:a,onSave:()=>u(x,l),header:{icon:At,title:"Cluster Configuration"},connectionIds:{value:l,setValue:i},search:{placeholder:"Search by cluster name",value:h,onChange:m},filters:e(r,{$gap:8,children:[t(s,{size:c.XXXS,color:p.v2.colors.silver[200],nowrap:!0,children:"Show only:"}),t(b,{size:we.S,label:"Selected",value:g.showOnlySelected,onChange:e=>f(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:I,isFetching:S,leftColumn:{width:"35%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(s,{size:c.XS,children:"Clusters"}),t(Q,{label:v.length,status:ke.Unknown})]}),e(r,{$gap:8,children:[t(s,{size:c.XXXS,color:p.v2.colors.silver[200],align:"right",children:"Selected clusters"}),t(Q,{label:`${l.length}/${v.length}`,status:ke.Unknown})]})]}),list:v.map(e=>t(da,{title:e.name,isChecked:l.includes(e.id),onClick:()=>y(e.id),onCheckboxChange:()=>y(e.id)},e.id))},rightColumn:{width:"65%",header:t(s,{size:c.XS,children:"Configurations"}),list:[t(b,{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:x.rollout?.automaticRolloutDisabled||!1,onChange:e=>T("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},mr=({token:o,isLoading:n,isEditing:l,onEdit:i,onCancel:d,onSave:u,formData:p,handleFormChange:h,handleErrorChange:g,formErrors:f})=>{const{CopyButton:v}=Oe(),y=!l||n||!p.newToken;return Me({key:"Enter",active:!y},u),e(r,l?{$justifyContent:"space-between",$alignItems:"flex-start",$gap:12,children:[t(m,{type:"password",value:p.newToken,onChange:e=>{h("newToken",e.target.value),g("newToken",void 0)},width:"430px",autoFocus:!0,errorMessage:f.newToken}),t(r,{$margin:n?"8px 0 0 0":"2px 0 0 0",$alignItems:"center",children:n?t(ge,{title:"Saving...",withGradient:!0}):e(a,{children:[t(w,{variant:T.Secondary,size:x.S,leftIcon:xt,onClick:d,disabled:n}),t(w,{variant:T.Primary,size:x.S,leftIcon:wt,onClick:u,disabled:y})]})})]}:{$justifyContent:"space-between",$gap:12,children:[t(s,{size:c.XS,children:new Array(55).fill("•").join("")}),e(r,{$alignItems:"center",$justifyContent:"space-between",children:[t(v,{value:o}),t(he,{icon:ft,onClick:i})]})]})},gr=({expiresAt:e,callbackValid:a,callbackExpired:o})=>{const{formatTimeAgo:n}=Fe(),l=Jt(()=>n(e),[e]),r=Jt(()=>new Date(e).toDateString().split(" ").slice(1).join(" "),[e]),i=Jt(()=>Le(e,0)?U.Error:Le(e,2592e6)?U.Warning:U.Success,[e]),s=Jt(()=>i===U.Success?wt:i===U.Warning?It:Et,[i]);return Ht(()=>{i===U.Success?a():i===U.Error&&o()},[i]),t(H,{text:r,children:t(Q,{leftIcon:s,label:l,status:i,invertColors:!0,useSecondaryTone:!0})})},fr=o.div`
|
|
402
348
|
display: flex;
|
|
403
349
|
flex-direction: column;
|
|
404
350
|
gap: 12px;
|
|
@@ -406,7 +352,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
406
352
|
border-radius: 12px;
|
|
407
353
|
border: 1px solid ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[500]:e.v2.colors.silver[600]};
|
|
408
354
|
background-color: ${({theme:e,$isExpired:t})=>t?e.v2.colors.red[1e3]:e.v2.colors.silver[800]};
|
|
409
|
-
`,
|
|
355
|
+
`,vr=({children:e})=>{const a=n();return t(s,{size:c.XXXS,color:a.v2.colors.grey[150],children:e})},yr=({token:a,updateToken:o})=>{const[n,i]=Gt(!1),[d,u]=Gt(!1),[p,h]=Gt(!1),{formData:m,handleFormChange:g,formErrors:f,handleErrorChange:v,resetFormData:y}=A({newToken:""});return t(ze,{richTitle:{icon:Rt,title:"Odigos Pro Token"},children:e(fr,{$isExpired:p,children:[e(r,{$justifyContent:"space-between",children:[e(l,{$gap:4,children:[t(vr,{children:"Issued for"}),t(s,{size:c.XS,children:a.name||"N/A"})]}),e(l,{$gap:4,children:[t(vr,{children:"Expiration"}),t(gr,{expiresAt:a.expiresAt,callbackValid:()=>h(!1),callbackExpired:()=>h(!0)})]}),t(l,{})]}),t(r,{children:e(l,{children:[t(vr,{children:"Token"}),t(mr,{token:a.token,newToken:m.newToken,isLoading:d,isEditing:n,onEdit:()=>i(!0),onCancel:()=>(i(!1),u(!1),void g("newToken","")),onSave:()=>(async()=>{u(!0);const e=await o(m.newToken.trim());u(!1),e?.error?v("newToken",e.error):(i(!1),y())})(),formData:m,handleFormChange:g,handleErrorChange:v,formErrors:f})]})})]})})},br=o.div`
|
|
410
356
|
display: flex;
|
|
411
357
|
flex-direction: column;
|
|
412
358
|
align-items: center;
|
|
@@ -415,49 +361,49 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
415
361
|
padding: 12px 24px;
|
|
416
362
|
border-radius: 8px;
|
|
417
363
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
418
|
-
`,
|
|
364
|
+
`,Sr=({downloadDiagnose:a})=>{const o=n(),{progress:d}=Ne(),{namespaces:u}=Se(),[p,h]=Gt(null),{formData:m,handleFormChange:g,resetFormData:f}=A({includeProfiles:!0,includeMetrics:!0,includeSourceWorkloads:!1,sourceWorkloadNamespaces:[]});return t(ze,{richTitle:{icon:$t,title:"Diagnose"},children:p?e(br,{children:[t(ge,{title:"Creating file...",subTitle:"This may take a few moments. Do not refresh the page.",withGradient:!0,withSpinner:"number"==typeof d[De.DownloadingDiagnose]?.percentage,percentage:d[De.DownloadingDiagnose]?.percentage,withVisual:"number"!=typeof d[De.DownloadingDiagnose]?.percentage,visualIcon:Pt,startedAt:p}),d[De.DownloadingDiagnose]?.list?.length&&t(l,{$width:"100%",children:d[De.DownloadingDiagnose].list.map(a=>e(r,{$gap:4,$alignItems:"center",children:[a.status===U.Success?t(wt,{size:16}):a.status===U.Error?t(xt,{size:16}):t(ge,{withSpinnerOld:!0,scaleSpinnerOld:.7}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:a.label})]},a.label))})]}):e(l,{$gap:24,children:[t(s,{size:c.XXS,color:o.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(l,{$gap:16,children:[e(r,{$gap:8,children:[t(i,{label:"Profiles",value:m.includeProfiles,onChange:e=>g("includeProfiles",e),tooltip:"Note: Adds 30s to diagnose download time to collect Profiles"}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:"Include pprof profiles"})]}),e(r,{$gap:8,children:[t(i,{label:"Metrics",value:m.includeMetrics,onChange:e=>g("includeMetrics",e)}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:"Include Prometheus metrics"})]}),e(r,{$gap:8,children:[t(i,{label:"Source Workloads",value:m.includeSourceWorkloads,onChange:e=>{g("includeSourceWorkloads",e),e&&g("sourceWorkloadNamespaces",[])}}),t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:"Include workload and pod manifests for instrumented sources"})]})]}),t($e,{alignX:Ve.Left,alignY:Xe.Bottom,items:u.map(e=>({id:e.name,label:e.name,withCheckbox:!0})),selectedIds:m.sourceWorkloadNamespaces,setSelectedIds:e=>g("sourceWorkloadNamespaces",e),withMultiSelect:!0,withSearch:!0,fullWidth:!0,buttonProps:{label:(m.sourceWorkloadNamespaces.length?"Selected":"Select")+" Namespaces",variant:T.Secondary,disabled:m.includeSourceWorkloads,leftIcon:m.sourceWorkloadNamespaces.length?()=>t(Q,{label:m.sourceWorkloadNamespaces.length,status:U.Default}):void 0}}),t(r,{$justifyContent:"flex-end",children:t(w,{label:"Download Diagnose",rightIcon:Pt,variant:T.Primary,onClick:async()=>{h(Date.now()),await a(m),h(null),f()},disabled:null!==p})})]})})},Cr=({fetchDescribeOdigos:e})=>{const{platformType:a,version:o,tier:n}=te(),[l,r]=Gt(null);return Ht(()=>{e().then(({data:e})=>r(e?.describeOdigos||null))},[]),t(ze,{richTitle:{icon:Ot,title:"General Information"},children:t(_e,{cellsPerRow:2,items:[{id:Be(),title:"Odigos Version",label:o},{id:Be(),title:`${a.toUpperCase()} Version`,label:l?.kubernetesVersion?.value||"-"},{id:Be(),title:"Installation Method",label:l?.installationMethod?.value||"-"},{id:Be(),title:"Tier",label:n}]})})},kr=({isOpen:a,onClose:o,token:n,updateToken:l,fetchDescribeOdigos:r,downloadDiagnose:i})=>e(Pe,{isOpen:a,header:{icon:Ot,title:"System Overview",onClose:o},children:[r&&t(Cr,{fetchDescribeOdigos:r}),l&&n&&t(yr,{token:n,updateToken:l}),i&&t(Sr,{downloadDiagnose:i})]}),wr="-",xr="Operation type",Tr="Sample",Nr="Delete rule",Dr={noisy:"Edit 'Noisy Operations' sampling rule",highlyRelevant:"Edit 'Highly Relevant Operations' sampling rule",costReduction:"Edit 'Cost Reduction' sampling rule"},Ar="All operations",Ir="HTTP server endpoint",Er={noisy:"Noisy Operation",highlyRelevant:"Highly Relevant",costReduction:"Cost Reduction"},Rr=o.div`
|
|
419
365
|
display: flex;
|
|
420
366
|
flex-direction: column;
|
|
421
367
|
gap: 8px;
|
|
422
368
|
border-radius: 8px;
|
|
423
|
-
|
|
369
|
+
`,$r=o.div`
|
|
424
370
|
min-width: 0;
|
|
425
371
|
padding: 8px 16px;
|
|
426
372
|
border-radius: 8px;
|
|
427
373
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
428
374
|
white-space: pre;
|
|
429
375
|
overflow-x: auto;
|
|
430
|
-
`,
|
|
376
|
+
`,Pr=({summary:a})=>{const o=n();return e(Rr,{children:[t(s,{size:c.XXS,color:o.v2.colors.silver[200],children:an}),t($r,{children:t(xo,{parts:a})})]})};function Or(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Er[e.category]}const Mr=({data:a})=>{const o=n(),l=Jt(()=>[{id:"name",title:sn,value:a.rule.name||Zo},{id:"type",title:cn,value:Or(a)}],[a]),r=a.rule.notes||wr;return e(Dn,{children:[t(In,{children:l.map(({id:a,title:n,value:l})=>e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),t(s,{size:c.XS,nowrap:!0,children:l})]},a))}),e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:dn}),t(s,{size:c.XS,children:r})]})]})},Fr=o.div`
|
|
431
377
|
display: flex;
|
|
432
378
|
flex-direction: column;
|
|
433
379
|
gap: 4px;
|
|
434
|
-
`,
|
|
380
|
+
`,Lr=o.div`
|
|
435
381
|
display: flex;
|
|
436
382
|
align-items: center;
|
|
437
383
|
gap: 8px;
|
|
438
384
|
padding: 8px 12px;
|
|
439
385
|
border-radius: 8px;
|
|
440
386
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
441
|
-
`,
|
|
387
|
+
`,zr=o.div`
|
|
442
388
|
display: flex;
|
|
443
389
|
width: 24px;
|
|
444
390
|
height: 24px;
|
|
445
391
|
justify-content: center;
|
|
446
392
|
align-items: center;
|
|
447
393
|
flex-shrink: 0;
|
|
448
|
-
`,
|
|
394
|
+
`,Xr={[Ee.JavaScript]:"Node.js",[Ee.DotNet]:".NET",[Ee.Php]:"PHP",[Ee.Java]:"Java",[Ee.Go]:"Go",[Ee.Python]:"Python",[Ee.Ruby]:"Ruby",[Ee.Rust]:"Rust"};function Vr(e){const t=Xr[e];return t||e.charAt(0).toUpperCase()+e.slice(1)}const _r=({scopes:a})=>{const o=n();return e(Dn,{children:[t(s,{size:c.XS,weight:500,children:on}),a.length?t(Fr,{children:a.map((a,n)=>function(a,o,n){if(a.workloadLanguage){const l=ee(a.workloadLanguage);return e(Lr,{children:[l&&t(zr,{children:t(l,{size:18})}),t(s,{size:c.XS,color:n.v2.colors.white[500],children:Vr(a.workloadLanguage)})]},o)}const l=[a.workloadNamespace,a.workloadKind,a.workloadName].filter(Boolean),r=l.length?l.join(" / "):"Unknown scope";return t(Lr,{children:t(s,{size:c.XS,color:n.v2.colors.white[500],children:r})},o)}(a,n,o))}):t(B,{status:U.Default,message:"Rule will apply to all sources in the cluster",fullWidth:!0})]})},Br="Kafka topic",Ur="Any method";const jr=({data:a})=>{const o=n(),l=Jt(()=>function(e){if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:xr,value:Ir},{id:"route",title:un,value:t.httpServer.route||t.httpServer.routePrefix||wr},{id:"method",title:pn,value:t.httpServer.method||Ur}];if(t?.httpClient){const e=[{id:"type",title:xr,value:"HTTP client endpoint"}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:un,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||wr}),e.push({id:"method",title:pn,value:t.httpClient.method||Ur}),e}return[{id:"type",title:xr,value:Ar}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:xr,value:Ir},{id:"route",title:un,value:t.httpServer.route||t.httpServer.routePrefix||wr},{id:"method",title:pn,value:t.httpServer.method||Ur}]:t?.kafkaConsumer?[{id:"type",title:xr,value:"Kafka consumer"},{id:"topic",title:Br,value:t.kafkaConsumer.kafkaTopic||wr}]:t?.kafkaProducer?[{id:"type",title:xr,value:"Kafka producer"},{id:"topic",title:Br,value:t.kafkaProducer.kafkaTopic||wr}]:[{id:"type",title:xr,value:Ar}]}(a),[a]);return e(Dn,{children:[t(s,{size:c.XS,children:nn}),t(In,{children:l.map(({id:a,title:n,value:l})=>e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),t(s,{size:c.XS,nowrap:!0,children:l})]},a))})]})},Hr=()=>{},Kr=o.div`
|
|
449
395
|
display: flex;
|
|
450
396
|
gap: 12px;
|
|
451
|
-
`,
|
|
397
|
+
`,Gr=({rule:a})=>{const o=n(),l=null!=a.durationAtLeastMs,r=a.error;return l||r?e(Kr,{children:[l&&e(An,{children:[t(s,{size:c.XS,children:ln}),e("div",{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],children:gn}),t(s,{size:c.XS,children:`${a.durationAtLeastMs}ms`})]})]}),r&&e(An,{children:[t(s,{size:c.XS,children:rn}),t(b,{onChange:Hr,value:!0,size:we.S,label:fn,labelAlign:S.Right})]})]}):null};const Wr=({data:a})=>{const o=n(),l=Jt(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:hn,method:Tr,description:vn,value:`${e.rule.percentageAtLeast}%`}:{title:hn,method:"Keep all",description:null,value:null};case"noisy":return null!=e.rule.percentageAtMost?{title:mn,method:Tr,description:yn,value:`${e.rule.percentageAtMost}%`}:{title:mn,method:"Drop all",description:null,value:null};case"costReduction":return{title:mn,method:Tr,description:yn,value:`${e.rule.percentageAtMost}%`}}}(a),[a]),r=[{id:"method",title:pn,value:l.method},...null!=l.description?[{id:"value",title:l.description,value:l.value}]:[]];return e(Dn,{children:[t(s,{size:c.XS,children:l.title}),t(In,{children:r.map(({id:a,title:n,value:l})=>e(En,{children:[t(s,{size:c.XXXS,color:o.v2.colors.silver[200],nowrap:!0,children:n}),t(s,{size:c.XS,nowrap:!0,children:l})]},a))})]})},qr=o.div`
|
|
452
398
|
display: flex;
|
|
453
399
|
align-items: center;
|
|
454
400
|
gap: 12px;
|
|
455
401
|
margin-top: auto;
|
|
456
402
|
padding: 12px 4px;
|
|
457
403
|
border-top: 1px solid ${({theme:e})=>e.v2.colors.silver[800]};
|
|
458
|
-
`,
|
|
404
|
+
`,Yr=o.div`
|
|
459
405
|
flex: 1;
|
|
460
|
-
`,
|
|
406
|
+
`,Jr=o.div`
|
|
461
407
|
display: flex;
|
|
462
408
|
align-items: center;
|
|
463
409
|
gap: 8px;
|
|
@@ -467,29 +413,29 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
467
413
|
&:hover {
|
|
468
414
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
469
415
|
}
|
|
470
|
-
`,
|
|
416
|
+
`,Qr=a=>{const o=n().v2.colors.red[500];if(a.isEditing){const{onCancelEdit:n,onSave:l,onDelete:r,duplicateWarning:i}=a;return e(qr,{children:[e(Jr,{onClick:r,children:[t(s,{size:c.XS,weight:500,color:o,children:Nr}),t(dt,{size:16,fill:o})]}),i&&t(B,{status:U.Warning,message:i.message,action:i.onViewRule?{label:"View rule",onClick:i.onViewRule}:void 0}),t(Yr,{}),t(w,{label:tn,variant:T.Secondary,size:x.S,onClick:n}),t(w,{label:"Save",variant:T.Primary,size:x.S,onClick:l,disabled:!!i})]})}const{onDelete:l,onCancel:r,onEdit:i}=a;return e(qr,{children:[e(Jr,{onClick:l,children:[t(s,{size:c.XS,weight:500,color:o,children:Nr}),t(dt,{size:16,fill:o})]}),t(Yr,{}),t(w,{label:tn,variant:T.Secondary,size:x.S,onClick:r}),t(w,{label:en,variant:T.Primary,size:x.S,onClick:i})]})},Zr=["5000","1000","500","100","50"],ei=["50","25","10","1","0.5","0.1"];function ti(e){if(null==e)return{percentageMode:"all",percentagePreset:"50",customPercentage:""};const t=ei.find(t=>Number(t)===e);return t?{percentageMode:"sample",percentagePreset:t,customPercentage:""}:{percentageMode:"sample",percentagePreset:"custom",customPercentage:String(e)}}function ai(e){if(!e)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};const t=e;if(t.httpServer){return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""}}return t.kafkaConsumer?{operationType:"kafkaConsumer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaConsumer.kafkaTopic||""}:t.kafkaProducer?{operationType:"kafkaProducer",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:t.kafkaProducer.kafkaTopic||""}:{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}function oi(e){const t=bl(),a=(o=e.rule.sourceScopes,o?.length?o.map(e=>e.workloadLanguage?{scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:e.workloadLanguage}:e.workloadName?{scopeType:"source",workloadName:e.workloadName,workloadKind:e.workloadKind??"",workloadNamespace:e.workloadNamespace??"",workloadLanguage:""}:e.workloadNamespace?{scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e.workloadNamespace,workloadLanguage:""}:{scopeType:"all",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:""}).filter(e=>"all"!==e.scopeType):[]);var o;const n=function(e){return"highlyRelevant"!==e.category?"Relevance":e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance"}(e);let l,r,i={durationPreset:"500",customDurationMs:""},s=!1;switch(e.category){case"noisy":l=function(e){const t=e.rule.operation;if(!t)return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""};if(t.httpServer)return{operationType:"httpServer",routeType:t.httpServer.routePrefix?"routePrefix":"route",route:t.httpServer.route||t.httpServer.routePrefix||"",serverAddress:"",method:t.httpServer.method||"",kafkaTopic:""};if(t.httpClient)return{operationType:"httpClient",routeType:t.httpClient.templatedPathPrefix?"routePrefix":"route",route:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||"",serverAddress:t.httpClient.serverAddress||"",method:t.httpClient.method||"",kafkaTopic:""};return{operationType:"all",routeType:"route",route:"",serverAddress:"",method:"",kafkaTopic:""}}(e),r=ti(e.rule.percentageAtMost);break;case"highlyRelevant":l=ai(e.rule.operation),r=ti(e.rule.percentageAtLeast),i=function(e){if(null==e)return{durationPreset:"500",customDurationMs:""};const t=Zr.find(t=>Number(t)===e);return t?{durationPreset:t,customDurationMs:""}:{durationPreset:"custom",customDurationMs:String(e)}}(e.rule.durationAtLeastMs),s=e.rule.error;break;case"costReduction":l=ai(e.rule.operation),r=ti(e.rule.percentageAtMost)}return{...t,name:e.rule.name||"",notes:e.rule.notes||"",disabled:e.rule.disabled,ruleType:n,sourceScopes:a,...l,...i,keepErrors:s,...r}}const ni=o.div`
|
|
471
417
|
display: flex;
|
|
472
418
|
flex-direction: column;
|
|
473
419
|
gap: 16px;
|
|
474
420
|
padding: 32px 28px;
|
|
475
421
|
flex: 1;
|
|
476
422
|
overflow-y: auto;
|
|
477
|
-
`,
|
|
423
|
+
`,li=({data:a,defaultEditMode:o,onClose:n,onDelete:l,onSaveEdit:r,sourceOptions:i,namespaceOptions:s,validateForm:c,onNavigateToDuplicate:d})=>{const[u,p]=Gt(!1),{formData:h,handleFormChange:m,resetFormData:g}=A(void 0),f=Qt(null),[v,y]=Gt(null);Ht(()=>{a!==f.current&&(f.current=a,a&&o?(g(oi(a)),y(null),p(!0)):(p(!1),y(null)))},[a,o]);const b=a?.rule.name||Zo,S=u&&a?Dr[a.category]:`${b} preview`,C=Wt(()=>{a&&(g(oi(a)),y(null),p(!0))},[a,g]),k=Wt(()=>{p(!1),y(null)},[]),w=Wt(()=>{if(a&&u){if(c){const e=c(h);if(e)return void y(e)}r(h,a.rule.ruleId,a.samplingId)}},[a,u,h,r,c]),x=Wt(()=>{a&&l(a.rule.ruleId,a.samplingId)},[a,l]),T=Wt(e=>{y(null),m(void 0,void 0,{...h,...e})},[h,m]),N=v?{message:v.message,onViewRule:d?()=>d(v.ruleId):void 0}:null;return e(Pe,{isOpen:!!a,width:Sn,header:{icon:Dt,title:S,subTitle:a?bn[a.category]:"",onClose:n},children:[a&&!u&&e(ni,{children:[t(Pr,{summary:a.summary}),t(Mr,{data:a}),t(_r,{scopes:a.rule.sourceScopes??[]}),t(jr,{data:a}),"highlyRelevant"===a.category&&t(Gr,{rule:a.rule}),t(Wr,{data:a}),t(Qr,{isEditing:!1,onDelete:x,onCancel:n,onEdit:C})]}),a&&u&&e(ni,{children:[t(Nn,{category:a.category,formState:h,onChange:T}),t(Fn,{category:a.category,formState:h,onChange:T}),t(Wn,{formState:h,onChange:T,sourceOptions:i,namespaceOptions:s}),t(ll,{category:a.category,formState:h,onChange:T}),"highlyRelevant"===a.category&&t(ul,{ruleType:h.ruleType,formState:h,onChange:T}),t(yl,{category:a.category,formState:h,onChange:T}),t(Qr,{isEditing:!0,onCancelEdit:k,onSave:w,onDelete:x,duplicateWarning:N})]})]})},ri=o.div`
|
|
478
424
|
display: flex;
|
|
479
425
|
flex-direction: column;
|
|
480
426
|
gap: 8px;
|
|
481
427
|
padding: 16px;
|
|
482
428
|
border-radius: 12px;
|
|
483
429
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
484
|
-
`,
|
|
430
|
+
`,ii=o(r)`
|
|
485
431
|
align-items: center;
|
|
486
432
|
gap: 24px;
|
|
487
|
-
`,
|
|
433
|
+
`,si=o.div`
|
|
488
434
|
flex: 1;
|
|
489
435
|
min-width: 0;
|
|
490
436
|
white-space: pre;
|
|
491
437
|
overflow-x: auto;
|
|
492
|
-
`,
|
|
438
|
+
`,ci=({title:a,summary:o,onEdit:l})=>{const r=n();return e(ri,{children:[t(s,{size:c.XXS,color:r.v2.colors.silver[200],children:a}),e(ii,{children:[t(si,{children:t(xo,{parts:o})}),t(w,{label:"Edit auto rule",rightIcon:ft,variant:T.Text,size:x.S,onClick:l})]})]})};var di,ui;!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"}(di||(di={})),function(e){e.Id="id",e.Name="name",e.Type="type",e.Status="status",e.OdigosVersion="odigosVersion",e.ConnectedSince="connectedSince",e.LastActivity="lastActivity"}(ui||(ui={}));const pi=[{key:ui.Name,label:"Name"},{key:ui.Type,label:"Type",textAlign:"right"},{key:ui.Status,label:"Status"},{key:ui.OdigosVersion,label:"Odigos Version"},{key:ui.ConnectedSince,label:"Connected Since"},{key:ui.LastActivity,label:"Last Activity"}],hi=(e,t)=>{const a=e.find(e=>e.key===ui.Id)?.rawValue;return t(a?.toString()||"")},mi=e=>{const{connections:t,configMinSupportedVersion:a,snapshotMinSupportedVersion:o,onDelete:n,onAddSource:l,onAddDestination:r,onAddAction:i,onAddInstrumentationRule:s,onEditConfiguration:c}=e;return({cells:e})=>{if(!(e=>e.find(e=>e.key===ui.Status)?.rawValue===U.Success)(e))return[{id:Be(),label:"Delete Connection",rightIcon:gt,onClick:()=>hi(e,n)}];const d=hi(e,e=>{const o=t.find(t=>t.id===e);return!!o&&Ue(o.odigosVersion,a)}),u=hi(e,e=>{const a=t.find(t=>t.id===e);return!!a&&Ue(a.odigosVersion,o)}),p=[];return l&&p.push({id:Be(),tooltip:u?pe.ADD_SOURCE:`To use this feature, please upgrade to Odigos v${o} or later.`,rightIcon:Nt,disabled:!u,onClick:()=>hi(e,l)}),r&&p.push({id:Be(),tooltip:pe.ADD_DESTINATION,rightIcon:St,onClick:()=>hi(e,r)}),i&&p.push({id:Be(),tooltip:pe.ADD_ACTION,rightIcon:bt,onClick:()=>hi(e,i)}),s&&p.push({id:Be(),tooltip:pe.ADD_INSTRUMENTATION_RULE,rightIcon:Tt,onClick:()=>hi(e,s)}),c&&p.push({id:Be(),tooltip:d?"Edit Configuration":`To use this feature, please upgrade to Odigos v${a} or later.`,rightIcon:At,disabled:!d,onClick:()=>hi(e,c)}),p}},gi=({tableRowsMaxHeight:a,connections:o,getConnections:l,onClickConnection:r,deleteConnection:i,configMinSupportedVersion:s=0,getEffectiveConfig:c,applyConfigurations:d,snapshotMinSupportedVersion:u=0,getAllClusterSnapshots:p,persistSources:h,getDestinationCategories:m,getPotentialDestinations:g,testConnection:f,createDestination:v,updateDestination:y,createAction:b,createInstrumentationRule:S})=>{const C=n(),{isVm:k}=te(),{formatTimeAgo:w}=Fe(),[N,D]=Gt(!1),[A,I]=Gt(o||[]),E=Wt(async()=>{try{D(!0),I(await l()??[])}catch(e){}finally{D(!1)}},[]);Ht(()=>{A.length||E()},[]);const[R,$]=Gt(""),[P,O]=Gt(null),[M,F]=Gt([]),L=Jt(()=>P===di.BulkConfig?s:P===di.BulkSource?u:0,[P,s,u]),{supportedConnections:z,supportedConnectionIds:X}=Jt(()=>{const e=((e,t)=>e.filter(e=>{const a=e.status===U.Success,o=Ue(e.odigosVersion,t);return a&&o}))(A,L);return{supportedConnections:e,supportedConnectionIds:e.map(e=>e.id)}},[A.length,L]);Ht(()=>{if(!P||P===di.Delete)return;const e=M.filter(e=>!X.includes(e));e.length&&F(t=>t.filter(t=>!e.includes(t)))},[P,M.length,X.length]);const V=Jt(()=>A.filter(e=>!R||e.name.toLowerCase().includes(R.toLowerCase())).map(e=>({cells:[{key:ui.Id,rawValue:e.id},{key:ui.Name,rawValue:e.name},{key:ui.Type,rawValue:e.type},{key:ui.Status,rawValue:e.status,component:()=>(e=>{const a=e===U.Success?"Connection live":"Connection lost",o=e===U.Success?wt:xt;return t(Q,{status:e,label:a,leftIcon:o})})(e.status)},{key:ui.OdigosVersion,rawValue:e.odigosVersion},{key:ui.ConnectedSince,rawValue:e.connectedAt?w(e.connectedAt):"-"},{key:ui.LastActivity,rawValue:e.lastSeenAt?w(e.lastSeenAt):"-"}],onClick:e.status!==U.Success||P?void 0:()=>r(e),isSelected:M.includes(e.id),onSelect:()=>F(t=>Array.from(new Set([...t,e.id]))),onDeselect:()=>F(t=>t.filter(t=>t!==e.id)),hideCheckbox:e.status!==U.Success||P===di.BulkConfig&&!Ue(e.odigosVersion,s)||P===di.BulkSource&&!Ue(e.odigosVersion,u)})),[A,M,R,P,s,u]),_=Jt(()=>{const e=(e,t)=>{F([e]),O(t)};return mi({connections:A,configMinSupportedVersion:s,snapshotMinSupportedVersion:u,onDelete:t=>e(t,di.Delete),onAddSource:!k&&p&&h?t=>e(t,di.BulkSource):void 0,onAddDestination:!k&&m&&g&&v?t=>e(t,di.BulkDestination):void 0,onAddAction:!k&&b?t=>e(t,di.BulkAction):void 0,onAddInstrumentationRule:!k&&S?t=>e(t,di.BulkInstrumentationRule):void 0,onEditConfiguration:!k&&c&&d?t=>e(t,di.BulkConfig):void 0})},[k,A,s,c,d,u,p,h,m,g,v,b,S]),B=Jt(()=>(e=>{const{onCancel:t,onAddSource:a,onAddDestination:o,onAddAction:n,onAddInstrumentationRule:l,onManageConfigurations:r}=e,i=[];a&&i.push({id:Be(),type:je.Button,buttonProps:{variant:T.Primary,size:x.S,label:"Add Sources",rightIcon:Nt,onClick:a}});const s=[o?{id:di.BulkDestination,label:pe.ADD_DESTINATION,icon:St}:null,n?{id:di.BulkAction,label:pe.ADD_ACTION,icon:bt}:null,l?{id:di.BulkInstrumentationRule,label:pe.ADD_INSTRUMENTATION_RULE,icon:Tt}:null,r?{id:di.BulkConfig,label:"Manage Configurations",icon:At}:null];return s.some(Boolean)&&i.push({id:Be(),type:je.ButtonDropData,buttonProps:{variant:T.Secondary,size:x.S,label:"Bulk Operations",onClick:e=>{e===di.BulkSource?a?.():e===di.BulkDestination?o?.():e===di.BulkAction?n?.():e===di.BulkInstrumentationRule?l?.():e===di.BulkConfig&&r?.()}},dropDataProps:{alignX:Ve.Left,items:s}}),i.push({id:Be(),type:je.Button,buttonProps:{variant:T.Text,size:x.S,label:He.CANCEL,onClick:t}}),i})({onCancel:()=>F([]),onAddSource:!k&&p&&h?()=>O(di.BulkSource):void 0,onAddDestination:!k&&m&&g&&v?()=>O(di.BulkDestination):void 0,onAddAction:!k&&b?()=>O(di.BulkAction):void 0,onAddInstrumentationRule:!k&&S?()=>O(di.BulkInstrumentationRule):void 0,onManageConfigurations:!k&&c&&d?()=>O(di.BulkConfig):void 0}),[k,c,d,p,h,m,g,v,b,S]);return t(Ke,{children:e(ze,{richTitle:{icon:Ft,title:pe.CONNECTIONS,badge:{label:A.length.toString(),status:ke.Unknown}},search:{placeholder:"Search by cluster name",value:R,onChange:e=>$(e),width:"300px"},actions:[{id:Be(),type:je.Button,buttonProps:{variant:T.Secondary,size:x.S,leftIcon:Mt,onClick:E,disabled:N}}],children:[t(Ge,{variant:We.Pretty,maxHeight:a,headerBackgroundColor:C.v2.colors.silver[1e3],isLoading:N,withCheckboxes:!0,columns:pi,rows:V,rowActionsPushRightPosition:P?`calc(${oa} - 24px)`:void 0,getRowActions:_}),P===di.BulkConfig&&c&&d&&t(hr,{onClose:()=>O(null),connections:z,selectedConnectionIds:M,setSelectedConnectionIds:F,getEffectiveConfig:c,onApply:d}),P===di.BulkSource&&p&&h&&t(qa,{selectedConnectionIds:M,getAllClusterSnapshots:p,children:t(Co,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,persistSources:async e=>await(h?.(e))})}),P===di.BulkDestination&&m&&g&&f&&v&&y&&t($a,{children:t(co,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,getDestinationCategories:m,getPotentialDestinations:g,testConnection:e=>f(e,M),createDestination:e=>v(e,M),updateDestination:(e,t)=>y(e,t,M)})}),P===di.BulkAction&&b&&t(Ta,{children:t(Qa,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,createAction:e=>b(e,M)})}),P===di.BulkInstrumentationRule&&S&&t(Ha,{children:t(uo,{onClose:()=>O(null),selectedConnectionIds:M,setSelectedConnectionIds:F,createInstrumentationRule:e=>S(e,M)})}),t(na,{target:"connection",isOpen:P===di.Delete,onClose:()=>{F([]),O(null)},onApprove:async()=>{const e=M[0];e&&(await i(e),await E())}}),t(qe,{isOpen:!!M.length&&!P,richTitle:{icon:ht,title:"Selected Clusters",badge:{label:M.length}},actions:B})]})})},fi=o.div`
|
|
493
439
|
display: flex;
|
|
494
440
|
align-items: center;
|
|
495
441
|
justify-content: space-between;
|
|
@@ -498,26 +444,26 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
498
444
|
width: calc(100% - 32px);
|
|
499
445
|
border-radius: 16px;
|
|
500
446
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
501
|
-
`,
|
|
447
|
+
`,vi=o.div`
|
|
502
448
|
display: flex;
|
|
503
449
|
align-items: center;
|
|
504
450
|
justify-content: center;
|
|
505
451
|
padding: 8px;
|
|
506
452
|
border-radius: 8px;
|
|
507
|
-
background-color: ${({theme:e})=>e.v2.colors.white[500]+
|
|
508
|
-
`,
|
|
453
|
+
background-color: ${({theme:e})=>e.v2.colors.white[500]+d["004"]};
|
|
454
|
+
`,yi=({setStep:a,onSave:o,sourcesPayload:l,destinationsPayload:i,disableAnimation:c})=>{const d=n(),u=()=>a(2),p=()=>a(3),h=Jt(()=>Object.values(l||{}).flatMap((a,o)=>a.map((a,n)=>{if(!a.selected)return null;const l=a.kind||se.Namespace,r=l===se.Namespace?a.namespace:`${a.namespace} → ${a.name}`;return e(fi,{children:[t(s,{nowrap:!0,children:r}),t(Q,{label:l,status:U.Info,backgroundColor:d.v2.colors.blue[900]})]},`source-${o}-${n}`)})).filter(Boolean),[l]),m=Jt(()=>i?.map((a,o)=>{const n=ve(a.option.type).icon;return e(fi,{children:[e(r,{$gap:8,children:[n&&t(vi,{children:t(n,{size:24})}),t(s,{nowrap:!0,children:a.formData.name||a.option.displayName})]}),void 0!==a.testResult&&t(Q,{status:a.testResult.succeeded?U.Success:U.Error,leftIcon:a.testResult.succeeded?wt:xt})]},`destination-${o}`)})||[],[i]);return t(aa,{isOpen:!0,disableAnimation:c,onBack:()=>a(3),onSave:o,header:{icon:Lt,title:pe.SUMMARY,subTitle:pe.REVIEW_SETUP},leftColumn:{width:"50%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(Nt,{size:24}),t(s,{nowrap:!0,children:pe.SELECTED_SOURCES}),t(Q,{label:h.length})]}),t(w,{"data-id":"summary-edit-sources",leftIcon:ft,variant:T.Secondary,size:x.S,onClick:u})]}),list:h.length?h:[t(ue,{$height:"100%",children:t(E,{icon:Nt,title:pe.NO_SOURCES_SELECTED,subTitle:pe.ADD_SOURCE_PROMPT,button:{leftIcon:ut,label:pe.ADD_SOURCE,onClick:u}})},"no-sources-data")]},rightColumn:{width:"50%",header:e(r,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(r,{$gap:8,children:[t(St,{size:24}),t(s,{nowrap:!0,children:pe.SELECTED_DESTINATIONS}),t(Q,{label:m.length})]}),t(w,{"data-id":"summary-edit-destinations",leftIcon:ft,variant:T.Secondary,size:x.S,onClick:p})]}),list:m.length?m:[t(ue,{"data-id":"summary-no-destinations",$height:"100%",children:t(E,{icon:St,title:pe.NO_DESTINATIONS_SELECTED,subTitle:pe.ADD_DESTINATION_PROMPT,button:{leftIcon:ut,label:pe.ADD_DESTINATIONS,onClick:p}})},"no-destinations-data")]}})},bi=o.div`
|
|
509
455
|
position: relative;
|
|
510
456
|
overflow: hidden;
|
|
511
457
|
width: calc(100vw - ${({$paddingXAxis:e})=>e});
|
|
512
458
|
height: calc(100vh - ${({$paddingYAxis:e})=>e});
|
|
513
459
|
box-sizing: border-box;
|
|
514
|
-
`,
|
|
460
|
+
`,Si=o.svg`
|
|
515
461
|
position: absolute;
|
|
516
462
|
top: 50%;
|
|
517
463
|
left: 50%;
|
|
518
464
|
transform: translate(-50%, -50%);
|
|
519
465
|
z-index: -1;
|
|
520
|
-
`,
|
|
466
|
+
`,Ci=[{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"}],ki=[{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:Ci},{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:Ci},{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:Ci}],wi=({paddingXAxis:a="0px",paddingYAxis:o="0px",children:n})=>{const[l,r]=Gt(window.innerWidth),i=Jt(()=>l/ki[0].width,[l]);return Ht(()=>{const e=()=>r(window.innerWidth);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),e(bi,{$paddingXAxis:a,$paddingYAxis:o,children:[ki.map(({width:a,height:o,pathOpacity:n,path:l,gradientTransform:r,stops:s},c)=>{const d=`purple-ring-${c}`;return e(Si,{width:a*i,height:"100%",viewBox:`0 0 ${a} ${o}`,fill:"none",children:[t("path",{opacity:n,d:l,fill:`url(#${d})`}),t("defs",{children:t("radialGradient",{id:d,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:r,children:s.map(({offset:e,opacity:a},o)=>t("stop",{offset:e,stopColor:"#7C3BFF",stopOpacity:a},o))})})]},d)}),n]})},xi=o.div`
|
|
521
467
|
display: flex;
|
|
522
468
|
flex-direction: column;
|
|
523
469
|
align-items: center;
|
|
@@ -528,7 +474,7 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
528
474
|
width: 50vw;
|
|
529
475
|
border-radius: 16px;
|
|
530
476
|
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
531
|
-
`,
|
|
477
|
+
`,Ti=o.div`
|
|
532
478
|
display: flex;
|
|
533
479
|
flex-direction: column;
|
|
534
480
|
align-items: center;
|
|
@@ -538,12 +484,12 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
538
484
|
& * {
|
|
539
485
|
text-align: center;
|
|
540
486
|
}
|
|
541
|
-
`,
|
|
487
|
+
`,Ni=({onStart:a})=>t(Pe,{width:"75vw",isOpen:!0,hideOverlay:!0,disableAnimation:!0,children:t(ue,{$height:"100%",children:e(xi,{children:[e(Ti,{children:[t(s,{size:c.L,weight:500,children:pe.GET_STARTED_WITH}),t(la,{size:260}),t(s,{size:c.S,weight:400,children:pe.GET_STARTED_DESCRIPTION})]}),t(w,{"data-id":"onboarding-get-started",label:He.GET_STARTED,rightIcon:zt,size:x.L,onClick:a})]})})}),Di=[{step:1,label:pe.INSTALLATION,forceDoneBadge:!0},{step:2,label:pe.SOURCES_SETUP},{step:3,label:pe.DESTINATIONS_SETUP},{step:4,label:pe.SUMMARY}],Ai=o.div`
|
|
542
488
|
display: flex;
|
|
543
489
|
flex-direction: column;
|
|
544
490
|
gap: 32px;
|
|
545
491
|
padding: 64px;
|
|
546
|
-
`,
|
|
492
|
+
`,Ii=({pagePaddingXAxis:a,pagePaddingYAxis:o,fetchNamespacesWithWorkloads:n,persistSources:l,getDestinationCategories:r,getPotentialDestinations:i,testConnection:s,createDestination:c,updateDestination:d,onDone:u})=>{const[p,h]=Gt(1),[m,g]=Gt(!1),[f,v]=Gt(null),[y,b]=Gt(null),S=()=>h(e=>e+1),C=()=>h(e=>e-1);return e(wi,{paddingXAxis:a,paddingYAxis:o,children:[e(Ai,{children:[t(la,{}),t(Ye,{currentStep:p,data:Di,gap:32})]}),t(qa,{fetchNamespacesWithWorkloads:n,initialInputs:f,children:e($a,{children:[1===p&&t(Ni,{onStart:S}),2===p&&t(Co,{disableAnimation:!0,onBack:e=>{v(e),C()},onNext:e=>{v(e),S()},persistSources:l}),3===p&&t(co,{disableAnimation:!0,onBack:e=>{b(e),C()},onNext:e=>{b(e),S()},getDestinationCategories:r,getPotentialDestinations:i,initialInputs:y,testConnection:s,createDestination:c,updateDestination:d}),4===p&&t(yi,{disableAnimation:!0,setStep:h,onSave:async()=>{if(!m){g(!0);try{const e=[];f&&e.push(l(f)),y&&e.push(...y.map(e=>c(e.formData)));const t=await Promise.allSettled(e),a=[];for(const e of t)"rejected"===e.status?a.push(e.reason?.message||String(e.reason)):e.value?.error&&a.push(e.value.error);if(a.length)return{error:a.join("\n")};u()}catch(e){return g(!1),{error:e instanceof Error?e.message:String(e)}}}},sourcesPayload:f,destinationsPayload:y})]})})]})},Ei=o.div`
|
|
547
493
|
display: flex;
|
|
548
494
|
align-items: center;
|
|
549
495
|
justify-content: space-between;
|
|
@@ -555,17 +501,17 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
555
501
|
&:hover {
|
|
556
502
|
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
557
503
|
}
|
|
558
|
-
`,
|
|
559
|
-
animation-name: ${
|
|
560
|
-
|
|
504
|
+
`,Ri=o.div`
|
|
505
|
+
animation-name: ${et.in};
|
|
506
|
+
`,$i=({pod:o,getExtendedPodInfo:n,onClose:r})=>{const{formatTimeAgo:i}=Fe(),[c,d]=Gt(null),[u,p]=Gt(!1);Ht(()=>{o?n(o.namespace,o.name).then(e=>d(e??null)):(d(null),p(!1))},[o]);const h=Jt(()=>[{id:Be(),title:"Node",label:c?.node??"-",withCopy:!0},{id:Be(),title:"Status",badge:{status:Je(c?.status),label:c?.status??"-"}}],[c]),m=Jt(()=>c?.containers?.map(e=>({id:Be(),items:[{id:Be(),title:"Container",label:e.name??"-"},{id:Be(),title:"Status",label:e.startedAt?`${e.status} (since ${i(e.startedAt)})`:e.status},{id:Be(),title:"Ready",badge:{status:e.ready?U.Success:U.Error,leftIcon:e.ready?ht:mt,label:e.ready?"True":"False",invertColors:!0}},{id:Be(),title:"Started",badge:{status:e.started?U.Success:U.Error,leftIcon:e.started?ht:mt,label:e.started?"True":"False",invertColors:!0}},{id:Be(),title:"Image Version",label:e.image?.split(":")?.[1]??"-"},{id:Be(),title:"Image Repository",label:e.image?.split(":")?.[0]??"-"},{id:Be(),title:"Restarts",label:e.restarts.toString()},{id:Be(),title:"State Reason",label:e.stateReason??"-"},{id:Be(),title:"Resource Requests",label:`CPU ${e.resources.requests.cpu} • Memory ${e.resources.requests.memory}`},{id:Be(),title:"Resource Limits",label:`CPU ${e.resources.limits.cpu} • Memory ${e.resources.limits.memory}`}]}))||[],[c]);return e(Pe,{isOpen:!!o,header:{icon:Xt,title:"Pod Information",onClose:r},children:[c?null:t(ue,{children:t(Qe,{})}),c?e(a,{children:[t(ze,{richTitle:{icon:Xt,title:c.name,withCopy:!0},children:e(l,{$gap:24,children:[t(_e,{cellsPerRow:2,items:h}),m.length>0&&e(l,{$gap:12,children:[e(Ei,{onClick:()=>p(e=>!e),children:[t(s,{children:"Containers Overview"}),t(he,{icon:u?Ct:kt})]}),u&&m.map(({id:e,items:a})=>t(Ri,{children:t(_e,{cellsPerRow:2,items:a})},e))]})]})}),t(ze,{richTitle:{icon:Ot,title:"Kubectl Commands"},children:e(l,{$gap:12,children:[t(Ze,{value:`kubectl get pod ${c.name} -n ${c.namespace} -o yaml`}),t(Ze,{value:`kubectl describe pod ${c.name} -n ${c.namespace}`}),t(Ze,{value:`kubectl logs ${c.name} -n ${c.namespace}`})]})}),t(ia,{yaml:c.manifestYAML,defaultOpen:!0})]}):null]})};var Pi;!function(e){e.PodName="podName",e.Status="status",e.Restarts="restarts",e.NodeName="nodeName",e.SpanDropDrate="spanDropDrate",e.Age="age",e.DockerImage="dockerImage"}(Pi||(Pi={}));const Oi=[{key:Pi.PodName,label:"Pod Name"},{key:Pi.Status,label:"Status"},{key:Pi.Restarts,label:"Restarts",textAlign:"right"},{key:Pi.NodeName,label:"Node Name"},{key:Pi.Age,label:"Age",textAlign:"right"},{key:Pi.DockerImage,label:"Docker Image",textAlign:"right"}],Mi=({isLoading:a,tableRowsMaxHeight:o,pods:l,getExtendedPodInfo:i})=>{const c=n(),{formatTimeAgo:d}=Fe(),[u,p]=Gt(null),h=Jt(()=>l.map(a=>({onClick:()=>p(a),cells:[{key:Pi.PodName,rawValue:a.name},{key:Pi.Status,rawValue:a.status,component:()=>{return e=a.status,t(Q,{status:Je(e),label:e});var e}},{key:Pi.Restarts,rawValue:a.restartsCount.toString()},{key:Pi.NodeName,rawValue:a.nodeName},{key:Pi.SpanDropDrate,rawValue:0,component:()=>{const{collectorMetrics:o}=a;if(!o)return t(s,{children:"-"});const n=(o?.metricsAcceptedRps??0)+(o?.metricsDroppedRps??0),l=n>0?Math.round((o?.metricsDroppedRps??0)/n*100):0,i=l>0?U.Error:U.Success,c=(o?.exporterSuccessRps??0)+(o?.exporterFailedRps??0),d=c>0?Math.round((o?.exporterFailedRps??0)/c*100):0,u=d>0?U.Error:U.Success;return e(r,{$gap:4,children:[t(H,{text:`Accepted: ${o.metricsAcceptedRps.toLocaleString()}, Dropped: ${o.metricsDroppedRps.toLocaleString()}`,children:t(Q,{status:i,label:`Receiver ${l}%`,leftIcon:i===U.Error?Vt:_t,useSecondaryTone:!0,invertColors:!0})}),t(H,{text:`Success: ${o.exporterSuccessRps.toLocaleString()}, Failed: ${o.exporterFailedRps.toLocaleString()}`,children:t(Q,{status:u,label:`Exporter ${d}%`,leftIcon:u===U.Error?Vt:_t,useSecondaryTone:!0,invertColors:!0})})]})}},{key:Pi.Age,rawValue:d(a.creationTimestamp)},{key:Pi.DockerImage,rawValue:a.image}]})),[l,c]);return e(ze,{richTitle:{icon:Xt,title:"Pods"},children:[t(Ge,{variant:We.Data,maxHeight:o,isLoading:a,columns:Oi,rows:h}),t($i,{pod:u,getExtendedPodInfo:i,onClose:()=>p(null)})]})};var Fi;!function(e){e.Gateway="gateway",e.Node="node"}(Fi||(Fi={}));const Li=[{value:Fi.Gateway,label:"Gateway"},{value:Fi.Node,label:"Node Collector"}],zi=o.div`
|
|
561
507
|
display: flex;
|
|
562
508
|
align-items: center;
|
|
563
509
|
justify-content: space-between;
|
|
564
|
-
`,
|
|
510
|
+
`,Xi=({selectedTab:a,setSelectedTab:o,onClickDownloadDiagnose:n,onClickRefresh:l,loading:i,disabled:s})=>{const c=Jt(()=>{const e=[];return n&&e.push({id:Be(),type:je.Button,buttonProps:{label:"Download Diagnose",leftIcon:Pt,size:x.S,variant:T.Text,onClick:n,disabled:s}}),l&&e.push({id:Be(),type:je.Button,buttonProps:{label:"Refresh",leftIcon:Mt,size:x.S,variant:T.Text,onClick:l,disabled:s,loading:i}}),e},[n,l,s,i]);return e(zi,{children:[e(r,{$gap:12,$alignItems:"center",children:[t(tt,{icon:Bt,title:"Pipeline Collectors"}),t($,{options:Li,selected:a,setSelected:o,disabled:s})]}),t(at,{actions:c})]})},Vi=({isOpen:e,onClose:a,title:o,yaml:n})=>t(Pe,{isOpen:e,header:{icon:Ut,title:o,onClose:a},children:t(ia,{yaml:n,defaultOpen:!0})});var _i;!function(e){e.ManifestYaml="manifest-yaml",e.ConfigMapYaml="configmap-yaml"}(_i||(_i={}));const Bi=({richTitle:a,statusCard:o,textCards:n,manifestYaml:l,configMapYaml:i})=>{const[s,c]=Gt(null);return e(ze,{richTitle:a,actions:[{id:Be(),type:je.ButtonDropData,buttonProps:{variant:T.Secondary,size:x.S,label:"View YAML",onClick:e=>c(e)},dropDataProps:{items:[{id:_i.ManifestYaml,label:a.title,icon:jt},{id:_i.ConfigMapYaml,label:"ConfigMap",icon:jt}]}}],children:[e(r,{$gap:16,children:[t(ot,{...o}),n.map(e=>t(nt,{...e},e.title))]}),t(Vi,{isOpen:s===_i.ManifestYaml,onClose:()=>c(null),title:a.title,yaml:l}),t(Vi,{isOpen:s===_i.ConfigMapYaml,onClose:()=>c(null),title:"ConfigMap",yaml:i})]})},Ui=e=>{switch(e){case lt.Healthy:return"All desired replicas are updated, available, and ready";case lt.Updating:return"Workload is progressing towards desired state (e.g., updating pods)";case lt.Degraded:return"Progressing but with availability issues (e.g., not enough available replicas)";case lt.Failed:return"Progress deadline exceeded or an unrecoverable error occurred";case lt.Down:return"No available replicas";case lt.Unknown:return"Status cannot be determined from current signals";default:return"Status unknown"}},ji=({minSupportedVersion:a=0,tableRowsMaxHeight:o,getGatewayInfo:n,getGatewayPods:l,getNodeCollectorInfo:r,getNodeCollectorPods:i,getExtendedPodInfo:s})=>{const{formatTimeAgo:c}=Fe(),{isVersionSupported:d,version:u}=te(a),[p,h]=Gt(!1),[m,g]=Gt(Fi.Gateway),[f,v]=Gt(null),[y,b]=Gt([]),[S,C]=Gt(null),[k,w]=Gt([]),x=Wt(async()=>{h(!0);try{switch(m){case Fi.Gateway:v(await n()??null),b(await l()??[]);break;case Fi.Node:C(await r()??null),w(await i()??[])}}catch(e){}h(!1)},[m]);Ht(()=>{x()},[x]);const T=Jt(()=>(e=>{switch(e){case Fi.Gateway:return"Deployment";case Fi.Node:return"DaemonSet";default:return"Pipeline Collectors"}})(m),[m]),N=Jt(()=>((e,t,a,o)=>{const n={status:ke.Disabled,label:"No rollouts yet"};let l=!1,r=null;switch(e){case Fi.Gateway:l=t?.rolloutInProgress??!1,r=t?.lastRolloutAt??null;break;case Fi.Node:l=a?.rolloutInProgress??!1,r=a?.lastRolloutAt??null;break;default:return n}return l?{status:U.Info,label:"Rollout in progress",rightIcon:Mt,useSecondaryTone:!0}:r?{status:ke.Disabled,label:`Last Rollout: ${o(r)}`}:n})(m,f,S,c),[f,S,m,c]),D=Jt(()=>((e,t,a,o)=>{let n=o?U.Info:ke.Unknown,l=o?"Loading":lt.Unknown,r=o?"Fetching data...":Ui(lt.Unknown);switch(e){case Fi.Gateway:n=t?.status?Je(t?.status):n,l=t?.status??l,r=t?.status?Ui(t.status):r;break;case Fi.Node:n=a?.status?Je(a?.status):n,l=a?.status??l,r=a?.status?Ui(a.status):r}return{status:n,title:l,description:r}})(m,f,S,p),[f,S,m,p]),A=Jt(()=>((e,t,a,o)=>{switch(e){case Fi.Gateway:return[{title:"HPA Spec (Replicas)",cells:[{label:"Min.",value:t?.hpa?.min.toString()??"-",isLoading:o},{label:"Max.",value:t?.hpa?.max.toString()??"-",isLoading:o},{label:"Current",value:t?.hpa?.current.toString()??"-",isLoading:o},{label:"Desired",value:t?.hpa?.desired.toString()??"-",isLoading:o}]},{title:"Requests",cells:[{label:"CPU",value:t?.resources?.requests.cpu??"-",isLoading:o},{label:"Memory",value:t?.resources?.requests.memory??"-",isLoading:o}]},{title:"Limits",cells:[{label:"CPU",value:t?.resources?.limits.cpu??"-",isLoading:o},{label:"Memory",value:t?.resources?.limits.memory??"-",isLoading:o}]},{title:"Docker Image",cells:[{value:t?.imageVersion??"-",isLoading:o}]}];case Fi.Node:return[{title:"Nodes",cells:[{label:"Desired",value:a?.nodes?.desired.toString()??"-",isLoading:o},{label:"Ready",value:a?.nodes?.ready.toString()??"-",isLoading:o}]},{title:"Requests",cells:[{label:"CPU",value:a?.resources?.requests.cpu??"-",isLoading:o},{label:"Memory",value:a?.resources?.requests.memory??"-",isLoading:o}]},{title:"Limits",cells:[{label:"CPU",value:a?.resources?.limits.cpu??"-",isLoading:o},{label:"Memory",value:a?.resources?.limits.memory??"-",isLoading:o}]},{title:"Docker Image",cells:[{value:a?.imageVersion??"-",isLoading:o}]}];default:return[]}})(m,f,S,p),[f,S,m,p]),I=Jt(()=>(m===Fi.Gateway?f?.manifestYAML:S?.manifestYAML)??"",[f,S,m]),E=Jt(()=>(m===Fi.Gateway?f?.configMapYAML:S?.configMapYAML)??"",[f,S,m]),R=Jt(()=>m===Fi.Gateway?y:k,[y,k,m]);return e(Ke,{children:[t(Xi,{disabled:!d,loading:p,selectedTab:m,setSelectedTab:g,onClickDownloadDiagnose:void 0,onClickRefresh:x}),e(rt,{children:[t(Bi,{richTitle:{icon:Ut,title:T,badge:N},statusCard:D,textCards:A,manifestYaml:I,configMapYaml:E}),t(Mi,{isLoading:p,tableRowsMaxHeight:o,pods:R,getExtendedPodInfo:s}),!d&&t(ra,{minSupportedVersion:a,currentVersion:u||""})]})]})},Hi=o(r)`
|
|
565
511
|
align-items: center;
|
|
566
512
|
gap: 12px;
|
|
567
513
|
padding: 12px 16px;
|
|
568
|
-
`,
|
|
514
|
+
`,Ki=[{value:"all",label:"All"},{value:"Relevance",label:"Relevance"},{value:"Duration",label:"Duration"},{value:"Error",label:"Error"}],Gi=({title:a,titleTooltip:o,itemCount:l,searchValue:i,onSearchChange:d,typeFilter:u,onTypeFilterChange:p,showTypeFilter:h})=>{const m=n();return e(Hi,{children:[e(r,{$gap:8,$alignItems:"center",children:[t(s,{size:c.XS,weight:500,nowrap:!0,children:a}),o&&t(H,{text:o,withIcon:!0}),t(Q,{label:l,backgroundColor:m.v2.colors.grey[600],textColor:m.v2.colors.white[500]})]}),t(it,{value:i,onChange:d,placeholder:"Search...",width:"360px"}),h&&t($,{size:be.S,options:Ki,selected:u,setSelected:p})]})},Wi=o.div`
|
|
569
515
|
position: relative;
|
|
570
516
|
display: flex;
|
|
571
517
|
align-items: center;
|
|
@@ -575,16 +521,16 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
575
521
|
background-color: ${({theme:e,$isHovered:t})=>t?e.v2.colors.silver[700]:e.v2.colors.silver[900]};
|
|
576
522
|
cursor: pointer;
|
|
577
523
|
transition: background-color 0.15s;
|
|
578
|
-
`,
|
|
524
|
+
`,qi=o.div`
|
|
579
525
|
display: flex;
|
|
580
526
|
flex-direction: column;
|
|
581
527
|
gap: 4px;
|
|
582
528
|
min-width: 0;
|
|
583
529
|
flex: 1;
|
|
584
|
-
`,
|
|
530
|
+
`,Yi=o(s)`
|
|
585
531
|
overflow: hidden;
|
|
586
532
|
text-overflow: ellipsis;
|
|
587
|
-
`,
|
|
533
|
+
`,Ji=o.div`
|
|
588
534
|
min-width: 0;
|
|
589
535
|
display: inline-flex;
|
|
590
536
|
align-items: center;
|
|
@@ -595,26 +541,26 @@ import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import o,{useThe
|
|
|
595
541
|
overflow: hidden;
|
|
596
542
|
white-space: pre;
|
|
597
543
|
text-overflow: ellipsis;
|
|
598
|
-
`,
|
|
544
|
+
`,Qi=o(r)`
|
|
599
545
|
flex-shrink: 0;
|
|
600
546
|
margin-left: auto;
|
|
601
547
|
gap: 6px;
|
|
602
548
|
align-items: center;
|
|
603
549
|
min-height: 22px;
|
|
604
|
-
`;const
|
|
550
|
+
`;const Zi=({item:a,isHovered:o,onClick:l,onEdit:r,onDelete:i,onMouseEnter:s,onMouseLeave:d})=>{const u=n(),p=Wt(()=>{r(a.ruleId,a.samplingId)},[a.ruleId,a.samplingId,r]),h=Wt(()=>{i(a.ruleId,a.samplingId)},[a.ruleId,a.samplingId,i]),m=Jt(()=>{const e=e=>t(gt,{...e,fill:u.v2.colors.red[500]});return e.displayName="RedDeleteIcon",e},[u]),g=[{id:"edit",label:en,leftIcon:ft,onClick:p},{id:"delete",label:"",leftIcon:m,onClick:h}],f=a.typeBadge?function(e,t){const a=e.v2.colors;switch(t){case"Relevance":return{bg:a.blue[800],text:a.white[500]};case"Duration":return{bg:a.purple[600],text:a.white[500]};case"Error":return{bg:a.red[500],text:a.black[500]}}}(u,a.typeBadge):void 0;return e(Wi,{$isHovered:o,onClick:()=>l(a),onMouseEnter:s,onMouseLeave:d,children:[e(qi,{children:[t(Ji,{$disabled:a.disabled,$isHovered:o,children:t(xo,{parts:a.summary})}),a.name&&t(Yi,{size:c.XXXS,color:u.v2.colors.grey[400],nowrap:!0,children:a.name})]}),e(Qi,{children:[a.disabled&&t(Q,{label:"Disabled rule",textSize:c.XXXS,backgroundColor:u.v2.colors.grey[700],textColor:u.v2.colors.grey[300]}),a.typeBadge&&f&&t(Q,{label:a.typeBadge,textSize:c.XXXS,backgroundColor:f.bg,textColor:f.text})]}),t(st,{isOpen:o,actions:g})]})},es=o(l)`
|
|
605
551
|
flex: 1;
|
|
606
552
|
min-height: 0;
|
|
607
553
|
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
608
554
|
border-radius: 16px;
|
|
609
|
-
`,
|
|
555
|
+
`,ts=o(l)`
|
|
610
556
|
flex: 1;
|
|
611
557
|
min-height: 0;
|
|
612
558
|
padding: 0 16px 16px;
|
|
613
559
|
gap: 4px;
|
|
614
560
|
overflow-y: auto;
|
|
615
|
-
`,
|
|
561
|
+
`,as=o.div`
|
|
616
562
|
display: flex;
|
|
617
563
|
align-items: center;
|
|
618
564
|
justify-content: center;
|
|
619
565
|
padding: 48px 16px;
|
|
620
|
-
`;const
|
|
566
|
+
`;const os=({title:a,titleTooltip:o,items:n,isLoading:l,showTypeFilter:r=!1,onRuleClick:i,onEditRule:s,onDeleteRule:c})=>{const[d,u]=Gt(""),[p,h]=Gt(null),[m,g]=Gt("all"),f=d.trim()||r&&"all"!==m,v=Jt(()=>{let e=function(e,t,a){return a&&"all"!==t?e.filter(e=>e.typeBadge===t):e}(n,m,r);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),o=e.summary.map(e=>e.text).join("").toLowerCase();return t||o.includes(a)})}(e,d),e},[n,m,r,d]),y=Wt(e=>{h(e)},[]),b=Wt(()=>{h(null)},[]);return e(es,{children:[t(Gi,{title:a,titleTooltip:o,itemCount:n.length,searchValue:d,onSearchChange:u,typeFilter:m,onTypeFilterChange:g,showTypeFilter:r}),l?t(as,{children:t(ge,{title:"Loading rules...",withSpinner:!0})}):0===v.length?t(as,{children:t(E,{title:f?"No matching rules":"No rules yet",subTitle:f?"Try adjusting your filters or search":"Create a rule to get started"})}):t(ts,{children:v.map((e,a)=>t(Zi,{item:e,isHovered:p===a,onClick:i,onEdit:s,onDelete:c,onMouseEnter:()=>y(a),onMouseLeave:b},e.ruleId))})]})},ns=e=>"general"===e.name?0:"advanced"===e.name?2:1,ls=e=>{const t=[N.Toggle,N.Checkbox].includes(e.componentType);return e.isHelmOnly?t?2:3:t?0:1},rs=({minSupportedVersion:a=0,pageHeightOffset:o=0,configYamls:n,configYamlsLoading:i,effectiveConfig:s,effectiveConfigLoading:c,onSave:d,saveLoading:u})=>{const{isVersionSupported:p,version:h}=te(a),m=Jt(()=>{if(!s)return{};const{manifestYAML:e,provenance:t,...a}=s;return a},[s]),{formData:g,handleFormChange:f,getNestedValue:v,getFormDiff:y,isFormDirty:b}=A(m);Ht(()=>{"{}"!==JSON.stringify(m)&&"{}"===JSON.stringify(g)&&f(void 0,void 0,m)},[m,g]);const S=Jt(()=>[...n].sort((e,t)=>ns(e)-ns(t)).map(e=>({...e,fields:[...e.fields].sort((e,t)=>ls(e)-ls(t))})),[n]),C=Jt(()=>(e=>{if(!e)return{};const t={};for(const a of e)t[a.helmPath]=a.reconciledFrom;return t})(s?.provenance),[s?.provenance]),k=Jt(()=>[{id:Be(),type:je.Button,buttonProps:{"data-id":"settings-save",variant:T.Primary,size:x.S,label:"Save Changes",leftIcon:wt,loading:u,onClick:()=>d?.(y(m,g))?.then(()=>f(void 0,void 0,{}))}},{id:Be(),type:je.Button,buttonProps:{"data-id":"settings-cancel",variant:T.Secondary,size:x.S,label:"Cancel",leftIcon:xt,onClick:()=>f(void 0,void 0,m)}}],[u,d,y,m,g,f]);return t(Ke,{$heightOffset:o,children:e(rt,{children:[!p&&t(ra,{minSupportedVersion:a,currentVersion:h||""}),t(qe,{isOpen:b,richTitle:{icon:At,title:"Config Settings"},actions:k}),e(r,{$gap:24,$alignItems:"flex-start",children:[t(l,{$gap:24,$width:"100%",children:n.length?S.map(e=>t(ze,{richTitle:{icon:At,title:e.displayName},children:e.fields.map(e=>{const a=V(e.componentProps||"{}",{}),o=C[e.helmValuePath]||"N/A";return t(ta,{componentType:e.componentType,inputType:a.type,name:e.helmValuePath,label:e.displayName,tooltip:e.description,badge:{status:ke.Unknown,label:o,tooltip:`This field is reconciled from the following resource: ${o}`},disabled:e.isHelmOnly||u,value:v("formData",e.helmValuePath),setValue:t=>f(e.helmValuePath,t),warnMessage:e.isHelmOnly?"This field can only be updated via Helm values.yaml file":"",dropdownOptions:a.options?.map(e=>({id:e,value:e}))},e.helmValuePath)})},e.name)):i?t(ue,{$height:"30vh",children:t(ge,{withSpinner:!0})}):t(ze,{richTitle:{icon:At,title:"Config Settings"},children:t(E,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})}),c&&!s?.manifestYAML?t(ue,{$height:"30vh",children:t(ge,{withSpinner:!0})}):t(ia,{title:"Effective Config YAML",yaml:s?.manifestYAML?.replaceAll(" |",""),defaultOpen:!0,fullHeight:!0})]})]})})};export{Qa as AddActionDrawer,Da as AddActionForm,Ta as AddActionFormContextProvider,co as AddDestinationDrawer,Ma as AddDestinationForm,$a as AddDestinationFormContextProvider,uo as AddRuleDrawer,Ga as AddRuleForm,Ha as AddRuleFormContextProvider,Co as AddSourceDrawer,qa as AddSourceFormContextProvider,ci as AutoRuleCard,Io as CATEGORY_TO_RULE_CATEGORY,gi as CentralConnections,Rl as CreateSamplingRuleDrawer,ql as EditAutoRuleDrawer,hr as EditConfigDrawer,pr as EditCostReductionAutoRuleDrawer,tr as EditHighlyRelevantAutoRuleDrawer,Ii as Onboarding,ji as PipelineCollectors,Ao as SAMPLING_CATEGORY_LIST_TITLES,Do as SAMPLING_CATEGORY_NOTES,No as SAMPLING_SEGMENT_OPTIONS,To as SamplingCategory,os as SamplingRulesList,rs as Settings,kr as SystemDrawer,li as ViewSamplingRuleDrawer,$l as buildAutoRuleSummary,zl as buildCostReductionAutoRuleSummary,Mo as buildCostReductionSummary,Ml as buildHighlyRelevantAutoRuleSummary,Oo as buildHighlyRelevantSummary,Po as buildNoisySummary,Lo as buildSamplingRuleItems,zo as buildSummaryForRule,Ll as findCostReductionAutoRule,Ko as findDuplicateRuleId,Ol as findHighlyRelevantAutoRule,Dl as formStateToCostReductionInput,Nl as formStateToHighlyRelevantInput,Tl as formStateToNoisyInput,bl as getDefaultFormState,Fo as getHighlyRelevantTypeBadge,_o as lookupViewRuleData,Vo as refreshViewRuleData,Na as useAddActionFormContext,Pa as useAddDestinationFormContext,Ka as useAddRuleFormContext,Ya as useAddSourceFormContext,oi as viewRuleDataToFormState};
|