@odigos/ui-kit 0.0.101 → 0.0.103
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 +16 -0
- package/lib/chunks/{ui-components-365e1848.js → ui-components-71ed0e2b.js} +4 -4
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/action-form/custom-fields/add-cluster-info.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/delete-attributes.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/error-sampler.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/index.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/k8s-attributes.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/latency-sampler.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/pii-masking.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/probabilistic-sampler.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/rename-attributes.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/service-name-sampler.d.ts +1 -1
- package/lib/containers/action-form/custom-fields/span-attribute-sampler.d.ts +1 -1
- package/lib/containers.js +9 -8
- package/lib/functions.js +1 -1
- package/lib/hooks/useActionFormData.d.ts +2 -2
- package/lib/hooks.js +1 -1
- package/lib/icons.js +1 -1
- 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 +34 -55
- package/lib/types.js +1 -1
- package/package.json +9 -9
package/lib/containers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperativeHandle as a,useMemo as l,Fragment as r,useCallback as s,Children as c}from"react";import d,{css as u}from"styled-components";import{D as p,a as m,A as h,K as g,F as y,C as v,b,c as f,I as x,d as C,i as $,e as S,f as k,g as w,h as D,j as N,k as T,T as I,S as E,l as O,m as M,M as A,n as F,u as R,o as L,p as q,q as P,B as K,r as H,s as z,t as W,E as B,v as j,w as V,x as U,y as _,z as G,G as J,H as Y,J as X,L as Q,N as Z,O as ee,P as te,Q as oe,R as ie,U as ne,V as ae,W as le,X as re,Y as se,Z as ce,_ as de,$ as ue,a0 as pe,a1 as me,a2 as he,a3 as ge,a4 as ye,a5 as ve,a6 as be,a7 as fe,a8 as xe,a9 as Ce,aa as $e,ab as Se,ac as ke,ad as we,ae as De,af as Ne,ag as Te,ah as Ie,ai as Ee,aj as Oe,ak as Me,al as Ae,am as Fe,an as Re,ao as Le,ap as qe,aq as Pe,ar as Ke,as as He,at as ze,au as We,av as Be,aw as je,ax as Ve,ay as Ue,az as _e,aA as Ge,aB as Je,aC as Ye,aD as Xe,aE as Qe,aF as Ze,aG as et,aH as tt,aI as ot,aJ as it,aK as nt,aL as at,aM as lt,aN as rt,aO as st,aP as ct,aQ as dt,aR as ut,aS as pt,aT as mt,aU as ht,aV as gt,aW as yt,aX as vt,aY as bt,aZ as ft,a_ as xt,a$ as Ct,b0 as $t,b1 as St,b2 as kt,b3 as wt,b4 as Dt,b5 as Nt,b6 as Tt,b7 as It,b8 as Et,b9 as Ot,ba as Mt,bb as At,bc as Ft,bd as Rt,be as Lt,bf as qt,bg as Pt,bh as Kt,bi as Ht,bj as zt,bk as Wt,bl as Bt,bm as jt,bn as Vt,bo as Ut,bp as _t,bq as Gt,br as Jt,bs as Yt,bt as Xt,bu as Qt,bv as Zt,bw as eo,bx as to,by as oo,bz as io,bA as no,bB as ao,bC as lo,bD as ro,bE as so,bF as co,bG as uo,bH as po,bI as mo,bJ as ho,bK as go,bL as yo,bM as vo}from"./chunks/ui-components-
|
|
1
|
+
import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperativeHandle as a,useMemo as l,Fragment as r,useCallback as s,Children as c}from"react";import d,{css as u}from"styled-components";import{D as p,a as m,A as h,K as g,F as y,C as v,b,c as f,I as x,d as C,i as $,e as S,f as k,g as w,h as D,j as N,k as T,T as I,S as E,l as O,m as M,M as A,n as F,u as R,o as L,p as q,q as P,B as K,r as H,s as z,t as W,E as B,v as j,w as V,x as U,y as _,z as G,G as J,H as Y,J as X,L as Q,N as Z,O as ee,P as te,Q as oe,R as ie,U as ne,V as ae,W as le,X as re,Y as se,Z as ce,_ as de,$ as ue,a0 as pe,a1 as me,a2 as he,a3 as ge,a4 as ye,a5 as ve,a6 as be,a7 as fe,a8 as xe,a9 as Ce,aa as $e,ab as Se,ac as ke,ad as we,ae as De,af as Ne,ag as Te,ah as Ie,ai as Ee,aj as Oe,ak as Me,al as Ae,am as Fe,an as Re,ao as Le,ap as qe,aq as Pe,ar as Ke,as as He,at as ze,au as We,av as Be,aw as je,ax as Ve,ay as Ue,az as _e,aA as Ge,aB as Je,aC as Ye,aD as Xe,aE as Qe,aF as Ze,aG as et,aH as tt,aI as ot,aJ as it,aK as nt,aL as at,aM as lt,aN as rt,aO as st,aP as ct,aQ as dt,aR as ut,aS as pt,aT as mt,aU as ht,aV as gt,aW as yt,aX as vt,aY as bt,aZ as ft,a_ as xt,a$ as Ct,b0 as $t,b1 as St,b2 as kt,b3 as wt,b4 as Dt,b5 as Nt,b6 as Tt,b7 as It,b8 as Et,b9 as Ot,ba as Mt,bb as At,bc as Ft,bd as Rt,be as Lt,bf as qt,bg as Pt,bh as Kt,bi as Ht,bj as zt,bk as Wt,bl as Bt,bm as jt,bn as Vt,bo as Ut,bp as _t,bq as Gt,br as Jt,bs as Yt,bt as Xt,bu as Qt,bv as Zt,bw as eo,bx as to,by as oo,bz as io,bA as no,bB as ao,bC as lo,bD as ro,bE as so,bF as co,bG as uo,bH as po,bI as mo,bJ as ho,bK as go,bL as yo,bM as vo}from"./chunks/ui-components-71ed0e2b.js";import{CheckCircledIcon as bo,CrossCircledIcon as fo,EditIcon as xo,TrashIcon as Co,OdigosLogoText as $o,SearchIcon as So,FilterIcon as ko,DataStreamsIcon as wo,CheckIcon as Do,OdigosLogo as No,ArrowIcon as To,PlusIcon as Io,RefreshLeftArrowIcon as Eo,NotificationIcon as Oo,UserIcon as Mo,ImageErrorIcon as Ao,OverviewIcon as Fo,RulesIcon as Ro,SourcesIcon as Lo,ActionsIcon as qo,DestinationsIcon as Po,SlackLogo as Ko,CopyIcon as Ho,KeyIcon as zo,TerminalIcon as Wo,GearIcon as Bo,WarningTriangleIcon as jo,TraceViewIcon as Vo,ErrorTriangleIcon as Uo}from"./icons.js";import{useNodesState as _o,useEdgesState as Go,applyNodeChanges as Jo,MarkerType as Yo}from"@xyflow/react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-1dea551d.js";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";const Xo=e=>{const{type:t,name:o,notes:i,signals:n,disabled:a,fields:{collectContainerAttributes:l,collectReplicaSetAttributes:r,collectWorkloadId:s,collectClusterId:c,labelsAttributes:d,annotationsAttributes:u,clusterAttributes:y,overwriteExistingValues:v,attributeNamesToDelete:b,renames:f,piiCategories:x,fallbackSamplingRatio:C,samplingPercentage:$,endpointsFilters:S,servicesNameFilters:k,attributeFilters:w}}=e,D=[{title:p.TYPE,value:t},{type:m.ActiveStatus,title:p.STATUS,value:String(!a)},{type:m.Monitors,title:p.SIGNALS_FOR_PROCESSING,value:n?.map(e=>e.toLowerCase()).join(", ")||""},{title:p.NAME,value:o||""},{title:p.NOTES,value:i||""},{type:m.Divider}];if(t===h.K8sAttributes&&(D.push({title:"Collect Container Attributes",value:String(l)}),D.push({title:"Collect ReplicaSet Attributes",value:String(r)}),D.push({title:"Collect Workload ID",value:String(s)}),D.push({title:"Collect Cluster ID",value:String(c)}),d?.length&&D.push({type:m.Divider}),d?.forEach(({labelKey:e,attributeKey:t,from:o},i)=>{let n="";n+=`Label Key: ${e}\n`,n+=`Attribute Key: ${t}\n`,n+=`From: ${o||g.Pod}\n`,D.push({title:"Label"+(d.length>1?` #${i+1}`:""),value:n})}),u?.length&&D.push({type:m.Divider}),u?.forEach(({annotationKey:e,attributeKey:t,from:o},i)=>{let n="";n+=`Annotation Key: ${e}\n`,n+=`Attribute Key: ${t}\n`,n+=`From: ${o||g.Pod}\n`,D.push({title:"Annotation"+(u.length>1?` #${i+1}`:""),value:n})})),t===h.AddClusterInfo){D.push({title:"Overwrite Existing Values",value:String(v||!1)});let e="";y?.forEach(({attributeName:t,attributeStringValue:o},i)=>{e+=`${t}: ${o}`,i<y.length-1&&(e+=", ")}),D.push({title:"Attributes",value:e})}if(t===h.DeleteAttributes){let e="";b?.forEach((t,o)=>{e+=t,o<b.length-1&&(e+=", ")}),D.push({title:"Attributes",value:e})}if(t===h.RenameAttributes){let e="";const t=Object.entries(f||{});t.forEach(([o,i],n)=>{e+=`${o}: ${i}`,n<t.length-1&&(e+=", ")}),D.push({title:"Attributes",value:e})}if(t===h.PiiMasking){let e="";x?.forEach((t,o)=>{e+=t,o<x.length-1&&(e+=", ")}),D.push({title:"Categories",value:e})}return t===h.ErrorSampler&&D.push({title:"Sampling Ratio",value:String(C)}),t===h.ProbabilisticSampler&&D.push({title:"Sampling Percentage",value:String($)}),t===h.LatencySampler&&S?.forEach(({serviceName:e,httpRoute:t,minimumLatencyThreshold:o,fallbackSamplingRatio:i},n)=>{let a="";a+=`Service Name: ${e}\n`,a+=`HTTP Route: ${t}\n`,a+=`Min. Latency: ${o}\n`,a+=`Fallback Sampling Ratio: ${i}`,D.push({title:"Endpoint"+(S.length>1?` #${n+1}`:""),value:a})}),t===h.ServiceNameSampler&&k?.forEach(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:o},i)=>{let n="";n+=`Service Name: ${e}\n`,n+=`Sampling Ratio: ${t}\n`,n+=`Fallback Sampling Ratio: ${o}`,D.push({title:"Filter"+(k.length>1?` #${i+1}`:""),value:n})}),t===h.SpanAttributeSampler&&w?.forEach(({serviceName:e,attributeKey:t,fallbackSamplingRatio:o,condition:i},n)=>{let a="";a+=`Service Name: ${e}\n`,a+=`Attribute Key: ${t}\n`,a+=`Fallback Sampling Ratio: ${o}\n`;const l=Object.keys(i)[0];a+=`Condition: ${l}\n`,a+=`Operation: ${i[l]?.operation}\n`,a+=`Expected Value: ${i[l]?.expectedValue}`,"jsonCondition"===l&&(a+=`\nJSON Path: ${i[l].jsonPath}`),D.push({title:"Filter"+(w.length>1?` #${n+1}`:""),value:a})}),D},Qo=f.PiiCategories,Zo=d.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: row;
|
|
4
4
|
gap: 32px;
|
|
@@ -14,7 +14,7 @@ import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperative
|
|
|
14
14
|
padding: 4px;
|
|
15
15
|
`,vi=d(T)`
|
|
16
16
|
margin-bottom: 12px;
|
|
17
|
-
`,bi=({isUpdate:t,action:o,formData:i,formErrors:n,handleFormChange:a})=>{const l=I.useTheme();return e.createElement(yi,null,t&&e.createElement("div",null,e.createElement(vi,null,"Status"),e.createElement(E,{options:[{icon:bo,label:p.ENABLED,value:!1,selectedBgColor:l.text.success+I.opacity.hex["050"]},{icon:fo,label:p.DISABLED,value:!0,selectedBgColor:l.text.error+I.opacity.hex["050"]}],selected:i.disabled,setSelected:e=>a("disabled",e)})),!t&&e.createElement(O,{title:"",description:o.docsDescription,actionButton:e.createElement(M,{endpoint:o.docsEndpoint})}),e.createElement(A,{title:"Signals for Processing",required:!0,allowedSignals:o.allowedSignals,selectedSignals:i.signals,setSelectedSignals:e=>a("signals",e),errorMessage:n.signals}),!t&&e.createElement(x,{title:"Action name",placeholder:"Use a name that describes the action",value:i.name,onChange:({target:{value:e}})=>a("name",e),errorMessage:n.name}),e.createElement(gi,{actionType:o.type,value:i,setValue:(e,t)=>a(e
|
|
17
|
+
`,bi=({isUpdate:t,action:o,formData:i,formErrors:n,handleFormChange:a})=>{const l=I.useTheme();return e.createElement(yi,null,t&&e.createElement("div",null,e.createElement(vi,null,"Status"),e.createElement(E,{options:[{icon:bo,label:p.ENABLED,value:!1,selectedBgColor:l.text.success+I.opacity.hex["050"]},{icon:fo,label:p.DISABLED,value:!0,selectedBgColor:l.text.error+I.opacity.hex["050"]}],selected:i.disabled,setSelected:e=>a("disabled",e)})),!t&&e.createElement(O,{title:"",description:o.docsDescription,actionButton:e.createElement(M,{endpoint:o.docsEndpoint})}),e.createElement(A,{title:"Signals for Processing",required:!0,allowedSignals:o.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>a("signals",e),errorMessage:n.signals}),!t&&e.createElement(x,{title:"Action name",placeholder:"Use a name that describes the action",value:i.name||"",onChange:({target:{value:e}})=>a("name",e),errorMessage:n.name}),e.createElement(gi,{actionType:o.type,value:i.fields,setValue:(e,t)=>a(`fields.${e}`,t),formErrors:n}),e.createElement(F,{title:"Notes",value:i.notes||"",onChange:({target:{value:e}})=>a("notes",e),errorMessage:n.notes}))},fi=i(({children:o,width:i=640,title:r,titleTooltip:s,hideEditTitleFromEdit:c,icons:d,iconSrcs:u,isEdit:p=!1,isFormDirty:m=!1,isLastItem:h=!1,onClose:g,onEdit:y,onSave:v,onDelete:b,onCancel:f,tabs:x,headerActionButtons:C},$)=>{const S=I.useTheme(),{isThisPending:k}=R(),{addNotification:w}=L(),{drawerType:D,drawerEntityId:N,setDrawerType:E,setDrawerEntityId:O}=q();P({key:"Enter",active:p},()=>Z());const[M,A]=t(!1),[F,V]=t(!1),U=n(null),_=D===B.Source,G=()=>{A(!1),V(!1)},J=()=>{G(),y&&y(!1),E(null),O(null),g?.()};a($,()=>({closeDrawer:J}));const Y=()=>{U.current?.clearTitle(),f&&f(),G()},X=()=>{const e=U.current?.isTitleDirty();m||e?V(!0):Y()},Q=()=>{A(!0)},Z=()=>{v&&v(U.current?.getTitle()||"")},ee=l(()=>!!D&&k({entityType:D,entityId:N}),[D,N]),te=e=>{w({type:j.Warning,title:"Pending",message:`Cannot click ${e}, ${D} is pending`,hideFromHistory:!0})},oe=C||[];return y&&!p&&oe.push({"data-id":"drawer-edit",variant:"tertiary",onClick:ee?()=>te("edit"):()=>y(!0),children:e.createElement(e.Fragment,null,e.createElement(xo,null),e.createElement(T,{size:14,family:"secondary",decoration:"underline"},"Edit"))}),b&&!p&&oe.push({"data-id":"drawer-delete",variant:"tertiary",onClick:ee?()=>te(_?"uninstrument":"delete"):Q,children:e.createElement(e.Fragment,null,e.createElement(Co,null),e.createElement(T,{color:S.text.error,size:14,family:"secondary",decoration:"underline"},_?K.UNINSTRUMENT:K.DELETE))}),e.createElement(e.Fragment,null,e.createElement(H,{isOpen:!0,onClose:p?X:J,closeOnEscape:!M&&!F,width:`${i+64}px`,header:{icons:d,iconSrcs:u,title:r,titleTooltip:s,replaceTitleWith:!c&&p?e.createElement(xi,{ref:U,title:r}):void 0,actionButtons:oe,tabs:x},footer:{isOpen:p,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:Z,children:K.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:X,children:K.CANCEL}],rightButtons:b?[{"data-id":"drawer-delete",variant:"tertiary",onClick:Q,children:e.createElement(e.Fragment,null,e.createElement(Co,null),e.createElement(T,{size:14,color:S.text.error,family:"secondary",decoration:"underline"},K.DELETE))}]:[]}},o),e.createElement(z,{isOpen:M,noOverlay:!0,name:`${D}${r?` (${r})`:""}`,type:D,isLastItem:h,onApprove:()=>{b&&b(),G()},onDeny:G}),e.createElement(W,{isOpen:F,noOverlay:!0,name:"edit mode",onApprove:Y,onDeny:G}))}),xi=i(({title:i},n)=>{const[l,r]=t(i);return o(()=>{r(i)},[i]),a(n,()=>({getTitle:()=>l||i,isTitleDirty:()=>l!==i,clearTitle:()=>r(i)})),e.createElement(x,{"data-id":"title",value:l,onChange:e=>r(e.target.value)})});xi.displayName=xi.name,fi.displayName=fi.name;const Ci=d.div`
|
|
18
18
|
width: 100%;
|
|
19
19
|
height: 100%;
|
|
20
20
|
max-height: calc(100vh - 220px);
|
|
@@ -24,10 +24,10 @@ import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperative
|
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
26
|
gap: 12px;
|
|
27
|
-
`,Si=({updateAction:o,deleteAction:i})=>{const{actions:a}=V(),{drawerType:r,drawerEntityId:s}=q(),c=n(null),d=r!==B.Action,[u,m]=t(!1),[h,g]=t(!1),{formData:y,formErrors:v,handleFormChange:b,resetFormData:f,validateForm:x,loadFormWithDrawerItem:C}=U(),$=l(()=>{if(d)return null;const e=a?.find(e=>e.id===s);return e&&C(e),e},[d,s,a]);if(!$)return null;const S=_.find(({type:e})=>e===$.type)||_.find(({label:e})=>"Attributes"===e)?.items?.find(({type:e})=>e===$.type)||_.find(({label:e})=>"Samplers"===e)?.items?.find(({type:e})=>e===$.type);return e.createElement(fi,{ref:c,title:$.
|
|
27
|
+
`,Si=({updateAction:o,deleteAction:i})=>{const{actions:a}=V(),{drawerType:r,drawerEntityId:s}=q(),c=n(null),d=r!==B.Action,[u,m]=t(!1),[h,g]=t(!1),{formData:y,formErrors:v,handleFormChange:b,resetFormData:f,validateForm:x,loadFormWithDrawerItem:C}=U(),$=l(()=>{if(d)return null;const e=a?.find(e=>e.id===s);return e&&C(e),e},[d,s,a]);if(!$)return null;const S=_.find(({type:e})=>e===$.type)||_.find(({label:e})=>"Attributes"===e)?.items?.find(({type:e})=>e===$.type)||_.find(({label:e})=>"Samplers"===e)?.items?.find(({type:e})=>e===$.type);return e.createElement(fi,{ref:c,title:$.name||$.type,icons:[G($.type)],isEdit:u,isFormDirty:h,onEdit:e=>{m("boolean"!=typeof e||e)},onSave:e=>{if(x({withAlert:!0,alertTitle:X.Update})){const t=e!==$.type?e:"";b("name",t),o(s,{...y,name:t}),m(!1),g(!1)}},onDelete:()=>{i(s,$.type),m(!1),g(!1),f(),c.current?.closeDrawer()},onCancel:()=>{m(!1),g(!1),C($)}},u&&S?e.createElement(Ci,null,e.createElement(bi,{isUpdate:!0,action:S,formData:y,formErrors:v,handleFormChange:(...e)=>{g(!0),b(...e)}})):e.createElement($i,null,e.createElement(J,{conditions:$.conditions||[]}),e.createElement(Y,{title:p.ACTION_DETAILS,data:$?Xo($):[]})))},ki=d(Q)`
|
|
28
28
|
margin-top: 24px;
|
|
29
29
|
gap: 12px;
|
|
30
|
-
`,wi=({createAction:o})=>{const{currentModal:i,setCurrentModal:n}=Z(),a=i===B.Action,{formData:l,formErrors:r,handleFormChange:s,resetFormData:c,validateForm:d}=U(),[u,m]=t(void 0),h=()=>{c(),m(void 0),n("")},g=()=>{if(!d({withAlert:!0,alertTitle:X.Create}))return null;o(l),h()};return P({key:"Enter",active:a},()=>g()),e.createElement(ee,{isOpen:a,onClose:h,header:{title:"Add Action"},actionComponent:e.createElement(te,{buttons:[{variant:"primary",label:"DONE",onClick:g,disabled:!u}]})},e.createElement(oe,null,e.createElement(O,{title:"Select Action",description:"Select an action to modify telemetry data before it`s sent to destinations. Choose an action type and configure its details."}),e.createElement(ki,null,e.createElement(ie,{type:j.Warning,message:ne.DEFINED_FOR_ALL_STREAMS(p.ACTIONS)}),e.createElement(ae,{options:_,selectedOption:u,onOptionSelect:e=>{return t=e,c(),s("type",t?.type||""),void m(t);var t},autoFocus:!u?.type})),u?.type?e.createElement("div",null,e.createElement(le,{margin:"16px 0"}),e.createElement(bi,{action:u,formData:l,formErrors:r,handleFormChange:s})):null))},Di=e=>{const{type:t,
|
|
30
|
+
`,wi=({createAction:o})=>{const{currentModal:i,setCurrentModal:n}=Z(),a=i===B.Action,{formData:l,formErrors:r,handleFormChange:s,resetFormData:c,validateForm:d}=U(),[u,m]=t(void 0),h=()=>{c(),m(void 0),n("")},g=()=>{if(!d({withAlert:!0,alertTitle:X.Create}))return null;o(l),h()};return P({key:"Enter",active:a},()=>g()),e.createElement(ee,{isOpen:a,onClose:h,header:{title:"Add Action"},actionComponent:e.createElement(te,{buttons:[{variant:"primary",label:"DONE",onClick:g,disabled:!u}]})},e.createElement(oe,null,e.createElement(O,{title:"Select Action",description:"Select an action to modify telemetry data before it`s sent to destinations. Choose an action type and configure its details."}),e.createElement(ki,null,e.createElement(ie,{type:j.Warning,message:ne.DEFINED_FOR_ALL_STREAMS(p.ACTIONS)}),e.createElement(ae,{options:_,selectedOption:u,onOptionSelect:e=>{return t=e,c(),s("type",t?.type||""),void m(t);var t},autoFocus:!u?.type})),u?.type?e.createElement("div",null,e.createElement(le,{margin:"16px 0"}),e.createElement(bi,{action:u,formData:l,formErrors:r,handleFormChange:s})):null))},Di=e=>{const{type:t,fields:{collectContainerAttributes:o,collectReplicaSetAttributes:i,collectWorkloadId:n,collectClusterId:a,labelsAttributes:l,annotationsAttributes:r,clusterAttributes:s,overwriteExistingValues:c,attributeNamesToDelete:d,renames:u,piiCategories:p,fallbackSamplingRatio:m,samplingPercentage:y,endpointsFilters:v,attributeFilters:b,servicesNameFilters:f}}=e;let x="";if(t===h.K8sAttributes&&(o&&(x+="Container Attributes, "),i&&(x+="ReplicaSet Attributes, "),n&&(x+="Workload ID, "),a&&(x+="Cluster ID, "),l?.forEach(({labelKey:e,attributeKey:t,from:o},i)=>{x+=`Label: ${e} ${t} ${o||g.Pod} `,i===l.length-1&&(x+=", ")}),r?.forEach(({annotationKey:e,attributeKey:t,from:o},i)=>{x+=`Annotation: ${e} ${t} ${o||g.Pod} `,i===r.length-1&&(x+=", ")})),t===h.AddClusterInfo&&(x+=`Overwrite Existing: ${c}\n`,s?.forEach(({attributeName:e,attributeStringValue:t},o)=>{x+=`${e}: ${t}`,o<s.length-1&&(x+=", ")})),t===h.DeleteAttributes&&d?.forEach((e,t)=>{x+=e,t<d.length-1&&(x+=", ")}),t===h.RenameAttributes){const e=Object.entries(u||{});e.forEach(([t,o],i)=>{x+=`${t}: ${o}`,i<e.length-1&&(x+=", ")})}return t===h.PiiMasking&&p?.forEach((e,t)=>{x+=e,t<p.length-1&&(x+=", ")}),t===h.ErrorSampler&&(x+=String(m)),t===h.ProbabilisticSampler&&(x+=String(y),x+="%"),t===h.LatencySampler&&v?.forEach(({serviceName:e,httpRoute:t,minimumLatencyThreshold:o,fallbackSamplingRatio:i},n)=>{x+=`Endpoint${v.length>1?` #${n+1}`:""}=${e}${t}\n`,x+=` Latency=${o}`,x+=` Sampling=${i}`,n<v.length-1&&(x+=", ")}),t===h.ServiceNameSampler&&f?.forEach(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:o})=>{x+=`Service Name: ${e}, `,x+=`Sampling Ratio: ${t}, `,x+=`Fallback Sampling Ratio: ${o}\n`}),t===h.SpanAttributeSampler&&b?.forEach(({serviceName:e,attributeKey:t,fallbackSamplingRatio:o})=>{x+=`Service Name: ${e}, `,x+=`Attribute Key: ${t}, `,x+=`Fallback Sampling Ratio: ${o}\n`}),x},Ni=({conditions:t,id:o})=>{const{errors:i,warnings:n,disableds:a,hasLoadings:r}=l(()=>re(t),[t]),s=i.length>0?i:n.length>0?n:a.length>0?a:[];if(s.length>0)return e.createElement("div",{style:{lineHeight:1}},e.createElement(Ti,{conditions:s,id:o}));const c=r?pe.Loading:j.Success;return e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:c,title:c,withBorder:!0,withIcon:!0}))},Ti=({conditions:t,id:o})=>{const i=I.useTheme();return e.createElement(ce,null,de(t).map(({status:t,type:n,reason:a,message:l,lastTransitionTime:r},s)=>{"loading"!==t&&"disabled"!==t||(t=j.Info);const c=me(t,i);return e.createElement(ue,{key:`condition-${o}-${t}-${n}-${s}`,titleIcon:c,title:n,text:l||a||"",timestamp:r},e.createElement(se,{status:t,title:a||n,withBorder:!0,withIcon:!0}))}))},Ii=({instrumentationRules:e,sources:t,actions:o,destinations:i,searchText:n,selectedCategory:a})=>{const l=n?e.filter(e=>e.type?.toLowerCase().includes(n)||e.ruleName?.toLowerCase().includes(n)):e,r=n?t.filter(e=>e.name?.toLowerCase().includes(n)||e.otelServiceName?.toLowerCase().includes(n)||e.namespace?.toLowerCase().includes(n)):t,s=n?o.filter(e=>e.type?.toLowerCase().includes(n)||e.name?.toLowerCase().includes(n)):o,c=n?i.filter(e=>e.destinationType.displayName?.toLowerCase().includes(n)||e.name?.toLowerCase().includes(n)):i,d=[{category:B.Source,label:"Sources",count:r.length,entities:[]},{category:B.Action,label:"Actions",count:s.length,entities:[]},{category:B.Destination,label:"Destinations",count:c.length,entities:[]},{category:B.InstrumentationRule,label:"Instrumentation Rules",count:l.length,entities:[]}];d.unshift({category:"all",label:"All",count:l.length+r.length+s.length+c.length,entities:[]});const u=d.filter(({count:e,category:t})=>!!e&&"all"!==t&&["all",t].includes(a)).map(e=>({...e,entities:e.category===B.InstrumentationRule?l:e.category===B.Source?r:e.category===B.Action?s:e.category===B.Destination?c:[]}));return{categories:d,searchResults:u}},Ei=[{key:"icon",title:""},{key:"name",title:p.NAME,sortable:!0},{key:"signals",title:p.MONITORS},{key:"active-status",title:p.STATUS},{key:"conditions",title:"Conditions"},{key:"type",title:p.TYPE,sortable:!0},{key:"spec",title:"Spec",sortable:!0},{key:"notes",title:p.NOTES,sortable:!0}],Oi=({maxHeight:t,maxWidth:o})=>{const i=I.useTheme(),n=he(),{actions:a,actionsLoading:r}=V(),{setDrawerType:s,setDrawerEntityId:c}=q(),d=l(()=>Ii({instrumentationRules:[],sources:[],actions:ge(a,n),destinations:[],searchText:n.searchText,selectedCategory:B.Action}).searchResults.find(({category:e})=>e===B.Action)?.entities||[],[a,n]),u=l(()=>d.map(t=>{const{hasErrors:o,hasWarnings:n,hasDisableds:a}=re(t.conditions||[]);return{status:o?j.Error:n?j.Warning:void 0,faded:a,onClick:()=>{s(B.Action),c(t.id)},cells:[{columnKey:"icon",component:()=>e.createElement(ye,{icon:G(t.type)})},{columnKey:"name",value:ve(t,B.Action,{prioritizeDisplayName:!0})},{columnKey:"type",value:t.type,textColor:i.text.info},{columnKey:"notes",value:t.notes,textColor:i.text.info,withTooltip:!0},{columnKey:"spec",value:Di(t),textColor:i.text.info,withTooltip:!0},{columnKey:"signals",component:()=>e.createElement(be,{withLabels:!0,monitors:t.signals||[]})},{columnKey:"conditions",component:()=>e.createElement(Ni,{conditions:t.conditions||[],id:t.id})},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:t.disabled?j.Error:j.Success,title:t.disabled?p.DISABLED:p.ENABLED,withIcon:!0,withBorder:!0}))}]}}),[d]),{badge:m,badgeTooltip:h}=l(()=>d.length!==a.length?{badge:`${d.length}/${a.length}`,badgeTooltip:p.FILTERED_COUNT_TOOLTIP}:{badge:a.length,badgeTooltip:void 0},[d,a]);return e.createElement(fe,{$maxWidth:o},e.createElement(xe,null,e.createElement(Ce,{icon:$e(B.Action),title:p.ACTIONS,badge:m,badgeTooltip:h,loading:r})),e.createElement(Se,{$maxHeight:t},e.createElement(ke,{columns:Ei,rows:u})),!d.length&&e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Mi=d(Q)`
|
|
31
31
|
// width: 100vw;
|
|
32
32
|
// height: 100vh;
|
|
33
33
|
gap: 64px;
|
|
@@ -45,7 +45,7 @@ import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperative
|
|
|
45
45
|
text-align: center;
|
|
46
46
|
line-height: 26px;
|
|
47
47
|
color: ${({theme:e})=>e.text.info};
|
|
48
|
-
`,Li=()=>{const[i,n]=t(0);return o(()=>{(async()=>{for(let e=0;e<=100;e+=5)await Ie(500),n(e)})()},[]),e.createElement(Mi,null,e.createElement($o,{size:100}),e.createElement(Ne,{width:400}),e.createElement(Ai,null,e.createElement(ce,{$gap:16},e.createElement(Fi,null,"Preparing your workspace..."),e.createElement(Te,{label:`${i}%`})),e.createElement(Ri,null,"It can take up to a few minutes. Grab a cup of coffee, look out a window, and enjoy your free moment!")))},{nodeHeight:qi,framePadding:Pi}=Ae,Ki=(e,t)=>{const{theme:o,label:i,isMultiTarget:n,isError:a,animated:l}=t||{},[r,s]=e.split("-to-");return{id:e,type:i?Me.Labeled:"default",source:r,target:s,animated:l,data:{label:i,isMultiTarget:n,isError:a},style:{stroke:a?o?.colors.dark_red:o?.colors.border}}},{nodeWidth:Hi,nodeHeight:zi,framePadding:Wi}=Ae,Bi=e=>({nodeWidth:Hi,nodeHeight:zi,id:e.ruleId,type:B.InstrumentationRule,status:void 0,title:ve(e,B.InstrumentationRule,{prioritizeDisplayName:!0}),subTitle:e.type,icon:Re(e.type),isActive:!e.disabled,raw:e}),{nodeWidth:ji,nodeHeight:Vi,framePadding:Ui}=Ae,_i=e=>{const{hasDisableds:t,priorotizedStatus:o}=re(e.conditions||[]);return{nodeWidth:ji,nodeHeight:Vi,id:e.id,type:B.Action,status:o,faded:t,title:ve(e,B.Action,{prioritizeDisplayName:!0}),subTitle:e.type,icon:G(e.type),monitors:e.
|
|
48
|
+
`,Li=()=>{const[i,n]=t(0);return o(()=>{(async()=>{for(let e=0;e<=100;e+=5)await Ie(500),n(e)})()},[]),e.createElement(Mi,null,e.createElement($o,{size:100}),e.createElement(Ne,{width:400}),e.createElement(Ai,null,e.createElement(ce,{$gap:16},e.createElement(Fi,null,"Preparing your workspace..."),e.createElement(Te,{label:`${i}%`})),e.createElement(Ri,null,"It can take up to a few minutes. Grab a cup of coffee, look out a window, and enjoy your free moment!")))},{nodeHeight:qi,framePadding:Pi}=Ae,Ki=(e,t)=>{const{theme:o,label:i,isMultiTarget:n,isError:a,animated:l}=t||{},[r,s]=e.split("-to-");return{id:e,type:i?Me.Labeled:"default",source:r,target:s,animated:l,data:{label:i,isMultiTarget:n,isError:a},style:{stroke:a?o?.colors.dark_red:o?.colors.border}}},{nodeWidth:Hi,nodeHeight:zi,framePadding:Wi}=Ae,Bi=e=>({nodeWidth:Hi,nodeHeight:zi,id:e.ruleId,type:B.InstrumentationRule,status:void 0,title:ve(e,B.InstrumentationRule,{prioritizeDisplayName:!0}),subTitle:e.type,icon:Re(e.type),isActive:!e.disabled,raw:e}),{nodeWidth:ji,nodeHeight:Vi,framePadding:Ui}=Ae,_i=e=>{const{hasDisableds:t,priorotizedStatus:o}=re(e.conditions||[]);return{nodeWidth:ji,nodeHeight:Vi,id:e.id,type:B.Action,status:o,faded:t,title:ve(e,B.Action,{prioritizeDisplayName:!0}),subTitle:e.type,icon:G(e.type),monitors:e.signals,isActive:!e.disabled,raw:e}},{nodeWidth:Gi,nodeHeight:Ji,framePadding:Yi}=Ae,Xi=e=>{const{priorotizedStatus:t,hasDisableds:o}=re(e.conditions||[]);return{nodeWidth:Gi,nodeHeight:Ji,id:{namespace:e.namespace,name:e.name,kind:e.kind},type:B.Source,status:t,faded:o,title:ve(e,B.Source,{extended:!0}),subTitle:`${e.namespace} • ${e.kind}`,icons:Le(e.containers),raw:e}},{nodeWidth:Qi,nodeHeight:Zi}=Ae,{nodeWidth:en,nodeHeight:tn,framePadding:on}=Ae,nn=e=>{const{hasDisableds:t,priorotizedStatus:o}=re(e.conditions||[]),{icon:i,iconSrc:n}=Ke(e.destinationType.type);return{nodeWidth:en,nodeHeight:tn,id:e.id,type:B.Destination,status:o,faded:t,title:ve(e,B.Destination,{prioritizeDisplayName:!0}),subTitle:e.destinationType.displayName,icon:i,iconSrc:n,monitors:Pe(e.exportedSignals),isActive:!e.disabled,raw:e}},an=d.div`
|
|
49
49
|
width: 100%;
|
|
50
50
|
height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px)`};
|
|
51
51
|
position: relative;
|
|
@@ -355,8 +355,9 @@ import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperative
|
|
|
355
355
|
`,hl=d(we)`
|
|
356
356
|
padding-bottom: ${({$addPadding:e})=>e?"16px":"0"};
|
|
357
357
|
`,gl=d(T)`
|
|
358
|
-
width:
|
|
359
|
-
|
|
358
|
+
width: 42px;
|
|
359
|
+
text-align: right;
|
|
360
|
+
`,yl=({isModal:t=!1,withInstances:o=!0,isFetchingEachNamespace:i,fetchedNamespaces:n,filteredNamespacesAndSources:a,selectedNamespace:l,onSelectNamespace:r,selectedSources:s,onSelectSource:c,selectedFutureApps:d,onSelectFutureApps:u})=>{const m=I.useTheme(),{namespacesLoading:h}=V(),g=Object.entries(a||{});if(!g?.length)return e.createElement(we,null,h?e.createElement(vt,null):e.createElement(De,{title:p.NO_SOURCES,subTitle:r?p.PLEASE_MAKE_SURE_UNIGNORED_NAMESPACES:p.PLEASE_ADD_SOURCE}));const y=$e(B.Namespace);return e.createElement(sl,{$isModal:t},i&&e.createElement(vt,{scale:1.2}),g.map(([t,a])=>{const g=s?.[t]||[],b=d?.[t]?.selected||!1,f=g.filter(({selected:e})=>e),x=g.length>0,C=l===t,$=f.length>0&&f.length===a.length,S=f.length>0&&f.length!==a.length,w=a.length>0,D=1===a.length;return r||w?e.createElement(cl,{key:`namespace-${t}`,"data-id":`namespace-${t}`,$selected:$,$isOpen:C},e.createElement(dl,{$selected:$,$withClick:!!r,onClick:()=>r?.(t)},e.createElement(ce,{$gap:12},r&&e.createElement(v,{partiallyChecked:S,value:$,onChange:e=>r(t,e)}),e.createElement(y,null),e.createElement(T,null,t)),e.createElement(ce,{$gap:12},u&&e.createElement(k,{title:p.FUTURE_APPS_TITLE,tooltip:p.FUTURE_APPS_DESCRIPTION,initialValue:b,onChange:e=>u(e,t),flipHorizontally:!0}),i&&!n?.includes(t)?e.createElement(vt,{scale:.8}):e.createElement(gl,{size:10,color:m.text.grey},x?`${f.length}/${a.length}`:null),r&&e.createElement(ut,{extend:C}))),(C||!r)&&(w?e.createElement(pl,{$addPadding:!c},e.createElement(ml,null,e.createElement(le,{orientation:"vertical",length:(D?24:34*a.length)+"px"})),a.map(i=>{const n=f.some(({name:e})=>e===i.name);return e.createElement(vl,{key:`source-${i.name}`,withInstances:o,source:i,namespace:t,isSelected:n,onSelect:c})})):e.createElement(hl,{$addPadding:!c},h||i&&!n?.includes(t)?e.createElement(vt,null):e.createElement(De,{title:p.NO_SOURCES_NAMESPACE,subTitle:p.TRY_SEARCH_OR_OTHER_NAMESPACE})))):null}))},vl=({withInstances:t,source:o,namespace:i,isSelected:n,onSelect:a})=>e.createElement(ul,{"data-id":`source-${o.name}`,$selected:n,$withClick:!!a,onClick:()=>a?.(o)},e.createElement(ce,{$gap:12},a&&e.createElement(v,{value:n,onChange:()=>a(o,i)}),e.createElement(ce,{$gap:4},e.createElement(T,null,o.name),e.createElement(T,{opacity:.8,size:10},t?` • ${o.numberOfInstances||0} running instance${1!==o.numberOfInstances?"s":""}`:"",` • ${o.kind}`)))),bl=d.div`
|
|
360
361
|
display: flex;
|
|
361
362
|
flex-direction: column;
|
|
362
363
|
align-items: center;
|
|
@@ -384,7 +385,7 @@ import e,{useState as t,useEffect as o,forwardRef as i,useRef as n,useImperative
|
|
|
384
385
|
display: flex;
|
|
385
386
|
flex-direction: column;
|
|
386
387
|
gap: 12px;
|
|
387
|
-
`,Fl=({persistSources:i,updateSource:a,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d})=>{const{sources:u}=V(),{selectedStreamName:m}=He(),{drawerType:h,drawerEntityId:g}=q(),y=l(()=>Be(u,m),[u,m]),v=n(null),b=h===B.Source,[f,x]=t(!1),[C,$]=t(!1),[S,k]=t(Il.Overview),[w,D]=t(null);o(()=>{b&&g&&s(g).then(e=>D(e||null))},[b,g
|
|
388
|
+
`,Fl=({persistSources:i,updateSource:a,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d})=>{const{sources:u}=V(),{selectedStreamName:m}=He(),{drawerType:h,drawerEntityId:g}=q(),y=l(()=>Be(u,m),[u,m]),v=n(null),b=h===B.Source,[f,x]=t(!1),[C,$]=t(!1),[S,k]=t(Il.Overview),[w,D]=t(null);o(()=>{b&&g&&s(g).then(e=>D(e||null))},[b,g]);const{formData:N,handleFormChange:I,resetFormData:E,loadFormWithDrawerItem:O}=Xt(),M=l(()=>{if(!b)return null;const e=(w&&JSON.stringify(Ht(w))===JSON.stringify(Ht(g))?w:null)||y?.find(e=>e.namespace===g.namespace&&e.name===g.name&&e.kind===g.kind);return e&&O(e),e},[b,g,y,w]),A=l(()=>{const e=M?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===pe.Loading,containers:M?.containers||[]}},[M]),F=l(()=>{const e=[{label:Il.Overview,onClick:()=>k(Il.Overview),selected:S===Il.Overview}];return El.includes(M?.kind)&&e.push({label:Il.Pods,onClick:()=>k(Il.Pods),selected:S===Il.Pods}),M?.containers?.some(({language:e})=>Ol.includes(e))&&e.push({label:Il.Libraries,onClick:()=>k(Il.Libraries),selected:S===Il.Libraries}),e},[S,M]);return M?e.createElement(fi,{ref:v,onClose:()=>{k(Il.Overview),D(null)},title:M.otelServiceName||M.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:Le(M.containers),isEdit:f,isFormDirty:C,onEdit:S===Il.Overview?e=>{x("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=N.otelServiceName!==M.name?N.otelServiceName:"";I("otelServiceName",e),await a(g,{...N,otelServiceName:e}),D(null),$(!1),x(!1)},onDelete:S===Il.Overview?async()=>{const{namespace:e}=M;i({[e]:[{...M,selected:!1,currentStreamName:m}]},{}),D(null),$(!1),x(!1),E(),v.current?.closeDrawer()}:void 0,onCancel:()=>{$(!1),x(!1),I("otelServiceName",M.otelServiceName||M.name||"")},isLastItem:1===y.length,tabs:F,headerActionButtons:[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>r([g]),children:e.createElement(e.Fragment,null,e.createElement(Eo,null),e.createElement(T,{size:14,family:"secondary",decoration:"underline"},"Restart"))}]},S===Il.Overview?f?e.createElement(Ml,null,e.createElement(wl,{formData:N,handleFormChange:(...e)=>{$(!0),I(...e),I("currentStreamName",m)}})):e.createElement(Al,null,e.createElement(J,{conditions:M.conditions||[]}),e.createElement(Y,{title:p.SOURCE_DETAILS,data:M?Sl(M):[]}),e.createElement(Y,{title:p.DETECTED_CONTAINERS,titleBadge:A.isLoading?pe.Loading:A.containers.length,description:A.description||p.DETECTED_CONTAINERS_DESCRIPTION},A.containers.map(t=>e.createElement(Qt,{key:`source-container-${t.containerName}`,...t,callbackRuntimeOverride:async e=>await a(g,e)})))):S===Il.Pods?e.createElement(Dl,{source:M,fetchSourceDescribe:c}):e.createElement(Tl,{source:M,fetchSourceLibraries:d})):null},Rl=d.div`
|
|
388
389
|
max-width: 420px;
|
|
389
390
|
width: 100%;
|
|
390
391
|
`,Ll=i(({isModal:t,fetchSingleNamespace:o,onClickSummary:i},n)=>{const l=I.useTheme(),r=to({fetchSingleNamespace:o}),{availableSources:s,selectedSources:c,isFetchingEachNamespace:d,selectedAllNamespaces:u,onSelectAllNamespaces:m,getApiSourcesPayload:h,getApiFutureAppsPayload:g,searchText:y,setSearchText:v,searchBy:b,setSearchBy:f,showSelectedOnly:C,setShowSelectedOnly:$,showRunningOnly:S,setShowRunningOnly:w}=r;a(n,()=>({getFormValues:()=>({initial:s,apps:h(),futureApps:g()})}));const D=Object.values(c).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return e.createElement(oe,{$isNotModal:!t},e.createElement(Q,{$gap:12},e.createElement(Q,{$gap:24},i&&e.createElement(mt,{onClick:i}),e.createElement(O,{title:p.SELECT_SOURCES,badgeLabel:D,description:p.SELECT_SOURCES_DESCRIPTION}),e.createElement(ce,{$justifyContent:"space-between"},e.createElement(Rl,null,e.createElement(x,{placeholder:b===B.Source?p.SEARCH_SOURCES:p.SEARCH_NAMESPACES,icon:So,value:y,onChange:e=>v(e.target.value.toLowerCase())})),e.createElement(E,{options:[{label:p.SOURCE,value:B.Source,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary},{label:p.NAMESPACE,value:B.Namespace,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary}],selected:b,setSelected:f})),e.createElement(ce,{$gap:36},e.createElement(k,{title:p.SELECT_ALL,initialValue:u,onChange:m,disabled:d}),e.createElement(k,{title:p.ONLY_SELECTED,initialValue:C,onChange:$}),e.createElement(k,{title:p.ONLY_RUNNING_INSTANCES,initialValue:S,onChange:w}))),e.createElement(le,null),e.createElement(yl,{isModal:t,...r})))});Ll.displayName=Ll.name;const ql=({fetchSingleNamespace:t,persistSources:o})=>{const{currentModal:i,setCurrentModal:a}=Z(),l=i===B.Source,r=()=>{a("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();o(e,t),r()}},c=n(null);return P({key:"Enter",active:l},s),l?e.createElement(ee,{isOpen:l,onClose:r,header:{title:"Add Source"},actionComponent:e.createElement(te,{buttons:[{label:"DONE",variant:"primary",onClick:s}]})},e.createElement(Ll,{ref:c,isModal:!0,fetchSingleNamespace:t})):null},Pl=[{key:"checkbox-and-icon",title:""},{key:"name",title:p.NAME,sortable:!0},{key:"type",title:"Kubernetes Type",sortable:!0},{key:"namespace",title:p.NAMESPACE,sortable:!0},{key:"containers",title:p.DETECTED_CONTAINERS},{key:"conditions",title:"Conditions"},{key:"throughput",title:"Throughput",sortable:!0}],Kl=({metrics:t,maxHeight:o,maxWidth:i})=>{const n=I.useTheme(),a=he(),{isThisPending:r}=R(),{selectedStreamName:c}=He(),{sources:d,sourcesLoading:u}=V(),{setDrawerType:m,setDrawerEntityId:h}=q(),{selectedSources:g,setSelectedSources:y}=Kt(),{isAwaitingInstrumentation:b,sourcesToCreate:f,sourcesCreated:x,sourcesToDelete:C,sourcesDeleted:$}=ze(),S=l(()=>{const e=(e,t)=>e>0&&Math.floor(100/e*t)||1;return f?e(f,x):C?e(C,$):1},[f,x,C,$]),k=l(()=>Be(d,c),[d,c]),w=l(()=>Ii({instrumentationRules:[],sources:je(k,a),actions:[],destinations:[],searchText:a.searchText,selectedCategory:B.Source}).searchResults.find(({category:e})=>e===B.Source)?.entities||[],[k,a]),[D,N]=l(()=>{let e=0;return Object.values(g).forEach(t=>{e+=t.length}),[0!==e,e]},[g]),E=s(e=>{if(e){const e={};w.forEach(t=>{const o={namespace:t.namespace,name:t.name,kind:t.kind};r({entityType:B.Source,entityId:o})||(e[t.namespace]?e[t.namespace].push(t):e[t.namespace]=[t])}),y(e)}else y({})},[w]),O=s(e=>{const{namespace:t,name:o,kind:i}=e,n={...g};n[t]||(n[t]=[]);const a=n[t].findIndex(e=>e.name===o&&e.kind===i);-1===a?n[t].push(e):n[t].splice(a,1),y(n)},[g]),M=l(()=>w.map(o=>{const i=Ht(o),a=JSON.stringify(i),{hasErrors:l,hasWarnings:s,hasDisableds:c}=re(o.conditions||[]),d=r({entityType:B.Source,entityId:i}),u=!!g[i.namespace]?.find(e=>e.namespace===i.namespace&&e.name===i.name&&e.kind===i.kind);return{status:l?j.Error:s?j.Warning:void 0,faded:c,onClick:()=>{m(B.Source),h(i)},cells:[{columnKey:"checkbox-and-icon",component:()=>e.createElement(ce,{$gap:16},e.createElement(v,{disabled:d,value:u,onChange:()=>O(o)}),e.createElement(oo,{icons:Le(o.containers),id:a}))},{columnKey:"name",value:ve(o,B.Source,{extended:!0})},{columnKey:"type",value:o.kind,textColor:n.text.info},{columnKey:"namespace",value:o.namespace,textColor:n.text.info},{columnKey:"throughput",value:Oe(Tt(t,B.Source,i).throughput),textColor:n.text.info},{columnKey:"conditions",component:()=>e.createElement(Ni,{conditions:o.conditions||[],id:a})},{columnKey:"containers",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:j.Info,title:io(o.containers),withBorder:!0}))}]}}),[w,g,t,O]),{badge:A,badgeTooltip:F}=l(()=>w.length!==k.length?{badge:`${w.length}/${k.length}`,badgeTooltip:p.FILTERED_COUNT_TOOLTIP}:{badge:k.length,badgeTooltip:void 0},[w,k]);return e.createElement(fe,{$maxWidth:i},e.createElement(xe,null,e.createElement(v,{partiallyChecked:D&&w?.length!==N,value:D&&w?.length===N,onChange:E,disabled:!w?.length}),e.createElement(Ce,{icon:$e(B.Source),title:p.SOURCES,badge:A,badgeTooltip:F,loading:u||b})),e.createElement(Se,{$maxHeight:o},e.createElement(ke,{columns:Pl,rows:M})),b&&!M.length?e.createElement(we,{style:{marginTop:"2rem",gap:"24px"}},e.createElement(Ne,{width:420}),e.createElement(ce,{$gap:16},e.createElement(T,{color:n.text.info},f?"Instrumenting":"Uninstrumenting"," workloads..."),e.createElement(Te,{label:`${S}%`}))):M.length?null:e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Hl=({expiresAt:t})=>{const o=I.useTheme(),i=zt().format(t),n=new Date(t).toDateString().split(" ").slice(1).join(" "),a=no(t,0)?o.text.error:no(t,6048e5)?o.text.warning:o.text.success;return e.createElement(T,{size:14,color:a},i," (",n,")")},zl=d.div`
|
package/lib/functions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{b0 as capitalizeFirstLetter,bY as cleanObjectEmptyStringsValues,aV as compareCondition,b3 as deepClone,a3 as filterActions,ay as filterDestinations,ax as filterDestinationsByStream,aw as filterSources,av as filterSourcesByStream,bZ as flattenObjectKeys,aj as formatBytes,bJ as formatDuration,z as getActionIcon,X as getConditionsBooleans,ao as getContainersIcons,bz as getContainersInstrumentedCount,ar as getDestinationIcon,aa as getEntityIcon,aF as getEntityId,a5 as getEntityLabel,b_ as getIdFromSseTarget,an as getInstrumentationRuleIcon,b$ as getMainContainerLanguage,b6 as getMetricForEntity,c0 as getMonitorIcon,c1 as getPlatformIcon,c2 as getPlatformLabel,bd as getProgrammingLanguageIcon,bL as getRecursiveValues,c3 as getSseTargetFromId,a1 as getStatusIcon,ap as getValueForRange,bi as getWorkloadId,a_ as getYamlFieldsForDestination,bn as hasUnhealthyInstances,i as isEmpty,c4 as isLegalK8sLabel,bA as isOverTime,br as isStringABoolean,c5 as isTimeElapsed,c6 as isValidVersion,_ as mapConditions,aU as mapDestinationFieldsForDisplay,aq as mapExportedSignals,c7 as numbersOnly,bs as parseBooleanFromString,c8 as parseJsonStringToPrettyString,c9 as removeEmptyValuesFromObject,aW as safeJsonParse,ca as safeJsonStringify,ah as sleep,aH as splitCamelString,cb as stringifyNonStringValues}from"./chunks/ui-components-
|
|
1
|
+
export{b0 as capitalizeFirstLetter,bY as cleanObjectEmptyStringsValues,aV as compareCondition,b3 as deepClone,a3 as filterActions,ay as filterDestinations,ax as filterDestinationsByStream,aw as filterSources,av as filterSourcesByStream,bZ as flattenObjectKeys,aj as formatBytes,bJ as formatDuration,z as getActionIcon,X as getConditionsBooleans,ao as getContainersIcons,bz as getContainersInstrumentedCount,ar as getDestinationIcon,aa as getEntityIcon,aF as getEntityId,a5 as getEntityLabel,b_ as getIdFromSseTarget,an as getInstrumentationRuleIcon,b$ as getMainContainerLanguage,b6 as getMetricForEntity,c0 as getMonitorIcon,c1 as getPlatformIcon,c2 as getPlatformLabel,bd as getProgrammingLanguageIcon,bL as getRecursiveValues,c3 as getSseTargetFromId,a1 as getStatusIcon,ap as getValueForRange,bi as getWorkloadId,a_ as getYamlFieldsForDestination,bn as hasUnhealthyInstances,i as isEmpty,c4 as isLegalK8sLabel,bA as isOverTime,br as isStringABoolean,c5 as isTimeElapsed,c6 as isValidVersion,_ as mapConditions,aU as mapDestinationFieldsForDisplay,aq as mapExportedSignals,c7 as numbersOnly,bs as parseBooleanFromString,c8 as parseJsonStringToPrettyString,c9 as removeEmptyValuesFromObject,aW as safeJsonParse,ca as safeJsonStringify,ah as sleep,aH as splitCamelString,cb as stringifyNonStringValues}from"./chunks/ui-components-71ed0e2b.js";import"./icons.js";import"react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-1dea551d.js";import"styled-components";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { type Action, type ActionFormData } from '@/types';
|
|
2
2
|
export declare const useActionFormData: () => {
|
|
3
3
|
formData: ActionFormData;
|
|
4
|
-
formErrors: Partial<Record<
|
|
4
|
+
formErrors: Partial<Record<"disabled" | "type" | "name" | "notes" | "signals" | "fields", string>>;
|
|
5
5
|
handleFormChange: (key?: string | undefined, val?: any, obj?: ActionFormData | undefined) => void;
|
|
6
6
|
resetFormData: () => void;
|
|
7
7
|
validateForm: (params?: {
|
|
8
8
|
withAlert?: boolean;
|
|
9
9
|
alertTitle?: string;
|
|
10
10
|
}) => boolean;
|
|
11
|
-
loadFormWithDrawerItem: ({ type,
|
|
11
|
+
loadFormWithDrawerItem: ({ type, fields }: Action) => void;
|
|
12
12
|
};
|
package/lib/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{x as useActionFormData,aA as useClickNode,bk as useClickNotification,au as useContainerSize,bB as useCopy,aO as useDataStreamFormData,aZ as useDestinationFormData,bC as useGenericForm,be as useInstrumentationRuleFormData,q as useKeyDown,aG as useOnClickOutside,aB as usePopup,aN as useSessionStorage,bt as useSourceFormData,bx as useSourceSelectionFormData,bj as useTimeAgo,bg as useTransition}from"./chunks/ui-components-
|
|
1
|
+
export{x as useActionFormData,aA as useClickNode,bk as useClickNotification,au as useContainerSize,bB as useCopy,aO as useDataStreamFormData,aZ as useDestinationFormData,bC as useGenericForm,be as useInstrumentationRuleFormData,q as useKeyDown,aG as useOnClickOutside,aB as usePopup,aN as useSessionStorage,bt as useSourceFormData,bx as useSourceSelectionFormData,bj as useTimeAgo,bg as useTransition}from"./chunks/ui-components-71ed0e2b.js";import"./icons.js";import"react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-1dea551d.js";import"styled-components";import"@xyflow/react";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";
|