@odigos/ui-kit 0.0.295 → 0.0.296
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/lib/chunks/{helpers-CVRjhvw4.js → helpers-BV_MHw06.js} +1 -1
- package/lib/chunks/index-vZsC8Ggg.js +353 -0
- package/lib/chunks/{source-instrument-form-context-CgGshOFa.js → source-instrument-form-context-CWv4NCRf.js} +1 -1
- package/lib/chunks/{ui-components-DwtaxXwl.js → ui-components-BlmdA--F.js} +14 -19
- package/lib/components/field-title/index.d.ts +1 -1
- package/lib/components/input/index.d.ts +3 -1
- package/lib/components/table/types.d.ts +1 -0
- package/lib/components/trace-view/types.d.ts +2 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/insights/findings/drawer/anomaly/anomaly-trace-compare/helpers.d.ts +2 -2
- package/lib/containers.js +200 -200
- package/lib/contexts/odigos-api/types.d.ts +1 -0
- package/lib/contexts.js +1 -1
- package/lib/functions/parse-raw-otlp/index.d.ts +2 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/icons.js +1 -1
- package/lib/snippets/blast-radius/helpers.d.ts +5 -5
- package/lib/snippets/blast-radius/types.d.ts +0 -4
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-B13xWqwt.js +0 -342
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.296](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.295...ui-kit-v0.0.296) (2026-09-07)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* bump @humanfs/node from 0.16.7 to 0.16.8 ([#1283](https://github.com/odigos-io/ui-kit/issues/1283)) ([30818ed](https://github.com/odigos-io/ui-kit/commit/30818ed581066f55a7f81dd46b24fe215253964d))
|
|
9
|
+
* bump browserslist from 4.28.1 to 4.28.8 ([#1282](https://github.com/odigos-io/ui-kit/issues/1282)) ([10ae8b7](https://github.com/odigos-io/ui-kit/commit/10ae8b72acbd054d29acb4fb4f53737e7205c965))
|
|
10
|
+
* **insights:** add time selector to transactions window ([#1281](https://github.com/odigos-io/ui-kit/issues/1281)) ([7b9426e](https://github.com/odigos-io/ui-kit/commit/7b9426e3709a5fea16eafc48c9c626155b544013))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* feedback on insights ([#1291](https://github.com/odigos-io/ui-kit/issues/1291)) ([3f869cd](https://github.com/odigos-io/ui-kit/commit/3f869cdeef7f89ba8e077274499f4fc45552572b))
|
|
16
|
+
|
|
3
17
|
## [0.0.295](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.294...ui-kit-v0.0.295) (2026-09-03)
|
|
4
18
|
|
|
5
19
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import{T as i,t as u,b as l,P as c}from"./ui-components-
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{Fragment as n,useMemo as o,useContext as a,createContext as s}from"react";import{T as i,t as u,b as l,P as c}from"./ui-components-BlmdA--F.js";import p from"styled-components";var d;(e=>{e.Default="default",e.Action="action",e.Endpoint="endpoint",e.Scope="scope",e.Duration="duration"})(d||(d={}));const f=[d.Action,d.Endpoint,d.Scope,d.Duration],h=p.span`
|
|
2
2
|
font-family: ${({theme:e,$isMono:t})=>t?e.font_family.secondary:e.font_family.primary};
|
|
3
3
|
font-size: ${({theme:e})=>e.v2.text.size.xxs}px;
|
|
4
4
|
line-height: 20px;
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import r,{css as l,useTheme as n}from"styled-components";import i from"elkjs/lib/elk.bundled.js";import o,{useMemo as s,useRef as d,useCallback as c,useState as p,memo as u,useEffect as h,Fragment as g,forwardRef as m,useImperativeHandle as v}from"react";import{Handle as f,Position as b,useReactFlow as y,ReactFlowProvider as x,ReactFlow as $,Background as k,getSmoothStepPath as C,BaseEdge as S,EdgeLabelRenderer as w,MarkerType as T}from"@xyflow/react";import{D as M,c as L,F as P,d as A,e as O,f as E,g as N,h as I,B as R,i as V,j as X,k as z,C as D,N as _,l as H,W as B,m as j,n as q,V as U,o as F,p as G,q as W,r as K,s as Y,u as Z,v as J,w as Q,I as ee,x as te,y as ae,z as re,E as le,G as ne,H as ie,J as oe,S as se,K as de,L as ce,U as pe,M as ue,O as he,Q as ge,X as me,Y as ve,Z as fe,_ as be,$ as ye,a0 as xe,a1 as $e,a2 as ke,a3 as Ce,a4 as Se,a5 as we,a6 as Te,a7 as Me,T as Le,a8 as Pe,a9 as Ae,aa as Oe,ab as Ee,ac as Ne,ad as Ie,ae as Re,af as Ve,ag as Xe,ah as ze,ai as De,aj as _e,ak as He,b as Be,al as je,am as qe,an as Ue,ao as Fe,ap as Ge,aq as We,ar as Ke,as as Ye,at as Ze,au as Je,av as Qe,aw as et,ax as tt,ay as at,az as rt,aA as lt,aB as nt,aC as it,aD as ot,aE as st,aF as dt,aG as ct,aH as pt,aI as ut,aJ as ht,aK as gt,aL as mt,aM as vt,aN as ft,aO as bt,aP as yt,aQ as xt,aR as $t,aS as kt,aT as Ct,aU as St,aV as wt,aW as Tt,aX as Mt,aY as Lt,aZ as Pt,a_ as At,a$ as Ot,b0 as Et,b1 as Nt,b2 as It,b3 as Rt,R as Vt,b4 as Xt,b5 as zt,A as Dt,b6 as _t,b7 as Ht}from"./ui-components-BlmdA--F.js";import{UserIcon as Bt,DestinationIcon as jt,HomeIcon as qt,VIcon as Ut,TrashIcon as Ft,PlusIcon as Gt,VSquareIcon as Wt,XSquareIcon as Kt,EditIcon as Yt,OdigosLogoTextCentral as Zt,OdigosLogoTextEnterprise as Jt,OdigosLogoTextCommunity as Qt,OdigosLogoTextColoredCentral as ea,OdigosLogoTextColoredEnterprise as ta,OdigosLogoTextColoredCommunity as aa,ArrowLeftIcon as ra,ArrowRightIcon as la,CopyIcon as na,YamlIcon as ia}from"../icons.js";import"@xyflow/react/dist/style.css";import{i as oa,m as sa,u as da,n as ca,a as pa,C as ua,b as ha,d as ga,e as ma,f as va,g as fa,h as ba,j as ya,k as xa}from"./helpers-BV_MHw06.js";const $a=/^[a-zA-Z]$/,ka=new Set(["*","+","?"]),Ca=new Set(["^","$"]),Sa={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},wa=r.div`
|
|
2
|
+
padding: 8px 16px;
|
|
3
|
+
border-radius: 6px;
|
|
4
|
+
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
5
|
+
background: ${({theme:e})=>e.v2.colors.black[500]};
|
|
6
|
+
font-family: ${({theme:e})=>e.font_family.code};
|
|
7
|
+
font-size: 12px;
|
|
8
|
+
line-height: 20px;
|
|
9
|
+
color: ${({theme:e})=>e.v2.colors.white[500]};
|
|
10
|
+
word-break: break-all;
|
|
11
|
+
white-space: pre-wrap;
|
|
12
|
+
user-select: text;
|
|
13
|
+
|
|
14
|
+
/* Wraps the background tightly to each visual fragment when a colored
|
|
15
|
+
token gets split across two visual lines. Without this the highlight
|
|
16
|
+
stretches all the way to the right edge of the container. */
|
|
17
|
+
& > span {
|
|
18
|
+
box-decoration-break: clone;
|
|
19
|
+
-webkit-box-decoration-break: clone;
|
|
20
|
+
}
|
|
21
|
+
`,Ta=r.span`
|
|
22
|
+
background: ${({$kind:e})=>Sa[e]};
|
|
23
|
+
`,Ma=({pattern:t,"data-id":a})=>{const r=s(()=>(e=>{const t=[];let a=0,r=!1;const l=(e,a)=>{const r=t[t.length-1];r&&r.kind===a?r.text+=e:t.push({text:e,kind:a})};for(;a<e.length;){const t=e[a];if(r){if("]"===t){l("]","class-bracket"),r=!1,a++;continue}if("\\"===t&&a+1<e.length){l(e.slice(a,a+2),"class-content"),a+=2;continue}l(t,"class-content"),a++}else{if("("===t&&"?"===e[a+1]){let t=2;const r=e[a+2];if(":"===r||"="===r||"!"===r)t=3;else if("<"===r){const r=e[a+3];if("="===r||"!"===r)t=4;else{const r=e.indexOf(">",a+2);-1!==r&&(t=r-a+1)}}l(e.slice(a,a+t),"group"),a+=t;continue}if("("!==t&&")"!==t)if("["!==t)if(ka.has(t)||Ca.has(t))l(t,"anchor-quantifier"),a++;else{if("{"===t){const t=e.indexOf("}",a);if(t>a&&/^\{\d+,?\d*\}$/.test(e.slice(a,t+1))){l(e.slice(a,t+1),"anchor-quantifier"),a=t+1;continue}}if("\\"===t&&a+1<e.length){const t=e[a+1];$a.test(t)?l(e.slice(a,a+2),"anchor-quantifier"):l(e.slice(a,a+2),"literal"),a+=2;continue}"|"!==t?(l(t,"literal"),a++):(l("|","alternation"),a++)}else"^"===e[a+1]?(l("[^","class-bracket"),a+=2):(l("[","class-bracket"),a++),r=!0;else l(t,"group"),a++}}return t})(t),[t]);return e(wa,t?{"data-id":a,children:r.map((t,a)=>e(Ta,{$kind:t.kind,children:t.text},a))}:{"data-id":a,children:" "})},La="rgba(102, 191, 255, 0.5)",Pa=l`
|
|
24
|
+
font-family: ${({theme:e})=>e.font_family.code};
|
|
25
|
+
font-size: 12px;
|
|
26
|
+
line-height: 20px;
|
|
27
|
+
letter-spacing: 0;
|
|
28
|
+
white-space: pre-wrap;
|
|
29
|
+
word-wrap: break-word;
|
|
30
|
+
overflow-wrap: break-word;
|
|
31
|
+
/* tab-size keeps tabs visually consistent across the two layers — some
|
|
32
|
+
browsers default to 8 on a textarea but 4 on a div. */
|
|
33
|
+
-moz-tab-size: 4;
|
|
34
|
+
tab-size: 4;
|
|
35
|
+
margin: 0;
|
|
36
|
+
`,Aa=r.div`
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 100%;
|
|
39
|
+
min-height: ${({$minHeight:e})=>e}px;
|
|
40
|
+
border-radius: 6px;
|
|
41
|
+
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
42
|
+
background: ${({theme:e})=>e.v2.colors.black[500]};
|
|
43
|
+
|
|
44
|
+
&:hover,
|
|
45
|
+
&:focus-within {
|
|
46
|
+
border-color: ${({theme:e})=>e.v2.colors.silver[300]};
|
|
47
|
+
}
|
|
48
|
+
`,Oa=r.div`
|
|
49
|
+
${Pa}
|
|
50
|
+
position: absolute;
|
|
51
|
+
inset: 0;
|
|
52
|
+
padding: 12px;
|
|
53
|
+
pointer-events: none;
|
|
54
|
+
color: transparent;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
|
|
57
|
+
/* Mandatory for backgrounds that wrap across visual lines. */
|
|
58
|
+
& > span {
|
|
59
|
+
box-decoration-break: clone;
|
|
60
|
+
-webkit-box-decoration-break: clone;
|
|
61
|
+
}
|
|
62
|
+
`,Ea=r.textarea`
|
|
63
|
+
${Pa}
|
|
64
|
+
position: relative;
|
|
65
|
+
z-index: 1;
|
|
66
|
+
display: block;
|
|
67
|
+
width: 100%;
|
|
68
|
+
min-height: ${({$minHeight:e})=>e}px;
|
|
69
|
+
padding: 12px;
|
|
70
|
+
border: 0;
|
|
71
|
+
background: transparent;
|
|
72
|
+
outline: none;
|
|
73
|
+
resize: vertical;
|
|
74
|
+
color: ${({theme:e})=>e.v2.colors.white[500]};
|
|
75
|
+
caret-color: ${({theme:e})=>e.v2.colors.white[500]};
|
|
76
|
+
box-sizing: border-box;
|
|
77
|
+
|
|
78
|
+
&::placeholder {
|
|
79
|
+
color: ${({theme:e})=>e.v2.colors.silver[600]};
|
|
80
|
+
}
|
|
81
|
+
`,Na=e=>({before:e,matchPre:"",capture:"",matchPost:"",after:""}),Ia=({regex:a,value:r,onChange:l,minHeight:n=240,...i})=>{const o=d(null),p=d(null),u=s(()=>((e,t)=>{if(!e||!t)return Na(t);let a;try{a=new RegExp(e)}catch{return Na(t)}const r=a.exec(t);if(!r)return Na(t);const l=r.index,n=r.index+r[0].length;if(r.length<2||null==r[1])return{before:t.slice(0,l),matchPre:"",capture:t.slice(l,n),matchPost:"",after:t.slice(n)};const i=r[0].indexOf(r[1]),o=i>=0?l+i:l,s=o+r[1].length;return{before:t.slice(0,l),matchPre:t.slice(l,o),capture:t.slice(o,s),matchPost:t.slice(s,n),after:t.slice(n)}})(a,r),[a,r]),h=c(()=>{o.current&&p.current&&(o.current.scrollTop=p.current.scrollTop,o.current.scrollLeft=p.current.scrollLeft)},[]);return t(Aa,{$minHeight:n,children:[t(Oa,{ref:o,"aria-hidden":!0,children:[u.before,e("span",{style:{background:La},children:u.matchPre}),e("span",{style:{background:"rgba(102, 242, 102, 0.5)"},children:u.capture}),e("span",{style:{background:La},children:u.matchPost}),u.after,r.endsWith("\n")?" ":""]}),e(Ea,{ref:p,$minHeight:n,value:r,onChange:e=>l(e.target.value),onScroll:h,spellCheck:!1,...i})]})},Ra=r.div`
|
|
82
|
+
flex: 1;
|
|
83
|
+
min-height: 0;
|
|
84
|
+
overflow-y: auto;
|
|
85
|
+
`,Va=r.div`
|
|
86
|
+
background: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
87
|
+
border-radius: 8px;
|
|
88
|
+
padding: 8px;
|
|
89
|
+
display: flex;
|
|
90
|
+
flex-direction: column;
|
|
91
|
+
gap: 12px;
|
|
92
|
+
`,Xa=r.div`
|
|
93
|
+
padding: 8px 16px;
|
|
94
|
+
border-radius: 8px;
|
|
95
|
+
background: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
96
|
+
font-family: ${({theme:e})=>e.font_family.code};
|
|
97
|
+
font-size: 12px;
|
|
98
|
+
line-height: 20px;
|
|
99
|
+
color: ${({theme:e,$tone:t})=>"error"===t?e.v2.colors.red[500]:"match"===t?e.v2.colors.white[500]:e.v2.colors.silver[200]};
|
|
100
|
+
word-break: break-all;
|
|
101
|
+
white-space: pre-wrap;
|
|
102
|
+
user-select: text;
|
|
103
|
+
`,za=({isOpen:a,regex:r,onClose:l,initialTestString:n=""})=>{const[i,o]=p(n),d=s(()=>((e,t)=>{if(!e)return{ok:!0,isMatch:!1,message:L.RESULT_EMPTY_REGEX};if(!t)return{ok:!0,isMatch:!1,message:L.RESULT_EMPTY_INPUT};let a;try{a=new RegExp(e)}catch(e){return{ok:!1,message:e instanceof Error?e.message:L.RESULT_INVALID_REGEX_FALLBACK}}const r=a.exec(t);return r?{ok:!0,isMatch:!0,message:r.length>1?r[1]:r[0]}:{ok:!0,isMatch:!1,message:L.RESULT_NO_MATCH}})(r,i),[r,i]),c=d.ok?d.isMatch?"match":"neutral":"error";return e(M,{isOpen:a,header:{title:L.TITLE,onClose:()=>{o(""),l()}},children:e(Ra,{children:t(Va,{children:[t(P,{$gap:6,children:[e(A,{label:L.REGEX_LABEL}),e(Ma,{pattern:r,"data-id":"regex-tester-regex"}),!r&&e(O,{size:N.XXS,color:E.Secondary,children:L.REGEX_EMPTY_HINT})]}),t(P,{$gap:6,children:[t(I,{$width:"100%",$justifyContent:"space-between",$alignItems:"center",children:[e(A,{label:L.TEST_STRING_LABEL}),e(R,{"data-id":"regex-tester-unescape",label:L.UNESCAPE_LABEL,tooltip:L.UNESCAPE_TOOLTIP,variant:X.Secondary,size:V.S,onClick:()=>o(e=>(e=>{let t="";for(let a=0;a<e.length;a++){if("\\"===e[a]&&a+1<e.length){const r=e[a+1],l="n"===r?"\n":"t"===r?"\t":"r"===r?"\r":'"'===r?'"':"'"===r?"'":"\\"===r?"\\":null;if(null!=l){t+=l,a++;continue}}t+=e[a]}return t})(e)),disabled:(u=i,!/\\["'\\nrt]/.test(u))})]}),e(Ia,{name:"regex-tester-test-string","data-id":"regex-tester-test-string",placeholder:L.TEST_STRING_PLACEHOLDER,regex:r,value:i,onChange:o,minHeight:240}),e(z,{helpMessage:L.TEST_STRING_HELP})]}),t(P,{$gap:8,children:[e(A,{label:L.RESULT_LABEL}),e(Xa,{$tone:c,"data-id":"regex-tester-result",children:d.message}),d.ok&&d.isMatch&&e(O,{size:N.XXS,color:E.Secondary,children:L.RESULT_CAPTURE_HINT})]})]})})});var u},Da=r.div`
|
|
104
|
+
display: grid;
|
|
105
|
+
grid-template-rows: ${({$open:e})=>e?"1fr":"0fr"};
|
|
106
|
+
opacity: ${({$open:e})=>e?1:0};
|
|
107
|
+
margin-bottom: ${({$open:e,$gapCancelPx:t})=>e?"0":`-${t}px`};
|
|
108
|
+
transition:
|
|
109
|
+
grid-template-rows ${220}ms ease,
|
|
110
|
+
opacity ${220}ms ease ${({$open:e,$delayInMs:t})=>e?`${t}ms`:"0ms"},
|
|
111
|
+
margin-bottom ${220}ms ease;
|
|
112
|
+
pointer-events: ${({$open:e})=>e?"auto":"none"};
|
|
113
|
+
|
|
114
|
+
> .animated-collapse-inner {
|
|
115
|
+
overflow: hidden;
|
|
116
|
+
min-height: 0;
|
|
117
|
+
}
|
|
118
|
+
`,_a=({open:t,children:a,delayInMs:r=0,gapCancelPx:l=0})=>e(Da,{$open:t,$delayInMs:r,$gapCancelPx:l,"aria-hidden":!t,children:e("div",{className:"animated-collapse-inner",children:a})}),Ha=r.div`
|
|
119
|
+
box-sizing: border-box;
|
|
120
|
+
min-width: 109px;
|
|
121
|
+
max-width: 160px;
|
|
122
|
+
padding: 12px;
|
|
123
|
+
border-radius: 8px;
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 8px;
|
|
127
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
128
|
+
border: 1px
|
|
129
|
+
${({$accent:e,$isVirtual:t})=>t?`dashed ${e}`:`solid ${e}`};
|
|
130
|
+
`,Ba=r.div`
|
|
131
|
+
display: flex;
|
|
132
|
+
align-items: center;
|
|
133
|
+
gap: 4px;
|
|
134
|
+
min-width: 0;
|
|
135
|
+
`,ja=r.div`
|
|
136
|
+
flex-shrink: 0;
|
|
137
|
+
width: 16px;
|
|
138
|
+
height: 16px;
|
|
139
|
+
display: flex;
|
|
140
|
+
align-items: center;
|
|
141
|
+
justify-content: center;
|
|
142
|
+
`,qa={visibility:"hidden"},Ua=u(({data:r})=>{const l=n(),{service:i,namespace:o,isVirtual:s,isRoot:d,isUser:c}=r,p=((e,t)=>"user"===e?Bt:t?jt:qt)(i,s),u=o?`${o}/${i}`:i,h=s?"virtual":"-",g=d?l.v2.colors.purple[300]:s?l.v2.colors.pink[500]:l.v2.colors.silver[200];return t(a,{children:[e(f,c?{type:"source",position:b.Bottom,style:qa}:{type:"source",position:b.Top,style:qa}),e(f,c?{type:"target",position:b.Right,style:qa}:{type:"target",position:b.Left,style:qa}),t(Ha,{$accent:g,$isVirtual:s,children:[t(Ba,{children:[e(ja,{children:e(p,{size:16,fill:g})}),e(O,{size:N.XXXS,color:g,nowrap:!0,children:u})]}),e(O,{size:N.XXXS,color:g,nowrap:!0,children:h})]})]})});Ua.displayName=Ua.name;const Fa={duration:300,padding:.2,includeHiddenNodes:!0,maxZoom:1},Ga=({trigger:e,options:t=Fa})=>{const{fitView:a}=y(),r=d(!0);return h(()=>{r.current?r.current=!1:e>0&&requestAnimationFrame(()=>a(t))},[e,a,t]),null},Wa=r.div`
|
|
143
|
+
position: relative;
|
|
144
|
+
width: 100%;
|
|
145
|
+
height: ${({$height:e})=>e};
|
|
146
|
+
border-radius: 8px;
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
149
|
+
|
|
150
|
+
.react-flow__attribution {
|
|
151
|
+
visibility: hidden;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
${({$lockPointerEvents:e})=>e?"\n .react-flow__node {\n cursor: default;\n pointer-events: none;\n }\n ":""}
|
|
155
|
+
|
|
156
|
+
${({$suppressFocus:e})=>e?"\n .react-flow__node:focus,\n .react-flow__node:focus-visible,\n .react-flow__node.selected {\n outline: none;\n box-shadow: none;\n }\n ":""}
|
|
157
|
+
|
|
158
|
+
* {
|
|
159
|
+
transition: none;
|
|
160
|
+
}
|
|
161
|
+
`,Ka=e=>"number"==typeof e?`${e}px`:e;function Ya({nodes:a,edges:r,nodeTypes:l,edgeTypes:i,height:o=420,interactive:d=!1,minZoom:c=.2,maxZoom:p=1.5,fitViewPadding:u=.2,fitViewTrigger:h=0,showBackground:g=!0,suppressNodeFocusStyle:m,onNodesChange:v,onEdgesChange:f,onNodeClick:b,onNodeMouseEnter:y,onNodeMouseLeave:x,className:C,style:S,children:w}){const T=n(),M=!d,L=m??M,P=s(()=>({...Fa,padding:u,maxZoom:Math.min(Fa.maxZoom??1,p)}),[u,p]);return e(Wa,{className:C,style:S,$height:Ka(o),$lockPointerEvents:M,$suppressFocus:L,children:t($,{nodes:a,edges:r,nodeTypes:l,edgeTypes:i,onNodesChange:v,onEdgesChange:f,onNodeClick:b,onNodeMouseEnter:y,onNodeMouseLeave:x,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,nodesFocusable:!M,edgesFocusable:!1,panOnDrag:!0,zoomOnScroll:!0,minZoom:c,maxZoom:p,proOptions:{hideAttribution:!0},children:[g&&e(k,{color:T.v2.colors.silver[600],gap:17,size:1}),e(Ga,{trigger:h,options:P}),w]})})}function Za(t){return e(x,{children:e(Ya,{...t})})}const Ja=t=>e(Za,{...t}),Qa=({sourceX:e,sourceY:t,targetX:a,targetY:r,sourcePosition:l=b.Right,targetPosition:n=b.Left,isSelfLoop:i,selfLoopNodeHeight:o})=>i?(({sourceX:e,sourceY:t,targetX:a,targetY:r,selfLoopNodeHeight:l=80})=>{const n=(e+a)/2,i=l/2+40,o=Math.min(t,r)-i;return[`M ${e},${t} C ${e+28},${t} ${e+28},${o} ${n},${o} C ${a-28},${o} ${a-28},${r} ${a},${r}`,n,o,0,0]})({sourceX:e,sourceY:t,targetX:a,targetY:r,selfLoopNodeHeight:o}):C({sourceX:e,sourceY:t,targetX:a,targetY:r,sourcePosition:l,targetPosition:n}),er=new i,tr=async(e,t,a)=>{const{nodeWidth:r,nodeHeight:l,rootIds:n=[],rootLayerConstraint:i="FIRST",rootAlignCenter:o="FIRST"===i,spacing:s,direction:d,extraOptions:c}=a,p=new Set(n),u=(({direction:e="RIGHT",spacing:t,extraOptions:a})=>({"elk.algorithm":"layered","elk.direction":e,"elk.layered.nodePlacement.strategy":"NETWORK_SIMPLEX","elk.layered.spacing.nodeNodeBetweenLayers":String(t?.betweenLayers??120),"elk.spacing.nodeNode":String(t?.nodeNode??24),"elk.layered.spacing.edgeEdgeBetweenLayers":String(t?.edgeEdge??24),"elk.layered.spacing.edgeNodeBetweenLayers":String(t?.edgeNode??32),...a}))({direction:d,spacing:s,extraOptions:c}),h={id:"root",layoutOptions:u,children:e.map(e=>({id:e.id,width:r,height:l,...p.has(e.id)?{layoutOptions:{"elk.layered.layering.layerConstraint":i,...o?{"elk.alignment":"CENTER"}:{}}}:{}})),edges:t.map(e=>({id:e.id,sources:[e.source],targets:[e.target]}))},g=await er.layout(h),m=new Map;return g.children?.forEach(e=>{m.set(e.id,{x:e.x??0,y:e.y??0})}),{nodes:e.map(e=>({...e,position:m.get(e.id)??e.position})),edges:t}},ar="0;0.5;1",rr=u(({id:r,source:l,target:i,sourceX:o,sourceY:d,targetX:c,targetY:p,sourcePosition:u,targetPosition:h,markerEnd:g,style:m,data:v})=>{const f=n(),b=v?.mode??"fixed",y=l===i||Boolean(v?.isSelfLoop),[x]=Qa({sourceX:o,sourceY:d,targetX:c,targetY:p,sourcePosition:u,targetPosition:h,isSelfLoop:y,selfLoopNodeHeight:v?.selfLoopNodeHeight}),$=`${r}__graph-flow-motion`,k=v?.trackColor??("string"==typeof m?.stroke?m.stroke:"path-length"===b?f.v2.colors.silver[400]:f.v2.colors.blue[700]),C=v?.ballColorSmall??("path-length"===b?f.v2.colors.silver[600]:f.v2.colors.blue[900]),T=v?.ballColorLarge??("path-length"===b?f.v2.colors.silver[200]:f.v2.colors.blue[500]),{travelDuration:M,ballCount:L}=s(()=>{if("fixed"===b)return{travelDuration:4,ballCount:5};const e=Math.hypot(c-o,p-d),t=((e,t)=>{if("undefined"==typeof document)return t;const a=document.createElementNS("http://www.w3.org/2000/svg","path");return a.setAttribute("d",e),a.getTotalLength()||t})(x,e);return{travelDuration:Math.max(1.2,t/100),ballCount:Math.min(10,Math.max(3,Math.round(t/72)))}},[b,x,o,d,c,p]),P=`${M.toFixed(3)}s`;return t(a,{children:[e(S,{id:r,path:x,markerEnd:g,style:{...m,stroke:k,strokeWidth:1}}),e(w,{children:t("svg",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",overflow:"visible",pointerEvents:"none"},children:[e("path",{id:$,d:x,fill:"none",stroke:"none"}),Array.from({length:L}).map((a,r)=>{const l=`-${(M/L*r).toFixed(3)}s`;return t("circle",{r:0,fill:C,children:[e("animateMotion",{dur:P,begin:l,repeatCount:"indefinite",children:e("mpath",{href:`#${$}`})}),e("animate",{attributeName:"r",dur:P,begin:l,repeatCount:"indefinite",keyTimes:ar,values:"0;3.5;3.5"}),e("animate",{attributeName:"fill",dur:P,begin:l,repeatCount:"indefinite",keyTimes:ar,values:`${C};${T};${T}`})]},r)})]})})]})});rr.displayName=rr.name;const lr="graph-flow-animated";var nr,ir;(e=>{e.Service="blast-radius-service"})(nr||(nr={})),(e=>{e.Animated="blast-radius-animated"})(ir||(ir={}));const or=(e,t)=>{const a=(e||"").trim();return a?`${a}/${t}`:t},sr=e=>or(e.namespace,e.service),dr=(e,t,a)=>{const r=new Set(e),l=[...e];for(;l.length;){const e=l.shift();for(const n of a.get(e)??[])n===t||r.has(n)||(r.add(n),l.push(n))}return r},cr=(e,t,a)=>{const r=new Map;if(!e.length)return r;const l=[];for(let t=0;t<e.length;t+=6)l.push(e.slice(t,t+6));const n=-72*(l.length-1)/2;return l.forEach((e,l)=>{const i=n+72*l;e.forEach((e,l)=>{const n=t+a*(l+1)*160;r.set(e,{x:n,y:i})})}),r},pr=(e,t,a)=>{const r=t.map(e=>a.get(e)).filter(e=>!!e);if(!r.length)return{x:0,y:72};const l={x:r.reduce((e,t)=>e+t.x,0)/r.length,y:r.reduce((e,t)=>e+t.y,0)/r.length+72},n=new Set([...a.entries()].filter(([t])=>t!==e).map(([,e])=>`${e.x},${e.y}`));let i=l;for(;n.has(`${i.x},${i.y}`);)i={x:i.x,y:i.y+72};return i},ur={[nr.Service]:Ua},hr={[ir.Animated]:rr,[lr]:rr},gr=r.div`
|
|
162
|
+
display: flex;
|
|
163
|
+
flex-direction: column;
|
|
164
|
+
gap: 8px;
|
|
165
|
+
padding: 12px;
|
|
166
|
+
width: fit-content;
|
|
167
|
+
border-radius: 8px;
|
|
168
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
169
|
+
position: absolute;
|
|
170
|
+
top: 12px;
|
|
171
|
+
left: 12px;
|
|
172
|
+
z-index: ${({theme:e})=>e.v2.zIndex.island};
|
|
173
|
+
`,mr=({subgraph:a})=>{const r=n(),[l,i]=p([]),[o,d]=p([]),[c,u]=p(0),[g,m]=p(null),v=s(()=>{const e=a.nodes.map(e=>`${e.namespace||""}/${e.service}:${e.isVirtual?1:0}`).join("|"),t=a.edges.map(e=>`${e.clientNamespace||""}/${e.clientService}->${e.serverNamespace||""}/${e.serverService}`).join("|");return`${(e=>`${e.root.namespace||""}/${e.root.service}`)(a)}::${e}::${t}`},[a]);h(()=>{const e=(e=>{const t=sr(e.root);return e.nodes.map(e=>{const a=sr(e);return{id:a,type:nr.Service,position:{x:0,y:0},data:{service:e.service,namespace:e.namespace||"",isVirtual:e.isVirtual,isRoot:a===t,isUser:"user"===e.service},measured:{width:120,height:58}}})})(a),t=new Set(e.map(e=>e.id)),l=((e,t,a)=>e.edges.flatMap(e=>{const r=(e=>or(e.clientNamespace,e.clientService))(e),l=(e=>or(e.serverNamespace,e.serverService))(e);if(!a.has(r)||!a.has(l))return[];const n=t.v2.colors.silver[400];return[{id:`${r}->${l}`,type:"smoothstep",source:r,target:l,markerEnd:{type:T.ArrowClosed,color:n,width:16,height:16},style:{stroke:n,strokeWidth:1}}]}))(a,r,t),n=((e,t)=>{if(!e.length)return{nodes:e,edges:t};const a=(e.find(e=>e.data.isRoot)??e[0]).id,r=e.find(e=>e.data.isUser)?.id??null,l=new Map,n=new Map,i=new Map;for(const t of e)l.set(t.id,[]),n.set(t.id,[]),i.set(t.id,[]);for(const e of t)l.get(e.source)?.push(e.target),n.get(e.target)?.push(e.source),i.get(e.source)?.push(e.target),i.get(e.target)?.push(e.source);const o=dr((n.get(a)??[]).filter(e=>e!==r),a,i),s=dr((l.get(a)??[]).filter(e=>e!==r&&!o.has(e)),a,i);r&&(o.delete(r),s.delete(r));const d=((e,t)=>{const a=new Map([[e,0]]),r=[e];for(;r.length;){const e=r.shift(),l=(a.get(e)??0)+1;for(const n of t.get(e)??[])a.has(n)||(a.set(n,l),r.push(n))}return a})(a,i),c=[...o].sort((e,t)=>{const a=(d.get(t)??0)-(d.get(e)??0);return 0!==a?a:e.localeCompare(t)}),p=[...s].filter(e=>!o.has(e)).sort((e,t)=>{const a=(d.get(e)??0)-(d.get(t)??0);return 0!==a?a:e.localeCompare(t)});for(const t of e)t.id===a||t.id===r||o.has(t.id)||s.has(t.id)||c.push(t.id);const u=new Map([[a,{x:0,y:0}]]);for(const[e,t]of cr(c,0,-1))u.set(e,t);for(const[e,t]of cr(p,0,1))u.set(e,t);return r&&u.set(r,pr(r,i.get(r)??[],u)),{nodes:e.map(e=>({...e,position:u.get(e.id)??e.position})),edges:t}})(e,l);i(n.nodes),d(n.edges),m(null),u(e=>e+1)},[v,a,r]);const f=s(()=>g?o.map(e=>{if(e.source===g||e.target===g)return{...e,type:ir.Animated,data:{...e.data,mode:"path-length"}};const t={opacity:.3};return{...e,style:{...e.style,...t},labelStyle:{...e.labelStyle,...t},labelBgStyle:{...e.labelBgStyle,...t}}}):o,[o,g]);return e(Za,{height:286,interactive:!0,nodeTypes:ur,edgeTypes:hr,nodes:l,edges:f,fitViewTrigger:c,fitViewPadding:.2,minZoom:.4,maxZoom:1.5,onNodeMouseEnter:(e,t)=>m(t.id),onNodeMouseLeave:()=>m(null),children:t(gr,{children:[t(I,{$gap:4,children:[e(H,{color:r.v2.colors.purple[400]}),e(O,{size:N.XXXS,children:"This Service"})]}),t(I,{$gap:4,children:[e(H,{color:r.v2.colors.pink[500]}),e(O,{size:N.XXXS,children:"Non-Instrumented Service"})]}),t(I,{$gap:4,children:[e(H,{color:r.v2.colors.silver[200]}),e(O,{size:N.XXXS,children:"Instrumented Service"})]})]})})},vr=({blastRadius:t})=>t?.nodes?.length?e(mr,{subgraph:t}):e(D,{children:e(_,{subTitle:"No blast-radius neighborhood for this service yet."})}),fr=({isOpen:t,onClose:a,onDeny:r,onApprove:l})=>e(B,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:a,denyButton:{label:"Keep editing",variant:X.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:"Discard changes",variant:X.Primary,onClick:()=>{l?.(),a()}}}),br=({isOpen:t,onClose:a,onViewConnector:r})=>e(B,{isOpen:t,onClose:a,visual:()=>e(U,{scale:1.2,icon:Ut}),title:q.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:q.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:j.STAY_ON_CONNECTIONS,variant:X.Secondary,onClick:a},approveButton:{label:j.GO_TO_CONNECTOR_OVERVIEW,variant:X.Primary,onClick:r??a}}),yr=({isOpen:t,onClose:a,onDeny:r,onApprove:l,action:n="delete",target:i,description:o,overrideApproveButtonLabel:s,overrideDenyButtonLabel:d})=>{const c=n.charAt(0).toUpperCase()+n.substring(1),p=i?.endsWith("s")?"these":"this";return e(B,{title:`${c}${i?` ${i}`:""}?`,description:o??`Are you sure you want to ${n}${i?` ${p} ${i}`:""}?`,isOpen:t,onClose:a,denyButton:{label:d??"Go back",variant:X.Secondary,onClick:()=>{r?.(),a()}},approveButton:{label:s??c,variant:X.Primary,onClick:()=>{l?.(),a()}}})},xr=({componentType:t,inputType:a,name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:d,value:c,setValue:p,errorMessage:u,warnMessage:h,helpMessage:g,dropdownOptions:m,dropdownNoSearch:v,dropdownNoCheckbox:f,timeUnits:b,timeDefaultUnit:y,toggleSize:x=K.L,keyLabel:$,valueLabel:k})=>{switch(t){case F.Input:return e(re,{name:r,type:a,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:d,value:c??"",onChange:e=>{const t=e.target.value;p(a===le.Number?""===t?null:Number(t):t)},errorMessage:u,warnMessage:h,helpMessage:g},r);case F.MultiInput:return e(ae,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:d,values:Array.isArray(c)?c:te(c,[]),setValues:e=>p(e),errorMessage:u,warnMessage:h,helpMessage:g,plain:!0},r);case F.KeyValuePair:return e(ee,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:d,limitFieldsPerRow:2,columns:[{keyName:"key",label:$||"Key",placeholder:$||"Key"},{keyName:"value",label:k||"Value",placeholder:k||"Value"}],values:Array.isArray(c)?c:te(c,[]),setValues:e=>p(e),errorMessage:u,warnMessage:h,helpMessage:g},r);case F.TextArea:return e(Q,{name:r,label:l,tooltip:n,badge:i,required:s,disabled:d,placeholder:o,value:c??"",onChange:e=>p(e.target.value),errorMessage:u,warnMessage:h,helpMessage:g},r);case F.Dropdown:return e(J,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:d,withSearch:!v,options:m?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!f}))||[],values:c?[String(c)]:[],setValues:e=>p(e[0]),errorMessage:u,warnMessage:h,helpMessage:g},r);case F.Checkbox:return e(Z,{name:r,label:l,tooltip:n,badge:i,value:!0===c||"true"===c,onChange:e=>p(e),disabled:d,errorMessage:u,warnMessage:h,helpMessage:g},r);case F.Time:return e(Y,{name:r,label:l,tooltip:n,badge:i,placeholder:o,required:s,disabled:d,value:c??"",setValue:e=>p(e),units:b,defaultUnit:y,errorMessage:u,warnMessage:h,helpMessage:g},r);case F.Toggle:return e(G,{name:r,size:x,labelAlign:W.Right,label:l,tooltip:n,badge:i,value:!0===c||"true"===c,onChange:e=>p(e),disabled:d,errorMessage:u,warnMessage:h,helpMessage:g},r);default:return null}},$r=r.div`
|
|
174
|
+
display: flex;
|
|
175
|
+
flex-wrap: wrap;
|
|
176
|
+
gap: 8px;
|
|
177
|
+
`,kr=r.div`
|
|
178
|
+
display: flex;
|
|
179
|
+
align-items: center;
|
|
180
|
+
gap: 8px;
|
|
181
|
+
padding: 8px 12px;
|
|
182
|
+
border-radius: 8px;
|
|
183
|
+
cursor: pointer;
|
|
184
|
+
background: ${({theme:e,$selected:t})=>t?e.v2.colors.silver[700]:e.v2.colors.silver[800]};
|
|
185
|
+
border: 1px solid ${({theme:e,$selected:t})=>t?e.v2.colors.silver[500]:e.v2.colors.silver[750]};
|
|
186
|
+
|
|
187
|
+
&:hover {
|
|
188
|
+
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
189
|
+
}
|
|
190
|
+
`,Cr=r.div`
|
|
191
|
+
display: flex;
|
|
192
|
+
width: 32px;
|
|
193
|
+
height: 32px;
|
|
194
|
+
justify-content: center;
|
|
195
|
+
align-items: center;
|
|
196
|
+
flex-shrink: 0;
|
|
197
|
+
`,Sr=r.div`
|
|
198
|
+
display: flex;
|
|
199
|
+
flex-direction: column;
|
|
200
|
+
gap: 12px;
|
|
201
|
+
`,wr=r.div`
|
|
202
|
+
display: flex;
|
|
203
|
+
flex-wrap: wrap;
|
|
204
|
+
gap: 6px;
|
|
205
|
+
`,Tr=r.div`
|
|
206
|
+
display: flex;
|
|
207
|
+
align-items: center;
|
|
208
|
+
gap: 8px;
|
|
209
|
+
&::before,
|
|
210
|
+
&::after {
|
|
211
|
+
content: '';
|
|
212
|
+
flex: 1;
|
|
213
|
+
height: 1px;
|
|
214
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
215
|
+
}
|
|
216
|
+
`,Mr=r.div`
|
|
217
|
+
padding: 2px 10px;
|
|
218
|
+
border-radius: 999px;
|
|
219
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
220
|
+
border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
|
|
221
|
+
`,Lr={[me.JavaScript]:"Node.js",[me.DotNet]:".NET",[me.Php]:"PHP",[me.Java]:"Java",[me.Go]:"Go",[me.Python]:"Python",[me.Ruby]:"Ruby",[me.Rust]:"Rust"},Pr=[me.Python,me.Java,me.JavaScript,me.DotNet,me.Php,me.Ruby,me.Go],Ar=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Or(e){return Lr[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Er(e){return null!=e?`${e}. ${we}`:we}const Nr=({readOnly:t,...a})=>e(t?Vr:zr,{...a}),Ir=({title:a,count:r,children:l})=>t(P,{$gap:6,children:[t(I,{$gap:8,$alignItems:"center",children:[e(O,{size:N.XS,color:E.Primary,nowrap:!0,children:a}),r>1&&e(O,{size:N.XXS,color:E.Secondary,nowrap:!0,children:`(${Ce})`})]}),e(wr,{children:l})]}),Rr=()=>{const t=n();return e(Tr,{children:e(Mr,{children:e(O,{size:N.XXS,color:t.v2.colors.white[500],nowrap:!0,children:Se})})})},Vr=({scopes:a,titleNumber:r,title:l,subTitle:n,icon:i,bgTint:s="900",entireClusterWarningMessage:d})=>{const c=l??Er(r),p={icon:i,title:c,subTitle:n,alignItems:n||i?"flex-start":void 0};if(oa(a))return e(ne,{bgTint:s,richTitle:p,withCollapse:!0,collapseIsDefaultOpen:!0,children:t(P,{$gap:8,children:[e(ie,{status:se.Default,message:oe,fullWidth:!0}),d&&e(ie,{status:se.Warning,message:d,fullWidth:!0,smallIcon:!0})]})});const u=a.sources??[],h=a.namespaces??[],g=a.languages??[],m=[];u.length&&m.push({kind:"sources",node:e(Ir,{title:de,count:u.length,children:u.map((t,a)=>{const r=[t.namespace,t.kind,t.name].filter(Boolean),l=r.length?r.join(" / "):pe;return e(ce,{label:l},`src-${a}-${l}`)})})}),h.length&&m.push({kind:"namespaces",node:e(Ir,{title:ue,count:h.length,children:h.map((t,a)=>e(ce,{label:t},`ns-${a}-${t}`))})}),g.length&&m.push({kind:"languages",node:e(Ir,{title:he,count:g.length,children:g.map((t,a)=>{const r=ve(t);return e(ce,{label:Or(t),leftIcon:r},`lang-${a}-${t}`)})})});const v=n??(m.length>1?ge:void 0);return e(ne,{bgTint:s,richTitle:{icon:i,title:c,subTitle:v,alignItems:v||i?"flex-start":void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(ne,{bgTint:"800",children:e(Sr,{children:m.map((a,r)=>t(o.Fragment,{children:[r>0&&e(Rr,{}),a.node]},a.kind))})})})},Xr=(e,t="all")=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":t,zr=({scopes:r,onChange:l,sourceOptions:n=[],namespaceOptions:i=[],supportedLanguages:o,titleNumber:d,title:u,subTitle:g,icon:m,dataIdPrefix:v="source-scope",slim:f,disabled:b,hideLogicNote:y,hideEntireClusterNote:x,entireClusterWarningMessage:$,defaultScopeTab:k="all"})=>{const C=r??sa(),[S,w]=p(()=>Xr(C,k)),{sources:T,namespaces:M,languages:L}=C,A=T.length>0||M.length>0||L.length>0;h(()=>{A&&"all"===S&&w(Xr(C,k))},[k,A,S,C]);const I=s(()=>Ar.map(e=>"language"===e.value&&0===o?.length?null:{...e,disabled:"all"===e.value&&A}).filter(Boolean),[A]),R=s(()=>T.map(e=>`${e.namespace}/${e.kind}/${e.name}`),[T]),V=s(()=>[...M],[M]),X=s(()=>new Set(L),[L]),z=c(e=>{w(e)},[]),D=c(e=>{const t=e.map(e=>(e=>{const t=e.split("/");return 3!==t.length?null:{namespace:t[0],kind:t[1],name:t[2]}})(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));l({...C,sources:t})},[C,l]),_=c(e=>{l({...C,namespaces:e})},[C,l]),H=c(e=>{const t=C.languages,a=t.includes(e)?t.filter(t=>t!==e):[...t,e];l({...C,languages:a})},[C,l]),B=!A&&"all"===S,j=(o||Pr).map(e=>({id:e,label:Lr[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:ve(e)})),q=u??Er(d),U=g??be;return e(fe,{richTitle:f?{icon:m,title:q,titleSize:N.XS,titleColor:E.Secondary,tooltip:U,alignItems:m?"flex-start":void 0}:{icon:m,title:q,subTitle:U,subTitleWrap:!0,alignItems:m||U?"flex-start":void 0},backgroundColor:f?"transparent":void 0,padding:f?0:void 0,children:t(P,{$gap:16,children:[B?t(a,{children:[!x&&e(ie,{status:se.Default,message:oe,fullWidth:!0,smallIcon:!0}),$&&e(ie,{status:se.Warning,message:$,fullWidth:!0,smallIcon:!0})]}):!y&&e(ie,{status:se.Info,message:ge,fullWidth:!0,smallIcon:!0}),e(P,{$alignItems:"flex-start",children:e(ye,{options:I,selected:S,setSelected:z,disabled:b})}),"source"===S&&e(xe,{multiple:!0,"data-id":`${v}-autocomplete-source`,options:n,value:R,onSelect:D,placeholder:$e,disabled:b}),"namespace"===S&&e(xe,{multiple:!0,"data-id":`${v}-autocomplete-namespace`,options:i,value:V,onSelect:_,placeholder:"Search namespace",disabled:b}),"language"===S&&j.length>0&&e($r,{children:j.map(({id:a,label:r,Icon:l})=>{const n=X.has(a);return t(kr,{$selected:n,onClick:()=>H(a),children:[e(Z,{name:`${v}-lang-${a}`,size:ke.S,value:n,onChange:()=>H(a),disabled:b}),e(Cr,{children:e(l,{size:20})}),e(O,{size:N.XS,nowrap:!0,children:r})]},a)})})]})})},Dr=e=>{if(null!=e){if(!Array.isArray(e)&&"object"==typeof e)return Object.entries(e).map(([e,t])=>({id:e,label:null==t?e:String(t)}));if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)}},_r=e=>{if(!Array.isArray(e)||e.length<3)return;const[t,a,r]=e;return e=>{const l=null==e?.[t]?"":String(e[t]);switch(a){case"=":case"==":case"===":return l===r;case"!=":case"!==":return l!==r;default:return!0}}},Hr=e=>{if(Array.isArray(e))return e.map(e=>{const t=e;return{keyName:String(t.keyName??t.name??""),label:t.label??t.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,componentType:t.componentType,options:Dr(t.options??t.values),fullRow:t.fullRow,defaultValue:t.defaultValue,withRegexTester:t.withRegexTester,separator:t.separator,copyByColumn:t.copyByColumn,renderCondition:_r(t.renderCondition)}})},Br=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const t=e;return{id:String(t.id??t.keyName??t.name??""),label:t.label??t.displayName??String(t.id??""),tooltip:t.tooltip,fields:Array.isArray(t.fields)?t.fields.map(jr):void 0}})},jr=e=>{const t="string"==typeof e.componentProperties?te(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??t.inputType??t.type,title:e.displayName,tooltip:t.tooltip,placeholder:t.placeholder,helpMessage:t.helpMessage,required:t.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Dr(t.options??t.values),itemWrapperKey:t.itemWrapperKey,columns:Hr(t.columns),limitFieldsPerRow:t.limitFieldsPerRow,variant:t.variant,wrapKey:t.wrapKey,checkboxOptions:Br(t.options??t.values),checkedValue:t.checkedValue??"true",valueMode:t.valueMode??"object",fields:Array.isArray(t.fields)?t.fields.map(jr):void 0,addLabel:t.addLabel,itemLabel:t.itemLabel,keyLabel:t.titleKey??t.keyLabel,valueLabel:t.titleValue??t.valueLabel,persistAs:t.persistAs}},qr=e=>{const t=e.initialValue;if(void 0!==t&&""!==t)return e.componentType===F.CheckboxList?"array"===e.valueMode?te(t,[]):te(t,{}):e.componentType!==F.MultiInput&&e.componentType!==F.MultiTabledInput||!e.wrapKey?e.componentType===F.MultiInput||e.componentType===F.MultiTabledInput?te(t,[]):e.componentType===F.SourceScopes?"null"===t||"{}"===t?sa():ca(te(t,null)):e.componentType===F.Toggle||e.componentType===F.Checkbox?"true"===t:t:{[e.wrapKey]:te(t,[])}},Ur=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Fr=e=>Array.isArray(e)?e:[],Gr=e=>{const t={};return e.forEach(e=>{t[String(e.key??"")]=String(e.value??"")}),t},Wr=e=>Ur(e)?Object.entries(e).map(([e,t])=>({key:e,value:String(t??"")})):[],Kr=({field:t,value:a,setValue:r,errorMessage:l,disabled:n})=>{const[i,o]=p(()=>Wr(a));return h(()=>{const e=Ur(a)?a:{};((e,t)=>{const a=Object.keys(e),r=Object.keys(t);return a.length===r.length&&a.every(a=>Object.prototype.hasOwnProperty.call(t,a)&&t[a]===e[a])})(Gr(i),e)||o(Wr(a))},[a]),e(ee,{name:t.name,label:t.title,tooltip:t.tooltip,helpMessage:t.helpMessage,required:t.required,disabled:n,limitFieldsPerRow:2,columns:[{keyName:"key",label:t.keyLabel||"Key",placeholder:t.keyLabel||"Key"},{keyName:"value",label:t.valueLabel||"Value",placeholder:t.valueLabel||"Value"}],values:i,setValues:e=>{o(e),r(Gr(e))},errorMessage:l})},Yr=({field:r,value:l,setValue:n,errorMessage:i,disabled:o,keyValuePersistAs:s,sourceOptions:d,namespaceOptions:c})=>{const{name:u,componentType:h,inputType:g,title:m,tooltip:v,placeholder:f,helpMessage:b,required:y,initialValue:x,options:$,itemWrapperKey:k,columns:C,limitFieldsPerRow:S,variant:w,wrapKey:T,checkboxOptions:M}=r,[L,I]=p({open:!1,value:""});if(h===F.SourceScopes)return e(Nr,{scopes:ca(l),onChange:e=>n(e),sourceOptions:d,namespaceOptions:c,dataIdPrefix:`dynamic-field-${u}`,slim:!0});if(h===F.CheckboxList&&"array"===r.valueMode){const a=Fr(l),r=(e,t)=>n(t?[...a.filter(t=>t!==e),e]:a.filter(t=>t!==e));return t(P,{$gap:12,children:[m&&e(A,{label:m,tooltip:v,required:y}),e(P,{$gap:8,children:(M||[]).map(t=>{const l=e(Z,{name:t.id,label:t.label,value:a.includes(t.id),disabled:o,onChange:e=>r(t.id,e)},t.id);return t.tooltip?e(Le,{text:t.tooltip,withIcon:!0,children:l},t.id):l})}),e(z,{errorMessage:i,helpMessage:b})]})}if(h===F.CheckboxList){const a=Ur(l)?l:{},d=(e=>"emptyObject"!==e.checkedValue||{})(r),c=e=>"emptyObject"===r.checkedValue?Ur(e):!!e;return t(P,{$gap:12,children:[m&&e(O,{size:N.XS,color:E.Secondary,nowrap:!0,children:m}),e(P,{$gap:12,children:(M||[]).map(r=>{const l=a[r.id],i=c(l),p=Ur(l)?l:{},h=e(Z,{label:r.label,value:i,disabled:o,onChange:e=>n({...a,[r.id]:e?Ur(l)?l:d:null})}),g=r.tooltip?e(Le,{text:r.tooltip,withIcon:!0,children:h}):h,m=i&&r.fields?.length?e(P,{$gap:12,$padding:"0 0 0 24px",children:r.fields.map(t=>e(Yr,{field:t,value:p[t.name],setValue:e=>n({...a,[r.id]:{...p,[t.name]:e}}),disabled:o,keyValuePersistAs:s},`${u}-${r.id}-${t.name}`))}):null;return t(P,{$gap:12,children:[g,m]},r.id)})}),e(z,{errorMessage:i,helpMessage:b})]})}if(h===F.MultiTabledInput){const r=Fr(T?l?.[T]:l),s=e=>n(T?{...Ur(l)?l:{},[T]:e}:e),d=(C||[]).some(e=>e.withRegexTester);return t(a,{children:[e("cards"===w?Pe:ee,{name:u,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,columns:C||[],limitFieldsPerRow:S,values:r,setValues:s,errorMessage:i,onTestRegex:d?e=>I({open:!0,value:e}):void 0}),d&&e(za,{isOpen:L.open,regex:L.value,onClose:()=>I({open:!1,value:""})})]})}if(h===F.MultiInput&&T){const t=Fr(l?.[T]);return e(ae,{name:u,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n({...Ur(l)?l:{},[T]:e}),errorMessage:i})}if(h===F.MultiInput&&k){const t=Fr(l).map(e=>String(e?.[k]??""));return e(ae,{name:u,label:m,tooltip:v,helpMessage:b,required:y,disabled:o,placeholder:f,values:t,setValues:e=>n(e.map(e=>({[k]:e}))),errorMessage:i})}return h===F.KeyValuePair?"map"===(r.persistAs??s)?e(Kr,{field:r,value:l,setValue:n,errorMessage:i,disabled:o}):e(xr,{componentType:h,name:u,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,errorMessage:i,keyLabel:r.keyLabel,valueLabel:r.valueLabel,value:l??[],setValue:n}):e(xr,{componentType:h,inputType:g,name:u,label:m,tooltip:v,helpMessage:b,disabled:o,required:y,placeholder:f,errorMessage:i,dropdownOptions:$,value:(null==l?x:l)??"",setValue:n})},Zr=({field:r,value:l,setValue:i,disabled:o,keyValuePersistAs:s,sourceOptions:d,namespaceOptions:c})=>{const p=n(),u=Fr(l),h=u.length?u:[{}],m=r.fields||[],v=e=>i(e);return t(a,{children:[h.map((a,l)=>t(g,{children:[e(Me,{}),t(P,{$gap:12,children:[t(I,{$justifyContent:"space-between",$alignItems:"center",children:[e(A,{label:`${r.itemLabel||r.title||"Item"} ${l+1}`}),e(R,{leftIcon:()=>e(Ft,{fill:p.v2.colors.red[500]}),variant:X.Secondary,size:V.S,onClick:()=>(e=>{const t=h.filter((t,a)=>a!==e);v(t)})(l),disabled:o||1===h.length})]}),m.map(t=>e(Yr,{field:t,value:a[t.name],setValue:e=>((e,t,a)=>v(h.map((r,l)=>l===e?{...r,[t]:a}:r)))(l,t.name,e),disabled:o,keyValuePersistAs:s,sourceOptions:d,namespaceOptions:c},`${r.name}-group-${l}-${t.name}`))]})]},`${r.name}-group-${l}`)),e(R,{variant:X.Secondary,label:r.addLabel||"Add",leftIcon:Gt,onClick:()=>v([...h,{}]),disabled:o}),e(Me,{})]})},Jr=({field:a,value:r,setValue:l,errorMessage:n,disabled:i})=>t(P,{$gap:12,children:[a.title&&e(A,{label:a.title,tooltip:a.tooltip,required:a.required}),e(P,{$gap:8,children:(a.checkboxOptions||[]).map(t=>{const a=e(Z,{name:t.id,label:t.label,value:!0===r?.[t.id],disabled:i,onChange:e=>l(t.id,e)},t.id);return t.tooltip?e(Le,{text:t.tooltip,withIcon:!0,children:a},t.id):a})}),e(z,{errorMessage:n,helpMessage:a.helpMessage})]}),Qr=({signals:t,fields:r,value:l,setValue:n,formErrors:i,disabled:o,seedInitialValues:s,keyValuePersistAs:d="map",sourceOptions:c,namespaceOptions:p})=>{const{isK8s:u}=da(),g=(r||[]).filter(e=>!!e).map(e=>jr(e));return h(()=>{if(!s)return;const e=l||{},t={};g.forEach(a=>{if(a.componentType===F.SourceScopes&&!u)return;const r=a.componentType===F.SourceScopes?qr(a)??sa():qr(a);if(void 0===r)return;if(a.componentType===F.CheckboxList&&"flatFields"===a.valueMode&&Ur(r))return void Object.entries(r).forEach(([a,r])=>{void 0!==e[a]&&null!==e[a]||(t[a]=r)});const l=e[a.name];if(a.componentType===F.SourceScopes){if(void 0!==l)return}else if(null!=l)return;t[a.name]=Ur(r)&&Ur(t[a.name])?{...t[a.name],...r}:r}),Object.entries(t).forEach(([e,t])=>n(e,t))},[]),e(a,{children:g.map((a,r)=>{const s=Object.entries(l||{}).map(([e,t])=>({name:e,key:e,value:t}));if(a.renderCondition&&!Te(a.renderCondition,t,s))return null;if(a.componentType===F.SourceScopes&&!u)return null;const h=l?.[a.name],g=`${a.name}-${r}`;if(a.componentType===F.FieldGroup)return e(Zr,{field:a,value:h,setValue:e=>n(a.name,e),disabled:o,keyValuePersistAs:d,sourceOptions:c,namespaceOptions:p},g);if(a.componentType===F.CheckboxList&&"flatFields"===a.valueMode){const t=a.checkboxOptions?.map(e=>i[e.id]).find(Boolean);return e(Jr,{field:a,value:l||{},setValue:n,errorMessage:t,disabled:o},g)}return e(Yr,{field:a,value:h,setValue:e=>n(a.name,e),errorMessage:i[a.name],disabled:o,keyValuePersistAs:d,sourceOptions:c,namespaceOptions:p},g)})})},el=Qr,tl=({isEnabled:t,setIsEnabled:a,fieldDisabled:r})=>{const l=n();return e(ye,{options:[{icon:Wt,label:"Enable",value:!0,selectedBgColor:l.v2.colors.green[1e3],selectedBorderColor:l.v2.colors.green[400],selectedTextColor:l.v2.colors.green[400]},{icon:Kt,label:"Disable",value:!1,selectedBgColor:l.v2.colors.red[1e3],selectedBorderColor:l.v2.colors.red[500],selectedTextColor:l.v2.colors.red[400]}],size:Ae.S,selected:t,setSelected:a,disabled:r})},al=r.div`
|
|
222
|
+
display: flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
gap: 24px;
|
|
225
|
+
padding: 8px 16px;
|
|
226
|
+
border-radius: 12px;
|
|
227
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
228
|
+
`,rl=r.div`
|
|
229
|
+
flex: 1;
|
|
230
|
+
min-width: 0;
|
|
231
|
+
white-space: pre;
|
|
232
|
+
overflow-x: auto;
|
|
233
|
+
`,ll=({title:a,summary:r,onEdit:l,renderAction:n})=>{const i=s(()=>{const e=[];return a&&(e.push({text:a,variant:pa.Default}),e.push({text:" - ",variant:pa.Default})),e.push(...r),e},[a,r]);return t(al,{children:[e(rl,{children:e(ua,{parts:i})}),n&&n(),l&&e(R,{"data-id":"sampling-btn-edit-auto-rule",label:Oe,rightIcon:Yt,variant:X.Text,size:V.S,onClick:l})]})},nl={[De.HttpRequest]:"HTTP request",[De.HttpResponse]:"HTTP response",[De.DbQuery]:"DB query",[De.Messaging]:"messaging"};function il(e,t,a){return 1===e?t:a??`${t}s`}function ol(e,t){const a=[],r=e.slice(0,3),l=e.slice(3);return r.forEach((e,r)=>{r>0&&a.push({text:", ",variant:pa.Default}),a.push({text:e,variant:t})}),l.length>0&&a.push({text:` + ${l.length} more`,variant:pa.Default,tooltipItems:l}),a}const sl=({option:t,formState:a,renderAction:r})=>{const l=s(()=>{const e=function(e,t){switch(e){case Ne.CodeAttributes:return(e=>{const t=Object.values(_e).filter(t=>!!e.codeAttributes?.[t]).map(e=>He(e).toLowerCase());return t.length?[{text:"Collect",variant:pa.Action},{text:" ",variant:pa.Default},...ol(t,pa.Endpoint)]:null})(t);case Ne.PayloadCollection:return(e=>{const t=Object.values(De).filter(t=>null!=e.payloadCollection?.[t]).map(e=>nl[e]);return t.length?[{text:"Collect",variant:pa.Action},{text:" ",variant:pa.Default},...ol(t,pa.Endpoint)]:null})(t);case Ne.HeadersCollection:return(e=>{const t=(e.headersCollection?.[ze.HeaderKeys]??[]).map(e=>e.trim()).filter(e=>e.length>0);if(!t.length)return null;const a=il(t.length,"HTTP header");return[{text:`Collect ${t.length} ${a}`,variant:pa.Action},{text:"",variant:pa.Default,tooltipItems:t}]})(t);case Ne.CustomInstrumentation:return(e=>{const t=(e.customInstrumentations?.[Ie.Java]??[]).map(e=>new Re(e.className,e.methodName)).filter(e=>e.Verify()),a=(e.customInstrumentations?.[Ie.Golang]??[]).map(e=>new Ve(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>e.Verify()),r=(e.customInstrumentations?.[Ie.Php]??[]).map(e=>new Xe(e.className,e.functionName)).filter(e=>e.Verify());if(!(t.length+a.length+r.length))return null;const l=[];t.length&&l.push(`${t.length} Java ${il(t.length,"probe")}`),a.length&&l.push(`${a.length} Go ${il(a.length,"probe")}`),r.length&&l.push(`${r.length} PHP ${il(r.length,"probe")}`);const n=[...t.map(e=>`Java: ${e.toString()}`),...a.map(e=>`Go: ${e.toString()}`),...r.map(e=>`PHP: ${e.toString()}`)];return[{text:`Apply ${l.join(" + ")}`,variant:pa.Action},{text:"",variant:pa.Default,tooltipItems:n}]})(t);case Ne.NetworkMetrics:return[{text:"Collect",variant:pa.Action},{text:" ",variant:pa.Default},{text:"network flow and TCP stats metrics",variant:pa.Endpoint}];default:return null}}(t?.type,a);return e?[...e,...ha(a.sourceScopes)]:[]},[t?.type,a]),n=0===l.length;return e(ll,{title:n?Ee:"Instrumentation Rule Preview",summary:l,renderAction:r})},dl=({size:t=200,central:a=!1,useInline:r=!1})=>{const{tier:l}=da();if(r){if(a)return e(Zt,{size:t});switch(l){case Be.Community:return e(Qt,{size:t});case Be.Onprem:return e(Jt,{size:t});default:return null}}if(a)return e(ea,{size:t});switch(l){case Be.Community:return e(aa,{size:t});case Be.Onprem:return e(ta,{size:t});default:return null}},cl=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],pl=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],ul=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],hl=({description:a,options:r,selected:l,onSelect:n,customName:i,customLabel:o,customPlaceholder:s,customValue:d,onCustomChange:c,customInputType:p=le.Number,customMin:u,customMax:h})=>t(P,{$gap:6,children:[e(A,{label:a}),t(I,{$gap:8,$alignItems:"flex-end",children:[e(ye,{options:r,selected:l,setSelected:n}),"custom"===l&&e(re,{name:i,label:o,placeholder:s,type:p,value:d,onChange:c,width:160,min:u,max:h})]})]}),gl=()=>{},ml=t=>t.readOnly?e(vl,{rule:t.rule}):e(fl,{ruleType:t.ruleType,formState:t.formState,onChange:t.onChange}),vl=({rule:a})=>{const r=null!=a.durationAtLeastMs;return a.error?e(fe,{richTitle:{title:je},children:e(G,{name:"sampling-view-toggle-keep-errors",onChange:gl,value:!0,size:K.S,label:qe,labelAlign:W.Right})}):r?e(fe,{richTitle:{title:Ue},children:t("div",{children:[e(O,{size:N.XXXS,color:E.Secondary,children:Fe}),e(O,{size:N.XS,children:`${a.durationAtLeastMs}ms`})]})}):null},fl=({ruleType:t,formState:a,onChange:r})=>{const l=c(e=>r({durationPreset:e}),[r]),n=c(e=>r({customDurationMs:e.target.value}),[r]);return"Duration"===t?e(fe,{richTitle:{title:Ue,subTitle:Ge},children:e(hl,{description:Fe,options:ul,selected:a.durationPreset,onSelect:l,customName:"sampling-input-custom-duration",customLabel:We,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:n})}):null},bl=r.div`
|
|
234
|
+
display: flex;
|
|
235
|
+
gap: 32px;
|
|
236
|
+
`,yl=r.div`
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: 4px;
|
|
240
|
+
`,xl=r.div`
|
|
241
|
+
display: flex;
|
|
242
|
+
flex-wrap: wrap;
|
|
243
|
+
align-items: flex-end;
|
|
244
|
+
gap: 16px;
|
|
245
|
+
`,$l=r.div`
|
|
246
|
+
display: flex;
|
|
247
|
+
align-items: flex-end;
|
|
248
|
+
gap: 16px;
|
|
249
|
+
padding: 12px 16px;
|
|
250
|
+
border-radius: 8px;
|
|
251
|
+
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
252
|
+
`,kl=r.div`
|
|
253
|
+
display: flex;
|
|
254
|
+
align-items: flex-end;
|
|
255
|
+
gap: 10px;
|
|
256
|
+
flex: 1;
|
|
257
|
+
`,Cl=r.div`
|
|
258
|
+
display: flex;
|
|
259
|
+
align-items: center;
|
|
260
|
+
height: 32px;
|
|
261
|
+
`,Sl=r.div`
|
|
262
|
+
display: flex;
|
|
263
|
+
align-items: flex-end;
|
|
264
|
+
gap: 16px;
|
|
265
|
+
margin-bottom: 12px;
|
|
266
|
+
`,wl="Any",Tl="Kafka topic",Ml=()=>e("div",{style:{marginBottom:"8px"},children:e(O,{size:N.XS,weight:500,children:"And"})}),Ll=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Pl=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Al=[{id:"",label:wl},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Ol=t=>t.readOnly?e(El,{data:t.data}):e(Nl,{category:t.category,formState:t.formState,onChange:t.onChange}),El=({data:a})=>{const r=s(()=>(e=>{if("noisy"===e.category){const t=e.rule.operation;if(t?.httpServer)return[{id:"type",title:dt,value:st},{id:"route",title:at,value:t.httpServer.route||t.httpServer.routePrefix||ct},{id:"method",title:it,value:t.httpServer.method||wl}];if(t?.httpClient){const e=[{id:"type",title:dt,value:pt}];return t.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:t.httpClient.serverAddress}),e.push({id:"route",title:at,value:t.httpClient.templatedPath||t.httpClient.templatedPathPrefix||ct}),e.push({id:"method",title:it,value:t.httpClient.method||wl}),e}return[{id:"type",title:dt,value:ut}]}const t=e.rule.operation;return t?.httpServer?[{id:"type",title:dt,value:st},{id:"route",title:at,value:t.httpServer.route||t.httpServer.routePrefix||ct},{id:"method",title:it,value:t.httpServer.method||wl}]:t?.kafkaConsumer?[{id:"type",title:dt,value:ht},{id:"topic",title:Tl,value:t.kafkaConsumer.kafkaTopic||ct}]:t?.kafkaProducer?[{id:"type",title:dt,value:gt},{id:"topic",title:Tl,value:t.kafkaProducer.kafkaTopic||ct}]:[{id:"type",title:dt,value:ut}]})(a),[a]);return e(fe,{richTitle:{title:Ke},children:e(bl,{children:r.map(({id:a,title:r,value:l})=>t(yl,{children:[e(O,{size:N.XXXS,color:E.Secondary,nowrap:!0,children:r}),e(O,{size:N.XS,nowrap:!0,children:l})]},a))})})},Nl=({category:a,formState:r,onChange:l})=>{const n=s(()=>"noisy"===a?Ll:Pl,[a]),i=c(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),o=c(e=>t=>{t&&l({routeType:e,route:""})},[l]),d=c(e=>l({route:e.target.value}),[l]),p=c(e=>l({serverAddress:e.target.value}),[l]),u=c(e=>l({method:e[0]||""}),[l]),h=c(e=>l({kafkaTopic:e.target.value}),[l]),g="httpServer"===r.operationType||"httpClient"===r.operationType,m="kafkaConsumer"===r.operationType||"kafkaProducer"===r.operationType,v="httpClient"===r.operationType?tt:at,f="httpClient"===r.operationType?rt:lt;return t(fe,{richTitle:{title:`2. ${Ke}`,subTitle:Ye},children:[e(P,{$alignItems:"flex-start",children:e(ye,{options:n,selected:r.operationType,setSelected:i})}),g&&t(xl,{children:["httpClient"===r.operationType&&t(Sl,{children:[e(re,{name:"sampling-input-server-address",label:Je,placeholder:Ze,value:r.serverAddress,onChange:p}),e(Ml,{})]}),t($l,{children:[t(kl,{children:[e(Cl,{children:e(Qe,{"data-id":"sampling-radio-route",value:"route"===r.routeType,onChange:o("route")})}),e(re,{name:"sampling-input-route",label:v,placeholder:et,value:"route"===r.routeType?r.route:"",onChange:d,disabled:"route"!==r.routeType})]}),t(kl,{children:[e(Cl,{children:e(Qe,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===r.routeType,onChange:o("routePrefix")})}),e(re,{name:"sampling-input-route-prefix",label:f,placeholder:et,value:"routePrefix"===r.routeType?r.route:"",onChange:d,disabled:"routePrefix"!==r.routeType})]})]}),t(Sl,{children:[e(Ml,{}),e(nt,{label:it,items:Al,selectedIds:[r.method||""],setSelectedIds:e=>u(e),buttonProps:{"data-id":"sampling-btn-method",label:Al.find(e=>e.id===r.method)?.label||wl,size:V.S,variant:X.Secondary}})]})]}),m&&e(re,{name:"sampling-input-kafka-topic",label:ot,placeholder:"Type kafka topic",value:r.kafkaTopic,onChange:h,width:"320px"})]})},Il=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Rl=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}],Vl=t=>t.readOnly?e(Xl,{data:t.data}):e(zl,{category:t.category,formState:t.formState,onChange:t.onChange}),Xl=({data:a})=>{const r=s(()=>(e=>{switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:vt,method:yt,description:ft,value:`${e.rule.percentageAtLeast}%`}:{title:vt,method:$t,description:null,value:null};case"noisy":return ga(e.rule.percentageAtMost)?{title:vt,method:xt,description:null,value:null}:{title:vt,method:yt,description:bt,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:vt,method:yt,description:bt,value:`${e.rule.percentageAtMost}%`}}})(a),[a]),l=[{id:"method",title:it,value:r.method},...null!=r.description?[{id:"value",title:r.description,value:r.value}]:[]];return e(fe,{richTitle:{title:r.title},children:e(bl,{children:l.map(({id:a,title:r,value:l})=>t(yl,{children:[e(O,{size:N.XXXS,color:E.Secondary,nowrap:!0,children:r}),e(O,{size:N.XS,nowrap:!0,children:l})]},a))})})},zl=({category:a,formState:r,onChange:l})=>{const n="highlyRelevant"===a,i=n?Rl:Il,o=`${n?4:3}. ${vt}`,s=mt[a],d=n?ft:bt,p="noisy"===a?pl:cl,u=c(e=>l({percentageMode:e}),[l]),h=c(e=>l({percentagePreset:e}),[l]),g=c(e=>l({customPercentage:e.target.value}),[l]);return t(fe,{richTitle:{title:o,subTitle:s},children:["costReduction"!==a&&e(P,{$alignItems:"flex-start",children:e(ye,{options:i,selected:r.percentageMode,setSelected:u})}),("costReduction"===a||"sample"===r.percentageMode)&&e(hl,{description:d,options:p,selected:r.percentagePreset,onSelect:h,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:r.customPercentage,onCustomChange:g,customInputType:le.Decimal,customMin:0,customMax:100})]})},Dl=r.div`
|
|
267
|
+
display: flex;
|
|
268
|
+
align-items: flex-end;
|
|
269
|
+
gap: 16px;
|
|
270
|
+
`,_l=r.div`
|
|
271
|
+
width: 280px;
|
|
272
|
+
flex-shrink: 0;
|
|
273
|
+
`,Hl=r.div`
|
|
274
|
+
flex: 1;
|
|
275
|
+
min-width: 0;
|
|
276
|
+
`;function Bl(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":Pt[e.category]}const jl=t=>t.readOnly?e(ql,{data:t.data}):e(Ul,{formState:t.formState,onChange:t.onChange}),ql=({data:a})=>{const r=s(()=>[{id:"name",title:Ct,value:a.rule.name||kt},{id:"type",title:St,value:Bl(a)}],[a]),l=a.rule.notes||ct;return t(fe,{children:[e(bl,{children:r.map(({id:a,title:r,value:l})=>t(yl,{children:[e(O,{size:N.XXXS,color:E.Secondary,nowrap:!0,children:r}),e(O,{size:N.XS,nowrap:!0,children:l})]},a))}),t(yl,{children:[e(O,{size:N.XXXS,color:E.Secondary,children:wt}),e(O,{size:N.XS,children:l})]})]})},Ul=({formState:a,onChange:r})=>{const l=c(e=>r({name:e.target.value}),[r]),n=c(e=>r({notes:e.target.value}),[r]);return e(fe,{children:t(Dl,{children:[e(_l,{children:e(re,{name:"sampling-input-rule-name",label:Ct,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Tt,value:a.name,onChange:l})}),e(Hl,{children:e(re,{name:"sampling-input-note",label:wt,tooltip:Lt,placeholder:Mt,value:a.notes,onChange:n})})]})})},Fl=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Gl=({formState:t,onChange:a})=>{const r=c(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return e(fe,{richTitle:{title:`3. ${St}`,subTitle:At},children:e(P,{$alignItems:"flex-start",children:e(ye,{options:Fl,selected:t.ruleType,setSelected:r})})})},Wl=t=>{const a=s(()=>{if(t.readOnly)return t.summary;switch(t.category){case"noisy":return fa(xa(t.formState));case"highlyRelevant":return va(ya(t.formState));case"costReduction":return ma(ba(t.formState))}},[t]);if(t.readOnly)return e(ll,{title:Ot,summary:a,renderAction:t.renderAction});const r=1===a.length&&"default"===a[0].variant;return e(ll,{title:r?Ee:Ot,summary:r?[]:a,renderAction:t.renderAction})},Kl=(e,t)=>!t?.length||!!t?.find(t=>t===e),Yl=({title:a="Signals",required:r,errorMessage:l,allowedSignals:n,selectedSignals:i,setSelectedSignals:o,disabled:s})=>{const[c,u]=p(1===i.length),g=d(JSON.stringify(i));return h(()=>{let e=Et(i).filter(e=>Kl(e,n));e.length||(e=Nt.filter(({id:e})=>Kl(e,n)).map(({id:e})=>e));const t=JSON.stringify(e);g.current!==t&&(g.current=t,o(e),u(1===e.length))},[n,i]),t(P,{$gap:12,children:[e(A,{label:a,required:r}),e(I,{$gap:12,children:Nt.map(t=>{const a=Kl(t.id,n),r=((e,t)=>!!t?.find(t=>t===e))(t.id,i);return a?e(Z,{label:t.value,disabled:s||!a||c&&r,value:r,onChange:e=>((e,t)=>{const a=e,r=t?[...i,a]:i.filter(e=>e!==a);o(r),u(1===r.length)})(t.id,e)},t.id):null})}),e(z,{errorMessage:l})]})},Zl=({minSupportedVersion:t,currentVersion:a})=>e(B,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(U,{scale:2.4,icon:()=>e("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:e("path",{fill:"#151618",d:"M9.4844 0.730003C9.99694 -0.243259 11.4076 -0.24341 11.92 0.730003L11.9685 0.831353L14.3039 6.22012L20.153 6.77755C21.3553 6.89211 21.841 8.38683 20.9358 9.18621L16.5314 13.0731L17.8091 18.8079C18.0716 19.9868 16.8005 20.9109 15.7605 20.2969L10.7017 17.3093L5.64282 20.2969C4.60289 20.9104 3.33173 19.9866 3.59427 18.8079L4.87192 13.0741L0.468608 9.18621C-0.43662 8.38693 0.0482932 6.8924 1.25029 6.77755L7.09837 6.22012L9.43588 0.831353L9.4844 0.730003ZM8.55284 7.02876C8.35287 7.48992 7.9179 7.80589 7.41751 7.85357L2.03952 8.36571L6.09027 11.941C6.46691 12.2737 6.63296 12.7852 6.5237 13.2758L5.34956 18.5459L10.0008 15.8009L10.1669 15.7179C10.5087 15.574 10.8945 15.5741 11.2364 15.7179L11.4036 15.8009L16.0538 18.5459L14.8807 13.2758C14.7714 12.7851 14.9374 12.2737 15.3141 11.941L19.3627 8.36571L13.9858 7.85357C13.4855 7.80587 13.0505 7.4899 12.8505 7.02876L10.7017 2.07342L8.55284 7.02876Z"})})}),title:q.UPGRADE_REQUIRED,description:`${q.UPGRADE_TO_USE_FEATURE(t)}\n${q.CURRENT_VERSION(a)}`}),Jl=r.div`
|
|
277
|
+
display: flex;
|
|
278
|
+
flex-direction: column;
|
|
279
|
+
justify-content: flex-end;
|
|
280
|
+
width: ${({$width:e})=>e};
|
|
281
|
+
gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
|
|
282
|
+
`,Ql=r.div`
|
|
283
|
+
display: flex;
|
|
284
|
+
align-items: center;
|
|
285
|
+
min-height: 24px;
|
|
286
|
+
padding: 12px;
|
|
287
|
+
border-radius: 16px 16px 0 0;
|
|
288
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
289
|
+
`,en=r.div`
|
|
290
|
+
display: flex;
|
|
291
|
+
flex-direction: column;
|
|
292
|
+
gap: ${({$gap:e})=>e}px;
|
|
293
|
+
padding: 12px 12px 0 12px;
|
|
294
|
+
width: 100%;
|
|
295
|
+
height: ${({$heightOffset:e,$columnHasHeader:t})=>`calc(100vh - 180px - ${e}px ${t?"- 48px":""})`};
|
|
296
|
+
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"};
|
|
297
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
298
|
+
overflow-y: auto;
|
|
299
|
+
overflow-x: hidden;
|
|
300
|
+
`,tn=({isLeft:r,isRight:l,heightOffset:n=0,width:i,header:o,list:s})=>t(Jl,{$width:i,$columnHasHeader:!!o,children:[o&&e(Ql,{children:o}),e(en,{$gap:8,$isLeft:r,$isRight:l,$heightOffset:n,$columnHasHeader:!!o,children:s.length?s.length>1?e(It,{gap:8,elements:s}):e(a,{children:s[0]}):e(D,{$height:"100%",children:e(_,{})})})]}),an="75vw",rn=r.div`
|
|
301
|
+
display: flex;
|
|
302
|
+
flex-direction: column;
|
|
303
|
+
border-radius: 16px;
|
|
304
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
305
|
+
overflow: hidden;
|
|
306
|
+
`,ln=r.div`
|
|
307
|
+
display: flex;
|
|
308
|
+
gap: 12px;
|
|
309
|
+
padding: 16px 16px 0 16px;
|
|
310
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
311
|
+
position: sticky;
|
|
312
|
+
top: 0;
|
|
313
|
+
`,nn=r.div`
|
|
314
|
+
padding: 12px 12px 0 12px;
|
|
315
|
+
`,on=r.div`
|
|
316
|
+
display: flex;
|
|
317
|
+
gap: 12px;
|
|
318
|
+
padding: 16px;
|
|
319
|
+
`,sn=r.div`
|
|
320
|
+
padding: 5vh 10vw;
|
|
321
|
+
border-radius: 12px;
|
|
322
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
323
|
+
`,dn=m(({isOpen:a,withOverlay:r,disableAnimation:l,onClose:n,onBack:i,onNext:o,nextIsSkip:d,onSave:u,disableSave:h,connectionIds:g,header:m,subHeader:f,leftColumn:b,rightColumn:y,search:x,filters:$,errorMessage:k,isFormDirty:C,allowSaveWhenPristine:S,hideDirtyNote:w,forcedNote:T,isFetching:L,progress:P},A)=>{const[O,E]=p(!1),[I,R]=p(!1),[V,z]=p(void 0);v(A,()=>({clearErrors:()=>z(void 0)}));const _=I,H=c(()=>{C&&!O?E(!0):(E(!1),n?.())},[C,O,n]),j=h||I||!S&&"boolean"==typeof C&&!C,q=c(async()=>{R(!0);const e=await u();R(!1),!1!==e&&(e?.error?z(e.error):(g?.setValue([]),n?.()))},[u,g,n]),U=!!x||!!g||!!$,F=!!f,G=(U?48:0)+(F?50:0),W=s(()=>T||(L?{status:se.Info,message:"Fetching Data..."}:I&&!P?{status:se.Info,message:"Saving Changes..."}:V||k?{status:se.Error,message:V||k}:"boolean"!=typeof C||w?void 0:C?{status:se.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:{status:se.Success,message:"The values reflect the current configuration of the selected cluster."}),[L,I,P,V,k,C,w,T]),K=s(()=>i?{label:"Back",leftIcon:ra,variant:X.Secondary,onClick:i}:{label:"Cancel",variant:X.Secondary,onClick:H,disabled:_},[i,H,_]),[Y,Z]=p(!1),J=s(()=>o?d?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:la,variant:X.Secondary,onClick:()=>Z(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:la,variant:X.Primary,onClick:o}:{"data-id":"wide-drawer-save",label:"Save",variant:X.Primary,onClick:q,disabled:j},[o,d,q,j]);return t(M,{width:an,isOpen:a,disableAnimation:l,hideOverlay:!I&&!r,header:{...m,onClose:n?H:void 0,onCloseDisabled:_},footer:{note:W,actions:[K,J]},children:[I?e(D,{$height:"calc(100vh - 136px)",children:e(sn,{children:e(Rt,{titleSize:N.S,subTitleSize:N.XXXS,withGradient:!0,withSpinner:!0,...P})})}):t(rn,{children:[U&&t(ln,{children:[g&&e(Vt,{icon:Wt,title:"Selected Clusters",badge:{label:g.value.length}}),x&&e(Xt,{...x,width:x.width??"100%"}),$]}),F&&e(nn,{children:e(Vt,{icon:f.icon,title:f.title,subTitle:f.description,badge:f.badge})}),t(on,{children:[e(tn,{isLeft:!0,heightOffset:G,...b}),e(tn,{isRight:!0,heightOffset:G,...y})]})]}),e(fr,{isOpen:O,onClose:()=>E(!1),onApprove:H}),e(B,{title:"Skip setup?",description:"Without completing setup, Odigos won't be able to collect and send your telemetry data. This may interrupt your data flow and limit the platform's ability to provide value.",isOpen:Y,onClose:()=>Z(!1),denyButton:{label:"Go Back",variant:X.Secondary,onClick:()=>Z(!1)},approveButton:{label:"Skip",variant:X.Primary,onClick:()=>{o?.(),Z(!1)}}})]})});dn.displayName=dn.name;const cn=r.div`
|
|
324
|
+
padding: 0 24px;
|
|
325
|
+
border-radius: 12px;
|
|
326
|
+
background-color: ${({$codeBgColor:e})=>e||"transparent"};
|
|
327
|
+
`,pn=r.div`
|
|
328
|
+
display: flex;
|
|
329
|
+
flex-direction: column;
|
|
330
|
+
gap: 8px;
|
|
331
|
+
width: 100%;
|
|
332
|
+
padding: 8px;
|
|
333
|
+
border: 1px solid ${({theme:e})=>e.v2.colors.silver[700]};
|
|
334
|
+
border-radius: 12px;
|
|
335
|
+
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
336
|
+
`,un=r.div`
|
|
337
|
+
display: flex;
|
|
338
|
+
align-items: center;
|
|
339
|
+
gap: 4px;
|
|
340
|
+
width: 100%;
|
|
341
|
+
`,hn=r.div`
|
|
342
|
+
flex: 1;
|
|
343
|
+
min-width: 0;
|
|
344
|
+
`,gn=r.div`
|
|
345
|
+
width: 100%;
|
|
346
|
+
max-height: 180px;
|
|
347
|
+
overflow: auto;
|
|
348
|
+
padding: 0 12px;
|
|
349
|
+
|
|
350
|
+
pre {
|
|
351
|
+
margin: 0;
|
|
352
|
+
}
|
|
353
|
+
`,mn=({title:a="YAML",yaml:r,defaultOpen:l,fullHeight:n,bgTint:i="1000",codeBgColor:o,compact:d})=>{const{clickCopy:c,isCopied:p,CopyButton:u}=zt(),h=s(()=>r?[{id:_t(),type:Dt.Button,buttonProps:{variant:X.Text,size:V.S,leftIcon:p?Ut:na,onClick:()=>c(r||""),disabled:p}}]:[],[r,p]);return d?t(pn,{children:[t(un,{children:[e(ia,{size:16}),e(hn,{children:e(O,{size:N.XXS,color:E.Primary,children:a})}),r&&e(u,{value:r})]}),r?e(gn,{children:e(Ht,{code:r,language:"yaml",theme:"duotoneDark"})}):e(_,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})]}):e(ne,{bgTint:i,richTitle:{icon:ia,title:a},actions:h,withCollapse:!0,collapseIsDefaultOpen:l,fullHeight:n,children:e(cn,{$codeBgColor:o,children:r?e(Ht,{code:r,language:"yaml",theme:"duotoneDark"}):e(D,{children:e(_,{title:"YAML not found",subTitle:"The YAML for this resource is not available"})})})})};export{_a as A,vr as B,fr as C,Fa as D,tl as E,lr as G,sl as I,pl as N,dl as O,cl as P,jl as R,Wl as S,Zl as U,an as W,mn as Y,rr as a,Ga as b,br as c,ul as d,yr as e,ml as f,el as g,xr as h,Qr as i,Za as j,Ja as k,Ol as l,Vl as m,hl as n,Gl as o,Yl as p,Nr as q,dn as r,tr as s,Qa as t,za as u,ll as v};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as a,useContext as r,createContext as n,useCallback as s,useState as o,useEffect as i,useRef as l}from"react";import{t as c,
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useMemo as a,useContext as r,createContext as n,useCallback as s,useState as o,useEffect as i,useRef as l}from"react";import{t as c,b8 as d,b9 as u,n as m,S,ba as p,bb as E,bc as I,P as T,bd as f,be as y,bf as _,bg as h,bh as g,bi as N,bj as v,bk as A,bl as R,bm as O,bn as C,bo as G,bp as D,bq as b,br as L,bs as w,bt as P,b0 as U,bu as F,bv as k,o as M,bw as H,bx as x,by as $,bz as K,bA as V,bB as B,x as Y,bC as W,h as j,L as q,bD as z,T as Q,bE as J,bF as X,bG as Z,bH as ee,bI as te,bJ as ae,bK as re,bL as ne,bM as se,bN as oe,bO as ie,bP as le,bQ as ce,bR as de,bS as ue,bT as me,bU as Se,bV as pe,bW as Ee,bX as Ie,bY as Te,ah as fe,ad as ye,af as _e,ae as he,ag as ge,ac as Ne,bZ as ve,b as Ae}from"./ui-components-BlmdA--F.js";import{i as Re,n as Oe,m as Ce,l as Ge,o as De,p as be,v as Le,q as we,u as Pe}from"./helpers-BV_MHw06.js";import{ApolloProvider as Ue,useLazyQuery as Fe,useApolloClient as ke,useQuery as Me}from"@apollo/client/react";import{ErrorLink as He}from"@apollo/client/link/error";import{SetContextLink as xe}from"@apollo/client/link/context";import{getMainDefinition as $e}from"@apollo/client/utilities";import{CombinedGraphQLErrors as Ke,ServerError as Ve}from"@apollo/client/errors";import{HttpLink as Be,ApolloLink as Ye,ApolloClient as We,InMemoryCache as je,gql as qe}from"@apollo/client";const ze=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},Qe=n(null),Je=()=>{const e=r(Qe);if(!e)throw new Error("[ui-kit] useOdigosApi() / useXxxApi() called outside of <OdigosApiProvider>. Make sure the host app mounts the provider at its layout level.");return e},Xe=({apolloConfig:t,operations:r,context:n,children:s})=>{const o=a(()=>(e=>{const t=new Be({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),a=new He(({error:t})=>{Ke.is(t)?t.errors.some(e=>ze(e.message))&&e.onAuthError?.():(Ve.is(t)&&401===t.statusCode||ze(t.message))&&e.onAuthError?.()}),r=new xe(async t=>{const a={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(a,t)}return e.csrfHeader&&Object.assign(a,e.csrfHeader()),{headers:a}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(r,a,t);let s=Ye.from(n);e.wsLink&&(s=Ye.split(({query:e})=>{const t=$e(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,s));const o=e.defaultFetchPolicies;return new We({link:s,cache:new je({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:o?.watchQuery??"cache-and-network"},query:{fetchPolicy:o?.query??"cache-first"},mutate:{fetchPolicy:o?.mutate??"network-only"}}})})(t),[t.httpUrl,t.wsLink,t.credentials,t.clientKey]),i=a(()=>({operations:r,context:n,apolloConfig:t}),[r,n,t]);return e(Ue,{client:o,children:e(Qe.Provider,{value:i,children:s})})},Ze=Qe,et=e=>e.map(e=>`${e.id}:${e.odigosVersion}:${e.type}`).join(","),tt=(e,t,a)=>{const r=t.length?t.map(e=>e.id):a??[],n={...e,connectionIds:r};if(!t.length||c(e.version)>0)return n;const s=t[0];return{...n,version:s.odigosVersion||e.version,platformType:s.type??e.platformType}},at=({connections:t,connectionIds:r,children:n})=>{const s=Je(),o=a(()=>({operations:s.operations,context:tt(s.context,t,r),apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,et(t),r?.join(",")]);return e(Ze.Provider,{value:o,children:n})},rt=(e,t)=>{if(e)return"string"==typeof e?e:p(e,t)},nt=e=>{const{addNotification:t}=d(),a=(a,r,n,s,o)=>t({type:a,title:r,message:n,crdType:e,target:rt(s,e),hideFromHistory:o});return{notify:a,notifyError:(e,t,r)=>a(S.Error,e,t,r),notifySuccess:(e,t,r)=>a(S.Success,e,t,r),notifyPending:(e,t)=>a(S.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:S.Warning,title:m.READONLY,message:u.READONLY_WARNING,hideFromHistory:!0})}}},st=e=>{e({type:S.Warning,title:m.READONLY,message:u.READONLY_WARNING,hideFromHistory:!0})},ot=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),it=(e,t)=>{if(e)return"function"==typeof e?e(t):e},lt=e=>{if(!e)return"Unknown error";if(e instanceof Error)return e.cause instanceof Error?e.cause.message:e.message;if("object"==typeof e){const t=e;return t.cause?.message||t.message||String(e)}return String(e)},ct=(e,t)=>e.client??t,dt=async(e,t,a,r,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(r))return{data:void 0};if(t.run)try{return await t.run(ct(t,e),a,r)}catch(e){return{error:lt(e)}}const s=it(t.document,r);if(!s)return{error:"Query operation not supported in this context"};const o=t.transformVariables?t.transformVariables(a,r):a,i=ct(t,e);try{const e=await i.query({query:s,variables:o,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,r):e.data,error:e.error?lt(e.error):void 0}}catch(e){return{error:lt(e)}}},ut=async(e,t,a,r)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(r))return{error:"Mutation operation not supported in this context"};if(t.run)try{return await t.run(ct(t,e),a,r)}catch(e){return{error:lt(e)}}const n=it(t.document,r);if(!n)return{error:"Mutation operation not supported in this context"};const s=t.transformVariables?t.transformVariables(a,r):a,o=ct(t,e);try{const e=await o.mutate({mutation:n,variables:s});return{data:t.transformResult?t.transformResult(e.data,r):e.data,error:void 0}}catch(e){return{error:lt(e)}}},mt=async(e,t,a,r,n)=>{if(!t)return ot("Multi fetch operation not configured");if(!a.length)return ot("No proxy ids supplied for multi fetch");const s=ct(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(a,r,n),o=[];for(const a of e)try{const e=await s.query({query:a.document,variables:a.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>o.push(e)):a.proxyIDs.forEach(t=>{o.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=lt(e);a.proxyIDs.forEach(e=>o.push({proxyID:e,success:!1,error:t}))}const i=o.filter(e=>e.success).length,l=o.length-i,c=Array.from(new Set(o.filter(e=>!!e.error).map(e=>e.error)));return{results:o,allSucceeded:0===l,anySucceeded:i>0,successCount:i,failureCount:l,error:c.length?c.join(", "):void 0}}const o=await Promise.all(a.map(async a=>{const s={...n,proxyID:a},o=await dt(e,t,r,s);return{proxyID:a,success:!o.error,data:o.data,error:o.error}})),i=o.filter(e=>e.success).length,l=o.length-i,c=Array.from(new Set(o.filter(e=>!!e.error).map(e=>e.error)));return{results:o,allSucceeded:0===l,anySucceeded:i>0,successCount:i,failureCount:l,error:c.length?c.join(", "):void 0}},St=qe`
|
|
2
2
|
query OdigosApiNoop {
|
|
3
3
|
__typename
|
|
4
4
|
}
|