@odigos/ui-kit 0.0.138 → 0.0.139
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 +8 -0
- package/lib/chunks/{ui-components-84317435.js → ui-components-eab2149b.js} +644 -644
- package/lib/components/styled.d.ts +3 -3
- 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/index.d.ts +2 -0
- package/lib/containers/v2.js +5 -5
- package/lib/containers.js +116 -116
- package/lib/functions.js +1 -1
- package/lib/hooks.js +1 -1
- package/lib/icons/common/question-circle-icon/index.d.ts +1 -1
- package/lib/icons.js +1 -1
- package/lib/snippets/add-button/index.d.ts +2 -1
- package/lib/snippets/edit-button/index.d.ts +1 -1
- package/lib/snippets.js +1 -1
- package/lib/store.js +1 -1
- package/lib/theme.js +1 -1
- package/lib/types.js +1 -1
- package/lib/visuals.js +4 -4
- package/package.json +1 -1
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}from"styled-components";import{E as
|
|
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{E as m,G as h,H as g,K as y,J as v,M as b,Q as f,R as x,U as $,V as C,X as S,Y as k,Z as w,_ as T,$ as D,a0 as N,a1 as E,o as O,a2 as F,a3 as I,a4 as A,a5 as M,a6 as R,a7 as L,a8 as P,a9 as K,aa as j,ab as V,ac as q,ad as z,ae as H,af as B,n as W,ag as _,ah as U,ai as J,aj as G,ak as Y,al as X,am as Z,F as Q,an as ee,ao as te,ap as ae,aq as ie,ar as ne,as as oe,at as le,au as re,av as se,aw as ce,a as de,ax as ue,e as pe,ay as me,az as he,aA as ge,aB as ye,aC as ve,aD as be,aE as fe,aF as xe,aG as $e,aH as Ce,aI as Se,aJ as ke,aK as we,r as Te,N as De,aL as Ne,aM as Ee,aN as Oe,aO as Fe,aP as Ie,aQ as Ae,aR as Me,aS as Re,s as Le,aT as Pe,aU as Ke,aV as je,aW as Ve,aX as qe,aY as ze,aZ as He,a_ as Be,a$ as We,b0 as _e,b1 as Ue,b2 as Je,b3 as Ge,b4 as Ye,b5 as Xe,b6 as Ze,b7 as Qe,b8 as et,b9 as tt,ba as at,bb as it,bc as nt,bd as ot,be as lt,bf as rt,bg as st,bh as ct,bi as dt,bj as ut,bk as pt,bl as mt,bm as ht,bn as gt,bo as yt,bp as vt,bq as bt,br as ft,bs as xt,bt as $t,bu as Ct,bv as St,bw as kt,bx as wt,by as Tt,bz as Dt,bA as Nt,bB as Et,bC as Ot,bD as Ft,bE as It,bF as At,bG as Mt,bH as Rt,bI as Lt,bJ as Pt,bK as Kt,bL as jt,bM as Vt,bN as qt,bO as zt,h as Ht,bP as Bt,bQ as Wt,bR as _t,bS as Ut,bT as Jt,bU as Gt,bV as Yt,bW as Xt,bX as Zt,bY as Qt,bZ as ea,b_ as ta,b$ as aa,c0 as ia,c1 as na,c2 as oa,c3 as la,c4 as ra,c5 as sa,c6 as ca,p as da,u as ua,c7 as pa,c8 as ma,c9 as ha,ca as ga,cb as ya,cc as va,cd as ba}from"./chunks/ui-components-eab2149b.js";import{VSquareIcon as fa,XSquareIcon as xa,EditIcon as $a,TrashIcon as Ca,OdigosLogoText as Sa,PlusIcon as ka,SearchIcon as wa,FilterIcon as Ta,DataStreamIcon as Da,VIcon as Na,OdigosLogo as Ea,ArrowIcon as Oa,RefreshLeftArrowIcon as Fa,NotificationIcon as Ia,UserIcon as Aa,ImageErrorIcon as Ma,OverviewIcon as Ra,InstrumentationRuleIcon as La,ActionIcon as Pa,SourceIcon as Ka,DestinationIcon as ja,SlackLogo as Va,KeyIcon as qa,TerminalIcon as za,ExclamationTriangleIcon as Ha,TraceViewIcon as Ba}from"./icons.js";import{MarkerType as Wa,useNodesState as _a,useEdgesState as Ua,applyNodeChanges as Ja}from"@xyflow/react";import"zustand";import"javascript-time-ago";import"./chunks/vendor-55cc654c.js";import"react-dom";import"prism-react-renderer";import"react-error-boundary";import"lottie-react";const Ga=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:$,samplingPercentage:C,endpointsFilters:S,servicesNameFilters:k,attributeFilters:w}}=e,T=[{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&&(T.push({title:"Collect Container Attributes",value:String(l)}),T.push({title:"Collect ReplicaSet Attributes",value:String(r)}),T.push({title:"Collect Workload ID",value:String(s)}),T.push({title:"Collect Cluster ID",value:String(c)}),d?.length&&T.push({type:h.Divider}),d?.forEach(({labelKey:e,attributeKey:t,from:a},i)=>{let n="";n+=`Label Key: ${e}\n`,n+=`Attribute Key: ${t}\n`,n+=`From: ${a||y.Pod}\n`,T.push({title:"Label"+(d.length>1?` #${i+1}`:""),value:n})}),u?.length&&T.push({type:h.Divider}),u?.forEach(({annotationKey:e,attributeKey:t,from:a},i)=>{let n="";n+=`Annotation Key: ${e}\n`,n+=`Attribute Key: ${t}\n`,n+=`From: ${a||y.Pod}\n`,T.push({title:"Annotation"+(u.length>1?` #${i+1}`:""),value:n})})),t===g.AddClusterInfo){T.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+=", ")}),T.push({title:"Attributes",value:e})}if(t===g.DeleteAttributes){let e="";b?.forEach((t,a)=>{e+=t,a<b.length-1&&(e+=", ")}),T.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+=", ")}),T.push({title:"Attributes",value:e})}if(t===g.PiiMasking){let e="";x?.forEach((t,a)=>{e+=t,a<x.length-1&&(e+=", ")}),T.push({title:"Categories",value:e})}return t===g.ErrorSampler&&T.push({title:"Sampling Ratio",value:String($)}),t===g.ProbabilisticSampler&&T.push({title:"Sampling Percentage",value:String(C)}),t===g.LatencySampler&&S?.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}`,T.push({title:"Endpoint"+(S.length>1?` #${n+1}`:""),value:o})}),t===g.ServiceNameSampler&&k?.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}`,T.push({title:"Filter"+(k.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}`),T.push({title:"Filter"+(w.length>1?` #${n+1}`:""),value:o})}),T},Ya=x.PiiCategories,Xa=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
|
-
`,Xa=[{id:"CREDIT_CARD",label:"Credit Card"}],Za=f.FallbackSamplingRatio,Qa=[{value:g.Pod,id:g.Pod},{value:g.Namespace,id:g.Namespace}],ei=[{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",keyName:"from",placeholder:Qa[0].value,componentType:"dropdown",options:Qa,required:!1}],ti=[{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",keyName:"from",placeholder:Qa[0].value,componentType:"dropdown",options:Qa,required:!1}],ai=f.EndpointsFilters,ii=[{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}],ni=f.AttributeNamesToDelete,oi=f.Renames,li=f.ServicesNameFilters,ri=[{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}],si=f.SamplingPercentage,ci=f.AttributeFilters,di=[{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:D.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:D.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}],ui={[h.K8sAttributes]:({value:t,setValue:i,formErrors:n})=>(a(()=>{t[f.CollectContainerAttributes]||t[f.CollectReplicaSetAttributes]||t[f.CollectWorkloadId]||t[f.CollectClusterId]||t[f.LabelsAttributes]?.length||t[f.AnnotationsAttributes]?.length||(i(f.CollectContainerAttributes,!0),i(f.CollectReplicaSetAttributes,!0),i(f.CollectWorkloadId,!0),i(f.CollectClusterId,!0),i(f.LabelsAttributes,[]),i(f.AnnotationsAttributes,[]))},[]),e.createElement(e.Fragment,null,e.createElement(v,{title:"Collect Container Attributes",value:t[f.CollectContainerAttributes]||!1,onChange:e=>i(f.CollectContainerAttributes,e),errorMessage:n[f.CollectContainerAttributes]}),e.createElement(v,{title:"Collect ReplicaSet Attributes",value:t[f.CollectReplicaSetAttributes]||!1,onChange:e=>i(f.CollectReplicaSetAttributes,e),errorMessage:n[f.CollectReplicaSetAttributes]}),e.createElement(v,{title:"Collect Workload ID",value:t[f.CollectWorkloadId]||!1,onChange:e=>i(f.CollectWorkloadId,e),errorMessage:n[f.CollectWorkloadId]}),e.createElement(v,{title:"Collect Cluster ID",value:t[f.CollectClusterId]||!1,onChange:e=>i(f.CollectClusterId,e),errorMessage:n[f.CollectClusterId]}),e.createElement(S,{columns:ei,value:t[f.LabelsAttributes]||[],onChange:e=>i(f.LabelsAttributes,e),errorMessage:n[f.LabelsAttributes]}),e.createElement(S,{columns:ti,value:t[f.AnnotationsAttributes]||[],onChange:e=>i(f.AnnotationsAttributes,e),errorMessage:n[f.AnnotationsAttributes]}))),[h.AddClusterInfo]:({value:t,setValue:a,formErrors:i})=>e.createElement(e.Fragment,null,e.createElement(k,{title:"Overwrite Existing Values",tooltip:"If enabled, the resource attributes will overwrite any existing attributes with the same name.",initialValue:t[f.OverwriteExistingValues]||!1,onChange:e=>a(f.OverwriteExistingValues,e)}),e.createElement(w,{title:"Resource Attributes",value:t[f.ClusterAttributes]?.map(e=>({key:e.attributeName,value:e.attributeStringValue}))||[],onChange:e=>a(f.ClusterAttributes,e.map(e=>({attributeName:e.key,attributeStringValue:e.value}))),required:!0,errorMessage:i[f.ClusterAttributes]})),[h.DeleteAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[ni],o=t[ni]||[];return e.createElement(T,{title:"Attributes to delete",value:o,onChange:e=>a(ni,e),required:!0,errorMessage:n})},[h.RenameAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[oi],o=Object.entries(t[oi]||{}).map(([e,t])=>({key:e,value:t}));return e.createElement(w,{title:"Attributes to rename",value:o,onChange:e=>{const t={};e.forEach(e=>t[e.key]=e.value),a(oi,t)},required:!0,errorMessage:n})},[h.PiiMasking]:({value:i,setValue:n,formErrors:o})=>{const l=o[Ga],r=i[Ga]||[],[s,c]=t(1===r.length);return a(()=>{if(!r.length){const e=Xa.map(({id:e})=>e);n(Ga,e),c(1===Xa.length)}},[]),e.createElement("div",null,e.createElement(y,{title:"Attributes to mask",required:!0}),e.createElement(Ya,{$hasError:!!l},Xa.map(({id:t,label:a})=>e.createElement(v,{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(Ga,a),c(1===a.length)})(t,e)}))),!!l&&e.createElement(b,null,l))},[h.ErrorSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[Za],o=t[Za];return e.createElement(x,{title:"Fallback sampling ratio",required:!0,type:$.Number,min:0,max:100,value:C(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(Za,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[h.ProbabilisticSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[si],o=t[si];return e.createElement(x,{title:"Sampling percentage",required:!0,type:$.Number,min:0,max:100,value:C(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(si,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[h.LatencySampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ai],o=t[ai]||[];return e.createElement(S,{columns:ii,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(ai,t)},errorMessage:n})},[h.ServiceNameSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[li],o=t[li]||[];return e.createElement(S,{columns:ri,value:o,onChange:e=>{const t=e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)}));a(li,t)},errorMessage:n})},[h.SpanAttributeSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ci],o=(t[ci]||[]).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(S,{columns:di,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(ci,t)},errorMessage:n,limitFieldsPerRow:3})}},pi=({actionType:t,value:a,setValue:i,formErrors:n})=>{if(!t)return null;const o=ui[t];return o?e.createElement(o,{value:a,setValue:i,formErrors:n}):null},mi=d.div`
|
|
10
|
+
`,Za=[{id:"CREDIT_CARD",label:"Credit Card"}],Qa=x.FallbackSamplingRatio,ei=[{value:y.Pod,id:y.Pod},{value:y.Namespace,id:y.Namespace}],ti=[{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",keyName:"from",placeholder:ei[0].value,componentType:"dropdown",options:ei,required:!1}],ai=[{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",keyName:"from",placeholder:ei[0].value,componentType:"dropdown",options:ei,required:!1}],ii=x.EndpointsFilters,ni=[{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:C.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:C.Number}],oi=x.AttributeNamesToDelete,li=x.Renames,ri=x.ServicesNameFilters,si=[{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:C.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:C.Number}],ci=x.SamplingPercentage,di=x.AttributeFilters,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:"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:C.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}],pi={[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(k,{columns:ti,value:t[x.LabelsAttributes]||[],onChange:e=>i(x.LabelsAttributes,e),errorMessage:n[x.LabelsAttributes]}),e.createElement(k,{columns:ai,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(T,{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[oi],o=t[oi]||[];return e.createElement(D,{title:"Attributes to delete",value:o,onChange:e=>a(oi,e),required:!0,errorMessage:n})},[g.RenameAttributes]:({value:t,setValue:a,formErrors:i})=>{const n=i[li],o=Object.entries(t[li]||{}).map(([e,t])=>({key:e,value:t}));return e.createElement(T,{title:"Attributes to rename",value:o,onChange:e=>{const t={};e.forEach(e=>t[e.key]=e.value),a(li,t)},required:!0,errorMessage:n})},[g.PiiMasking]:({value:i,setValue:n,formErrors:o})=>{const l=o[Ya],r=i[Ya]||[],[s,c]=t(1===r.length);return a(()=>{if(!r.length){const e=Za.map(({id:e})=>e);n(Ya,e),c(1===Za.length)}},[]),e.createElement("div",null,e.createElement(v,{title:"Attributes to mask",required:!0}),e.createElement(Xa,{$hasError:!!l},Za.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(Ya,a),c(1===a.length)})(t,e)}))),!!l&&e.createElement(f,null,l))},[g.ErrorSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[Qa],o=t[Qa];return e.createElement($,{title:"Fallback sampling ratio",required:!0,type:C.Number,min:0,max:100,value:S(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(Qa,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[g.ProbabilisticSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ci],o=t[ci];return e.createElement($,{title:"Sampling percentage",required:!0,type:C.Number,min:0,max:100,value:S(o)?"":String(o),onChange:({target:{value:e}})=>{return t=e,a(ci,Math.max(0,Math.min(Number(t),100))||0);var t},errorMessage:n})},[g.LatencySampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ii],o=t[ii]||[];return e.createElement(k,{columns:ni,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(ii,t)},errorMessage:n})},[g.ServiceNameSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[ri],o=t[ri]||[];return e.createElement(k,{columns:si,value:o,onChange:e=>{const t=e.map(({serviceName:e,samplingRatio:t,fallbackSamplingRatio:a})=>({serviceName:e,samplingRatio:Number(t),fallbackSamplingRatio:Number(a)}));a(ri,t)},errorMessage:n})},[g.SpanAttributeSampler]:({value:t,setValue:a,formErrors:i})=>{const n=i[di],o=(t[di]||[]).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(k,{columns:ui,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(di,t)},errorMessage:n,limitFieldsPerRow:3})}},mi=({actionType:t,value:a,setValue:i,formErrors:n})=>{if(!t)return null;const o=pi[t];return o?e.createElement(o,{value:a,setValue:i,formErrors:n}):null},hi=d.div`
|
|
11
11
|
display: flex;
|
|
12
12
|
flex-direction: column;
|
|
13
13
|
gap: 24px;
|
|
14
14
|
padding: 4px;
|
|
15
|
-
`,
|
|
15
|
+
`,gi=d(E)`
|
|
16
16
|
margin-bottom: 12px;
|
|
17
|
-
`,
|
|
17
|
+
`,yi=({isUpdate:t,action:a,formData:i,formErrors:n,handleFormChange:o})=>{const l=O.useTheme();return e.createElement(hi,null,t&&e.createElement("div",null,e.createElement(gi,null,"Status"),e.createElement(F,{options:[{icon:fa,label:m.ENABLED,value:!1,selectedBgColor:l.text.success+O.opacity.hex["050"]},{icon:xa,label:m.DISABLED,value:!0,selectedBgColor:l.text.error+O.opacity.hex["050"]}],selected:i.disabled,setSelected:e=>o("disabled",e)})),!t&&e.createElement(I,{title:"",description:a.docsDescription,actionButton:e.createElement(A,{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($,{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(mi,{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}))},vi=i(({children:a,width:i=640,title:r,titleTooltip:s,hideEditTitleFromEdit:c,icons:d,iconSrcs:u,isEdit:p=!1,isFormDirty:m=!1,isLastItem:h=!1,onClose:g,onEdit:y,onSave:v,onDelete:b,onCancel:f,tabs:x,headerActionButtons:$},C)=>{const S=O.useTheme(),{isThisPending:k}=L(),{addNotification:w}=P(),{drawerType:T,drawerEntityId:D,setDrawerType:N,setDrawerEntityId:F}=K();j({key:"Enter",active:p},()=>Q());const[I,A]=t(!1),[M,R]=t(!1),_=n(null),U=T===B.Source,J=()=>{A(!1),R(!1)},G=()=>{J(),y&&y(!1),N(null),F(null),g?.()};o(C,()=>({closeDrawer:G}));const Y=()=>{_.current?.clearTitle(),f&&f(),J()},X=()=>{const e=_.current?.isTitleDirty();m||e?R(!0):Y()},Z=()=>{A(!0)},Q=()=>{v&&v(_.current?.getTitle()||"")},ee=l(()=>!!T&&k({entityType:T,entityId:D}),[T,D]),te=e=>{w({type:W.Warning,title:"Pending",message:`Cannot click ${e}, ${T} is pending`,hideFromHistory:!0})},ae=$||[];return y&&!p&&ae.push({"data-id":"drawer-edit",variant:"tertiary",onClick:ee?()=>te("edit"):()=>y(!0),children:e.createElement(e.Fragment,null,e.createElement($a,null),e.createElement(E,{size:14,family:"secondary",decoration:"underline"},"Edit"))}),b&&!p&&ae.push({"data-id":"drawer-delete",variant:"tertiary",onClick:ee?()=>te(U?"uninstrument":"delete"):Z,children:e.createElement(e.Fragment,null,e.createElement(Ca,null),e.createElement(E,{color:S.text.error,size:14,family:"secondary",decoration:"underline"},U?V.UNINSTRUMENT:V.DELETE))}),e.createElement(e.Fragment,null,e.createElement(q,{isOpen:!0,onClose:p?X:G,closeOnEscape:!I&&!M,width:`${i+64}px`,header:{icons:d,iconSrcs:u,title:r,titleTooltip:s,replaceTitleWith:!c&&p?e.createElement(bi,{ref:_,title:r}):void 0,actionButtons:ae,tabs:x},footer:{isOpen:p,leftButtons:[{"data-id":"drawer-save",variant:"primary",onClick:Q,children:V.SAVE},{"data-id":"drawer-cancel",variant:"secondary",onClick:X,children:V.CANCEL}],rightButtons:b?[{"data-id":"drawer-delete",variant:"tertiary",onClick:Z,children:e.createElement(e.Fragment,null,e.createElement(Ca,null),e.createElement(E,{size:14,color:S.text.error,family:"secondary",decoration:"underline"},V.DELETE))}]:[]}},a),e.createElement(z,{isOpen:I,noOverlay:!0,name:`${T}${r?` (${r})`:""}`,type:T,isLastItem:h,onApprove:()=>{b&&b(),J()},onDeny:J}),e.createElement(H,{isOpen:M,noOverlay:!0,name:"edit mode",onApprove:Y,onDeny:J}))}),bi=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($,{"data-id":"title",value:l,onChange:e=>r(e.target.value)})});bi.displayName=bi.name,vi.displayName=vi.name;const fi=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
|
+
`,xi=d.div`
|
|
24
24
|
display: flex;
|
|
25
25
|
flex-direction: column;
|
|
26
26
|
gap: 12px;
|
|
27
|
-
|
|
27
|
+
`,$i=({updateAction:a,deleteAction:i})=>{const{actions:o}=_(),{drawerType:r,drawerEntityId:s}=K(),c=n(null),d=r!==B.Action,[u,p]=t(!1),[h,g]=t(!1),{formData:y,formErrors:v,handleFormChange:b,resetFormData:f,validateForm:x,loadFormWithDrawerItem:$}=U(),C=l(()=>{if(d)return f();const e=o?.find(e=>e.id===s);return e?$(e):f(),e},[d,s,o]);if(!C)return null;const S=J.find(({type:e})=>e===C.type)||J.find(({label:e})=>"Attributes"===e)?.items?.find(({type:e})=>e===C.type)||J.find(({label:e})=>"Samplers"===e)?.items?.find(({type:e})=>e===C.type);return e.createElement(vi,{ref:c,title:C.name||C.type,icons:[G(C.type)],isEdit:u,isFormDirty:h,onEdit:e=>{p("boolean"!=typeof e||e)},onSave:e=>{if(x({withAlert:!0,alertTitle:Z.Update})){const t=e!==C.type?e:"";b("name",t),a(s,{...y,name:t}),p(!1),g(!1)}},onDelete:()=>{i(s,C.type),p(!1),g(!1),c.current?.closeDrawer()},onCancel:()=>{p(!1),g(!1),$(C)}},u&&S?e.createElement(fi,null,e.createElement(yi,{isUpdate:!0,action:S,formData:y,formErrors:v,handleFormChange:(...e)=>{g(!0),b(...e)}})):e.createElement(xi,null,e.createElement(Y,{conditions:C.conditions||[]}),e.createElement(X,{title:m.ACTION_DETAILS,data:C?Ga(C):[]})))},Ci=d(Q)`
|
|
28
28
|
margin-top: 24px;
|
|
29
29
|
gap: 12px;
|
|
30
|
-
`,
|
|
30
|
+
`,Si=({createAction:a})=>{const{currentModal:i,setCurrentModal:n}=ee(),o=i===B.Action,{formData:l,formErrors:r,handleFormChange:s,resetFormData:c,validateForm:d}=U(),[u,p]=t(void 0),h=()=>{c(),p(void 0),n("")},g=()=>{if(!d({withAlert:!0,alertTitle:Z.Create}))return null;a(l),h()};return j({key:"Enter",active:o},()=>g()),e.createElement(te,{isOpen:o,onClose:h,header:{title:"Add Action"},actionComponent:e.createElement(ae,{buttons:[{variant:"primary",label:"DONE",onClick:g,disabled:!u}]})},e.createElement(ie,null,e.createElement(I,{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(Ci,null,e.createElement(ne,{type:W.Warning,message:oe.DEFINED_FOR_ALL_STREAMS(m.ACTIONS)}),e.createElement(le,{options:J,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(re,{margin:"16px 0"}),e.createElement(yi,{action:u,formData:l,formErrors:r,handleFormChange:s})):null))},ki=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},i)=>{x+=`Label: ${e} ${t} ${a||y.Pod} `,i===l.length-1&&(x+=", ")}),r?.forEach(({annotationKey:e,attributeKey:t,from:a},i)=>{x+=`Annotation: ${e} ${t} ${a||y.Pod} `,i===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},wi=({conditions:t,id:a})=>{const{errors:i,warnings:n,disableds:o,hasLoadings:r}=l(()=>se(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(Ti,{conditions:s,id:a}));const c=r?me.Loading:W.Success;return e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:c,title:c,withBorder:!0,withIcon:!0}))},Ti=({conditions:t,id:a})=>{const i=O.useTheme();return e.createElement(de,null,ue(t).map(({status:t,type:n,reason:o,message:l,lastTransitionTime:r},s)=>{"loading"!==t&&"disabled"!==t||(t=W.Info);const c=he(t,i);return e.createElement(pe,{key:`condition-${a}-${t}-${n}-${s}`,titleIcon:c,title:n,text:l||o||"",timestamp:r},e.createElement(ce,{status:t,title:o||n,withBorder:!0,withIcon:!0}))}))},Di=({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:B.Source,label:"Sources",count:r.length,entities:[]},{category:B.Action,label:"Actions",count:s.length,entities:[]},{category:B.Destination,label:"Destinations",count:c.length,entities:[]},{category:B.InstrumentationRule,label:"Instrumentation Rules",count:l.length,entities:[]}];d.unshift({category:"all",label:"All",count:l.length+r.length+s.length+c.length,entities:[]});const u=d.filter(({count:e,category:t})=>!!e&&"all"!==t&&["all",t].includes(o)).map(e=>({...e,entities:e.category===B.InstrumentationRule?l:e.category===B.Source?r:e.category===B.Action?s:e.category===B.Destination?c:[]}));return{categories:d,searchResults:u}},Ni=[{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}],Ei=({maxHeight:t,maxWidth:a})=>{const i=O.useTheme(),n=ge(),{actions:o,actionsLoading:r}=_(),{setDrawerType:s,setDrawerEntityId:c}=K(),d=l(()=>Di({instrumentationRules:[],sources:[],actions:ye(o,n),destinations:[],searchText:n.searchText,selectedCategory:B.Action}).searchResults.find(({category:e})=>e===B.Action)?.entities||[],[o,n]),u=l(()=>d.map(t=>{const{hasErrors:a,hasWarnings:n,hasDisableds:o}=se(t.conditions||[]);return{status:a?W.Error:n?W.Warning:void 0,faded:o,onClick:()=>{s(B.Action),c(t.id)},cells:[{columnKey:"icon",component:()=>e.createElement(ve,{icon:G(t.type)})},{columnKey:"name",value:be(t,B.Action,{prioritizeDisplayName:!0})},{columnKey:"type",value:t.type,textColor:i.text.info},{columnKey:"notes",value:t.notes,textColor:i.text.info,withTooltip:!0},{columnKey:"spec",value:ki(t),textColor:i.text.info,withTooltip:!0},{columnKey:"signals",component:()=>e.createElement(fe,{withLabels:!0,monitors:t.signals||[]})},{columnKey:"conditions",component:()=>e.createElement(wi,{conditions:t.conditions||[],id:t.id})},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:t.disabled?W.Error:W.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(xe,{$maxWidth:a},e.createElement($e,null,e.createElement(Ce,{icon:Se(B.Action),title:m.ACTIONS,badge:p,badgeTooltip:h,loading:r})),e.createElement(ke,{$maxHeight:t},e.createElement(we,{columns:Ni,rows:u})),!d.length&&e.createElement(Te,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Oi=d(Q)`
|
|
31
31
|
// width: 100vw;
|
|
32
32
|
// height: 100vh;
|
|
33
33
|
gap: 64px;
|
|
34
34
|
align-items: center;
|
|
35
35
|
justify-content: center;
|
|
36
|
-
`,
|
|
36
|
+
`,Fi=d(Q)`
|
|
37
37
|
max-width: 400px;
|
|
38
38
|
gap: 12px;
|
|
39
39
|
align-items: center;
|
|
40
40
|
justify-content: center;
|
|
41
|
-
`,
|
|
41
|
+
`,Ii=d(E)`
|
|
42
42
|
text-align: center;
|
|
43
43
|
font-size: 24px;
|
|
44
|
-
`,
|
|
44
|
+
`,Ai=d(E)`
|
|
45
45
|
text-align: center;
|
|
46
46
|
line-height: 26px;
|
|
47
47
|
color: ${({theme:e})=>e.text.info};
|
|
48
|
-
`,
|
|
48
|
+
`,Mi=()=>{const[i,n]=t(0);return a(()=>{(async()=>{for(let e=0;e<=100;e+=5)await Oe(500),n(e)})()},[]),e.createElement(Oi,null,e.createElement(Sa,{size:100}),e.createElement(Ne,{width:400}),e.createElement(Fi,null,e.createElement(de,{$gap:16},e.createElement(Ii,null,"Preparing your workspace..."),e.createElement(Ee,{label:`${i}%`})),e.createElement(Ai,null,"It can take up to a few minutes. Grab a cup of coffee, look out a window, and enjoy your free moment!")))},Ri=d(Q)`
|
|
49
49
|
align-items: center !important;
|
|
50
50
|
justify-content: center !important;
|
|
51
51
|
align-self: stretch;
|
|
@@ -61,9 +61,9 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
61
61
|
cursor: pointer;
|
|
62
62
|
|
|
63
63
|
&:hover {
|
|
64
|
-
background-color: ${({theme:e})=>e.colors.dropdown_bg_2+
|
|
64
|
+
background-color: ${({theme:e})=>e.colors.dropdown_bg_2+O.opacity.hex["030"]};
|
|
65
65
|
}
|
|
66
|
-
`,
|
|
66
|
+
`,Li=({entityType:t,description:a})=>{const{setCurrentModal:i}=ee(),{isThisPending:n}=L(),o=n({entityType:t});return e.createElement(Ri,{onClick:()=>i(t)},e.createElement(de,{$gap:4},e.createElement(ka,null),o?e.createElement(Fe,{size:14,weight:600,family:"secondary"},"Adding ",t):e.createElement(E,{size:14,weight:600,family:"secondary",decoration:"underline"},"Add ",t)),e.createElement(E,{size:12,align:"center"},o?"Just a few more seconds...":a))},Pi=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
|
+
`,Ki=d(de)`
|
|
75
75
|
margin-left: ${({$marginLeft:e})=>e};
|
|
76
|
-
`,
|
|
76
|
+
`,ji=d(Ie)`
|
|
77
77
|
width: 24px;
|
|
78
78
|
height: 24px;
|
|
79
79
|
padding: 0;
|
|
80
|
-
`,
|
|
80
|
+
`,Vi=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
|
+
`,qi=({entityType:t,badge:a,badgeTooltip:i,isLoading:n})=>{const o=O.useTheme(),{sources:r}=_(),{isThisPending:s}=L(),{setCurrentModal:c}=ee(),{selectedSources:d,setSelectedSources:u}=Ae(),{isAwaitingInstrumentation:p,sourcesToCreate:m,sourcesCreated:h,sourcesToDelete:g,sourcesDeleted:y}=Me(),v=Se(t),f=t===B.Source&&p,x=(m?Math.floor(100/m*h):g?Math.floor(100/g*y):0)||1,[$,C]=l(()=>{let e=0;return Object.values(d).forEach(t=>e+=t.length),[0!==e,e]},[d]);return e.createElement(Pi,null,t===B.Source&&e.createElement(Ki,{$marginLeft:"28px"},e.createElement(b,{partiallyChecked:$&&r?.length!==C,value:$&&r?.length===C,onChange:e=>{if(e){const e={};r?.forEach(t=>{const a={namespace:t.namespace,name:t.name,kind:t.kind};s({entityType:B.Source,entityId:a})||(e[t.namespace]?e[t.namespace].push(t):e[t.namespace]=[t])}),u(e)}else u({})},disabled:!r?.length})),e.createElement(Ki,{$marginLeft:t===B.Source?"0":"28px"},e.createElement(Ce,{icon:v,title:`${t}s`,badge:f?`${x}%`:a,badgeTooltip:i,loading:n&&!f})),e.createElement(Ki,{$marginLeft:"auto"},e.createElement(ji,{"data-id":`add-${t}`,variant:"primary",onClick:()=>c(t)},e.createElement(ka,{fill:o.colors.primary,size:18}))),f&&e.createElement(Vi,{percent:x}))},zi=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
|
+
`,Hi=({entityId:t,entityType:a,status:i,faded:n,title:o,subTitle:l,label:r,icon:s,icons:c,iconSrc:d,iconSrcs:u,monitors:p,isActive:m,raw:h})=>{const g=O.useTheme(),y=a===B.Source,v="boolean"==typeof m,{setDrawerType:b,setDrawerEntityId:f}=K(),{isThisPending:x}=L(),$=x({entityType:a,entityId:t}),{selectedSources:C,setSelectedSources:S}=Ae(),k={...C},{namespace:w,name:T,kind:D}=h;y&&!k[w]&&(k[w]=[]);const N=y?k[w].findIndex(e=>e.name===T&&e.kind===D):-1;return e.createElement(Re,{"data-id":a===B.Source?`${t.namespace}-${t.name}-${t.kind}`:t,title:o,subTitle:l,onClick:()=>{b(a),f(t)},renderActions:()=>{const t=y&&(!h.conditions?.length||h.conditions?.some(({status:e})=>"loading"===e)),a=v&&!m?he(W.Info,g):i?he(i,g):void 0,n=$||t?e.createElement(Le,{scale:.8}):a?e.createElement(a,{size:14}):null;return r?e.createElement(zi,{$isError:i===W.Error},e.createElement(pe,{text:"Heads up! The data-flow metrics you see are calculated over 10-second intervals."},r),n):n||null},iconProps:{icon:s,icons:c,iconSrc:d,iconSrcs:u},visualProps:{status:i,faded:n||v&&!m,monitors:p||void 0},checkboxProps:{withCheckbox:y,isChecked:-1!==N,onCheckboxChange:()=>{-1===N?k[w].push(h):k[w].splice(N,1),S(k)},isCheckboxDisabled:$}})},Bi=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
|
+
`,Wi=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
|
+
`,_i=({height:t,entityType:a,entities:i,metrics:n,isVm:o})=>{const r=l(()=>i.map(t=>{const i=Pe(t);if(!i)return null;const l=[B.Source,B.Destination].includes(a),r=[B.Destination,B.Action].includes(a),s=[B.Destination,B.Action,B.InstrumentationRule].includes(a),c=r?a==B.Destination?Ke(t.exportedSignals):t.signals:void 0,d=l?n?.[`${a.toLowerCase()}s`]?.find(e=>JSON.stringify(Pe(e))===JSON.stringify(i)):void 0,u=s?!t.disabled:void 0,p=be(t,a,{extended:a===B.Source,prioritizeDisplayName:a!==B.Source}),m=((e,t,a)=>{switch(e){case B.Source:return a?`${t.kind}`:`${t.namespace} • ${t.kind}`;case B.Destination:return t.destinationType.displayName;case B.Action:case B.InstrumentationRule:return t.type;default:return""}})(a,t,o),h=l?je(d?.throughput):void 0,{priorotizedStatus:g,hasDisableds:y}=se(t.conditions||[]),{icons:v,icon:b,iconSrc:f}=((e,t)=>{switch(e){case B.Source:return{icons:He(t.containers),icon:Se(e)};case B.Destination:return ze(t.destinationType.type);case B.Action:return{icon:G(t.type)};case B.InstrumentationRule:return{icon:qe(t.type)};default:return{icon:Se(e)}}})(a,t);return e.createElement(Hi,{key:JSON.stringify(i),entityType:a,entityId:i,raw:t,title:p,subTitle:m,faded:y,status:g,label:h,icons:v,icon:b,iconSrc:f,monitors:c,isActive:u})}),[i,a,n,o]);return e.createElement(Bi,{$height:t},e.createElement(Ve,{containerHeight:t-24,elementHeight:80,elements:r}),e.createElement(Wi,{$hide:!0}))},Ui=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
|
+
`,Ji=({entityType:t,entities:a,unfilteredCount:i,metrics:n,loading:o,maxHeight:l,isVm:r})=>{const s=a.length!==i,c=Math.min(l,80*a.length+12);return r&&[B.InstrumentationRule,B.Action].includes(t)?null:e.createElement(Ui,{$isVm:r},e.createElement(qi,{entityType:t,badge:s?`${a.length}/${i}`:i,badgeTooltip:s?m.FILTERED_COUNT_TOOLTIP:void 0,isLoading:o}),a.length?e.createElement(_i,{height:c,entityType:t,entities:a,metrics:n,isVm:r}):o?e.createElement(Be,{size:3}):e.createElement(Li,{entityType:t,description:m.TO_COLLECT_OTEL_DATA}))},Gi=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
|
+
`,Yi=({height:i,metrics:n})=>{const{isVm:o}=We(),l=ge(),{selectedStreamName:r}=_e(),{containerRef:s,containerHeight:c}=Ue(),{sources:d,sourcesLoading:u,destinations:p,destinationsLoading:m,actions:h,actionsLoading:g,instrumentationRules:y,instrumentationRulesLoading:v}=_(),[b,f]=t([]),[x,$]=t([]),[C,S]=t([]),[k,w]=t([]);return a(()=>{f(Je(Ge(d,r),l))},[d,r,l]),a(()=>{$(Ye(Xe(p,r),l))},[p,r,l]),a(()=>{S(ye(h,l))},[h,l]),a(()=>{w(y)},[y]),e.createElement(Gi,{ref:s,$height:i},e.createElement(Ji,{entityType:B.InstrumentationRule,entities:k,unfilteredCount:y.length,loading:v,maxHeight:c,isVm:o}),e.createElement(Ji,{entityType:B.Source,entities:b,unfilteredCount:d.length,metrics:n,loading:u,maxHeight:c,isVm:o}),e.createElement(Ji,{entityType:B.Action,entities:C,unfilteredCount:h.length,loading:g,maxHeight:c,isVm:o}),e.createElement(Ji,{entityType:B.Destination,entities:x,unfilteredCount:p.length,metrics:n,loading:m,maxHeight:c,isVm:o}))},Xi=d.div`
|
|
141
141
|
position: relative;
|
|
142
142
|
max-width: 200px;
|
|
143
143
|
`;d.div`
|
|
@@ -151,65 +151,65 @@ 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 Zi=d.div`
|
|
155
155
|
display: flex;
|
|
156
156
|
align-items: center;
|
|
157
157
|
overflow-x: scroll;
|
|
158
|
-
`,
|
|
158
|
+
`,Qi=({onClose:i})=>{const n=O.useTheme(),{onClickNode:o}=Ze(),{searchText:s}=ge(),{selectedStreamName:c}=_e(),{sources:d,destinations:u,actions:p,instrumentationRules:m}=_(),{popupRef:h,popupOpen:g,setPopupOpen:y,popupPosition:v,handlePosition:b}=Qe();a(()=>{g||(b(0,50),y(!0))},[g]);const[f,x]=t("all"),{categories:$,searchResults:C}=l(()=>Di({instrumentationRules:m,sources:Ge(d,c),actions:p,destinations:Xe(u,c),searchText:s,selectedCategory:f}),[m,d,p,u,c,s,f]);return C.length?e.createElement(et,{ref:h,isOpen:g,top:v.top,left:v.left,maxWidth:"420px",header:e.createElement(Zi,null,$.map(({category:t,label:a,count:i})=>!!i&&e.createElement(tt,{key:`category-select-${t}`,label:a,badgeLabel:i,isSelected:f===t,onClick:()=>x(t)})))},C.map(({category:t,label:a,entities:l},s)=>!!l.length&&e.createElement(r,{key:`category-list-${t}`},e.createElement(at,{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(tt,{key:`entity-${s}-${n}`,icon:Se(t),label:be(a,t,{extended:!0}),onClick:()=>{const e=Pe(a);o(null,{data:{type:t,id:e}}),i()},style:{width:"100%",justifyContent:"flex-start"},color:"transparent"}))),e.createElement(re,{thickness:s===C.length-1?0:1,length:"90%",margin:"8px auto"})))):e.createElement(et,{ref:h,isOpen:g,top:v.top,left:v.left},e.createElement(De,null))},en=({preventPopup:a=!1})=>{const{searchText:i,setSearchText:o}=ge(),[l,r]=t(!1),s=!!i||l,c=()=>{o(""),r(!1)},d=n(null);return it(d,c),j({key:"Escape",active:s},c),e.createElement(Xi,{ref:d},e.createElement($,{placeholder:"Search",icon:wa,value:i,onChange:e=>o(e.target.value.toLowerCase()),onFocus:()=>r(!0)}),s&&!a?e.createElement(Qi,{onClose:c}):null)},tn=({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:`${nt(t)} - ${nt(a)}`})})}),e.sort((e,t)=>e.id?.localeCompare(t.id||"")||0)},[t]);return e.createElement(ot,{disabled:!s?.length,title:a,placeholder:"All",options:s,value:i,onSelect:n,onDeselect:o,...r})},an=({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})=>{ue(t||[]).forEach(({status:t,message:a,reason:i})=>{t!==W.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(ot,{disabled:r||!c?.length,title:a,placeholder:"All",options:c,value:i,onSelect:n,onDeselect:o,...s})},nn=({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:lt[t]||t})})}),e.sort((e,t)=>e.id?.localeCompare(t.id||"")||0)},[t]);return e.createElement(ot,{disabled:!s?.length,title:a,placeholder:"All",options:s,value:i,onSelect:n,onDeselect:o,...r})},on=({title:t="Monitors",value:a,onSelect:i,onDeselect:n,...o})=>{const r=l(()=>{const e=[];return rt.forEach(({id:t,value:a})=>{e.find(e=>e.id===t)||e.push({id:t,value:a})}),e},[]);return e.createElement(ot,{disabled:!r?.length,title:t,placeholder:"All",options:r,value:a,onSelect:i,onDeselect:n,...o})},ln=({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(ot,{disabled:!s?.length,title:a,placeholder:"Select namespace",options:s,value:i,onSelect:n,onDeselect:o,...r})},rn=({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(ot,{disabled:!s?.length,title:a,placeholder:"All",options:s,value:i,onSelect:n,onDeselect:o,...r})},sn=d.div`
|
|
159
159
|
display: flex;
|
|
160
160
|
flex-direction: column;
|
|
161
161
|
gap: 12px;
|
|
162
162
|
padding: 12px;
|
|
163
|
-
`,
|
|
163
|
+
`,cn=d.div`
|
|
164
164
|
padding: 12px 6px 6px 6px;
|
|
165
|
-
`,
|
|
165
|
+
`,dn=d(Ie)`
|
|
166
166
|
font-size: 14px;
|
|
167
167
|
${({$color:e})=>`color: ${e};`}
|
|
168
|
-
`,
|
|
168
|
+
`,un=d.div`
|
|
169
169
|
margin-left: auto;
|
|
170
|
-
`,
|
|
170
|
+
`,pn=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},mn=()=>{const i=O.useTheme(),{isVm:o}=We(),{namespaces:r,sources:s}=_(),{selectedStreamName:c}=_e(),{getItemSS:d,setItemSS:u,removeItemSS:p}=ct(),{popupRef:m,popupOpen:h,setPopupOpen:g,popupPosition:y,handlePosition:v}=Qe(),{namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:k,setAll:T,clearAll:D,getEmptyState:N}=ge(),E=l(()=>Ge(s,c),[s,c]),[F,I]=t({namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:k}),[A,M]=t(pn(F));a(()=>{const e=d(st.OVERVIEW_FILTERS,N());T(e)},[]),a(()=>{if(!h){const e={namespaces:b,kinds:f,monitors:x,languages:$,conditions:C,errors:S,onlyErrors:k};I(e),M(pn(e))}},[h,b,f,x,$,C,S,k]);const R=()=>{g(!1)},L=n(null);return it(L,R),j({key:"Escape",active:h},R),e.createElement(Xi,{ref:L},e.createElement(tt,{label:"Filters",icon:Ta,badgeLabel:A,badgeFilled:!!A,withBorder:!0,color:"transparent",onClick:()=>{v(0,50),g(!0)}}),e.createElement(et,{ref:m,isOpen:h,top:y.top,left:y.left,width:"420px",footer:e.createElement(de,null,e.createElement(dn,{variant:"primary",onClick:()=>{u(st.OVERVIEW_FILTERS,F),T(F),M(pn(F)),g(!1)}},"Apply"),e.createElement(dn,{variant:"secondary",onClick:R},"Cancel"),e.createElement(un,null,e.createElement(dn,{variant:"tertiary",onClick:()=>{p(st.OVERVIEW_FILTERS),D(),I(N()),M(0),g(!1)},$color:i.text.error},"Reset")))},e.createElement(sn,null,!o&&e.createElement(ln,{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(rn,{sources:E,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(nn,{sources:E,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(on,{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(tn,{sources:E,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(cn,null,e.createElement(w,{title:"Show only sources with errors",initialValue:F.onlyErrors,onChange:e=>I(t=>({...t,errors:[],onlyErrors:e}))})),e.createElement(an,{sources:E,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}))))},hn=d.div`
|
|
171
171
|
display: flex;
|
|
172
172
|
flex-direction: column;
|
|
173
173
|
gap: 24px;
|
|
174
174
|
padding: 4px;
|
|
175
|
-
`,
|
|
175
|
+
`,gn=({formData:t,handleFormChange:a,formErrors:i})=>{const{dataStreams:n,selectedStreamName:o}=_e(),r=l(()=>n.find(e=>e.name===t.name&&e.name!==o),[n,t.name,o]);return e.createElement(hn,null,e.createElement($,{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(ne,{type:W.Warning,message:m.DATA_STREAM_EXISTS_WARNING(o,r.name)}))},yn=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
|
+
`,vn=({isOpen:a,onClose:i,dataStreamName:o,updateDataStream:r})=>{const{dataStreams:c}=_e(),d=n(null),[u,p]=t(!1),{formData:m,handleFormChange:h,formErrors:g,validateForm:y,resetFormData:v,loadFormWithDrawerItem:b}=dt({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(vi,{ref:d,title:f.name,icons:[Da],hideEditTitleFromEdit:!0,isEdit:!0,isFormDirty:u,onSave:()=>{y({withAlert:!0,alertTitle:Z.Update})&&(r(o,m),p(!1),i())},onCancel:()=>{v(),p(!1),i()}},e.createElement(yn,null,e.createElement(gn,{formData:m,handleFormChange:x,formErrors:g}))):null},bn=d.div`
|
|
182
182
|
position: relative;
|
|
183
|
-
`,
|
|
183
|
+
`,fn=d(de)`
|
|
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
|
+
`,xn=d(E)`
|
|
191
191
|
text-wrap: nowrap;
|
|
192
|
-
|
|
192
|
+
`,$n=d(at)`
|
|
193
193
|
max-height: 240px;
|
|
194
194
|
padding: 0px !important;
|
|
195
|
-
|
|
195
|
+
`,Cn=d(de)`
|
|
196
196
|
width: 100%;
|
|
197
|
-
`,
|
|
197
|
+
`,Sn=d.div`
|
|
198
198
|
width: 100%;
|
|
199
|
-
`,
|
|
199
|
+
`,kn=({onClickNewDataStream:a,updateDataStream:i,deleteDataStream:n})=>{const o=O.useTheme(),{clearStore:r}=ut(),{popupRef:s,popupOpen:c,setPopupOpen:d,popupPosition:u,handlePosition:p}=Qe(),{dataStreams:m,selectedStreamName:h,setSelectedStreamName:g}=_e(),[y,v]=t(""),[b,f]=t(""),[x,C]=t(""),S=l(()=>m.filter(({name:e})=>!x||e.toLowerCase().includes(x.toLowerCase())).map(({name:t})=>e.createElement(Cn,{key:`stream-${t}`},e.createElement(Sn,null,e.createElement(tt,{label:t,isSelected:h===t,onClick:()=>{r(),g(t),d(!1)},color:"transparent",style:{width:"100%",justifyContent:"flex-start"}})),t!==pt&&e.createElement(mt,{onClick:()=>f(t),tooltip:V.DELETE},e.createElement(Ca,null)),e.createElement(mt,{onClick:()=>v(t),tooltip:V.EDIT},e.createElement($a,null)))),[m,h,x]);return e.createElement(e.Fragment,null,e.createElement(bn,null,e.createElement(fn,{$gap:0},e.createElement(Ie,{variant:"tertiary",onClick:()=>{p(0,50),d(e=>!e)}},e.createElement(Da,{fill:o.text.info}),e.createElement(xn,null,"Data Stream: ",h),e.createElement(ht,{extend:c}),e.createElement(Ee,{label:m.length})),e.createElement(re,{orientation:"vertical",length:"32px",thickness:2,margin:"0"}),e.createElement(gt,{onClick:()=>{r(),a()},label:V.NEW})),e.createElement(et,{ref:s,isOpen:c,top:u.top,left:u.left,header:e.createElement($,{placeholder:"Search...",icon:wa,value:x,onChange:e=>C(e.target.value)})},e.createElement($n,null,S))),e.createElement(z,{isOpen:""!==b,name:b,onApprove:()=>{n(b),f("")},onDeny:()=>{f("")}}),e.createElement(vn,{isOpen:""!==y,onClose:()=>{v("")},dataStreamName:y,updateDataStream:i}))},wn=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
|
+
`,Tn=d.div`
|
|
206
206
|
margin-left: auto;
|
|
207
|
-
`,
|
|
207
|
+
`,Dn=({addEntity:t,preventSearchPopup:a,onClickNewDataStream:i,updateDataStream:n,deleteDataStream:o})=>{const{setCurrentModal:l}=ee();return e.createElement(wn,null,e.createElement(kn,{onClickNewDataStream:i,updateDataStream:n,deleteDataStream:o}),e.createElement(en,{preventPopup:a}),e.createElement(mn,null),t&&e.createElement(Tn,null,e.createElement(gt,{"data-id":`add-${t}`,onClick:()=>l(t),label:`${V.ADD} ${nt(t)}`,variant:"primary",textProps:{weight:900}})))},Nn=i(({isModal:t,onClickSummary:a},i)=>{const{selectedStreamName:n}=_e(),{formData:l,handleFormChange:r,formErrors:s,validateForm:c}=dt({name:n});return o(i,()=>({validateForm:c,getFormValues:()=>l})),e.createElement(ie,{$isNotModal:!t},e.createElement(Q,{$gap:24},a&&e.createElement(yt,{onClick:a}),e.createElement(I,{title:m.NAME_YOUR_STREAM,description:m.STREAM_DESCRIPTION}),e.createElement(gn,{formData:l,handleFormChange:r,formErrors:s})))});Nn.displayName=Nn.name;const En=({createDataStream:t})=>{const{currentModal:a,setCurrentModal:i}=ee(),{addDataStreams:o,setSelectedStreamName:l}=_e(),r=a===vt.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 j({key:"Enter",active:r},c),e.createElement(te,{isOpen:r,onClose:s,header:{title:"Add Data Stream"},actionComponent:e.createElement(ae,{buttons:[{label:"DONE",variant:"primary",onClick:c}]})},e.createElement(Nn,{ref:d,isModal:!0}))},On=e=>Object.keys(e).filter(t=>e[t]).join(", "),Fn=(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:On(n)},{title:m.NAME,value:a.displayName}],l=bt(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||!ft(c,Ke(n),r)){const{type:e}=xt(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},In=({signals:t,fields:a,onChange:i,formErrors:n})=>a?.map(o=>{const{componentType:l,renderCondition:r,...s}=o;if(r&&!ft(r,t,a))return null;switch(l){case N.Input:return e.createElement($,{key:o.name,...s,onChange:e=>i(o.name,e.target.value),errorMessage:n[o.name]});case N.Dropdown:return e.createElement(ot,{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(D,{key:o.name,...s,value:"string"==typeof s.value?xt(s.value,[]):s.value,onChange:e=>i(o.name,JSON.stringify(e)),errorMessage:n[o.name]});case N.KeyValuePair:return e.createElement(T,{key:o.name,...s,value:"string"==typeof s.value?xt(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}}),An=d(Ie)`
|
|
208
208
|
display: flex;
|
|
209
209
|
align-items: center;
|
|
210
210
|
gap: 8px;
|
|
211
211
|
|
|
212
|
-
${({$status:e,theme:t})=>e===
|
|
212
|
+
${({$status:e,theme:t})=>e===W.Success?u`
|
|
213
213
|
border-color: transparent;
|
|
214
214
|
background-color: ${t.colors.success};
|
|
215
215
|
`:"error"===e?u`
|
|
@@ -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
|
+
`,Mn=({destination:a,validateForm:i,status:n,testConnection:o,onSuccess:l,onError:r})=>{const s=O.useTheme(),{selectedStreamName:c}=_e(),[d,u]=t(!1),p=n?he(n,s):void 0;return e.createElement(An,{$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(Le,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===W.Success?"Connection OK":"error"===n?"Connection Failed":"Test Connection"))},Rn=d(Q)`
|
|
222
222
|
align-items: unset;
|
|
223
223
|
padding: 0 4px;
|
|
224
|
-
`,
|
|
224
|
+
`,Ln=d.div`
|
|
225
225
|
display: flex;
|
|
226
226
|
flex-direction: column;
|
|
227
227
|
gap: 12px;
|
|
228
|
-
`,
|
|
228
|
+
`,Pn=d(de)`
|
|
229
229
|
justify-content: space-between;
|
|
230
|
-
`,
|
|
230
|
+
`,Kn=d(E)`
|
|
231
231
|
margin-bottom: 12px;
|
|
232
|
-
`,
|
|
232
|
+
`,jn=({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,C]=t(!1),[S,k]=t(!1),[w,T]=t(void 0),D=n(!1);a(()=>{if(u.length&&!D.current){D.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}}C(e)}},[u,S]);const N=l(()=>{const{logs:e,metrics:t,traces:a}=v||{},i=[];return e?.supported&&i.push($t.Logs),t?.supported&&i.push($t.Metrics),a?.supported&&i.push($t.Traces),i},[v]),E=l(()=>{const{logs:e,metrics:t,traces:a}=r.exportedSignals||{},i=[];return e&&i.push($t.Logs),t&&i.push($t.Metrics),a&&i.push($t.Traces),i},[r.exportedSignals]),R=()=>{C(!1),k(!0),T(void 0)};return e.createElement(Rn,{$gap:24},e.createElement(Rn,{$gap:12},e.createElement(I,{title:i?"Update destination":"Create destination",description:`Connect ${y} with Odigos.`,actionButton:b&&e.createElement(Mn,{destination:r,validateForm:c,status:w?.type,testConnection:h,onError:e=>{k(!1),T({type:W.Error,title:e?.reason||"Connection failed",message:e?.message||"Please check your input and try again."})},onSuccess:e=>{k(!1),T({type:W.Success,title:e?.reason||"Connection succeeded",message:e?.message||""})}})}),e.createElement(Ln,null,b&&w&&e.createElement(ne,{type:w.type,title:w.title,message:w.message}),x&&!w&&!i&&e.createElement(ne,{type:W.Default,message:`Odigos autocompleted ${y} destination details.`})),e.createElement(re,null)),e.createElement(Pn,null,e.createElement(M,{title:i?"":"This connection will monitor:",required:!0,allowedSignals:N,selectedSignals:E,setSelectedSignals:e=>{R(),d("exportedSignals",{logs:e.includes($t.Logs),metrics:e.includes($t.Metrics),traces:e.includes($t.Traces)})},errorMessage:s.exportedSignals}),!i&&e.createElement(A,{endpoint:`/backends/${g}`})),i&&e.createElement("div",null,e.createElement(Kn,null,"Status"),e.createElement(F,{options:[{icon:fa,label:m.ENABLED,value:!1,selectedBgColor:f.text.success+O.opacity.hex["050"]},{icon:xa,label:m.DISABLED,value:!0,selectedBgColor:f.text.error+O.opacity.hex["050"]}],selected:r.disabled,setSelected:e=>d("disabled",e)})),!i&&e.createElement($,{title:"Destination name",placeholder:"Enter destination name",value:r.name,onChange:e=>{R(),d("name",e.target.value)},errorMessage:s.name}),e.createElement(In,{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}))},Vn=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
|
+
`,qn=d.div`
|
|
239
239
|
display: flex;
|
|
240
240
|
flex-direction: column;
|
|
241
241
|
gap: 12px;
|
|
242
|
-
`,
|
|
242
|
+
`,zn=({categories:a,updateDestination:i,deleteDestination:o,testConnection:r})=>{const{destinations:s}=_(),{selectedStreamName:c}=_e(),{drawerType:d,drawerEntityId:u}=K(),p=l(()=>Xe(s,c),[s,c]),h=n(null),g=d!==B.Destination,[y,v]=t(!1),[b,f]=t(!1),{formData:x,formErrors:$,handleFormChange:C,resetFormData:S,validateForm:k,loadFormWithDrawerItem:w,yamlFields:T,setYamlFields:D,dynamicFields:N,setDynamicFields:E}=Ct({}),O=l(()=>{if(g)return S();const e=p?.find(e=>e.id===u);return e?(w(e),D(St(a,e))):S(),e},[g,u,p]);if(!O)return null;const F=a.flatMap(e=>e.items).find(e=>e.type===O.destinationType.type),{icon:I,iconSrc:A}=F?ze(F?.type):{icon:void 0,iconSrc:void 0};return e.createElement(vi,{ref:h,title:O.name||O.destinationType.displayName,icons:I?[I]:void 0,iconSrcs:A?[A]:void 0,isEdit:y,isFormDirty:b,onEdit:e=>{v("boolean"!=typeof e||e)},onSave:async e=>{if(k({withAlert:!0,alertTitle:Z.Update})){const t=e!==O.destinationType.displayName?e:"";C("name",t),i(u,{...x,name:t}),v(!1),f(!1)}},onDelete:async()=>{o(u),v(!1),f(!1),h.current?.closeDrawer()},onCancel:()=>{v(!1),f(!1),w(O)},isLastItem:1===p.length},y?e.createElement(Vn,null,e.createElement(jn,{isUpdate:!0,categoryItem:F,formData:x,formErrors:$,handleFormChange:(...e)=>{f(!0),C(...e)},dynamicFields:N,setDynamicFields:(...e)=>{f(!0),E(...e)},validateForm:k,testConnection:r})):e.createElement(qn,null,O.conditions?.length?e.createElement(Y,{conditions:O.conditions}):null,e.createElement(X,{title:m.DESTINATION_DETAILS,data:O?Fn(O,T):[]})))},Hn=d.div`
|
|
243
243
|
display: flex;
|
|
244
244
|
flex-direction: column;
|
|
245
245
|
gap: 12px;
|
|
246
|
-
`,
|
|
246
|
+
`,Bn=({items:t,onSelectNew:a,onSelectConfigured:i,isLoadingForDestinationIds:n})=>{const{configuredDestinationsUpdateOnly:o}=ut();return t.map(t=>{const l=t.name===wt.EXISTS.TITLE;return e.createElement(Hn,{key:`category-${t.name}`},e.createElement(I,{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}=ze(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(Re,{key:s,"data-id":s,title:r.displayName,hoverText:V.SELECT,onClick:h,iconProps:{icon:d,iconSrc:u},visualProps:{monitors:c,monitorsWithLabels:!0},checkboxProps:{withCheckbox:l,isChecked:p,isLoading:m,onCheckboxChange:()=>i(r.id)}})}))})},Wn=d.div`
|
|
247
247
|
display: flex;
|
|
248
248
|
flex-direction: column;
|
|
249
249
|
gap: 24px;
|
|
250
|
-
`,
|
|
250
|
+
`,_n=d.div`
|
|
251
251
|
display: flex;
|
|
252
252
|
align-items: center;
|
|
253
253
|
gap: 12px;
|
|
254
|
-
`,
|
|
254
|
+
`,Un=d.div`
|
|
255
255
|
width: 170px;
|
|
256
256
|
margin-right: 8px;
|
|
257
|
-
`,
|
|
257
|
+
`,Jn=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
|
+
`,Gn=d(Wn)`
|
|
269
269
|
margin-top: 80px;
|
|
270
|
-
`,{MANAGED:
|
|
270
|
+
`,{MANAGED:Yn,SELF_HOSTED:Xn,DETECTED:Zn,EXISTS:Qn}=wt,eo=[{value:"All types",id:"all"},{value:Yn.TITLE,id:Yn.TITLE},{value:Xn.TITLE,id:Xn.TITLE},{value:Zn.TITLE,id:Zn.TITLE},{value:Qn.TITLE,id:Qn.TITLE}],to=eo[0],ao=[$t.Logs,$t.Metrics,$t.Traces],io=(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:{[$t.Logs]:{supported:e.exportedSignals.logs},[$t.Metrics]:{supported:e.exportedSignals.metrics},[$t.Traces]:{supported:e.exportedSignals.traces}}}}),no=({hidden:a,categories:i,potentialDestinations:n,onSelectNew:o,onSelectConfigured:r,isLoadingForDestinationIds:s})=>{const{destinations:c}=_(),{selectedStreamName:d}=_e(),{configuredDestinations:u,configuredDestinationsUpdateOnly:p}=ut(),[m,h]=t(""),[g,y]=t(to),[v,b]=t(ao),f=l(()=>{const e=Tt(i);return e.unshift({name:Qn.TITLE,description:Qn.DESCRIPTION,icon:Na,items:io(c,d,new Set(u.concat(p).map(e=>e.id)))}),e.unshift({name:Zn.TITLE,description:Zn.DESCRIPTION,icon:Ea,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(Wn,null,e.createElement(I,{title:"Choose destination",description:"Add backend destination you want to connect with Odigos."}),e.createElement(_n,null,e.createElement(Un,null,e.createElement($,{placeholder:"Search...",icon:wa,value:m,onChange:({target:{value:e}})=>h(e)})),e.createElement(Un,null,e.createElement(ot,{options:eo,value:g,onSelect:y,onDeselect:()=>{}})),e.createElement(M,{title:"",selectedSignals:v,setSelectedSignals:b})),e.createElement(re,null),f.length?e.createElement(Jn,null,e.createElement(Bn,{items:f,onSelectNew:e=>o(e,v),onSelectConfigured:r,isLoadingForDestinationIds:s})):e.createElement(Gn,null,e.createElement(De,{title:"No destinations found"})))},oo=d.div`
|
|
271
271
|
display: flex;
|
|
272
|
-
`,
|
|
272
|
+
`,lo=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
|
+
`,ro=({isOnboarding:a,categories:i,potentialDestinations:n,createDestination:o,updateDestination:l,deleteDestination:r,testConnection:s})=>{const{destinations:c}=_(),{selectedStreamName:d}=_e(),{currentModal:u,setCurrentModal:p}=ee(),{addConfiguredDestination:h,addConfiguredDestinationUpdateOnly:g,removeConfiguredDestinationUpdateOnly:y,configuredDestinationsUpdateOnly:v}=ut(),b=u===B.Destination,[f,x]=t(void 0),{formData:$,formErrors:C,handleFormChange:S,resetFormData:k,validateForm:w,setYamlFields:T,dynamicFields:D,setDynamicFields:N,loadFormWithDrawerItem:E}=Ct({supportedSignals:f?.supportedSignals,preLoadedFields:f?.fields}),[O,F]=t([]),I=e=>{const t={};return e||D.forEach(e=>t[e.name]=e.value),{id:e?.id||"",name:e?.name||$.name,disabled:e?.disabled||$.disabled,dataStreamNames:e?.dataStreamNames||[],conditions:e?.conditions||[],exportedSignals:e?.exportedSignals||$.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}}}}},A=async e=>{if(a&&!e){const e=I();h(e)}else if(a&&e){const t=I(e);v.some(t=>t.id===e.id)?y(e):g(t)}else if(a||e){if(!a&&e){const t=I(e),a=t.dataStreamNames.some(e=>e===d);F(t=>[...t,e.id]),a?await r(e.id):await l(e.id,E(t)),F(t=>t.filter(t=>t!==e.id))}}else o($)},M=()=>{k(),x(void 0),p("")},R=()=>{k(),x(void 0)},L=async()=>{if(f){if(!w({withAlert:!a,alertTitle:Z.Create}))return null;A()}M()};return j({key:"Enter",active:b},()=>L()),e.createElement(te,{isOpen:b,onClose:M,header:{title:m.ADD_DESTINATION},actionComponent:e.createElement(ae,{buttons:(()=>{const t=[{label:"DONE",variant:"primary",onClick:L}];return f&&t.unshift({label:"BACK",icon:()=>e.createElement(Oa,{rotate:-90}),variant:"secondary",onClick:R}),t})()})},e.createElement(oo,null,e.createElement(lo,null,e.createElement(Dt,{currentStep:f?2:1,data:[{stepNumber:1,title:m.DESTINATIONS},{stepNumber:2,title:m.CONNECTION}]})),e.createElement(ie,{style:{margin:"32px 24px 12px 24px"}},e.createElement(no,{hidden:void 0!==f,categories:i,potentialDestinations:n,onSelectNew:(e,t)=>{k(),S("type",e?.type||""),S("currentStreamName",d);const a={logs:!1,metrics:!1,traces:!1};t.filter(t=>e.supportedSignals[t].supported).forEach(e=>a[e]=!0),S("exportedSignals",a),T(e?.fields||[]),x(e)},onSelectConfigured:e=>{const t=c.find(t=>t.id===e);t&&A(t)},isLoadingForDestinationIds:O}),f&&e.createElement(jn,{categoryItem:f,formData:$,formErrors:C,handleFormChange:S,dynamicFields:D,setDynamicFields:N,validateForm:w,testConnection:s}))))},so=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
|
+
`,co=({categories:t,withDelete:a})=>{const{configuredDestinations:i,configuredDestinationsUpdateOnly:n}=ut();return i.length||n.length?e.createElement(so,null,i.concat(n).map((o,l)=>e.createElement(uo,{key:`configured-destination-${o.destinationType.type}-${l}`,"data-id":`configured-destination-${o.destinationType.type}`,item:o,yamlFields:St(t,o),isLastItem:i.length+n.length===1,withDelete:a}))):e.createElement(Te,null,e.createElement(De,{title:"No destinations",subTitle:"Please add a destination"}))},uo=({item:a,yamlFields:i,isLastItem:n,withDelete:o})=>{const[r,s]=t(!1),{icon:c,iconSrc:d}=ze(a.destinationType.type),{removeConfiguredDestination:u,removeConfiguredDestinationUpdateOnly:p}=ut(),m=l(()=>bt(a,i).map(e=>({title:e.name,value:e.value})),[a,i]);return e.createElement(e.Fragment,null,e.createElement(Re,{title:a.name||a.destinationType.displayName,subTitle:a.destinationType.type,iconProps:{icon:c,iconSrc:d},visualProps:{monitors:Ke(a.exportedSignals),monitorsWithLabels:!0},extendableProps:{withExtend:!0,renderExtended:()=>e.createElement(Nt,{data:m})},renderActions:o?()=>e.createElement(mt,{onClick:()=>s(!0)},e.createElement(Ca,null)):void 0}),o&&e.createElement(z,{isOpen:r,name:a.destinationType.displayName||a.name,type:B.Destination,isLastItem:n,onApprove:()=>{a.id?p(a):u(a)},onDeny:()=>s(!1)}))},po=d(Ie)`
|
|
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
|
+
`,mo=({isSourcesListEmpty:t,goToSources:a,categories:i,potentialDestinations:n,testConnection:o,onClickSummary:l})=>{const r=O.useTheme(),{setCurrentModal:s}=ee(),{configuredDestinations:c,configuredDestinationsUpdateOnly:d}=ut();return e.createElement(e.Fragment,null,e.createElement(ie,{$isNotModal:!0},e.createElement(Q,{$gap:12},e.createElement(Q,{$gap:24},l&&e.createElement(yt,{onClick:l}),e.createElement(I,{title:m.ADD_DESTINATIONS,badgeLabel:c.length+d.length,description:m.ADD_DESTINATION_DESCRIPTION}),t&&e.createElement(ne,{type:W.Warning,message:m.NO_SOURCES_GO_BACK,action:{label:m.SELECT_SOURCES,onClick:a}}),e.createElement(po,{variant:"secondary",onClick:()=>s(B.Destination)},e.createElement(ka,null),e.createElement(E,{color:r.colors.secondary,size:14,decoration:"underline",family:"secondary"},m.ADD_DESTINATION))),e.createElement(co,{categories:i,withDelete:!0}))),e.createElement(ro,{isOnboarding:!0,categories:i,potentialDestinations:n,updateDestination:async()=>{},createDestination:async()=>{},deleteDestination:async()=>{},testConnection:o}))},ho=[{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}],go=({metrics:t,maxHeight:a,maxWidth:i})=>{const n=O.useTheme(),o=ge(),{selectedStreamName:r}=_e(),{setDrawerType:s,setDrawerEntityId:c}=K(),{destinations:d,destinationsLoading:u}=_(),p=l(()=>Xe(d,r),[d,r]),h=l(()=>Di({instrumentationRules:[],sources:[],actions:[],destinations:Ye(p,o),searchText:o.searchText,selectedCategory:B.Destination}).searchResults.find(({category:e})=>e===B.Destination)?.entities||[],[p,o]),g=l(()=>h.map(a=>{const{hasErrors:i,hasWarnings:o,hasDisableds:l}=se(a.conditions||[]),{icon:r,iconSrc:d}=ze(a.destinationType.type);return{status:i?W.Error:o?W.Warning:void 0,faded:l,onClick:()=>{s(B.Destination),c(a.id)},cells:[{columnKey:"icon",component:()=>e.createElement(ve,{icon:r,src:d})},{columnKey:"name",value:be(a,B.Destination,{prioritizeDisplayName:!0})},{columnKey:"type",value:a.destinationType.type,textColor:n.text.info},{columnKey:"throughput",value:je(Et(t,B.Destination,a.id).throughput),textColor:n.text.info},{columnKey:"signals",component:()=>e.createElement(fe,{withLabels:!0,monitors:Ke(a.exportedSignals)})},{columnKey:"conditions",component:()=>a.conditions?.length?e.createElement(wi,{conditions:a.conditions,id:a.id}):null},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:a.disabled?W.Error:W.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(xe,{$maxWidth:i},e.createElement($e,null,e.createElement(Ce,{icon:Se(B.Destination),title:m.DESTINATIONS,badge:y,badgeTooltip:v,loading:u})),e.createElement(ke,{$maxHeight:a},e.createElement(we,{columns:ho,rows:g})),!h.length&&e.createElement(Te,{style:{marginTop:"2rem"}},e.createElement(De,null)))},yo=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[Ot.HeaderKeys]||[]).filter(e=>e).join(", ");e&&d.push({title:"Collect",value:e})}if(c){const e=(c[It.Java]||[]).map(e=>new Ft(e.className,e.methodName)).map(e=>`• ${e.toString()}`).join("\r\n");e&&d.push({title:m.JAVA_CUSTOM_PROBES,value:e});const t=(c[It.Golang]||[]).map(e=>new At(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},vo=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
|
+
`,bo=[{id:Mt.FilePath,label:"Collect File Path",tooltip:"Indicates whether to record the `code.filepath` attribute."},{id:Mt.Function,label:"Collect Function",tooltip:"Indicates whether to record the `code.function` attribute."},{id:Mt.LineNumber,label:"Collect Line Number",tooltip:"Indicates whether to record the `code.lineno` attribute."}],fo=[{id:Mt.Column,label:"Collect Column",tooltip:"Indicates whether to record the `code.column` attribute."},{id:Mt.Namespace,label:"Collect Namespace",tooltip:"Indicates whether to record the `code.namespace` attribute."},{id:Mt.StackTrace,label:"Collect Stacktrace",tooltip:"Indicates whether to record the `code.stacktrace` attribute."}],xo={[It.Java]:[new Ft("","")],[It.Golang]:[new At("")]},$o=["*"],Co=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
|
+
`,So=[{id:Rt.HttpRequest,label:"Collect HTTP Request"},{id:Rt.HttpResponse,label:"Collect HTTP Response"},{id:Rt.DbQuery,label:"Collect DB Query"},{id:Rt.Messaging,label:"Collect Messaging"}],ko={[Lt.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={[Mt.Column]:null,[Mt.FilePath]:!0,[Mt.Function]:!0,[Mt.LineNumber]:!0,[Mt.Namespace]:null,[Mt.StackTrace]:null};n("codeAttributes",e),d(!1)}},[]);const u=(e,t)=>{const a=t?[...s,e]:s.filter(t=>t!==e),i=Object.values(Mt).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(vo,{$hasError:!!r},bo.map(({id:t,label:a,tooltip:i})=>e.createElement(pe,{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(vo,{$hasError:!!r},fo.map(({id:t,label:a,tooltip:i})=>e.createElement(pe,{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)))},[Lt.CustomInstrumentation]:({value:t,setValue:i,formErrors:n})=>{const o=n.customInstrumentations,r=l(()=>(t?.customInstrumentations?.[It.Java]||[]).map(e=>({key:e.className,value:e.methodName})),[t]),s=l(()=>(t?.customInstrumentations?.[It.Golang]||[]).map(e=>new At(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),[t]),c=(e,t)=>{const a={};switch(t){case"java":a[It.Java]=e.map(e=>new Ft(e.className,e.methodName)),a[It.Golang]=s.map(e=>new At(e.packageName,e.functionName,e.receiverName,e.receiverMethodName));break;case"golang":a[It.Golang]=e.map(e=>new At(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)),a[It.Java]=r.map(({key:e,value:t})=>new Ft(e,t))}i("customInstrumentations",a)};return a(()=>{t?.customInstrumentations||i("customInstrumentations",{[It.Golang]:xo[It.Golang],[It.Java]:xo[It.Java]})},[i,t]),e.createElement("div",null,e.createElement(k,{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(T,{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"}))},[Lt.HeadersCollection]:({value:t,setValue:i,formErrors:n})=>{const o=n.headersCollection,r=l(()=>t?.headersCollection?.[Ot.HeaderKeys]||[],[t]),s=e=>{const t={[Ot.HeaderKeys]:e};i("headersCollection",t)};return a(()=>{r.length||s($o)},[r]),e.createElement("div",null,r.length>0&&e.createElement(D,{title:"Header Keys",tooltip:"Specify which headers you want to collect, asterisk (*) will collect all headers.",value:r,onChange:e=>s(e),errorMessage:o}))},[Lt.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={[Rt.HttpRequest]:{},[Rt.HttpResponse]:{},[Rt.DbQuery]:{},[Rt.Messaging]:{}};n("payloadCollection",e),d(!1)}},[]),e.createElement("div",null,e.createElement(v,{title:"Type of data to collect",required:!0}),e.createElement(Co,{$hasError:!!r},So.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={[Rt.HttpRequest]:a.includes(Rt.HttpRequest)?{}:null,[Rt.HttpResponse]:a.includes(Rt.HttpResponse)?{}:null,[Rt.DbQuery]:a.includes(Rt.DbQuery)?{}:null,[Rt.Messaging]:a.includes(Rt.Messaging)?{}:null};n("payloadCollection",i),d(1===a.length)})(t,e)}))),!!r&&e.createElement(f,null,r))},[Lt.UnknownType]:null},wo=({ruleType:t,value:a,setValue:i,formErrors:n})=>{if(!t)return null;const o=ko[t];return o?e.createElement(o,{value:a,setValue:i,formErrors:n}):null},To=d.div`
|
|
318
318
|
display: flex;
|
|
319
319
|
flex-direction: column;
|
|
320
320
|
gap: 24px;
|
|
321
321
|
padding: 4px;
|
|
322
|
-
`,
|
|
322
|
+
`,Do=d(E)`
|
|
323
323
|
margin-bottom: 12px;
|
|
324
|
-
`,
|
|
324
|
+
`,No=({isUpdate:t,rule:a,formData:i,formErrors:n,handleFormChange:o})=>{const l=O.useTheme();return e.createElement(To,null,e.createElement(de,null,a.supportedLanguages.map(t=>e.createElement(Pt,{key:t,icon:Kt(t),type:W.Info},lt[t]))),t?e.createElement("div",null,e.createElement(Do,null,"Status"),e.createElement(F,{options:[{icon:fa,label:m.ENABLED,value:!1,selectedBgColor:l.text.success+O.opacity.hex["050"]},{icon:xa,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(I,{title:"",description:a.docsDescription,actionButton:e.createElement(A,{endpoint:a.docsEndpoint})}),e.createElement($,{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(wo,{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}))},Eo=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
|
+
`,Oo=d.div`
|
|
331
331
|
display: flex;
|
|
332
332
|
flex-direction: column;
|
|
333
333
|
gap: 12px;
|
|
334
|
-
`,
|
|
334
|
+
`,Fo=({updateInstrumentationRule:a,deleteInstrumentationRule:i})=>{const{instrumentationRules:o}=_(),{addNotification:r}=P(),{drawerType:s,drawerEntityId:c}=K(),d=n(null),u=s!==B.InstrumentationRule,[p,m]=t(!1),[h,g]=t(!1),{formData:y,formErrors:v,handleFormChange:b,resetFormData:f,validateForm:x,loadFormWithDrawerItem:$}=jt(),C=l(()=>{if(u)return f();const e=o?.find(e=>e.ruleId===c);return e?$(e):f(),e},[u,c,o]);if(!C)return null;const S=Vt.find(({type:e})=>e===C.type);return e.createElement(vi,{ref:d,title:C.ruleName||C.type,icons:[qe(C.type)],isEdit:p,isFormDirty:h,onEdit:e=>{C.mutable||!e&&void 0!==e?m("boolean"!=typeof e||e):r({type:W.Warning,title:oe.FORBIDDEN,message:oe.CANNOT_EDIT_RULE,crdType:B.InstrumentationRule,target:c,hideFromHistory:!0})},onSave:e=>{if(x()){const t=e!==C.type?e:"";b("ruleName",t),a(c,{...y,ruleName:t}),m(!1),g(!1)}},onDelete:()=>{C.mutable?(i(c),m(!1),g(!1),d.current?.closeDrawer()):r({type:W.Warning,title:oe.FORBIDDEN,message:oe.CANNOT_DELETE_RULE,crdType:B.InstrumentationRule,target:c,hideFromHistory:!0})},onCancel:()=>{m(!1),g(!1),$(C)}},p&&S?e.createElement(Eo,null,e.createElement(No,{isUpdate:!0,rule:S,formData:y,formErrors:v,handleFormChange:(...e)=>{g(!0),b(...e)}})):e.createElement(Oo,null,e.createElement(Y,{conditions:C.conditions||[]}),e.createElement(X,{title:"Instrumentation Rule Details",data:C?yo(C):[]})))},Io=d(Q)`
|
|
335
335
|
margin-top: 24px;
|
|
336
336
|
gap: 12px;
|
|
337
|
-
`,
|
|
337
|
+
`,Ao=Vt,Mo=({isEnterprise:a,createInstrumentationRule:i})=>{const{currentModal:n,setCurrentModal:o}=ee(),l=n===B.InstrumentationRule,{formData:r,formErrors:s,handleFormChange:c,resetFormData:d,validateForm:u}=jt(),[p,h]=t(void 0),g=()=>{d(),h(void 0),o("")},y=()=>{if(!u())return null;i(r),g()};return j({key:"Enter",active:l},()=>y()),e.createElement(te,{isOpen:l,onClose:g,header:{title:"Add Instrumentation Rule"},actionComponent:e.createElement(ae,{buttons:[{variant:"primary",label:"DONE",onClick:y,disabled:!a||!p,tooltip:a?"":oe.ENTERPRISE_ONLY("Instrumentation Rules")}]})},e.createElement(ie,null,e.createElement(I,{title:"Select Instrumentation Rule",description:"Define how telemetry is recorded from your application. Choose a rule type and configure the details."}),e.createElement(Io,null,a?e.createElement(ne,{type:W.Warning,message:oe.DEFINED_FOR_ALL_STREAMS(m.INSTRUMENTATION_RULES)}):e.createElement(ne,{type:W.Default,message:oe.ENTERPRISE_ONLY(m.INSTRUMENTATION_RULES)}),e.createElement(le,{options:Ao,selectedOption:p,onOptionSelect:e=>{return t=e,d(),void h(t);var t},autoFocus:!p?.type})),p?.type?e.createElement("div",null,e.createElement(re,{margin:"16px 0"}),e.createElement(No,{rule:p,formData:r,formErrors:s,handleFormChange:c})):null))},Ro=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(It).forEach(e=>{const t=(i[e]||[]).filter(e=>e).join(", ");t&&(n+=n?`, ${t}`:t)}),n},Lo=[{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}],Po=({maxHeight:t,maxWidth:a})=>{const i=p(),n=ge(),{setDrawerType:o,setDrawerEntityId:r}=K(),{instrumentationRules:s,instrumentationRulesLoading:c}=_(),d=l(()=>Di({instrumentationRules:s,sources:[],actions:[],destinations:[],searchText:n.searchText,selectedCategory:B.InstrumentationRule}).searchResults.find(({category:e})=>e===B.InstrumentationRule)?.entities||[],[s,n]),u=l(()=>d.map(t=>{const{hasErrors:a,hasWarnings:n,hasDisableds:l}=se(t.conditions||[]);return{status:a?W.Error:n?W.Warning:void 0,faded:l,onClick:()=>{o(B.InstrumentationRule),r(t.ruleId)},cells:[{columnKey:"icon",component:()=>e.createElement(ve,{icon:qe(t.type)})},{columnKey:"name",value:be(t,B.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:Ro(t),textColor:i.text.info,withTooltip:!0},{columnKey:"conditions",component:()=>e.createElement(wi,{conditions:t.conditions||[],id:t.ruleId})},{columnKey:"active-status",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:t.disabled?W.Error:W.Success,title:t.disabled?m.DISABLED:m.ENABLED,withIcon:!0,withBorder:!0}))},{columnKey:"source-count",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:W.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(xe,{$maxWidth:a},e.createElement($e,null,e.createElement(Ce,{icon:Se(B.Action),title:m.INSTRUMENTATION_RULES,badge:h,badgeTooltip:g,loading:c})),e.createElement(ke,{$maxHeight:t},e.createElement(we,{columns:Lo,rows:u})),!d.length&&e.createElement(Te,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Ko=d.div`
|
|
338
338
|
position: fixed;
|
|
339
339
|
bottom: 0;
|
|
340
340
|
left: 50%;
|
|
@@ -347,17 +347,17 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
347
347
|
border-radius: 32px;
|
|
348
348
|
border: 1px solid ${({theme:e})=>e.colors.border};
|
|
349
349
|
background-color: ${({theme:e})=>e.colors.dropdown_bg};
|
|
350
|
-
`,
|
|
350
|
+
`,jo=({totalSourceCount:a,uninstrumentSources:i,restartWorkloads:n})=>{const o=O.useTheme(),s=qt({container:Ko,animateIn:O.animations.slide.in.center,animateOut:O.animations.slide.out.center}),{selectedSources:c,setSelectedSources:d}=Ae(),[u,p]=t(!1),m=l(()=>{let e=0;return Object.values(c).forEach(t=>{e+=t.length}),e},[c]),h=()=>{d({})};return e.createElement(r,null,e.createElement(s,{"data-id":"multi-source-control",enter:!!m},e.createElement(E,null,"Selected sources"),e.createElement(Ee,{label:m,filled:!0}),e.createElement(re,{orientation:"vertical",length:"16px"}),e.createElement(Ie,{variant:"tertiary",onClick:h},e.createElement(E,{family:"secondary",decoration:"underline"},"Deselect")),e.createElement(Ie,{variant:"tertiary",onClick:()=>{const e=[];Object.values(c).forEach(t=>{e.push(...t.map(e=>zt(e)))}),n(e),h()}},e.createElement(Fa,null),e.createElement(E,{family:"secondary",decoration:"underline"},"Restart")),e.createElement(Ie,{variant:"tertiary",onClick:()=>p(!0)},e.createElement(Ca,null),e.createElement(E,{family:"secondary",decoration:"underline",color:o.text.error},"Uninstrument"))),e.createElement(z,{isOpen:u,name:`${m} sources`,type:B.Source,isLastItem:m===a,onApprove:()=>{const e={};Object.entries(c).forEach(([t,a])=>{e[t]=a.map(e=>({...e,selected:!1}))}),i(e),p(!1),h()},onDeny:()=>p(!1)}))},Vo=d.div`
|
|
351
351
|
position: relative;
|
|
352
352
|
width: fit-content;
|
|
353
|
-
`,
|
|
353
|
+
`,qo=d(de)`
|
|
354
354
|
gap: 12px;
|
|
355
355
|
padding: 0 12px;
|
|
356
|
-
`,
|
|
356
|
+
`,zo=d(Q)`
|
|
357
357
|
gap: 12px;
|
|
358
358
|
max-height: 400px;
|
|
359
359
|
overflow-y: auto;
|
|
360
|
-
`,
|
|
360
|
+
`,Ho=d.div`
|
|
361
361
|
position: absolute;
|
|
362
362
|
bottom: 0;
|
|
363
363
|
left: 0;
|
|
@@ -366,19 +366,19 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
366
366
|
border-radius: 0 0 24px 24px;
|
|
367
367
|
background: ${({theme:e})=>`linear-gradient(to top, ${e.colors.dropdown_bg}, transparent)`};
|
|
368
368
|
pointer-events: none;
|
|
369
|
-
`,
|
|
369
|
+
`,Bo=d(E)`
|
|
370
370
|
background-color: ${({theme:e})=>e.colors.orange_soft};
|
|
371
371
|
color: ${({theme:e})=>e.text.primary};
|
|
372
372
|
border-radius: 32px;
|
|
373
373
|
width: fit-content;
|
|
374
374
|
padding: 2px 8px;
|
|
375
|
-
`,
|
|
375
|
+
`,Wo=()=>{const t=O.useTheme(),{notifications:a,markAsSeen:i}=P(),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}=Qe({defaultClientHeight:420,defaultClientwidth:400,onClickOutside:()=>{l&&o.forEach(({id:e})=>i(e))}});return e.createElement(Vo,null,e.createElement(mt,{onClick:()=>{u(0,0),c(e=>!e)},tooltip:"Notifications",withPing:!!l,pingColor:t.colors.orange_og},e.createElement(Ia,{size:18})),e.createElement(et,{ref:r,isOpen:s,right:d.left,maxWidth:"400px",header:e.createElement(qo,null,e.createElement(E,{size:20},"Notifications"),!!l&&e.createElement(Bo,{size:12,family:"secondary"},l," new"))},e.createElement(zo,null,n.length?n.map(t=>e.createElement(Xo,{key:`notification-${t.id}`,...t,onClick:()=>c(!1)})):e.createElement(De,{title:"No notifications",subTitle:""})),e.createElement(Ho,null)))},_o=d.div`
|
|
376
376
|
display: flex;
|
|
377
377
|
align-items: flex-start;
|
|
378
378
|
gap: 12px;
|
|
379
379
|
padding: 16px;
|
|
380
380
|
border-radius: 16px;
|
|
381
|
-
background-color: ${({theme:e})=>e.colors.dropdown_bg_2+
|
|
381
|
+
background-color: ${({theme:e})=>e.colors.dropdown_bg_2+O.opacity.hex["080"]};
|
|
382
382
|
cursor: not-allowed;
|
|
383
383
|
&.click-enabled {
|
|
384
384
|
cursor: pointer;
|
|
@@ -386,27 +386,27 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
386
386
|
background-color: ${({theme:e})=>e.colors.dropdown_bg_2};
|
|
387
387
|
}
|
|
388
388
|
}
|
|
389
|
-
`,
|
|
390
|
-
background-color: ${({$type:e,theme:t})=>t.text[e]+
|
|
389
|
+
`,Uo=d.div`
|
|
390
|
+
background-color: ${({$type:e,theme:t})=>t.text[e]+O.opacity.hex["015"]};
|
|
391
391
|
border-radius: 8px;
|
|
392
392
|
width: 36px;
|
|
393
393
|
height: 36px;
|
|
394
394
|
display: flex;
|
|
395
395
|
align-items: center;
|
|
396
396
|
justify-content: center;
|
|
397
|
-
`,Uo=d.div`
|
|
398
|
-
width: 290px;
|
|
399
397
|
`,Jo=d.div`
|
|
400
|
-
|
|
398
|
+
width: 290px;
|
|
401
399
|
`,Go=d.div`
|
|
400
|
+
margin-bottom: 6px;
|
|
401
|
+
`,Yo=d.div`
|
|
402
402
|
display: flex;
|
|
403
403
|
align-items: center;
|
|
404
404
|
gap: 6px;
|
|
405
|
-
`,
|
|
405
|
+
`,Xo=({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}=Bt(),m=!!r&&!!s,h=n?.toLowerCase().includes(Z.Delete.toLowerCase())||!1,g=he(i,d);return e.createElement(_o,{key:`notification-${t}`,className:m?"click-enabled":"",onClick:()=>{m&&(c(),p({id:t,crdType:r,target:s}))}},e.createElement(Uo,{$type:h?W.Error:i},h?e.createElement(Ca,null):e.createElement(g,null)),e.createElement(Jo,null,e.createElement(Go,null,e.createElement(E,{size:14},o)),e.createElement(Yo,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")))))},Zo=(e,t,a)=>{const i=e?.serviceName||t?.otelServiceName||t?.name,n=a?[Aa]:He(t?.containers||[]),{priorotizedStatus:o}=se(t?.conditions||[]);return{id:i,title:i,icons:n.length?n:[Ma],status:o,serviceMapEntry:e}},Qo=e=>"user"===e?.otelServiceName&&!e?.namespace&&!e?.name&&!e?.kind,el=d.div`
|
|
406
406
|
width: 100%;
|
|
407
407
|
height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px)`};
|
|
408
408
|
position: relative;
|
|
409
|
-
`,
|
|
409
|
+
`,tl={namespace:"",name:"",kind:"",otelServiceName:"user",selected:!0,numberOfInstances:0,dataStreamNames:[],containers:[],conditions:[]},al=({heightToRemove:t,serviceMap:i})=>{const n=O.useTheme(),{sources:o,sourcesLoading:l}=_(),{containerRef:r,containerHeight:s,containerWidth:c}=Ue(),[d,u,p]=_a([]),[h,g,y]=Ua([]);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===`${B.Source}-${a}-${Wt.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:`${B.Source}-${a}-${Wt.MapItem}`,type:Wt.MapItem,position:l.get(a),data:Zo(t,i,Qo(i))})}),o.forEach((t,a)=>{if(n.find(e=>e.id===`${B.Source}-${a}-${Wt.MapItem}`))return;const i=e.find(e=>a===e.otelServiceName||a===e.name);n.push({id:`${B.Source}-${a}-${Wt.MapItem}`,type:Wt.MapItem,position:l.get(a),data:Zo(t,i,Qo(i))})});let a=50;e.forEach(e=>{const t=e.otelServiceName||e.name;n.find(e=>e.id===`${B.Source}-${t}-${Wt.MapItem}`)||(n.push({id:`${B.Source}-${t}-${Wt.MapItem}`,type:Wt.MapItem,position:{x:a,y:10},data:Zo(void 0,e,Qo(e))}),a+=110)})}else n.push({id:`${B.Source}-${Wt.NoData}`,type:Wt.NoData,position:{x:i/2-150,y:a/4},data:{subTitle:m.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}});return n})({serviceMap:i,sources:[tl].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===`${B.Source}-${Wt.NoData}`)&&a.push({id:`${B.Source}-${Wt.NoData}`,type:"remove"}),Ja(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=`${B.Source}-${a.serviceName}-${Wt.MapItem}`,r=o===W.Error;i.push({id:`${n}-to-${l}`,source:n,target:l,markerEnd:{type:Wa.ArrowClosed},style:{stroke:r?e?.colors.dark_red:e?.colors.border}})})}),i})({theme:n,nodes:d,serviceMap:i}))},[n,d,i]),e.createElement(el,{ref:r,$heightToRemove:t},e.createElement(_t,{nodes:d,edges:h,onNodesChange:p,onEdgesChange:y,zoomOnScroll:!0}))},il=d.div`
|
|
410
410
|
display: flex;
|
|
411
411
|
flex-direction: column;
|
|
412
412
|
align-items: center;
|
|
@@ -416,12 +416,12 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
416
416
|
max-height: ${({$isModal:e})=>e?"calc(100vh - 510px)":"calc(100vh - 310px)"};
|
|
417
417
|
height: fit-content;
|
|
418
418
|
overflow-y: scroll;
|
|
419
|
-
`,
|
|
419
|
+
`,nl=d.div`
|
|
420
420
|
width: 100%;
|
|
421
421
|
padding-bottom: ${({$isOpen:e})=>e?"18px":"0"};
|
|
422
422
|
border-radius: 16px;
|
|
423
|
-
background-color: ${({$selected:e,theme:t})=>e?t.colors.majestic_blue+
|
|
424
|
-
`,
|
|
423
|
+
background-color: ${({$selected:e,theme:t})=>e?t.colors.majestic_blue+O.opacity.hex["024"]:t.colors.dropdown_bg_2+O.opacity.hex["040"]};
|
|
424
|
+
`,ol=d.div`
|
|
425
425
|
display: flex;
|
|
426
426
|
justify-content: space-between;
|
|
427
427
|
gap: 12px;
|
|
@@ -430,29 +430,29 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
430
430
|
border-radius: 16px;
|
|
431
431
|
cursor: ${({$withClick:e})=>e?"pointer":"unset"};
|
|
432
432
|
&:hover {
|
|
433
|
-
background-color: ${({$withClick:e,$selected:t,theme:a})=>e&&(t?a.colors.majestic_blue+
|
|
433
|
+
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"])};
|
|
434
434
|
transition: background-color 0.3s;
|
|
435
435
|
}
|
|
436
|
-
`,
|
|
436
|
+
`,ll=d(ol)`
|
|
437
437
|
width: calc(100% - 100px);
|
|
438
438
|
margin: 0 auto;
|
|
439
439
|
padding: 8px;
|
|
440
|
-
`,
|
|
440
|
+
`,rl=d.div`
|
|
441
441
|
position: relative;
|
|
442
442
|
padding-bottom: ${({$addPadding:e})=>e?"16px":"0"};
|
|
443
|
-
`,
|
|
443
|
+
`,sl=d.div`
|
|
444
444
|
position: absolute;
|
|
445
445
|
top: 6px;
|
|
446
446
|
left: 18px;
|
|
447
|
-
`,
|
|
447
|
+
`,cl=d(Te)`
|
|
448
448
|
padding-bottom: ${({$addPadding:e})=>e?"16px":"0"};
|
|
449
|
-
`,
|
|
449
|
+
`,dl=d.div`
|
|
450
450
|
width: ${({$width:e})=>`${e||42}px`};
|
|
451
451
|
display: flex;
|
|
452
452
|
align-items: center;
|
|
453
453
|
justify-content: flex-end;
|
|
454
454
|
text-align: right;
|
|
455
|
-
`,
|
|
455
|
+
`,ul=Se(B.Namespace),pl=({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}=We(),{namespacesLoading:g}=_(),y=Object.entries(o||{});return y?.length?e.createElement(il,{$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,$=l===t,C=f.length>0&&f.length===o.length,S=f.length>0&&f.length!==o.length,k=o.length>0,T=1===o.length;return r||k?e.createElement(nl,{key:`namespace-${t}`,"data-id":`namespace-${t}`,$selected:C,$isOpen:$},e.createElement(ol,{$selected:C,$withClick:!!r,onClick:()=>r?.(t)},e.createElement(de,{$gap:12},r&&e.createElement(b,{partiallyChecked:S,value:C,onChange:e=>r(t,e)}),e.createElement(ul,null),e.createElement(E,null,t)),e.createElement(de,{$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(dl,{$width:108},i!==t||n?.includes(t)?null:e.createElement(Fe,{size:10},"Retrieving workloads...")),e.createElement(dl,null,e.createElement(E,{size:10,color:p.text.grey},x?`${f.length}/${o.length}`:null)),r&&e.createElement(ht,{extend:$}))),($||!r)&&(k?e.createElement(rl,{$addPadding:!c},e.createElement(sl,null,e.createElement(re,{orientation:"vertical",length:(T?24:34*o.length)+"px"})),o.map(i=>{const n=f.some(({name:e})=>e===i.name);return e.createElement(ml,{key:`source-${i.name}`,withInstances:a,source:i,namespace:t,isSelected:n,onSelect:c})})):e.createElement(cl,{$addPadding:!c},g||i===t&&!n?.includes(t)?e.createElement(Le,null):e.createElement(De,{title:m.NO_SOURCES_NAMESPACE,subTitle:m.TRY_SEARCH_OR_OTHER_NAMESPACE})))):null})):e.createElement(Te,null,g||i?e.createElement(Le,null):e.createElement(De,{title:m.NO_SOURCES,subTitle:!h&&r?m.PLEASE_MAKE_SURE_UNIGNORED_NAMESPACES:m.PLEASE_ADD_SOURCE}))},ml=({withInstances:t,source:a,namespace:i,isSelected:n,onSelect:o})=>e.createElement(ll,{"data-id":`source-${a.name}`,$selected:n,$withClick:!!o,onClick:()=>o?.(a)},e.createElement(de,{$gap:12},o&&e.createElement(b,{value:n,onChange:()=>o(a,i)}),e.createElement(de,{$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}`)))),hl=d.div`
|
|
456
456
|
display: flex;
|
|
457
457
|
flex-direction: column;
|
|
458
458
|
align-items: center;
|
|
@@ -461,35 +461,35 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
461
461
|
max-height: calc(100vh - 200px);
|
|
462
462
|
height: fit-content;
|
|
463
463
|
overflow-y: scroll;
|
|
464
|
-
`,
|
|
464
|
+
`,gl=({onEditStream:t,onEditSources:a,onEditDestinations:i,categories:n})=>{const{selectedStreamName:o}=_e(),{configuredSources:r,configuredDestinations:s,configuredDestinationsUpdateOnly:c}=ut(),d=l(()=>Object.values(r).reduce((e,t)=>e+t.filter(e=>e.selected).length,0),[r]);return e.createElement(ie,{$isNotModal:!0},e.createElement(Q,{$gap:12},e.createElement(I,{title:m.SUMMARY,description:m.STREAM_CONFIRM}),e.createElement(hl,null,e.createElement(X,{title:m.STREAM_NAME,action:()=>e.createElement(Ut,{onClick:t}),data:[{title:"",value:o}]}),e.createElement(X,{title:m.SELECTED_SOURCES,titleBadge:d,action:()=>e.createElement(Ut,{onClick:a})},e.createElement(pl,{filteredNamespacesAndSources:r,withInstances:!1})),e.createElement(X,{title:m.SELECTED_DESTINATIONS,titleBadge:s.length+c.length,action:()=>e.createElement(Ut,{onClick:i})},e.createElement(co,{categories:n})))))};var yl;!function(e){e.Overview="overview",e.InstrumentationRules="InstrumentationRule",e.Sources="Source",e.Actions="Action",e.Destinations="Destination"}(yl||(yl={}));const vl=({onClickId:a,defaultSelectedId:i,extendedNavIcons:n})=>{const{isVm:o}=We(),[r,s]=t(i||""),c=l(()=>[{id:yl.Overview,icon:Ra,selected:r===yl.Overview,onClick:()=>{s(yl.Overview),a(yl.Overview)},tooltip:"Overview"},...(n||[]).map(e=>({...e,selected:r===e.id,onClick:()=>{s(e.id),e.onClick()}}))],[r]),d=l(()=>{const e=[{id:yl.Sources,icon:Ka,selected:r===yl.Sources,onClick:()=>{s(yl.Sources),a(yl.Sources)},tooltip:"Sources"},{id:yl.Destinations,icon:ja,selected:r===yl.Destinations,onClick:()=>{s(yl.Destinations),a(yl.Destinations)},tooltip:"Destinations"}];return o||(e.push({id:yl.InstrumentationRules,icon:La,selected:r===yl.InstrumentationRules,onClick:()=>{s(yl.InstrumentationRules),a(yl.InstrumentationRules)},tooltip:"Instrumentation Rules"}),e.push({id:yl.Actions,icon:Pa,selected:r===yl.Actions,onClick:()=>{s(yl.Actions),a(yl.Actions)},tooltip:"Actions"})),e},[o,r]);return e.createElement(Jt,{orientation:"vertical",mainIcons:c,subIcons:d})},bl=({})=>e.createElement(mt,{onClick:()=>window.open("https://join.slack.com/t/odigos/shared_invite/zt-2wc6gm4j9-EhcVFYrLwHqvcIErO9sVzw","_blank","noopener noreferrer"),tooltip:"Join our Slack community"},e.createElement(Va,null)),fl=(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},xl=d.div`
|
|
465
465
|
display: flex;
|
|
466
466
|
flex-direction: column;
|
|
467
467
|
gap: 24px;
|
|
468
468
|
padding: 4px;
|
|
469
|
-
|
|
469
|
+
`,$l=({formData:t,handleFormChange:a})=>e.createElement(xl,null,e.createElement($,{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)})),Cl=({workloadOdigosHealthStatus:t})=>{if(!t)return null;const a=Gt(t.status),i=nt(t.reasonEnum),n=t.message;return e.createElement(de,{$alignItems:"center",$justifyContent:"center"},e.createElement(ce,{status:a,title:i,subtitle:n,withBackground:a!==me.Disabled,withBorder:!0,withIcon:!0,width:"calc(100% - 24px)"}))},Sl=({source:i,fetchSourceDescribe:n})=>{const[o,l]=t(!1),[r,s]=t(null);return a(()=>{i&&n({variables:{namespace:i.namespace,name:i.name,kind:i.kind}}).then(({data:e})=>{e?.describeSource?s(e.describeSource):l(!0)})},[n,i]),r||o?e.createElement(Q,{$gap:12},o?e.createElement(Te,{$height:"70vh"},e.createElement(De,{subTitle:"Could not fetch describe for this source"})):r?.pods?.length?r.pods.map(({podName:t,nodeName:a,phase:n,agentInjected:o,runningLatestWorkloadRevision:l,containers:s})=>{const d=n.status!==W.Success||Yt(s)?W.Error:W.Success,u=[];return u.push(e.createElement(Xt,{value:`kubectl get pod ${t.value} -n ${r?.namespace?.value||i.namespace}`.toLowerCase()})),u.push(e.createElement(re,{length:"100%",margin:"0"})),u.push(e.createElement(Zt,{title:a.name,tooltip:a.explain||"",value:{status:a.status||void 0,text:a.value}})),u.push(e.createElement(re,{length:"100%",margin:"0"})),u.push(e.createElement(Zt,{title:n.name,tooltip:n.explain||"",value:{status:n.status||void 0,text:n.value}})),u.push(e.createElement(re,{length:"100%",margin:"0"})),u.push(e.createElement(Zt,{title:o.name,tooltip:o.explain||"",value:{status:o.status||void 0,text:o.value}})),u.push(e.createElement(re,{length:"100%",margin:"0"})),l?.name&&(u.push(e.createElement(Zt,{title:l.name,tooltip:l.explain||void 0,value:{status:l.status||void 0,text:l.value}})),u.push(e.createElement(re,{length:"100%",margin:"0"}))),s.forEach(t=>{u.push(e.createElement(Qt,{...t}))}),e.createElement(X,{key:`pod-${t.value}`,title:`Pod: ${t.value}`,withExtend:!0,action:()=>e.createElement(ce,{status:d,title:d,withIcon:!0,withBorder:!0})},c.toArray(u))}):e.createElement(Te,{$height:"70vh"},e.createElement(De,{subTitle:"Check if you have any running pods and try again"}))):e.createElement(Te,{$height:"70vh"},e.createElement(Le,null))},kl=d(de)`
|
|
470
470
|
width: 100%;
|
|
471
471
|
align-items: center;
|
|
472
472
|
justify-content: space-between;
|
|
473
|
-
`,
|
|
473
|
+
`,wl=({source:i,fetchSourceLibraries:n})=>{const o=O.useTheme(),[l,s]=t(!1),[c,d]=t(null);return a(()=>{i&&n({variables:{namespace:i.namespace,name:i.name,kind:i.kind}}).then(({data:e})=>{e?.instrumentationInstanceComponents?d(Tt(e.instrumentationInstanceComponents).sort((e,t)=>e.name.localeCompare(t.name))):s(!0)})},[n,i]),c||l?e.createElement(Q,{$gap:12},l?e.createElement(Te,{$height:"70vh"},e.createElement(De,{subTitle:"Could not fetch libraries for this source"})):c?.length?e.createElement(X,{title:"Instrumented Libraries"},c.map(({name:t,healthy:a,nonIdentifyingAttributes:i},n)=>e.createElement(r,{key:`library-${t}`},e.createElement(kl,null,e.createElement(E,{size:12,color:o.text.grey},t),e.createElement(de,{$gap:4},i.map(({key:a,value:i})=>ea(i)&&ta(i)&&"is_standard_lib"===a?e.createElement(ce,{key:`${t}-${a}`,status:W.Default,title:"STANDARD",withBorder:!0}):null),"boolean"==typeof a&&e.createElement(ce,{status:a?W.Success:W.Error,title:a?"HEALTHY":"UNHEALTHY",withBorder:!0}))),n!==c.length-1&&e.createElement(re,{length:"100%",margin:"0"})))):e.createElement(Te,{$height:"70vh",$gap:12},e.createElement(De,{title:"No libraries found",subTitle:""}),e.createElement(ne,{type:W.Warning,message:"This feature is in early development, and has very limited support"}))):e.createElement(Te,{$height:"70vh"},e.createElement(Le,null))};var Tl;!function(e){e.Overview="Overview",e.Pods="Pods",e.Libraries="Libraries"}(Tl||(Tl={}));const Dl=[na.Deployment,na.StatefulSet,na.DaemonSet,na.DeploymentConfig],Nl=[oa.Python,oa.Go,oa.Java],El=d.div`
|
|
474
474
|
width: 100%;
|
|
475
475
|
height: 100%;
|
|
476
476
|
max-height: calc(100vh - 220px);
|
|
477
477
|
overflow: overlay;
|
|
478
478
|
overflow-y: auto;
|
|
479
|
-
`,
|
|
479
|
+
`,Ol=d.div`
|
|
480
480
|
display: flex;
|
|
481
481
|
flex-direction: column;
|
|
482
482
|
gap: 12px;
|
|
483
|
-
`,
|
|
483
|
+
`,Fl=({persistSources:i,updateSource:o,restartWorkloads:r,fetchSourceById:s,fetchSourceDescribe:c,fetchSourceLibraries:d})=>{const{isVm:u}=We(),{sources:p}=_(),{selectedStreamName:h}=_e(),{drawerType:g,drawerEntityId:y}=K(),v=l(()=>Ge(p,h),[p,h]),b=n(null),f=g===B.Source,[x,$]=t(!1),[C,S]=t(!1),[k,w]=t(Tl.Overview),[T,D]=t(null);a(()=>{f&&y&&s(y).then(e=>D(e||null))},[f,y]);const{formData:N,handleFormChange:O,resetFormData:F,loadFormWithDrawerItem:I}=aa(),A=l(()=>{if(!f)return F();const e=(T&&JSON.stringify(zt(T))===JSON.stringify(zt(y))?T:null)||v?.find(e=>e.namespace===y.namespace&&e.name===y.name&&e.kind===y.kind);return e?I(e):F(),e},[f,y,v,T]),M=l(()=>{const e=A?.conditions?.find(({type:e})=>"RuntimeDetection"===e);return{description:e?.message,isLoading:e?.status===me.Loading,containers:A?.containers||[]}},[A]),R=l(()=>{const e=[{label:Tl.Overview,onClick:()=>w(Tl.Overview),selected:k===Tl.Overview}];return Dl.includes(A?.kind)&&e.push({label:Tl.Pods,onClick:()=>w(Tl.Pods),selected:k===Tl.Pods}),A?.containers?.some(({language:e})=>Nl.includes(e))&&e.push({label:Tl.Libraries,onClick:()=>w(Tl.Libraries),selected:k===Tl.Libraries}),e},[k,A]);return A?e.createElement(vi,{ref:b,onClose:()=>{w(Tl.Overview),D(null)},title:A.otelServiceName||A.name,titleTooltip:"This attribute is used to identify the name of the service (service.name) that is generating telemetry data.",hideEditTitleFromEdit:!0,icons:He(A.containers),isEdit:x,isFormDirty:C,onEdit:k===Tl.Overview?e=>{$("boolean"!=typeof e||e)}:void 0,onSave:async()=>{const e=N.otelServiceName!==A.name?N.otelServiceName:"";O("otelServiceName",e),await o(y,{...N,otelServiceName:e}),D(null),S(!1),$(!1)},onDelete:k===Tl.Overview?async()=>{const{namespace:e}=A;i({[e]:[{...A,selected:!1,currentStreamName:h}]},{}),D(null),S(!1),$(!1),b.current?.closeDrawer()}:void 0,onCancel:()=>{S(!1),$(!1),O("otelServiceName",A.otelServiceName||A.name||"")},isLastItem:1===v.length,tabs:R,headerActionButtons:[{"data-id":"rollout-restart",variant:"tertiary",onClick:()=>r([y]),children:e.createElement(e.Fragment,null,e.createElement(Fa,null),e.createElement(E,{size:14,family:"secondary",decoration:"underline"},"Restart"))}]},k===Tl.Overview?x?e.createElement(El,null,e.createElement($l,{formData:N,handleFormChange:(...e)=>{S(!0),O(...e),O("currentStreamName",h)}})):e.createElement(Ol,null,e.createElement(Cl,{workloadOdigosHealthStatus:A.workloadOdigosHealthStatus}),e.createElement(Y,{conditions:A.conditions||[]}),e.createElement(X,{title:m.SOURCE_DETAILS,data:A?fl(A,u):[]}),e.createElement(X,{title:u?m.DETECTED_PROCESSES:m.DETECTED_CONTAINERS,titleBadge:M.isLoading?me.Loading:M.containers.length,description:M.description||(u?m.DETECTED_PROCESSES_DESCRIPTION:m.DETECTED_CONTAINERS_DESCRIPTION)},M.containers.map(t=>e.createElement(ia,{key:`source-container-${t.containerName}`,...t,callbackRuntimeOverride:async e=>await o(y,e)})))):k===Tl.Pods?e.createElement(Sl,{source:A,fetchSourceDescribe:c}):e.createElement(wl,{source:A,fetchSourceLibraries:d})):null},Il=d.div`
|
|
484
484
|
max-width: ${({$fullWidth:e})=>e?"unset":"420px"};
|
|
485
485
|
width: 100%;
|
|
486
|
-
`,
|
|
486
|
+
`,Al=i(({isModal:t,fetchSingleNamespace:a,onClickSummary:i},n)=>{const l=O.useTheme(),{isVm:r}=We(),s=la({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:C,showRunningOnly:S,setShowRunningOnly:k}=s;o(n,()=>({getFormValues:()=>({apps:h(),futureApps:g()})}));const T=Object.values(c).reduce((e,t)=>e+t.filter(e=>e.selected).length,0);return e.createElement(ie,{$isNotModal:!t},e.createElement(Q,{$gap:12},e.createElement(Q,{$gap:24},i&&e.createElement(yt,{onClick:i}),e.createElement(I,{title:m.SELECT_SOURCES,badgeLabel:T,description:m.SELECT_SOURCES_DESCRIPTION}),e.createElement(de,{$justifyContent:"space-between"},e.createElement(Il,{$fullWidth:r},e.createElement($,{placeholder:b===B.Source?m.SEARCH_SOURCES:m.SEARCH_NAMESPACES,icon:wa,value:y,onChange:e=>v(e.target.value.toLowerCase())})),!r&&e.createElement(F,{options:[{label:m.SOURCE,value:B.Source,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary},{label:m.NAMESPACE,value:B.Namespace,selectedBgColor:l.text.secondary,selectedTextColor:l.text.primary}],selected:b,setSelected:f})),e.createElement(de,{$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:C}),e.createElement(w,{title:m.ONLY_RUNNING_INSTANCES,initialValue:S,onChange:k}))),e.createElement(re,null),e.createElement(pl,{isModal:t,...s})))});Al.displayName=Al.name;const Ml=({fetchSingleNamespace:t,persistSources:a})=>{const{currentModal:i,setCurrentModal:o}=ee(),l=i===B.Source,r=()=>{o("")},s=async()=>{if(c.current){const{apps:e,futureApps:t}=c.current.getFormValues();a(e,t),r()}},c=n(null);return j({key:"Enter",active:l},s),l?e.createElement(te,{isOpen:l,onClose:r,header:{title:"Add Source"},actionComponent:e.createElement(ae,{buttons:[{label:"DONE",variant:"primary",onClick:s}]})},e.createElement(Al,{ref:c,isModal:!0,fetchSingleNamespace:t})):null},Rl=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},Ll=({metrics:t,maxHeight:a,maxWidth:i})=>{const n=O.useTheme(),{isVm:o}=We(),r=ge(),{isThisPending:c}=L(),{selectedStreamName:d}=_e(),{sources:u,sourcesLoading:p}=_(),{setDrawerType:h,setDrawerEntityId:g}=K(),{selectedSources:y,setSelectedSources:v}=Ae(),{isAwaitingInstrumentation:f,sourcesToCreate:x,sourcesCreated:$,sourcesToDelete:C,sourcesDeleted:S}=Me(),k=l(()=>{const e=(e,t)=>e>0&&Math.floor(100/e*t)||1;return x?e(x,$):C?e(C,S):1},[x,$,C,S]),w=l(()=>Ge(u,d),[u,d]),T=l(()=>Di({instrumentationRules:[],sources:Je(w,r),actions:[],destinations:[],searchText:r.searchText,selectedCategory:B.Source}).searchResults.find(({category:e})=>e===B.Source)?.entities||[],[w,r]),[D,N]=l(()=>{let e=0;return Object.values(y).forEach(t=>{e+=t.length}),[0!==e,e]},[y]),F=s(e=>{if(e){const e={};T.forEach(t=>{const a={namespace:t.namespace,name:t.name,kind:t.kind};c({entityType:B.Source,entityId:a})||(e[t.namespace]?e[t.namespace].push(t):e[t.namespace]=[t])}),v(e)}else v({})},[T]),I=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]),A=l(()=>T.map(a=>{const i=zt(a),o=JSON.stringify(i),{hasErrors:l,hasWarnings:r,hasDisableds:s}=se(a.conditions||[]),d=c({entityType:B.Source,entityId:i}),u=!!y[i.namespace]?.find(e=>e.namespace===i.namespace&&e.name===i.name&&e.kind===i.kind);return{status:l?W.Error:r?W.Warning:void 0,faded:s,onClick:()=>{h(B.Source),g(i)},cells:[{columnKey:"checkbox-and-icon",component:()=>e.createElement(de,{$gap:16},e.createElement(b,{disabled:d,value:u,onChange:()=>I(a)}),e.createElement(ra,{icons:He(a.containers),id:o}))},{columnKey:"name",value:be(a,B.Source,{extended:!0})},{columnKey:"kind",value:a.kind,textColor:n.text.info},{columnKey:"namespace",value:a.namespace,textColor:n.text.info},{columnKey:"throughput",value:je(Et(t,B.Source,i).throughput),textColor:n.text.info},{columnKey:"conditions",component:()=>e.createElement(wi,{conditions:a.conditions||[],id:o})},{columnKey:"containers",component:()=>e.createElement("div",{style:{lineHeight:1}},e.createElement(ce,{status:W.Info,title:sa(a.containers),withBorder:!0}))}]}}),[T,y,t,I]),{badge:M,badgeTooltip:R}=l(()=>T.length!==w.length?{badge:`${T.length}/${w.length}`,badgeTooltip:m.FILTERED_COUNT_TOOLTIP}:{badge:w.length,badgeTooltip:void 0},[T,w]);return e.createElement(xe,{$maxWidth:i},e.createElement($e,null,e.createElement(b,{partiallyChecked:D&&T?.length!==N,value:D&&T?.length===N,onChange:F,disabled:!T?.length}),e.createElement(Ce,{icon:Se(B.Source),title:m.SOURCES,badge:M,badgeTooltip:R,loading:p||f})),e.createElement(ke,{$maxHeight:a},e.createElement(we,{columns:Rl(o),rows:A})),f&&!A.length?e.createElement(Te,{style:{marginTop:"2rem",gap:"24px"}},e.createElement(Ne,{width:420}),e.createElement(de,{$gap:16},e.createElement(E,{color:n.text.info},x?"Instrumenting":"Uninstrumenting"," workloads..."),e.createElement(Ee,{label:`${k}%`}))):A.length?null:e.createElement(Te,{style:{marginTop:"2rem"}},e.createElement(De,null)))},Pl=({expiresAt:t})=>{const a=O.useTheme(),{formatTimeAgo:i}=Ht(),n=i(t),o=new Date(t).toDateString().split(" ").slice(1).join(" "),l=ca(t,0)?a.text.error:ca(t,6048e5)?a.text.warning:a.text.success;return e.createElement(E,{size:14,color:l},n," (",o,")")},Kl=d.div`
|
|
487
487
|
position: relative;
|
|
488
|
-
`,
|
|
488
|
+
`,jl=({token:a,saveToken:i})=>{const{CopyButton:n}=da(),{formData:o,handleFormChange:l,resetFormData:r}=ua({token:a}),[s,c]=t(!1),d=()=>{c(!1),r()};return e.createElement(de,{$gap:0},e.createElement(n,{value:a,size:pa.L}),e.createElement(re,{orientation:"vertical",length:"12px"}),e.createElement(Kl,null,e.createElement(mt,{size:32,onClick:()=>{c(!0)}},e.createElement($a,null)),s&&e.createElement(ma,{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($,{placeholder:"API Token",type:"password",value:o.token,onChange:e=>l("token",e.target.value)}))))},Vl=({tokens:t,saveToken:a})=>e.createElement(X,{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:qa},{columnKey:"name",value:t},{columnKey:"token",value:`${new Array(15).fill("•").join("")}`},{columnKey:"expires_at",component:()=>e.createElement(Pl,{expiresAt:n})},{columnKey:"actions",component:()=>e.createElement(jl,{token:i,saveToken:a})}]}))}}]}),ql=({fetchDescribeOdigos:i})=>{const[n,o]=t(null);if(a(()=>{i().then(({data:e})=>{o(e?.describeOdigos||null)})},[i]),!n)return e.createElement(Te,null,e.createElement(Le,null));const l=t=>t?.name?[e.createElement(re,{key:`divider-${t.name}`}),e.createElement(Zt,{key:`describe-row-${t.name}`,title:t.name,subTitle:t.explain||void 0,value:{status:t.status||(ea(t.value)?ta(t.value)?W.Success:W.Error:W.Default),text:t.value}})]:[];return e.createElement(e.Fragment,null,e.createElement(X,{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(X,{title:"Cluster Collector",withExtend:!0},Object.values(n?.clusterCollector||{}).map(l)),e.createElement(X,{title:"Node Collector",withExtend:!0},Object.values(n?.nodeCollector||{}).map(l)))},zl=d.div`
|
|
489
489
|
display: flex;
|
|
490
490
|
flex-direction: column;
|
|
491
491
|
gap: 12px;
|
|
492
|
-
`,
|
|
492
|
+
`,Hl="System Overview",Bl=({tokens:a,saveToken:i,fetchDescribeOdigos:n})=>{const[o,l]=t(!1),r=()=>l(e=>!e);return e.createElement(e.Fragment,null,e.createElement(mt,{key:Hl,onClick:r,tooltip:Hl},e.createElement(za,{size:18})),e.createElement(q,{width:"750px",isOpen:o,onClose:r,header:{icons:[za],title:Hl},footer:{isOpen:!1}},e.createElement(zl,null,!!a?.length&&e.createElement(Vl,{tokens:a,saveToken:i}),e.createElement(ql,{fetchDescribeOdigos:n}))))},Wl=d.div`
|
|
493
493
|
position: fixed;
|
|
494
494
|
bottom: 12px;
|
|
495
495
|
left: 12px;
|
|
@@ -498,7 +498,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
498
498
|
flex-direction: column-reverse;
|
|
499
499
|
gap: 6px;
|
|
500
500
|
max-width: 600px;
|
|
501
|
-
`,
|
|
501
|
+
`,_l=()=>{const{notifications:t,markAsDismissed:a,markAsSeen:i}=P(),{onClickNotification:n}=Bt();return e.createElement(Wl,null,t.filter(({dismissed:e})=>!e).map(({id:t,type:o,title:l,message:r,crdType:s,target:c})=>e.createElement(ne,{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})})))},Ul=d.div`
|
|
502
502
|
position: relative;
|
|
503
503
|
display: flex;
|
|
504
504
|
align-items: center;
|
|
@@ -517,7 +517,7 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
517
517
|
stroke: ${({theme:e})=>e.text.secondary};
|
|
518
518
|
}
|
|
519
519
|
}
|
|
520
|
-
`,
|
|
520
|
+
`,Jl=d.div`
|
|
521
521
|
position: absolute;
|
|
522
522
|
top: 2px;
|
|
523
523
|
left: ${({$darkMode:e})=>e?"2px":"calc(100% - 2px - 24px)"};
|
|
@@ -527,50 +527,50 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
527
527
|
background-color: ${({theme:e})=>e.colors.border};
|
|
528
528
|
border-radius: 100%;
|
|
529
529
|
transition: all 0.3s;
|
|
530
|
-
`,
|
|
530
|
+
`,Gl=({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})),Yl=()=>{const{darkMode:t,setDarkMode:a}=ha();return e.createElement(Ul,{onClick:()=>a(!t)},e.createElement(Gl,{path:"M14 7.977A4.333 4.333 0 1 1 8.023 2H8a6 6 0 1 0 6 6v-.023Z"}),e.createElement(Gl,{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(Jl,{$darkMode:t}))},Xl=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)},Zl=(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},Ql=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},er=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:ga(o)}),s.push({title:"Start time",value:new Date(l/1e3).toLocaleString()}),r.length&&(s.push({type:h.Divider}),s.push({title:"Warnings",titleIcon:Ha,value:r})),s},tr=(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},ar=d.div`
|
|
531
531
|
display: flex;
|
|
532
532
|
flex-direction: column;
|
|
533
533
|
gap: 12px;
|
|
534
534
|
max-height: 100vh;
|
|
535
535
|
overflow-y: auto;
|
|
536
|
-
`,
|
|
536
|
+
`,ir=({span:a,process:i,onClose:n})=>{const[o,l]=t(!0),[r,s]=t(!0);return e.createElement(q,{width:"750px",isOpen:!0,onClose:n,header:{icons:[Ba],title:a.operationName},footer:{isOpen:!1}},e.createElement(ar,null,e.createElement(X,{title:"Details",data:er(a)}),a.logs.length>0&&e.createElement(X,{title:"Errors",titleBadge:a.logs.length,titleIcon:Ha,data:Ql(a)}),e.createElement(X,{title:"Tags",data:Zl(a,o),action:e.createElement(ya,{isPrettyMode:o,setIsPrettyMode:l})}),i&&e.createElement(X,{title:`Process (${i.serviceName})`,data:tr(i,r),action:e.createElement(ya,{isPrettyMode:r,setIsPrettyMode:s})})))},nr=370,or=["#33DCA7","#50F6E8","#444AD9","#8B55FF","#FF7CA9"].reverse(),lr=d.div`
|
|
537
537
|
display: flex;
|
|
538
538
|
align-items: center;
|
|
539
|
-
width: ${
|
|
540
|
-
background-color: ${({$withErrors:e,theme:t})=>e?t.colors.error+
|
|
539
|
+
width: ${nr}px;
|
|
540
|
+
background-color: ${({$withErrors:e,theme:t})=>e?t.colors.error+O.opacity.hex["042"]:t.colors.dark_grey};
|
|
541
541
|
&:hover {
|
|
542
|
-
${({$withErrors:e,$preventHover:t,theme:a})=>!t&&`background-color: ${e?a.colors.error:a.colors.secondary+
|
|
542
|
+
${({$withErrors:e,$preventHover:t,theme:a})=>!t&&`background-color: ${e?a.colors.error:a.colors.secondary+O.opacity.hex["010"]};`}
|
|
543
543
|
cursor: ${({$preventHover:e})=>e?"default":"pointer"};
|
|
544
544
|
}
|
|
545
|
-
`,
|
|
545
|
+
`,rr=d(de)`
|
|
546
546
|
align-items: center;
|
|
547
547
|
justify-content: space-between;
|
|
548
548
|
gap: 4px;
|
|
549
549
|
padding: 12px;
|
|
550
550
|
padding-left: ${({$depth:e})=>12*e||12}px;
|
|
551
|
-
width: calc(${
|
|
552
|
-
`,
|
|
551
|
+
width: calc(${nr}px - ${({$depth:e})=>12*e}px);
|
|
552
|
+
`,sr=d(de)`
|
|
553
553
|
align-items: center;
|
|
554
554
|
gap: 4px;
|
|
555
555
|
position: absolute;
|
|
556
556
|
right: 56px;
|
|
557
557
|
width: calc(100% - ${434}px);
|
|
558
|
-
`,
|
|
558
|
+
`,cr=d.div`
|
|
559
559
|
position: absolute;
|
|
560
560
|
left: ${({$startTime:e,$minStartTime:t,$maxEndTime:a})=>(e-t)/(a-t)*100+"%"};
|
|
561
561
|
width: ${({$duration:e,$maxDuration:t})=>e/t*100+"%"};
|
|
562
562
|
height: 12px;
|
|
563
563
|
border-radius: 32px;
|
|
564
|
-
background-color: ${({$indexInMatrix:e})=>
|
|
565
|
-
`,
|
|
564
|
+
background-color: ${({$indexInMatrix:e})=>or[e%or.length]};
|
|
565
|
+
`,dr=d(E)`
|
|
566
566
|
padding-left: calc(100% + 8px);
|
|
567
567
|
font-size: 10px;
|
|
568
568
|
color: ${({theme:e})=>e.text.darker_grey};
|
|
569
569
|
font-family: ${({theme:e})=>e.font_family.secondary};
|
|
570
570
|
white-space: nowrap;
|
|
571
|
-
`,
|
|
571
|
+
`,ur=({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=nr-12*i-20-(s?12:0),b=s&&(1===i||a.logs.length>0);return e.createElement(lr,{className:"span-container",$withErrors:s,$preventHover:g,onClick:m},e.createElement(rr,{$depth:i,className:"span-left"},e.createElement(de,{$gap:4,$alignItems:"center"},u?e.createElement("div",{onMouseEnter:()=>y(!0),onMouseLeave:()=>y(!1)},e.createElement(mt,{onClick:e=>{e.stopPropagation(),p?.()},size:24},e.createElement(ht,{extend:d??!1}))):e.createElement("div",{style:{width:"24px"}}),e.createElement(ba,{maxWidth:v/2,text:a.processID,textSize:14}),e.createElement(E,{size:12,color:h.text.darker_grey},"•"),e.createElement(ba,{maxWidth:v/2,text:a.operationName,textSize:12,textColor:h.text.darker_grey})),s&&(b?e.createElement(pe,{...c},e.createElement(Ha,{fill:h.text.error})):e.createElement("div",{style:{position:"relative"}},e.createElement("div",{style:{position:"absolute",top:"-24px",right:"8px"}},e.createElement(re,{type:W.Error,orientation:"vertical",thickness:1,length:"48px",margin:"0",opacity:.5}))))),e.createElement(sr,{className:"span-right"},e.createElement(cr,{$indexInMatrix:n,$duration:a.duration,$maxDuration:o,$startTime:a.startTime,$minStartTime:l,$maxEndTime:r},e.createElement(dr,null,ga(a.duration)))))},pr=({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:va(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(ur,{span:t,depth:i,indexInMatrix:n+u+i,maxDuration:o,minStartTime:l,maxEndTime:r,withErrors:y,errorTooltip:{titleIcon:Ha,title:v,text:b},isOpen:m,withToggle:h,onToggleOpen:()=>s.set(e=>e.some(e=>e===p)?e.filter(e=>e!=p):[...e,p,...va(t,"spans","spanID")]),onSelect:()=>c.set(e=>e?.spanID===p?null:t)}),m&&h?e.createElement(pr,{spans:t.spans||[],logs:g,depth:i+1,indexInMatrix:n+u,maxDuration:o,minStartTime:l,maxEndTime:r,openSpanIdsState:s,selectedSpanState:c}):null)})},mr=d.div`
|
|
572
572
|
width: 100%;
|
|
573
|
-
`,
|
|
573
|
+
`,hr=d.div`
|
|
574
574
|
max-height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px + 2px)`};
|
|
575
575
|
overflow: auto;
|
|
576
576
|
|
|
@@ -580,22 +580,22 @@ import e,{useState as t,useEffect as a,forwardRef as i,useRef as n,useImperative
|
|
|
580
580
|
border-radius: 24px;
|
|
581
581
|
border: 1px solid ${({theme:e})=>e.colors.dropdown_bg_2};
|
|
582
582
|
position: relative;
|
|
583
|
-
`,
|
|
583
|
+
`,gr=d.div`
|
|
584
584
|
padding: 12px 12px 12px 24px;
|
|
585
|
-
width: calc(${
|
|
585
|
+
width: calc(${nr}px - 36px);
|
|
586
586
|
background-color: ${({theme:e})=>e.colors.dark_grey};
|
|
587
|
-
`,
|
|
587
|
+
`,yr=d.div`
|
|
588
588
|
width: 1px;
|
|
589
589
|
height: ${({$heightToRemove:e})=>`calc(100vh - ${e}px + 2px)`};
|
|
590
590
|
background: ${({theme:e})=>`linear-gradient(to bottom, ${e.colors.border}, transparent)`};
|
|
591
591
|
|
|
592
592
|
position: absolute;
|
|
593
|
-
left: calc(${
|
|
594
|
-
`,
|
|
593
|
+
left: calc(${nr}px + ((100% - ${nr}px) / ${5}) * ${({index:e})=>e});
|
|
594
|
+
`,vr=d(E)`
|
|
595
595
|
color: ${({theme:e})=>e.text.darker_grey};
|
|
596
596
|
font-size: 12px;
|
|
597
597
|
font-family: ${({theme:e})=>e.font_family.secondary};
|
|
598
598
|
padding-top: 12px;
|
|
599
599
|
padding-left: 12px;
|
|
600
600
|
white-space: nowrap;
|
|
601
|
-
`,
|
|
601
|
+
`,br=({heightToRemove:a,traces:i,isLoading:n})=>{const[o,r]=t([]),[s,c]=t(null),d=l(()=>Tt(i).sort((e,t)=>t.spans[0].startTime-e.spans[0].startTime).map(e=>({...e,spans:Xl(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(mr,{$heightToRemove:a},n?e.createElement(Te,{$height:"50vh"},e.createElement(Le,{scale:1.5})):d.length?e.createElement(hr,{$heightToRemove:a},e.createElement(gr,null,e.createElement(E,null,"Service & operation")),new Array(5).fill(null).map((t,i)=>e.createElement(yr,{key:`${i}-divider`,$heightToRemove:a,index:i},e.createElement(vr,null,ga(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(pr,{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(Te,{$height:"50vh"},e.createElement(De,{title:m.NO_TRACES_FOUND,subTitle:m.ARE_SERVICES_INSTRUMENTED_AND_PRODUCING_TRAFFIC}))),s&&e.createElement(ir,{span:s,process:p,onClose:()=>c(null)}))};export{$i as ActionDrawer,yi as ActionForm,Si as ActionModal,Ei as ActionTable,Mi as AwaitPipeline,tn as ConditionDropdown,Yi as DataFlow,Dn as DataFlowActionsMenu,vn as DataStreamDrawer,gn as DataStreamForm,En as DataStreamModal,Nn as DataStreamSelectionForm,zn as DestinationDrawer,jn as DestinationForm,ro as DestinationModal,mo as DestinationSelectionForm,go as DestinationTable,an as ErrorDropdown,Fo as InstrumentationRuleDrawer,No as InstrumentationRuleForm,Mo as InstrumentationRuleModal,Po as InstrumentationRuleTable,rn as KindDropdown,nn as LanguageDropdown,on as MonitorDropdown,jo as MultiSourceControl,ln as NamespaceDropdown,yl as NavIconIds,Wo as NotificationManager,vi as OverviewDrawer,al as ServiceMap,gl as SetupSummary,vl as SideNav,bl as SlackInvite,Fl as SourceDrawer,$l as SourceForm,Ml as SourceModal,Al as SourceSelectionForm,Ll as SourceTable,Bl as SystemOverview,wi as TableCellConditions,_l as ToastList,Yl as ToggleDarkMode,br as TraceView};
|