@odigos/ui-kit 0.0.271 → 0.0.273
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-pQ9OGZgF.js → helpers-B3Ne2tBs.js} +1 -1
- package/lib/chunks/{index-BD_WHo50.js → index-C18_FX5i.js} +6 -6
- package/lib/chunks/{source-instrument-form-context-DB1VZT-P.js → source-instrument-form-context-DsVdhWzt.js} +1 -1
- package/lib/chunks/ui-components-Cz05Wzh4.js +1596 -0
- package/lib/components/autocomplete/index.d.ts +1 -0
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_drawers/edit-action-drawer/statuses-card.d.ts +6 -0
- package/lib/containers.js +225 -225
- package/lib/contexts.js +1 -1
- package/lib/functions/get-action-conditions/index.d.ts +2 -0
- package/lib/functions/index.d.ts +2 -0
- package/lib/functions/map-desired-statuses-to-conditions/index.d.ts +2 -0
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets/sampling-rule-form-sections/source-scope.d.ts +1 -0
- package/lib/snippets/wide-drawer/index.d.ts +2 -0
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/actions/index.d.ts +3 -2
- package/lib/types/common/index.d.ts +16 -0
- package/lib/types/workload/index.d.ts +2 -16
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/ui-components-BzgG1abD.js +0 -1596
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.273](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.272...ui-kit-v0.0.273) (2026-07-27)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* render action desired-state statuses in the edit drawer (PLAT-1336) ([#1127](https://github.com/odigos-io/ui-kit/issues/1127)) ([7eb81e6](https://github.com/odigos-io/ui-kit/commit/7eb81e6691eed6698193ffe99b83f5366cb87aad))
|
|
9
|
+
|
|
10
|
+
## [0.0.272](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.271...ui-kit-v0.0.272) (2026-07-27)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Bug Fixes
|
|
14
|
+
|
|
15
|
+
* block CRUD on Instrumentation Rules for OSS installations ([#1120](https://github.com/odigos-io/ui-kit/issues/1120)) ([f0a1627](https://github.com/odigos-io/ui-kit/commit/f0a16277b623b4d07fe10ef79e867e19d1dff9d9))
|
|
16
|
+
|
|
3
17
|
## [0.0.271](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.270...ui-kit-v0.0.271) (2026-07-27)
|
|
4
18
|
|
|
5
19
|
### Features
|
|
@@ -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-Cz05Wzh4.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;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c as r,F as n,d as i,e as o,f as s,g as c,h as d,B as u,i as p,j as h,k as g,W as m,l as v,m as b,V as f,n as y,o as x,p as k,q as C,r as S,C as T,s as $,u as w,I as M,v as A,w as O,x as L,y as P,z as E,N as I,E as R,S as
|
|
1
|
+
import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c as r,F as n,d as i,e as o,f as s,g as c,h as d,B as u,i as p,j as h,k as g,W as m,l as v,m as b,V as f,n as y,o as x,p as k,q as C,r as S,C as T,s as $,u as w,I as M,v as A,w as O,x as L,y as P,z as E,N as I,E as R,S as N,G as V,H as z,U as D,J as X,K as H,L as _,M as q,O as B,Q as j,X as K,Y as U,Z as G,_ as F,$ as W,a0 as J,a1 as Y,a2 as Z,a3 as Q,a4 as ee,T as ae,a5 as te,a6 as le,a7 as re,a8 as ne,a9 as ie,aa as oe,ab as se,ac as ce,ad as de,ae as ue,af as pe,ag as he,b as ge,ah as me,ai as ve,aj as be,ak as fe,al as ye,am as xe,an as ke,ao as Ce,ap as Se,aq as Te,ar as $e,as as we,at as Me,au as Ae,av as Oe,aw as Le,ax as Pe,ay as Ee,az as Ie,aA as Re,aB as Ne,aC as Ve,aD as ze,aE as De,aF as Xe,aG as He,aH as _e,aI as qe,aJ as Be,aK as je,aL as Ke,aM as Ue,aN as Ge,aO as Fe,aP as We,aQ as Je,aR as Ye,aS as Ze,aT as Qe,aU as ea,aV as aa,aW as ta,aX as la,aY as ra,aZ as na,a_ as ia,a$ as oa,b0 as sa,b1 as ca,R as da,b2 as ua,b3 as pa,A as ha,b4 as ga,b5 as ma}from"./ui-components-Cz05Wzh4.js";import{VIcon as va,TrashIcon as ba,PlusIcon as fa,EditIcon as ya,OdigosLogoTextCentral as xa,OdigosLogoTextEnterprise as ka,OdigosLogoTextCommunity as Ca,OdigosLogoTextColoredCentral as Sa,OdigosLogoTextColoredEnterprise as Ta,OdigosLogoTextColoredCommunity as $a,ArrowLeftIcon as wa,ArrowRightIcon as Ma,VSquareIcon as Aa,CopyIcon as Oa,YamlIcon as La}from"../icons.js";import Pa,{useMemo as Ea,useRef as Ia,useCallback as Ra,useState as Na,useEffect as Va,Fragment as za,forwardRef as Da,useImperativeHandle as Xa}from"react";import Ha,{css as _a,useTheme as qa}from"styled-components";import{i as Ba,m as ja,u as Ka,n as Ua,a as Ga,C as Fa,b as Wa,d as Ja,e as Ya,f as Za,g as Qa,h as et,j as at,k as tt}from"./helpers-B3Ne2tBs.js";const lt=/^[a-zA-Z]$/,rt=new Set(["*","+","?"]),nt=new Set(["^","$"]),it={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"},ot=Ha.div`
|
|
2
2
|
padding: 8px 16px;
|
|
3
3
|
border-radius: 6px;
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
@@ -100,7 +100,7 @@ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c
|
|
|
100
100
|
word-break: break-all;
|
|
101
101
|
white-space: pre-wrap;
|
|
102
102
|
user-select: text;
|
|
103
|
-
`,xt=({isOpen:t,regex:m,onClose:v,initialTestString:b=""})=>{const[f,y]=
|
|
103
|
+
`,xt=({isOpen:t,regex:m,onClose:v,initialTestString:b=""})=>{const[f,y]=Na(b),x=Ea(()=>((e,a)=>{if(!e)return{ok:!0,isMatch:!1,message:r.RESULT_EMPTY_REGEX};if(!a)return{ok:!0,isMatch:!1,message:r.RESULT_EMPTY_INPUT};let t;try{t=new RegExp(e)}catch(e){return{ok:!1,message:e instanceof Error?e.message:r.RESULT_INVALID_REGEX_FALLBACK}}const l=t.exec(a);return l?{ok:!0,isMatch:!0,message:l.length>1?l[1]:l[0]}:{ok:!0,isMatch:!1,message:r.RESULT_NO_MATCH}})(m,f),[m,f]),k=x.ok?x.isMatch?"match":"neutral":"error";return e(l,{isOpen:t,header:{title:r.TITLE,onClose:()=>{y(""),v()}},children:e(bt,{children:a(ft,{children:[a(n,{$gap:6,children:[e(i,{label:r.REGEX_LABEL}),e(ct,{pattern:m,"data-id":"regex-tester-regex"}),!m&&e(o,{size:c.XXS,color:s.Secondary,children:r.REGEX_EMPTY_HINT})]}),a(n,{$gap:6,children:[a(d,{$width:"100%",$justifyContent:"space-between",$alignItems:"center",children:[e(i,{label:r.TEST_STRING_LABEL}),e(u,{"data-id":"regex-tester-unescape",label:r.UNESCAPE_LABEL,tooltip:r.UNESCAPE_TOOLTIP,variant:h.Secondary,size:p.S,onClick:()=>y(e=>(e=>{let a="";for(let t=0;t<e.length;t++){if("\\"===e[t]&&t+1<e.length){const l=e[t+1],r="n"===l?"\n":"t"===l?"\t":"r"===l?"\r":'"'===l?'"':"'"===l?"'":"\\"===l?"\\":null;if(null!=r){a+=r,t++;continue}}a+=e[t]}return a})(e)),disabled:(C=f,!/\\["'\\nrt]/.test(C))})]}),e(vt,{name:"regex-tester-test-string","data-id":"regex-tester-test-string",placeholder:r.TEST_STRING_PLACEHOLDER,regex:m,value:f,onChange:y,minHeight:240}),e(g,{helpMessage:r.TEST_STRING_HELP})]}),a(n,{$gap:8,children:[e(i,{label:r.RESULT_LABEL}),e(yt,{$tone:k,"data-id":"regex-tester-result",children:x.message}),x.ok&&x.isMatch&&e(o,{size:c.XXS,color:s.Secondary,children:r.RESULT_CAPTURE_HINT})]})]})})});var C},kt=({isOpen:a,onClose:t,onDeny:l,onApprove:r})=>e(m,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:a,onClose:t,denyButton:{label:"Keep editing",variant:h.Secondary,onClick:()=>{l?.(),t()}},approveButton:{label:"Discard changes",variant:h.Primary,onClick:()=>{r?.(),t()}}}),Ct=({isOpen:a,onClose:t,onViewConnector:l})=>e(m,{isOpen:a,onClose:t,visual:()=>e(f,{scale:1.2,icon:va}),title:b.CLOUD_CONNECTOR_CREATED_MODAL_TITLE,description:b.CLOUD_CONNECTOR_CREATED_MODAL_DESC,denyButton:{label:v.STAY_ON_CONNECTIONS,variant:h.Secondary,onClick:t},approveButton:{label:v.GO_TO_CONNECTOR_OVERVIEW,variant:h.Primary,onClick:l??t}}),St=({isOpen:a,onClose:t,onDeny:l,onApprove:r,action:n="delete",target:i,description:o,overrideApproveButtonLabel:s,overrideDenyButtonLabel:c})=>{const d=n.charAt(0).toUpperCase()+n.substring(1),u=i?.endsWith("s")?"these":"this";return e(m,{title:`${d}${i?` ${i}`:""}?`,description:o??`Are you sure you want to ${n}${i?` ${u} ${i}`:""}?`,isOpen:a,onClose:t,denyButton:{label:c??"Go back",variant:h.Secondary,onClick:()=>{l?.(),t()}},approveButton:{label:s??d,variant:h.Primary,onClick:()=>{r?.(),t()}}})},Tt=({componentType:a,inputType:t,name:l,label:r,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d,setValue:u,errorMessage:p,warnMessage:h,helpMessage:g,dropdownOptions:m,dropdownNoSearch:v,dropdownNoCheckbox:b,timeUnits:f,timeDefaultUnit:E,toggleSize:I=C.L,keyLabel:R,valueLabel:N})=>{switch(a){case y.Input:return e(L,{name:l,type:t,label:r,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",onChange:e=>{const a=e.target.value;u(t===P.Number?""===a?null:Number(a):a)},errorMessage:p,warnMessage:h,helpMessage:g},l);case y.MultiInput:return e(O,{name:l,label:r,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,values:Array.isArray(d)?d:A(d,[]),setValues:e=>u(e),errorMessage:p,warnMessage:h,helpMessage:g,plain:!0},l);case y.KeyValuePair:return e(M,{name:l,label:r,tooltip:n,badge:i,required:s,disabled:c,limitFieldsPerRow:2,columns:[{keyName:"key",label:R||"Key",placeholder:R||"Key"},{keyName:"value",label:N||"Value",placeholder:N||"Value"}],values:Array.isArray(d)?d:A(d,[]),setValues:e=>u(e),errorMessage:p,warnMessage:h,helpMessage:g},l);case y.TextArea:return e(w,{name:l,label:r,tooltip:n,badge:i,required:s,disabled:c,placeholder:o,value:d??"",onChange:e=>u(e.target.value),errorMessage:p,warnMessage:h,helpMessage:g},l);case y.Dropdown:return e($,{name:l,label:r,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,withSearch:!v,options:m?.map(e=>({id:e.id||"",label:e.label||"",withCheckbox:!b}))||[],values:d?[String(d)]:[],setValues:e=>u(e[0]),errorMessage:p,warnMessage:h,helpMessage:g},l);case y.Checkbox:return e(T,{name:l,label:r,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>u(e),disabled:c,errorMessage:p,warnMessage:h,helpMessage:g},l);case y.Time:return e(S,{name:l,label:r,tooltip:n,badge:i,placeholder:o,required:s,disabled:c,value:d??"",setValue:e=>u(e),units:f,defaultUnit:E,errorMessage:p,warnMessage:h,helpMessage:g},l);case y.Toggle:return e(x,{name:l,size:I,labelAlign:k.Right,label:r,tooltip:n,badge:i,value:!0===d||"true"===d,onChange:e=>u(e),disabled:c,errorMessage:p,warnMessage:h,helpMessage:g},l);default:return null}},$t=Ha.div`
|
|
104
104
|
display: flex;
|
|
105
105
|
flex-wrap: wrap;
|
|
106
106
|
gap: 8px;
|
|
@@ -148,7 +148,7 @@ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c
|
|
|
148
148
|
border-radius: 999px;
|
|
149
149
|
background-color: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
150
150
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[600]};
|
|
151
|
-
`,Et={[q.JavaScript]:"Node.js",[q.DotNet]:".NET",[q.Php]:"PHP",[q.Java]:"Java",[q.Go]:"Go",[q.Python]:"Python",[q.Ruby]:"Ruby",[q.Rust]:"Rust"},It=[q.Python,q.Java,q.JavaScript,q.DotNet,q.Php,q.Ruby,q.Go],Rt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Vt(e){return Et[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Nt(e){return null!=e?`${e}. ${Z}`:Z}const zt=({readOnly:a,...t})=>e(a?Ht:qt,{...t}),Dt=({title:t,count:l,children:r})=>a(n,{$gap:6,children:[a(d,{$gap:8,$alignItems:"center",children:[e(o,{size:c.XS,color:s.Primary,nowrap:!0,children:t}),l>1&&e(o,{size:c.XXS,color:s.Secondary,nowrap:!0,children:`(${J})`})]}),e(Ot,{children:r})]}),Xt=()=>{const a=qa();return e(Lt,{children:e(Pt,{children:e(o,{size:c.XXS,color:a.v2.colors.white[500],nowrap:!0,children:Y})})})},Ht=({scopes:t,titleNumber:l})=>{const r=Nt(l);if(Ba(t))return e(E,{bgTint:"900",richTitle:{title:r},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(I,{status:V.Default,message:R,fullWidth:!0})});const n=t.sources??[],i=t.namespaces??[],o=t.languages??[],s=[];return n.length&&s.push({kind:"sources",node:e(Dt,{title:N,count:n.length,children:n.map((a,t)=>{const l=[a.namespace,a.kind,a.name].filter(Boolean),r=l.length?l.join(" / "):D;return e(z,{label:r},`src-${t}-${r}`)})})}),i.length&&s.push({kind:"namespaces",node:e(Dt,{title:X,count:i.length,children:i.map((a,t)=>e(z,{label:a},`ns-${t}-${a}`))})}),o.length&&s.push({kind:"languages",node:e(Dt,{title:H,count:o.length,children:o.map((a,t)=>{const l=B(a);return e(z,{label:Vt(a),leftIcon:l},`lang-${t}-${a}`)})})}),e(E,{bgTint:"900",richTitle:{title:r,subTitle:s.length>1?_:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(E,{bgTint:"800",children:e(At,{children:s.map((t,l)=>a(Pa.Fragment,{children:[l>0&&e(Xt,{}),t.node]},t.kind))})})})},_t=e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all",qt=({scopes:t,onChange:l,sourceOptions:r=[],namespaceOptions:i=[],supportedLanguages:d,titleNumber:u,dataIdPrefix:p="source-scope",slim:h})=>{const g=t??ja(),[m,v]=Va(()=>_t(g)),{sources:b,namespaces:f,languages:y}=g,x=b.length>0||f.length>0||y.length>0;Na(()=>{x&&"all"===m&&v(_t(g))},[x,m]);const k=Ea(()=>Rt.map(e=>"language"===e.value&&0===d?.length?null:{...e,disabled:"all"===e.value&&x}).filter(Boolean),[x]),C=Ea(()=>b.map(e=>`${e.namespace}/${e.kind}/${e.name}`),[b]),S=Ea(()=>[...f],[f]),$=Ea(()=>new Set(y),[y]),w=Ra(e=>{v(e)},[]),M=Ra(e=>{const a=e.map(e=>(e=>{const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}})(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));l({...g,sources:a})},[g,l]),A=Ra(e=>{l({...g,namespaces:e})},[g,l]),O=Ra(e=>{const a=g.languages,t=a.includes(e)?a.filter(a=>a!==e):[...a,e];l({...g,languages:t})},[g,l]),L=!x&&"all"===m,P=(d||It).map(e=>({id:e,label:Et[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:B(e)}));return a(j,{richTitle:h?{title:Nt(u),titleSize:c.XS,titleColor:s.Secondary,tooltip:K}:{title:Nt(u),subTitle:K,subTitleWrap:!0},backgroundColor:h?"transparent":void 0,padding:h?0:void 0,children:[e(I,L?{status:V.Default,message:R,fullWidth:!0,smallIcon:!0}:{status:V.Info,message:_,fullWidth:!0,smallIcon:!0}),e(n,{$alignItems:"flex-start",children:e(U,{options:k,selected:m,setSelected:w})}),"source"===m&&e(G,{multiple:!0,"data-id":`${p}-autocomplete-source`,options:r,value:C,onSelect:M,placeholder:F}),"namespace"===m&&e(G,{multiple:!0,"data-id":`${p}-autocomplete-namespace`,options:i,value:S,onSelect:A,placeholder:"Search namespace"}),"language"===m&&P.length>0&&e($t,{children:P.map(({id:t,label:l,Icon:r})=>{const n=$.has(t);return a(wt,{$selected:n,onClick:()=>O(t),children:[e(T,{name:`${p}-lang-${t}`,size:W.S,value:n,onChange:()=>O(t)}),e(Mt,{children:e(r,{size:20})}),e(o,{size:c.XS,nowrap:!0,children:l})]},t)})})]})},Bt=e=>{if(null!=e){if(!Array.isArray(e)&&"object"==typeof e)return Object.entries(e).map(([e,a])=>({id:e,label:null==a?e:String(a)}));if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)}},jt=e=>{if(!Array.isArray(e)||e.length<3)return;const[a,t,l]=e;return e=>{const r=null==e?.[a]?"":String(e[a]);switch(t){case"=":case"==":case"===":return r===l;case"!=":case"!==":return r!==l;default:return!0}}},Kt=e=>{if(Array.isArray(e))return e.map(e=>{const a=e;return{keyName:String(a.keyName??a.name??""),label:a.label??a.displayName,tooltip:a.tooltip,placeholder:a.placeholder,helpMessage:a.helpMessage,componentType:a.componentType,options:Bt(a.options??a.values),fullRow:a.fullRow,defaultValue:a.defaultValue,withRegexTester:a.withRegexTester,separator:a.separator,copyByColumn:a.copyByColumn,renderCondition:jt(a.renderCondition)}})},Ut=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const a=e;return{id:String(a.id??a.keyName??a.name??""),label:a.label??a.displayName??String(a.id??""),tooltip:a.tooltip,fields:Array.isArray(a.fields)?a.fields.map(Gt):void 0}})},Gt=e=>{const a="string"==typeof e.componentProperties?A(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??a.inputType??a.type,title:e.displayName,tooltip:a.tooltip,placeholder:a.placeholder,helpMessage:a.helpMessage,required:a.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Bt(a.options??a.values),itemWrapperKey:a.itemWrapperKey,columns:Kt(a.columns),limitFieldsPerRow:a.limitFieldsPerRow,variant:a.variant,wrapKey:a.wrapKey,checkboxOptions:Ut(a.options??a.values),checkedValue:a.checkedValue??"true",valueMode:a.valueMode??"object",fields:Array.isArray(a.fields)?a.fields.map(Gt):void 0,addLabel:a.addLabel,itemLabel:a.itemLabel,keyLabel:a.titleKey??a.keyLabel,valueLabel:a.titleValue??a.valueLabel,persistAs:a.persistAs}},Ft=e=>{const a=e.initialValue;if(void 0!==a&&""!==a)return e.componentType===y.CheckboxList?"array"===e.valueMode?A(a,[]):A(a,{}):e.componentType!==y.MultiInput&&e.componentType!==y.MultiTabledInput||!e.wrapKey?e.componentType===y.MultiInput||e.componentType===y.MultiTabledInput?A(a,[]):e.componentType===y.SourceScopes?"null"===a||"{}"===a?ja():Ua(A(a,null)):e.componentType===y.Toggle||e.componentType===y.Checkbox?"true"===a:a:{[e.wrapKey]:A(a,[])}},Wt=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Jt=e=>Array.isArray(e)?e:[],Yt=e=>{const a={};return e.forEach(e=>{a[String(e.key??"")]=String(e.value??"")}),a},Zt=e=>Wt(e)?Object.entries(e).map(([e,a])=>({key:e,value:String(a??"")})):[],Qt=({field:a,value:t,setValue:l,errorMessage:r,disabled:n})=>{const[i,o]=Va(()=>Zt(t));return Na(()=>{const e=Wt(t)?t:{};((e,a)=>{const t=Object.keys(e),l=Object.keys(a);return t.length===l.length&&t.every(t=>Object.prototype.hasOwnProperty.call(a,t)&&a[t]===e[t])})(Yt(i),e)||o(Zt(t))},[t]),e(M,{name:a.name,label:a.title,tooltip:a.tooltip,helpMessage:a.helpMessage,required:a.required,disabled:n,limitFieldsPerRow:2,columns:[{keyName:"key",label:a.keyLabel||"Key",placeholder:a.keyLabel||"Key"},{keyName:"value",label:a.valueLabel||"Value",placeholder:a.valueLabel||"Value"}],values:i,setValues:e=>{o(e),l(Yt(e))},errorMessage:r})},el=({field:l,value:r,setValue:d,errorMessage:u,disabled:p,keyValuePersistAs:h,sourceOptions:m,namespaceOptions:v})=>{const{name:b,componentType:f,inputType:x,title:k,tooltip:C,placeholder:S,helpMessage:$,required:w,initialValue:A,options:L,itemWrapperKey:P,columns:E,limitFieldsPerRow:I,variant:R,wrapKey:V,checkboxOptions:N}=l,[z,D]=Va({open:!1,value:""});if(f===y.SourceScopes)return e(zt,{scopes:Ua(r),onChange:e=>d(e),sourceOptions:m,namespaceOptions:v,dataIdPrefix:`dynamic-field-${b}`,slim:!0});if(f===y.CheckboxList&&"array"===l.valueMode){const t=Jt(r),l=(e,a)=>d(a?[...t.filter(a=>a!==e),e]:t.filter(a=>a!==e));return a(n,{$gap:12,children:[k&&e(i,{label:k,tooltip:C,required:w}),e(n,{$gap:8,children:(N||[]).map(a=>{const r=e(T,{name:a.id,label:a.label,value:t.includes(a.id),disabled:p,onChange:e=>l(a.id,e)},a.id);return a.tooltip?e(ae,{text:a.tooltip,withIcon:!0,children:r},a.id):r})}),e(g,{errorMessage:u,helpMessage:$})]})}if(f===y.CheckboxList){const t=Wt(r)?r:{},i=(e=>"emptyObject"!==e.checkedValue||{})(l),m=e=>"emptyObject"===l.checkedValue?Wt(e):!!e;return a(n,{$gap:12,children:[k&&e(o,{size:c.XS,color:s.Secondary,nowrap:!0,children:k}),e(n,{$gap:12,children:(N||[]).map(l=>{const r=t[l.id],o=m(r),s=Wt(r)?r:{},c=e(T,{label:l.label,value:o,disabled:p,onChange:e=>d({...t,[l.id]:e?Wt(r)?r:i:null})}),u=l.tooltip?e(ae,{text:l.tooltip,withIcon:!0,children:c}):c,g=o&&l.fields?.length?e(n,{$gap:12,$padding:"0 0 0 24px",children:l.fields.map(a=>e(el,{field:a,value:s[a.name],setValue:e=>d({...t,[l.id]:{...s,[a.name]:e}}),disabled:p,keyValuePersistAs:h},`${b}-${l.id}-${a.name}`))}):null;return a(n,{$gap:12,children:[u,g]},l.id)})}),e(g,{errorMessage:u,helpMessage:$})]})}if(f===y.MultiTabledInput){const l=Jt(V?r?.[V]:r),n=e=>d(V?{...Wt(r)?r:{},[V]:e}:e),i=(E||[]).some(e=>e.withRegexTester);return a(t,{children:[e("cards"===R?te:M,{name:b,label:k,tooltip:C,helpMessage:$,required:w,disabled:p,columns:E||[],limitFieldsPerRow:I,values:l,setValues:n,errorMessage:u,onTestRegex:i?e=>D({open:!0,value:e}):void 0}),i&&e(xt,{isOpen:z.open,regex:z.value,onClose:()=>D({open:!1,value:""})})]})}if(f===y.MultiInput&&V){const a=Jt(r?.[V]);return e(O,{name:b,label:k,tooltip:C,helpMessage:$,required:w,disabled:p,placeholder:S,values:a,setValues:e=>d({...Wt(r)?r:{},[V]:e}),errorMessage:u})}if(f===y.MultiInput&&P){const a=Jt(r).map(e=>String(e?.[P]??""));return e(O,{name:b,label:k,tooltip:C,helpMessage:$,required:w,disabled:p,placeholder:S,values:a,setValues:e=>d(e.map(e=>({[P]:e}))),errorMessage:u})}return f===y.KeyValuePair?"map"===(l.persistAs??h)?e(Qt,{field:l,value:r,setValue:d,errorMessage:u,disabled:p}):e(Tt,{componentType:f,name:b,label:k,tooltip:C,helpMessage:$,disabled:p,required:w,errorMessage:u,keyLabel:l.keyLabel,valueLabel:l.valueLabel,value:r??[],setValue:d}):e(Tt,{componentType:f,inputType:x,name:b,label:k,tooltip:C,helpMessage:$,disabled:p,required:w,placeholder:S,errorMessage:u,dropdownOptions:L,value:(null==r?A:r)??"",setValue:d})},al=({field:l,value:r,setValue:o,disabled:s,keyValuePersistAs:c,sourceOptions:g,namespaceOptions:m})=>{const v=qa(),b=Jt(r),f=b.length?b:[{}],y=l.fields||[],x=e=>o(e);return a(t,{children:[f.map((t,r)=>a(za,{children:[e(ee,{}),a(n,{$gap:12,children:[a(d,{$justifyContent:"space-between",$alignItems:"center",children:[e(i,{label:`${l.itemLabel||l.title||"Item"} ${r+1}`}),e(u,{leftIcon:()=>e(ba,{fill:v.v2.colors.red[500]}),variant:h.Secondary,size:p.S,onClick:()=>(e=>{const a=f.filter((a,t)=>t!==e);x(a)})(r),disabled:s||1===f.length})]}),y.map(a=>e(el,{field:a,value:t[a.name],setValue:e=>((e,a,t)=>x(f.map((l,r)=>r===e?{...l,[a]:t}:l)))(r,a.name,e),disabled:s,keyValuePersistAs:c,sourceOptions:g,namespaceOptions:m},`${l.name}-group-${r}-${a.name}`))]})]},`${l.name}-group-${r}`)),e(u,{variant:h.Secondary,label:l.addLabel||"Add",leftIcon:fa,onClick:()=>x([...f,{}]),disabled:s}),e(ee,{})]})},tl=({field:t,value:l,setValue:r,errorMessage:o,disabled:s})=>a(n,{$gap:12,children:[t.title&&e(i,{label:t.title,tooltip:t.tooltip,required:t.required}),e(n,{$gap:8,children:(t.checkboxOptions||[]).map(a=>{const t=e(T,{name:a.id,label:a.label,value:!0===l?.[a.id],disabled:s,onChange:e=>r(a.id,e)},a.id);return a.tooltip?e(ae,{text:a.tooltip,withIcon:!0,children:t},a.id):t})}),e(g,{errorMessage:o,helpMessage:t.helpMessage})]}),ll=({signals:a,fields:l,value:r,setValue:n,formErrors:i,disabled:o,seedInitialValues:s,keyValuePersistAs:c="map",sourceOptions:d,namespaceOptions:u})=>{const{isVm:p}=Ka(),h=(l||[]).filter(e=>!!e).map(e=>Gt(e));return Na(()=>{if(!s)return;const e=r||{},a={};h.forEach(t=>{if(t.componentType===y.SourceScopes&&p)return;const l=t.componentType===y.SourceScopes?Ft(t)??ja():Ft(t);if(void 0===l)return;if(t.componentType===y.CheckboxList&&"flatFields"===t.valueMode&&Wt(l))return void Object.entries(l).forEach(([t,l])=>{void 0!==e[t]&&null!==e[t]||(a[t]=l)});const r=e[t.name];if(t.componentType===y.SourceScopes){if(void 0!==r)return}else if(null!=r)return;a[t.name]=Wt(l)&&Wt(a[t.name])?{...a[t.name],...l}:l}),Object.entries(a).forEach(([e,a])=>n(e,a))},[]),e(t,{children:h.map(t=>{const l=Object.entries(r||{}).map(([e,a])=>({name:e,key:e,value:a}));if(t.renderCondition&&!Q(t.renderCondition,a,l))return null;if(t.componentType===y.SourceScopes&&p)return null;const s=r?.[t.name];if(t.componentType===y.FieldGroup)return e(al,{field:t,value:s,setValue:e=>n(t.name,e),disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},t.name);if(t.componentType===y.CheckboxList&&"flatFields"===t.valueMode){const a=t.checkboxOptions?.map(e=>i[e.id]).find(Boolean);return e(tl,{field:t,value:r||{},setValue:n,errorMessage:a,disabled:o},t.name)}return e(el,{field:t,value:s,setValue:e=>n(t.name,e),errorMessage:i[t.name],disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},t.name)})})},rl=ll,nl=Ha.div`
|
|
151
|
+
`,Et={[q.JavaScript]:"Node.js",[q.DotNet]:".NET",[q.Php]:"PHP",[q.Java]:"Java",[q.Go]:"Go",[q.Python]:"Python",[q.Ruby]:"Ruby",[q.Rust]:"Rust"},It=[q.Python,q.Java,q.JavaScript,q.DotNet,q.Php,q.Ruby,q.Go],Rt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function Nt(e){return Et[e]||e.charAt(0).toUpperCase()+e.slice(1)}function Vt(e){return null!=e?`${e}. ${Z}`:Z}const zt=({readOnly:a,...t})=>e(a?Ht:qt,{...t}),Dt=({title:t,count:l,children:r})=>a(n,{$gap:6,children:[a(d,{$gap:8,$alignItems:"center",children:[e(o,{size:c.XS,color:s.Primary,nowrap:!0,children:t}),l>1&&e(o,{size:c.XXS,color:s.Secondary,nowrap:!0,children:`(${J})`})]}),e(Ot,{children:r})]}),Xt=()=>{const a=qa();return e(Lt,{children:e(Pt,{children:e(o,{size:c.XXS,color:a.v2.colors.white[500],nowrap:!0,children:Y})})})},Ht=({scopes:t,titleNumber:l})=>{const r=Vt(l);if(Ba(t))return e(E,{bgTint:"900",richTitle:{title:r},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(I,{status:N.Default,message:R,fullWidth:!0})});const n=t.sources??[],i=t.namespaces??[],o=t.languages??[],s=[];return n.length&&s.push({kind:"sources",node:e(Dt,{title:V,count:n.length,children:n.map((a,t)=>{const l=[a.namespace,a.kind,a.name].filter(Boolean),r=l.length?l.join(" / "):D;return e(z,{label:r},`src-${t}-${r}`)})})}),i.length&&s.push({kind:"namespaces",node:e(Dt,{title:X,count:i.length,children:i.map((a,t)=>e(z,{label:a},`ns-${t}-${a}`))})}),o.length&&s.push({kind:"languages",node:e(Dt,{title:H,count:o.length,children:o.map((a,t)=>{const l=B(a);return e(z,{label:Nt(a),leftIcon:l},`lang-${t}-${a}`)})})}),e(E,{bgTint:"900",richTitle:{title:r,subTitle:s.length>1?_:void 0},withCollapse:!0,collapseIsDefaultOpen:!0,children:e(E,{bgTint:"800",children:e(At,{children:s.map((t,l)=>a(Pa.Fragment,{children:[l>0&&e(Xt,{}),t.node]},t.kind))})})})},_t=e=>e.sources.length>0?"source":e.namespaces.length>0?"namespace":e.languages.length>0?"language":"all",qt=({scopes:t,onChange:l,sourceOptions:r=[],namespaceOptions:i=[],supportedLanguages:d,titleNumber:u,dataIdPrefix:p="source-scope",slim:h,disabled:g})=>{const m=t??ja(),[v,b]=Na(()=>_t(m)),{sources:f,namespaces:y,languages:x}=m,k=f.length>0||y.length>0||x.length>0;Va(()=>{k&&"all"===v&&b(_t(m))},[k,v]);const C=Ea(()=>Rt.map(e=>"language"===e.value&&0===d?.length?null:{...e,disabled:"all"===e.value&&k}).filter(Boolean),[k]),S=Ea(()=>f.map(e=>`${e.namespace}/${e.kind}/${e.name}`),[f]),$=Ea(()=>[...y],[y]),w=Ea(()=>new Set(x),[x]),M=Ra(e=>{b(e)},[]),A=Ra(e=>{const a=e.map(e=>(e=>{const a=e.split("/");return 3!==a.length?null:{namespace:a[0],kind:a[1],name:a[2]}})(e)).filter(e=>null!=e).map(e=>({namespace:e.namespace,kind:e.kind,name:e.name}));l({...m,sources:a})},[m,l]),O=Ra(e=>{l({...m,namespaces:e})},[m,l]),L=Ra(e=>{const a=m.languages,t=a.includes(e)?a.filter(a=>a!==e):[...a,e];l({...m,languages:t})},[m,l]),P=!k&&"all"===v,E=(d||It).map(e=>({id:e,label:Et[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:B(e)}));return a(j,{richTitle:h?{title:Vt(u),titleSize:c.XS,titleColor:s.Secondary,tooltip:K}:{title:Vt(u),subTitle:K,subTitleWrap:!0},backgroundColor:h?"transparent":void 0,padding:h?0:void 0,children:[e(I,P?{status:N.Default,message:R,fullWidth:!0,smallIcon:!0}:{status:N.Info,message:_,fullWidth:!0,smallIcon:!0}),e(n,{$alignItems:"flex-start",children:e(U,{options:C,selected:v,setSelected:M,disabled:g})}),"source"===v&&e(G,{multiple:!0,"data-id":`${p}-autocomplete-source`,options:r,value:S,onSelect:A,placeholder:F,disabled:g}),"namespace"===v&&e(G,{multiple:!0,"data-id":`${p}-autocomplete-namespace`,options:i,value:$,onSelect:O,placeholder:"Search namespace",disabled:g}),"language"===v&&E.length>0&&e($t,{children:E.map(({id:t,label:l,Icon:r})=>{const n=w.has(t);return a(wt,{$selected:n,onClick:()=>L(t),children:[e(T,{name:`${p}-lang-${t}`,size:W.S,value:n,onChange:()=>L(t),disabled:g}),e(Mt,{children:e(r,{size:20})}),e(o,{size:c.XS,nowrap:!0,children:l})]},t)})})]})},Bt=e=>{if(null!=e){if(!Array.isArray(e)&&"object"==typeof e)return Object.entries(e).map(([e,a])=>({id:e,label:null==a?e:String(a)}));if(Array.isArray(e))return e.map(e=>"string"==typeof e?{id:e,label:e}:e)}},jt=e=>{if(!Array.isArray(e)||e.length<3)return;const[a,t,l]=e;return e=>{const r=null==e?.[a]?"":String(e[a]);switch(t){case"=":case"==":case"===":return r===l;case"!=":case"!==":return r!==l;default:return!0}}},Kt=e=>{if(Array.isArray(e))return e.map(e=>{const a=e;return{keyName:String(a.keyName??a.name??""),label:a.label??a.displayName,tooltip:a.tooltip,placeholder:a.placeholder,helpMessage:a.helpMessage,componentType:a.componentType,options:Bt(a.options??a.values),fullRow:a.fullRow,defaultValue:a.defaultValue,withRegexTester:a.withRegexTester,separator:a.separator,copyByColumn:a.copyByColumn,renderCondition:jt(a.renderCondition)}})},Ut=e=>{if(Array.isArray(e))return e.map(e=>{if("string"==typeof e)return{id:e,label:e};const a=e;return{id:String(a.id??a.keyName??a.name??""),label:a.label??a.displayName??String(a.id??""),tooltip:a.tooltip,fields:Array.isArray(a.fields)?a.fields.map(Gt):void 0}})},Gt=e=>{const a="string"==typeof e.componentProperties?A(e.componentProperties,{}):e.componentProps||{};return{name:e.name,componentType:e.componentType,inputType:e.inputType??a.inputType??a.type,title:e.displayName,tooltip:a.tooltip,placeholder:a.placeholder,helpMessage:a.helpMessage,required:a.required,initialValue:e.initialValue,renderCondition:e.renderCondition,options:Bt(a.options??a.values),itemWrapperKey:a.itemWrapperKey,columns:Kt(a.columns),limitFieldsPerRow:a.limitFieldsPerRow,variant:a.variant,wrapKey:a.wrapKey,checkboxOptions:Ut(a.options??a.values),checkedValue:a.checkedValue??"true",valueMode:a.valueMode??"object",fields:Array.isArray(a.fields)?a.fields.map(Gt):void 0,addLabel:a.addLabel,itemLabel:a.itemLabel,keyLabel:a.titleKey??a.keyLabel,valueLabel:a.titleValue??a.valueLabel,persistAs:a.persistAs}},Ft=e=>{const a=e.initialValue;if(void 0!==a&&""!==a)return e.componentType===y.CheckboxList?"array"===e.valueMode?A(a,[]):A(a,{}):e.componentType!==y.MultiInput&&e.componentType!==y.MultiTabledInput||!e.wrapKey?e.componentType===y.MultiInput||e.componentType===y.MultiTabledInput?A(a,[]):e.componentType===y.SourceScopes?"null"===a||"{}"===a?ja():Ua(A(a,null)):e.componentType===y.Toggle||e.componentType===y.Checkbox?"true"===a:a:{[e.wrapKey]:A(a,[])}},Wt=e=>"object"==typeof e&&null!==e&&!Array.isArray(e),Jt=e=>Array.isArray(e)?e:[],Yt=e=>{const a={};return e.forEach(e=>{a[String(e.key??"")]=String(e.value??"")}),a},Zt=e=>Wt(e)?Object.entries(e).map(([e,a])=>({key:e,value:String(a??"")})):[],Qt=({field:a,value:t,setValue:l,errorMessage:r,disabled:n})=>{const[i,o]=Na(()=>Zt(t));return Va(()=>{const e=Wt(t)?t:{};((e,a)=>{const t=Object.keys(e),l=Object.keys(a);return t.length===l.length&&t.every(t=>Object.prototype.hasOwnProperty.call(a,t)&&a[t]===e[t])})(Yt(i),e)||o(Zt(t))},[t]),e(M,{name:a.name,label:a.title,tooltip:a.tooltip,helpMessage:a.helpMessage,required:a.required,disabled:n,limitFieldsPerRow:2,columns:[{keyName:"key",label:a.keyLabel||"Key",placeholder:a.keyLabel||"Key"},{keyName:"value",label:a.valueLabel||"Value",placeholder:a.valueLabel||"Value"}],values:i,setValues:e=>{o(e),l(Yt(e))},errorMessage:r})},el=({field:l,value:r,setValue:d,errorMessage:u,disabled:p,keyValuePersistAs:h,sourceOptions:m,namespaceOptions:v})=>{const{name:b,componentType:f,inputType:x,title:k,tooltip:C,placeholder:S,helpMessage:$,required:w,initialValue:A,options:L,itemWrapperKey:P,columns:E,limitFieldsPerRow:I,variant:R,wrapKey:N,checkboxOptions:V}=l,[z,D]=Na({open:!1,value:""});if(f===y.SourceScopes)return e(zt,{scopes:Ua(r),onChange:e=>d(e),sourceOptions:m,namespaceOptions:v,dataIdPrefix:`dynamic-field-${b}`,slim:!0});if(f===y.CheckboxList&&"array"===l.valueMode){const t=Jt(r),l=(e,a)=>d(a?[...t.filter(a=>a!==e),e]:t.filter(a=>a!==e));return a(n,{$gap:12,children:[k&&e(i,{label:k,tooltip:C,required:w}),e(n,{$gap:8,children:(V||[]).map(a=>{const r=e(T,{name:a.id,label:a.label,value:t.includes(a.id),disabled:p,onChange:e=>l(a.id,e)},a.id);return a.tooltip?e(ae,{text:a.tooltip,withIcon:!0,children:r},a.id):r})}),e(g,{errorMessage:u,helpMessage:$})]})}if(f===y.CheckboxList){const t=Wt(r)?r:{},i=(e=>"emptyObject"!==e.checkedValue||{})(l),m=e=>"emptyObject"===l.checkedValue?Wt(e):!!e;return a(n,{$gap:12,children:[k&&e(o,{size:c.XS,color:s.Secondary,nowrap:!0,children:k}),e(n,{$gap:12,children:(V||[]).map(l=>{const r=t[l.id],o=m(r),s=Wt(r)?r:{},c=e(T,{label:l.label,value:o,disabled:p,onChange:e=>d({...t,[l.id]:e?Wt(r)?r:i:null})}),u=l.tooltip?e(ae,{text:l.tooltip,withIcon:!0,children:c}):c,g=o&&l.fields?.length?e(n,{$gap:12,$padding:"0 0 0 24px",children:l.fields.map(a=>e(el,{field:a,value:s[a.name],setValue:e=>d({...t,[l.id]:{...s,[a.name]:e}}),disabled:p,keyValuePersistAs:h},`${b}-${l.id}-${a.name}`))}):null;return a(n,{$gap:12,children:[u,g]},l.id)})}),e(g,{errorMessage:u,helpMessage:$})]})}if(f===y.MultiTabledInput){const l=Jt(N?r?.[N]:r),n=e=>d(N?{...Wt(r)?r:{},[N]:e}:e),i=(E||[]).some(e=>e.withRegexTester);return a(t,{children:[e("cards"===R?te:M,{name:b,label:k,tooltip:C,helpMessage:$,required:w,disabled:p,columns:E||[],limitFieldsPerRow:I,values:l,setValues:n,errorMessage:u,onTestRegex:i?e=>D({open:!0,value:e}):void 0}),i&&e(xt,{isOpen:z.open,regex:z.value,onClose:()=>D({open:!1,value:""})})]})}if(f===y.MultiInput&&N){const a=Jt(r?.[N]);return e(O,{name:b,label:k,tooltip:C,helpMessage:$,required:w,disabled:p,placeholder:S,values:a,setValues:e=>d({...Wt(r)?r:{},[N]:e}),errorMessage:u})}if(f===y.MultiInput&&P){const a=Jt(r).map(e=>String(e?.[P]??""));return e(O,{name:b,label:k,tooltip:C,helpMessage:$,required:w,disabled:p,placeholder:S,values:a,setValues:e=>d(e.map(e=>({[P]:e}))),errorMessage:u})}return f===y.KeyValuePair?"map"===(l.persistAs??h)?e(Qt,{field:l,value:r,setValue:d,errorMessage:u,disabled:p}):e(Tt,{componentType:f,name:b,label:k,tooltip:C,helpMessage:$,disabled:p,required:w,errorMessage:u,keyLabel:l.keyLabel,valueLabel:l.valueLabel,value:r??[],setValue:d}):e(Tt,{componentType:f,inputType:x,name:b,label:k,tooltip:C,helpMessage:$,disabled:p,required:w,placeholder:S,errorMessage:u,dropdownOptions:L,value:(null==r?A:r)??"",setValue:d})},al=({field:l,value:r,setValue:o,disabled:s,keyValuePersistAs:c,sourceOptions:g,namespaceOptions:m})=>{const v=qa(),b=Jt(r),f=b.length?b:[{}],y=l.fields||[],x=e=>o(e);return a(t,{children:[f.map((t,r)=>a(za,{children:[e(ee,{}),a(n,{$gap:12,children:[a(d,{$justifyContent:"space-between",$alignItems:"center",children:[e(i,{label:`${l.itemLabel||l.title||"Item"} ${r+1}`}),e(u,{leftIcon:()=>e(ba,{fill:v.v2.colors.red[500]}),variant:h.Secondary,size:p.S,onClick:()=>(e=>{const a=f.filter((a,t)=>t!==e);x(a)})(r),disabled:s||1===f.length})]}),y.map(a=>e(el,{field:a,value:t[a.name],setValue:e=>((e,a,t)=>x(f.map((l,r)=>r===e?{...l,[a]:t}:l)))(r,a.name,e),disabled:s,keyValuePersistAs:c,sourceOptions:g,namespaceOptions:m},`${l.name}-group-${r}-${a.name}`))]})]},`${l.name}-group-${r}`)),e(u,{variant:h.Secondary,label:l.addLabel||"Add",leftIcon:fa,onClick:()=>x([...f,{}]),disabled:s}),e(ee,{})]})},tl=({field:t,value:l,setValue:r,errorMessage:o,disabled:s})=>a(n,{$gap:12,children:[t.title&&e(i,{label:t.title,tooltip:t.tooltip,required:t.required}),e(n,{$gap:8,children:(t.checkboxOptions||[]).map(a=>{const t=e(T,{name:a.id,label:a.label,value:!0===l?.[a.id],disabled:s,onChange:e=>r(a.id,e)},a.id);return a.tooltip?e(ae,{text:a.tooltip,withIcon:!0,children:t},a.id):t})}),e(g,{errorMessage:o,helpMessage:t.helpMessage})]}),ll=({signals:a,fields:l,value:r,setValue:n,formErrors:i,disabled:o,seedInitialValues:s,keyValuePersistAs:c="map",sourceOptions:d,namespaceOptions:u})=>{const{isVm:p}=Ka(),h=(l||[]).filter(e=>!!e).map(e=>Gt(e));return Va(()=>{if(!s)return;const e=r||{},a={};h.forEach(t=>{if(t.componentType===y.SourceScopes&&p)return;const l=t.componentType===y.SourceScopes?Ft(t)??ja():Ft(t);if(void 0===l)return;if(t.componentType===y.CheckboxList&&"flatFields"===t.valueMode&&Wt(l))return void Object.entries(l).forEach(([t,l])=>{void 0!==e[t]&&null!==e[t]||(a[t]=l)});const r=e[t.name];if(t.componentType===y.SourceScopes){if(void 0!==r)return}else if(null!=r)return;a[t.name]=Wt(l)&&Wt(a[t.name])?{...a[t.name],...l}:l}),Object.entries(a).forEach(([e,a])=>n(e,a))},[]),e(t,{children:h.map(t=>{const l=Object.entries(r||{}).map(([e,a])=>({name:e,key:e,value:a}));if(t.renderCondition&&!Q(t.renderCondition,a,l))return null;if(t.componentType===y.SourceScopes&&p)return null;const s=r?.[t.name];if(t.componentType===y.FieldGroup)return e(al,{field:t,value:s,setValue:e=>n(t.name,e),disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},t.name);if(t.componentType===y.CheckboxList&&"flatFields"===t.valueMode){const a=t.checkboxOptions?.map(e=>i[e.id]).find(Boolean);return e(tl,{field:t,value:r||{},setValue:n,errorMessage:a,disabled:o},t.name)}return e(el,{field:t,value:s,setValue:e=>n(t.name,e),errorMessage:i[t.name],disabled:o,keyValuePersistAs:c,sourceOptions:d,namespaceOptions:u},t.name)})})},rl=ll,nl=Ha.div`
|
|
152
152
|
display: flex;
|
|
153
153
|
align-items: center;
|
|
154
154
|
gap: 24px;
|
|
@@ -193,7 +193,7 @@ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c
|
|
|
193
193
|
align-items: flex-end;
|
|
194
194
|
gap: 16px;
|
|
195
195
|
margin-bottom: 12px;
|
|
196
|
-
`,Al="Any",Ol="Kafka topic",Ll=()=>e("div",{style:{marginBottom:"8px"},children:e(o,{size:c.XS,weight:500,children:"And"})}),Pl=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],El=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Il=[{id:"",label:Al},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Rl=a=>a.readOnly?e(
|
|
196
|
+
`,Al="Any",Ol="Kafka topic",Ll=()=>e("div",{style:{marginBottom:"8px"},children:e(o,{size:c.XS,weight:500,children:"And"})}),Pl=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],El=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Il=[{id:"",label:Al},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}],Rl=a=>a.readOnly?e(Nl,{data:a.data}):e(Vl,{category:a.category,formState:a.formState,onChange:a.onChange}),Nl=({data:t})=>{const l=Ea(()=>(e=>{if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:Ne,value:Re},{id:"route",title:Ae,value:a.httpServer.route||a.httpServer.routePrefix||Ve},{id:"method",title:Ee,value:a.httpServer.method||Al}];if(a?.httpClient){const e=[{id:"type",title:Ne,value:ze}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:Ae,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||Ve}),e.push({id:"method",title:Ee,value:a.httpClient.method||Al}),e}return[{id:"type",title:Ne,value:De}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:Ne,value:Re},{id:"route",title:Ae,value:a.httpServer.route||a.httpServer.routePrefix||Ve},{id:"method",title:Ee,value:a.httpServer.method||Al}]:a?.kafkaConsumer?[{id:"type",title:Ne,value:Xe},{id:"topic",title:Ol,value:a.kafkaConsumer.kafkaTopic||Ve}]:a?.kafkaProducer?[{id:"type",title:Ne,value:He},{id:"topic",title:Ol,value:a.kafkaProducer.kafkaTopic||Ve}]:[{id:"type",title:Ne,value:De}]})(t),[t]);return e(j,{richTitle:{title:ke},children:e(kl,{children:l.map(({id:t,title:l,value:r})=>a(Cl,{children:[e(o,{size:c.XXXS,color:s.Secondary,nowrap:!0,children:l}),e(o,{size:c.XS,nowrap:!0,children:r})]},t))})})},Vl=({category:t,formState:l,onChange:r})=>{const i=Ea(()=>"noisy"===t?Pl:El,[t]),o=Ra(e=>r({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[r]),s=Ra(e=>a=>{a&&r({routeType:e,route:""})},[r]),c=Ra(e=>r({route:e.target.value}),[r]),d=Ra(e=>r({serverAddress:e.target.value}),[r]),u=Ra(e=>r({method:e[0]||""}),[r]),g=Ra(e=>r({kafkaTopic:e.target.value}),[r]),m="httpServer"===l.operationType||"httpClient"===l.operationType,v="kafkaConsumer"===l.operationType||"kafkaProducer"===l.operationType,b="httpClient"===l.operationType?Me:Ae,f="httpClient"===l.operationType?Oe:Le;return a(j,{richTitle:{title:`2. ${ke}`,subTitle:Ce},children:[e(n,{$alignItems:"flex-start",children:e(U,{options:i,selected:l.operationType,setSelected:o})}),m&&a(Sl,{children:["httpClient"===l.operationType&&a(Ml,{children:[e(L,{name:"sampling-input-server-address",label:Te,placeholder:Se,value:l.serverAddress,onChange:d}),e(Ll,{})]}),a(Tl,{children:[a($l,{children:[e(wl,{children:e($e,{"data-id":"sampling-radio-route",value:"route"===l.routeType,onChange:s("route")})}),e(L,{name:"sampling-input-route",label:b,placeholder:we,value:"route"===l.routeType?l.route:"",onChange:c,disabled:"route"!==l.routeType})]}),a($l,{children:[e(wl,{children:e($e,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===l.routeType,onChange:s("routePrefix")})}),e(L,{name:"sampling-input-route-prefix",label:f,placeholder:we,value:"routePrefix"===l.routeType?l.route:"",onChange:c,disabled:"routePrefix"!==l.routeType})]})]}),a(Ml,{children:[e(Ll,{}),e(Pe,{label:Ee,items:Il,selectedIds:[l.method||""],setSelectedIds:e=>u(e),buttonProps:{"data-id":"sampling-btn-method",label:Il.find(e=>e.id===l.method)?.label||Al,size:p.S,variant:h.Secondary}})]})]}),v&&e(L,{name:"sampling-input-kafka-topic",label:Ie,placeholder:"Type kafka topic",value:l.kafkaTopic,onChange:g,width:"320px"})]})},zl=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],Dl=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}],Xl=a=>a.readOnly?e(Hl,{data:a.data}):e(_l,{category:a.category,formState:a.formState,onChange:a.onChange}),Hl=({data:t})=>{const l=Ea(()=>(e=>{switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:qe,method:Ke,description:Be,value:`${e.rule.percentageAtLeast}%`}:{title:qe,method:Ge,description:null,value:null};case"noisy":return Ja(e.rule.percentageAtMost)?{title:qe,method:Ue,description:null,value:null}:{title:qe,method:Ke,description:je,value:`${e.rule.percentageAtMost}%`};case"costReduction":return{title:qe,method:Ke,description:je,value:`${e.rule.percentageAtMost}%`}}})(t),[t]),r=[{id:"method",title:Ee,value:l.method},...null!=l.description?[{id:"value",title:l.description,value:l.value}]:[]];return e(j,{richTitle:{title:l.title},children:e(kl,{children:r.map(({id:t,title:l,value:r})=>a(Cl,{children:[e(o,{size:c.XXXS,color:s.Secondary,nowrap:!0,children:l}),e(o,{size:c.XS,nowrap:!0,children:r})]},t))})})},_l=({category:t,formState:l,onChange:r})=>{const i="highlyRelevant"===t,o=i?Dl:zl,s=`${i?4:3}. ${qe}`,c=_e[t],d=i?Be:je,u="noisy"===t?gl:hl,p=Ra(e=>r({percentageMode:e}),[r]),h=Ra(e=>r({percentagePreset:e}),[r]),g=Ra(e=>r({customPercentage:e.target.value}),[r]);return a(j,{richTitle:{title:s,subTitle:c},children:["costReduction"!==t&&e(n,{$alignItems:"flex-start",children:e(U,{options:o,selected:l.percentageMode,setSelected:p})}),("costReduction"===t||"sample"===l.percentageMode)&&e(vl,{description:d,options:u,selected:l.percentagePreset,onSelect:h,customName:"sampling-input-custom-percentage",customPlaceholder:"5%",customValue:l.customPercentage,onCustomChange:g,customInputType:P.Decimal,customMin:0,customMax:100})]})},ql=Ha.div`
|
|
197
197
|
display: flex;
|
|
198
198
|
align-items: flex-end;
|
|
199
199
|
gap: 16px;
|
|
@@ -203,7 +203,7 @@ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c
|
|
|
203
203
|
`,jl=Ha.div`
|
|
204
204
|
flex: 1;
|
|
205
205
|
min-width: 0;
|
|
206
|
-
`;function Kl(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":aa[e.category]}const Ul=a=>a.readOnly?e(Gl,{data:a.data}):e(Fl,{formState:a.formState,onChange:a.onChange}),Gl=({data:t})=>{const l=Ea(()=>[{id:"name",title:We,value:t.rule.name||Fe},{id:"type",title:Je,value:Kl(t)}],[t]),r=t.rule.notes||
|
|
206
|
+
`;function Kl(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":aa[e.category]}const Ul=a=>a.readOnly?e(Gl,{data:a.data}):e(Fl,{formState:a.formState,onChange:a.onChange}),Gl=({data:t})=>{const l=Ea(()=>[{id:"name",title:We,value:t.rule.name||Fe},{id:"type",title:Je,value:Kl(t)}],[t]),r=t.rule.notes||Ve;return a(j,{children:[e(kl,{children:l.map(({id:t,title:l,value:r})=>a(Cl,{children:[e(o,{size:c.XXXS,color:s.Secondary,nowrap:!0,children:l}),e(o,{size:c.XS,nowrap:!0,children:r})]},t))}),a(Cl,{children:[e(o,{size:c.XXXS,color:s.Secondary,children:Ye}),e(o,{size:c.XS,children:r})]})]})},Fl=({formState:t,onChange:l})=>{const r=Ra(e=>l({name:e.target.value}),[l]),n=Ra(e=>l({notes:e.target.value}),[l]);return e(j,{children:a(ql,{children:[e(Bl,{children:e(L,{name:"sampling-input-rule-name",label:We,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:Ze,value:t.name,onChange:r})}),e(jl,{children:e(L,{name:"sampling-input-note",label:Ye,tooltip:ea,placeholder:Qe,value:t.notes,onChange:n})})]})})},Wl=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],Jl=({formState:a,onChange:t})=>{const l=Ra(e=>t({ruleType:e,keepErrors:"Error"===e}),[t]);return e(j,{richTitle:{title:`3. ${Je}`,subTitle:ta},children:e(n,{$alignItems:"flex-start",children:e(U,{options:Wl,selected:a.ruleType,setSelected:l})})})},Yl=a=>{const t=Ea(()=>{if(a.readOnly)return a.summary;switch(a.category){case"noisy":return Qa(tt(a.formState));case"highlyRelevant":return Za(at(a.formState));case"costReduction":return Ya(et(a.formState))}},[a]);if(a.readOnly)return e(ol,{title:la,summary:t,renderAction:a.renderAction});const l=1===t.length&&"default"===t[0].variant;return e(ol,{title:l?re:la,summary:l?[]:t,renderAction:a.renderAction})},Zl=(e,a)=>!a?.length||!!a?.find(a=>a===e),Ql=({title:t="Signals",required:l,errorMessage:r,allowedSignals:o,selectedSignals:s,setSelectedSignals:c,disabled:u})=>{const[p,h]=Na(1===s.length),m=Ia(JSON.stringify(s));return Va(()=>{let e=ra(s).filter(e=>Zl(e,o));e.length||(e=na.filter(({id:e})=>Zl(e,o)).map(({id:e})=>e));const a=JSON.stringify(e);m.current!==a&&(m.current=a,c(e),h(1===e.length))},[o,s]),a(n,{$gap:12,children:[e(i,{label:t,required:l}),e(d,{$gap:12,children:na.map(a=>{const t=Zl(a.id,o),l=((e,a)=>!!a?.find(a=>a===e))(a.id,s);return t?e(T,{label:a.value,disabled:u||!t||p&&l,value:l,onChange:e=>((e,a)=>{const t=e,l=a?[...s,t]:s.filter(e=>e!==t);c(l),h(1===l.length)})(a.id,e)},a.id):null})}),e(g,{errorMessage:r})]})},er=({minSupportedVersion:a,currentVersion:t})=>e(m,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>e(f,{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:"Upgrade Required",description:`To use this feature, please upgrade to Odigos v${a} or later.\nCurrent version: ${t}.`}),ar=Ha.div`
|
|
207
207
|
display: flex;
|
|
208
208
|
flex-direction: column;
|
|
209
209
|
justify-content: flex-end;
|
|
@@ -250,7 +250,7 @@ import{jsx as e,jsxs as a,Fragment as t}from"react/jsx-runtime";import{D as l,c
|
|
|
250
250
|
padding: 5vh 10vw;
|
|
251
251
|
border-radius: 12px;
|
|
252
252
|
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
253
|
-
`,ur=Da(({isOpen:t,withOverlay:r,disableAnimation:n,onClose:i,onBack:o,onNext:s,nextIsSkip:d,onSave:u,disableSave:p,connectionIds:g,header:v,subHeader:b,leftColumn:f,rightColumn:y,search:x,filters:k,errorMessage:C,isFormDirty:S,hideDirtyNote:T,isFetching
|
|
253
|
+
`,ur=Da(({isOpen:t,withOverlay:r,disableAnimation:n,onClose:i,onBack:o,onNext:s,nextIsSkip:d,onSave:u,disableSave:p,connectionIds:g,header:v,subHeader:b,leftColumn:f,rightColumn:y,search:x,filters:k,errorMessage:C,isFormDirty:S,hideDirtyNote:T,forcedNote:$,isFetching:w,progress:M},A)=>{const[O,L]=Na(!1),[P,E]=Na(!1),[I,R]=Na(void 0);Xa(A,()=>({clearErrors:()=>R(void 0)}));const V=P,z=Ra(()=>{S&&!O?L(!0):(L(!1),i?.())},[S,O,i]),D=p||P||"boolean"==typeof S&&!S,X=Ra(async()=>{E(!0);const e=await u();E(!1),!1!==e&&(e?.error?R(e.error):(g?.setValue([]),i?.()))},[u,g,i]),H=!!x||!!g||!!k,_=!!b,q=(H?48:0)+(_?50:0),B=Ea(()=>$||(w?{status:N.Info,message:"Fetching Data..."}:P&&!M?{status:N.Info,message:"Saving Changes..."}:I||C?{status:N.Error,message:I||C}:"boolean"==typeof S&&S&&!T?{status:N.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:void 0),[w,P,M,I,C,S,T,$]),j=Ea(()=>o?{label:"Back",leftIcon:wa,variant:h.Secondary,onClick:o}:{label:"Cancel",variant:h.Secondary,onClick:z,disabled:V},[o,z,V]),[K,U]=Na(!1),G=Ea(()=>s?d?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:Ma,variant:h.Secondary,onClick:()=>U(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:Ma,variant:h.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:h.Primary,onClick:X,disabled:D},[s,d,X,D]);return a(l,{width:nr,isOpen:t,disableAnimation:n,hideOverlay:!P&&!r,header:{...v,onClose:i?z:void 0,onCloseDisabled:V},footer:{note:B,actions:[j,G]},children:[P?e(oa,{$height:"calc(100vh - 136px)",children:e(dr,{children:e(ca,{titleSize:c.S,subTitleSize:c.XXXS,withGradient:!0,withSpinner:!0,...M})})}):a(ir,{children:[H&&a(or,{children:[g&&e(da,{icon:Aa,title:"Selected Clusters",badge:{label:g.value.length}}),x&&e(ua,{width:"100%",...x}),k]}),_&&e(sr,{children:e(da,{icon:b.icon,title:b.title,subTitle:b.description,badge:b.badge})}),a(cr,{children:[e(rr,{isLeft:!0,heightOffset:q,...f}),e(rr,{isRight:!0,heightOffset:q,...y})]})]}),e(kt,{isOpen:O,onClose:()=>L(!1),onApprove:z}),e(m,{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:K,onClose:()=>U(!1),denyButton:{label:"Go Back",variant:h.Secondary,onClick:()=>U(!1)},approveButton:{label:"Skip",variant:h.Primary,onClick:()=>{s?.(),U(!1)}}})]})});ur.displayName=ur.name;const pr=Ha.div`
|
|
254
254
|
padding: 0 24px;
|
|
255
255
|
border-radius: 12px;
|
|
256
256
|
background-color: ${({$codeBgColor:e})=>e||"transparent"};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{b6 as c,b7 as l,m as d,S as u,b8 as m,b9 as p,ba as f,P as E,b as y,bb as h,bc as S,bd as T,be as g,bf as _,bg as I,bh as A,bi as v,bj as R,bk as C,bl as N,aY as O,bm as D,bn as w,n as b,bo as P,bp as L,bq as k,br as F,bs as G,bt as U,v as M,bu as x,bv as H,ad as K,a9 as V,ab as W,aa as Y,ac as $,a8 as j,bw as q}from"./ui-components-
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useMemo as t,useContext as r,createContext as a,useCallback as n,useState as o,useEffect as s,useRef as i}from"react";import{b6 as c,b7 as l,m as d,S as u,b8 as m,b9 as p,ba as f,P as E,b as y,bb as h,bc as S,bd as T,be as g,bf as _,bg as I,bh as A,bi as v,bj as R,bk as C,bl as N,aY as O,bm as D,bn as w,n as b,bo as P,bp as L,bq as k,br as F,bs as G,bt as U,v as M,bu as x,bv as H,ad as K,a9 as V,ab as W,aa as Y,ac as $,a8 as j,bw as q}from"./ui-components-Cz05Wzh4.js";import{i as B,n as Q,m as z,l as J,o as X,p as Z,v as ee,q as te,u as re}from"./helpers-B3Ne2tBs.js";import{ApolloProvider as ae,useLazyQuery as ne,useApolloClient as oe,useQuery as se}from"@apollo/client/react";import{ErrorLink as ie}from"@apollo/client/link/error";import{SetContextLink as ce}from"@apollo/client/link/context";import{getMainDefinition as le}from"@apollo/client/utilities";import{CombinedGraphQLErrors as de,ServerError as ue}from"@apollo/client/errors";import{HttpLink as me,ApolloLink as pe,ApolloClient as fe,InMemoryCache as Ee,gql as ye}from"@apollo/client";const he=e=>{if(!e)return!1;const t=e.toLowerCase();return t.includes("authentication required")||t.includes("authentication expired")||t.includes("http 401")},Se=a(null),Te=()=>{const e=r(Se);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},ge=({apolloConfig:r,operations:a,context:n,children:o})=>{const s=t(()=>(e=>{const t=new me({uri:e.httpUrl,credentials:e.credentials??"same-origin"}),r=new ie(({error:t})=>{de.is(t)?t.errors.some(e=>he(e.message))&&e.onAuthError?.():(ue.is(t)&&401===t.statusCode||he(t.message))&&e.onAuthError?.()}),a=new ce(async t=>{const r={...t.headers};if(e.authHeader){const t=await e.authHeader();Object.assign(r,t)}return e.csrfHeader&&Object.assign(r,e.csrfHeader()),{headers:r}}),n=[];e.additionalLinks?.length&&n.push(...e.additionalLinks),n.push(a,r,t);let o=pe.from(n);e.wsLink&&(o=pe.split(({query:e})=>{const t=le(e);return"OperationDefinition"===t.kind&&"subscription"===t.operation},e.wsLink,o));const s=e.defaultFetchPolicies;return new fe({link:o,cache:new Ee({typePolicies:e.cacheTypePolicies}),defaultOptions:{watchQuery:{fetchPolicy:s?.watchQuery??"cache-and-network"},query:{fetchPolicy:s?.query??"cache-first"},mutate:{fetchPolicy:s?.mutate??"network-only"}}})})(r),[r.httpUrl,r.wsLink,r.credentials,r.clientKey]),i=t(()=>({operations:a,context:n,apolloConfig:r}),[a,n,r]);return e(ae,{client:s,children:e(Se.Provider,{value:i,children:o})})},_e=Se,Ie=({connectionIds:r,children:a})=>{const n=Te(),o=t(()=>({operations:n.operations,context:{...n.context,connectionIds:r},apolloConfig:n.apolloConfig}),[n.operations,n.context,n.apolloConfig,r.join(",")]);return e(_e.Provider,{value:o,children:a})},Ae=(e,t)=>{if(e)return"string"==typeof e?e:m(e,t)},ve=e=>{const{addNotification:t}=c(),r=(r,a,n,o,s)=>t({type:r,title:a,message:n,crdType:e,target:Ae(o,e),hideFromHistory:s});return{notify:r,notifyError:(e,t,a)=>r(u.Error,e,t,a),notifySuccess:(e,t,a)=>r(u.Success,e,t,a),notifyPending:(e,t)=>r(u.Default,"Pending",e,t,!0),notifyReadonly:()=>{t({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})}}},Re=e=>{e({type:u.Warning,title:d.READONLY,message:l.READONLY_WARNING,hideFromHistory:!0})},Ce=e=>({error:e,results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:0}),Ne=(e,t)=>{if(e)return"function"==typeof e?e(t):e},Oe=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)},De=(e,t)=>e.client??t,we=async(e,t,r,a,n)=>{if(!t)return{error:"Query operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(De(t,e),r,a)}catch(e){return{error:Oe(e)}}const o=Ne(t.document,a);if(!o)return{error:"Query operation not supported in this context"};const s=t.transformVariables?t.transformVariables(r,a):r,i=De(t,e);try{const e=await i.query({query:o,variables:s,fetchPolicy:n??"network-only"});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:e.error?Oe(e.error):void 0}}catch(e){return{error:Oe(e)}}},be=async(e,t,r,a)=>{if(!t)return{error:"Mutation operation not configured"};if(t.canRun&&!t.canRun(a))return{data:void 0};if(t.run)try{return await t.run(De(t,e),r,a)}catch(e){return{error:Oe(e)}}const n=Ne(t.document,a);if(!n)return{error:"Mutation operation not supported in this context"};const o=t.transformVariables?t.transformVariables(r,a):r,s=De(t,e);try{const e=await s.mutate({mutation:n,variables:o});return{data:t.transformResult?t.transformResult(e.data,a):e.data,error:void 0}}catch(e){return{error:Oe(e)}}},Pe=async(e,t,r,a,n)=>{if(!t)return Ce("Multi fetch operation not configured");if(!r.length)return Ce("No proxy ids supplied for multi fetch");const o=De(t,e);if(t.transformVariablesMulti&&(t.documentMulti||t.document)){const e=t.transformVariablesMulti(r,a,n),s=[];for(const r of e)try{const e=await o.query({query:r.document,variables:r.variables,fetchPolicy:"network-only"});t.transformMultiResult?t.transformMultiResult(e.data,n).forEach(e=>s.push(e)):r.proxyIDs.forEach(t=>{s.push({proxyID:t,success:!e.error,data:e.data,error:e.error?.message})})}catch(e){const t=Oe(e);r.proxyIDs.forEach(e=>s.push({proxyID:e,success:!1,error:t}))}const i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}}const s=await Promise.all(r.map(async r=>{const o={...n,proxyID:r},s=await we(e,t,a,o);return{proxyID:r,success:!s.error,data:s.data,error:s.error}})),i=s.filter(e=>e.success).length,c=s.length-i,l=Array.from(new Set(s.filter(e=>!!e.error).map(e=>e.error)));return{results:s,allSucceeded:0===c,anySucceeded:i>0,successCount:i,failureCount:c,error:l.length?l.join(", "):void 0}},Le=ye`
|
|
2
2
|
query OdigosApiNoop {
|
|
3
3
|
__typename
|
|
4
4
|
}
|