@odigos/ui-kit 0.0.234 → 0.0.235
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/chunks/{index-eOSrP07c.js → index-BmuiyBxZ.js} +1 -1
- package/lib/chunks/index-D6lL097V.js +145 -0
- package/lib/chunks/{index-Coer-PRZ.js → index-pkD-mO1h.js} +1 -1
- package/lib/chunks/ui-components-B4It5sfa.js +2696 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants/sampling/index.d.ts +1 -0
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/sampling-rules/converters.d.ts +3 -1
- package/lib/containers/_v2/sampling-rules/helpers.d.ts +2 -2
- package/lib/containers/v2.js +4 -4
- package/lib/containers.js +1 -1
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets/_v2/sampling-rule-form-sections/source-scope.d.ts +2 -2
- package/lib/snippets/v2.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/sampling.d.ts +24 -26
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/chunks/index-EPaudVws.js +0 -145
- package/lib/chunks/ui-components-BogDd0Qc.js +0 -2696
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import{cA as e,a,as as t,j as l,l as r,fs as i,cn as o,cP as s,cu as n,cq as d,bC as c,cr as p,cp as u,ak as h,a4 as g,b_ as m,F as v,y as f,cm as b,S as y,s as S,cL as x,ft as k,fu as C,k as w,fv as T,n as $,fw as P,o as L,p as A,fx as M,fy as O,fz as N,fA as z,fB as R,fC as X,fD as D,e5 as I,fE as E,fF as H,fG as B,fH as V,fI as K,di as j,B as U,fJ as q,fK as G,fL as J,fM as W,fN as F,fO as Z,fP as Y,fQ as _,fR as Q,fS as ee,cF as ae,fT as te,fU as le,cM as re,fV as ie,fW as oe,fX as se,fY as ne,fZ as de,d7 as ce,f_ as pe,f$ as ue,g0 as he,g1 as ge,g2 as me,g3 as ve,g4 as fe,g5 as be,g6 as ye,dm as Se,m as xe,g7 as ke,g8 as Ce,g9 as we,ga as Te,gb as $e,gc as Pe,gd as Le,ge as Ae,gf as Me,gg as Oe,cw as Ne,gh as ze,R as Re,gi as Xe,gj as De,gk as Ie,gl as Ee,eL as He,P as Be,bW as Ve,$ as Ke,br as je,co as Ue,gm as qe,b6 as Ge,b as Je,N as We,c4 as Fe,L as Ze,eO as Ye,w as _e}from"./ui-components-BogDd0Qc.js";import{jsx as Qe,jsxs as ea,Fragment as aa}from"react/jsx-runtime";import{OdigosLogoTextEnterprise as ta,OdigosLogoTextCommunity as la,EditIcon as ra,ArrowLeftIcon as ia,ArrowRightIcon as oa,VSquareIcon as sa}from"../icons.js";import{useCallback as na,useMemo as da,useState as ca,useRef as pa,useEffect as ua,forwardRef as ha,useImperativeHandle as ga}from"react";import ma from"styled-components";import"./index-eOSrP07c.js";const va=({isOpen:t,onClose:l,onDeny:r,onApprove:i})=>Qe(e,{title:"Discard changes?",description:"You have unsaved changes.\nIf you cancel now, your changes won't be saved.",isOpen:t,onClose:l,denyButton:{label:"Keep editing",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:"Discard changes",variant:a.Primary,onClick:()=>{i?.(),l()}}}),fa=({isOpen:t,onClose:l,onDeny:r,onApprove:i,action:o="delete",target:s})=>{const n=o.charAt(0).toUpperCase()+o.substring(1),d=s?.endsWith("s")?"these":"this";return Qe(e,{title:`${n}${s?` ${s}`:""}?`,description:`Are you sure you want to ${o}${s?` ${d} ${s}`:""}?`,isOpen:t,onClose:l,denyButton:{label:"Go back",variant:a.Secondary,onClick:()=>{r?.(),l()}},approveButton:{label:n,variant:a.Primary,onClick:()=>{i?.(),l()}}})},ba=({componentType:e,inputType:a,name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:S,value:x,setValue:k,errorMessage:C,warnMessage:w,helpMessage:T,dropdownOptions:$,dropdownNoSearch:P,dropdownNoCheckbox:L,timeUnits:A,timeDefaultUnit:M})=>{switch(e){case t.Input:return Qe(u,{name:g,type:a,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:S,value:x??"",onChange:e=>{const t=e.target.value;k(a===h.Number?""===t?null:Number(t):t)},errorMessage:C,warnMessage:w,helpMessage:T},g);case t.MultiInput:return Qe(p,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:S,values:Array.isArray(x)?x:c(x,[]),setValues:e=>k(e),errorMessage:C,warnMessage:w,helpMessage:T},g);case t.KeyValuePair:return Qe(d,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:S,limitFieldsPerRow:2,columns:[{keyName:"key",label:"Key"},{keyName:"value",label:"Value"}],values:Array.isArray(x)?x:c(x,[]),setValues:e=>k(e),errorMessage:C,warnMessage:w,helpMessage:T},g);case t.TextArea:return Qe(n,{name:g,label:m,tooltip:v,badge:f,required:y,disabled:S,placeholder:b,value:x??"",onChange:e=>k(e.target.value),errorMessage:C,warnMessage:w,helpMessage:T},g);case t.Dropdown:return Qe(s,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:S,withSearch:!P,options:$?.map(e=>({id:e.id||"",label:e.value||"",withCheckbox:!L}))||[],values:x?[String(x)]:[],setValues:e=>k(e[0]),errorMessage:C,warnMessage:w,helpMessage:T},g);case t.Checkbox:return Qe(o,{name:g,label:m,tooltip:v,badge:f,value:!0===x||"true"===x,onChange:e=>k(e),disabled:S,errorMessage:C,warnMessage:w,helpMessage:T},g);case t.Time:return Qe(i,{name:g,label:m,tooltip:v,badge:f,placeholder:b,required:y,disabled:S,value:x??"",setValue:e=>k(e),units:A,defaultUnit:M,errorMessage:C,warnMessage:w,helpMessage:T},g);case t.Toggle:return Qe(l,{name:g,labelAlign:r.Right,label:m,tooltip:v,badge:f,value:!0===x||"true"===x,onChange:e=>k(e),disabled:S,errorMessage:C,warnMessage:w,helpMessage:T},g);default:return null}},ya=({size:e=200})=>{const{tier:a}=g();return a===m.Onprem?Qe(ta,{size:e}):Qe(la,{size:e})},Sa=[{value:"50",label:"50%"},{value:"25",label:"25%"},{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"custom",label:"Custom"}],xa=[{value:"10",label:"10%"},{value:"1",label:"1%"},{value:"0.5",label:"0.5%"},{value:"0.1",label:"0.1%"},{value:"custom",label:"Custom"}],ka=[{value:"5000",label:"5s"},{value:"1000",label:"1s"},{value:"500",label:"500ms"},{value:"100",label:"100ms"},{value:"50",label:"50ms"},{value:"custom",label:"Custom"}],Ca=({description:e,options:a,selected:t,onSelect:l,customName:r,customLabel:i,customPlaceholder:o,customValue:s,onCustomChange:n})=>ea(v,{$gap:16,$alignItems:"flex-end",children:[ea(f,{$gap:6,children:[Qe(b,{label:e}),Qe(y,{size:S.S,options:a,selected:t,setSelected:l})]}),"custom"===t&&Qe(u,{name:r,label:i,placeholder:o,type:h.Number,value:s,onChange:n,width:160})]}),wa=()=>{},Ta=e=>e.readOnly?Qe($a,{rule:e.rule}):Qe(Pa,{ruleType:e.ruleType,formState:e.formState,onChange:e.onChange}),$a=({rule:e})=>{const a=null!=e.durationAtLeastMs;return e.error?Qe(x,{richTitle:{title:k},children:Qe(l,{name:"sampling-view-toggle-keep-errors",onChange:wa,value:!0,size:w.S,label:C,labelAlign:r.Right})}):a?Qe(x,{richTitle:{title:T},children:ea("div",{children:[Qe($,{size:A.XXXS,color:L.Secondary,children:P}),Qe($,{size:A.XS,children:`${e.durationAtLeastMs}ms`})]})}):null},Pa=({ruleType:e,formState:a,onChange:t})=>{const i=na(e=>t({durationPreset:e}),[t]),o=na(e=>t({customDurationMs:e.target.value}),[t]);return"Error"===e?Qe(x,{richTitle:{title:k,subTitle:M},children:Qe(l,{name:"sampling-toggle-keep-errors",value:!0,onChange:wa,size:w.S,label:C,labelAlign:r.Right})}):"Duration"===e?Qe(x,{richTitle:{title:T,subTitle:O},children:Qe(Ca,{description:P,options:ka,selected:a.durationPreset,onSelect:i,customName:"sampling-input-custom-duration",customLabel:N,customPlaceholder:"200ms",customValue:a.customDurationMs,onCustomChange:o})}):null},La=ma.div`
|
|
2
|
-
display: flex;
|
|
3
|
-
gap: 32px;
|
|
4
|
-
`,Aa=ma.div`
|
|
5
|
-
display: flex;
|
|
6
|
-
flex-direction: column;
|
|
7
|
-
gap: 4px;
|
|
8
|
-
`,Ma=ma.div`
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-wrap: wrap;
|
|
11
|
-
align-items: flex-end;
|
|
12
|
-
gap: 16px;
|
|
13
|
-
`,Oa=ma.div`
|
|
14
|
-
display: flex;
|
|
15
|
-
align-items: flex-end;
|
|
16
|
-
gap: 16px;
|
|
17
|
-
padding: 12px 16px;
|
|
18
|
-
border-radius: 8px;
|
|
19
|
-
background-color: ${({theme:e})=>e.v2.colors.black[500]};
|
|
20
|
-
`,Na=ma.div`
|
|
21
|
-
display: flex;
|
|
22
|
-
align-items: flex-end;
|
|
23
|
-
gap: 10px;
|
|
24
|
-
flex: 1;
|
|
25
|
-
`,za=ma.div`
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
height: 32px;
|
|
29
|
-
`,Ra=ma.div`
|
|
30
|
-
display: flex;
|
|
31
|
-
align-items: flex-end;
|
|
32
|
-
gap: 16px;
|
|
33
|
-
margin-bottom: 12px;
|
|
34
|
-
`,Xa="Any",Da="Kafka topic",Ia=()=>Qe("div",{style:{marginBottom:"8px"},children:Qe($,{size:A.XS,weight:500,children:"And"})}),Ea=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"httpClient",label:"HTTP Client"}],Ha=[{value:"all",label:"All Operations"},{value:"httpServer",label:"HTTP Server"},{value:"kafkaConsumer",label:"Kafka Consumer"},{value:"kafkaProducer",label:"Kafka Producer"}],Ba=[{id:"",label:Xa},{id:"GET",label:"GET"},{id:"POST",label:"POST"},{id:"PUT",label:"PUT"},{id:"DELETE",label:"DELETE"},{id:"PATCH",label:"PATCH"}];const Va=e=>e.readOnly?Qe(Ka,{data:e.data}):Qe(ja,{category:e.category,formState:e.formState,onChange:e.onChange}),Ka=({data:e})=>{const a=da(()=>function(e){if("noisy"===e.category){const a=e.rule.operation;if(a?.httpServer)return[{id:"type",title:W,value:J},{id:"route",title:B,value:a.httpServer.route||a.httpServer.routePrefix||F},{id:"method",title:q,value:a.httpServer.method||Xa}];if(a?.httpClient){const e=[{id:"type",title:W,value:Z}];return a.httpClient.serverAddress&&e.push({id:"serverAddress",title:"Server address",value:a.httpClient.serverAddress}),e.push({id:"route",title:B,value:a.httpClient.templatedPath||a.httpClient.templatedPathPrefix||F}),e.push({id:"method",title:q,value:a.httpClient.method||Xa}),e}return[{id:"type",title:W,value:Y}]}const a=e.rule.operation;return a?.httpServer?[{id:"type",title:W,value:J},{id:"route",title:B,value:a.httpServer.route||a.httpServer.routePrefix||F},{id:"method",title:q,value:a.httpServer.method||Xa}]:a?.kafkaConsumer?[{id:"type",title:W,value:_},{id:"topic",title:Da,value:a.kafkaConsumer.kafkaTopic||F}]:a?.kafkaProducer?[{id:"type",title:W,value:Q},{id:"topic",title:Da,value:a.kafkaProducer.kafkaTopic||F}]:[{id:"type",title:W,value:Y}]}(e),[e]);return Qe(x,{richTitle:{title:z},children:Qe(La,{children:a.map(({id:e,title:a,value:t})=>ea(Aa,{children:[Qe($,{size:A.XXXS,color:L.Secondary,nowrap:!0,children:a}),Qe($,{size:A.XS,nowrap:!0,children:t})]},e))})})},ja=({category:e,formState:t,onChange:l})=>{const r=da(()=>"noisy"===e?Ea:Ha,[e]),i=na(e=>l({operationType:e,route:"",serverAddress:"",method:"",kafkaTopic:""}),[l]),o=na(e=>a=>{a&&l({routeType:e,route:""})},[l]),s=na(e=>l({route:e.target.value}),[l]),n=na(e=>l({serverAddress:e.target.value}),[l]),d=na(e=>l({method:e[0]||""}),[l]),c=na(e=>l({kafkaTopic:e.target.value}),[l]),p="httpServer"===t.operationType||"httpClient"===t.operationType,h="kafkaConsumer"===t.operationType||"kafkaProducer"===t.operationType,g="httpClient"===t.operationType?H:B,m="httpClient"===t.operationType?V:K;return ea(x,{richTitle:{title:`2. ${z}`,subTitle:R},children:[Qe(f,{$alignItems:"flex-start",children:Qe(y,{size:S.S,options:r,selected:t.operationType,setSelected:i})}),p&&ea(Ma,{children:["httpClient"===t.operationType&&ea(Ra,{children:[Qe(u,{name:"sampling-input-server-address",label:D,placeholder:X,value:t.serverAddress,onChange:n}),Qe(Ia,{})]}),ea(Oa,{children:[ea(Na,{children:[Qe(za,{children:Qe(I,{"data-id":"sampling-radio-route",value:"route"===t.routeType,onChange:o("route")})}),Qe(u,{name:"sampling-input-route",label:g,placeholder:E,value:"route"===t.routeType?t.route:"",onChange:s,disabled:"route"!==t.routeType})]}),ea(Na,{children:[Qe(za,{children:Qe(I,{"data-id":"sampling-radio-route-prefix",value:"routePrefix"===t.routeType,onChange:o("routePrefix")})}),Qe(u,{name:"sampling-input-route-prefix",label:m,placeholder:E,value:"routePrefix"===t.routeType?t.route:"",onChange:s,disabled:"routePrefix"!==t.routeType})]})]}),ea(Ra,{children:[Qe(Ia,{}),Qe(j,{label:q,items:Ba,selectedIds:[t.method||""],setSelectedIds:e=>d(e),buttonProps:{"data-id":"sampling-btn-method",label:Ba.find(e=>e.id===t.method)?.label||Xa,size:U.S,variant:a.Secondary}})]})]}),h&&Qe(u,{name:"sampling-input-kafka-topic",label:G,placeholder:"Type kafka topic",value:t.kafkaTopic,onChange:c,width:"320px"})]})},Ua=[{value:"all",label:"Drop All"},{value:"sample",label:"Sample"}],qa=[{value:"all",label:"Keep All"},{value:"sample",label:"Sample"}];const Ga=e=>e.readOnly?Qe(Ja,{data:e.data}):Qe(Wa,{category:e.category,formState:e.formState,onChange:e.onChange}),Ja=({data:e})=>{const a=da(()=>function(e){switch(e.category){case"highlyRelevant":return null!=e.rule.percentageAtLeast?{title:te,method:se,description:ie,value:`${e.rule.percentageAtLeast}%`}:{title:te,method:de,description:null,value:null};case"noisy":return null!=e.rule.percentageAtMost?{title:le,method:se,description:oe,value:`${e.rule.percentageAtMost}%`}:{title:le,method:ne,description:null,value:null};case"costReduction":return{title:le,method:se,description:oe,value:`${e.rule.percentageAtMost}%`}}}(e),[e]),t=[{id:"method",title:q,value:a.method},...null!=a.description?[{id:"value",title:a.description,value:a.value}]:[]];return Qe(x,{richTitle:{title:a.title},children:Qe(La,{children:t.map(({id:e,title:a,value:t})=>ea(Aa,{children:[Qe($,{size:A.XXXS,color:L.Secondary,nowrap:!0,children:a}),Qe($,{size:A.XS,nowrap:!0,children:t})]},e))})})},Wa=({category:e,formState:a,onChange:t})=>{const l="highlyRelevant"===e,r=l?qa:Ua,i=`${l?4:3}. ${l?te:le}`,o=l?ee:ae,s=l?ie:oe,n="noisy"===e?xa:Sa,d=na(e=>t({percentageMode:e}),[t]),c=na(e=>t({percentagePreset:e}),[t]),p=na(e=>t({customPercentage:e.target.value}),[t]);return ea(x,{richTitle:{title:i,subTitle:o},children:["costReduction"!==e&&Qe(f,{$alignItems:"flex-start",children:Qe(y,{size:S.S,options:r,selected:a.percentageMode,setSelected:d})}),("costReduction"===e||"sample"===a.percentageMode)&&Qe(Ca,{description:s,options:n,selected:a.percentagePreset,onSelect:c,customName:"sampling-input-custom-percentage",customLabel:re,customPlaceholder:"5%",customValue:a.customPercentage,onCustomChange:p})]})},Fa=ma.div`
|
|
35
|
-
display: flex;
|
|
36
|
-
align-items: flex-end;
|
|
37
|
-
gap: 16px;
|
|
38
|
-
`,Za=ma.div`
|
|
39
|
-
width: 280px;
|
|
40
|
-
flex-shrink: 0;
|
|
41
|
-
`,Ya=ma.div`
|
|
42
|
-
flex: 1;
|
|
43
|
-
min-width: 0;
|
|
44
|
-
`;function _a(e){return"highlyRelevant"===e.category?e.rule.error?"Error":null!=e.rule.durationAtLeastMs?"Duration":"Relevance":fe[e.category]}const Qa=e=>e.readOnly?Qe(et,{data:e.data}):Qe(at,{formState:e.formState,onChange:e.onChange}),et=({data:e})=>{const a=da(()=>[{id:"name",title:pe,value:e.rule.name||ce},{id:"type",title:ue,value:_a(e)}],[e]),t=e.rule.notes||F;return ea(x,{children:[Qe(La,{children:a.map(({id:e,title:a,value:t})=>ea(Aa,{children:[Qe($,{size:A.XXXS,color:L.Secondary,nowrap:!0,children:a}),Qe($,{size:A.XS,nowrap:!0,children:t})]},e))}),ea(Aa,{children:[Qe($,{size:A.XXXS,color:L.Secondary,children:he}),Qe($,{size:A.XS,children:t})]})]})},at=({formState:e,onChange:a})=>{const t=na(e=>a({name:e.target.value}),[a]),l=na(e=>a({notes:e.target.value}),[a]);return Qe(x,{children:ea(Fa,{children:[Qe(Za,{children:Qe(u,{name:"sampling-input-rule-name",label:pe,tooltip:"Optional. Give this rule a name for easier identification.",placeholder:ge,value:e.name,onChange:t})}),Qe(Ya,{children:Qe(u,{name:"sampling-input-note",label:he,tooltip:ve,placeholder:me,value:e.notes,onChange:l})})]})})},tt=[{value:"Relevance",label:"Relevance"},{value:"Error",label:"Error"},{value:"Duration",label:"Duration"}],lt=({formState:e,onChange:a})=>{const t=na(e=>a({ruleType:e,keepErrors:"Error"===e}),[a]);return Qe(x,{richTitle:{title:`3. ${ue}`,subTitle:be},children:Qe(f,{$alignItems:"flex-start",children:Qe(y,{size:S.S,options:tt,selected:e.ruleType,setSelected:t})})})},rt=ma.div`
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
gap: 24px;
|
|
48
|
-
padding: 8px 16px;
|
|
49
|
-
border-radius: 12px;
|
|
50
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
51
|
-
`,it=ma.div`
|
|
52
|
-
flex: 1;
|
|
53
|
-
min-width: 0;
|
|
54
|
-
white-space: pre;
|
|
55
|
-
overflow-x: auto;
|
|
56
|
-
`,ot=({title:e,summary:t,onEdit:l,renderAction:r})=>{const i=da(()=>{const a=[];return e&&(a.push({text:e,variant:ye.Default}),a.push({text:" - ",variant:ye.Default})),a.push(...t),a},[e,t]);return ea(rt,{children:[Qe(it,{children:Qe(Se,{parts:i})}),r&&r(),l&&Qe(xe,{"data-id":"sampling-btn-edit-auto-rule",label:ke,rightIcon:ra,variant:a.Text,size:U.S,onClick:l})]})},st=e=>{const a=da(()=>{if(e.readOnly)return e.summary;switch(e.category){case"noisy":return Pe(Le(e.formState));case"highlyRelevant":return Te($e(e.formState));case"costReduction":return Ce(we(e.formState))}},[e]);if(e.readOnly)return Qe(ot,{title:Ae,summary:a,renderAction:e.renderAction});const t=1===a.length&&"default"===a[0].variant;return Qe(ot,{title:t?Me:Ae,summary:t?[]:a,renderAction:e.renderAction})},nt=ma.div`
|
|
57
|
-
display: flex;
|
|
58
|
-
flex-wrap: wrap;
|
|
59
|
-
gap: 8px;
|
|
60
|
-
`,dt=ma.div`
|
|
61
|
-
display: flex;
|
|
62
|
-
align-items: center;
|
|
63
|
-
gap: 8px;
|
|
64
|
-
padding: 8px 12px;
|
|
65
|
-
border-radius: 8px;
|
|
66
|
-
cursor: pointer;
|
|
67
|
-
background: ${({theme:e,$selected:a})=>a?e.v2.colors.silver[700]:e.v2.colors.silver[900]};
|
|
68
|
-
border: 1px solid ${({theme:e,$selected:a})=>a?e.v2.colors.silver[500]:e.v2.colors.silver[800]};
|
|
69
|
-
|
|
70
|
-
&:hover {
|
|
71
|
-
background: ${({theme:e})=>e.v2.colors.silver[700]};
|
|
72
|
-
}
|
|
73
|
-
`,ct=ma.div`
|
|
74
|
-
display: flex;
|
|
75
|
-
width: 32px;
|
|
76
|
-
height: 32px;
|
|
77
|
-
justify-content: center;
|
|
78
|
-
align-items: center;
|
|
79
|
-
flex-shrink: 0;
|
|
80
|
-
`,pt=ma.div`
|
|
81
|
-
display: flex;
|
|
82
|
-
flex-direction: column;
|
|
83
|
-
gap: 4px;
|
|
84
|
-
`,ut=ma.div`
|
|
85
|
-
display: flex;
|
|
86
|
-
align-items: center;
|
|
87
|
-
gap: 8px;
|
|
88
|
-
padding: 8px;
|
|
89
|
-
border-radius: 8px;
|
|
90
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
91
|
-
`,ht=ma.div`
|
|
92
|
-
display: flex;
|
|
93
|
-
width: 24px;
|
|
94
|
-
height: 24px;
|
|
95
|
-
justify-content: center;
|
|
96
|
-
align-items: center;
|
|
97
|
-
flex-shrink: 0;
|
|
98
|
-
`,gt={[Be.JavaScript]:"Node.js",[Be.DotNet]:".NET",[Be.Php]:"PHP",[Be.Java]:"Java",[Be.Go]:"Go",[Be.Python]:"Python",[Be.Ruby]:"Ruby",[Be.Rust]:"Rust"},mt=[Be.Python,Be.Java,Be.JavaScript,Be.DotNet,Be.Php,Be.Ruby,Be.Go].map(e=>({id:e,label:gt[e]??e.charAt(0).toUpperCase()+e.slice(1),Icon:Ve(e)})),vt=[{value:"all",label:"Entire Cluster"},{value:"source",label:"Specific Source"},{value:"namespace",label:"Specific Namespace"},{value:"language",label:"Specific Programming Language"}];function ft(e){const a=gt[e];return a||e.charAt(0).toUpperCase()+e.slice(1)}const bt=e=>e.readOnly?Qe(yt,{scopes:e.scopes}):Qe(St,{formState:e.formState,onChange:e.onChange,sourceOptions:e.sourceOptions,namespaceOptions:e.namespaceOptions}),yt=({scopes:e})=>Qe(x,{richTitle:{title:Oe},children:e.length?Qe(pt,{children:e.map((e,a)=>((e,a)=>{if(e.workloadLanguage){const t=Ve(e.workloadLanguage);return ea(ut,{children:[t&&Qe(ht,{children:Qe(t,{size:18})}),Qe($,{size:A.XS,color:L.Primary,children:ft(e.workloadLanguage)})]},a)}const t=[e.workloadNamespace,e.workloadKind,e.workloadName].filter(Boolean),l=t.length?t.join(" / "):"Unknown scope";return Qe(ut,{children:Qe($,{size:A.XS,color:L.Primary,children:l})},a)})(e,a))}):Qe(Ne,{status:Re.Default,message:ze,fullWidth:!0})}),St=({formState:e,onChange:a,sourceOptions:t=[],namespaceOptions:l=[]})=>{const[r,i]=ca("all"),s=e.sourceScopes.length>0,n=da(()=>vt.map(e=>({...e,disabled:"all"===e.value&&s})),[s]),d=da(()=>e.sourceScopes.filter(e=>"source"===e.scopeType).map(e=>{return a=e.workloadNamespace,t=e.workloadKind,l=e.workloadName,`${a}/${t}/${l}`;var a,t,l}),[e.sourceScopes]),c=da(()=>e.sourceScopes.filter(e=>"namespace"===e.scopeType).map(e=>e.workloadNamespace),[e.sourceScopes]),p=da(()=>new Set(e.sourceScopes.filter(e=>"language"===e.scopeType).map(e=>e.workloadLanguage)),[e.sourceScopes]),u=na(e=>{i(e)},[]),h=na(t=>{const l=e.sourceScopes.filter(e=>"source"!==e.scopeType),r=t.map(e=>function(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=>({scopeType:"source",workloadName:e.name,workloadKind:e.kind,workloadNamespace:e.namespace,workloadLanguage:""}));a({sourceScopes:[...l,...r]})},[e.sourceScopes,a]),g=na(t=>{const l=e.sourceScopes.filter(e=>"namespace"!==e.scopeType),r=t.map(e=>({scopeType:"namespace",workloadName:"",workloadKind:"",workloadNamespace:e,workloadLanguage:""}));a({sourceScopes:[...l,...r]})},[e.sourceScopes,a]),m=na(t=>{if(e.sourceScopes.some(e=>"language"===e.scopeType&&e.workloadLanguage===t))a({sourceScopes:e.sourceScopes.filter(e=>!("language"===e.scopeType&&e.workloadLanguage===t))});else{const l={scopeType:"language",workloadName:"",workloadKind:"",workloadNamespace:"",workloadLanguage:t};a({sourceScopes:[...e.sourceScopes,l]})}},[e.sourceScopes,a]);return ea(x,{richTitle:{title:`1. ${Oe}`,subTitle:Xe},children:[Qe(Ne,!s&&"all"===r?{status:Re.Default,message:ze,fullWidth:!0,smallIcon:!0}:{status:Re.Info,message:De,fullWidth:!0,smallIcon:!0}),Qe(f,{$alignItems:"flex-start",children:Qe(y,{size:S.S,options:n,selected:r,setSelected:u})}),"source"===r&&Qe(Ie,{multiple:!0,"data-id":"sampling-autocomplete-source",options:t,value:d,onSelect:h,placeholder:Ee}),"namespace"===r&&Qe(Ie,{multiple:!0,"data-id":"sampling-autocomplete-namespace",options:l,value:c,onSelect:g,placeholder:"Search namespace"}),"language"===r&&Qe(nt,{children:mt.map(({id:e,label:a,Icon:t})=>{const l=p.has(e);return ea(dt,{$selected:l,onClick:()=>m(e),children:[Qe(o,{name:`sampling-scope-lang-${e}`,size:He.S,value:l,onChange:()=>m(e)}),Qe(ct,{children:Qe(t,{size:20})}),Qe($,{size:A.XS,nowrap:!0,children:a})]},e)})})]})},xt=(e,a)=>!a?.length||!!a?.find(a=>a===e),kt=({title:e="Signals",required:a,errorMessage:t,allowedSignals:l,selectedSignals:r,setSelectedSignals:i,disabled:s})=>{const[n,d]=ca(1===r.length),c=pa(JSON.stringify(r));ua(()=>{let e=Ke(r).filter(e=>xt(e,l));e.length||(e=je.filter(({id:e})=>xt(e,l)).map(({id:e})=>e));const a=JSON.stringify(e);c.current!==a&&(c.current=a,i(e),d(1===e.length))},[l,r]);return ea(f,{$gap:12,children:[Qe(b,{label:e,required:a}),Qe(v,{$gap:12,children:je.map(e=>{const a=xt(e.id,l),t=((e,a)=>!!a?.find(a=>a===e))(e.id,r);return a?Qe(o,{label:e.value,disabled:s||!a||n&&t,value:t,onChange:a=>((e,a)=>{const t=e,l=a?[...r,t]:r.filter(e=>e!==t);i(l),d(1===l.length)})(e.id,a)},e.id):null})}),Qe(Ue,{errorMessage:t})]})},Ct=({minSupportedVersion:a,currentVersion:t})=>Qe(e,{isOpen:!0,onClose:()=>{},relativeToParent:!0,visual:()=>Qe(qe,{scale:2.4,icon:()=>Qe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"22",height:"21",viewBox:"0 0 22 21",fill:"none",children:Qe("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}.`}),wt=ma.div`
|
|
99
|
-
display: flex;
|
|
100
|
-
flex-direction: column;
|
|
101
|
-
justify-content: flex-end;
|
|
102
|
-
width: ${({$width:e})=>e};
|
|
103
|
-
gap: ${({$columnHasHeader:e})=>e?"0":"12px"};
|
|
104
|
-
`,Tt=ma.div`
|
|
105
|
-
display: flex;
|
|
106
|
-
align-items: center;
|
|
107
|
-
min-height: 24px;
|
|
108
|
-
padding: 12px;
|
|
109
|
-
border-radius: 16px 16px 0 0;
|
|
110
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
111
|
-
`,$t=ma.div`
|
|
112
|
-
display: flex;
|
|
113
|
-
flex-direction: column;
|
|
114
|
-
gap: ${({$gap:e})=>e}px;
|
|
115
|
-
padding: 12px 12px 0 12px;
|
|
116
|
-
width: calc(100% - 24px);
|
|
117
|
-
height: ${({$heightOffset:e,$columnHasHeader:a})=>`calc(100vh - 180px - ${e}px ${a?"- 48px":""})`};
|
|
118
|
-
border-radius: ${({$columnHasHeader:e,$isLeft:a,$isRight:t})=>e?a?"0 0 0 16px":t?"0 16px 0 0":"0":a?"16px 0 0 16px":t?"0 16px 16px 0":"16px"};
|
|
119
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[900]};
|
|
120
|
-
overflow-y: auto;
|
|
121
|
-
overflow-x: hidden;
|
|
122
|
-
`,Pt=({isLeft:e,isRight:a,heightOffset:t=0,width:l,header:r,list:i})=>ea(wt,{$width:l,$columnHasHeader:!!r,children:[r&&Qe(Tt,{children:r}),Qe($t,{$gap:8,$isLeft:e,$isRight:a,$heightOffset:t,$columnHasHeader:!!r,children:i.length?i.length>1?Qe(Ge,{gap:8,elements:i}):Qe(aa,{children:i[0]}):Qe(Je,{$height:"100%",children:Qe(We,{})})})]}),Lt="75vw",At=ma.div`
|
|
123
|
-
display: flex;
|
|
124
|
-
flex-direction: column;
|
|
125
|
-
border-radius: 16px;
|
|
126
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
127
|
-
overflow: hidden;
|
|
128
|
-
`,Mt=ma.div`
|
|
129
|
-
display: flex;
|
|
130
|
-
gap: 12px;
|
|
131
|
-
padding: 16px 16px 0 16px;
|
|
132
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[1e3]};
|
|
133
|
-
position: sticky;
|
|
134
|
-
top: 0;
|
|
135
|
-
`,Ot=ma.div`
|
|
136
|
-
padding: 12px 12px 0 12px;
|
|
137
|
-
`,Nt=ma.div`
|
|
138
|
-
display: flex;
|
|
139
|
-
gap: 12px;
|
|
140
|
-
padding: 16px;
|
|
141
|
-
`,zt=ma.div`
|
|
142
|
-
padding: 5vh 10vw;
|
|
143
|
-
border-radius: 12px;
|
|
144
|
-
background-color: ${({theme:e})=>e.v2.colors.silver[800]};
|
|
145
|
-
`,Rt=ha(({isOpen:t,withOverlay:l,disableAnimation:r,onClose:i,onBack:o,onNext:s,nextIsSkip:n,onSave:d,disableSave:c,connectionIds:p,header:u,subHeader:h,leftColumn:g,rightColumn:m,search:v,filters:f,errorMessage:b,isFormDirty:y,hideDirtyNote:S,isFetching:x,progress:k},C)=>{const[w,T]=ca(!1),[$,P]=ca(!1),[L,M]=ca(void 0);ga(C,()=>({clearErrors:()=>M(void 0)}));const O=$,N=na(()=>{y&&!w?T(!0):(T(!1),i?.())},[y,w,i]),z=c||$||"boolean"==typeof y&&!y,R=na(async()=>{P(!0);const e=await d();P(!1),e?.error?M(e.error):(p?.setValue([]),i?.())},[d,p,i]),X=!!v||!!p||!!f,D=!!h,I=(X?48:0)+(D?50:0),E=da(()=>x?{status:Re.Info,message:"Fetching Data..."}:$&&!k?{status:Re.Info,message:"Saving Changes..."}:L||b?{status:Re.Error,message:L||b}:"boolean"==typeof y&&y&&!S?{status:Re.Info,message:'The values don\'t reflect the current configurations of the selected clusters.\n"Save" will override the current configurations.'}:"boolean"!=typeof y||y||S?void 0:{status:Re.Success,message:"The values reflect the current configuration of the selected cluster."},[x,$,k,L,b,y,S]),H=da(()=>o?{label:"Back",leftIcon:ia,variant:a.Secondary,onClick:o}:{label:"Cancel",variant:a.Secondary,onClick:N,disabled:O},[o,N,O]),[B,V]=ca(!1),K=da(()=>s?n?{"data-id":"wide-drawer-skip",label:"Skip",rightIcon:oa,variant:a.Secondary,onClick:()=>V(!0)}:{"data-id":"wide-drawer-next",label:"Next",rightIcon:oa,variant:a.Primary,onClick:s}:{"data-id":"wide-drawer-save",label:"Save",variant:a.Primary,onClick:R,disabled:z},[s,n,R,z]);return ea(Fe,{width:Lt,isOpen:t,disableAnimation:r,hideOverlay:!$&&!l,header:{...u,onClose:i?N:void 0,onCloseDisabled:O},footer:{note:E,actions:[H,K]},children:[$?Qe(Je,{$height:"calc(100vh - 136px)",children:Qe(zt,{children:Qe(Ze,{titleSize:A.S,subTitleSize:A.XXXS,withGradient:!0,withSpinner:!0,...k})})}):ea(At,{children:[X&&ea(Mt,{children:[p&&Qe(Ye,{icon:sa,title:"Selected Clusters",badge:{label:p.value.length}}),v&&Qe(_e,{width:"100%",...v}),f]}),D&&Qe(Ot,{children:Qe(Ye,{icon:h.icon,title:h.title,subTitle:h.description,badge:h.badge})}),ea(Nt,{children:[Qe(Pt,{isLeft:!0,heightOffset:I,...g}),Qe(Pt,{isRight:!0,heightOffset:I,...m})]})]}),Qe(va,{isOpen:w,onClose:()=>T(!1),onApprove:N}),Qe(e,{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:B,onClose:()=>V(!1),denyButton:{label:"Go Back",variant:a.Secondary,onClick:()=>V(!1)},approveButton:{label:"Skip",variant:a.Primary,onClick:()=>{s?.(),V(!1)}}})]})});Rt.displayName=Rt.name;export{ot as A,va as C,ba as D,xa as N,Va as O,Ca as P,Qa as R,kt as S,Ct as U,Rt as W,Sa as a,st as b,bt as c,lt as d,Ta as e,Ga as f,fa as g,Lt as h,ya as i,ka as j};
|