@odigos/ui-kit 0.0.167 → 0.0.169
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/{ui-components-548ceb33.js → ui-components-e54e1ba5.js} +402 -382
- package/lib/components/_v2/badge/index.d.ts +1 -0
- package/lib/components/_v2/drawer/header/index.d.ts +1 -0
- package/lib/components/_v2/hover-actions/index.d.ts +1 -0
- package/lib/components/_v2/loader/index.d.ts +12 -6
- package/lib/components/_v2/loader/spinner/index.d.ts +5 -0
- package/lib/components/_v2/loader/spinner-old/helpers/animation.d.ts +1 -0
- package/lib/components/_v2/loader/spinner-old/helpers/unitConverter.d.ts +22 -0
- package/lib/components/_v2/loader/spinner-old/index.d.ts +10 -0
- package/lib/components/v2.js +1 -1
- package/lib/components.js +1 -1
- package/lib/constants.js +1 -1
- package/lib/containers/_v2/central-connections/source-drawer/index.d.ts +1 -1
- package/lib/containers/_v2/central-connections/source-drawer/types.d.ts +2 -2
- package/lib/containers/v2.js +26 -22
- package/lib/containers.js +108 -108
- package/lib/contexts.js +1 -1
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store/index.d.ts +1 -1
- package/lib/store/useProgressStore.d.ts +22 -0
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types/snapshot/index.d.ts +0 -1
- package/lib/types.js +1 -1
- package/lib/visuals.js +1 -1
- package/package.json +1 -1
- package/lib/store/useInstrumentStore.d.ts +0 -13
package/lib/containers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperativeHandle as o,useMemo as l,Fragment as r,useCallback as s,Children as c}from"react";import d,{css as u,useTheme as p}from"styled-components";import{
|
|
1
|
+
import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperativeHandle as o,useMemo as l,Fragment as r,useCallback as s,Children as c}from"react";import d,{css as u,useTheme as p}from"styled-components";import{a1 as m,a2 as h,a3 as g,a4 as y,a5 as v,a6 as b,a7 as f,a8 as x,a9 as S,aa as $,ab as k,ac as C,ad as w,ae as D,af as T,ag as N,ah as E,H as O,ai as A,aj as F,ak as I,al as M,am as R,an as L,ao as P,ap as j,aq as K,ar as V,as as q,E as H,at as z,au as B,av as W,aw as _,ax as J,ay as U,az as G,aA as Y,F as X,aB as Z,aC as Q,aD as ee,aE as te,aF as ae,S as ie,aG as ne,aH as oe,aI as le,aJ as re,aK as se,a as ce,aL as de,c as ue,aM as pe,aN as me,aO as he,aP as ge,aQ as ye,aR as ve,aS as be,aT as fe,aU as xe,aV as Se,aW as $e,aX as ke,aY as Ce,j as we,N as De,aZ as Te,a_ as Ne,a$ as Ee,b0 as Oe,q as Ae,b1 as Fe,b2 as Ie,b3 as Me,b4 as Re,b5 as Le,b6 as Pe,b7 as je,b8 as Ke,b9 as Ve,g as qe,P as He,ba as ze,bb as Be,u as We,bc as _e,bd as Je,be as Ue,bf as Ge,bg as Ye,bh as Xe,bi as Ze,bj as Qe,bk as et,bl as tt,bm as at,bn as it,bo as nt,bp as ot,bq as lt,br as rt,bs as st,bt as ct,bu as dt,D as ut,bv as pt,bw as mt,bx as ht,by as gt,bz as yt,bA as vt,bB as bt,bC as ft,bD as xt,bE as St,bF as $t,bG as kt,bH as Ct,h as wt,bI as Dt,bJ as Tt,bK as Nt,bL as Et,bM as Ot,bN as At,bO as Ft,bP as It,bQ as Mt,bR as Rt,bS as Lt,bT as Pt,bU as jt,bV as Kt,bW as Vt,bX as qt,r as Ht,bY as zt,bZ as Bt,b_ as Wt,b$ as _t,c0 as Jt,c1 as Ut,c2 as Gt,c3 as Yt,c4 as Xt,c5 as Zt,c6 as Qt,Y as ea,c7 as ta,v as aa,c8 as ia,c9 as na,ca as oa,cb as la,cc as ra,cd as sa,ce as ca,cf as da,cg as ua,ch as pa,ci as ma,p as ha,cj as ga,ck as ya,cl as va,cm as ba,cn as fa,co as xa,cp as Sa}from"./chunks/ui-components-e54e1ba5.js";import{VSquareIcon as $a,XSquareIcon as ka,EditIcon as Ca,TrashIcon as wa,OdigosLogoText as Da,PlusIcon as Ta,RefreshIcon as Na,SearchIcon as Ea,FilterIcon as Oa,DataStreamIcon as Aa,VIcon as Fa,OdigosLogo as Ia,ArrowIcon as Ma,RefreshLeftArrowIcon as Ra,NotificationIcon as La,UserIcon as Pa,ImageErrorIcon as ja,OverviewIcon as Ka,InstrumentationRuleIcon as Va,ActionIcon as qa,SourceIcon as Ha,DestinationIcon as za,SlackLogo as Ba,KeyIcon as Wa,TerminalIcon as _a,ExclamationTriangleIcon as Ja,TraceViewIcon as Ua}from"./icons.js";import{MarkerType as Ga,useNodesState as Ya,useEdgesState as Xa,applyNodeChanges as Za}from"@xyflow/react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-0965fadc.js";import"react-dom";import"react-error-boundary";import"lottie-react";import"prism-react-renderer";const Qa=e=>{const{type:t,name:a,notes:i,signals:n,disabled:o,fields:{collectContainerAttributes:l,collectReplicaSetAttributes:r,collectWorkloadId:s,collectClusterId:c,labelsAttributes:d,annotationsAttributes:u,clusterAttributes:p,overwriteExistingValues:v,attributeNamesToDelete:b,renames:f,piiCategories:x,fallbackSamplingRatio:S,samplingPercentage:$,endpointsFilters:k,servicesNameFilters:C,attributeFilters:w}}=e,D=[{title:m.TYPE,value:t},{type:h.ActiveStatus,title:m.STATUS,value:String(!o)},{type:h.Monitors,title:m.SIGNALS_FOR_PROCESSING,value:n?.map(e=>e.toLowerCase()).join(", ")||""},{title:m.NAME,value:a||""},{title:m.NOTES,value:i||""},{type:h.Divider}];if(t===g.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:h.Divider}),d?.forEach(({labelKey:e,attributeKey:t,from:a,fromSources:i},n)=>{let o="";o+=`Label Key: ${e}\n`,o+=`Attribute Key: ${t}\n`,o+=`From: ${i?.length?i.join(", "):a||y.Pod}\n`,D.push({title:"Label"+(d.length>1?` #${n+1}`:""),value:o})}),u?.length&&D.push({type:h.Divider}),u?.forEach(({annotationKey:e,attributeKey:t,from:a,fromSources:i},n)=>{let o="";o+=`Annotation Key: ${e}\n`,o+=`Attribute Key: ${t}\n`,o+=`From: ${i?.length?i.join(", "):a||y.Pod}\n`,D.push({title:"Annotation"+(u.length>1?` #${n+1}`:""),value:o})})),t===g.AddClusterInfo){D.push({title:"Overwrite Existing Values",value:String(v||!1)});let e="";p?.forEach(({attributeName:t,attributeStringValue:a},i)=>{e+=`${t}: ${a}`,i<p.length-1&&(e+=", ")}),D.push({title:"Attributes",value:e})}if(t===g.DeleteAttributes){let e="";b?.forEach((t,a)=>{e+=t,a<b.length-1&&(e+=", ")}),D.push({title:"Attributes",value:e})}if(t===g.RenameAttributes){let e="";const t=Object.entries(f||{});t.forEach(([a,i],n)=>{e+=`${a}: ${i}`,n<t.length-1&&(e+=", ")}),D.push({title:"Attributes",value:e})}if(t===g.PiiMasking){let e="";x?.forEach((t,a)=>{e+=t,a<x.length-1&&(e+=", ")}),D.push({title:"Categories",value:e})}return t===g.ErrorSampler&&D.push({title:"Sampling Ratio",value:String(S)}),t===g.ProbabilisticSampler&&D.push({title:"Sampling Percentage",value:String($)}),t===g.LatencySampler&&k?.forEach(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:i},n)=>{let o="";o+=`Service Name: ${e}\n`,o+=`HTTP Route: ${t}\n`,o+=`Min. Latency: ${a}\n`,o+=`Fallback Sampling Ratio: ${i}`,D.push({title:"Endpoint"+(k.length>1?` #${n+1}`:""),value:o})}),t===g.ServiceNameSampler&&C?.forEach(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a},i)=>{let n="";n+=`Service Name: ${e}\n`,n+=`Sampling Ratio: ${t}\n`,n+=`Fallback Sampling Ratio: ${a}`,D.push({title:"Filter"+(C.length>1?` #${i+1}`:""),value:n})}),t===g.SpanAttributeSampler&&w?.forEach(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i},n)=>{let o="";o+=`Service Name: ${e}\n`,o+=`Attribute Key: ${t}\n`,o+=`Fallback Sampling Ratio: ${a}\n`;const l=Object.keys(i)[0];o+=`Condition: ${l}\n`,o+=`Operation: ${i[l]?.operation}\n`,o+=`Expected Value: ${i[l]?.expectedValue}`,"jsonCondition"===l&&(o+=`\nJSON Path: ${i[l].jsonPath}`),D.push({title:"Filter"+(w.length>1?` #${n+1}`:""),value:o})}),D},ei=x.PiiCategories,ti=d.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
flex-direction: row;
|
|
4
4
|
gap: 32px;
|
|
@@ -7,45 +7,45 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
7
7
|
border-radius: 32px;
|
|
8
8
|
padding: 8px;
|
|
9
9
|
`}
|
|
10
|
-
`,ti=[{id:"CREDIT_CARD",label:"Credit Card"}],ai=x.FallbackSamplingRatio,ii=[{value:y.Pod,id:y.Pod},{value:y.Namespace,id:y.Namespace},{value:y.Node,id:y.Node}],ni=[{title:"Label Key",keyName:"labelKey",placeholder:"app.kubernetes.io/name",required:!0},{title:"Attribute Key",keyName:"attributeKey",placeholder:"app.kubernetes.name",required:!0},{title:"From Sources",keyName:"fromSources",placeholder:"pod, namespace",componentType:"multi-dropdown",options:ii,required:!1,tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones."}],oi=[{title:"Annotation Key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt",required:!0},{title:"Attribute Key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt",required:!0},{title:"From Sources",keyName:"fromSources",placeholder:"pod, namespace",componentType:"multi-dropdown",options:ii,required:!1,tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones."}],li=x.EndpointsFilters,ri=[{title:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered.",required:!0},{title:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product.",required:!0},{title:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",required:!0,type:$.Number},{title:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",required:!0,type:$.Number}],si=x.AttributeNamesToDelete,ci=x.Renames,di=x.ServicesNameFilters,ui=[{title:"Service Name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans).",required:!0},{title:"Sampling Ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",required:!0,type:$.Number},{title:"Fallback Sampling Ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",required:!0,type:$.Number}],pi=x.SamplingPercentage,mi=x.AttributeFilters,hi=[{title:"Service Name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans).",required:!0},{title:"Attribute Key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span.",required:!0},{title:"Fallback Sampling Ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",required:!0,type:$.Number},{title:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",required:!0,componentType:N.Dropdown,options:[{id:"stringCondition",value:"String Condition"},{id:"numberCondition",value:"Number Condition"},{id:"booleanCondition",value:"Boolean Condition"},{id:"jsonCondition",value:"JSON Condition"}]},{title:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",required:!0,componentType:N.Dropdown,options:[{id:"exists",value:"Exists"},{id:"equals",value:"Equals"},{id:"not_equals",value:"Not Equals"},{id:"contains",value:"Contains"},{id:"not_contains",value:"Not Contains"},{id:"regex",value:"Regex"},{id:"greater_than",value:"Greater Than"},{id:"less_than",value:"Less Than"},{id:"greater_than_or_equal",value:"Greater Than Or Equal"},{id:"less_than_or_equal",value:"Less Than Or Equal"},{id:"is_valid_json",value:"Is Valid JSON"},{id:"is_invalid_json",value:"Is Invalid JSON"},{id:"jsonpath_exists",value:"JSON Path Exists"},{id:"key_equals",value:"Key Equals"},{id:"key_not_equals",value:"Key Not Equals"}]},{title:"Expected Value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against.",required:!0},{title:"JSON Path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",required:!1,renderCondition:e=>"jsonCondition"===e.condition}],gi={[g.K8sAttributes]:({value:t,setValue:i,formErrors:n})=>(a(()=>{t[x.CollectContainerAttributes]||t[x.CollectReplicaSetAttributes]||t[x.CollectWorkloadId]||t[x.CollectClusterId]||t[x.LabelsAttributes]?.length||t[x.AnnotationsAttributes]?.length||(i(x.CollectContainerAttributes,!0),i(x.CollectReplicaSetAttributes,!0),i(x.CollectWorkloadId,!0),i(x.CollectClusterId,!0),i(x.LabelsAttributes,[]),i(x.AnnotationsAttributes,[]))},[]),e.createElement(e.Fragment,null,e.createElement(b,{title:"Collect Container Attributes",value:t[x.CollectContainerAttributes]||!1,onChange:e=>i(x.CollectContainerAttributes,e),errorMessage:n[x.CollectContainerAttributes]}),e.createElement(b,{title:"Collect ReplicaSet Attributes",value:t[x.CollectReplicaSetAttributes]||!1,onChange:e=>i(x.CollectReplicaSetAttributes,e),errorMessage:n[x.CollectReplicaSetAttributes]}),e.createElement(b,{title:"Collect Workload ID",value:t[x.CollectWorkloadId]||!1,onChange:e=>i(x.CollectWorkloadId,e),errorMessage:n[x.CollectWorkloadId]}),e.createElement(b,{title:"Collect Cluster ID",value:t[x.CollectClusterId]||!1,onChange:e=>i(x.CollectClusterId,e),errorMessage:n[x.CollectClusterId]}),e.createElement(C,{columns:ni,value:t[x.LabelsAttributes]||[],onChange:e=>i(x.LabelsAttributes,e),errorMessage:n[x.LabelsAttributes]}),e.createElement(C,{columns:oi,value:t[x.AnnotationsAttributes]||[],onChange:e=>i(x.AnnotationsAttributes,e),errorMessage:n[x.AnnotationsAttributes]}))),[g.AddClusterInfo]:({value:t,setValue:a,formErrors:i})=>e.createElement(e.Fragment,null,e.createElement(w,{title:"Overwrite Existing Values",tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",initialValue:t[x.OverwriteExistingValues]||!1,onChange:e=>a(x.OverwriteExistingValues,e)}),e.createElement(D,{title:"Resource Attributes",value:t[x.ClusterAttributes]?.map(e=>({key:e.attributeName,value:e.attributeStringValue}))||[],onChange:e=>a(x.ClusterAttributes,e.map(e=>({attributeName:e.key,attributeStringValue:e.value}))),required:!0,errorMessage:i[x.ClusterAttributes]})),[g.DeleteAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[si],o=t[si]||[];return e.createElement(T,{title:"Attributes to delete",value:o,onChange:e=>a(si,e),required:!0,errorMessage:n})},[g.RenameAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[ci],o=Object.entries(t[ci]||{}).map(([e,t])=>({key:e,value:t}));return e.createElement(D,{title:"Attributes to rename",value:o,onChange:e=>{const t={};e.forEach(e=>t[e.key]=e.value),a(ci,t)},required:!0,errorMessage:n})},[g.PiiMasking]:({value:i,setValue:n,formErrors:o})=>{const l=o[Qa],r=i[Qa]||[],[s,c]=t(1===r.length);return a(()=>{if(!r.length){const e=ti.map(({id:e})=>e);n(Qa,e),c(1===ti.length)}},[]),e.createElement("div",null,e.createElement(v,{title:"Attributes to mask",required:!0}),e.createElement(ei,{$hasError:!!l},ti.map(({id:t,label:a})=>e.createElement(b,{key:t,title:a,disabled:s&&r.includes(t),value:r.includes(t),onChange:e=>((e,t)=>{const a=t?[...r,e]:r.filter(t=>t!==e);n(Qa,a),c(1===a.length)})(t,e)}))),!!l&&e.createElement(f,null,l))},[g.ErrorSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ai],o=t[ai];return e.createElement(S,{title:"Fallback sampling ratio",required:!0,type:$.Number,min:0,max:100,value:k(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(ai,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[g.ProbabilisticSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[pi],o=t[pi];return e.createElement(S,{title:"Sampling percentage",required:!0,type:$.Number,min:0,max:100,value:k(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(pi,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[g.LatencySampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[li],o=t[li]||[];return e.createElement(C,{columns:ri,value:o,onChange:e=>{const t=e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:i})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(i)}));a(li,t)},errorMessage:n})},[g.ServiceNameSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[di],o=t[di]||[];return e.createElement(C,{columns:ui,value:o,onChange:e=>{const t=e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)}));a(di,t)},errorMessage:n})},[g.SpanAttributeSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[mi],o=(t[mi]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i})=>{const n=Object.entries(i).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:i[n]?.operation,expectedValue:i[n]?.expectedValue,jsonPath:i[n]?.jsonPath}});return e.createElement(C,{columns:hi,value:o,onChange:e=>{const t=e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i,operation:n,expectedValue:o,jsonPath:l})=>{const r={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[i]:{operation:n,expectedValue:o}}};return l&&(r.condition[i].jsonPath=l),r});a(mi,t)},errorMessage:n,limitFieldsPerRow:3})}},yi=({actionType:t,value:a,setValue:i,formErrors:n})=>{if(!t)return null;const o=gi[t];return o?e.createElement(o,{value:a,setValue:i,formErrors:n}):null},vi=d.div`
|
|
10
|
+
`,ai=[{id:"CREDIT_CARD",label:"Credit Card"}],ii=x.FallbackSamplingRatio,ni=[{value:y.Pod,id:y.Pod},{value:y.Namespace,id:y.Namespace},{value:y.Node,id:y.Node}],oi=[{title:"Label Key",keyName:"labelKey",placeholder:"app.kubernetes.io/name",required:!0},{title:"Attribute Key",keyName:"attributeKey",placeholder:"app.kubernetes.name",required:!0},{title:"From Sources",keyName:"fromSources",placeholder:"pod, namespace",componentType:"multi-dropdown",options:ni,required:!1,tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones."}],li=[{title:"Annotation Key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt",required:!0},{title:"Attribute Key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt",required:!0},{title:"From Sources",keyName:"fromSources",placeholder:"pod, namespace",componentType:"multi-dropdown",options:ni,required:!1,tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones."}],ri=x.EndpointsFilters,si=[{title:"Service",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Service name: The rule applies to a specific service name. Only traces originating from this service’s root span will be considered.",required:!0},{title:"HTTP route",keyName:"httpRoute",placeholder:"e.g. /api/v1/users",tooltip:"HTTP route: The specific HTTP route prefix to match for sampling. Only traces with routes beginning with this prefix will be considered. For instance, configuring /buy will also match /buy/product.",required:!0},{title:"Threshold",keyName:"minimumLatencyThreshold",placeholder:"e.g. 1000",tooltip:"Minimum latency threshold (ms): Specifies the minimum latency in milliseconds; traces with latency below this threshold are ignored.",required:!0,type:$.Number},{title:"Fallback",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Fallback sampling ratio: Specifies the percentage of traces that meet the service/http_route filter but fall below the threshold that you still want to retain. For example, if a rule is set for service A and http_route B with a minimum latency threshold of 1 second, you might still want to keep some traces below this threshold. Setting the ratio to 20% ensures that 20% of these traces will be retained.",required:!0,type:$.Number}],ci=x.AttributeNamesToDelete,di=x.Renames,ui=x.ServicesNameFilters,pi=[{title:"Service Name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (Across all available spans).",required:!0},{title:"Sampling Ratio",keyName:"samplingRatio",placeholder:"e.g. 10",tooltip:"Specifies the sample rate for all traces.",required:!0,type:$.Number},{title:"Fallback Sampling Ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",required:!0,type:$.Number}],mi=x.SamplingPercentage,hi=x.AttributeFilters,gi=[{title:"Service Name",keyName:"serviceName",placeholder:"e.g. my-service",tooltip:"Specifies the service name to search within the trace (across all available spans).",required:!0},{title:"Attribute Key",keyName:"attributeKey",placeholder:"e.g. http.request.method",tooltip:"Specifies the attribute key inside of the span.",required:!0},{title:"Fallback Sampling Ratio",keyName:"fallbackSamplingRatio",placeholder:"e.g. 100",tooltip:"Specifies the percentage of traces that don’t meet the service name filter and that you still like to retain.",required:!0,type:$.Number},{title:"Condition",keyName:"condition",tooltip:"An object representing the filters for span attributes filters.",required:!0,componentType:N.Dropdown,options:[{id:"stringCondition",value:"String Condition"},{id:"numberCondition",value:"Number Condition"},{id:"booleanCondition",value:"Boolean Condition"},{id:"jsonCondition",value:"JSON Condition"}]},{title:"Operation",keyName:"operation",tooltip:"Specifies the operation to run against the attribute.",required:!0,componentType:N.Dropdown,options:[{id:"exists",value:"Exists"},{id:"equals",value:"Equals"},{id:"not_equals",value:"Not Equals"},{id:"contains",value:"Contains"},{id:"not_contains",value:"Not Contains"},{id:"regex",value:"Regex"},{id:"greater_than",value:"Greater Than"},{id:"less_than",value:"Less Than"},{id:"greater_than_or_equal",value:"Greater Than Or Equal"},{id:"less_than_or_equal",value:"Less Than Or Equal"},{id:"is_valid_json",value:"Is Valid JSON"},{id:"is_invalid_json",value:"Is Invalid JSON"},{id:"jsonpath_exists",value:"JSON Path Exists"},{id:"key_equals",value:"Key Equals"},{id:"key_not_equals",value:"Key Not Equals"}]},{title:"Expected Value",keyName:"expectedValue",placeholder:"e.g. GET",tooltip:"The values to test the attribute against.",required:!0},{title:"JSON Path",keyName:"jsonPath",placeholder:"e.g. $.user.role",tooltip:"An expression used to navigate the JSON structure.",required:!1,renderCondition:e=>"jsonCondition"===e.condition}],yi={[g.K8sAttributes]:({value:t,setValue:i,formErrors:n})=>(a(()=>{t[x.CollectContainerAttributes]||t[x.CollectReplicaSetAttributes]||t[x.CollectWorkloadId]||t[x.CollectClusterId]||t[x.LabelsAttributes]?.length||t[x.AnnotationsAttributes]?.length||(i(x.CollectContainerAttributes,!0),i(x.CollectReplicaSetAttributes,!0),i(x.CollectWorkloadId,!0),i(x.CollectClusterId,!0),i(x.LabelsAttributes,[]),i(x.AnnotationsAttributes,[]))},[]),e.createElement(e.Fragment,null,e.createElement(b,{title:"Collect Container Attributes",value:t[x.CollectContainerAttributes]||!1,onChange:e=>i(x.CollectContainerAttributes,e),errorMessage:n[x.CollectContainerAttributes]}),e.createElement(b,{title:"Collect ReplicaSet Attributes",value:t[x.CollectReplicaSetAttributes]||!1,onChange:e=>i(x.CollectReplicaSetAttributes,e),errorMessage:n[x.CollectReplicaSetAttributes]}),e.createElement(b,{title:"Collect Workload ID",value:t[x.CollectWorkloadId]||!1,onChange:e=>i(x.CollectWorkloadId,e),errorMessage:n[x.CollectWorkloadId]}),e.createElement(b,{title:"Collect Cluster ID",value:t[x.CollectClusterId]||!1,onChange:e=>i(x.CollectClusterId,e),errorMessage:n[x.CollectClusterId]}),e.createElement(C,{columns:oi,value:t[x.LabelsAttributes]||[],onChange:e=>i(x.LabelsAttributes,e),errorMessage:n[x.LabelsAttributes]}),e.createElement(C,{columns:li,value:t[x.AnnotationsAttributes]||[],onChange:e=>i(x.AnnotationsAttributes,e),errorMessage:n[x.AnnotationsAttributes]}))),[g.AddClusterInfo]:({value:t,setValue:a,formErrors:i})=>e.createElement(e.Fragment,null,e.createElement(w,{title:"Overwrite Existing Values",tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",initialValue:t[x.OverwriteExistingValues]||!1,onChange:e=>a(x.OverwriteExistingValues,e)}),e.createElement(D,{title:"Resource Attributes",value:t[x.ClusterAttributes]?.map(e=>({key:e.attributeName,value:e.attributeStringValue}))||[],onChange:e=>a(x.ClusterAttributes,e.map(e=>({attributeName:e.key,attributeStringValue:e.value}))),required:!0,errorMessage:i[x.ClusterAttributes]})),[g.DeleteAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[ci],o=t[ci]||[];return e.createElement(T,{title:"Attributes to delete",value:o,onChange:e=>a(ci,e),required:!0,errorMessage:n})},[g.RenameAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[di],o=Object.entries(t[di]||{}).map(([e,t])=>({key:e,value:t}));return e.createElement(D,{title:"Attributes to rename",value:o,onChange:e=>{const t={};e.forEach(e=>t[e.key]=e.value),a(di,t)},required:!0,errorMessage:n})},[g.PiiMasking]:({value:i,setValue:n,formErrors:o})=>{const l=o[ei],r=i[ei]||[],[s,c]=t(1===r.length);return a(()=>{if(!r.length){const e=ai.map(({id:e})=>e);n(ei,e),c(1===ai.length)}},[]),e.createElement("div",null,e.createElement(v,{title:"Attributes to mask",required:!0}),e.createElement(ti,{$hasError:!!l},ai.map(({id:t,label:a})=>e.createElement(b,{key:t,title:a,disabled:s&&r.includes(t),value:r.includes(t),onChange:e=>((e,t)=>{const a=t?[...r,e]:r.filter(t=>t!==e);n(ei,a),c(1===a.length)})(t,e)}))),!!l&&e.createElement(f,null,l))},[g.ErrorSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ii],o=t[ii];return e.createElement(S,{title:"Fallback sampling ratio",required:!0,type:$.Number,min:0,max:100,value:k(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(ii,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[g.ProbabilisticSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[mi],o=t[mi];return e.createElement(S,{title:"Sampling percentage",required:!0,type:$.Number,min:0,max:100,value:k(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(mi,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[g.LatencySampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ri],o=t[ri]||[];return e.createElement(C,{columns:si,value:o,onChange:e=>{const t=e.map(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:i})=>({serviceName:e,httpRoute:t,minimumLatencyThreshold:Number(a),fallbackSamplingRatio:Number(i)}));a(ri,t)},errorMessage:n})},[g.ServiceNameSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ui],o=t[ui]||[];return e.createElement(C,{columns:pi,value:o,onChange:e=>{const t=e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)}));a(ui,t)},errorMessage:n})},[g.SpanAttributeSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[hi],o=(t[hi]||[]).map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i})=>{const n=Object.entries(i).filter(([e,t])=>t)[0][0];return{serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:n,operation:i[n]?.operation,expectedValue:i[n]?.expectedValue,jsonPath:i[n]?.jsonPath}});return e.createElement(C,{columns:gi,value:o,onChange:e=>{const t=e.map(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a,condition:i,operation:n,expectedValue:o,jsonPath:l})=>{const r={serviceName:e,attributeKey:t,fallbackSamplingRatio:Number(a),condition:{[i]:{operation:n,expectedValue:o}}};return l&&(r.condition[i].jsonPath=l),r});a(hi,t)},errorMessage:n,limitFieldsPerRow:3})}},vi=({actionType:t,value:a,setValue:i,formErrors:n})=>{if(!t)return null;const o=yi[t];return o?e.createElement(o,{value:a,setValue:i,formErrors:n}):null},bi=d.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
gap: 24px;
|
|
14
14
|
padding: 4px;
|
|
15
|
-
`,
|
|
15
|
+
`,fi=d(E)`
|
|
16
16
|
margin-bottom: 12px;
|
|
17
|
-
`,
|
|
17
|
+
`,xi=({isUpdate:t,action:a,formData:i,formErrors:n,handleFormChange:o})=>{const l=O.useTheme();return e.createElement(bi,null,t&&e.createElement("div",null,e.createElement(fi,null,"Status"),e.createElement(A,{options:[{icon:$a,label:m.ENABLED,value:!1,selectedBgColor:l.text.success+O.opacity.hex["050"]},{icon:ka,label:m.DISABLED,value:!0,selectedBgColor:l.text.error+O.opacity.hex["050"]}],selected:i.disabled,setSelected:e=>o("disabled",e)})),!t&&e.createElement(F,{title:"",description:a.docsDescription,actionButton:e.createElement(I,{endpoint:a.docsEndpoint})}),e.createElement(M,{title:"Signals for Processing",required:!0,allowedSignals:a.allowedSignals,selectedSignals:i.signals||[],setSelectedSignals:e=>o("signals",e),errorMessage:n.signals}),!t&&e.createElement(S,{title:"Action name",placeholder:"Use a name that describes the action",value:i.name||"",onChange:({target:{value:e}})=>o("name",e),errorMessage:n.name}),e.createElement(vi,{actionType:a.type,value:i.fields,setValue:(e,t)=>o(`fields.${e}`,t),formErrors:n}),e.createElement(R,{title:"Notes",value:i.notes||"",onChange:({target:{value:e}})=>o("notes",e),errorMessage:n.notes}))},Si=i(({children:a,width:i=640,title:l,titleTooltip:r,hideEditTitleFromEdit:s,icons:c,iconSrcs:d,isEdit:u=!1,isFormDirty:m=!1,isLastItem:h=!1,onClose:g,onEdit:y,onSave:v,onDelete:b,onCancel:f,tabs:x,headerActionButtons:S},$)=>{const k=p(),{drawerType:C,setDrawerType:w,setDrawerEntityId:D}=L();P({key:"Enter",active:u},()=>_());const[T,N]=t(!1),[O,A]=t(!1),F=n(null),I=C===H.Source,M=()=>{N(!1),A(!1)},R=()=>{M(),y&&y(!1),w(null),D(null),g?.()};o($,()=>({closeDrawer:R}));const z=()=>{F.current?.clearTitle(),f&&f(),M()},B=()=>{const e=F.current?.isTitleDirty();m||e?A(!0):z()},W=()=>{N(!0)},_=()=>{v&&v(F.current?.getTitle()||"")},J=S||[];return y&&!u&&J.push({"data-id":"drawer-edit",variant:"tertiary",onClick:()=>y(!0),children:e.createElement(e.Fragment,null,e.createElement(Ca,null),e.createElement(E,{size:14,family:"secondary",decoration:"underline"},"Edit"))}),b&&!u&&J.push({"data-id":"drawer-delete",variant:"tertiary",onClick:W,children:e.createElement(e.Fragment,null,e.createElement(wa,null),e.createElement(E,{color:k.text.error,size:14,family:"secondary",decoration:"underline"},I?j.UNINSTRUMENT:j.DELETE))}),e.createElement(e.Fragment,null,e.createElement(K,{isOpen:!0,onClose:u?B:R,closeOnEscape:!T&&!O,width:`${i+64}px`,header:{icons:c,iconSrcs:d,title:l,titleTooltip:r,replaceTitleWith:!s&&u?e.createElement($i,{ref:F,title:l}):void 0,actionButtons:J,tabs:x},footer:{isOpen:u,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:_,children:j.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:B,children:j.CANCEL}],rightButtons:b?[{"data-id":"drawer-delete",variant:"tertiary",onClick:W,children:e.createElement(e.Fragment,null,e.createElement(wa,null),e.createElement(E,{size:14,color:k.text.error,family:"secondary",decoration:"underline"},j.DELETE))}]:[]}},a),e.createElement(V,{isOpen:T,noOverlay:!0,name:`${C}${l?` (${l})`:""}`,type:C,isLastItem:h,onApprove:()=>{b&&b(),M()},onDeny:M}),e.createElement(q,{isOpen:O,noOverlay:!0,name:"edit mode",onApprove:z,onDeny:M}))}),$i=i(({title:i},n)=>{const[l,r]=t(i);return a(()=>{r(i)},[i]),o(n,()=>({getTitle:()=>l||i,isTitleDirty:()=>l!==i,clearTitle:()=>r(i)})),e.createElement(S,{"data-id":"title",value:l,onChange:e=>r(e.target.value)})});$i.displayName=$i.name,Si.displayName=Si.name;const ki=d.div`
|
|
18
18
|
width: 100%;
|
|
19
19
|
height: 100%;
|
|
20
20
|
max-height: calc(100vh - 220px);
|
|
21
21
|
overflow: overlay;
|
|
22
22
|
overflow-y: auto;
|
|
23
|
-
`,
|
|
23
|
+
`,Ci=d.div`
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
26
|
gap: 12px;
|
|
27
|
-
`,
|
|
27
|
+
`,wi=({updateAction:i,deleteAction:o})=>{const{actions:r}=z(),{drawerType:s,drawerEntityId:c}=L(),d=n(null),u=s===H.Action,[p,h]=t(!1),[g,y]=t(!1),{formData:v,formErrors:b,handleFormChange:f,resetFormData:x,validateForm:S,loadFormWithDrawerItem:$}=B(),k=l(()=>{if(c)return r?.find(e=>W(e)===c)},[c,r]);if(a(()=>{u&&k?$(k):x()},[u,k]),!k)return null;const C=_.find(({type:e})=>e===k.type)||_.find(({label:e})=>"Attributes"===e)?.items?.find(({type:e})=>e===k.type)||_.find(({label:e})=>"Samplers"===e)?.items?.find(({type:e})=>e===k.type);return e.createElement(Si,{ref:d,title:k.name||k.type,icons:[J(k.type)],isEdit:p,isFormDirty:g,onEdit:e=>{h("boolean"!=typeof e||e)},onSave:e=>{if(S({withAlert:!0,alertTitle:Y.Update})){const t=e!==k.type?e:"";f("name",t),i(c,{...v,name:t}),h(!1),y(!1)}},onDelete:()=>{o(c,k.type),h(!1),y(!1),d.current?.closeDrawer()},onCancel:()=>{h(!1),y(!1),$(k)}},p&&C?e.createElement(ki,null,e.createElement(xi,{isUpdate:!0,action:C,formData:v,formErrors:b,handleFormChange:(...e)=>{y(!0),f(...e)}})):e.createElement(Ci,null,e.createElement(U,{conditions:k.conditions||[]}),e.createElement(G,{title:m.ACTION_DETAILS,data:k?Qa(k):[]})))},Di=d(X)`
|
|
28
28
|
margin-top: 24px;
|
|
29
29
|
gap: 12px;
|
|
30
|
-
`,
|
|
30
|
+
`,Ti=({createAction:a})=>{const{currentModal:i,setCurrentModal:n}=Z(),o=i===H.Action,{formData:l,formErrors:r,handleFormChange:s,resetFormData:c,validateForm:d}=B(),[u,p]=t(void 0),h=()=>{c(),p(void 0),n("")},g=()=>{if(!d({withAlert:!0,alertTitle:Y.Create}))return null;a(l),h()};return P({key:"Enter",active:o},()=>g()),e.createElement(Q,{isOpen:o,onClose:h,header:{title:"Add Action"},actionComponent:e.createElement(ee,{buttons:[{variant:"primary",label:"DONE",onClick:g,disabled:!u}]})},e.createElement(te,null,e.createElement(F,{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(Di,null,e.createElement(ae,{type:ie.Warning,message:ne.DEFINED_FOR_ALL_STREAMS(m.ACTIONS)}),e.createElement(oe,{options:_,selectedOption:u,onOptionSelect:e=>{return t=e,c(),s("type",t?.type||""),void p(t);var t},autoFocus:!u?.type})),u?.type?e.createElement("div",null,e.createElement(le,{margin:"16px 0"}),e.createElement(xi,{action:u,formData:l,formErrors:r,handleFormChange:s})):null))},Ni=e=>{const{type:t,fields:{collectContainerAttributes:a,collectReplicaSetAttributes:i,collectWorkloadId:n,collectClusterId:o,labelsAttributes:l,annotationsAttributes:r,clusterAttributes:s,overwriteExistingValues:c,attributeNamesToDelete:d,renames:u,piiCategories:p,fallbackSamplingRatio:m,samplingPercentage:h,endpointsFilters:v,attributeFilters:b,servicesNameFilters:f}}=e;let x="";if(t===g.K8sAttributes&&(a&&(x+="Container Attributes, "),i&&(x+="ReplicaSet Attributes, "),n&&(x+="Workload ID, "),o&&(x+="Cluster ID, "),l?.forEach(({labelKey:e,attributeKey:t,from:a,fromSources:i},n)=>{const o=i?.length?i.join(","):a||y.Pod;x+=`Label: ${e} ${t} ${o} `,n===l.length-1&&(x+=", ")}),r?.forEach(({annotationKey:e,attributeKey:t,from:a,fromSources:i},n)=>{const o=i?.length?i.join(","):a||y.Pod;x+=`Annotation: ${e} ${t} ${o} `,n===r.length-1&&(x+=", ")})),t===g.AddClusterInfo&&(x+=`Overwrite Existing: ${c}\n`,s?.forEach(({attributeName:e,attributeStringValue:t},a)=>{x+=`${e}: ${t}`,a<s.length-1&&(x+=", ")})),t===g.DeleteAttributes&&d?.forEach((e,t)=>{x+=e,t<d.length-1&&(x+=", ")}),t===g.RenameAttributes){const e=Object.entries(u||{});e.forEach(([t,a],i)=>{x+=`${t}: ${a}`,i<e.length-1&&(x+=", ")})}return t===g.PiiMasking&&p?.forEach((e,t)=>{x+=e,t<p.length-1&&(x+=", ")}),t===g.ErrorSampler&&(x+=String(m)),t===g.ProbabilisticSampler&&(x+=String(h),x+="%"),t===g.LatencySampler&&v?.forEach(({serviceName:e,httpRoute:t,minimumLatencyThreshold:a,fallbackSamplingRatio:i},n)=>{x+=`Endpoint${v.length>1?` #${n+1}`:""}=${e}${t}\n`,x+=` Latency=${a}`,x+=` Sampling=${i}`,n<v.length-1&&(x+=", ")}),t===g.ServiceNameSampler&&f?.forEach(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>{x+=`Service Name: ${e}, `,x+=`Sampling Ratio: ${t}, `,x+=`Fallback Sampling Ratio: ${a}\n`}),t===g.SpanAttributeSampler&&b?.forEach(({serviceName:e,attributeKey:t,fallbackSamplingRatio:a})=>{x+=`Service Name: ${e}, `,x+=`Attribute Key: ${t}, `,x+=`Fallback Sampling Ratio: ${a}\n`}),x},Ei=({conditions:t,id:a})=>{const{errors:i,warnings:n,disableds:o,hasLoadings:r}=l(()=>re(t),[t]),s=i.length>0?i:n.length>0?n:o.length>0?o:[];if(s.length>0)return e.createElement("div",{style:{lineHeight:1}},e.createElement(Oi,{conditions:s,id:a}));const c=r?pe.Loading:ie.Success;return e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:c,title:c,withBorder:!0,withIcon:!0}))},Oi=({conditions:t,id:a})=>{const i=O.useTheme();return e.createElement(ce,null,de(t).map(({status:t,type:n,reason:o,message:l,lastTransitionTime:r},s)=>{"loading"!==t&&"disabled"!==t||(t=ie.Info);const c=me(t,i);return e.createElement(ue,{key:`condition-${a}-${t}-${n}-${s}`,titleIcon:c,title:n,text:l||o||"",timestamp:r},e.createElement(se,{status:t,title:o||n,withBorder:!0,withIcon:!0}))}))},Ai=({instrumentationRules:e,sources:t,actions:a,destinations:i,searchText:n,selectedCategory:o})=>{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?a.filter(e=>e.type?.toLowerCase().includes(n)||e.name?.toLowerCase().includes(n)):a,c=n?i.filter(e=>e.destinationType.displayName?.toLowerCase().includes(n)||e.name?.toLowerCase().includes(n)):i,d=[{category:H.Source,label:"Sources",count:r.length,entities:[]},{category:H.Action,label:"Actions",count:s.length,entities:[]},{category:H.Destination,label:"Destinations",count:c.length,entities:[]},{category:H.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(o)).map(e=>({...e,entities:e.category===H.InstrumentationRule?l:e.category===H.Source?r:e.category===H.Action?s:e.category===H.Destination?c:[]}));return{categories:d,searchResults:u}},Fi=[{key:"icon",title:""},{key:"name",title:m.NAME,sortable:!0},{key:"signals",title:m.MONITORS},{key:"active-status",title:m.STATUS},{key:"conditions",title:"Conditions"},{key:"type",title:m.TYPE,sortable:!0},{key:"spec",title:"Spec",sortable:!0},{key:"notes",title:m.NOTES,sortable:!0}],Ii=({maxHeight:t,maxWidth:a})=>{const i=O.useTheme(),n=he(),{actions:o,actionsLoading:r}=z(),{setDrawerType:s,setDrawerEntityId:c}=L(),d=l(()=>Ai({instrumentationRules:[],sources:[],actions:ge(o,n),destinations:[],searchText:n.searchText,selectedCategory:H.Action}).searchResults.find(({category:e})=>e===H.Action)?.entities||[],[o,n]),u=l(()=>d.map(t=>{const{hasErrors:a,hasWarnings:n,hasDisableds:o}=re(t.conditions||[]);return{status:a?ie.Error:n?ie.Warning:void 0,faded:o,onClick:()=>{s(H.Action),c(t.id)},cells:[{columnKey:"icon",component:()=>e.createElement(ye,{icon:J(t.type)})},{columnKey:"name",value:ve(t,H.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:Ni(t),textColor:i.text.info,withTooltip:!0},{columnKey:"signals",component:()=>e.createElement(be,{withLabels:!0,monitors:t.signals||[]})},{columnKey:"conditions",component:()=>e.createElement(Ei,{conditions:t.conditions||[],id:t.id})},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:t.disabled?ie.Error:ie.Success,title:t.disabled?m.DISABLED:m.ENABLED,withIcon:!0,withBorder:!0}))}]}}),[d]),{badge:p,badgeTooltip:h}=l(()=>d.length!==o.length?{badge:`${d.length}/${o.length}`,badgeTooltip:m.FILTERED_COUNT_TOOLTIP}:{badge:o.length,badgeTooltip:void 0},[d,o]);return e.createElement(fe,{$maxWidth:a},e.createElement(xe,null,e.createElement(Se,{icon:$e(H.Action),title:m.ACTIONS,badge:p,badgeTooltip:h,loading:r})),e.createElement(ke,{$maxHeight:t},e.createElement(Ce,{columns:Fi,rows:u})),!d.length&&e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Mi=d(X)`
|
|
31
31
|
// width: 100vw;
|
|
32
32
|
// height: 100vh;
|
|
33
33
|
gap: 64px;
|
|
34
34
|
align-items: center;
|
|
35
35
|
justify-content: center;
|
|
36
|
-
`,
|
|
36
|
+
`,Ri=d(X)`
|
|
37
37
|
max-width: 400px;
|
|
38
38
|
gap: 12px;
|
|
39
39
|
align-items: center;
|
|
40
40
|
justify-content: center;
|
|
41
|
-
`,
|
|
41
|
+
`,Li=d(E)`
|
|
42
42
|
text-align: center;
|
|
43
43
|
font-size: 24px;
|
|
44
|
-
`,
|
|
44
|
+
`,Pi=d(E)`
|
|
45
45
|
text-align: center;
|
|
46
46
|
line-height: 26px;
|
|
47
47
|
color: ${({theme:e})=>e.text.info};
|
|
48
|
-
`,
|
|
48
|
+
`,ji=()=>{const[i,n]=t(0);return a(()=>{(async()=>{for(let e=0;e<=100;e+=5)await Ee(500),n(e)})()},[]),e.createElement(Mi,null,e.createElement(Da,{size:100}),e.createElement(Te,{width:400}),e.createElement(Ri,null,e.createElement(ce,{$gap:16},e.createElement(Li,null,"Preparing your workspace..."),e.createElement(Ne,{label:`${i}%`})),e.createElement(Pi,null,"It can take up to a few minutes. Grab a cup of coffee, look out a window, and enjoy your free moment!")))},Ki=d(X)`
|
|
49
49
|
align-items: center !important;
|
|
50
50
|
justify-content: center !important;
|
|
51
51
|
align-self: stretch;
|
|
@@ -63,7 +63,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
63
63
|
&:hover {
|
|
64
64
|
background-color: ${({theme:e})=>e.colors.dropdown_bg_2+O.opacity.hex["030"]};
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
66
|
+
`,Vi=({entityType:t,description:a})=>{const{setCurrentModal:i}=Z();return e.createElement(Ki,{onClick:()=>i(t)},e.createElement(ce,{$gap:4},e.createElement(Ta,null),e.createElement(E,{size:14,weight:600,family:"secondary",decoration:"underline"},"Add ",t)),e.createElement(E,{size:12,align:"center"},a))},qi=d.div`
|
|
67
67
|
position: relative;
|
|
68
68
|
width: 100%;
|
|
69
69
|
padding: 12px 0;
|
|
@@ -71,13 +71,13 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
71
71
|
display: flex;
|
|
72
72
|
align-items: center;
|
|
73
73
|
border-bottom: 1px solid ${({theme:e})=>e.colors.border};
|
|
74
|
-
`,
|
|
74
|
+
`,Hi=d(ce)`
|
|
75
75
|
margin-left: ${({$marginLeft:e})=>e};
|
|
76
|
-
`,
|
|
76
|
+
`,zi=d(Oe)`
|
|
77
77
|
width: 24px;
|
|
78
78
|
height: 24px;
|
|
79
79
|
padding: 0;
|
|
80
|
-
`,
|
|
80
|
+
`,Bi=d.div`
|
|
81
81
|
position: absolute;
|
|
82
82
|
bottom: -2px;
|
|
83
83
|
left: 0;
|
|
@@ -86,7 +86,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
86
86
|
height: 4px;
|
|
87
87
|
width: ${({percent:e})=>`${e}%`};
|
|
88
88
|
transition: width 0.3s;
|
|
89
|
-
`,
|
|
89
|
+
`,Wi=({entityType:t,badge:a,badgeTooltip:i,isLoading:n,refetch:o,partiallySelected:l,allSelected:r,onSelectAll:s,progressPercent:c})=>{const d=p(),{setCurrentModal:u}=Z(),m=$e(t);return e.createElement(qi,null,s&&e.createElement(Hi,{$marginLeft:"28px"},e.createElement(b,{partiallyChecked:l,value:r,onChange:s})),e.createElement(Hi,{$marginLeft:t===H.Source?"0":"28px"},e.createElement(Se,{icon:m,title:`${t}s`,badge:a,badgeTooltip:i,loading:!1})),e.createElement(Hi,{$marginLeft:"auto"},e.createElement(zi,{"data-id":`refresh-${t}`,variant:"secondary",onClick:o,disabled:n},n?e.createElement(Ae,{scale:.8}):e.createElement(Na,{fill:d.colors.secondary,size:18})),e.createElement(zi,{"data-id":`add-${t}`,variant:"primary",onClick:()=>u(t)},e.createElement(Ta,{fill:d.colors.primary,size:18}))),"number"==typeof c&&e.createElement(Bi,{percent:c}))},_i=d.div`
|
|
90
90
|
padding: 2px 6px;
|
|
91
91
|
background-color: ${({theme:e})=>e.colors.primary};
|
|
92
92
|
border-radius: 360px;
|
|
@@ -101,7 +101,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
101
101
|
align-items: center;
|
|
102
102
|
justify-content: center;
|
|
103
103
|
white-space: nowrap;
|
|
104
|
-
`,
|
|
104
|
+
`,Ji=({entityId:t,entityType:a,status:i,faded:n,title:o,subTitle:l,tooltip:r,label:s,icon:c,icons:d,iconSrc:u,iconSrcs:m,monitors:h,isActive:g,raw:y})=>{const v=p(),b=a===H.Source,f="boolean"==typeof g,{setDrawerType:x,setDrawerEntityId:S}=L(),{selectedSources:$,setSelectedSources:k}=Fe(),C={...$},{namespace:w,name:D,kind:T}=y;b&&!C[w]&&(C[w]=[]);const N=b?C[w].findIndex(e=>e.name===D&&e.kind===T):-1;return e.createElement(Ie,{"data-id":a===H.Source?`${t.namespace}-${t.name}-${t.kind}`:t,title:o,subTitle:l,onClick:()=>{x(a),S(t)},renderActions:()=>{const t=b&&(!y.conditions?.length||y.conditions?.some(({status:e})=>"loading"===e)),a=f&&!g?me(ie.Info,v):i?me(i,v):void 0,n=t?e.createElement(Ae,{scale:.8}):a?e.createElement(a,{size:14}):null;return s?e.createElement(_i,{$isError:i===ie.Error},e.createElement(ue,{text:r||"Heads up! The data-flow metrics you see are calculated over 10-second intervals."},s),n):n||null},iconProps:{icon:c,icons:d,iconSrc:u,iconSrcs:m},visualProps:{status:i,faded:n||f&&!g,monitors:h||void 0},checkboxProps:{withCheckbox:b,isChecked:-1!==N,onCheckboxChange:()=>{-1===N?C[w].push(y):C[w].splice(N,1),k(C)}}})},Ui=d.div`
|
|
105
105
|
height: calc(${({$height:e})=>e}px - 24px);
|
|
106
106
|
width: calc(100% - 24px);
|
|
107
107
|
padding: 12px;
|
|
@@ -109,7 +109,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
109
109
|
border: 1px dashed ${({theme:e})=>e.colors.border};
|
|
110
110
|
border-radius: 24px;
|
|
111
111
|
position: relative;
|
|
112
|
-
`,
|
|
112
|
+
`,Gi=d.div`
|
|
113
113
|
position: absolute;
|
|
114
114
|
bottom: 0;
|
|
115
115
|
left: 0;
|
|
@@ -124,20 +124,20 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
124
124
|
justify-content: center;
|
|
125
125
|
|
|
126
126
|
pointer-events: none;
|
|
127
|
-
`,
|
|
127
|
+
`,Yi=({height:t,entityType:a,entities:i,metrics:n,isVm:o})=>{const r=l(()=>i.map(t=>{const i=W(t);if(!i)return null;const l=[H.Source,H.Destination].includes(a),r=[H.Destination,H.Action].includes(a),s=[H.Destination,H.Action,H.InstrumentationRule].includes(a),c=r?a==H.Destination?Me(t.exportedSignals):t.signals:void 0,d=l?n?.[`${a.toLowerCase()}s`]?.find(e=>JSON.stringify(W(e))===JSON.stringify(i)):void 0,u=s?!t.disabled:void 0,p=ve(t,a,{extended:a===H.Source,prioritizeDisplayName:a!==H.Source}),m=((e,t,a)=>{switch(e){case H.Source:return a?`${t.kind}`:`${t.namespace} • ${t.kind}`;case H.Destination:return t.destinationType.displayName;case H.Action:case H.InstrumentationRule:return t.type;default:return""}})(a,t,o),h=l?Re(d?.throughput):void 0,{priorotizedStatus:g,hasDisableds:y}=re(t.conditions||[]),{icons:v,icon:b,iconSrc:f}=((e,t)=>{switch(e){case H.Source:return{icons:Ke(t.containers),icon:$e(e)};case H.Destination:return je(t.destinationType.type);case H.Action:return{icon:J(t.type)};case H.InstrumentationRule:return{icon:Pe(t.type)};default:return{icon:$e(e)}}})(a,t),x=a===H.Source?t.podsAgentInjectionStatus:void 0,S=x?(e=>{switch(e){case Ve.Error:return ie.Error;case Ve.Notice:return ie.Warning;case Ve.Waiting:return ie.Info}})(x.status):void 0,$=x&&S?x.message:void 0;return e.createElement(Ji,{key:JSON.stringify(i),entityType:a,entityId:i,raw:t,title:p,subTitle:m,faded:y,status:S||g,tooltip:$,label:h,icons:v,icon:b,iconSrc:f,monitors:c,isActive:u})}),[i,a,n,o]);return e.createElement(Ui,{$height:t},e.createElement(Le,{containerHeight:t-24,elementHeight:80,elements:r}),e.createElement(Gi,{$hide:!0}))},Xi=d.div`
|
|
128
128
|
width: ${({$isVm:e})=>e?"45vw":"22vw"};
|
|
129
129
|
|
|
130
130
|
display: flex;
|
|
131
131
|
flex-direction: column;
|
|
132
132
|
gap: 12px;
|
|
133
|
-
`,
|
|
133
|
+
`,Zi=({entityType:t,entities:a,unfilteredCount:i,metrics:n,loading:o,maxHeight:r,isVm:s,refetch:c})=>{const{frameHeight:d,hasFiltersApplied:u,isSources:p}=l(()=>({frameHeight:Math.min(r,80*a.length+12),hasFiltersApplied:a.length!==i,isSources:t===H.Source}),[t,a.length,r,i]),{progress:h}=qe(),g=l(()=>p&&(h[He.Instrumenting]||h[He.Uninstrumenting])?h[He.Instrumenting]?.percentage||h[He.Uninstrumenting]?.percentage||0:void 0,[p,h[He.Instrumenting],h[He.Uninstrumenting]]),{selectedSources:y,setSelectedSources:v}=Fe(),b=l(()=>p?Object.values(y).reduce((e,t)=>e+t.length,0):0,[p,y]);return s&&[H.InstrumentationRule,H.Action].includes(t)?null:e.createElement(Xi,{$isVm:s},e.createElement(Wi,{entityType:t,badge:"number"==typeof g?`${g}%`:u?`${a.length}/${i}`:i,badgeTooltip:u?m.FILTERED_COUNT_TOOLTIP:void 0,isLoading:o,refetch:c,partiallySelected:b>0&&a?.length!==b,allSelected:b>0&&a?.length===b,onSelectAll:p?e=>{if(p)if(e){const e={};a?.forEach(t=>{const{namespace:a}=t;e[a]?e[a].push(t):e[a]=[t]}),v(e)}else v({})}:void 0,progressPercent:g}),a.length?e.createElement(Yi,{height:d,entityType:t,entities:a,metrics:n,isVm:s}):o?e.createElement(ze,{size:3}):e.createElement(Vi,{entityType:t,description:m.TO_COLLECT_OTEL_DATA}))},Qi=d.div`
|
|
134
134
|
width: 100%;
|
|
135
135
|
height: ${({$height:e})=>e};
|
|
136
136
|
|
|
137
137
|
display: flex;
|
|
138
138
|
justify-content: space-evenly;
|
|
139
139
|
gap: 24px;
|
|
140
|
-
`,
|
|
140
|
+
`,en=({height:i,metrics:n,refetchSources:o,refetchDestinations:l,refetchActions:r,refetchInstrumentationRules:s})=>{const{isVm:c}=Be(),d=he(),{selectedStreamName:u}=We(),{containerRef:p,containerHeight:m}=_e(),{sources:h,sourcesLoading:g,destinations:y,destinationsLoading:v,actions:b,actionsLoading:f,instrumentationRules:x,instrumentationRulesLoading:S}=z(),[$,k]=t([]),[C,w]=t([]),[D,T]=t([]),[N,E]=t([]);return a(()=>{k(Je(Ue(h,u),d))},[h,u,d]),a(()=>{w(Ge(Ye(y,u),d))},[y,u,d]),a(()=>{T(ge(b,d))},[b,d]),a(()=>{E(x)},[x]),e.createElement(Qi,{ref:p,$height:i},e.createElement(Zi,{entityType:H.InstrumentationRule,entities:N,unfilteredCount:x.length,loading:S,maxHeight:m,isVm:c,refetch:s}),e.createElement(Zi,{entityType:H.Source,entities:$,unfilteredCount:h.length,metrics:n,loading:g,maxHeight:m,isVm:c,refetch:o}),e.createElement(Zi,{entityType:H.Action,entities:D,unfilteredCount:b.length,loading:f,maxHeight:m,isVm:c,refetch:r}),e.createElement(Zi,{entityType:H.Destination,entities:C,unfilteredCount:y.length,metrics:n,loading:v,maxHeight:m,isVm:c,refetch:l}))},tn=d.div`
|
|
141
141
|
position: relative;
|
|
142
142
|
max-width: 200px;
|
|
143
143
|
`;d.div`
|
|
@@ -151,60 +151,60 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
151
151
|
background-color: ${({theme:e})=>e.colors.dropdown_bg};
|
|
152
152
|
border: ${({theme:e})=>`1px solid ${e.colors.border}`};
|
|
153
153
|
border-radius: 24px;
|
|
154
|
-
`;const
|
|
154
|
+
`;const an=d.div`
|
|
155
155
|
display: flex;
|
|
156
156
|
align-items: center;
|
|
157
157
|
overflow-x: scroll;
|
|
158
|
-
`,
|
|
158
|
+
`,nn=({onClose:i})=>{const n=O.useTheme(),{onClickNode:o}=Xe(),{searchText:s}=he(),{selectedStreamName:c}=We(),{sources:d,destinations:u,actions:p,instrumentationRules:m}=z(),{popupRef:h,popupOpen:g,setPopupOpen:y,popupPosition:v,handlePosition:b}=Ze();a(()=>{g||(b(0,50),y(!0))},[g]);const[f,x]=t("all"),{categories:S,searchResults:$}=l(()=>Ai({instrumentationRules:m,sources:Ue(d,c),actions:p,destinations:Ye(u,c),searchText:s,selectedCategory:f}),[m,d,p,u,c,s,f]);return $.length?e.createElement(Qe,{ref:h,isOpen:g,top:v.top,left:v.left,maxWidth:"420px",header:e.createElement(an,null,S.map(({category:t,label:a,count:i})=>!!i&&e.createElement(et,{key:`category-select-${t}`,label:a,badgeLabel:i,isSelected:f===t,onClick:()=>x(t)})))},$.map(({category:t,label:a,entities:l},s)=>!!l.length&&e.createElement(r,{key:`category-list-${t}`},e.createElement(tt,{style:{maxHeight:"all"!==f?"240px":"140px",padding:"12px 0"}},e.createElement(E,{size:12,family:"secondary",color:n.text.darker_grey,style:{marginLeft:"16px"}},a),l.map((a,n)=>e.createElement(et,{key:`entity-${s}-${n}`,icon:$e(t),label:ve(a,t,{extended:!0}),onClick:()=>{const e=W(a);o(null,{data:{type:t,id:e}}),i()},style:{width:"100%",justifyContent:"flex-start"},color:"transparent"}))),e.createElement(le,{thickness:s===$.length-1?0:1,length:"90%",margin:"8px auto"})))):e.createElement(Qe,{ref:h,isOpen:g,top:v.top,left:v.left},e.createElement(De,null))},on=({preventPopup:a=!1})=>{const{searchText:i,setSearchText:o}=he(),[l,r]=t(!1),s=!!i||l,c=()=>{o(""),r(!1)},d=n(null);return at(d,c),P({key:"Escape",active:s},c),e.createElement(tn,{ref:d},e.createElement(S,{placeholder:"Search",icon:Ea,value:i,onChange:e=>o(e.target.value.toLowerCase()),onFocus:()=>r(!0)}),s&&!a?e.createElement(nn,{onClose:c}):null)},ln=({sources:t,title:a="Condition",value:i,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t.forEach(({conditions:t})=>{t?.forEach(({type:t,reason:a})=>{e.find(e=>e.id===`${t}#${a}`)||e.push({id:`${t}#${a}`,value:`${it(t)} - ${it(a)}`})})}),e.sort((e,t)=>e.id?.localeCompare(t.id||"")||0)},[t]);return e.createElement(nt,{disabled:!s?.length,title:a,placeholder:"All",options:s,value:i,onSelect:n,onDeselect:o,...r})},rn=({sources:t,title:a="Error Message",value:i,onSelect:n,onDeselect:o,disabled:r,...s})=>{const c=l(()=>{const e=[];return t.forEach(({conditions:t})=>{de(t||[]).forEach(({status:t,message:a,reason:i})=>{t!==ie.Error||e.find(e=>e.id===a)||(a?e.find(e=>e.id===a)||e.push({id:a,value:a}):i&&(e.find(e=>e.id===i)||e.push({id:i,value:i})))})}),e},[t]);return e.createElement(nt,{disabled:r||!c?.length,title:a,placeholder:"All",options:c,value:i,onSelect:n,onDeselect:o,...s})},sn=({sources:t,title:a="Programming Language",value:i,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t.forEach(({containers:t})=>{t?.forEach(({language:t})=>{e.find(e=>e.id===t)||e.push({id:t,value:ot[t]||t})})}),e.sort((e,t)=>e.id?.localeCompare(t.id||"")||0)},[t]);return e.createElement(nt,{disabled:!s?.length,title:a,placeholder:"All",options:s,value:i,onSelect:n,onDeselect:o,...r})},cn=({title:t="Monitors",value:a,onSelect:i,onDeselect:n,...o})=>{const r=l(()=>{const e=[];return lt.forEach(({id:t,value:a})=>{e.find(e=>e.id===t)||e.push({id:t,value:a})}),e},[]);return e.createElement(nt,{disabled:!r?.length,title:t,placeholder:"All",options:r,value:a,onSelect:i,onDeselect:n,...o})},dn=({namespaces:t,title:a="Namespace",value:i,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t?.forEach(({name:t})=>{e.find(e=>e.id===t)||e.push({id:t,value:t})}),e},[t]);return e.createElement(nt,{disabled:!s?.length,title:a,placeholder:"Select namespace",options:s,value:i,onSelect:n,onDeselect:o,...r})},un=({sources:t,title:a="Kind",value:i,onSelect:n,onDeselect:o,...r})=>{const s=l(()=>{const e=[];return t.forEach(({kind:t})=>{e.find(e=>e.id===t)||e.push({id:t,value:t})}),e},[t]);return e.createElement(nt,{disabled:!s?.length,title:a,placeholder:"All",options:s,value:i,onSelect:n,onDeselect:o,...r})},pn=({sources:t,title:a="Agent Injection Status",value:i,onSelect:n,onDeselect:o,disabled:r,...s})=>{const c=l(()=>{const e=[];return t.forEach(({podsAgentInjectionStatus:t})=>{const{status:a,message:i}=t||{};i&&!e.find(e=>e.id===i)&&e.push({id:i,value:`${a} - ${i}`})}),e},[t]);return e.createElement(nt,{disabled:r||!c?.length,title:a,placeholder:"All",options:c,value:i,onSelect:n,onDeselect:o,...s})},mn=d.div`
|
|
159
159
|
display: flex;
|
|
160
160
|
flex-direction: column;
|
|
161
161
|
gap: 12px;
|
|
162
162
|
padding: 12px;
|
|
163
|
-
`,
|
|
163
|
+
`,hn=d.div`
|
|
164
164
|
padding: 12px 6px 6px 6px;
|
|
165
|
-
`,
|
|
165
|
+
`,gn=d(Oe)`
|
|
166
166
|
font-size: 14px;
|
|
167
167
|
${({$color:e})=>`color: ${e};`}
|
|
168
|
-
`,
|
|
168
|
+
`,yn=d.div`
|
|
169
169
|
margin-left: auto;
|
|
170
|
-
`,
|
|
170
|
+
`,vn=e=>{let t=0;return Object.values(e).forEach(e=>{e&&Array.isArray(e)&&e.length>0&&(t+=e.length)}),e.onlyErrors&&t++,e.searchText&&t++,t},bn=()=>{const i=O.useTheme(),{isVm:o}=Be(),{namespaces:r,sources:s}=z(),{selectedStreamName:c}=We(),{getItemSS:d,setItemSS:u,removeItemSS:p}=st(),{popupRef:m,popupOpen:h,setPopupOpen:g,popupPosition:y,handlePosition:v}=Ze(),{namespaces:b,kinds:f,monitors:x,languages:S,conditions:$,errors:k,onlyErrors:C,podsAgentInjectionStatus:D,setAll:T,clearAll:N,getEmptyState:E}=he(),A=l(()=>Ue(s,c),[s,c]),[F,I]=t({namespaces:b,kinds:f,monitors:x,languages:S,conditions:$,errors:k,onlyErrors:C,podsAgentInjectionStatus:D}),[M,R]=t(vn(F));a(()=>{const e=d(rt.OVERVIEW_FILTERS,E());T(e)},[]),a(()=>{if(!h){const e={namespaces:b,kinds:f,monitors:x,languages:S,conditions:$,errors:k,onlyErrors:C};I(e),R(vn(e))}},[h,b,f,x,S,$,k,C]);const L=()=>{g(!1)},j=n(null);return at(j,L),P({key:"Escape",active:h},L),e.createElement(tn,{ref:j},e.createElement(et,{label:"Filters",icon:Oa,badgeLabel:M,badgeFilled:!!M,withBorder:!0,color:"transparent",onClick:()=>{v(0,50),g(!0)}}),e.createElement(Qe,{ref:m,isOpen:h,top:y.top,left:y.left,width:"420px",footer:e.createElement(ce,null,e.createElement(gn,{variant:"primary",onClick:()=>{u(rt.OVERVIEW_FILTERS,F),T(F),R(vn(F)),g(!1)}},"Apply"),e.createElement(gn,{variant:"secondary",onClick:L},"Cancel"),e.createElement(yn,null,e.createElement(gn,{variant:"tertiary",onClick:()=>{p(rt.OVERVIEW_FILTERS),N(),I(E()),R(0),g(!1)},$color:i.text.error},"Reset")))},e.createElement(mn,null,!o&&e.createElement(dn,{namespaces:r,value:F.namespaces,onSelect:e=>I(t=>({...t,namespaces:[...t.namespaces||[],e]})),onDeselect:e=>I(t=>({...t,namespaces:(t.namespaces||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(un,{sources:A,value:F.kinds,onSelect:e=>I(t=>({...t,kinds:[...t.kinds||[],e]})),onDeselect:e=>I(t=>({...t,kinds:(t.kinds||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(sn,{sources:A,value:F.languages,onSelect:e=>I(t=>({...t,languages:[...t.languages||[],e]})),onDeselect:e=>I(t=>({...t,languages:(t.languages||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(cn,{value:F.monitors,onSelect:e=>I(t=>({...t,monitors:[...t.monitors||[],e]})),onDeselect:e=>I(t=>({...t,monitors:(t.monitors||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(ln,{sources:A,value:F.conditions,onSelect:e=>I(t=>({...t,conditions:[...t.conditions||[],e]})),onDeselect:e=>I(t=>({...t,conditions:(t.conditions||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(pn,{sources:A,value:F.podsAgentInjectionStatus,onSelect:e=>I(t=>({...t,podsAgentInjectionStatus:[...t.podsAgentInjectionStatus||[],e]})),onDeselect:e=>I(t=>({...t,podsAgentInjectionStatus:(t.podsAgentInjectionStatus||[]).filter(t=>t.id!==e.id)})),showSearch:!0,required:!0,isMulti:!0}),e.createElement(hn,null,e.createElement(w,{title:"Show only sources with errors",initialValue:F.onlyErrors,onChange:e=>I(t=>({...t,errors:[],onlyErrors:e}))})),e.createElement(rn,{sources:A,value:F.errors,onSelect:e=>I(t=>({...t,errors:[...t.errors||[],e]})),onDeselect:e=>I(t=>({...t,errors:(t.errors||[]).filter(t=>t.id!==e.id)})),disabled:!F.onlyErrors,showSearch:!0,required:!0,isMulti:!0}))))},fn=d.div`
|
|
171
171
|
display: flex;
|
|
172
172
|
flex-direction: column;
|
|
173
173
|
gap: 24px;
|
|
174
174
|
padding: 4px;
|
|
175
|
-
`,
|
|
175
|
+
`,xn=({formData:t,handleFormChange:a,formErrors:i})=>{const{dataStreams:n,selectedStreamName:o}=We(),r=l(()=>n.find(e=>e.name===t.name&&e.name!==o),[n,t.name,o]);return e.createElement(fn,null,e.createElement(S,{name:"name",title:m.STREAM_NAME,placeholder:m.NAME_YOUR_STREAM_PLACEHOLDER,required:!0,value:t.name,onChange:({target:{value:e}})=>a("name",e),errorMessage:i.name}),r&&e.createElement(ae,{type:ie.Warning,message:m.DATA_STREAM_EXISTS_WARNING(o,r.name)}))},Sn=d.div`
|
|
176
176
|
width: 100%;
|
|
177
177
|
height: 100%;
|
|
178
178
|
max-height: calc(100vh - 220px);
|
|
179
179
|
overflow: overlay;
|
|
180
180
|
overflow-y: auto;
|
|
181
|
-
|
|
181
|
+
`,$n=({isOpen:a,onClose:i,dataStreamName:o,updateDataStream:r})=>{const{dataStreams:c}=We(),d=n(null),[u,p]=t(!1),{formData:m,handleFormChange:h,formErrors:g,validateForm:y,resetFormData:v,loadFormWithDrawerItem:b}=ct({name:o}),f=l(()=>{if(!a)return v();const e=c?.find(e=>e.name===o);return e?b(e):v(),e},[a,c,o]),x=s((e,t)=>{h(e,t),p(!0)},[h]);return f?e.createElement(Si,{ref:d,title:f.name,icons:[Aa],hideEditTitleFromEdit:!0,isEdit:!0,isFormDirty:u,onSave:()=>{y({withAlert:!0,alertTitle:Y.Update})&&(r(o,m),p(!1),i())},onCancel:()=>{v(),p(!1),i()}},e.createElement(Sn,null,e.createElement(xn,{formData:m,handleFormChange:x,formErrors:g}))):null},kn=d.div`
|
|
182
182
|
position: relative;
|
|
183
|
-
`,
|
|
183
|
+
`,Cn=d(ce)`
|
|
184
184
|
border: 1px solid ${({theme:e})=>e.colors.border};
|
|
185
185
|
border-radius: 32px;
|
|
186
186
|
|
|
187
187
|
& button {
|
|
188
188
|
max-height: 28px;
|
|
189
189
|
}
|
|
190
|
-
`,
|
|
190
|
+
`,wn=d(E)`
|
|
191
191
|
text-wrap: nowrap;
|
|
192
|
-
`,
|
|
192
|
+
`,Dn=d(tt)`
|
|
193
193
|
max-height: 240px;
|
|
194
194
|
padding: 0px !important;
|
|
195
|
-
`,
|
|
195
|
+
`,Tn=d(ce)`
|
|
196
196
|
width: 100%;
|
|
197
|
-
`,
|
|
197
|
+
`,Nn=d.div`
|
|
198
198
|
width: 100%;
|
|
199
|
-
`,
|
|
199
|
+
`,En=({onClickNewDataStream:a,updateDataStream:i,deleteDataStream:n})=>{const o=O.useTheme(),{clearStore:r}=dt(),{popupRef:s,popupOpen:c,setPopupOpen:d,popupPosition:u,handlePosition:p}=Ze(),{dataStreams:m,selectedStreamName:h,setSelectedStreamName:g}=We(),[y,v]=t(""),[b,f]=t(""),[x,$]=t(""),k=l(()=>m.filter(({name:e})=>!x||e.toLowerCase().includes(x.toLowerCase())).map(({name:t})=>e.createElement(Tn,{key:`stream-${t}`},e.createElement(Nn,null,e.createElement(et,{label:t,isSelected:h===t,onClick:()=>{r(),g(t),d(!1)},color:"transparent",style:{width:"100%",justifyContent:"flex-start"}})),t!==ut&&e.createElement(pt,{onClick:()=>f(t),tooltip:j.DELETE},e.createElement(wa,null)),e.createElement(pt,{onClick:()=>v(t),tooltip:j.EDIT},e.createElement(Ca,null)))),[m,h,x]);return e.createElement(e.Fragment,null,e.createElement(kn,null,e.createElement(Cn,{$gap:0},e.createElement(Oe,{variant:"tertiary",onClick:()=>{p(0,50),d(e=>!e)}},e.createElement(Aa,{fill:o.text.info}),e.createElement(wn,null,"Data Stream: ",h),e.createElement(mt,{extend:c}),e.createElement(Ne,{label:m.length})),e.createElement(le,{orientation:"vertical",length:"32px",thickness:2,margin:"0"}),e.createElement(ht,{onClick:()=>{r(),a()},label:j.NEW})),e.createElement(Qe,{ref:s,isOpen:c,top:u.top,left:u.left,header:e.createElement(S,{placeholder:"Search...",icon:Ea,value:x,onChange:e=>$(e.target.value)})},e.createElement(Dn,null,k))),e.createElement(V,{isOpen:""!==b,name:b,onApprove:()=>{n(b),f("")},onDeny:()=>{f("")}}),e.createElement($n,{isOpen:""!==y,onClose:()=>{v("")},dataStreamName:y,updateDataStream:i}))},On=d.div`
|
|
200
200
|
display: flex;
|
|
201
201
|
align-items: center;
|
|
202
202
|
margin: 20px 0;
|
|
203
203
|
padding: 0 16px;
|
|
204
204
|
gap: 8px;
|
|
205
|
-
`,
|
|
205
|
+
`,An=d.div`
|
|
206
206
|
margin-left: auto;
|
|
207
|
-
`,
|
|
207
|
+
`,Fn=({addEntity:t,preventSearchPopup:a,onClickNewDataStream:i,updateDataStream:n,deleteDataStream:o})=>{const{setCurrentModal:l}=Z();return e.createElement(On,null,e.createElement(En,{onClickNewDataStream:i,updateDataStream:n,deleteDataStream:o}),e.createElement(on,{preventPopup:a}),e.createElement(bn,null),t&&e.createElement(An,null,e.createElement(ht,{"data-id":`add-${t}`,onClick:()=>l(t),label:`${j.ADD} ${it(t)}`,variant:"primary",textProps:{weight:900}})))},In=i(({isModal:t,onClickSummary:a},i)=>{const{selectedStreamName:n}=We(),{formData:l,handleFormChange:r,formErrors:s,validateForm:c}=ct({name:n});return o(i,()=>({validateForm:c,getFormValues:()=>l})),e.createElement(te,{$isNotModal:!t},e.createElement(X,{$gap:24},a&&e.createElement(gt,{onClick:a}),e.createElement(F,{title:m.NAME_YOUR_STREAM,description:m.STREAM_DESCRIPTION}),e.createElement(xn,{formData:l,handleFormChange:r,formErrors:s})))});In.displayName=In.name;const Mn=({createDataStream:t})=>{const{currentModal:a,setCurrentModal:i}=Z(),{addDataStreams:o,setSelectedStreamName:l}=We(),r=a===yt.DataStream,s=()=>i(""),c=async()=>{if(d.current&&d.current.validateForm()){const e=d.current.getFormValues();t?t(e):(o([e]),l(e.name)),s()}},d=n(null);return P({key:"Enter",active:r},c),e.createElement(Q,{isOpen:r,onClose:s,header:{title:"Add Data Stream"},actionComponent:e.createElement(ee,{buttons:[{label:"DONE",variant:"primary",onClick:c}]})},e.createElement(In,{ref:d,isModal:!0}))},Rn=e=>Object.keys(e).filter(t=>e[t]).join(", "),Ln=(e,t)=>{const{destinationType:a,disabled:i,exportedSignals:n}=e,o=[{title:m.TYPE,value:a.type},{type:h.ActiveStatus,title:m.STATUS,value:String(!i)},{type:h.Monitors,title:m.MONITORS,value:Rn(n)},{title:m.NAME,value:a.displayName}],l=vt(e,t),r=l.map(e=>({name:e.key,value:e.value}));return l.map(({key:e,name:a,value:i})=>{const{secret:l,componentProperties:s,hideFromReadData:c,customReadDataLabels:d}=t.find(t=>t.name===e)||{};if(!c?.length||!bt(c,Me(n),r)){const{type:e}=ft(s,{type:""}),t=(l||"password"===e)&&i.length?new Array(10).fill("•").join(""):"";o.push({type:h.Divider}),d?.length?d.forEach(({condition:e,...t})=>{e==i&&o.push({title:t.title,value:t.value})}):o.push({title:a,value:t||i})}}),o},Pn=({signals:t,fields:a,onChange:i,formErrors:n})=>a?.map(o=>{const{componentType:l,renderCondition:r,...s}=o;if(r&&!bt(r,t,a))return null;switch(l){case N.Input:return e.createElement(S,{key:o.name,...s,onChange:e=>i(o.name,e.target.value),errorMessage:n[o.name]});case N.Dropdown:return e.createElement(nt,{key:o.name,...s,showSearch:!0,value:{id:s.value||"",value:s.value||""},options:s.options||[],onSelect:e=>i(o.name,e.id),errorMessage:n[o.name]});case N.MultiInput:return e.createElement(T,{key:o.name,...s,value:"string"==typeof s.value?ft(s.value,[]):s.value,onChange:e=>i(o.name,JSON.stringify(e)),errorMessage:n[o.name]});case N.KeyValuePair:return e.createElement(D,{key:o.name,...s,value:"string"==typeof s.value?ft(s.value,[]):s.value,onChange:e=>i(o.name,JSON.stringify(e)),errorMessage:n[o.name]});case N.TextArea:return e.createElement(R,{key:o.name,...s,onChange:e=>i(o.name,e.target.value),errorMessage:n[o.name]});case N.Checkbox:return e.createElement(b,{key:o.name,...s,value:"true"==s.value,onChange:e=>i(o.name,String(e)),errorMessage:n[o.name]});default:return null}}),jn=d(Oe)`
|
|
208
208
|
display: flex;
|
|
209
209
|
align-items: center;
|
|
210
210
|
gap: 8px;
|
|
@@ -218,43 +218,43 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
218
218
|
`:u`
|
|
219
219
|
background-color: transparent;
|
|
220
220
|
`}
|
|
221
|
-
`,
|
|
221
|
+
`,Kn=({destination:a,validateForm:i,status:n,testConnection:o,onSuccess:l,onError:r})=>{const s=O.useTheme(),{selectedStreamName:c}=We(),[d,u]=t(!1),p=n?me(n,s):void 0;return e.createElement(jn,{$status:n,variant:"secondary",onClick:async()=>{if(i()){u(!0);const e=await o({...a,currentStreamName:c});e&&(e.succeeded?l(e):r(e)),u(!1)}}},d?e.createElement(Ae,null):p?e.createElement(p,null):null,e.createElement(E,{family:"secondary",decoration:"underline",size:14,color:n?s.text[n]:void 0},d?"Checking":n===ie.Success?"Connection OK":"error"===n?"Connection Failed":"Test Connection"))},Vn=d(X)`
|
|
222
222
|
align-items: unset;
|
|
223
223
|
padding: 0 4px;
|
|
224
|
-
`,
|
|
224
|
+
`,qn=d.div`
|
|
225
225
|
display: flex;
|
|
226
226
|
flex-direction: column;
|
|
227
227
|
gap: 12px;
|
|
228
|
-
`,
|
|
228
|
+
`,Hn=d(ce)`
|
|
229
229
|
justify-content: space-between;
|
|
230
|
-
`,
|
|
230
|
+
`,zn=d(E)`
|
|
231
231
|
margin-bottom: 12px;
|
|
232
|
-
`,
|
|
232
|
+
`,Bn=({isUpdate:i,categoryItem:o,formData:r,formErrors:s,validateForm:c,handleFormChange:d,dynamicFields:u,setDynamicFields:p,testConnection:h})=>{const{type:g,displayName:y,supportedSignals:v,testConnectionSupported:b}=o||{},f=O.useTheme(),[x,$]=t(!1),[k,C]=t(!1),[w,D]=t(void 0),T=n(!1);a(()=>{if(u.length&&!T.current){T.current=!0;let e=!1;for(let t=0;t<u.length;t++){const{required:a,value:i}=u[t];if(a){if([void 0,null,""].includes(i)){e=!1;break}e=!0}}$(e)}},[u,k]);const N=l(()=>{const{logs:e,metrics:t,traces:a}=v||{},i=[];return e?.supported&&i.push(xt.Logs),t?.supported&&i.push(xt.Metrics),a?.supported&&i.push(xt.Traces),i},[v]),E=l(()=>{const{logs:e,metrics:t,traces:a}=r.exportedSignals||{},i=[];return e&&i.push(xt.Logs),t&&i.push(xt.Metrics),a&&i.push(xt.Traces),i},[r.exportedSignals]),R=()=>{$(!1),C(!0),D(void 0)};return e.createElement(Vn,{$gap:24},e.createElement(Vn,{$gap:12},e.createElement(F,{title:i?"Update destination":"Create destination",description:`Connect ${y} with Odigos.`,actionButton:b&&e.createElement(Kn,{destination:r,validateForm:c,status:w?.type,testConnection:h,onError:e=>{C(!1),D({type:ie.Error,title:e?.reason||"Connection failed",message:e?.message||"Please check your input and try again."})},onSuccess:e=>{C(!1),D({type:ie.Success,title:e?.reason||"Connection succeeded",message:e?.message||""})}})}),e.createElement(qn,null,b&&w&&e.createElement(ae,{type:w.type,title:w.title,message:w.message}),x&&!w&&!i&&e.createElement(ae,{type:ie.Default,message:`Odigos autocompleted ${y} destination details.`})),e.createElement(le,null)),e.createElement(Hn,null,e.createElement(M,{title:i?"":"This connection will monitor:",required:!0,allowedSignals:N,selectedSignals:E,setSelectedSignals:e=>{R(),d("exportedSignals",{logs:e.includes(xt.Logs),metrics:e.includes(xt.Metrics),traces:e.includes(xt.Traces)})},errorMessage:s.exportedSignals}),!i&&e.createElement(I,{endpoint:`/backends/${g}`})),i&&e.createElement("div",null,e.createElement(zn,null,"Status"),e.createElement(A,{options:[{icon:$a,label:m.ENABLED,value:!1,selectedBgColor:f.text.success+O.opacity.hex["050"]},{icon:ka,label:m.DISABLED,value:!0,selectedBgColor:f.text.error+O.opacity.hex["050"]}],selected:r.disabled,setSelected:e=>d("disabled",e)})),!i&&e.createElement(S,{title:"Destination name",placeholder:"Enter destination name",value:r.name,onChange:e=>{R(),d("name",e.target.value)},errorMessage:s.name}),e.createElement(Pn,{signals:E,fields:u,onChange:(e,t)=>{R(),p(a=>{const i=[...a],n=i.findIndex(t=>t.name===e);return-1!==n&&(i[n]={...i[n],value:t}),i})},formErrors:s}))},Wn=d.div`
|
|
233
233
|
width: 100%;
|
|
234
234
|
height: 100%;
|
|
235
235
|
max-height: calc(100vh - 220px);
|
|
236
236
|
overflow: overlay;
|
|
237
237
|
overflow-y: auto;
|
|
238
|
-
`,
|
|
238
|
+
`,_n=d.div`
|
|
239
239
|
display: flex;
|
|
240
240
|
flex-direction: column;
|
|
241
241
|
gap: 12px;
|
|
242
|
-
`,
|
|
242
|
+
`,Jn=({categories:i,updateDestination:o,deleteDestination:r,testConnection:s})=>{const{destinations:c}=z(),{selectedStreamName:d}=We(),{drawerType:u,drawerEntityId:p}=L(),h=l(()=>Ye(c,d),[c,d]),g=n(null),y=u===H.Destination,[v,b]=t(!1),[f,x]=t(!1),{formData:S,formErrors:$,handleFormChange:k,resetFormData:C,validateForm:w,loadFormWithDrawerItem:D,yamlFields:T,setYamlFields:N,dynamicFields:E,setDynamicFields:O}=St({}),A=l(()=>{if(p)return h?.find(e=>W(e)===p)},[p,h]);if(a(()=>{y&&A?(N($t(i,A)),D(A)):C()},[y,A,i]),!A)return null;const F=i.flatMap(e=>e.items).find(e=>e.type===A.destinationType.type),{icon:I,iconSrc:M}=F?je(F?.type):{icon:void 0,iconSrc:void 0};return e.createElement(Si,{ref:g,title:A.name||A.destinationType.displayName,icons:I?[I]:void 0,iconSrcs:M?[M]:void 0,isEdit:v,isFormDirty:f,onEdit:e=>{b("boolean"!=typeof e||e)},onSave:async e=>{if(w({withAlert:!0,alertTitle:Y.Update})){const t=e!==A.destinationType.displayName?e:"";k("name",t),o(p,{...S,name:t}),b(!1),x(!1)}},onDelete:async()=>{r(p),b(!1),x(!1),g.current?.closeDrawer()},onCancel:()=>{b(!1),x(!1),D(A)},isLastItem:1===h.length},v?e.createElement(Wn,null,e.createElement(Bn,{isUpdate:!0,categoryItem:F,formData:S,formErrors:$,handleFormChange:(...e)=>{x(!0),k(...e)},dynamicFields:E,setDynamicFields:(...e)=>{x(!0),O(...e)},validateForm:w,testConnection:s})):e.createElement(_n,null,A.conditions?.length?e.createElement(U,{conditions:A.conditions}):null,e.createElement(G,{title:m.DESTINATION_DETAILS,data:A?Ln(A,T):[]})))},Un=d.div`
|
|
243
243
|
display: flex;
|
|
244
244
|
flex-direction: column;
|
|
245
245
|
gap: 12px;
|
|
246
|
-
`,
|
|
246
|
+
`,Gn=({items:t,onSelectNew:a,onSelectConfigured:i,isLoadingForDestinationIds:n})=>{const{configuredDestinationsUpdateOnly:o}=dt();return t.map(t=>{const l=t.name===Ct.EXISTS.TITLE;return e.createElement(Un,{key:`category-${t.name}`},e.createElement(F,{size:"small",icon:t.icon,title:kt(t.name),description:t.description}),t.items.map(r=>{const s=`select-${t.name.replaceAll(" ","")}-destination-${r.type}`,c=Object.keys(r.supportedSignals).filter(e=>r.supportedSignals[e].supported),{icon:d,iconSrc:u}=je(r.type),p=r.selected||o.some(e=>e.id===r.id),m=!!n.find(e=>e===r.id),h=l?()=>i(r.id):()=>a(r);return e.createElement(Ie,{key:s,"data-id":s,title:r.displayName,hoverText:j.SELECT,onClick:h,iconProps:{icon:d,iconSrc:u},visualProps:{monitors:c,monitorsWithLabels:!0},checkboxProps:{withCheckbox:l,isChecked:p,isLoading:m,onCheckboxChange:()=>i(r.id)}})}))})},Yn=d.div`
|
|
247
247
|
display: flex;
|
|
248
248
|
flex-direction: column;
|
|
249
249
|
gap: 24px;
|
|
250
|
-
`,
|
|
250
|
+
`,Xn=d.div`
|
|
251
251
|
display: flex;
|
|
252
252
|
align-items: center;
|
|
253
253
|
gap: 12px;
|
|
254
|
-
`,
|
|
254
|
+
`,Zn=d.div`
|
|
255
255
|
width: 170px;
|
|
256
256
|
margin-right: 8px;
|
|
257
|
-
`,
|
|
257
|
+
`,Qn=d.div`
|
|
258
258
|
display: flex;
|
|
259
259
|
flex-direction: column;
|
|
260
260
|
align-self: stretch;
|
|
@@ -265,18 +265,18 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
265
265
|
@media (height < 800px) {
|
|
266
266
|
max-height: calc(100vh - 400px);
|
|
267
267
|
}
|
|
268
|
-
`,
|
|
268
|
+
`,eo=d(Yn)`
|
|
269
269
|
margin-top: 80px;
|
|
270
|
-
`,{MANAGED:
|
|
270
|
+
`,{MANAGED:to,SELF_HOSTED:ao,DETECTED:io,EXISTS:no}=Ct,oo=[{value:"All types",id:"all"},{value:to.TITLE,id:to.TITLE},{value:ao.TITLE,id:ao.TITLE},{value:io.TITLE,id:io.TITLE},{value:no.TITLE,id:no.TITLE}],lo=oo[0],ro=[xt.Logs,xt.Metrics,xt.Traces],so=(e,t,a)=>e.map(e=>{const{type:i,displayName:n}=e.destinationType,o=e.dataStreamNames?.includes(t),l=a.has(e.id);return{id:e.id,type:i,displayName:n,selected:o||l,fields:[],testConnectionSupported:!1,supportedSignals:{[xt.Logs]:{supported:e.exportedSignals.logs},[xt.Metrics]:{supported:e.exportedSignals.metrics},[xt.Traces]:{supported:e.exportedSignals.traces}}}}),co=({hidden:a,categories:i,potentialDestinations:n,onSelectNew:o,onSelectConfigured:r,isLoadingForDestinationIds:s})=>{const{destinations:c}=z(),{selectedStreamName:d}=We(),{configuredDestinations:u,configuredDestinationsUpdateOnly:p}=dt(),[m,h]=t(""),[g,y]=t(lo),[v,b]=t(ro),f=l(()=>{const e=wt(i);return e.unshift({name:no.TITLE,description:no.DESCRIPTION,icon:Fa,items:so(c,d,new Set(u.concat(p).map(e=>e.id)))}),e.unshift({name:io.TITLE,description:io.DESCRIPTION,icon:Ia,items:n}),e.map(e=>{const t=e.items.filter(t=>{const a=!m||t.displayName.toLowerCase().includes(m.toLowerCase()),i="all"===g.id||g.id===e.name,n=v.some(e=>t.supportedSignals[e.toLowerCase()]?.supported);return a&&i&&n});return{...e,items:t}}).filter(({items:e})=>!!e.length)},[i,n,c,m,g,v,d,u,p]);return a?null:e.createElement(Yn,null,e.createElement(F,{title:"Choose destination",description:"Add backend destination you want to connect with Odigos."}),e.createElement(Xn,null,e.createElement(Zn,null,e.createElement(S,{placeholder:"Search...",icon:Ea,value:m,onChange:({target:{value:e}})=>h(e)})),e.createElement(Zn,null,e.createElement(nt,{options:oo,value:g,onSelect:y,onDeselect:()=>{}})),e.createElement(M,{title:"",selectedSignals:v,setSelectedSignals:b})),e.createElement(le,null),f.length?e.createElement(Qn,null,e.createElement(Gn,{items:f,onSelectNew:e=>o(e,v),onSelectConfigured:r,isLoadingForDestinationIds:s})):e.createElement(eo,null,e.createElement(De,{title:"No destinations found"})))},uo=d.div`
|
|
271
271
|
display: flex;
|
|
272
|
-
`,
|
|
272
|
+
`,po=d.div`
|
|
273
273
|
border-right: 1px solid ${({theme:e})=>e.colors.border};
|
|
274
274
|
padding: 32px;
|
|
275
275
|
width: 200px;
|
|
276
276
|
@media (max-width: 1050px) {
|
|
277
277
|
display: none;
|
|
278
278
|
}
|
|
279
|
-
`,
|
|
279
|
+
`,mo=({isOnboarding:a,categories:i,potentialDestinations:n,createDestination:o,updateDestination:l,deleteDestination:r,testConnection:s})=>{const{destinations:c}=z(),{selectedStreamName:d}=We(),{currentModal:u,setCurrentModal:p}=Z(),{addConfiguredDestination:h,addConfiguredDestinationUpdateOnly:g,removeConfiguredDestinationUpdateOnly:y,configuredDestinationsUpdateOnly:v}=dt(),b=u===H.Destination,[f,x]=t(void 0),{formData:S,formErrors:$,handleFormChange:k,resetFormData:C,validateForm:w,setYamlFields:D,dynamicFields:T,setDynamicFields:N,loadFormWithDrawerItem:E}=St({supportedSignals:f?.supportedSignals,preLoadedFields:f?.fields}),[O,A]=t([]),F=e=>{const t={};return e||T.forEach(e=>t[e.name]=e.value),{id:e?.id||"",name:e?.name||S.name,disabled:e?.disabled||S.disabled,dataStreamNames:e?.dataStreamNames||[],conditions:e?.conditions||[],exportedSignals:e?.exportedSignals||S.exportedSignals,fields:e?.fields||JSON.stringify(t),destinationType:e?.destinationType||{type:f.type,displayName:f.displayName,supportedSignals:{logs:{supported:!1},metrics:{supported:!1},traces:{supported:!1}}}}},I=async e=>{if(a&&!e){const e=F();h(e)}else if(a&&e){const t=F(e);v.some(t=>t.id===e.id)?y(e):g(t)}else if(a||e){if(!a&&e){const t=F(e),a=t.dataStreamNames.some(e=>e===d);A(t=>[...t,e.id]),a?await r(e.id):await l(e.id,E(t)),A(t=>t.filter(t=>t!==e.id))}}else o(S)},M=()=>{C(),x(void 0),p("")},R=()=>{C(),x(void 0)},L=async()=>{if(f){if(!w({withAlert:!a,alertTitle:Y.Create}))return null;I()}M()};return P({key:"Enter",active:b},()=>L()),e.createElement(Q,{isOpen:b,onClose:M,header:{title:m.ADD_DESTINATION},actionComponent:e.createElement(ee,{buttons:(()=>{const t=[{label:"DONE",variant:"primary",onClick:L}];return f&&t.unshift({label:"BACK",icon:()=>e.createElement(Ma,{rotate:-90}),variant:"secondary",onClick:R}),t})()})},e.createElement(uo,null,e.createElement(po,null,e.createElement(Dt,{currentStep:f?2:1,data:[{stepNumber:1,title:m.DESTINATIONS},{stepNumber:2,title:m.CONNECTION}]})),e.createElement(te,{style:{margin:"32px 24px 12px 24px"}},e.createElement(co,{hidden:void 0!==f,categories:i,potentialDestinations:n,onSelectNew:(e,t)=>{C(),k("type",e?.type||""),k("currentStreamName",d);const a={logs:!1,metrics:!1,traces:!1};t.filter(t=>e.supportedSignals[t].supported).forEach(e=>a[e]=!0),k("exportedSignals",a),D(e?.fields||[]),x(e)},onSelectConfigured:e=>{const t=c.find(t=>t.id===e);t&&I(t)},isLoadingForDestinationIds:O}),f&&e.createElement(Bn,{categoryItem:f,formData:S,formErrors:$,handleFormChange:k,dynamicFields:T,setDynamicFields:N,validateForm:w,testConnection:s}))))},ho=d.div`
|
|
280
280
|
display: flex;
|
|
281
281
|
flex-direction: column;
|
|
282
282
|
align-items: center;
|
|
@@ -285,7 +285,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
285
285
|
max-height: calc(100vh - 310px);
|
|
286
286
|
height: fit-content;
|
|
287
287
|
overflow-y: scroll;
|
|
288
|
-
`,
|
|
288
|
+
`,go=({categories:t,withDelete:a})=>{const{configuredDestinations:i,configuredDestinationsUpdateOnly:n}=dt();return i.length||n.length?e.createElement(ho,null,i.concat(n).map((o,l)=>e.createElement(yo,{key:`configured-destination-${o.destinationType.type}-${l}`,"data-id":`configured-destination-${o.destinationType.type}`,item:o,yamlFields:$t(t,o),isLastItem:i.length+n.length===1,withDelete:a}))):e.createElement(we,null,e.createElement(De,{title:"No destinations",subTitle:"Please add a destination"}))},yo=({item:a,yamlFields:i,isLastItem:n,withDelete:o})=>{const[r,s]=t(!1),{icon:c,iconSrc:d}=je(a.destinationType.type),{removeConfiguredDestination:u,removeConfiguredDestinationUpdateOnly:p}=dt(),m=l(()=>vt(a,i).map(e=>({title:e.name,value:e.value})),[a,i]);return e.createElement(e.Fragment,null,e.createElement(Ie,{title:a.name||a.destinationType.displayName,subTitle:a.destinationType.type,iconProps:{icon:c,iconSrc:d},visualProps:{monitors:Me(a.exportedSignals),monitorsWithLabels:!0},extendableProps:{withExtend:!0,renderExtended:()=>e.createElement(Tt,{data:m})},renderActions:o?()=>e.createElement(pt,{onClick:()=>s(!0)},e.createElement(wa,null)):void 0}),o&&e.createElement(V,{isOpen:r,name:a.destinationType.displayName||a.name,type:H.Destination,isLastItem:n,onApprove:()=>{a.id?p(a):u(a)},onDeny:()=>s(!1)}))},vo=d(Oe)`
|
|
289
289
|
display: flex;
|
|
290
290
|
align-items: center;
|
|
291
291
|
justify-content: center;
|
|
@@ -294,7 +294,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
294
294
|
padding: 32px;
|
|
295
295
|
border-radius: 16px;
|
|
296
296
|
border-style: dashed !important;
|
|
297
|
-
`,
|
|
297
|
+
`,bo=({isSourcesListEmpty:t,goToSources:a,categories:i,potentialDestinations:n,testConnection:o,onClickSummary:l})=>{const r=O.useTheme(),{setCurrentModal:s}=Z(),{configuredDestinations:c,configuredDestinationsUpdateOnly:d}=dt();return e.createElement(e.Fragment,null,e.createElement(te,{$isNotModal:!0},e.createElement(X,{$gap:12},e.createElement(X,{$gap:24},l&&e.createElement(gt,{onClick:l}),e.createElement(F,{title:m.ADD_DESTINATIONS,badgeLabel:c.length+d.length,description:m.ADD_DESTINATION_DESCRIPTION}),t&&e.createElement(ae,{type:ie.Warning,message:m.NO_SOURCES_GO_BACK,action:{label:m.SELECT_SOURCES,onClick:a}}),e.createElement(vo,{variant:"secondary",onClick:()=>s(H.Destination)},e.createElement(Ta,null),e.createElement(E,{color:r.colors.secondary,size:14,decoration:"underline",family:"secondary"},m.ADD_DESTINATION))),e.createElement(go,{categories:i,withDelete:!0}))),e.createElement(mo,{isOnboarding:!0,categories:i,potentialDestinations:n,updateDestination:async()=>{},createDestination:async()=>{},deleteDestination:async()=>{},testConnection:o}))},fo=[{key:"icon",title:""},{key:"name",title:m.NAME,sortable:!0},{key:"type",title:m.TYPE,sortable:!0},{key:"signals",title:m.MONITORS},{key:"active-status",title:m.STATUS},{key:"conditions",title:"Conditions"},{key:"throughput",title:"Throughput",sortable:!0}],xo=({metrics:t,maxHeight:a,maxWidth:i})=>{const n=O.useTheme(),o=he(),{selectedStreamName:r}=We(),{setDrawerType:s,setDrawerEntityId:c}=L(),{destinations:d,destinationsLoading:u}=z(),p=l(()=>Ye(d,r),[d,r]),h=l(()=>Ai({instrumentationRules:[],sources:[],actions:[],destinations:Ge(p,o),searchText:o.searchText,selectedCategory:H.Destination}).searchResults.find(({category:e})=>e===H.Destination)?.entities||[],[p,o]),g=l(()=>h.map(a=>{const{hasErrors:i,hasWarnings:o,hasDisableds:l}=re(a.conditions||[]),{icon:r,iconSrc:d}=je(a.destinationType.type);return{status:i?ie.Error:o?ie.Warning:void 0,faded:l,onClick:()=>{s(H.Destination),c(a.id)},cells:[{columnKey:"icon",component:()=>e.createElement(ye,{icon:r,src:d})},{columnKey:"name",value:ve(a,H.Destination,{prioritizeDisplayName:!0})},{columnKey:"type",value:a.destinationType.type,textColor:n.text.info},{columnKey:"throughput",value:Re(Nt(t,H.Destination,a.id).throughput),textColor:n.text.info},{columnKey:"signals",component:()=>e.createElement(be,{withLabels:!0,monitors:Me(a.exportedSignals)})},{columnKey:"conditions",component:()=>a.conditions?.length?e.createElement(Ei,{conditions:a.conditions,id:a.id}):null},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:a.disabled?ie.Error:ie.Success,title:a.disabled?m.DISABLED:m.ENABLED,withIcon:!0,withBorder:!0}))}]}}),[h,t]),{badge:y,badgeTooltip:v}=l(()=>h.length!==p.length?{badge:`${h.length}/${p.length}`,badgeTooltip:m.FILTERED_COUNT_TOOLTIP}:{badge:p.length,badgeTooltip:void 0},[h,p]);return e.createElement(fe,{$maxWidth:i},e.createElement(xe,null,e.createElement(Se,{icon:$e(H.Destination),title:m.DESTINATIONS,badge:y,badgeTooltip:v,loading:u})),e.createElement(ke,{$maxHeight:a},e.createElement(Ce,{columns:fo,rows:g})),!h.length&&e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(De,null)))},So=e=>{const{type:t,ruleName:a,notes:i,disabled:n,profileName:o,payloadCollection:l,codeAttributes:r,headersCollection:s,customInstrumentations:c}=e,d=[{title:m.TYPE,value:t},{type:h.ActiveStatus,title:m.STATUS,value:String(!n)},{title:m.NAME,value:a},{title:m.NOTES,value:i},{title:m.MANAGED_BY_PROFILE,value:o},{type:h.Divider}];if(l){const e=Object.entries(l).filter(([e,t])=>t).map(([e,t])=>e).join(", ");e&&d.push({title:"Collect",value:e})}if(r){const e=Object.entries(r).filter(([e,t])=>t).map(([e,t])=>e).join(", ");e&&d.push({title:"Collect",value:e})}if(s){const e=(s[Et.HeaderKeys]||[]).filter(e=>e).join(", ");e&&d.push({title:"Collect",value:e})}if(c){const e=(c[At.Java]||[]).map(e=>new Ot(e.className,e.methodName)).map(e=>`• ${e.toString()}`).join("\r\n");e&&d.push({title:m.JAVA_CUSTOM_PROBES,value:e});const t=(c[At.Golang]||[]).map(e=>new Ft(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).map(e=>`• ${e.toString()}`).join("\r\n");t&&d.push({title:m.GOLANG_CUSTOM_PROBES,value:t})}return d},$o=d.div`
|
|
298
298
|
display: flex;
|
|
299
299
|
flex-direction: column;
|
|
300
300
|
gap: 12px;
|
|
@@ -304,7 +304,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
304
304
|
border-radius: 16px;
|
|
305
305
|
padding: 8px;
|
|
306
306
|
`}
|
|
307
|
-
|
|
307
|
+
`,ko=[{id:It.FilePath,label:"Collect File Path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:It.Function,label:"Collect Function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:It.LineNumber,label:"Collect Line Number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],Co=[{id:It.Column,label:"Collect Column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:It.Namespace,label:"Collect Namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:It.StackTrace,label:"Collect Stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],wo={[At.Java]:[new Ot("","")],[At.Golang]:[new Ft("")]},Do=["*"],To=d.div`
|
|
308
308
|
display: flex;
|
|
309
309
|
flex-direction: column;
|
|
310
310
|
gap: 12px;
|
|
@@ -314,27 +314,27 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
314
314
|
border-radius: 16px;
|
|
315
315
|
padding: 8px;
|
|
316
316
|
`}
|
|
317
|
-
`,
|
|
317
|
+
`,No=[{id:Mt.HttpRequest,label:"Collect HTTP Request"},{id:Mt.HttpResponse,label:"Collect HTTP Response"},{id:Mt.DbQuery,label:"Collect DB Query"},{id:Mt.Messaging,label:"Collect Messaging"}],Eo={[Rt.CodeAttributes]:({value:i,setValue:n,formErrors:o})=>{const r=o.codeAttributes,s=l(()=>Object.entries(i.codeAttributes||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]),[c,d]=t(1===s.length);a(()=>{if(!s.length){const e={[It.Column]:null,[It.FilePath]:!0,[It.Function]:!0,[It.LineNumber]:!0,[It.Namespace]:null,[It.StackTrace]:null};n("codeAttributes",e),d(!1)}},[]);const u=(e,t)=>{const a=t?[...s,e]:s.filter(t=>t!==e),i=Object.values(It).reduce((e,t)=>(e[t]=!!a.includes(t)||null,e),{});n("codeAttributes",i),d(1===a.length)};return e.createElement(e.Fragment,null,e.createElement("div",null,e.createElement(v,{title:"Recommended data to collect",required:!0}),e.createElement($o,{$hasError:!!r},ko.map(({id:t,label:a,tooltip:i})=>e.createElement(ue,{key:t,text:i,withIcon:!0},e.createElement(b,{title:a,disabled:c&&s.includes(t),value:s.includes(t),onChange:e=>u(t,e)})))),!!r&&e.createElement(f,null,r)),e.createElement("div",null,e.createElement(v,{title:"Verbose data to collect",required:!0}),e.createElement($o,{$hasError:!!r},Co.map(({id:t,label:a,tooltip:i})=>e.createElement(ue,{key:t,text:i,withIcon:!0},e.createElement(b,{title:a,disabled:c&&s.includes(t),value:s.includes(t),onChange:e=>u(t,e)})))),!!r&&e.createElement(f,null,r)))},[Rt.CustomInstrumentation]:({value:t,setValue:i,formErrors:n})=>{const o=n.customInstrumentations,r=l(()=>(t?.customInstrumentations?.[At.Java]||[]).map(e=>({key:e.className,value:e.methodName})),[t]),s=l(()=>(t?.customInstrumentations?.[At.Golang]||[]).map(e=>new Ft(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[t]),c=(e,t)=>{const a={};switch(t){case"java":a[At.Java]=e.map(e=>new Ot(e.className,e.methodName)),a[At.Golang]=s.map(e=>new Ft(e.packageName,e.functionName,e.receiverName,e.receiverMethodName));break;case"golang":a[At.Golang]=e.map(e=>new Ft(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),a[At.Java]=r.map(({key:e,value:t})=>new Ot(e,t))}i("customInstrumentations",a)};return a(()=>{t?.customInstrumentations||i("customInstrumentations",{[At.Golang]:wo[At.Golang],[At.Java]:wo[At.Java]})},[i,t]),e.createElement("div",null,e.createElement(C,{title:"Golang Custom Probes",columns:[{title:"",keyName:"packageName",placeholder:"Package name",required:!0,tooltip:"The full import path of the package containing the function or method to be instrumented."},{title:"",keyName:"functionName",placeholder:"Function name",required:!1,tooltip:"The name of the function to be instrumented. Leave empty if instrumenting a receiver method."},{title:"",keyName:"receiverName",placeholder:"Receiver name",required:!1,tooltip:"The name of the receiver type if instrumenting a method. Leave empty if instrumenting a standalone function."},{title:"",keyName:"receiverMethodName",placeholder:"Receiver method name",required:!1,tooltip:"The name of the method to be instrumented. Leave empty if instrumenting a standalone function."}],value:s,onChange:e=>c(e,"golang"),errorMessage:o,limitFieldsPerRow:2}),e.createElement(D,{title:"Java Custom Probes",tooltip:"Specify class name and method name pair to instrument.",value:r,onChange:(e=[])=>c(e.map(({key:e,value:t})=>({className:e,methodName:t})),"java"),errorMessage:o,keyPlaceholder:"Class name",valuePlaceholder:"Method name"}))},[Rt.HeadersCollection]:({value:t,setValue:i,formErrors:n})=>{const o=n.headersCollection,r=l(()=>t?.headersCollection?.[Et.HeaderKeys]||[],[t]),s=e=>{const t={[Et.HeaderKeys]:e};i("headersCollection",t)};return a(()=>{r.length||s(Do)},[r]),e.createElement("div",null,r.length>0&&e.createElement(T,{title:"Header Keys",tooltip:"Specify which headers you want to collect, asterisk (*) will collect all headers.",value:r,onChange:e=>s(e),errorMessage:o}))},[Rt.PayloadCollection]:({value:i,setValue:n,formErrors:o})=>{const r=o.payloadCollection,s=l(()=>Object.entries(i.payloadCollection||{}).filter(([e,t])=>!!t).map(([e])=>e),[i]),[c,d]=t(1===s.length);return a(()=>{if(!s.length){const e={[Mt.HttpRequest]:{},[Mt.HttpResponse]:{},[Mt.DbQuery]:{},[Mt.Messaging]:{}};n("payloadCollection",e),d(!1)}},[]),e.createElement("div",null,e.createElement(v,{title:"Type of data to collect",required:!0}),e.createElement(To,{$hasError:!!r},No.map(({id:t,label:a})=>e.createElement(b,{key:t,title:a,disabled:c&&s.includes(t),value:s.includes(t),onChange:e=>((e,t)=>{const a=t?[...s,e]:s.filter(t=>t!==e),i={[Mt.HttpRequest]:a.includes(Mt.HttpRequest)?{}:null,[Mt.HttpResponse]:a.includes(Mt.HttpResponse)?{}:null,[Mt.DbQuery]:a.includes(Mt.DbQuery)?{}:null,[Mt.Messaging]:a.includes(Mt.Messaging)?{}:null};n("payloadCollection",i),d(1===a.length)})(t,e)}))),!!r&&e.createElement(f,null,r))},[Rt.UnknownType]:null},Oo=({ruleType:t,value:a,setValue:i,formErrors:n})=>{if(!t)return null;const o=Eo[t];return o?e.createElement(o,{value:a,setValue:i,formErrors:n}):null},Ao=d.div`
|
|
318
318
|
display: flex;
|
|
319
319
|
flex-direction: column;
|
|
320
320
|
gap: 24px;
|
|
321
321
|
padding: 4px;
|
|
322
|
-
`,
|
|
322
|
+
`,Fo=d(E)`
|
|
323
323
|
margin-bottom: 12px;
|
|
324
|
-
`,
|
|
324
|
+
`,Io=({isUpdate:t,rule:a,formData:i,formErrors:n,handleFormChange:o})=>{const l=O.useTheme();return e.createElement(Ao,null,e.createElement(ce,null,a.supportedLanguages.map(t=>e.createElement(Lt,{key:t,icon:Pt(t),type:ie.Info},ot[t]))),t?e.createElement("div",null,e.createElement(Fo,null,"Status"),e.createElement(A,{options:[{icon:$a,label:m.ENABLED,value:!1,selectedBgColor:l.text.success+O.opacity.hex["050"]},{icon:ka,label:m.DISABLED,value:!0,selectedBgColor:l.text.error+O.opacity.hex["050"]}],selected:i.disabled,setSelected:e=>o("disabled",e)})):e.createElement(e.Fragment,null,e.createElement(F,{title:"",description:a.docsDescription,actionButton:e.createElement(I,{endpoint:a.docsEndpoint})}),e.createElement(S,{title:"Rule name",placeholder:"Use a name that describes the rule",value:i.ruleName,onChange:({target:{value:e}})=>o("ruleName",e),errorMessage:n.ruleName})),e.createElement(Oo,{ruleType:a.type,value:i,setValue:(e,t)=>o(e,t),formErrors:n}),e.createElement(R,{title:"Notes",value:i.notes,onChange:({target:{value:e}})=>o("notes",e),errorMessage:n.notes}))},Mo=d.div`
|
|
325
325
|
width: 100%;
|
|
326
326
|
height: 100%;
|
|
327
327
|
max-height: calc(100vh - 220px);
|
|
328
328
|
overflow: overlay;
|
|
329
329
|
overflow-y: auto;
|
|
330
|
-
`,
|
|
330
|
+
`,Ro=d.div`
|
|
331
331
|
display: flex;
|
|
332
332
|
flex-direction: column;
|
|
333
333
|
gap: 12px;
|
|
334
|
-
`,
|
|
334
|
+
`,Lo=({updateInstrumentationRule:i,deleteInstrumentationRule:o})=>{const{instrumentationRules:r}=z(),{addNotification:s}=jt(),{drawerType:c,drawerEntityId:d}=L(),u=n(null),p=c===H.InstrumentationRule,[m,h]=t(!1),[g,y]=t(!1),{formData:v,formErrors:b,handleFormChange:f,resetFormData:x,validateForm:S,loadFormWithDrawerItem:$}=Kt(),k=l(()=>{if(d)return r?.find(e=>W(e)===d)},[d,r]);if(a(()=>{p&&k?$(k):x()},[p,k]),!k)return null;const C=Vt.find(({type:e})=>e===k.type);return e.createElement(Si,{ref:u,title:k.ruleName||k.type,icons:[Pe(k.type)],isEdit:m,isFormDirty:g,onEdit:e=>{k.mutable||!e&&void 0!==e?h("boolean"!=typeof e||e):s({type:ie.Warning,title:ne.FORBIDDEN,message:ne.CANNOT_EDIT_RULE,crdType:H.InstrumentationRule,target:d,hideFromHistory:!0})},onSave:e=>{if(S()){const t=e!==k.type?e:"";f("ruleName",t),i(d,{...v,ruleName:t}),h(!1),y(!1)}},onDelete:()=>{k.mutable?(o(d),h(!1),y(!1),u.current?.closeDrawer()):s({type:ie.Warning,title:ne.FORBIDDEN,message:ne.CANNOT_DELETE_RULE,crdType:H.InstrumentationRule,target:d,hideFromHistory:!0})},onCancel:()=>{h(!1),y(!1),$(k)}},m&&C?e.createElement(Mo,null,e.createElement(Io,{isUpdate:!0,rule:C,formData:v,formErrors:b,handleFormChange:(...e)=>{y(!0),f(...e)}})):e.createElement(Ro,null,e.createElement(U,{conditions:k.conditions||[]}),e.createElement(G,{title:"Instrumentation Rule Details",data:k?So(k):[]})))},Po=d(X)`
|
|
335
335
|
margin-top: 24px;
|
|
336
336
|
gap: 12px;
|
|
337
|
-
`,
|
|
337
|
+
`,jo=Vt,Ko=({isEnterprise:a,createInstrumentationRule:i})=>{const{currentModal:n,setCurrentModal:o}=Z(),l=n===H.InstrumentationRule,{formData:r,formErrors:s,handleFormChange:c,resetFormData:d,validateForm:u}=Kt(),[p,h]=t(void 0),g=()=>{d(),h(void 0),o("")},y=()=>{if(!u())return null;i(r),g()};return P({key:"Enter",active:l},()=>y()),e.createElement(Q,{isOpen:l,onClose:g,header:{title:"Add Instrumentation Rule"},actionComponent:e.createElement(ee,{buttons:[{variant:"primary",label:"DONE",onClick:y,disabled:!a||!p,tooltip:a?"":ne.ENTERPRISE_ONLY("Instrumentation Rules")}]})},e.createElement(te,null,e.createElement(F,{title:"Select Instrumentation Rule",description:"Define how telemetry is recorded from your application. Choose a rule type and configure the details."}),e.createElement(Po,null,a?e.createElement(ae,{type:ie.Warning,message:ne.DEFINED_FOR_ALL_STREAMS(m.INSTRUMENTATION_RULES)}):e.createElement(ae,{type:ie.Default,message:ne.ENTERPRISE_ONLY(m.INSTRUMENTATION_RULES)}),e.createElement(oe,{options:jo,selectedOption:p,onOptionSelect:e=>{return t=e,d(),void h(t);var t},autoFocus:!p?.type})),p?.type?e.createElement("div",null,e.createElement(le,{margin:"16px 0"}),e.createElement(Io,{rule:p,formData:r,formErrors:s,handleFormChange:c})):null))},Vo=e=>{const{payloadCollection:t,codeAttributes:a,customInstrumentations:i}=e;let n="";return t&&(n+=Object.entries(t).filter(([e,t])=>!!t).map(([e,t])=>e).join(", ")),a&&(n+=Object.entries(a).filter(([e,t])=>!!t).map(([e,t])=>e).join(", ")),i&&Object.values(At).forEach(e=>{const t=(i[e]||[]).filter(e=>e).join(", ");t&&(n+=n?`, ${t}`:t)}),n},qo=[{key:"icon",title:""},{key:"name",title:m.NAME,sortable:!0},{key:"profile",title:m.MANAGED_BY_PROFILE,sortable:!0},{key:"active-status",title:m.STATUS},{key:"conditions",title:"Conditions"},{key:"source-count",title:"Applicable Source"},{key:"type",title:m.TYPE,sortable:!0},{key:"spec",title:"Spec",sortable:!0},{key:"notes",title:m.NOTES,sortable:!0}],Ho=({maxHeight:t,maxWidth:a})=>{const i=p(),n=he(),{setDrawerType:o,setDrawerEntityId:r}=L(),{instrumentationRules:s,instrumentationRulesLoading:c}=z(),d=l(()=>Ai({instrumentationRules:s,sources:[],actions:[],destinations:[],searchText:n.searchText,selectedCategory:H.InstrumentationRule}).searchResults.find(({category:e})=>e===H.InstrumentationRule)?.entities||[],[s,n]),u=l(()=>d.map(t=>{const{hasErrors:a,hasWarnings:n,hasDisableds:l}=re(t.conditions||[]);return{status:a?ie.Error:n?ie.Warning:void 0,faded:l,onClick:()=>{o(H.InstrumentationRule),r(t.ruleId)},cells:[{columnKey:"icon",component:()=>e.createElement(ye,{icon:Pe(t.type)})},{columnKey:"name",value:ve(t,H.InstrumentationRule,{prioritizeDisplayName:!0})},{columnKey:"type",value:t.type,textColor:i.text.info},{columnKey:"profile",value:t.profileName,textColor:i.text.info},{columnKey:"notes",value:t.notes,textColor:i.text.info,withTooltip:!0},{columnKey:"spec",value:Vo(t),textColor:i.text.info,withTooltip:!0},{columnKey:"conditions",component:()=>e.createElement(Ei,{conditions:t.conditions||[],id:t.ruleId})},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:t.disabled?ie.Error:ie.Success,title:t.disabled?m.DISABLED:m.ENABLED,withIcon:!0,withBorder:!0}))},{columnKey:"source-count",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:ie.Info,title:"all sources",withBorder:!0}))}]}}),[d]),{badge:h,badgeTooltip:g}=l(()=>d.length!==s.length?{badge:`${d.length}/${s.length}`,badgeTooltip:m.FILTERED_COUNT_TOOLTIP}:{badge:s.length,badgeTooltip:void 0},[d,s]);return e.createElement(fe,{$maxWidth:a},e.createElement(xe,null,e.createElement(Se,{icon:$e(H.Action),title:m.INSTRUMENTATION_RULES,badge:h,badgeTooltip:g,loading:c})),e.createElement(ke,{$maxHeight:t},e.createElement(Ce,{columns:qo,rows:u})),!d.length&&e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(De,null)))},zo=d.div`
|
|
338
338
|
position: fixed;
|
|
339
339
|
bottom: 0;
|
|
340
340
|
left: 50%;
|
|
@@ -348,17 +348,17 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
348
348
|
border: 1px solid ${({theme:e})=>e.colors.border};
|
|
349
349
|
background-color: ${({theme:e})=>e.colors.dropdown_bg};
|
|
350
350
|
animation-name: ${O.animations.slide.in.center};
|
|
351
|
-
`,
|
|
351
|
+
`,Bo=({totalSourceCount:a,uninstrumentSources:i,restartWorkloads:n})=>{const o=O.useTheme(),{selectedSources:s,setSelectedSources:c}=Fe(),[d,u]=t(!1),p=l(()=>{let e=0;return Object.values(s).forEach(t=>{e+=t.length}),e},[s]),m=()=>{c({})};return p?e.createElement(r,null,e.createElement(zo,{"data-id":"multi-source-control"},e.createElement(E,null,"Selected sources"),e.createElement(Ne,{label:p,filled:!0}),e.createElement(le,{orientation:"vertical",length:"16px"}),e.createElement(Oe,{variant:"tertiary",onClick:m},e.createElement(E,{family:"secondary",decoration:"underline"},"Deselect")),e.createElement(Oe,{variant:"tertiary",onClick:()=>{const e=[];Object.values(s).forEach(t=>{e.push(...t.map(e=>qt(e)))}),n(e),m()}},e.createElement(Ra,null),e.createElement(E,{family:"secondary",decoration:"underline"},"Restart")),e.createElement(Oe,{variant:"tertiary",onClick:()=>u(!0)},e.createElement(wa,null),e.createElement(E,{family:"secondary",decoration:"underline",color:o.text.error},"Uninstrument"))),e.createElement(V,{isOpen:d,name:`${p} sources`,type:H.Source,isLastItem:p===a,onApprove:()=>{const e={};Object.entries(s).forEach(([t,a])=>{e[t]=a.map(e=>({...e,selected:!1}))}),i(e),u(!1),m()},onDeny:()=>u(!1)})):null},Wo=d.div`
|
|
352
352
|
position: relative;
|
|
353
353
|
width: fit-content;
|
|
354
|
-
`,
|
|
354
|
+
`,_o=d(ce)`
|
|
355
355
|
gap: 12px;
|
|
356
356
|
padding: 0 12px;
|
|
357
|
-
`,
|
|
357
|
+
`,Jo=d(X)`
|
|
358
358
|
gap: 12px;
|
|
359
359
|
max-height: 400px;
|
|
360
360
|
overflow-y: auto;
|
|
361
|
-
`,
|
|
361
|
+
`,Uo=d.div`
|
|
362
362
|
position: absolute;
|
|
363
363
|
bottom: 0;
|
|
364
364
|
left: 0;
|
|
@@ -367,13 +367,13 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
367
367
|
border-radius: 0 0 24px 24px;
|
|
368
368
|
background: ${({theme:e})=>`linear-gradient(to top, ${e.colors.dropdown_bg}, transparent)`};
|
|
369
369
|
pointer-events: none;
|
|
370
|
-
`,
|
|
370
|
+
`,Go=d(E)`
|
|
371
371
|
background-color: ${({theme:e})=>e.colors.orange_soft};
|
|
372
372
|
color: ${({theme:e})=>e.text.primary};
|
|
373
373
|
border-radius: 32px;
|
|
374
374
|
width: fit-content;
|
|
375
375
|
padding: 2px 8px;
|
|
376
|
-
`,
|
|
376
|
+
`,Yo=()=>{const t=O.useTheme(),{notifications:a,markAsSeen:i}=jt(),n=a.filter(({hideFromHistory:e})=>!e),o=n.filter(({seen:e})=>!e),l=o.length,{popupRef:r,popupOpen:s,setPopupOpen:c,popupPosition:d,handlePosition:u}=Ze({defaultClientHeight:420,defaultClientwidth:400,onClickOutside:()=>{l&&o.forEach(({id:e})=>i(e))}});return e.createElement(Wo,null,e.createElement(pt,{onClick:()=>{u(0,0),c(e=>!e)},tooltip:"Notifications",withPing:!!l,pingColor:t.colors.orange_og},e.createElement(La,{size:18})),e.createElement(Qe,{ref:r,isOpen:s,right:d.left,maxWidth:"400px",header:e.createElement(_o,null,e.createElement(E,{size:20},"Notifications"),!!l&&e.createElement(Go,{size:12,family:"secondary"},l," new"))},e.createElement(Jo,null,n.length?n.map(t=>e.createElement(al,{key:`notification-${t.id}`,...t,onClick:()=>c(!1)})):e.createElement(De,{title:"No notifications",subTitle:""})),e.createElement(Uo,null)))},Xo=d.div`
|
|
377
377
|
display: flex;
|
|
378
378
|
align-items: flex-start;
|
|
379
379
|
gap: 12px;
|
|
@@ -387,7 +387,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
387
387
|
background-color: ${({theme:e})=>e.colors.dropdown_bg_2};
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
|
-
`,
|
|
390
|
+
`,Zo=d.div`
|
|
391
391
|
background-color: ${({$type:e,theme:t})=>t.text[e]+O.opacity.hex["015"]};
|
|
392
392
|
border-radius: 8px;
|
|
393
393
|
width: 36px;
|
|
@@ -395,19 +395,19 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
395
395
|
display: flex;
|
|
396
396
|
align-items: center;
|
|
397
397
|
justify-content: center;
|
|
398
|
-
`,Zo=d.div`
|
|
399
|
-
width: 290px;
|
|
400
398
|
`,Qo=d.div`
|
|
401
|
-
|
|
399
|
+
width: 290px;
|
|
402
400
|
`,el=d.div`
|
|
401
|
+
margin-bottom: 6px;
|
|
402
|
+
`,tl=d.div`
|
|
403
403
|
display: flex;
|
|
404
404
|
align-items: center;
|
|
405
405
|
gap: 6px;
|
|
406
|
-
`,
|
|
406
|
+
`,al=({id:t,seen:a,type:i,title:n,message:o,time:l,crdType:r,target:s,onClick:c})=>{const d=O.useTheme(),{formatTimeAgo:u}=Ht(),{onClickNotification:p}=zt(),m=!!r&&!!s,h=n?.toLowerCase().includes(Y.Delete.toLowerCase())||!1,g=me(i,d);return e.createElement(Xo,{key:`notification-${t}`,className:m?"click-enabled":"",onClick:()=>{m&&(c(),p({id:t,crdType:r,target:s}))}},e.createElement(Zo,{$type:h?ie.Error:i},h?e.createElement(wa,null):e.createElement(g,null)),e.createElement(Qo,null,e.createElement(el,null,e.createElement(E,{size:14},o)),e.createElement(tl,null,e.createElement(E,{size:10,color:d.text.grey},u(l)),!a&&e.createElement(e.Fragment,null,e.createElement(E,{size:10},"·"),e.createElement(E,{size:10,color:d.colors.orange_soft},"new")))))},il=(e,t,a)=>{const i=e?.serviceName||t?.otelServiceName||t?.name,n=a?[Pa]:Ke(t?.containers||[]),{priorotizedStatus:o}=re(t?.conditions||[]);return{id:i,title:i,icons:n.length?n:[ja],status:o,serviceMapEntry:e}},nl=e=>"user"===e?.otelServiceName&&!e?.namespace&&!e?.name&&!e?.kind,ol=d.div`
|
|
407
407
|
width: 100%;
|
|
408
408
|
height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px)`};
|
|
409
409
|
position: relative;
|
|
410
|
-
`,
|
|
410
|
+
`,ll={namespace:"",name:"",kind:"",otelServiceName:"user",selected:!0,numberOfInstances:0,dataStreamNames:[],containers:[],conditions:[]},rl=({heightToRemove:t,serviceMap:i})=>{const n=O.useTheme(),{sources:o,sourcesLoading:l}=z(),{containerRef:r,containerHeight:s,containerWidth:c}=_e(),[d,u,p]=Ya([]),[h,g,y]=Xa([]);return a(()=>{if(s&&c){const t=(({sources:e,serviceMap:t,containerHeight:a,containerWidth:i})=>{const n=[],o=new Map,l=((e,t)=>{const a=new Map,i=new Map,n=new Map,o=new Set;e.forEach(e=>{o.add(e.serviceName),e.services.forEach(e=>{o.add(e.serviceName)})}),o.forEach(e=>{i.set(e,[]),n.set(e,0)}),e.forEach(e=>{e.services.forEach(t=>{i.get(e.serviceName)?.push(t.serviceName);const a=n.get(t.serviceName)||0;n.set(t.serviceName,a+1)})});const l=[],r=[];for(o.forEach(e=>{0===(n.get(e)||0)&&r.push(e)});r.length>0;){const e=[],t=r.length;for(let a=0;a<t;a++){const t=r.shift();e.push(t),i.get(t)?.forEach(e=>{const t=n.get(e)||0;n.set(e,t-1),t-1==0&&r.push(e)})}e.length>0&&l.push(e)}return o.forEach(e=>{l.flat().includes(e)||(0===l.length?l.push([e]):l[l.length-1].push(e))}),l.forEach((e,i)=>{const n=100+150*i,o=150*(e.length-1),l=(t-o)/2;e.forEach((e,t)=>{const i=l+150*t,o=n;a.set(e,{x:i,y:o})})}),a})(t,i);if(t.length&&e.length){t.forEach(t=>{const a=t.serviceName;if(n.find(e=>e.id===`${H.Source}-${a}-${Bt.MapItem}`))return;const i=e.find(e=>a===e.otelServiceName||a===e.name);o.set(a,t),t.services.forEach(e=>o.set(e.serviceName,{serviceName:e.serviceName,services:[]})),n.push({id:`${H.Source}-${a}-${Bt.MapItem}`,type:Bt.MapItem,position:l.get(a),data:il(t,i,nl(i))})}),o.forEach((t,a)=>{if(n.find(e=>e.id===`${H.Source}-${a}-${Bt.MapItem}`))return;const i=e.find(e=>a===e.otelServiceName||a===e.name);n.push({id:`${H.Source}-${a}-${Bt.MapItem}`,type:Bt.MapItem,position:l.get(a),data:il(t,i,nl(i))})});let a=50;e.forEach(e=>{const t=e.otelServiceName||e.name;n.find(e=>e.id===`${H.Source}-${t}-${Bt.MapItem}`)||(n.push({id:`${H.Source}-${t}-${Bt.MapItem}`,type:Bt.MapItem,position:{x:a,y:10},data:il(void 0,e,nl(e))}),a+=110)})}else n.push({id:`${H.Source}-${Bt.NoData}`,type:Bt.NoData,position:{x:i/2-150,y:a/4},data:{subTitle:m.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}});return n})({serviceMap:i,sources:[ll].concat(o),sourcesLoading:l,containerHeight:s,containerWidth:c});d.length>1?(e=t,u(t=>{const a=e.map(e=>{const a=t.find(t=>t.id===e.id);return e.position=a?.position||e.position,{id:e.id,item:e,type:a?"replace":"add"}});return t.find(e=>e.id===`${H.Source}-${Bt.NoData}`)&&a.push({id:`${H.Source}-${Bt.NoData}`,type:"remove"}),Za(a,t)})):u(t)}var e},[i,o,l,s,c]),a(()=>{g((({theme:e,nodes:t,serviceMap:a})=>{const i=[];return t.forEach(({id:t,data:{id:n,status:o}})=>{const{services:l}=a.find(e=>e.serviceName===n)||{services:[]};l.forEach(a=>{const n=t,l=`${H.Source}-${a.serviceName}-${Bt.MapItem}`,r=o===ie.Error;i.push({id:`${n}-to-${l}`,source:n,target:l,markerEnd:{type:Ga.ArrowClosed},style:{stroke:r?e?.colors.dark_red:e?.colors.border}})})}),i})({theme:n,nodes:d,serviceMap:i}))},[n,d,i]),e.createElement(ol,{ref:r,$heightToRemove:t},e.createElement(Wt,{nodes:d,edges:h,onNodesChange:p,onEdgesChange:y,zoomOnScroll:!0}))},sl=d.div`
|
|
411
411
|
display: flex;
|
|
412
412
|
flex-direction: column;
|
|
413
413
|
align-items: center;
|
|
@@ -417,12 +417,12 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
417
417
|
max-height: ${({$isModal:e})=>e?"calc(100vh - 510px)":"calc(100vh - 310px)"};
|
|
418
418
|
height: fit-content;
|
|
419
419
|
overflow-y: scroll;
|
|
420
|
-
`,
|
|
420
|
+
`,cl=d.div`
|
|
421
421
|
width: 100%;
|
|
422
422
|
padding-bottom: ${({$isOpen:e})=>e?"18px":"0"};
|
|
423
423
|
border-radius: 16px;
|
|
424
424
|
background-color: ${({$selected:e,theme:t})=>e?t.colors.majestic_blue+O.opacity.hex["024"]:t.colors.dropdown_bg_2+O.opacity.hex["040"]};
|
|
425
|
-
`,
|
|
425
|
+
`,dl=d.div`
|
|
426
426
|
display: flex;
|
|
427
427
|
justify-content: space-between;
|
|
428
428
|
gap: 12px;
|
|
@@ -434,26 +434,26 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
434
434
|
background-color: ${({$withClick:e,$selected:t,theme:a})=>e&&(t?a.colors.majestic_blue+O.opacity.hex["040"]:a.colors.dropdown_bg_2+O.opacity.hex["080"])};
|
|
435
435
|
transition: background-color 0.3s;
|
|
436
436
|
}
|
|
437
|
-
`,
|
|
437
|
+
`,ul=d(dl)`
|
|
438
438
|
width: calc(100% - 100px);
|
|
439
439
|
margin: 0 auto;
|
|
440
440
|
padding: 8px;
|
|
441
|
-
`,
|
|
441
|
+
`,pl=d.div`
|
|
442
442
|
position: relative;
|
|
443
443
|
padding-bottom: ${({$addPadding:e})=>e?"16px":"0"};
|
|
444
|
-
`,
|
|
444
|
+
`,ml=d.div`
|
|
445
445
|
position: absolute;
|
|
446
446
|
top: 6px;
|
|
447
447
|
left: 18px;
|
|
448
|
-
`,
|
|
448
|
+
`,hl=d(we)`
|
|
449
449
|
padding-bottom: ${({$addPadding:e})=>e?"16px":"0"};
|
|
450
|
-
`,
|
|
450
|
+
`,gl=d.div`
|
|
451
451
|
width: ${({$width:e})=>`${e||42}px`};
|
|
452
452
|
display: flex;
|
|
453
453
|
align-items: center;
|
|
454
454
|
justify-content: flex-end;
|
|
455
455
|
text-align: right;
|
|
456
|
-
`,
|
|
456
|
+
`,yl=$e(H.Namespace),vl=({isModal:t=!1,withInstances:a=!0,fetchingNamespace:i,fetchedNamespaces:n,filteredNamespacesAndSources:o,selectedNamespace:l,onSelectNamespace:r,selectedSources:s,onSelectSource:c,selectedFutureApps:d,onSelectFutureApps:u})=>{const p=O.useTheme(),{isVm:h}=Be(),{namespacesLoading:g}=z(),y=Object.entries(o||{});return y?.length?e.createElement(sl,{$isModal:t},y.map(([t,o])=>{const y=s?.[t]||[],v=d?.[t]?.selected||!1,f=y.filter(({selected:e})=>e),x=y.length>0,S=l===t,$=f.length>0&&f.length===o.length,k=f.length>0&&f.length!==o.length,C=o.length>0,D=1===o.length;return r||C?e.createElement(cl,{key:`namespace-${t}`,"data-id":`namespace-${t}`,$selected:$,$isOpen:S},e.createElement(dl,{$selected:$,$withClick:!!r,onClick:()=>r?.(t)},e.createElement(ce,{$gap:12},r&&e.createElement(b,{partiallyChecked:k,value:$,onChange:e=>r(t,e)}),e.createElement(yl,null),e.createElement(E,null,t)),e.createElement(ce,{$gap:24},!h&&u&&e.createElement(w,{title:m.FUTURE_APPS_TITLE,tooltip:m.FUTURE_APPS_DESCRIPTION,initialValue:v,onChange:e=>u(e,t),flipHorizontally:!0}),e.createElement(gl,{$width:108},i!==t||n?.includes(t)?null:e.createElement(_t,{size:10},"Retrieving workloads...")),e.createElement(gl,null,e.createElement(E,{size:10,color:p.text.grey},x?`${f.length}/${o.length}`:null)),r&&e.createElement(mt,{extend:S}))),(S||!r)&&(C?e.createElement(pl,{$addPadding:!c},e.createElement(ml,null,e.createElement(le,{orientation:"vertical",length:(D?24:34*o.length)+"px"})),o.map(i=>{const n=f.some(({name:e})=>e===i.name);return e.createElement(bl,{key:`source-${i.name}`,withInstances:a,source:i,namespace:t,isSelected:n,onSelect:c})})):e.createElement(hl,{$addPadding:!c},g||i===t&&!n?.includes(t)?e.createElement(Ae,null):e.createElement(De,{title:m.NO_SOURCES_NAMESPACE,subTitle:m.TRY_SEARCH_OR_OTHER_NAMESPACE})))):null})):e.createElement(we,null,g||i?e.createElement(Ae,null):e.createElement(De,{title:m.NO_SOURCES,subTitle:!h&&r?m.PLEASE_MAKE_SURE_UNIGNORED_NAMESPACES:m.PLEASE_ADD_SOURCE}))},bl=({withInstances:t,source:a,namespace:i,isSelected:n,onSelect:o})=>e.createElement(ul,{"data-id":`source-${a.name}`,$selected:n,$withClick:!!o,onClick:()=>o?.(a)},e.createElement(ce,{$gap:12},o&&e.createElement(b,{value:n,onChange:()=>o(a,i)}),e.createElement(ce,{$gap:4},e.createElement(E,null,a.name),e.createElement(E,{opacity:.8,size:10},t?` • ${a.numberOfInstances||0} running instance${1!==a.numberOfInstances?"s":""}`:"",` • ${a.kind}`)))),fl=d.div`
|
|
457
457
|
display: flex;
|
|
458
458
|
flex-direction: column;
|
|
459
459
|
align-items: center;
|
|
@@ -462,35 +462,35 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
462
462
|
max-height: calc(100vh - 200px);
|
|
463
463
|
height: fit-content;
|
|
464
464
|
overflow-y: scroll;
|
|
465
|
-
`,
|
|
465
|
+
`,xl=({onEditStream:t,onEditSources:a,onEditDestinations:i,categories:n})=>{const{selectedStreamName:o}=We(),{configuredSources:r,configuredDestinations:s,configuredDestinationsUpdateOnly:c}=dt(),d=l(()=>Object.values(r).reduce((e,t)=>e+t.filter(e=>e.selected).length,0),[r]);return e.createElement(te,{$isNotModal:!0},e.createElement(X,{$gap:12},e.createElement(F,{title:m.SUMMARY,description:m.STREAM_CONFIRM}),e.createElement(fl,null,e.createElement(G,{title:m.STREAM_NAME,action:()=>e.createElement(Jt,{onClick:t}),data:[{title:"",value:o}]}),e.createElement(G,{title:m.SELECTED_SOURCES,titleBadge:d,action:()=>e.createElement(Jt,{onClick:a})},e.createElement(vl,{filteredNamespacesAndSources:r,withInstances:!1})),e.createElement(G,{title:m.SELECTED_DESTINATIONS,titleBadge:s.length+c.length,action:()=>e.createElement(Jt,{onClick:i})},e.createElement(go,{categories:n})))))};var Sl;!function(e){e.Overview="overview",e.InstrumentationRules="InstrumentationRule",e.Sources="Source",e.Actions="Action",e.Destinations="Destination"}(Sl||(Sl={}));const $l=({onClickId:a,defaultSelectedId:i,extendedNavIcons:n})=>{const{isVm:o}=Be(),[r,s]=t(i||""),c=l(()=>[{id:Sl.Overview,icon:Ka,selected:r===Sl.Overview,onClick:()=>{s(Sl.Overview),a(Sl.Overview)},tooltip:"Overview"},...(n||[]).map(e=>({...e,selected:r===e.id,onClick:()=>{s(e.id),e.onClick()}}))],[r]),d=l(()=>{const e=[{id:Sl.Sources,icon:Ha,selected:r===Sl.Sources,onClick:()=>{s(Sl.Sources),a(Sl.Sources)},tooltip:"Sources"},{id:Sl.Destinations,icon:za,selected:r===Sl.Destinations,onClick:()=>{s(Sl.Destinations),a(Sl.Destinations)},tooltip:"Destinations"}];return o||(e.push({id:Sl.InstrumentationRules,icon:Va,selected:r===Sl.InstrumentationRules,onClick:()=>{s(Sl.InstrumentationRules),a(Sl.InstrumentationRules)},tooltip:"Instrumentation Rules"}),e.push({id:Sl.Actions,icon:qa,selected:r===Sl.Actions,onClick:()=>{s(Sl.Actions),a(Sl.Actions)},tooltip:"Actions"})),e},[o,r]);return e.createElement(Ut,{orientation:"vertical",mainIcons:c,subIcons:d})},kl=({})=>e.createElement(pt,{onClick:()=>window.open("https://join.slack.com/t/odigos/shared_invite/zt-2wc6gm4j9-EhcVFYrLwHqvcIErO9sVzw","_blank","noopener noreferrer"),tooltip:"Join our Slack community"},e.createElement(Ba,null)),Cl=(e,t)=>{const{name:a,kind:i,namespace:n}=e,o=[{title:m.KIND,value:i},{title:m.NAME,value:a,tooltip:"Resource name"}];return t||(o.unshift({title:m.NAMESPACE,value:n}),o.push({type:h.Divider}),o.push({type:h.CopyText,value:`kubectl get ${i} ${a} -n ${n}`.toLowerCase()})),o},wl=d.div`
|
|
466
466
|
display: flex;
|
|
467
467
|
flex-direction: column;
|
|
468
468
|
gap: 24px;
|
|
469
469
|
padding: 4px;
|
|
470
|
-
`,
|
|
470
|
+
`,Dl=({formData:t,handleFormChange:a})=>e.createElement(wl,null,e.createElement(S,{name:"sourceName",title:"Source name",tooltip:"This overrides the default service name that runs in your cluster.",placeholder:"Use a name that overrides the source name",value:t.otelServiceName,onChange:({target:{value:e}})=>a("otelServiceName",e)})),Tl=({workloadOdigosHealthStatus:t})=>{if(!t)return null;const a=Gt(t?.status),i=it(t?.reasonEnum),n=t?.message;return e.createElement(ce,{$alignItems:"center",$justifyContent:"center"},e.createElement(se,{status:a,title:i,subtitle:n,withBackground:a!==pe.Disabled,withBorder:!0,withIcon:!0,width:"calc(100% - 24px)"}))},Nl=({source:i,fetchSourceDescribe:n,restartPod:o})=>{const[l,r]=t(!1),[s,d]=t(null);return a(()=>{i&&n({namespace:i.namespace,name:i.name,kind:i.kind}).then(({data:e})=>{e?.describeSource?d(e.describeSource):r(!0)})},[i.namespace,i.name,i.kind]),s||l?e.createElement(X,{$gap:12},l?e.createElement(we,{$height:"70vh"},e.createElement(De,{subTitle:"Could not fetch describe for this source"})):s?.pods?.length?s.pods.map(({podName:t,nodeName:a,phase:n,agentInjected:l,runningLatestWorkloadRevision:r,containers:d,manifestYAML:u})=>{const p=n.status!==ie.Success||Yt(d)?ie.Error:ie.Success,m=[];return m.push(e.createElement(Xt,{key:"copy-text",value:`kubectl get pod ${t.value} -n ${s?.namespace?.value||i.namespace}`.toLowerCase()})),m.push(e.createElement(le,{key:"divider-1",length:"100%",margin:"0"})),m.push(e.createElement(Zt,{key:"describe-row-1",title:a.name,tooltip:a.explain||"",value:{status:a.status||void 0,text:a.value}})),m.push(e.createElement(le,{key:"divider-2",length:"100%",margin:"0"})),m.push(e.createElement(Zt,{key:"describe-row-2",title:n.name,tooltip:n.explain||"",value:{status:n.status||void 0,text:n.value}})),m.push(e.createElement(le,{key:"divider-3",length:"100%",margin:"0"})),m.push(e.createElement(Zt,{key:"describe-row-3",title:l.name,tooltip:l.explain||"",value:{status:l.status||void 0,text:l.value}})),m.push(e.createElement(le,{key:"divider-4",length:"100%",margin:"0"})),r?.name&&(m.push(e.createElement(Zt,{key:"describe-row-4",title:r.name,tooltip:r.explain||void 0,value:{status:r.status||void 0,text:r.value}})),m.push(e.createElement(le,{key:"divider-5",length:"100%",margin:"0"}))),d.forEach(t=>{m.push(e.createElement(Qt,{key:`pod-container-${t.containerName.value}`,...t}))}),u&&(m.push(e.createElement(le,{key:"divider-6",length:"100%",margin:"0"})),m.push(e.createElement(ea,{key:"yaml-section-card",yaml:u}))),e.createElement(G,{key:`pod-${t.value}`,title:`Pod: ${t.value}`,withExtend:!0,action:({hovered:a})=>e.createElement("div",{style:{position:"relative"}},e.createElement(se,{key:"status",status:p,title:p,withIcon:!0,withBorder:!0}),a&&e.createElement(ta,{key:"hover-actions",isOpen:!0,positionRight:"calc(100% + 12px)",actions:[{id:aa(),label:"Restart",rightIcon:Na,onClick:()=>o(s?.namespace?.value||i.namespace,t.value)}]}))},c.toArray(m))}):e.createElement(we,{$height:"70vh"},e.createElement(De,{subTitle:"Check if you have any running pods and try again"}))):e.createElement(we,{$height:"70vh"},e.createElement(Ae,null))},El=d(ce)`
|
|
471
471
|
width: 100%;
|
|
472
472
|
align-items: center;
|
|
473
473
|
justify-content: space-between;
|
|
474
|
-
`,
|
|
474
|
+
`,Ol=({source:i,fetchSourceLibraries:n})=>{const o=O.useTheme(),[l,s]=t(!1),[c,d]=t(null);return a(()=>{i&&n({namespace:i.namespace,name:i.name,kind:i.kind}).then(({data:e})=>{e?.instrumentationInstanceComponents?d(wt(e.instrumentationInstanceComponents).sort((e,t)=>e.name.localeCompare(t.name))):s(!0)})},[i.namespace,i.name,i.kind]),c||l?e.createElement(X,{$gap:12},l?e.createElement(we,{$height:"70vh"},e.createElement(De,{subTitle:"Could not fetch libraries for this source"})):c?.length?e.createElement(G,{title:"Instrumented Libraries"},c.map(({name:t,healthy:a,nonIdentifyingAttributes:i},n)=>e.createElement(r,{key:`library-${t}`},e.createElement(El,null,e.createElement(E,{size:12,color:o.text.grey},t),e.createElement(ce,{$gap:4},i.map(({key:a,value:i})=>ia(i)&&na(i)&&"is_standard_lib"===a?e.createElement(se,{key:`${t}-${a}`,status:ie.Default,title:"STANDARD",withBorder:!0}):null),"boolean"==typeof a&&e.createElement(se,{status:a?ie.Success:ie.Error,title:a?"HEALTHY":"UNHEALTHY",withBorder:!0}))),n!==c.length-1&&e.createElement(le,{length:"100%",margin:"0"})))):e.createElement(we,{$height:"70vh",$gap:12},e.createElement(De,{title:"No libraries found",subTitle:""}),e.createElement(ae,{type:ie.Warning,message:"This feature is in early development, and has very limited support"}))):e.createElement(we,{$height:"70vh"},e.createElement(Ae,null))};var Al;!function(e){e.Overview="Overview",e.Pods="Pods",e.Libraries="Libraries"}(Al||(Al={}));const Fl=[ra.Deployment,ra.StatefulSet,ra.DaemonSet,ra.DeploymentConfig],Il=[sa.Python,sa.Go,sa.Java],Ml=d.div`
|
|
475
475
|
width: 100%;
|
|
476
476
|
height: 100%;
|
|
477
477
|
max-height: calc(100vh - 220px);
|
|
478
478
|
overflow: overlay;
|
|
479
479
|
overflow-y: auto;
|
|
480
|
-
`,
|
|
480
|
+
`,Rl=d.div`
|
|
481
481
|
display: flex;
|
|
482
482
|
flex-direction: column;
|
|
483
483
|
gap: 12px;
|
|
484
|
-
`,
|
|
484
|
+
`,Ll=({persistSources:i,updateSource:o,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d,restartPod:u})=>{const{isVm:p}=Be(),{sources:h}=z(),{selectedStreamName:g}=We(),{drawerType:y,drawerEntityId:v}=L(),b=l(()=>Ue(h,g),[h,g]),f=n(null),x=y===H.Source,[S,$]=t(!1),[k,C]=t(!1),[w,D]=t(Al.Overview),[T,N]=t(null);a(()=>{x&&v&&s(v).then(e=>N(e||null))},[x,v]);const{formData:O,handleFormChange:A,resetFormData:F,loadFormWithDrawerItem:I}=oa(),M=l(()=>{if(v)return T&&JSON.stringify(qt(T))===JSON.stringify(qt(v))?T:b?.find(e=>JSON.stringify(qt(e))===JSON.stringify(qt(v)))},[v,b,T]);a(()=>{x&&M?I(M):F()},[x,M]);const R=l(()=>{const e=M?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===pe.Loading,containers:M?.containers||[]}},[M]),P=l(()=>{const e=[{label:Al.Overview,onClick:()=>D(Al.Overview),selected:w===Al.Overview}];return Fl.includes(M?.kind)&&e.push({label:Al.Pods,onClick:()=>D(Al.Pods),selected:w===Al.Pods}),M?.containers?.some(({language:e})=>Il.includes(e))&&e.push({label:Al.Libraries,onClick:()=>D(Al.Libraries),selected:w===Al.Libraries}),e},[w,M]);return M?e.createElement(Si,{ref:f,onClose:()=>{D(Al.Overview),N(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:Ke(M.containers),isEdit:S,isFormDirty:k,onEdit:w===Al.Overview?e=>{$("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=O.otelServiceName!==M.name?O.otelServiceName:"";A("otelServiceName",e),await o(v,{...O,otelServiceName:e}),N(null),C(!1),$(!1)},onDelete:w===Al.Overview?async()=>{const{namespace:e}=M;i({[e]:[{...M,selected:!1,currentStreamName:g}]},{}),N(null),C(!1),$(!1),f.current?.closeDrawer()}:void 0,onCancel:()=>{C(!1),$(!1),A("otelServiceName",M.otelServiceName||M.name||"")},isLastItem:1===b.length,tabs:P,headerActionButtons:[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>r([v]),children:e.createElement(e.Fragment,null,e.createElement(Ra,null),e.createElement(E,{size:14,family:"secondary",decoration:"underline"},"Restart"))}]},w===Al.Overview?S?e.createElement(Ml,null,e.createElement(Dl,{formData:O,handleFormChange:(...e)=>{C(!0),A(...e),A("currentStreamName",g)}})):e.createElement(Rl,null,e.createElement(Tl,{workloadOdigosHealthStatus:M.workloadOdigosHealthStatus}),e.createElement(U,{conditions:M.conditions||[]}),e.createElement(G,{title:m.SOURCE_DETAILS,data:M?Cl(M,p):[]}),e.createElement(G,{title:p?m.DETECTED_PROCESSES:m.DETECTED_CONTAINERS,titleBadge:R.isLoading?pe.Loading:R.containers.length,description:R.description||(p?m.DETECTED_PROCESSES_DESCRIPTION:m.DETECTED_CONTAINERS_DESCRIPTION)},R.containers.map(t=>e.createElement(la,{key:`source-container-${t.containerName}`,...t,callbackRuntimeOverride:async e=>await o(v,e)}))),e.createElement(ea,{yaml:M.manifestYAML})):w===Al.Pods?e.createElement(Nl,{source:M,fetchSourceDescribe:c,restartPod:u}):e.createElement(Ol,{source:M,fetchSourceLibraries:d})):null},Pl=d.div`
|
|
485
485
|
max-width: ${({$fullWidth:e})=>e?"unset":"420px"};
|
|
486
486
|
width: 100%;
|
|
487
|
-
`,
|
|
487
|
+
`,jl=i(({isModal:t,fetchSingleNamespace:a,onClickSummary:i},n)=>{const l=O.useTheme(),{isVm:r}=Be(),s=ca({fetchSingleNamespace:a}),{selectedSources:c,fetchingNamespace:d,selectedAllNamespaces:u,onSelectAllNamespaces:p,getApiSourcesPayload:h,getApiFutureAppsPayload:g,searchText:y,setSearchText:v,searchBy:b,setSearchBy:f,showSelectedOnly:x,setShowSelectedOnly:$,showRunningOnly:k,setShowRunningOnly:C}=s;o(n,()=>({getFormValues:()=>({apps:h(),futureApps:g()})}));const D=Object.values(c).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return e.createElement(te,{$isNotModal:!t},e.createElement(X,{$gap:12},e.createElement(X,{$gap:24},i&&e.createElement(gt,{onClick:i}),e.createElement(F,{title:m.SELECT_SOURCES,badgeLabel:D,description:m.SELECT_SOURCES_DESCRIPTION}),e.createElement(ce,{$justifyContent:"space-between"},e.createElement(Pl,{$fullWidth:r},e.createElement(S,{placeholder:b===H.Source?m.SEARCH_SOURCES:m.SEARCH_NAMESPACES,icon:Ea,value:y,onChange:e=>v(e.target.value.toLowerCase())})),!r&&e.createElement(A,{options:[{label:m.SOURCE,value:H.Source,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary},{label:m.NAMESPACE,value:H.Namespace,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary}],selected:b,setSelected:f})),e.createElement(ce,{$gap:36},e.createElement(w,{title:m.SELECT_ALL,initialValue:u,onChange:p,disabled:!!d}),e.createElement(w,{title:m.ONLY_SELECTED,initialValue:x,onChange:$}),e.createElement(w,{title:m.ONLY_RUNNING_INSTANCES,initialValue:k,onChange:C}))),e.createElement(le,null),e.createElement(vl,{isModal:t,...s})))});jl.displayName=jl.name;const Kl=({fetchSingleNamespace:t,persistSources:a})=>{const{currentModal:i,setCurrentModal:o}=Z(),l=i===H.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();a(e,t),r()}},c=n(null);return P({key:"Enter",active:l},s),l?e.createElement(Q,{isOpen:l,onClose:r,header:{title:"Add Source"},actionComponent:e.createElement(ee,{buttons:[{label:"DONE",variant:"primary",onClick:s}]})},e.createElement(jl,{ref:c,isModal:!0,fetchSingleNamespace:t})):null},Vl=e=>{const t=[{key:"checkbox-and-icon",title:""},{key:"name",title:m.NAME,sortable:!0},{key:"kind",title:"Kind",sortable:!0}];return e||t.push({key:"namespace",title:m.NAMESPACE,sortable:!0}),t.push({key:"containers",title:m.DETECTED_CONTAINERS}),t.push({key:"conditions",title:"Conditions"}),t.push({key:"throughput",title:"Throughput",sortable:!0}),t},ql=({metrics:t,maxHeight:a,maxWidth:i})=>{const n=p(),{isVm:o}=Be(),r=he(),{selectedStreamName:c}=We(),{sources:d,sourcesLoading:u}=z(),{setDrawerType:h,setDrawerEntityId:g}=L(),{selectedSources:y,setSelectedSources:v}=Fe(),{progress:f}=qe(),x=l(()=>f[He.Instrumenting]||f[He.Uninstrumenting]?f[He.Instrumenting]?.percentage||f[He.Uninstrumenting]?.percentage||0:void 0,[f[He.Instrumenting],f[He.Uninstrumenting]]),S=l(()=>Ue(d,c),[d,c]),$=l(()=>Ai({instrumentationRules:[],sources:Je(S,r),actions:[],destinations:[],searchText:r.searchText,selectedCategory:H.Source}).searchResults.find(({category:e})=>e===H.Source)?.entities||[],[S,r]),[k,C]=l(()=>{let e=0;return Object.values(y).forEach(t=>{e+=t.length}),[0!==e,e]},[y]),w=s(e=>{if(e){const e={};$.forEach(t=>{const{namespace:a}=t;e[a]?e[a].push(t):e[a]=[t]}),v(e)}else v({})},[$]),D=s(e=>{const{namespace:t,name:a,kind:i}=e,n={...y};n[t]||(n[t]=[]);const o=n[t].findIndex(e=>e.name===a&&e.kind===i);-1===o?n[t].push(e):n[t].splice(o,1),v(n)},[y]),T=l(()=>$.map(a=>{const i=qt(a),o=JSON.stringify(i),{hasErrors:l,hasWarnings:r,hasDisableds:s}=re(a.conditions||[]),c=!!y[i.namespace]?.find(e=>e.namespace===i.namespace&&e.name===i.name&&e.kind===i.kind);return{status:l?ie.Error:r?ie.Warning:void 0,faded:s,onClick:()=>{h(H.Source),g(i)},cells:[{columnKey:"checkbox-and-icon",component:()=>e.createElement(ce,{$gap:16},e.createElement(b,{value:c,onChange:()=>D(a)}),e.createElement(da,{icons:Ke(a.containers),id:o}))},{columnKey:"name",value:ve(a,H.Source,{extended:!0})},{columnKey:"kind",value:a.kind,textColor:n.text.info},{columnKey:"namespace",value:a.namespace,textColor:n.text.info},{columnKey:"throughput",value:Re(Nt(t,H.Source,i).throughput),textColor:n.text.info},{columnKey:"conditions",component:()=>e.createElement(Ei,{conditions:a.conditions||[],id:o})},{columnKey:"containers",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(se,{status:ie.Info,title:ua(a.containers),withBorder:!0}))}]}}),[$,y,t,D]),{badge:N,badgeTooltip:O}=l(()=>$.length!==S.length?{badge:`${$.length}/${S.length}`,badgeTooltip:m.FILTERED_COUNT_TOOLTIP}:{badge:S.length,badgeTooltip:void 0},[$,S]);return e.createElement(fe,{$maxWidth:i},e.createElement(xe,null,e.createElement(b,{partiallyChecked:k&&$?.length!==C,value:k&&$?.length===C,onChange:w,disabled:!$?.length}),e.createElement(Se,{icon:$e(H.Source),title:m.SOURCES,badge:N,badgeTooltip:O,loading:u||"number"==typeof x})),e.createElement(ke,{$maxHeight:a},e.createElement(Ce,{columns:Vl(o),rows:T})),"number"!=typeof x||T.length?T.length?null:e.createElement(we,{style:{marginTop:"2rem"}},e.createElement(De,null)):e.createElement(we,{style:{marginTop:"2rem",gap:"24px"}},e.createElement(Te,{width:420}),e.createElement(ce,{$gap:16},e.createElement(E,{color:n.text.info},f[He.Instrumenting]?"Instrumenting":"Uninstrumenting"," workloads..."),e.createElement(Ne,{label:`${x}%`}))))},Hl=({expiresAt:t})=>{const a=O.useTheme(),{formatTimeAgo:i}=Ht(),n=i(t),o=new Date(t).toDateString().split(" ").slice(1).join(" "),l=pa(t,0)?a.text.error:pa(t,6048e5)?a.text.warning:a.text.success;return e.createElement(E,{size:14,color:l},n," (",o,")")},zl=d.div`
|
|
488
488
|
position: relative;
|
|
489
|
-
`,
|
|
489
|
+
`,Bl=({token:a,saveToken:i})=>{const{CopyButton:n}=ma(),{formData:o,handleFormChange:l,resetFormData:r}=ha({token:a}),[s,c]=t(!1),d=()=>{c(!1),r()};return e.createElement(ce,{$gap:0},e.createElement(n,{value:a,size:ga.L}),e.createElement(le,{orientation:"vertical",length:"12px"}),e.createElement(zl,null,e.createElement(pt,{size:32,onClick:()=>{c(!0)}},e.createElement(Ca,null)),s&&e.createElement(ya,{flipX:!0,clientX:36,isOpen:s,onClose:d,onSave:()=>{i(o.token).then(d)},title:"Enter a new API Token",titleTooltip:"Contact us to generate a new one"},e.createElement(S,{placeholder:"API Token",type:"password",value:o.token,onChange:e=>l("token",e.target.value)}))))},Wl=({tokens:t,saveToken:a})=>e.createElement(G,{title:"Authorization Tokens",titleBadge:t.length,data:[{type:h.Table,value:{columns:[{key:"icon",title:""},{key:"name",title:"Name"},{key:"expires_at",title:"Expires"},{key:"token",title:"Token"},{key:"actions",title:""}],rows:t.map(({name:t,token:i,expiresAt:n})=>({cells:[{columnKey:"icon",icon:Wa},{columnKey:"name",value:t},{columnKey:"token",value:`${new Array(15).fill("•").join("")}`},{columnKey:"expires_at",component:()=>e.createElement(Hl,{expiresAt:n})},{columnKey:"actions",component:()=>e.createElement(Bl,{token:i,saveToken:a})}]}))}}]}),_l=({fetchDescribeOdigos:i})=>{const[n,o]=t(null);if(a(()=>{i().then(({data:e})=>o(e?.describeOdigos||null))},[]),!n)return e.createElement(we,null,e.createElement(Ae,null));const l=t=>t?.name?[e.createElement(le,{key:`divider-${t.name}`}),e.createElement(Zt,{key:`describe-row-${t.name}`,title:t.name,subTitle:t.explain||void 0,value:{status:t.status||(ia(t.value)?na(t.value)?ie.Success:ie.Error:ie.Default),text:t.value}})]:[];return e.createElement(e.Fragment,null,e.createElement(G,{title:"General Information",withExtend:!0,initialExtended:!0,data:[{title:n?.odigosVersion?.name,value:n?.odigosVersion?.value},{title:n?.kubernetesVersion?.name,value:n?.kubernetesVersion?.value},{title:n?.installationMethod?.name,value:n?.installationMethod?.value},{title:n?.tier?.name,value:n?.tier?.value},{title:"# of sources",value:n?.numberOfSources?.toString()},{title:"# of destinations",value:n?.numberOfDestinations?.toString()}]}),e.createElement(G,{title:"Cluster Collector",withExtend:!0},Object.values(n?.clusterCollector||{}).map(l)),e.createElement(G,{title:"Node Collector",withExtend:!0},Object.values(n?.nodeCollector||{}).map(l)))},Jl=d.div`
|
|
490
490
|
display: flex;
|
|
491
491
|
flex-direction: column;
|
|
492
492
|
gap: 12px;
|
|
493
|
-
`,
|
|
493
|
+
`,Ul="System Overview",Gl=({tokens:a,saveToken:i,fetchDescribeOdigos:n})=>{const[o,l]=t(!1),r=()=>l(e=>!e);return e.createElement(e.Fragment,null,e.createElement(pt,{key:Ul,onClick:r,tooltip:Ul},e.createElement(_a,{size:18})),e.createElement(K,{width:"750px",isOpen:o,onClose:r,header:{icons:[_a],title:Ul},footer:{isOpen:!1}},e.createElement(Jl,null,!!a?.length&&e.createElement(Wl,{tokens:a,saveToken:i}),e.createElement(_l,{fetchDescribeOdigos:n}))))},Yl=d.div`
|
|
494
494
|
position: fixed;
|
|
495
495
|
bottom: 12px;
|
|
496
496
|
left: 12px;
|
|
@@ -499,7 +499,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
499
499
|
flex-direction: column-reverse;
|
|
500
500
|
gap: 6px;
|
|
501
501
|
max-width: 600px;
|
|
502
|
-
`,
|
|
502
|
+
`,Xl=()=>{const{notifications:t,markAsDismissed:a,markAsSeen:i}=jt(),{onClickNotification:n}=zt();return e.createElement(Yl,null,t.filter(({dismissed:e})=>!e).map(({id:t,type:o,title:l,message:r,crdType:s,target:c})=>e.createElement(ae,{key:`toast-${t}`,id:t,type:o,title:l,message:r,action:s&&c?{label:"go to details",onClick:()=>n({id:t,crdType:s,target:c},{dismissToast:!0})}:void 0,onClose:()=>(({id:e,asSeen:t})=>{a(e),t&&i(e)})({id:t,asSeen:!0})})))},Zl=d.div`
|
|
503
503
|
position: relative;
|
|
504
504
|
display: flex;
|
|
505
505
|
align-items: center;
|
|
@@ -518,7 +518,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
518
518
|
stroke: ${({theme:e})=>e.text.secondary};
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
`,
|
|
521
|
+
`,Ql=d.div`
|
|
522
522
|
position: absolute;
|
|
523
523
|
top: 2px;
|
|
524
524
|
left: ${({$darkMode:e})=>e?"2px":"calc(100% - 2px - 24px)"};
|
|
@@ -528,50 +528,50 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
528
528
|
background-color: ${({theme:e})=>e.colors.border};
|
|
529
529
|
border-radius: 100%;
|
|
530
530
|
transition: all 0.3s;
|
|
531
|
-
`,
|
|
531
|
+
`,er=({path:t})=>e.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",fill:"none"},e.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:t})),tr=()=>{const{darkMode:t,setDarkMode:a}=va();return e.createElement(Zl,{onClick:()=>a(!t)},e.createElement(er,{path:"M14 7.977A4.333 4.333 0 1 1 8.023 2H8a6 6 0 1 0 6 6v-.023Z"}),e.createElement(er,{path:"M8 15.333v-.666m-5.185-1.482.471-.471M.666 8h.667m1.482-5.185.471.47M8 1.334V.667m4.714 2.619.471-.471M14.667 8h.666m-2.619 4.714.471.471M12 8a4 4 0 1 1-8 0 4 4 0 0 1 8 0Z"}),e.createElement(Ql,{$darkMode:t}))},ar=e=>{const{spans:t}=e,a=new Map;t.forEach(e=>{a.set(e.spanID,{...e,spans:[]})});const i=[];return t.forEach(e=>{const t=a.get(e.spanID);let n=!1;if(e.references.length){const t=e.references.find(e=>"CHILD_OF"===e.refType);t&&t.spanID&&a.has(t.spanID)||(n=!0)}else n=!0;if(n)i.push(t);else{const i=e.references.find(e=>"CHILD_OF"===e.refType);if(i){const e=a.get(i.spanID);e&&(e.spans=e.spans||[],e.spans.push(t),e.spans=e.spans.sort((e,t)=>e.startTime-t.startTime))}}}),i.sort((e,t)=>e.startTime-t.startTime)},ir=(e,t)=>{const{tags:a}=e,i={},n=[];return a.forEach(e=>{i[e.key]=e.value}),n.push({type:h.Code,value:{language:"json",code:JSON.stringify(i,null,2),pretty:t}}),n},nr=e=>{const{logs:t}=e,a=[];return t.forEach((e,i)=>{e.fields.forEach(e=>{a.push({title:e.key,value:e.value})}),i!==t.length-1&&a.push({type:h.Divider})}),a},or=e=>{const{traceID:t,spanID:a,processID:i,operationName:n,duration:o,startTime:l,warnings:r}=e,s=[];return s.push({type:h.CopyText,title:"Trace ID",value:t}),s.push({type:h.CopyText,title:"Span ID",value:a}),s.push({type:h.Divider}),s.push({title:"Service",value:i}),s.push({title:"Operation",value:n}),s.push({title:"Duration",value:ba(o)}),s.push({title:"Start time",value:new Date(l/1e3).toLocaleString()}),r.length&&(s.push({type:h.Divider}),s.push({title:"Warnings",titleIcon:Ja,value:r})),s},lr=(e,t)=>{const{tags:a}=e,i={},n=[];return a.forEach(e=>{i[e.key]=e.value}),n.push({type:h.Code,value:{language:"json",code:JSON.stringify(i,null,2),pretty:t}}),n},rr=d.div`
|
|
532
532
|
display: flex;
|
|
533
533
|
flex-direction: column;
|
|
534
534
|
gap: 12px;
|
|
535
535
|
max-height: 100vh;
|
|
536
536
|
overflow-y: auto;
|
|
537
|
-
`,
|
|
537
|
+
`,sr=({span:a,process:i,onClose:n})=>{const[o,l]=t(!0),[r,s]=t(!0);return e.createElement(K,{width:"750px",isOpen:!0,onClose:n,header:{icons:[Ua],title:a.operationName},footer:{isOpen:!1}},e.createElement(rr,null,e.createElement(G,{title:"Details",data:or(a)}),a.logs.length>0&&e.createElement(G,{title:"Errors",titleBadge:a.logs.length,titleIcon:Ja,data:nr(a)}),e.createElement(G,{title:"Tags",data:ir(a,o),action:e.createElement(fa,{isPrettyMode:o,setIsPrettyMode:l})}),i&&e.createElement(G,{title:`Process (${i.serviceName})`,data:lr(i,r),action:e.createElement(fa,{isPrettyMode:r,setIsPrettyMode:s})})))},cr=370,dr=["#33DCA7","#50F6E8","#444AD9","#8B55FF","#FF7CA9"].reverse(),ur=d.div`
|
|
538
538
|
display: flex;
|
|
539
539
|
align-items: center;
|
|
540
|
-
width: ${
|
|
540
|
+
width: ${cr}px;
|
|
541
541
|
background-color: ${({$withErrors:e,theme:t})=>e?t.colors.error+O.opacity.hex["042"]:t.colors.dark_grey};
|
|
542
542
|
&:hover {
|
|
543
543
|
${({$withErrors:e,$preventHover:t,theme:a})=>!t&&`background-color: ${e?a.colors.error:a.colors.secondary+O.opacity.hex["010"]};`}
|
|
544
544
|
cursor: ${({$preventHover:e})=>e?"default":"pointer"};
|
|
545
545
|
}
|
|
546
|
-
`,
|
|
546
|
+
`,pr=d(ce)`
|
|
547
547
|
align-items: center;
|
|
548
548
|
justify-content: space-between;
|
|
549
549
|
gap: 4px;
|
|
550
550
|
padding: 12px;
|
|
551
551
|
padding-left: ${({$depth:e})=>12*e||12}px;
|
|
552
|
-
width: calc(${
|
|
553
|
-
`,
|
|
552
|
+
width: calc(${cr}px - ${({$depth:e})=>12*e}px);
|
|
553
|
+
`,mr=d(ce)`
|
|
554
554
|
align-items: center;
|
|
555
555
|
gap: 4px;
|
|
556
556
|
position: absolute;
|
|
557
557
|
right: 56px;
|
|
558
558
|
width: calc(100% - ${434}px);
|
|
559
|
-
`,
|
|
559
|
+
`,hr=d.div`
|
|
560
560
|
position: absolute;
|
|
561
561
|
left: ${({$startTime:e,$minStartTime:t,$maxEndTime:a})=>(e-t)/(a-t)*100+"%"};
|
|
562
562
|
width: ${({$duration:e,$maxDuration:t})=>e/t*100+"%"};
|
|
563
563
|
height: 12px;
|
|
564
564
|
border-radius: 32px;
|
|
565
|
-
background-color: ${({$indexInMatrix:e})=>
|
|
566
|
-
`,
|
|
565
|
+
background-color: ${({$indexInMatrix:e})=>dr[e%dr.length]};
|
|
566
|
+
`,gr=d(E)`
|
|
567
567
|
padding-left: calc(100% + 8px);
|
|
568
568
|
font-size: 10px;
|
|
569
569
|
color: ${({theme:e})=>e.text.darker_grey};
|
|
570
570
|
font-family: ${({theme:e})=>e.font_family.secondary};
|
|
571
571
|
white-space: nowrap;
|
|
572
|
-
`,
|
|
572
|
+
`,yr=({span:a,depth:i,indexInMatrix:n,maxDuration:o,minStartTime:l,maxEndTime:r,withErrors:s,errorTooltip:c,isOpen:d,withToggle:u,onToggleOpen:p,onSelect:m})=>{const h=O.useTheme(),[g,y]=t(!1),v=cr-12*i-20-(s?12:0),b=s&&(1===i||a.logs.length>0);return e.createElement(ur,{className:"span-container",$withErrors:s,$preventHover:g,onClick:m},e.createElement(pr,{$depth:i,className:"span-left"},e.createElement(ce,{$gap:4,$alignItems:"center"},u?e.createElement("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},e.createElement(pt,{onClick:e=>{e.stopPropagation(),p?.()},size:24},e.createElement(mt,{extend:d??!1}))):e.createElement("div",{style:{width:"24px"}}),e.createElement(Sa,{maxWidth:v/2,text:a.processID,textSize:14}),e.createElement(E,{size:12,color:h.text.darker_grey},"•"),e.createElement(Sa,{maxWidth:v/2,text:a.operationName,textSize:12,textColor:h.text.darker_grey})),s&&(b?e.createElement(ue,{...c},e.createElement(Ja,{fill:h.text.error})):e.createElement("div",{style:{position:"relative"}},e.createElement("div",{style:{position:"absolute",top:"-24px",right:"8px"}},e.createElement(le,{type:ie.Error,orientation:"vertical",thickness:1,length:"48px",margin:"0",opacity:.5}))))),e.createElement(mr,{className:"span-right"},e.createElement(hr,{$indexInMatrix:n,$duration:a.duration,$maxDuration:o,$startTime:a.startTime,$minStartTime:l,$maxEndTime:r},e.createElement(gr,null,ba(a.duration)))))},vr=({spans:t,logs:a,depth:i,indexInMatrix:n,maxDuration:o,minStartTime:l,maxEndTime:r,openSpanIdsState:s,selectedSpanState:c})=>{const d=O.useTheme();return t.map((t,u)=>{const p=t.spanID,m=s.value.includes(p),h=!!t.spans?.length,g=a.length?a:xa(t,"spans","logs"),y=g.length>0,v=y?g.length>1?`(${g.length}) errors`:g[0].fields.find(e=>"exception.message"===e.key)?.value:void 0,b=y?g.length>1?void 0:g[0].fields.find(e=>"exception.stacktrace"===e.key)?.value:void 0;return e.createElement("div",{key:`span-${p}`,style:{borderBottom:1===i?`1px dotted ${d.colors.border}`:"none"}},e.createElement(yr,{span:t,depth:i,indexInMatrix:n+u+i,maxDuration:o,minStartTime:l,maxEndTime:r,withErrors:y,errorTooltip:{titleIcon:Ja,title:v,text:b},isOpen:m,withToggle:h,onToggleOpen:()=>s.set(e=>e.some(e=>e===p)?e.filter(e=>e!=p):[...e,p,...xa(t,"spans","spanID")]),onSelect:()=>c.set(e=>e?.spanID===p?null:t)}),m&&h?e.createElement(vr,{spans:t.spans||[],logs:g,depth:i+1,indexInMatrix:n+u,maxDuration:o,minStartTime:l,maxEndTime:r,openSpanIdsState:s,selectedSpanState:c}):null)})},br=d.div`
|
|
573
573
|
width: 100%;
|
|
574
|
-
`,
|
|
574
|
+
`,fr=d.div`
|
|
575
575
|
max-height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px + 2px)`};
|
|
576
576
|
overflow: auto;
|
|
577
577
|
|
|
@@ -581,22 +581,22 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
581
581
|
border-radius: 24px;
|
|
582
582
|
border: 1px solid ${({theme:e})=>e.colors.dropdown_bg_2};
|
|
583
583
|
position: relative;
|
|
584
|
-
`,
|
|
584
|
+
`,xr=d.div`
|
|
585
585
|
padding: 12px 12px 12px 24px;
|
|
586
|
-
width: calc(${
|
|
586
|
+
width: calc(${cr}px - 36px);
|
|
587
587
|
background-color: ${({theme:e})=>e.colors.dark_grey};
|
|
588
|
-
`,
|
|
588
|
+
`,Sr=d.div`
|
|
589
589
|
width: 1px;
|
|
590
590
|
height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px + 2px)`};
|
|
591
591
|
background: ${({theme:e})=>`linear-gradient(to bottom, ${e.colors.border}, transparent)`};
|
|
592
592
|
|
|
593
593
|
position: absolute;
|
|
594
|
-
left: calc(${
|
|
595
|
-
|
|
594
|
+
left: calc(${cr}px + ((100% - ${cr}px) / ${5}) * ${({index:e})=>e});
|
|
595
|
+
`,$r=d(E)`
|
|
596
596
|
color: ${({theme:e})=>e.text.darker_grey};
|
|
597
597
|
font-size: 12px;
|
|
598
598
|
font-family: ${({theme:e})=>e.font_family.secondary};
|
|
599
599
|
padding-top: 12px;
|
|
600
600
|
padding-left: 12px;
|
|
601
601
|
white-space: nowrap;
|
|
602
|
-
|
|
602
|
+
`,kr=({heightToRemove:a,traces:i,isLoading:n})=>{const[o,r]=t([]),[s,c]=t(null),d=l(()=>wt(i).sort((e,t)=>t.spans[0].startTime-e.spans[0].startTime).map(e=>({...e,spans:ar(e)})),[i]),u=l(()=>d.reduce((e,t)=>Math.max(e,t.spans.reduce((e,t)=>e+t.duration,0)),0),[d]),p=l(()=>{const e=d.find(e=>e.spans.some(e=>e.spanID===s?.spanID)),t=e?.processes.find(e=>e.serviceName===s?.processID);return t},[d,s]);return e.createElement(e.Fragment,null,e.createElement(br,{$heightToRemove:a},n?e.createElement(we,{$height:"50vh"},e.createElement(Ae,{scale:1.5})):d.length?e.createElement(fr,{$heightToRemove:a},e.createElement(xr,null,e.createElement(E,null,"Service & operation")),new Array(5).fill(null).map((t,i)=>e.createElement(Sr,{key:`${i}-divider`,$heightToRemove:a,index:i},e.createElement($r,null,ba(u/5*i)))),d.map((t,a)=>{const{spans:i}=t,n=i.reduce((e,t)=>Math.min(e,t.startTime),Number.MAX_SAFE_INTEGER),l=i.reduce((e,t)=>Math.max(e,t.startTime+t.duration),0);return e.createElement(vr,{key:`recursive-spans-${t.traceID}`,spans:i,logs:[],depth:1,indexInMatrix:a,maxDuration:u,minStartTime:n,maxEndTime:l,openSpanIdsState:{value:o,set:r},selectedSpanState:{value:s,set:c}})})):e.createElement(we,{$height:"50vh"},e.createElement(De,{title:m.NO_TRACES_FOUND,subTitle:m.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}))),s&&e.createElement(sr,{span:s,process:p,onClose:()=>c(null)}))};export{wi as ActionDrawer,xi as ActionForm,Ti as ActionModal,Ii as ActionTable,ji as AwaitPipeline,ln as ConditionDropdown,en as DataFlow,Fn as DataFlowActionsMenu,$n as DataStreamDrawer,xn as DataStreamForm,Mn as DataStreamModal,In as DataStreamSelectionForm,Jn as DestinationDrawer,Bn as DestinationForm,mo as DestinationModal,bo as DestinationSelectionForm,xo as DestinationTable,rn as ErrorDropdown,Lo as InstrumentationRuleDrawer,Io as InstrumentationRuleForm,Ko as InstrumentationRuleModal,Ho as InstrumentationRuleTable,un as KindDropdown,sn as LanguageDropdown,cn as MonitorDropdown,Bo as MultiSourceControl,dn as NamespaceDropdown,Sl as NavIconIds,Yo as NotificationManager,Si as OverviewDrawer,pn as PodsAgentInjectionStatusDropdown,rl as ServiceMap,xl as SetupSummary,$l as SideNav,kl as SlackInvite,Ll as SourceDrawer,Dl as SourceForm,Kl as SourceModal,jl as SourceSelectionForm,ql as SourceTable,Gl as SystemOverview,Ei as TableCellConditions,Xl as ToastList,tr as ToggleDarkMode,kr as TraceView};
|