@odigos/ui-kit 0.0.255 → 0.0.256
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/lib/chunks/{connections-scope-DATTj_XG.js → connections-scope-D_2Q866B.js} +1 -1
- package/lib/chunks/{source-instrument-form-context-DY-QjJ0l.js → source-instrument-form-context-DaQkZ03_.js} +1 -1
- package/lib/chunks/{use-odigos-api-FiChYL7A.js → use-odigos-api-BMcghWbA.js} +1 -1
- package/lib/containers/v2.js +2 -2
- package/lib/containers.js +1 -1
- package/lib/contexts/odigos-api/hooks/use-snapshots-api.d.ts +3 -0
- package/lib/contexts/odigos-api.js +1 -1
- package/lib/contexts.js +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.0.256](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.255...ui-kit-v0.0.256) (2026-06-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **drawers:** refetch data on drawer open ([#1022](https://github.com/odigos-io/ui-kit/issues/1022)) ([58df7fc](https://github.com/odigos-io/ui-kit/commit/58df7fc665cee5752c4df5d9076ca1d00a01588a))
|
|
9
|
+
|
|
3
10
|
## [0.0.255](https://github.com/odigos-io/ui-kit/compare/ui-kit-v0.0.254...ui-kit-v0.0.255) (2026-06-22)
|
|
4
11
|
|
|
5
12
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as o}from"react/jsx-runtime";import{useMemo as n}from"react";import{e as t,_ as e}from"./use-odigos-api-
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{useMemo as n}from"react";import{e as t,_ as e}from"./use-odigos-api-BMcghWbA.js";const r=({connectionIds:r,children:i})=>{const s=t(),a=n(()=>({operations:s.operations,context:{...s.context,connectionIds:r},apolloConfig:s.apolloConfig}),[s.operations,s.context,s.apolloConfig,r.join(",")]);return o(e.Provider,{value:a,children:i})};export{r as O};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as n,useContext as r,createContext as s,useRef as o,useEffect as i}from"react";import{d as l,e as d,A as c,f as u,g as m,i as p,F as h,h as f,j as g,D as v,m as b,S as y,s as D,k as E,l as S,I as k,H as C,C as A,G as F,J as I,n as w,K as N,T as x,E as R}from"./ui-components-B1TCLO_N.js";import{d as P}from"./use-odigos-api-FiChYL7A.js";import{n as T,m as O,i as L,b as M,a as U,d as j,v as K,g as G,u as V}from"./helpers-CUmUiA_l.js";const _={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},q=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(n=a)?!n.trim():p(n));var n}),Q=({children:r})=>{const[s,o]=t(null),i=l(_),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a(e=>{var t;i.resetFormData((({type:e,name:t,notes:a,disabled:n,signals:r,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!n,signals:r??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o((t=e.type,c.find(e=>e.type===t)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(_)};const e=(e=>{const t=d(e),a=t.fields||{},n=a[u.UrlTemplatizationRulesGroups];n?.length&&(a[u.UrlTemplatizationRulesGroups]=n.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const r=a[u.AttributeNamesToDelete];r?.length&&(a[u.AttributeNamesToDelete]=r.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const n={},r=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(r[u.CollectContainerAttributes]||r[u.CollectReplicaSetAttributes]||r[u.CollectWorkloadId]||r[u.CollectClusterId]),t=!r[u.LabelsAttributes]?.length,a=!r[u.AnnotationsAttributes]?.length;e&&t&&a&&(n[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=r[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(n[u.LabelsAttributes]=H);const o=r[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(n[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=r[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(n[u.ClusterAttributes]=H):n[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=r[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(n[u.AttributeNamesToDelete]=H):n[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(r[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(n[u.Renames]=H):n[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=r[u.PiiCategories];e?.length||(n[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=r[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(n[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=r[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))n[u.ExtractAttribute]="Each row needs a target attribute name and either a regex or both lookup key and data format";else{const t=new Set;e.some(e=>{const a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(n[u.ExtractAttribute]="Each new span attribute name must be unique")}else n[u.ExtractAttribute]=t.length?H:z;break}}return n})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=n(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(q.Provider,{value:b,children:r})},W=()=>{const e=r(q);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:r,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,D]=t(null),E=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),D(null),E.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const n=i.find(e=>e.name===a.name&&e.name!==m);if(n)return E.current=e,void D({preparedFormData:a,existingName:n.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=E.current,t=y?.preparedFormData;E.current=null,D(null),e&&t&&await e(t)},[y]),I=a(()=>{E.current=null,D(null)},[]),w=n(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:r})},Y=()=>{const e=r(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:r,initialValue:s,renderCondition:o}=e,i=a===S.Dropdown,l=D(n,{});return{componentType:a,renderCondition:o,name:t,title:r,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),ne=({children:r})=>{const{selectedStreamName:s}=f(),{items:o}=P().destinationsApi.useDestinations(),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),S=n(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),k=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:v.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),C=a((e,t,a)=>{c&&(g(a=>a.map((a,n)=>n===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:v.UNSAVED}:null:null))},[c]),A=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),F=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(S)return void F.resetFormData({...S.formData});if(c.listType===v.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void F.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,disabled:!!e.disabled,exportedSignals:{logs:!!e.exportedSignals?.logs,metrics:!!e.exportedSignals?.metrics,traces:!!e.exportedSignals?.traces,profiles:!!e.exportedSignals?.profiles},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})}const e=b(c.option.supportedSignals);F.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,disabled:!1,exportedSignals:{logs:e.includes(y.Logs),metrics:e.includes(y.Metrics),traces:e.includes(y.Traces),profiles:e.includes(y.Profiles)},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})},[c,S]);const I=a(e=>{F.resetFormData(),F.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),w=a((e,t)=>{let a;for(const n of t){const t=n.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const n=D(e.fields,{}),r={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:n[e.name]??e.initialValue})):[]},s=ae(r.fields);u({listType:v.EXISTS,option:r,dynamicFields:s})},[]),N=a(()=>{const e=d(F.formData),t={};c?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;p(n)&&(t[a]=h.FIELD_IS_REQUIRED)}});return E(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),F.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[F,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:I,loadDestination:w,genericForm:F,validateFormData:N,unsavedDestinations:m,thisUnsavedDestination:S,setUnsavedDestinations:g,addUnsavedDestination:k,updateUnsavedDestination:C,deleteUnsavedDestination:A},children:r})},re=()=>r(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:O(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:r,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:n,instrumentationLibraries:r,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:T(n),workloads:null,instrumentationLibraries:r??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,k.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[C.HeaderKeys]?.length&&(a.headersCollection[C.HeaderKeys]=a.headersCollection[C.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[A.Golang]?.length&&(a.customInstrumentations[A.Golang]=a.customInstrumentations[A.Golang].map(e=>new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>{return t=e,!!(t.packageName?.trim()||t.functionName?.trim()||t.receiverName?.trim()||t.receiverMethodName?.trim());var t})),a.customInstrumentations?.[A.Java]?.length&&(a.customInstrumentations[A.Java]=a.customInstrumentations[A.Java].map(e=>new I(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case w.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case w.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case w.HeadersCollection:t.headersCollection?.[C.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case w.CustomInstrumentation:{const e=t.customInstrumentations?.[A.Golang]||[],n=t.customInstrumentations?.[A.Java]||[];if(!e.length&&!n.length){a.customInstrumentations="Custom instrumentation are required";break}const r=e.findIndex(e=>!new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==r){a.customInstrumentations=`Golang probe #${r+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=n.findIndex(e=>!new I(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=n(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:r})},le=()=>{const e=r(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:r,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(G(r)),[p,h]=t(null);i(()=>{m(G(r)),h(null)},[r]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(G(r)),h(null)},[r,m]),v=n(()=>({formType:de.Create,category:r,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[r,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:r,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{r!==v.current&&(v.current=r,r&&s?(g(K(r)),y(null),p(!0)):(p(!1),y(null)))},[r,s]);const D=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),E=a(()=>{r&&(g(K(r)),y(null),p(!0))},[r,g]),S=a(()=>{p(!1),y(null)},[]),k=n(()=>({formType:de.View,data:r,isEditing:m,formData:h,handleChange:D,handleEdit:E,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[r,m,h,D,E,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,r]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{r(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=n(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:r,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:r})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=n(()=>M(s?{disabled:!1}:null),[s]),d=n(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:r})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function De(e){const t=r(ce);if(!t)throw new Error("useSamplingRulesFormContext must be used within a SamplingRulesFormProvider");if(e&&t.formType!==e)throw new Error(`Expected formType "${e}" but found "${t.formType}"`);return t}const Ee={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:r})=>{const[s,o]=t(void 0),i=l(Ee),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=n(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:r})},Ce=()=>{const e=r(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([N.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:n}=Fe(e);return t||a||n}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=(e,t,a)=>{const n=[];return t.workloads.forEach(r=>{const s=e?.workloads.find(e=>e.name===r.name&&e.kind===r.kind);r.selected!==s?.selected&&n.push({namespace:t.name,name:r.name,kind:r.kind,selected:r.selected||!1,currentStreamName:a})}),n},Re=({children:r,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=V(),c=l===x.Onprem,{capabilities:u}=P(),m=u.canInstrumentNamespaces,{selectedStreamName:p}=f(),[h,g]=t(!1),[v,b]=t(null),[y,D]=t([]);i(()=>{v&&D(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(v,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return n})})},[v,s,o]);const{formDiff:E,isFormDirty:S}=n(()=>{const e=((e,t,a,n)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(s=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===s.name);if(!n){const t=xe(o,s,a);return void(t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t)))}const i=s.selected||!1;if(i!==o?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:s.name,selected:i,currentStreamName:a}),i?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==s.name||e.namespace===s.name&&(!e.name||!e.kind)):s.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:s.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=xe(o,s,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(y,v?.clusters||[],p,m);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[y,v,p,m]),k=a(e=>!c&&Ae.has(e),[c]),C=a(({clusterId:e,workloadId:t,selected:a,auto:n})=>{D(r=>{const s=d(r),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const n="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=n,m)if(n){s[o].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else if(m){const e="boolean"==typeof n?n:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}else{const e="boolean"==typeof a?a:"boolean"!=typeof n||n;s[o].namespaces[i].workloads.forEach(t=>{e&&k(t.kind)||(t.selected=e)})}return s})},[k,m]),A=a(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:r="",filters:s})=>{D(o=>{const i=d(o),l=r===R.Namespace?n:"",c=r===R.Source?n:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((n,r)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},o)=>{if(!t||e===t)if(u)if(t){if(n.forEach((e,t)=>{a&&k(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[r].namespaces[o].workloads[t].selected=a)}),m){const e=i[r].namespaces[o].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);i[r].namespaces[o].selected=e}}else{if(!Ie(i[r].namespaces[o],l,s||{showOnlySelected:!1}))return;m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})}else m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})})}),i})},[k,m]);return e(Ne.Provider,{value:{snapshots:v,setSnapshots:b,isFetching:h,setIsFetching:g,formData:y,handleSourceChange:C,handleSelectAll:A,formDiff:E,isFormDirty:S},children:r})},Pe=()=>r(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,ne as a,ye as b,ke as c,Re as d,Y as e,re as f,le as g,De as h,Ce as i,Pe as j,we as k,Ie as l,Fe as m,W as u};
|
|
1
|
+
import{jsx as e}from"react/jsx-runtime";import{useState as t,useCallback as a,useMemo as n,useContext as r,createContext as s,useRef as o,useEffect as i}from"react";import{d as l,e as d,A as c,f as u,g as m,i as p,F as h,h as f,j as g,D as v,m as b,S as y,s as D,k as E,l as S,I as k,H as C,C as A,G as F,J as I,n as w,K as N,T as x,E as R}from"./ui-components-B1TCLO_N.js";import{d as P}from"./use-odigos-api-BMcghWbA.js";import{n as T,m as O,i as L,b as M,a as U,d as j,v as K,g as G,u as V}from"./helpers-CUmUiA_l.js";const _={type:"",disabled:!1,name:"",notes:"",signals:[],fields:{}},q=s(null),H="All row fields are required",z="At least one row is required",J=(e,t)=>!!e&&t.every(t=>{const a=e[t];return Array.isArray(a)?a.length>0:!("string"==typeof(n=a)?!n.trim():p(n));var n}),Q=({children:r})=>{const[s,o]=t(null),i=l(_),f=a(e=>{i.resetFormData(),i.handleErrorChange(void 0,void 0,{}),e?.type&&i.handleFormChange("type",e.type),o(e)},[]),g=a(e=>{var t;i.resetFormData((({type:e,name:t,notes:a,disabled:n,signals:r,fields:s})=>({type:e,name:t||"",notes:a||"",disabled:!!n,signals:r??[],fields:s??{}}))(e)),i.handleErrorChange(void 0,void 0,{}),o((t=e.type,c.find(e=>e.type===t)??null))},[]),v=a(()=>{if(!s)return{errorMessage:"No action type selected",preparedFormData:d(_)};const e=(e=>{const t=d(e),a=t.fields||{},n=a[u.UrlTemplatizationRulesGroups];n?.length&&(a[u.UrlTemplatizationRulesGroups]=n.map(e=>({...e,templatizationRules:(e.templatizationRules||[]).filter(e=>!!e.template?.trim())})));const r=a[u.AttributeNamesToDelete];r?.length&&(a[u.AttributeNamesToDelete]=r.filter(e=>!!e?.trim()));const s=a[u.Renames];s&&(a[u.Renames]=Object.fromEntries(Object.entries(s).filter(([e,t])=>!!e?.trim()&&!!t?.trim())));const o=a[u.ExtractAttribute];return o?.extractions?.length&&(a[u.ExtractAttribute]={extractions:o.extractions.map(e=>({targetAttributeName:e.targetAttributeName?.trim()||"",lookupKey:e.lookupKey?.trim()||"",dataFormat:e.dataFormat||"",regex:e.regex?.trim()||""})).filter(e=>!!(e.targetAttributeName||e.lookupKey||e.dataFormat||e.regex))}),t.fields=a,t})(i.formData),t={};p(e.signals)&&(t.signals=h.FIELD_IS_REQUIRED),s.type&&Object.assign(t,((e,t,a)=>{const n={},r=t.fields||{},s=a.fields||{};switch(e){case m.K8sAttributes:{const e=!(r[u.CollectContainerAttributes]||r[u.CollectReplicaSetAttributes]||r[u.CollectWorkloadId]||r[u.CollectClusterId]),t=!r[u.LabelsAttributes]?.length,a=!r[u.AnnotationsAttributes]?.length;e&&t&&a&&(n[u.CollectContainerAttributes]="Enable at least one option or add a label/annotation row");const s=r[u.LabelsAttributes];s?.some(e=>!J(e,["labelKey","attributeKey","fromSources"]))&&(n[u.LabelsAttributes]=H);const o=r[u.AnnotationsAttributes];o?.some(e=>!J(e,["annotationKey","attributeKey","fromSources"]))&&(n[u.AnnotationsAttributes]=H);break}case m.AddClusterInfo:{const e=r[u.ClusterAttributes];e?.length?e.some(e=>!J(e,["attributeName","attributeStringValue"]))&&(n[u.ClusterAttributes]=H):n[u.ClusterAttributes]=z;break}case m.DeleteAttributes:{const e=s[u.AttributeNamesToDelete]||[],t=r[u.AttributeNamesToDelete]||[];t.length?e.length>t.length&&(n[u.AttributeNamesToDelete]=H):n[u.AttributeNamesToDelete]=e.length?H:z;break}case m.RenameAttributes:{const e=Object.entries(s[u.Renames]||{}),t=Object.entries(r[u.Renames]||{}),a=e.some(([e,t])=>!e?.trim()||!t?.trim());t.length?a&&(n[u.Renames]=H):n[u.Renames]=e.length?H:z;break}case m.PiiMasking:{const e=r[u.PiiCategories];e?.length||(n[u.PiiCategories]="Select at least one attribute to mask");break}case m.URLTemplatization:{const e=r[u.UrlTemplatizationRulesGroups];(!e?.length||e.some(e=>!e.templatizationRules?.length))&&(n[u.UrlTemplatizationRulesGroups]="Each rule group needs at least one non-blank template");break}case m.ExtractAttribute:{const e=r[u.ExtractAttribute]?.extractions||[],t=s[u.ExtractAttribute]?.extractions||[];if(e.length)if(e.some(e=>{if(!e.targetAttributeName?.trim())return!0;const t=!!e.regex?.trim(),a=!!e.lookupKey?.trim();return a!==!!e.dataFormat||t===a}))n[u.ExtractAttribute]="Each row needs a target attribute name and either a regex or both lookup key and data format";else{const t=new Set;e.some(e=>{const a=e.targetAttributeName?.trim()||"";return!!t.has(a)||(t.add(a),!1)})&&(n[u.ExtractAttribute]="Each new span attribute name must be unique")}else n[u.ExtractAttribute]=t.length?H:z;break}}return n})(s.type,e,i.formData)),i.handleErrorChange(void 0,void 0,t);return{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[i,s]),b=n(()=>({selectedOption:s,onSelectOption:f,loadAction:g,genericForm:i,validateFormData:v}),[s,f,g,i,v]);return e(q.Provider,{value:b,children:r})},W=()=>{const e=r(q);if(!e)throw new Error("useActionFormContext must be used within an ActionFormContextProvider");return e},$={name:""},B=s(null),X=({children:r,defaultExcludeName:s=""})=>{const{dataStreams:i}=f(),[c,u]=t(void 0),[m,p]=t(s),[v,b]=t(void 0),[y,D]=t(null),E=o(null),S=l($),k=a(e=>{S.resetFormData({name:e}),S.handleErrorChange(void 0,void 0,{}),u(void 0),p(e),b(e),D(null),E.current=null},[]),C=a(()=>{const e=d(S.formData),t=(e=>{const t={};return e.name?g(e.name)||(t.name=h.ILLEGAL_K8S_LABEL):t.name=h.FIELD_IS_REQUIRED,t})(e);S.handleErrorChange(void 0,void 0,t);const a=Object.keys(t).length>0?h.REQUIRED_FIELDS:void 0;return u(a),{errorMessage:a,preparedFormData:e}},[S]),A=a(async e=>{const{errorMessage:t,preparedFormData:a}=C();if(t)return;const n=i.find(e=>e.name===a.name&&e.name!==m);if(n)return E.current=e,void D({preparedFormData:a,existingName:n.name,editingName:v});await e(a)},[C,i,m,v]),F=a(async()=>{const e=E.current,t=y?.preparedFormData;E.current=null,D(null),e&&t&&await e(t)},[y]),I=a(()=>{E.current=null,D(null)},[]),w=n(()=>({genericForm:S,loadDataStream:k,editingName:v,validateFormData:C,requestSubmit:A,pendingMerge:y,confirmMerge:F,cancelMerge:I,errorMessage:c,excludeName:m,setExcludeName:p}),[S,k,v,C,A,y,F,I,c,m]);return e(B.Provider,{value:w,children:r})},Y=()=>{const e=r(B);if(!e)throw new Error("useDataStreamFormContext must be used within a DataStreamFormContextProvider");return e},Z={type:"",name:"",currentStreamName:"",disabled:!1,exportedSignals:{logs:!1,metrics:!1,traces:!1,profiles:!1},fields:[]},ee={activeForm:null,onChangeActiveForm:()=>{},loadDestination:()=>{},genericForm:void 0,validateFormData:()=>({isOk:!1,preparedFormData:d(Z)}),unsavedDestinations:[],thisUnsavedDestination:void 0,setUnsavedDestinations:()=>{},addUnsavedDestination:()=>{},updateUnsavedDestination:()=>{},deleteUnsavedDestination:()=>{}},te=s(ee),ae=e=>e.filter(e=>!!e).map(e=>{const{name:t,componentType:a,componentProperties:n,displayName:r,initialValue:s,renderCondition:o}=e,i=a===S.Dropdown,l=D(n,{});return{componentType:a,renderCondition:o,name:t,title:r,value:s,placeholder:l.placeholder||(i?"Select an option":void 0),options:i&&Array.isArray(l.values)?l.values.map(e=>({id:e,label:e})):void 0,...l}}),ne=({children:r})=>{const{selectedStreamName:s}=f(),{items:o}=P().destinationsApi.useDestinations(),[c,u]=t(null),[m,g]=t(ee.unsavedDestinations),S=n(()=>"number"==typeof c?.unsavedIdx?m[c.unsavedIdx]:void 0,[c,m]),k=a((e,t)=>{c&&(g(t=>[...t,{...e,option:c.option}]),u(t?e=>e?{...e,listType:v.UNSAVED,unsavedIdx:m.length}:null:null))},[c,m.length]),C=a((e,t,a)=>{c&&(g(a=>a.map((a,n)=>n===e?{...a,...t,option:c.option}:a)),u(a?e=>e?{...e,listType:v.UNSAVED}:null:null))},[c]),A=a(e=>{g(t=>t.filter((t,a)=>a!==e)),u(null)},[]),F=l({...Z,currentStreamName:s});i(()=>{if(!c)return;if(S)return void F.resetFormData({...S.formData});if(c.listType===v.EXISTS&&c.option.id){const e=o.find(e=>e.id===c.option.id);if(e)return void F.resetFormData({type:e.destinationType.type,name:e.name||e.destinationType.displayName,currentStreamName:s,disabled:!!e.disabled,exportedSignals:{logs:!!e.exportedSignals?.logs,metrics:!!e.exportedSignals?.metrics,traces:!!e.exportedSignals?.traces,profiles:!!e.exportedSignals?.profiles},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})}const e=b(c.option.supportedSignals);F.resetFormData({type:c.option.type,name:c.option.displayName,currentStreamName:s,disabled:!1,exportedSignals:{logs:e.includes(y.Logs),metrics:e.includes(y.Metrics),traces:e.includes(y.Traces),profiles:e.includes(y.Profiles)},fields:c.dynamicFields.map(e=>({key:e.name,value:e.value}))})},[c,S]);const I=a(e=>{F.resetFormData(),F.handleErrorChange(void 0,void 0,{}),u(e?{...e,dynamicFields:e.option?.fields?ae(e.option.fields):[]}:null)},[]),w=a((e,t)=>{let a;for(const n of t){const t=n.items.find(t=>t.type===e.destinationType.type);if(t){a=t;break}}const n=D(e.fields,{}),r={id:e.id,type:e.destinationType.type,displayName:e.name||e.destinationType.displayName,selected:!0,testConnectionSupported:a?.testConnectionSupported??!1,supportedSignals:e.destinationType.supportedSignals,fields:a?a.fields.map(e=>({...e,initialValue:n[e.name]??e.initialValue})):[]},s=ae(r.fields);u({listType:v.EXISTS,option:r,dynamicFields:s})},[]),N=a(()=>{const e=d(F.formData),t={};c?.dynamicFields.forEach(({name:a,required:n})=>{if(n){const n=e.fields.find(e=>e.key===a)?.value;p(n)&&(t[a]=h.FIELD_IS_REQUIRED)}});return E(e.exportedSignals).length||(t.exportedSignals=h.FIELD_IS_REQUIRED),F.handleErrorChange(void 0,void 0,t),{errorMessage:0===Object.keys(t).length?void 0:"Invalid form values",preparedFormData:e}},[F,c]);return e(te.Provider,{value:{activeForm:c,onChangeActiveForm:I,loadDestination:w,genericForm:F,validateFormData:N,unsavedDestinations:m,thisUnsavedDestination:S,setUnsavedDestinations:g,addUnsavedDestination:k,updateUnsavedDestination:C,deleteUnsavedDestination:A},children:r})},re=()=>r(te),se={disabled:!1,ruleName:"",notes:"",sourceScopes:O(),workloads:null,instrumentationLibraries:null,payloadCollection:null,codeAttributes:null,headersCollection:null,customInstrumentations:null},oe=s(null),ie=({children:r,sourceOptions:s=[],namespaceOptions:o=[]})=>{const[i,c]=t(null),u=l(se),m=a(e=>{u.resetFormData(),u.handleErrorChange(void 0,void 0,{}),c(e)},[]),p=a(e=>{var t;u.resetFormData((({ruleName:e,notes:t,disabled:a,sourceScopes:n,instrumentationLibraries:r,payloadCollection:s,codeAttributes:o,headersCollection:i,customInstrumentations:l})=>({ruleName:e||"",notes:t||"",disabled:!!a,sourceScopes:T(n),workloads:null,instrumentationLibraries:r??null,payloadCollection:s??null,codeAttributes:o??null,headersCollection:i??null,customInstrumentations:l??null}))(e)),u.handleErrorChange(void 0,void 0,{}),c((t=e.type,k.find(e=>e.type===t)??null))},[]),h=a(()=>{if(!i)return{errorMessage:"No rule type selected",preparedFormData:d(se)};const e=(e=>{const t=d(e),a={...t,sourceScopes:L(t.sourceScopes)?null:t.sourceScopes,workloads:null};return a.headersCollection?.[C.HeaderKeys]?.length&&(a.headersCollection[C.HeaderKeys]=a.headersCollection[C.HeaderKeys].map(e=>e.trim()).filter(e=>e)),a.customInstrumentations?.[A.Golang]?.length&&(a.customInstrumentations[A.Golang]=a.customInstrumentations[A.Golang].map(e=>new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName)).filter(e=>{return t=e,!!(t.packageName?.trim()||t.functionName?.trim()||t.receiverName?.trim()||t.receiverMethodName?.trim());var t})),a.customInstrumentations?.[A.Java]?.length&&(a.customInstrumentations[A.Java]=a.customInstrumentations[A.Java].map(e=>new I(e.className,e.methodName)).filter(e=>{return t=e,!(!t.className?.trim()&&!t.methodName?.trim());var t})),a})(u.formData),t=((e,t)=>{const a={};switch(e){case w.CodeAttributes:Object.values(t.codeAttributes||{}).some(e=>null!=e)||(a.codeAttributes="Code attributes are required");break;case w.PayloadCollection:Object.values(t.payloadCollection||{}).some(e=>null!=e)||(a.payloadCollection="Payload collection are required");break;case w.HeadersCollection:t.headersCollection?.[C.HeaderKeys]?.length||(a.headersCollection="Header keys are required");break;case w.CustomInstrumentation:{const e=t.customInstrumentations?.[A.Golang]||[],n=t.customInstrumentations?.[A.Java]||[];if(!e.length&&!n.length){a.customInstrumentations="Custom instrumentation are required";break}const r=e.findIndex(e=>!new F(e.packageName,e.functionName,e.receiverName,e.receiverMethodName).Verify());if(-1!==r){a.customInstrumentations=`Golang probe #${r+1} is invalid: provide a package name plus either a function name OR both a receiver name and receiver method name`;break}const s=n.findIndex(e=>!new I(e.className,e.methodName).Verify());if(-1!==s){a.customInstrumentations=`Java probe #${s+1} is invalid: both class name and method name are required`;break}break}}return a})(i.type,e);return u.handleErrorChange(void 0,void 0,t),{errorMessage:Object.keys(t).length>0?"Invalid form values":void 0,preparedFormData:e}},[u,i]),f=n(()=>({selectedOption:i,onSelectOption:m,loadRule:p,genericForm:u,validateFormData:h,sourceOptions:s,namespaceOptions:o}),[i,m,p,u,h,s,o]);return e(oe.Provider,{value:f,children:r})},le=()=>{const e=r(oe);if(!e)throw new Error("useRuleFormContext must be used within a RuleFormContextProvider");return e};var de;!function(e){e.Create="create",e.View="view",e.EditAutoNoisy="edit-auto-noisy",e.EditAutoCostReduction="edit-auto-cost-reduction",e.EditAutoHighlyRelevant="edit-auto-highly-relevant"}(de||(de={}));const ce=s(null),ue=["50","25","10","1"];function me(e){const t=String(e);return ue.includes(t)?t:"custom"}const pe=({category:r,sourceOptions:s=[],namespaceOptions:o=[],children:d})=>{const{formData:c,handleFormChange:u,resetFormData:m}=l(G(r)),[p,h]=t(null);i(()=>{m(G(r)),h(null)},[r]);const f=a(e=>{h(null),u(void 0,void 0,{...c,...e})},[c,u]),g=a(()=>{m(G(r)),h(null)},[r,m]),v=n(()=>({formType:de.Create,category:r,formData:c,handleChange:f,resetForm:g,duplicateWarning:p,setDuplicateWarning:h,sourceOptions:s,namespaceOptions:o}),[r,c,f,g,p,s,o]);return e(ce.Provider,{value:v,children:d})},he=({data:r,defaultEditMode:s,sourceOptions:d=[],namespaceOptions:c=[],children:u})=>{const[m,p]=t(!1),{formData:h,handleFormChange:f,resetFormData:g}=l(void 0),v=o(null),[b,y]=t(null);i(()=>{r!==v.current&&(v.current=r,r&&s?(g(K(r)),y(null),p(!0)):(p(!1),y(null)))},[r,s]);const D=a(e=>{y(null),f(void 0,void 0,{...h,...e})},[h,f]),E=a(()=>{r&&(g(K(r)),y(null),p(!0))},[r,g]),S=a(()=>{p(!1),y(null)},[]),k=n(()=>({formType:de.View,data:r,isEditing:m,formData:h,handleChange:D,handleEdit:E,handleCancelEdit:S,duplicateWarning:b,setDuplicateWarning:y,sourceOptions:d,namespaceOptions:c}),[r,m,h,D,E,S,b,d,c]);return e(ce.Provider,{value:k,children:u})};function fe(e){const[a,r]=t(()=>0===e?"all":"sample"),[s,o]=t(()=>me(e)),[l,d]=t(()=>"custom"===me(e)?String(e):"");i(()=>{r(0===e?"all":"sample");const t=me(e);o(t),d("custom"===t?String(e):"")},[e]);const c=n(()=>"all"===a?0:"custom"===s?Number(l)||0:Number(s),[a,s,l]);return{percentageMode:a,setPercentageMode:r,percentagePreset:s,setPercentagePreset:o,customPercentage:l,setCustomPercentage:d,resolvedPercentage:c}}const ge=({enabled:a,keepPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>j({enabled:o,keepPercentage:d.resolvedPercentage}),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoNoisy,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},ve=({enabled:a,dropPercentage:r,children:s})=>{const[o,l]=t(a),d=fe(r);i(()=>{l(a)},[a]);const c=n(()=>U(o?{disabled:!1,percentageAtMost:d.resolvedPercentage}:null),[o,d.resolvedPercentage]),u=n(()=>({formType:de.EditAutoCostReduction,localEnabled:o,setLocalEnabled:l,...d,summary:c}),[o,d,c]);return e(ce.Provider,{value:u,children:s})},be=({enabled:a,children:r})=>{const[s,o]=t(a);i(()=>{o(a)},[a]);const l=n(()=>M(s?{disabled:!1}:null),[s]),d=n(()=>({formType:de.EditAutoHighlyRelevant,localEnabled:s,setLocalEnabled:o,summary:l}),[s,l]);return e(ce.Provider,{value:d,children:r})},ye=t=>{switch(t.formType){case de.Create:return e(pe,{...t});case de.View:return e(he,{...t});case de.EditAutoNoisy:return e(ge,{...t});case de.EditAutoCostReduction:return e(ve,{...t});case de.EditAutoHighlyRelevant:return e(be,{...t})}};function De(e){const t=r(ce);if(!t)throw new Error("useSamplingRulesFormContext must be used within a SamplingRulesFormProvider");if(e&&t.formType!==e)throw new Error(`Expected formType "${e}" but found "${t.formType}"`);return t}const Ee={otelServiceName:"",currentStreamName:""},Se=s(null),ke=({children:r})=>{const[s,o]=t(void 0),i=l(Ee),c=a(e=>{i.resetFormData((({serviceName:e,id:t})=>({otelServiceName:e||t.name||"",currentStreamName:""}))(e)),i.handleErrorChange(void 0,void 0,{}),o(void 0)},[]),u=a(()=>{const e=d(i.formData);return i.handleErrorChange(void 0,void 0,{}),o(void 0),{errorMessage:void 0,preparedFormData:e}},[i]),m=n(()=>({loadSource:c,genericForm:i,validateFormData:u,errorMessage:s}),[c,i,u,s]);return e(Se.Provider,{value:m,children:r})},Ce=()=>{const e=r(Se);if(!e)throw new Error("useSourceEditFormContext must be used within a SourceEditFormContextProvider");return e},Ae=new Set([N.StaticPod]),Fe=e=>{const t=e.workloads.filter(({selected:e})=>e).length,a=e.workloads.length;return{selectedCount:t,isAllSourced:t>0&&t===a,isSomeSourced:t>0&&t<a,isFutureApps:e.selected||!1}},Ie=(e,t,a)=>{if(t&&!e.name.toLowerCase().includes(t.toLowerCase()))return!1;if(a.showOnlySelected){const{isAllSourced:t,isSomeSourced:a,isFutureApps:n}=Fe(e);return t||a||n}return!0},we=(e,t,a)=>!(t&&!e.name.toLowerCase().includes(t.toLowerCase()))&&(!a.showOnlySelected||e.selected),Ne=s({snapshots:null,setSnapshots:()=>{},isFetching:!1,setIsFetching:()=>{},formData:[],handleSourceChange:()=>{},handleSelectAll:()=>{},formDiff:{},isFormDirty:!1}),xe=(e,t,a)=>{const n=[];return t.workloads.forEach(r=>{const s=e?.workloads.find(e=>e.name===r.name&&e.kind===r.kind);r.selected!==s?.selected&&n.push({namespace:t.name,name:r.name,kind:r.kind,selected:r.selected||!1,currentStreamName:a})}),n},Re=({children:r,selectedConnectionIds:s,initialInputs:o})=>{const{tier:l}=V(),c=l===x.Onprem,{capabilities:u}=P(),m=u.canInstrumentNamespaces,{selectedStreamName:p}=f(),[h,g]=t(!1),[v,b]=t(null),[y,D]=t([]);i(()=>{v&&D(e=>{const t=((e,t)=>d(((e,t)=>e.clusters.filter(({clusterId:e})=>!t||t.includes(e)))(e,t)))(v,s);return t.map(t=>{const a=e?.find(e=>e.clusterId===t.clusterId),n=a??t;if(o?.[t.clusterId]){const e=o[t.clusterId],a=d(n);return e.forEach(e=>{const t=a.namespaces.find(t=>t.name===e.namespace);if(t)if(e.name&&e.kind){const a=t.workloads.find(t=>t.name===e.name&&t.kind===e.kind);a&&(a.selected=e.selected)}else t.selected=e.selected,e.selected&&t.workloads.forEach(e=>{Ae.has(e.kind)&&!c||(e.selected=!0)})}),a}return n})})},[v,s,o]);const{formDiff:E,isFormDirty:S}=n(()=>{const e=((e,t,a,n)=>{const r={};return e.forEach(e=>{e.namespaces.forEach(s=>{const o=t.find(t=>t.clusterId===e.clusterId)?.namespaces.find(e=>e.name===s.name);if(!n){const t=xe(o,s,a);return void(t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t)))}const i=s.selected||!1;if(i!==o?.selected)r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push({namespace:s.name,selected:i,currentStreamName:a}),i?r[e.clusterId]=r[e.clusterId].filter(e=>e.namespace!==s.name||e.namespace===s.name&&(!e.name||!e.kind)):s.workloads.forEach(t=>{t.selected&&r[e.clusterId].push({namespace:s.name,name:t.name,kind:t.kind,selected:!0,currentStreamName:a})});else{const t=xe(o,s,a);t.length>0&&(r[e.clusterId]||(r[e.clusterId]=[]),r[e.clusterId].push(...t))}})}),r})(y,v?.clusters||[],p,m);return{formDiff:e,isFormDirty:Object.keys(e).length>0}},[y,v,p,m]),k=a(e=>!c&&Ae.has(e),[c]),C=a(({clusterId:e,workloadId:t,selected:a,auto:n})=>{D(r=>{const s=d(r),o=s.findIndex(t=>t.clusterId===e);if(-1===o)return s;const i=s[o].namespaces.findIndex(e=>e.name===t.namespace);if(-1===i)return s;if(t.kind&&t.name){const e=s[o].namespaces[i].workloads.findIndex(e=>e.name===t.name&&e.kind===t.kind);if(-1===e)return s;const n="boolean"==typeof a?a:!s[o].namespaces[i].workloads[e].selected;if(s[o].namespaces[i].workloads[e].selected=n,m)if(n){s[o].namespaces[i].workloads.filter(e=>!k(e.kind)).every(e=>e.selected)&&(s[o].namespaces[i].selected=!0)}else s[o].namespaces[i].selected=!1}else if(m){const e="boolean"==typeof n?n:!s[o].namespaces[i].selected;s[o].namespaces[i].selected=e,e?s[o].namespaces[i].workloads.forEach(e=>{k(e.kind)||(e.selected=!0)}):"boolean"!=typeof a||a||s[o].namespaces[i].workloads.forEach(e=>{e.selected=!1})}else{const e="boolean"==typeof a?a:"boolean"!=typeof n||n;s[o].namespaces[i].workloads.forEach(t=>{e&&k(t.kind)||(t.selected=e)})}return s})},[k,m]),A=a(({clusterId:e,namespaceName:t,boolean:a,searchText:n="",searchBy:r="",filters:s})=>{D(o=>{const i=d(o),l=r===R.Namespace?n:"",c=r===R.Source?n:"",u=!!l||!!c||!!s?.showOnlySelected;return i.forEach((n,r)=>{e&&n.clusterId!==e||n.namespaces.forEach(({name:e,workloads:n},o)=>{if(!t||e===t)if(u)if(t){if(n.forEach((e,t)=>{a&&k(e.kind)||we(e,c,s||{showOnlySelected:!1})&&(i[r].namespaces[o].workloads[t].selected=a)}),m){const e=i[r].namespaces[o].workloads.filter(e=>!k(e.kind)).every(e=>e.selected);i[r].namespaces[o].selected=e}}else{if(!Ie(i[r].namespaces[o],l,s||{showOnlySelected:!1}))return;m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})}else m&&(i[r].namespaces[o].selected=a),n.forEach((e,t)=>{a&&k(e.kind)||(i[r].namespaces[o].workloads[t].selected=a)})})}),i})},[k,m]);return e(Ne.Provider,{value:{snapshots:v,setSnapshots:b,isFetching:h,setIsFetching:g,formData:y,handleSourceChange:C,handleSelectAll:A,formDiff:E,isFormDirty:S},children:r})},Pe=()=>r(Ne);export{Q as A,X as D,Ae as E,ie as R,de as S,ne as a,ye as b,ke as c,Re as d,Y as e,re as f,le as g,De as h,Ce as i,Pe as j,we as k,Ie as l,Fe as m,W as u};
|
|
@@ -2,4 +2,4 @@ import{useMemo as e,useContext as t,createContext as r,useCallback as a,useState
|
|
|
2
2
|
query OdigosApiNoop {
|
|
3
3
|
__typename
|
|
4
4
|
}
|
|
5
|
-
`,Z=(e,t)=>{if(e)return"function"==typeof e?e(t):e},ee=(e,t)=>e[t],te=(e,t,r)=>{if(void 0===t)return;return e?.transformResult?e.transformResult(t,r):t},re=(e,t,r)=>{if(!e)return;const a=e.transformVariables;return a?a(t,r):t},ae=(t,r,n)=>{const{operations:o,context:i}=H(),s=ee(o,t),c=e(()=>Z(s?.document,i),[s,i]),d=e(()=>re(s,r,i),[s,r,i]),u=!s||!c,l=!!s?.canRun&&!s.canRun(i),E=n?.skip||u||l,f=T(c??J,{variables:d,skip:E,pollInterval:n?.pollInterval,fetchPolicy:n?.fetchPolicy??"cache-and-network",notifyOnNetworkStatusChange:n?.notifyOnNetworkStatusChange,client:s?.client,onCompleted:n?.onCompleted?e=>{const t=te(s,e,i);void 0!==t&&n.onCompleted(t)}:void 0,onError:n?.onError}),_=e(()=>{if(!E)return te(s,f.data,i)},[s,i,f.data,E]),S=a(async()=>{if(u)return{data:void 0};const e=await f.refetch();return{data:te(s,e.data,i)}},[s,i,f,u]);return{data:_,loading:!E&&f.loading,error:f.error,refetch:S,unsupported:u}},ne=(t,r)=>{const{operations:n,context:o}=H(),i=ee(n,t),s=e(()=>Z(i?.document,o),[i,o]),c=!i||!s,[d,u]=E(s??J,{fetchPolicy:r?.fetchPolicy??"network-only",notifyOnNetworkStatusChange:r?.notifyOnNetworkStatusChange,client:i?.client});return{execute:a(async e=>{if(c)return{error:void 0};if(i?.canRun&&!i.canRun(o))return{data:void 0};const t=re(i,e,o),r=await d({variables:t});return r.error?{error:r.error}:{data:te(i,r.data,o)}},[i,o,d,c]),data:e(()=>te(i,u.data,o),[i,o,u.data]),loading:u.loading,error:u.error,called:u.called,unsupported:c}},oe=(t,r)=>{const{operations:o,context:i}=H(),s=f(),c=ee(o,t),d=e(()=>Z(c?.document,i),[c,i]),u=!c||!d,[l,E]=n({loading:!1,called:!1}),T=a(()=>E({loading:!1,called:!1}),[]);return[a(async e=>{if(u||!d)return{error:void 0};if(c?.canRun&&!c.canRun(i))return{data:void 0};const t=re(c,e,i),a=c?.client??s;E(e=>({...e,loading:!0,called:!0}));try{const e=await a.mutate({mutation:d,variables:t}),n=te(c,e.data,i);if(E({data:n,loading:!1,error:void 0,called:!0}),r?.refetchQueries){const e=a.refetchQueries({include:r.refetchQueries});r?.awaitRefetchQueries&&await e}return void 0!==n&&r?.onCompleted?.(n),{data:n}}catch(e){const t=e;return E({data:void 0,loading:!1,error:t,called:!0}),r?.onError?.(t),{error:t}}},[c,i,s,d,u,r]),{data:l.data,loading:l.loading,error:l.error,called:l.called,unsupported:u,reset:T}]},ie=[],se=(e,t,r,a)=>{let n=!0;const o={sources:[]};for(const[i,s]of Object.entries(e)){if(!s.length)continue;n=!1;const e=s.map(({id:e,selected:t,currentStreamName:a})=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:void 0!==t&&t,currentStreamName:a||r}));let c=0,d=0;for(const r of e){const e=t.find(e=>e.id.namespace===i&&e.id.name===r.name&&e.id.kind===r.kind),a=e?.dataStreamNames||[];r.selected&&!e?c++:!r.selected&&e&&a.length<=1&&d++}a(c,d),o.sources.push(...e)}return{payload:o,isEmpty:n}},ce=(e,t)=>{let r=!0;const a={namespaces:[]};for(const[n,{selected:o,currentStreamName:i}]of Object.entries(e))"boolean"==typeof o&&(r=!1,a.namespaces.push({namespace:n,selected:o,currentStreamName:i||t}));return{payload:a,isEmpty:r}},de={filter:{markedForInstrumentation:!0}},ue=[],le=[],Ee=async e=>{const t=(e=>{try{return new URL("/diagnose/download",e).toString()}catch{return null}})(e.httpUrl);if(t)try{const[r,a]=await Promise.all([Promise.resolve(e.authHeader?.()??{}),Promise.resolve(e.csrfHeader?.()??{})]),n=await fetch(t,{credentials:e.credentials??"same-origin",headers:{...r,...a}});if(!n.ok)throw new Error(`Failed to download diagnose archive: ${n.status} ${n.statusText}`);((e,t)=>{if("undefined"==typeof document)return;const r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)})(await n.blob(),`odigos-diagnose-${Date.now()}.tar.gz`)}catch(e){}},fe=[],Te=[],_e=[],Se=[],ye=(e,t)=>({...e,fields:e.fields.filter(({value:e})=>void 0!==e),currentStreamName:t}),Re=()=>{const{operations:t,context:r}=H(),n=f(),i=((e,t)=>{const r=f(),{notifyError:n,notifySuccess:o,notifyPending:i,notifyReadonly:s}=x(h.Source),{selectedStreamName:c}=P(),{setProgress:d,resetProgress:u}=G(),{setConfiguredSources:l,setConfiguredFutureApps:E}=U(),T=(e,t)=>{const{progress:r}=G.getState();e>0&&d(v.Instrumenting,{total:(r[v.Instrumenting]?.total||0)+e,current:r[v.Instrumenting]?.current||0}),t>0&&d(v.Uninstrumenting,{total:(r[v.Uninstrumenting]?.total||0)+t,current:r[v.Uninstrumenting]?.current||0})},_=a(async()=>{const{error:a}=await Q(r,e.GET_WORKLOADS,de,t);a&&n(C.Read,a)},[r,e.GET_WORKLOADS,t,n]);return{useSources:()=>{const e=ae("GET_WORKLOADS",de,{fetchPolicy:"cache-first"});return{items:e.data?.workloads??ue,loading:e.loading,refetch:_}},fetchAll:_,fetchByTargets:async(a,o)=>{const i=!!o?.slim,s=a.map(e=>D(e,h.Source)).filter(e=>e.namespace&&e.name&&e.kind);if(0===s.length)return;if(s.length>50)return void await _();const c=i&&e.GET_WORKLOADS_BY_IDS_SLIM?e.GET_WORKLOADS_BY_IDS_SLIM:e.GET_WORKLOADS_BY_IDS,{error:d}=await Q(r,c,{ids:s.map(({namespace:e,kind:t,name:r})=>({namespace:e,kind:t,name:r}))},t);d?n(C.Read,d):await _()},fetchById:async a=>{const{data:o,error:i}=await Q(r,e.GET_WORKLOADS_BY_IDS,{ids:[{namespace:a.namespace,kind:a.kind,name:a.name}]},t);if(!i)return await _(),o?.workloadsByIds?.find(e=>e.id.namespace===a.namespace&&e.id.kind===a.kind&&e.id.name===a.name);n(C.Read,i)},fetchLibraries:async a=>Q(r,e.GET_SOURCE_LIBRARIES,a,t),fetchPeerSources:async a=>Q(r,e.GET_PEER_SOURCES,{serviceName:a},t),usePeerSources:(e,t)=>ae("GET_PEER_SOURCES",e,t),persist:async(a,o)=>{if(t.isReadonly)return s();const{data:d}=await Q(r,e.GET_WORKLOADS,de,t,"cache-first"),f=d?.workloads??ue,{payload:_,isEmpty:S}=se(a,f,c,T),{payload:y,isEmpty:R}=ce(o,c);let p=!1;S||(p=!0,i("Persisting sources...")),R||p||i("Persisting namespaces...");const{error:m}=await X(r,e.PERSIST_SOURCES,_,t);if(m&&(u(v.Instrumenting),u(v.Uninstrumenting),n(C.Update,m)),e.PERSIST_NAMESPACES){const{error:a}=await X(r,e.PERSIST_NAMESPACES,y,t);a&&n(C.Update,a)}l({}),E({})},persistV2:async a=>{if(t.isReadonly)return s(),{error:"readonly"};const n=[];for(const[,o]of Object.entries(a)){const a={sources:[]},i={namespaces:[]};for(const e of o)e.name&&e.kind?a.sources.push(e):i.namespaces.push(e);if(i.namespaces.length>0&&e.PERSIST_NAMESPACES){const{error:a}=await X(r,e.PERSIST_NAMESPACES,i,t);a&&n.push(a)}if(a.sources.length>0){const{error:o}=await X(r,e.PERSIST_SOURCES,a,t);o&&n.push(o)}}return n.length?{error:n.join(", ")}:void 0},update:async(a,d)=>{if(t.isReadonly)return s();i("Updating source...");const u={sourceId:a,patchSourceRequest:{...d,currentStreamName:c}},{data:l,error:E}=await X(r,e.UPDATE_SOURCE,u,t);E?n(C.Update,E,a):l?.updateK8sActualSource&&o(C.Update,`Successfully updated "${a.name}" source`,a)},restartWorkloads:async a=>{if(t.isReadonly)return s();i("Restarting sources...");const{data:c,error:d}=await X(r,e.RESTART_WORKLOADS,{sourceIds:a},t);d?n(C.Update,d):c?.restartWorkloads&&o(C.Update,`Successfully restarted ${a.length} sources`)},restartPod:async(a,c)=>{if(t.isReadonly)return s();i("Restarting pod...");const{data:d,error:u}=await X(r,e.RESTART_POD,{namespace:a,name:c},t);u?n(C.Update,u):d?.restartPod&&o(C.Update,`Successfully restarted pod ${a}/${c}`)},recoverFromRollback:async a=>{if(t.isReadonly)return s();i("Recovering from rollback...");const{data:c,error:d}=await X(r,e.RECOVER_FROM_ROLLBACK,{sourceId:a},t);d?n(C.Update,d,a):c?.recoverFromRollbackForWorkload&&o(C.Update,"Successfully triggered recovery from rollback")}}})(t,r),s=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.Destination),{selectedStreamName:i}=P(),s=async()=>{const{error:n}=await Q(r,e.GET_DESTINATIONS,void 0,t);n&&a(C.Read,n)};return{useDestinations:()=>{const e=ae("GET_DESTINATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.destinations??e.data?.destinations??Se,loading:e.loading,refetch:s}},useDestinationCategories:()=>{const e=ae("GET_DESTINATION_CATEGORIES",void 0);return{data:e.data,loading:e.loading}},usePotentialDestinations:()=>{const e=ae("GET_POTENTIAL_DESTINATIONS",void 0);return{data:e.data,loading:e.loading}},fetchAll:s,testConnection:async a=>{const{data:n}=await X(r,e.TEST_DESTINATION_CONNECTION,{destination:ye(a,i)},t);return n},create:async c=>{if(t.isReadonly)return o();const{error:d}=await X(r,e.CREATE_DESTINATION,{destination:ye(c,i)},t);d?a(C.Create,d):(n(C.Create,`Successfully created "${c.type}" destination`),await s())},update:async(c,d)=>{if(t.isReadonly)return o();const{data:u,error:l}=await X(r,e.UPDATE_DESTINATION,{id:c,destination:ye(d,i)},t);l?a(C.Update,l,c):u?.updateDestination&&(n(C.Update,`Successfully updated "${d.type}" destination`,c),await s())},remove:async c=>{if(t.isReadonly)return o();const{data:d}=await Q(r,e.GET_DESTINATIONS,void 0,t,"cache-first"),u=d?.computePlatform?.destinations??d?.destinations??Se,l=u.find(e=>w(e)===c)?.destinationType?.type,{error:E}=await X(r,e.DELETE_DESTINATION,{id:c,currentStreamName:i},t);E?a(C.Delete,E,c):(n(C.Delete,`Successfully deleted "${l??c}" destination`,c),await s())}}})(t,r),c=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.Action),i=async()=>{const{error:n}=await Q(r,e.GET_ACTIONS,void 0,t);n&&a(C.Read,n)};return{useActions:()=>{const e=ae("GET_ACTIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.actions??e.data?.actions??le,loading:e.loading,refetch:i}},fetchAll:i,create:async s=>{if(t.isReadonly)return o();if(!e.CREATE_ACTION)return;const{error:c}=await X(r,e.CREATE_ACTION,{action:s},t);c?a(C.Create,c):(n(C.Create,`Successfully created "${s.type}" action`),await i())},update:async(s,c)=>{if(t.isReadonly)return o();if(!e.UPDATE_ACTION)return;const{error:d}=await X(r,e.UPDATE_ACTION,{id:s,action:c},t);d?a(C.Update,d,s):(n(C.Update,`Successfully updated "${c.type}" action`,s),await i())},remove:async(s,c)=>{if(t.isReadonly)return o();if(!e.DELETE_ACTION)return;const{error:d}=await X(r,e.DELETE_ACTION,{id:s,actionType:c},t);d?a(C.Delete,d,s):(n(C.Delete,`Successfully deleted "${c}" action`,s),await i())}}})(t,r),d=((t,r)=>{const a=f(),{notifyError:n,notifySuccess:o,notifyReadonly:i}=x(h.InstrumentationRule),s=async()=>{const{error:e}=await Q(a,t.GET_INSTRUMENTATION_RULES,void 0,r);e&&n(C.Read,e)};return{useRules:()=>{const t=ae("GET_INSTRUMENTATION_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e(()=>(t.data?.computePlatform?.instrumentationRules??t.data?.instrumentationRules??[]).map(M),[t.data]),loading:t.loading,refetch:s}},fetchAll:s,create:async(e,c)=>{if(r.isReadonly)return i();if(!t.CREATE_INSTRUMENTATION_RULE)return;const{error:d}=await X(a,t.CREATE_INSTRUMENTATION_RULE,{instrumentationRule:F(e)},r);d?n(C.Create,d):(o(C.Create,`Successfully created${c?` "${c}"`:""} rule`),await s())},update:async(e,c,d)=>{if(r.isReadonly)return i();if(!t.UPDATE_INSTRUMENTATION_RULE)return;const{error:u}=await X(a,t.UPDATE_INSTRUMENTATION_RULE,{ruleId:e,instrumentationRule:F(c)},r);u?n(C.Update,u,e):(o(C.Update,`Successfully updated${d?` "${d}"`:""} rule`,e),await s())},remove:async(e,c)=>{if(r.isReadonly)return i();if(!t.DELETE_INSTRUMENTATION_RULE)return;const{error:d}=await X(a,t.DELETE_INSTRUMENTATION_RULE,{ruleId:e},r);d?n(C.Delete,d,e):(o(C.Delete,`Successfully deleted${c?` "${c}"`:""} rule`,e),await s())}}})(t,r),u=((e,t)=>{const r=f(),{addNotification:a}=m(),{setDataStreams:n}=P(),i=(e,t)=>a({type:I.Error,title:e,message:t}),s=async()=>{const{data:a,error:o}=await Q(r,e.GET_DATA_STREAMS,void 0,t);if(o)i(C.Read,o);else if(a){const e=a.computePlatform?.dataStreams??a.dataStreams??[];n(e)}},c=e.CREATE_DATA_STREAM?async n=>{if(t.isReadonly)return K(a);const{error:o}=await X(r,e.CREATE_DATA_STREAM,{stream:n},t);o?i(C.Create,o):await s()}:void 0;return{useDataStreams:()=>{const e=ae("GET_DATA_STREAMS",void 0,{fetchPolicy:"cache-first"}),t=e.data?.computePlatform?.dataStreams??e.data?.dataStreams??_e;return o(()=>{n(t)},[JSON.stringify(t.map(e=>e.name))]),{items:t,loading:e.loading,refetch:s}},fetchAll:s,create:c,update:async(n,o)=>{if(t.isReadonly)return K(a);const{error:c}=await X(r,e.UPDATE_DATA_STREAM,{id:n,dataStream:o},t);c?i(C.Update,c):await s()},remove:async n=>{if(t.isReadonly)return K(a);const{error:o}=await X(r,e.DELETE_DATA_STREAM,{id:n},t);o?i(C.Delete,o):await s()}}})(t,r),l=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=x(h.Namespace),o=async()=>{const n=await Q(r,e.GET_NAMESPACES_WITH_WORKLOADS,void 0,t);return n.error&&a(C.Read,n.error),n};return{useNamespaces:()=>{const e=ae("GET_NAMESPACES_WITH_WORKLOADS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.namespaces??Te,loading:e.loading,refetch:o}},fetchAll:o,persist:async o=>{if(t.isReadonly)return n();const{error:i}=await X(r,e.PERSIST_NAMESPACES,o,t);return i&&a(C.Update,i),i?{error:i}:void 0}}})(t,r),E=((e,t)=>{const r=f(),{notifyError:a}=x(h.Source);return{fetch:async n=>{const o=await Q(r,e.GET_K8S_MANIFEST,n,t);return o.error&&a(C.Read,o.error),o}}})(t,r),T=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.Source);return{useEffectiveConfig:(e,t)=>ae("GET_EFFECTIVE_CONFIG",e,t),useConfigYamls:e=>ae("GET_CONFIG_YAMLS",void 0,e),getEffectiveConfig:async a=>e.GET_EFFECTIVE_CONFIG?Q(r,e.GET_EFFECTIVE_CONFIG,{id:a},t):{error:"GET_EFFECTIVE_CONFIG not configured"},applyConfigurations:e.UPDATE_REMOTE_CONFIG?async(n,i)=>{if(t.isReadonly)return o();const{error:s}=await X(r,e.UPDATE_REMOTE_CONFIG,{formData:n,connectionIds:i},t);return s&&a(C.Update,s),s?{error:s}:void 0}:void 0,getConfigYamls:e.GET_CONFIG_YAMLS?async()=>Q(r,e.GET_CONFIG_YAMLS,void 0,t):void 0,updateLocalUiConfig:e.UPDATE_LOCAL_UI_CONFIG?async i=>{if(t.isReadonly)return o();const{error:s}=await X(r,e.UPDATE_LOCAL_UI_CONFIG,{config:i},t);return s?a(C.Update,s):n(C.Update,"Local UI configuration updated successfully"),s?{error:s}:void 0}:void 0,resetLocalUiConfigToDefaults:e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS?async()=>{if(t.isReadonly)return o();const{error:i}=await X(r,e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS,void 0,t);return i?a(C.Update,i):n(C.Update,"Local UI configuration reset to factory defaults"),i?{error:i}:void 0}:void 0}})(t,r),_=((e,t)=>{const r=f(),{apolloConfig:a}=H();return{fetchDescribeOdigos:e.GET_DESCRIBE_ODIGOS?async()=>Q(r,e.GET_DESCRIBE_ODIGOS,void 0,t):void 0,fetchDescribeSource:e.GET_DESCRIBE_SOURCE?async a=>Q(r,e.GET_DESCRIBE_SOURCE,a,t):void 0,downloadDiagnose:e.GET_DIAGNOSE?async(n,o)=>{const i=await Q(r,e.GET_DIAGNOSE,{input:n,dryRun:o?.dryRun??!1},t),s=i?.data?.stats?.fileCount??0;return!i.error&&s>0&&!o?.dryRun&&await Ee(a),i}:void 0}})(t,r),S=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=x(h.Source),o=async()=>{e.GET_TOKENS&&await Q(r,e.GET_TOKENS,void 0,t)};return{useTokens:()=>{const e=ae("GET_TOKENS",void 0,{fetchPolicy:"cache-first"});return{items:e.data??ie,loading:e.loading,refetch:o}},updateToken:e.UPDATE_TOKEN?async o=>{if(t.isReadonly)return n();const{error:i}=await X(r,e.UPDATE_TOKEN,{token:o},t);return i&&a(C.Update,i),i?{error:i}:void 0}:void 0}})(t,r),y=((e,t)=>{const r=f();return{useMetrics:e=>ae("GET_METRICS",void 0,e),fetch:async()=>Q(r,e.GET_METRICS,void 0,t)}})(t,r),R=((e,t)=>{const r=f();return{useServiceMap:e=>ae("GET_SERVICE_MAP",void 0,e),fetch:e.GET_SERVICE_MAP?async()=>Q(r,e.GET_SERVICE_MAP,void 0,t):void 0}})(t,r),p=((e,t)=>{const r=f();return{useSlots:e=>ae("GET_PROFILING_SLOTS",void 0,e),useSourceProfiling:(e,t)=>ae("GET_SOURCE_PROFILING",e,t),fetchSlots:e.GET_PROFILING_SLOTS?async()=>Q(r,e.GET_PROFILING_SLOTS,void 0,t):void 0,fetchSourceProfiling:e.GET_SOURCE_PROFILING?async a=>Q(r,e.GET_SOURCE_PROFILING,a,t):void 0,enableProfiling:e.ENABLE_SOURCE_PROFILING?async a=>X(r,e.ENABLE_SOURCE_PROFILING,a,t):void 0}})(t,r),O=((e,t)=>{const r=f();return{useGatewayInfo:e=>ae("GET_GATEWAY_INFO",void 0,e),useGatewayPods:e=>ae("GET_GATEWAY_PODS",void 0,e),useNodeCollectorInfo:e=>ae("GET_NODE_COLLECTOR_INFO",void 0,e),useNodeCollectorPods:e=>ae("GET_NODE_COLLECTOR_PODS",void 0,e),usePodInfo:(e,t)=>ae("GET_COLLECTOR_POD_INFO",e,t),getGatewayInfo:e.GET_GATEWAY_INFO?async()=>Q(r,e.GET_GATEWAY_INFO,void 0,t):void 0,getGatewayPods:e.GET_GATEWAY_PODS?async()=>Q(r,e.GET_GATEWAY_PODS,void 0,t):void 0,getNodeCollectorInfo:e.GET_NODE_COLLECTOR_INFO?async()=>Q(r,e.GET_NODE_COLLECTOR_INFO,void 0,t):void 0,getNodeCollectorPods:e.GET_NODE_COLLECTOR_PODS?async()=>Q(r,e.GET_NODE_COLLECTOR_PODS,void 0,t):void 0,getExtendedPodInfo:e.GET_COLLECTOR_POD_INFO?async(a,n)=>Q(r,e.GET_COLLECTOR_POD_INFO,{namespace:a,name:n},t):void 0}})(t,r),A=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.SamplingRule),i=async()=>{e.GET_SAMPLING_RULES&&await Q(r,e.GET_SAMPLING_RULES,void 0,t)},s=(e,s)=>e?async c=>{if(t.isReadonly)return o();const{error:d}=await X(r,e,c,t);return d?a(s,d):(n(C.Create,"Successfully created sampling rule"),await i()),d?{error:d}:void 0}:void 0,c=(e,s)=>e?async(c,d)=>{if(t.isReadonly)return o();const{error:u}=await X(r,e,{samplingId:d.samplingId,ruleId:c,rule:d.rule},t);return u?a(s,u):(n(C.Update,"Successfully updated sampling rule"),await i()),u?{error:u}:void 0}:void 0,d=e=>e?async(s,c)=>{if(t.isReadonly)return o();const{error:d}=await X(r,e,{samplingId:c,ruleId:s},t);return d?a(C.Delete,d):(n(C.Delete,"Successfully deleted sampling rule"),await i()),d?{error:d}:void 0}:void 0;return{useSamplingRules:()=>{const e=ae("GET_SAMPLING_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.samplingRules??e.data?.samplingRules??fe,k8sHealthProbesConfig:e.data?.computePlatform?.k8sHealthProbesConfig??e.data?.k8sHealthProbesConfig??null,loading:e.loading,refetch:i}},fetchAll:e.GET_SAMPLING_RULES?async()=>Q(r,e.GET_SAMPLING_RULES,void 0,t):void 0,createNoisy:s(e.CREATE_NOISY_OPERATION_RULE,C.Create),updateNoisy:c(e.UPDATE_NOISY_OPERATION_RULE,C.Update),deleteNoisy:d(e.DELETE_NOISY_OPERATION_RULE),createHighlyRelevant:s(e.CREATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Create),updateHighlyRelevant:c(e.UPDATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Update),deleteHighlyRelevant:d(e.DELETE_HIGHLY_RELEVANT_OPERATION_RULE),createCostReduction:s(e.CREATE_COST_REDUCTION_RULE,C.Create),updateCostReduction:c(e.UPDATE_COST_REDUCTION_RULE,C.Update),deleteCostReduction:d(e.DELETE_COST_REDUCTION_RULE),updateK8sHealthProbesConfig:e.UPDATE_LOCAL_UI_SAMPLING_CONFIG?async n=>{if(t.isReadonly)return o();const{error:s}=await X(r,e.UPDATE_LOCAL_UI_SAMPLING_CONFIG,{config:{k8sHealthProbesSampling:n}},t);return s?a(C.Update,s):await i(),s?{error:s}:void 0}:void 0}})(t,r),N=((e,t)=>{const r=f();return{useSnapshots:()=>{const e=ae("GET_ALL_CLUSTER_SNAPSHOTS",void 0,{fetchPolicy:"cache-first"});return{data:e.data,loading:e.loading,unsupported:e.unsupported}},getAllClusterSnapshots:e.GET_ALL_CLUSTER_SNAPSHOTS?async()=>Q(r,e.GET_ALL_CLUSTER_SNAPSHOTS,void 0,t):void 0,getClusterSnapshot:e.GET_CLUSTER_SNAPSHOT?async a=>Q(r,e.GET_CLUSTER_SNAPSHOT,{clusterId:a},t):void 0}})(t,r);return{sourcesApi:i,destinationsApi:s,actionsApi:c,instrumentationRulesApi:d,dataStreamsApi:u,namespacesApi:l,k8sManifestApi:E,configApi:T,describeApi:_,tokensApi:S,metricsApi:y,serviceMapApi:R,profilingApi:p,collectorsApi:O,samplingApi:A,snapshotsApi:N,capabilities:e(()=>((e,t)=>{const r=t.platformType===g.Vm,a=t.tier===L.Onprem,n=!r;return{canBulkPersistSources:n&&!!e.PERSIST_SOURCES,canInstrumentNamespaces:n&&!!e.PERSIST_NAMESPACES,canFetchSnapshots:n&&!!e.GET_ALL_CLUSTER_SNAPSHOTS,canRecoverFromRollback:n&&!!e.RECOVER_FROM_ROLLBACK,canRestartWorkloads:n&&!!e.RESTART_WORKLOADS,canFetchPeerSources:!!e.GET_PEER_SOURCES,canFetchSourceLibraries:!!e.GET_SOURCE_LIBRARIES,canFetchK8sManifest:n&&!!e.GET_K8S_MANIFEST,canCreateDestination:n&&!!e.CREATE_DESTINATION,canTestConnection:n&&!!e.TEST_DESTINATION_CONNECTION,canFetchDestinationCategories:!!e.GET_DESTINATION_CATEGORIES,canFetchPotentialDestinations:n&&!!e.GET_POTENTIAL_DESTINATIONS,canCreateAction:n&&!!e.CREATE_ACTION,canCreateInstrumentationRule:n&&!!e.CREATE_INSTRUMENTATION_RULE,canApplyEffectiveConfig:n&&!!e.UPDATE_REMOTE_CONFIG&&!!e.GET_EFFECTIVE_CONFIG,canFetchEffectiveConfig:!!e.GET_EFFECTIVE_CONFIG,canFetchConfigYamls:!!e.GET_CONFIG_YAMLS,canFetchProfiling:n&&!!e.GET_PROFILING_SLOTS,canFetchCollectorInfo:n&&!!e.GET_GATEWAY_INFO,canManageSamplingRules:!!e.GET_SAMPLING_RULES,isEnterprise:a,isVm:r}})(t,r),[t,r]),resetCache:a(async()=>{await n.cache.reset()},[n])}};export{Y as O,W as _,se as a,oe as b,ae as c,Re as d,H as e,z as f,ce as p,X as r,ne as u};
|
|
5
|
+
`,Z=(e,t)=>{if(e)return"function"==typeof e?e(t):e},ee=(e,t)=>e[t],te=(e,t,r)=>{if(void 0===t)return;return e?.transformResult?e.transformResult(t,r):t},re=(e,t,r)=>{if(!e)return;const a=e.transformVariables;return a?a(t,r):t},ae=(t,r,n)=>{const{operations:o,context:i}=H(),s=ee(o,t),c=e(()=>Z(s?.document,i),[s,i]),d=e(()=>re(s,r,i),[s,r,i]),u=!s||!c,l=!!s?.canRun&&!s.canRun(i),E=n?.skip||u||l,f=T(c??J,{variables:d,skip:E,pollInterval:n?.pollInterval,fetchPolicy:n?.fetchPolicy??"cache-and-network",notifyOnNetworkStatusChange:n?.notifyOnNetworkStatusChange,client:s?.client,onCompleted:n?.onCompleted?e=>{const t=te(s,e,i);void 0!==t&&n.onCompleted(t)}:void 0,onError:n?.onError}),_=e(()=>{if(!E)return te(s,f.data,i)},[s,i,f.data,E]),S=a(async()=>{if(u)return{data:void 0};const e=await f.refetch();return{data:te(s,e.data,i)}},[s,i,f,u]);return{data:_,loading:!E&&f.loading,error:f.error,refetch:S,unsupported:u}},ne=(t,r)=>{const{operations:n,context:o}=H(),i=ee(n,t),s=e(()=>Z(i?.document,o),[i,o]),c=!i||!s,[d,u]=E(s??J,{fetchPolicy:r?.fetchPolicy??"network-only",notifyOnNetworkStatusChange:r?.notifyOnNetworkStatusChange,client:i?.client});return{execute:a(async e=>{if(c)return{error:void 0};if(i?.canRun&&!i.canRun(o))return{data:void 0};const t=re(i,e,o),r=await d({variables:t});return r.error?{error:r.error}:{data:te(i,r.data,o)}},[i,o,d,c]),data:e(()=>te(i,u.data,o),[i,o,u.data]),loading:u.loading,error:u.error,called:u.called,unsupported:c}},oe=(t,r)=>{const{operations:o,context:i}=H(),s=f(),c=ee(o,t),d=e(()=>Z(c?.document,i),[c,i]),u=!c||!d,[l,E]=n({loading:!1,called:!1}),T=a(()=>E({loading:!1,called:!1}),[]);return[a(async e=>{if(u||!d)return{error:void 0};if(c?.canRun&&!c.canRun(i))return{data:void 0};const t=re(c,e,i),a=c?.client??s;E(e=>({...e,loading:!0,called:!0}));try{const e=await a.mutate({mutation:d,variables:t}),n=te(c,e.data,i);if(E({data:n,loading:!1,error:void 0,called:!0}),r?.refetchQueries){const e=a.refetchQueries({include:r.refetchQueries});r?.awaitRefetchQueries&&await e}return void 0!==n&&r?.onCompleted?.(n),{data:n}}catch(e){const t=e;return E({data:void 0,loading:!1,error:t,called:!0}),r?.onError?.(t),{error:t}}},[c,i,s,d,u,r]),{data:l.data,loading:l.loading,error:l.error,called:l.called,unsupported:u,reset:T}]},ie=[],se=(e,t,r,a)=>{let n=!0;const o={sources:[]};for(const[i,s]of Object.entries(e)){if(!s.length)continue;n=!1;const e=s.map(({id:e,selected:t,currentStreamName:a})=>({namespace:e.namespace,name:e.name,kind:e.kind,selected:void 0!==t&&t,currentStreamName:a||r}));let c=0,d=0;for(const r of e){const e=t.find(e=>e.id.namespace===i&&e.id.name===r.name&&e.id.kind===r.kind),a=e?.dataStreamNames||[];r.selected&&!e?c++:!r.selected&&e&&a.length<=1&&d++}a(c,d),o.sources.push(...e)}return{payload:o,isEmpty:n}},ce=(e,t)=>{let r=!0;const a={namespaces:[]};for(const[n,{selected:o,currentStreamName:i}]of Object.entries(e))"boolean"==typeof o&&(r=!1,a.namespaces.push({namespace:n,selected:o,currentStreamName:i||t}));return{payload:a,isEmpty:r}},de={filter:{markedForInstrumentation:!0}},ue=[],le=[],Ee=async e=>{const t=(e=>{try{return new URL("/diagnose/download",e).toString()}catch{return null}})(e.httpUrl);if(t)try{const[r,a]=await Promise.all([Promise.resolve(e.authHeader?.()??{}),Promise.resolve(e.csrfHeader?.()??{})]),n=await fetch(t,{credentials:e.credentials??"same-origin",headers:{...r,...a}});if(!n.ok)throw new Error(`Failed to download diagnose archive: ${n.status} ${n.statusText}`);((e,t)=>{if("undefined"==typeof document)return;const r=URL.createObjectURL(e),a=document.createElement("a");a.href=r,a.download=t,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(r)})(await n.blob(),`odigos-diagnose-${Date.now()}.tar.gz`)}catch(e){}},fe=[],Te=[],_e=[],Se=[],ye=(e,t)=>({...e,fields:e.fields.filter(({value:e})=>void 0!==e),currentStreamName:t}),Re=()=>{const{operations:t,context:r}=H(),n=f(),i=((e,t)=>{const r=f(),{notifyError:n,notifySuccess:o,notifyPending:i,notifyReadonly:s}=x(h.Source),{selectedStreamName:c}=P(),{setProgress:d,resetProgress:u}=G(),{setConfiguredSources:l,setConfiguredFutureApps:E}=U(),T=(e,t)=>{const{progress:r}=G.getState();e>0&&d(v.Instrumenting,{total:(r[v.Instrumenting]?.total||0)+e,current:r[v.Instrumenting]?.current||0}),t>0&&d(v.Uninstrumenting,{total:(r[v.Uninstrumenting]?.total||0)+t,current:r[v.Uninstrumenting]?.current||0})},_=a(async()=>{const{error:a}=await Q(r,e.GET_WORKLOADS,de,t);a&&n(C.Read,a)},[r,e.GET_WORKLOADS,t,n]);return{useSources:()=>{const e=ae("GET_WORKLOADS",de,{fetchPolicy:"cache-first"});return{items:e.data?.workloads??ue,loading:e.loading,refetch:_}},fetchAll:_,fetchByTargets:async(a,o)=>{const i=!!o?.slim,s=a.map(e=>D(e,h.Source)).filter(e=>e.namespace&&e.name&&e.kind);if(0===s.length)return;if(s.length>50)return void await _();const c=i&&e.GET_WORKLOADS_BY_IDS_SLIM?e.GET_WORKLOADS_BY_IDS_SLIM:e.GET_WORKLOADS_BY_IDS,{error:d}=await Q(r,c,{ids:s.map(({namespace:e,kind:t,name:r})=>({namespace:e,kind:t,name:r}))},t);d?n(C.Read,d):await _()},fetchById:async a=>{const{data:o,error:i}=await Q(r,e.GET_WORKLOADS_BY_IDS,{ids:[{namespace:a.namespace,kind:a.kind,name:a.name}]},t);if(!i)return await _(),o?.workloadsByIds?.find(e=>e.id.namespace===a.namespace&&e.id.kind===a.kind&&e.id.name===a.name);n(C.Read,i)},fetchLibraries:async a=>Q(r,e.GET_SOURCE_LIBRARIES,a,t),fetchPeerSources:async a=>Q(r,e.GET_PEER_SOURCES,{serviceName:a},t),usePeerSources:(e,t)=>ae("GET_PEER_SOURCES",e,t),persist:async(a,o)=>{if(t.isReadonly)return s();const{data:d}=await Q(r,e.GET_WORKLOADS,de,t,"cache-first"),f=d?.workloads??ue,{payload:_,isEmpty:S}=se(a,f,c,T),{payload:y,isEmpty:R}=ce(o,c);let p=!1;S||(p=!0,i("Persisting sources...")),R||p||i("Persisting namespaces...");const{error:m}=await X(r,e.PERSIST_SOURCES,_,t);if(m&&(u(v.Instrumenting),u(v.Uninstrumenting),n(C.Update,m)),e.PERSIST_NAMESPACES){const{error:a}=await X(r,e.PERSIST_NAMESPACES,y,t);a&&n(C.Update,a)}l({}),E({})},persistV2:async a=>{if(t.isReadonly)return s(),{error:"readonly"};const n=[];for(const[,o]of Object.entries(a)){const a={sources:[]},i={namespaces:[]};for(const e of o)e.name&&e.kind?a.sources.push(e):i.namespaces.push(e);if(i.namespaces.length>0&&e.PERSIST_NAMESPACES){const{error:a}=await X(r,e.PERSIST_NAMESPACES,i,t);a&&n.push(a)}if(a.sources.length>0){const{error:o}=await X(r,e.PERSIST_SOURCES,a,t);o&&n.push(o)}}return n.length?{error:n.join(", ")}:void 0},update:async(a,d)=>{if(t.isReadonly)return s();i("Updating source...");const u={sourceId:a,patchSourceRequest:{...d,currentStreamName:c}},{data:l,error:E}=await X(r,e.UPDATE_SOURCE,u,t);E?n(C.Update,E,a):l?.updateK8sActualSource&&o(C.Update,`Successfully updated "${a.name}" source`,a)},restartWorkloads:async a=>{if(t.isReadonly)return s();i("Restarting sources...");const{data:c,error:d}=await X(r,e.RESTART_WORKLOADS,{sourceIds:a},t);d?n(C.Update,d):c?.restartWorkloads&&o(C.Update,`Successfully restarted ${a.length} sources`)},restartPod:async(a,c)=>{if(t.isReadonly)return s();i("Restarting pod...");const{data:d,error:u}=await X(r,e.RESTART_POD,{namespace:a,name:c},t);u?n(C.Update,u):d?.restartPod&&o(C.Update,`Successfully restarted pod ${a}/${c}`)},recoverFromRollback:async a=>{if(t.isReadonly)return s();i("Recovering from rollback...");const{data:c,error:d}=await X(r,e.RECOVER_FROM_ROLLBACK,{sourceId:a},t);d?n(C.Update,d,a):c?.recoverFromRollbackForWorkload&&o(C.Update,"Successfully triggered recovery from rollback")}}})(t,r),s=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.Destination),{selectedStreamName:i}=P(),s=async()=>{const{error:n}=await Q(r,e.GET_DESTINATIONS,void 0,t);n&&a(C.Read,n)};return{useDestinations:()=>{const e=ae("GET_DESTINATIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.destinations??e.data?.destinations??Se,loading:e.loading,refetch:s}},useDestinationCategories:()=>{const e=ae("GET_DESTINATION_CATEGORIES",void 0);return{data:e.data,loading:e.loading}},usePotentialDestinations:()=>{const e=ae("GET_POTENTIAL_DESTINATIONS",void 0);return{data:e.data,loading:e.loading}},fetchAll:s,testConnection:async a=>{const{data:n}=await X(r,e.TEST_DESTINATION_CONNECTION,{destination:ye(a,i)},t);return n},create:async c=>{if(t.isReadonly)return o();const{error:d}=await X(r,e.CREATE_DESTINATION,{destination:ye(c,i)},t);d?a(C.Create,d):(n(C.Create,`Successfully created "${c.type}" destination`),await s())},update:async(c,d)=>{if(t.isReadonly)return o();const{data:u,error:l}=await X(r,e.UPDATE_DESTINATION,{id:c,destination:ye(d,i)},t);l?a(C.Update,l,c):u?.updateDestination&&(n(C.Update,`Successfully updated "${d.type}" destination`,c),await s())},remove:async c=>{if(t.isReadonly)return o();const{data:d}=await Q(r,e.GET_DESTINATIONS,void 0,t,"cache-first"),u=d?.computePlatform?.destinations??d?.destinations??Se,l=u.find(e=>w(e)===c)?.destinationType?.type,{error:E}=await X(r,e.DELETE_DESTINATION,{id:c,currentStreamName:i},t);E?a(C.Delete,E,c):(n(C.Delete,`Successfully deleted "${l??c}" destination`,c),await s())}}})(t,r),c=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.Action),i=async()=>{const{error:n}=await Q(r,e.GET_ACTIONS,void 0,t);n&&a(C.Read,n)};return{useActions:()=>{const e=ae("GET_ACTIONS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.actions??e.data?.actions??le,loading:e.loading,refetch:i}},fetchAll:i,create:async s=>{if(t.isReadonly)return o();if(!e.CREATE_ACTION)return;const{error:c}=await X(r,e.CREATE_ACTION,{action:s},t);c?a(C.Create,c):(n(C.Create,`Successfully created "${s.type}" action`),await i())},update:async(s,c)=>{if(t.isReadonly)return o();if(!e.UPDATE_ACTION)return;const{error:d}=await X(r,e.UPDATE_ACTION,{id:s,action:c},t);d?a(C.Update,d,s):(n(C.Update,`Successfully updated "${c.type}" action`,s),await i())},remove:async(s,c)=>{if(t.isReadonly)return o();if(!e.DELETE_ACTION)return;const{error:d}=await X(r,e.DELETE_ACTION,{id:s,actionType:c},t);d?a(C.Delete,d,s):(n(C.Delete,`Successfully deleted "${c}" action`,s),await i())}}})(t,r),d=((t,r)=>{const a=f(),{notifyError:n,notifySuccess:o,notifyReadonly:i}=x(h.InstrumentationRule),s=async()=>{const{error:e}=await Q(a,t.GET_INSTRUMENTATION_RULES,void 0,r);e&&n(C.Read,e)};return{useRules:()=>{const t=ae("GET_INSTRUMENTATION_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e(()=>(t.data?.computePlatform?.instrumentationRules??t.data?.instrumentationRules??[]).map(M),[t.data]),loading:t.loading,refetch:s}},fetchAll:s,create:async(e,c)=>{if(r.isReadonly)return i();if(!t.CREATE_INSTRUMENTATION_RULE)return;const{error:d}=await X(a,t.CREATE_INSTRUMENTATION_RULE,{instrumentationRule:F(e)},r);d?n(C.Create,d):(o(C.Create,`Successfully created${c?` "${c}"`:""} rule`),await s())},update:async(e,c,d)=>{if(r.isReadonly)return i();if(!t.UPDATE_INSTRUMENTATION_RULE)return;const{error:u}=await X(a,t.UPDATE_INSTRUMENTATION_RULE,{ruleId:e,instrumentationRule:F(c)},r);u?n(C.Update,u,e):(o(C.Update,`Successfully updated${d?` "${d}"`:""} rule`,e),await s())},remove:async(e,c)=>{if(r.isReadonly)return i();if(!t.DELETE_INSTRUMENTATION_RULE)return;const{error:d}=await X(a,t.DELETE_INSTRUMENTATION_RULE,{ruleId:e},r);d?n(C.Delete,d,e):(o(C.Delete,`Successfully deleted${c?` "${c}"`:""} rule`,e),await s())}}})(t,r),u=((e,t)=>{const r=f(),{addNotification:a}=m(),{setDataStreams:n}=P(),i=(e,t)=>a({type:I.Error,title:e,message:t}),s=async()=>{const{data:a,error:o}=await Q(r,e.GET_DATA_STREAMS,void 0,t);if(o)i(C.Read,o);else if(a){const e=a.computePlatform?.dataStreams??a.dataStreams??[];n(e)}},c=e.CREATE_DATA_STREAM?async n=>{if(t.isReadonly)return K(a);const{error:o}=await X(r,e.CREATE_DATA_STREAM,{stream:n},t);o?i(C.Create,o):await s()}:void 0;return{useDataStreams:()=>{const e=ae("GET_DATA_STREAMS",void 0,{fetchPolicy:"cache-first"}),t=e.data?.computePlatform?.dataStreams??e.data?.dataStreams??_e;return o(()=>{n(t)},[JSON.stringify(t.map(e=>e.name))]),{items:t,loading:e.loading,refetch:s}},fetchAll:s,create:c,update:async(n,o)=>{if(t.isReadonly)return K(a);const{error:c}=await X(r,e.UPDATE_DATA_STREAM,{id:n,dataStream:o},t);c?i(C.Update,c):await s()},remove:async n=>{if(t.isReadonly)return K(a);const{error:o}=await X(r,e.DELETE_DATA_STREAM,{id:n},t);o?i(C.Delete,o):await s()}}})(t,r),l=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=x(h.Namespace),o=async()=>{const n=await Q(r,e.GET_NAMESPACES_WITH_WORKLOADS,void 0,t);return n.error&&a(C.Read,n.error),n};return{useNamespaces:()=>{const e=ae("GET_NAMESPACES_WITH_WORKLOADS",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.namespaces??Te,loading:e.loading,refetch:o}},fetchAll:o,persist:async o=>{if(t.isReadonly)return n();const{error:i}=await X(r,e.PERSIST_NAMESPACES,o,t);return i&&a(C.Update,i),i?{error:i}:void 0}}})(t,r),E=((e,t)=>{const r=f(),{notifyError:a}=x(h.Source);return{fetch:async n=>{const o=await Q(r,e.GET_K8S_MANIFEST,n,t);return o.error&&a(C.Read,o.error),o}}})(t,r),T=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.Source);return{useEffectiveConfig:(e,t)=>ae("GET_EFFECTIVE_CONFIG",e,t),useConfigYamls:e=>ae("GET_CONFIG_YAMLS",void 0,e),getEffectiveConfig:async a=>e.GET_EFFECTIVE_CONFIG?Q(r,e.GET_EFFECTIVE_CONFIG,{id:a},t):{error:"GET_EFFECTIVE_CONFIG not configured"},applyConfigurations:e.UPDATE_REMOTE_CONFIG?async(n,i)=>{if(t.isReadonly)return o();const{error:s}=await X(r,e.UPDATE_REMOTE_CONFIG,{formData:n,connectionIds:i},t);return s&&a(C.Update,s),s?{error:s}:void 0}:void 0,getConfigYamls:e.GET_CONFIG_YAMLS?async()=>Q(r,e.GET_CONFIG_YAMLS,void 0,t):void 0,updateLocalUiConfig:e.UPDATE_LOCAL_UI_CONFIG?async i=>{if(t.isReadonly)return o();const{error:s}=await X(r,e.UPDATE_LOCAL_UI_CONFIG,{config:i},t);return s?a(C.Update,s):n(C.Update,"Local UI configuration updated successfully"),s?{error:s}:void 0}:void 0,resetLocalUiConfigToDefaults:e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS?async()=>{if(t.isReadonly)return o();const{error:i}=await X(r,e.RESET_LOCAL_UI_CONFIG_TO_FACTORY_DEFAULTS,void 0,t);return i?a(C.Update,i):n(C.Update,"Local UI configuration reset to factory defaults"),i?{error:i}:void 0}:void 0}})(t,r),_=((e,t)=>{const r=f(),{apolloConfig:a}=H();return{fetchDescribeOdigos:e.GET_DESCRIBE_ODIGOS?async()=>Q(r,e.GET_DESCRIBE_ODIGOS,void 0,t):void 0,fetchDescribeSource:e.GET_DESCRIBE_SOURCE?async a=>Q(r,e.GET_DESCRIBE_SOURCE,a,t):void 0,downloadDiagnose:e.GET_DIAGNOSE?async(n,o)=>{const i=await Q(r,e.GET_DIAGNOSE,{input:n,dryRun:o?.dryRun??!1},t),s=i?.data?.stats?.fileCount??0;return!i.error&&s>0&&!o?.dryRun&&await Ee(a),i}:void 0}})(t,r),S=((e,t)=>{const r=f(),{notifyError:a,notifyReadonly:n}=x(h.Source),o=async()=>{e.GET_TOKENS&&await Q(r,e.GET_TOKENS,void 0,t)};return{useTokens:()=>{const e=ae("GET_TOKENS",void 0,{fetchPolicy:"cache-first"});return{items:e.data??ie,loading:e.loading,refetch:o}},updateToken:e.UPDATE_TOKEN?async o=>{if(t.isReadonly)return n();const{error:i}=await X(r,e.UPDATE_TOKEN,{token:o},t);return i&&a(C.Update,i),i?{error:i}:void 0}:void 0}})(t,r),y=((e,t)=>{const r=f();return{useMetrics:e=>ae("GET_METRICS",void 0,e),fetch:async()=>Q(r,e.GET_METRICS,void 0,t)}})(t,r),R=((e,t)=>{const r=f();return{useServiceMap:e=>ae("GET_SERVICE_MAP",void 0,e),fetch:e.GET_SERVICE_MAP?async()=>Q(r,e.GET_SERVICE_MAP,void 0,t):void 0}})(t,r),p=((e,t)=>{const r=f();return{useSlots:e=>ae("GET_PROFILING_SLOTS",void 0,e),useSourceProfiling:(e,t)=>ae("GET_SOURCE_PROFILING",e,t),fetchSlots:e.GET_PROFILING_SLOTS?async()=>Q(r,e.GET_PROFILING_SLOTS,void 0,t):void 0,fetchSourceProfiling:e.GET_SOURCE_PROFILING?async a=>Q(r,e.GET_SOURCE_PROFILING,a,t):void 0,enableProfiling:e.ENABLE_SOURCE_PROFILING?async a=>X(r,e.ENABLE_SOURCE_PROFILING,a,t):void 0}})(t,r),O=((e,t)=>{const r=f();return{useGatewayInfo:e=>ae("GET_GATEWAY_INFO",void 0,e),useGatewayPods:e=>ae("GET_GATEWAY_PODS",void 0,e),useNodeCollectorInfo:e=>ae("GET_NODE_COLLECTOR_INFO",void 0,e),useNodeCollectorPods:e=>ae("GET_NODE_COLLECTOR_PODS",void 0,e),usePodInfo:(e,t)=>ae("GET_COLLECTOR_POD_INFO",e,t),getGatewayInfo:e.GET_GATEWAY_INFO?async()=>Q(r,e.GET_GATEWAY_INFO,void 0,t):void 0,getGatewayPods:e.GET_GATEWAY_PODS?async()=>Q(r,e.GET_GATEWAY_PODS,void 0,t):void 0,getNodeCollectorInfo:e.GET_NODE_COLLECTOR_INFO?async()=>Q(r,e.GET_NODE_COLLECTOR_INFO,void 0,t):void 0,getNodeCollectorPods:e.GET_NODE_COLLECTOR_PODS?async()=>Q(r,e.GET_NODE_COLLECTOR_PODS,void 0,t):void 0,getExtendedPodInfo:e.GET_COLLECTOR_POD_INFO?async(a,n)=>Q(r,e.GET_COLLECTOR_POD_INFO,{namespace:a,name:n},t):void 0}})(t,r),A=((e,t)=>{const r=f(),{notifyError:a,notifySuccess:n,notifyReadonly:o}=x(h.SamplingRule),i=async()=>{e.GET_SAMPLING_RULES&&await Q(r,e.GET_SAMPLING_RULES,void 0,t)},s=(e,s)=>e?async c=>{if(t.isReadonly)return o();const{error:d}=await X(r,e,c,t);return d?a(s,d):(n(C.Create,"Successfully created sampling rule"),await i()),d?{error:d}:void 0}:void 0,c=(e,s)=>e?async(c,d)=>{if(t.isReadonly)return o();const{error:u}=await X(r,e,{samplingId:d.samplingId,ruleId:c,rule:d.rule},t);return u?a(s,u):(n(C.Update,"Successfully updated sampling rule"),await i()),u?{error:u}:void 0}:void 0,d=e=>e?async(s,c)=>{if(t.isReadonly)return o();const{error:d}=await X(r,e,{samplingId:c,ruleId:s},t);return d?a(C.Delete,d):(n(C.Delete,"Successfully deleted sampling rule"),await i()),d?{error:d}:void 0}:void 0;return{useSamplingRules:()=>{const e=ae("GET_SAMPLING_RULES",void 0,{fetchPolicy:"cache-first"});return{items:e.data?.computePlatform?.samplingRules??e.data?.samplingRules??fe,k8sHealthProbesConfig:e.data?.computePlatform?.k8sHealthProbesConfig??e.data?.k8sHealthProbesConfig??null,loading:e.loading,refetch:i}},fetchAll:e.GET_SAMPLING_RULES?async()=>Q(r,e.GET_SAMPLING_RULES,void 0,t):void 0,createNoisy:s(e.CREATE_NOISY_OPERATION_RULE,C.Create),updateNoisy:c(e.UPDATE_NOISY_OPERATION_RULE,C.Update),deleteNoisy:d(e.DELETE_NOISY_OPERATION_RULE),createHighlyRelevant:s(e.CREATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Create),updateHighlyRelevant:c(e.UPDATE_HIGHLY_RELEVANT_OPERATION_RULE,C.Update),deleteHighlyRelevant:d(e.DELETE_HIGHLY_RELEVANT_OPERATION_RULE),createCostReduction:s(e.CREATE_COST_REDUCTION_RULE,C.Create),updateCostReduction:c(e.UPDATE_COST_REDUCTION_RULE,C.Update),deleteCostReduction:d(e.DELETE_COST_REDUCTION_RULE),updateK8sHealthProbesConfig:e.UPDATE_LOCAL_UI_SAMPLING_CONFIG?async n=>{if(t.isReadonly)return o();const{error:s}=await X(r,e.UPDATE_LOCAL_UI_SAMPLING_CONFIG,{config:{k8sHealthProbesSampling:n}},t);return s?a(C.Update,s):await i(),s?{error:s}:void 0}:void 0}})(t,r),N=((e,t)=>{const r=f();return{useSnapshots:()=>{const e=ae("GET_ALL_CLUSTER_SNAPSHOTS",void 0,{fetchPolicy:"cache-first"});return{data:e.data,loading:e.loading,unsupported:e.unsupported,refetch:e.refetch}},getAllClusterSnapshots:e.GET_ALL_CLUSTER_SNAPSHOTS?async()=>Q(r,e.GET_ALL_CLUSTER_SNAPSHOTS,void 0,t):void 0,getClusterSnapshot:e.GET_CLUSTER_SNAPSHOT?async a=>Q(r,e.GET_CLUSTER_SNAPSHOT,{clusterId:a},t):void 0}})(t,r);return{sourcesApi:i,destinationsApi:s,actionsApi:c,instrumentationRulesApi:d,dataStreamsApi:u,namespacesApi:l,k8sManifestApi:E,configApi:T,describeApi:_,tokensApi:S,metricsApi:y,serviceMapApi:R,profilingApi:p,collectorsApi:O,samplingApi:A,snapshotsApi:N,capabilities:e(()=>((e,t)=>{const r=t.platformType===g.Vm,a=t.tier===L.Onprem,n=!r;return{canBulkPersistSources:n&&!!e.PERSIST_SOURCES,canInstrumentNamespaces:n&&!!e.PERSIST_NAMESPACES,canFetchSnapshots:n&&!!e.GET_ALL_CLUSTER_SNAPSHOTS,canRecoverFromRollback:n&&!!e.RECOVER_FROM_ROLLBACK,canRestartWorkloads:n&&!!e.RESTART_WORKLOADS,canFetchPeerSources:!!e.GET_PEER_SOURCES,canFetchSourceLibraries:!!e.GET_SOURCE_LIBRARIES,canFetchK8sManifest:n&&!!e.GET_K8S_MANIFEST,canCreateDestination:n&&!!e.CREATE_DESTINATION,canTestConnection:n&&!!e.TEST_DESTINATION_CONNECTION,canFetchDestinationCategories:!!e.GET_DESTINATION_CATEGORIES,canFetchPotentialDestinations:n&&!!e.GET_POTENTIAL_DESTINATIONS,canCreateAction:n&&!!e.CREATE_ACTION,canCreateInstrumentationRule:n&&!!e.CREATE_INSTRUMENTATION_RULE,canApplyEffectiveConfig:n&&!!e.UPDATE_REMOTE_CONFIG&&!!e.GET_EFFECTIVE_CONFIG,canFetchEffectiveConfig:!!e.GET_EFFECTIVE_CONFIG,canFetchConfigYamls:!!e.GET_CONFIG_YAMLS,canFetchProfiling:n&&!!e.GET_PROFILING_SLOTS,canFetchCollectorInfo:n&&!!e.GET_GATEWAY_INFO,canManageSamplingRules:!!e.GET_SAMPLING_RULES,isEnterprise:a,isVm:r}})(t,r),[t,r]),resetCache:a(async()=>{await n.cache.reset()},[n])}};export{Y as O,W as _,se as a,oe as b,ae as c,Re as d,H as e,z as f,ce as p,X as r,ne as u};
|
package/lib/containers/v2.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useEffect as n,useMemo as a,useRef as i,useCallback as l,useState as s,Fragment as r,forwardRef as c,useImperativeHandle as d,Children as u,createContext as p,useContext as h,useLayoutEffect as g}from"react";import m,{useTheme as f,css as b,keyframes as v}from"styled-components";import{u as y,n as C,C as S,e as w,f as x,h as T,d as k,b as $,c as E,S as I,j as A,R as N,k as O,l as R,a as D,r as P,o as F,p as L,q as _,s as z,t as M,w as B,x as X,y as V,z as U,A as H,B as G}from"../chunks/helpers-CUmUiA_l.js";import{f as j,a1 as W,a2 as K,M as Y,a3 as J,a4 as q,a5 as Z,a6 as Q,a7 as ee,a8 as te,a9 as oe,aa as ne,b as ae,ab as ie,c as le,y as se,ac as re,ad as ce,ae as de,af as ue,ag as pe,ah as he,ai as ge,aj as me,ak as fe,al as be,am as ve,g as ye,N as Ce,an as Se,ao as we,ap as xe,aq as Te,ar as ke,R as $e,o as Ee,S as Ie,k as Ae,m as Ne,as as Oe,at as Re,au as De,H as Pe,av as Fe,G as Le,J as _e,C as ze,n as Me,B as Be,aw as Xe,ax as Ve,ay as Ue,p as He,h as Ge,az as je,aA as We,aB as Ke,aC as Ye,aD as Je,aE as qe,aF as Ze,aG as Qe,aH as et,aI as tt,aJ as ot,A as nt,aK as at,D as it,aL as lt,aM as st,aN as rt,aO as ct,aP as dt,aQ as ut,e as pt,s as ht,I as gt,E as mt,aR as ft,T as bt,aS as vt,aT as yt,W as Ct,aU as St,aV as wt,Y as xt,_ as Tt,aW as kt,aX as $t,aY as Et,aZ as It,a_ as At,d as Nt,a$ as Ot,l as Rt,b0 as Dt,b1 as Pt,b2 as Ft,O as Lt,F as _t,b3 as zt,b4 as Mt,b5 as Bt,b6 as Xt,b7 as Vt,b8 as Ut,b9 as Ht,ba as Gt,bb as jt,bc as Wt,bd as Kt,be as Yt,bf as Jt,bg as qt,z as Zt,L as Qt,bh as eo,bi as to,q as oo,r as no,w as ao,K as io,bj as lo,bk as so,bl as ro,bm as co,bn as uo,bo as po,bp as ho,bq as go,br as mo,bs as fo,bt as bo,bu as vo,bv as yo,bw as Co,bx as So,by as wo,bz as xo,bA as To,bB as ko,bC as $o,bD as Eo,bE as Io,bF as Ao,bG as No,bH as Oo,bI as Ro,bJ as Do,bK as Po,bL as Fo,bM as Lo,bN as _o,bO as zo,bP as Mo,bQ as Bo,bR as Xo,bS as Vo,bT as Uo,bU as Ho,bV as Go,bW as jo,bX as Wo,bY as Ko,bZ as Yo,b_ as Jo,b$ as qo,c0 as Zo,c1 as Qo,c2 as en,c3 as tn,c4 as on,c5 as nn,c6 as an,c7 as ln,c8 as sn,c9 as rn,ca as cn,cb as dn,cc as un,cd as pn,ce as hn,cf as gn,cg as mn,ch as fn,ci as bn,cj as vn,ck as yn,cl as Cn,cm as Sn,cn as wn,co as xn,cp as Tn,cq as kn,cr as $n,cs as En,ct as In,cu as An,cv as Nn,cw as On,cx as Rn,cy as Dn,cz as Pn,cA as Fn,cB as Ln,cC as _n,cD as zn,cE as Mn,cF as Bn,cG as Xn,cH as Vn,cI as Un,cJ as Hn,cK as Gn,cL as jn,cM as Wn,cN as Kn,cO as Yn,cP as Jn,cQ as qn,cR as Zn,cS as Qn,cT as ea,cU as ta,cV as oa,cW as na,cX as aa,cY as ia,cZ as la,c_ as sa,c$ as ra,d0 as ca,d1 as da,d2 as ua,d3 as pa,d4 as ha,d5 as ga,d6 as ma,d7 as fa,d8 as ba,d9 as va,da as ya,db as Ca,dc as Sa,dd as wa,de as xa,x as Ta,df as ka,v as $a,dg as Ea,dh as Ia,di as Aa,dj as Na,dk as Oa,dl as Ra,dm as Da,dn as Pa,X as Fa,dp as La,dq as _a,dr as za,ds as Ma,dt as Ba,du as Xa,dv as Va,dw as Ua,dx as Ha,dy as Ga,dz as ja,dA as Wa,dB as Ka,dC as Ya,dD as Ja,dE as qa,dF as Za,dG as Qa,dH as ei,dI as ti,dJ as oi,dK as ni,dL as ai,dM as ii,dN as li,dO as si}from"../chunks/ui-components-B1TCLO_N.js";import{TrashIcon as ri,PlusIcon as ci,ArrowRightIcon as di,VSquareIcon as ui,XSquareIcon as pi,BookIcon as hi,DeleteIcon as gi,EditIcon as mi,GoLogo as fi,JavaLogo as bi,ChevronRightIcon as vi,ActionIcon as yi,DestinationIcon as Ci,ChevronUpIcon as Si,ChevronDownIcon as wi,VIcon as xi,XIcon as Ti,InstrumentationRuleIcon as ki,SourceIcon as $i,NamespacesIcon as Ei,SettingsIcon as Ii,PodIcon as Ai,OdigosLogo as Ni,K8sLogo as Oi,RefreshIcon as Ri,ExclamationCircleIcon as Di,QuestionCircleIcon as Pi,InboundIcon as Fi,OutboundIcon as Li,UserIcon as _i,TerminalIcon as zi,SearchIcon as Mi,MinusIcon as Bi,ExpandIcon as Xi,CopyIcon as Vi,DotIcon as Ui,DownloadIcon as Hi,RefreshLeftArrowIcon as Gi,VmLogo as ji,SamplingIcon as Wi,ExclamationTriangleIcon as Ki,KeyIcon as Yi,DiagnoseIcon as Ji,StarIcon as qi,ArrowIcon as Zi,ConnectionsIcon as Qi,FilterIcon as el,DataStreamIcon as tl,PipelineCollectorIcon as ol,ArrowDownSquareIcon as nl,ArrowUpSquareIcon as al,GatewayIcon as il,YamlIcon as ll}from"../icons.js";import{d as sl}from"../chunks/use-odigos-api-
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useEffect as n,useMemo as a,useRef as i,useCallback as l,useState as s,Fragment as r,forwardRef as c,useImperativeHandle as d,Children as u,createContext as p,useContext as h,useLayoutEffect as g}from"react";import m,{useTheme as f,css as b,keyframes as v}from"styled-components";import{u as y,n as C,C as S,e as w,f as x,h as T,d as k,b as $,c as E,S as I,j as A,R as N,k as O,l as R,a as D,r as P,o as F,p as L,q as _,s as z,t as M,w as B,x as X,y as V,z as U,A as H,B as G}from"../chunks/helpers-CUmUiA_l.js";import{f as j,a1 as W,a2 as K,M as Y,a3 as J,a4 as q,a5 as Z,a6 as Q,a7 as ee,a8 as te,a9 as oe,aa as ne,b as ae,ab as ie,c as le,y as se,ac as re,ad as ce,ae as de,af as ue,ag as pe,ah as he,ai as ge,aj as me,ak as fe,al as be,am as ve,g as ye,N as Ce,an as Se,ao as we,ap as xe,aq as Te,ar as ke,R as $e,o as Ee,S as Ie,k as Ae,m as Ne,as as Oe,at as Re,au as De,H as Pe,av as Fe,G as Le,J as _e,C as ze,n as Me,B as Be,aw as Xe,ax as Ve,ay as Ue,p as He,h as Ge,az as je,aA as We,aB as Ke,aC as Ye,aD as Je,aE as qe,aF as Ze,aG as Qe,aH as et,aI as tt,aJ as ot,A as nt,aK as at,D as it,aL as lt,aM as st,aN as rt,aO as ct,aP as dt,aQ as ut,e as pt,s as ht,I as gt,E as mt,aR as ft,T as bt,aS as vt,aT as yt,W as Ct,aU as St,aV as wt,Y as xt,_ as Tt,aW as kt,aX as $t,aY as Et,aZ as It,a_ as At,d as Nt,a$ as Ot,l as Rt,b0 as Dt,b1 as Pt,b2 as Ft,O as Lt,F as _t,b3 as zt,b4 as Mt,b5 as Bt,b6 as Xt,b7 as Vt,b8 as Ut,b9 as Ht,ba as Gt,bb as jt,bc as Wt,bd as Kt,be as Yt,bf as Jt,bg as qt,z as Zt,L as Qt,bh as eo,bi as to,q as oo,r as no,w as ao,K as io,bj as lo,bk as so,bl as ro,bm as co,bn as uo,bo as po,bp as ho,bq as go,br as mo,bs as fo,bt as bo,bu as vo,bv as yo,bw as Co,bx as So,by as wo,bz as xo,bA as To,bB as ko,bC as $o,bD as Eo,bE as Io,bF as Ao,bG as No,bH as Oo,bI as Ro,bJ as Do,bK as Po,bL as Fo,bM as Lo,bN as _o,bO as zo,bP as Mo,bQ as Bo,bR as Xo,bS as Vo,bT as Uo,bU as Ho,bV as Go,bW as jo,bX as Wo,bY as Ko,bZ as Yo,b_ as Jo,b$ as qo,c0 as Zo,c1 as Qo,c2 as en,c3 as tn,c4 as on,c5 as nn,c6 as an,c7 as ln,c8 as sn,c9 as rn,ca as cn,cb as dn,cc as un,cd as pn,ce as hn,cf as gn,cg as mn,ch as fn,ci as bn,cj as vn,ck as yn,cl as Cn,cm as Sn,cn as wn,co as xn,cp as Tn,cq as kn,cr as $n,cs as En,ct as In,cu as An,cv as Nn,cw as On,cx as Rn,cy as Dn,cz as Pn,cA as Fn,cB as Ln,cC as _n,cD as zn,cE as Mn,cF as Bn,cG as Xn,cH as Vn,cI as Un,cJ as Hn,cK as Gn,cL as jn,cM as Wn,cN as Kn,cO as Yn,cP as Jn,cQ as qn,cR as Zn,cS as Qn,cT as ea,cU as ta,cV as oa,cW as na,cX as aa,cY as ia,cZ as la,c_ as sa,c$ as ra,d0 as ca,d1 as da,d2 as ua,d3 as pa,d4 as ha,d5 as ga,d6 as ma,d7 as fa,d8 as ba,d9 as va,da as ya,db as Ca,dc as Sa,dd as wa,de as xa,x as Ta,df as ka,v as $a,dg as Ea,dh as Ia,di as Aa,dj as Na,dk as Oa,dl as Ra,dm as Da,dn as Pa,X as Fa,dp as La,dq as _a,dr as za,ds as Ma,dt as Ba,du as Xa,dv as Va,dw as Ua,dx as Ha,dy as Ga,dz as ja,dA as Wa,dB as Ka,dC as Ya,dD as Ja,dE as qa,dF as Za,dG as Qa,dH as ei,dI as ti,dJ as oi,dK as ni,dL as ai,dM as ii,dN as li,dO as si}from"../chunks/ui-components-B1TCLO_N.js";import{TrashIcon as ri,PlusIcon as ci,ArrowRightIcon as di,VSquareIcon as ui,XSquareIcon as pi,BookIcon as hi,DeleteIcon as gi,EditIcon as mi,GoLogo as fi,JavaLogo as bi,ChevronRightIcon as vi,ActionIcon as yi,DestinationIcon as Ci,ChevronUpIcon as Si,ChevronDownIcon as wi,VIcon as xi,XIcon as Ti,InstrumentationRuleIcon as ki,SourceIcon as $i,NamespacesIcon as Ei,SettingsIcon as Ii,PodIcon as Ai,OdigosLogo as Ni,K8sLogo as Oi,RefreshIcon as Ri,ExclamationCircleIcon as Di,QuestionCircleIcon as Pi,InboundIcon as Fi,OutboundIcon as Li,UserIcon as _i,TerminalIcon as zi,SearchIcon as Mi,MinusIcon as Bi,ExpandIcon as Xi,CopyIcon as Vi,DotIcon as Ui,DownloadIcon as Hi,RefreshLeftArrowIcon as Gi,VmLogo as ji,SamplingIcon as Wi,ExclamationTriangleIcon as Ki,KeyIcon as Yi,DiagnoseIcon as Ji,StarIcon as qi,ArrowIcon as Zi,ConnectionsIcon as Qi,FilterIcon as el,DataStreamIcon as tl,PipelineCollectorIcon as ol,ArrowDownSquareIcon as nl,ArrowUpSquareIcon as al,GatewayIcon as il,YamlIcon as ll}from"../icons.js";import{d as sl}from"../chunks/use-odigos-api-BMcghWbA.js";import{S as rl,D as cl,I as dl,a as ul,A as pl,P as hl,b as gl,c as ml,R as fl,O as bl,d as vl,e as yl,f as Cl,W as Sl,g as wl,C as xl,Y as Tl,h as kl,i as $l,U as El}from"../chunks/index-hiRPXsEi.js";import{O as Il}from"../chunks/connections-scope-D_2Q866B.js";import{u as Al,f as Nl,g as Ol,e as Rl,i as Dl,h as Pl,S as Fl,k as Ll,E as _l,l as zl,m as Ml,j as Bl,b as Xl,d as Vl,a as Ul,A as Hl,R as Gl,c as jl,D as Wl}from"../chunks/source-instrument-form-context-DaQkZ03_.js";import{U as Kl}from"../chunks/consts-D6GCMJ6c.js";import{createPortal as Yl}from"react-dom";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const Jl=[{id:"CREDIT_CARD",label:"Credit card"}],ql=[{id:j.CollectContainerAttributes,label:"Collect container attributes"},{id:j.CollectReplicaSetAttributes,label:"Collect ReplicaSet attributes"},{id:j.CollectWorkloadId,label:"Collect workload ID"},{id:j.CollectClusterId,label:"Collect cluster ID"}],Zl=[{id:Z.Pod,label:Z.Pod},{id:Z.Namespace,label:Z.Namespace},{id:Z.Node,label:Z.Node}],Ql=[{label:"Label key",keyName:"labelKey",placeholder:"app.kubernetes.io/name"},{label:"Attribute key",keyName:"attributeKey",placeholder:"app.kubernetes.name"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Zl}],es=[{label:"Annotation key",keyName:"annotationKey",placeholder:"kubectl.kubernetes.io/restartedAt"},{label:"Attribute key",keyName:"attributeKey",placeholder:"kubectl.kubernetes.restartedAt"},{label:"From sources",keyName:"fromSources",placeholder:"pod, namespace",tooltip:"Select multiple sources. Higher precedence sources (pod > namespace > node) will override lower ones.",componentType:"multi-dropdown",options:Zl}],ts=/^[a-zA-Z]$/,os=new Set(["*","+","?"]),ns=new Set(["^","$"]),as={group:"rgba(102, 242, 102, 0.5)","anchor-quantifier":"rgba(102, 191, 255, 0.5)","class-bracket":"rgba(255, 153, 153, 0.5)","class-content":"rgba(178, 1, 1, 0.5)",alternation:"rgba(255, 153, 153, 0.5)",literal:"transparent"},is=m.div`
|
|
2
2
|
padding: 8px 16px;
|
|
3
3
|
border-radius: 6px;
|
|
4
4
|
border: 1px solid ${({theme:e})=>e.v2.colors.silver[500]};
|
|
@@ -188,7 +188,7 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import{useEffect
|
|
|
188
188
|
${Dr}:hover & {
|
|
189
189
|
visibility: visible;
|
|
190
190
|
}
|
|
191
|
-
`,Fr=({clusterId:o,namespaceName:n,checkbox:a,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const{isVm:d}=y(),u=e=>{r(),c({clusterId:o,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Dr,{children:t(ir,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(se,{$gap:12,children:[!d&&t(Pr,{$visible:s||i,children:t(De,{text:Ir,children:t(Q,{label:Er,labelAlign:ee.Left,size:vt.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(se,{$gap:8,children:[t(ae,{variant:yt.Span,size:le.XXXS,color:ie.Secondary,align:"right",children:$r}),t(Be,{label:`${l.sourced}/${l.total}`,status:s?Ee.Default:ft.Unknown,minWidth:"42px"})]})]})})})},Lr=({withCollapse:e,clusterId:o,clusterName:n,namespaces:i,selectedArea:l,setSelectedArea:s,handleSourceChange:r})=>{const c=a(()=>i.map(({name:e,totalWorkloads:a,selectedCount:i,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Fr,{clusterId:o,namespaceName:e,isFutureApps:u,checkbox:{all:c||u,partial:d},selectedCounts:{sourced:i,total:a},isActive:l.clusterId===o&&l.namespaceName===e,onActive:()=>s({clusterId:o,clusterName:n,namespaceName:e}),handleSourceChange:r},`${o}#${e}`)),[o,n,i,l]);return e?t(dr,{title:n,list:c,noBgColor:!0}):c},_r=({onClose:o,onBack:i,onNext:l,selectedConnectionIds:r,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:u})=>{const{isVm:p}=y(),{sourcesApi:h,snapshotsApi:g,namespacesApi:m}=sl(),{data:f,loading:b}=g.useSnapshots(),{items:v,loading:C}=m.useNamespaces(),S=Cr(p),{selectedStreamName:w}=Ge(),{progress:x,resetProgress:T}=Ct(),{isFetching:k,setIsFetching:$,setSnapshots:E,formData:I,handleSourceChange:A,handleSelectAll:N,formDiff:O,isFormDirty:R}=Bl(),D=a(()=>{if(f)return f;const e=v;return e.length?{clusters:[{clusterId:wt,clusterName:St,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes(w),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes(w)??!1)}))||[]}))}]}:null},[f,v,w]);n(()=>{$(b||C),D&&E(D)},[D,b,C,$,E]);const[P,F]=s(""),[L,_]=s(mt.Namespace),[z,M]=s({showOnlySelected:!1}),[B,X]=s({clusterId:"",clusterName:"",namespaceName:""}),V=(({isFetching:o,formData:n,handleSourceChange:i,handleSelectAll:l,selectedArea:s,setSelectedArea:r,searchText:c,searchBy:d,filters:u})=>{const{isVm:p}=y(),h=Cr(p),g=a(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>zl(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ml(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=a(()=>{let e=!1;for(const{visibleNamespaces:t}of g)for(const{totalWorkloads:o,selectedCount:n}of t)if(e=!0,n!==o)return!1;return e},[g]),{list:f,withFilterCount:b,filteredCount:v,totalCount:C}=a(()=>{const e=g.map(({clusterId:e,clusterName:o,visibleNamespaces:n})=>n.length?t(Lr,{withCollapse:g.length>1,clusterId:e,clusterName:o,namespaces:n,selectedArea:s,setSelectedArea:r,handleSourceChange:i},e):null),o=e.filter(e=>null!==e);return{list:o,withFilterCount:o.length!==e.length,filteredCount:o.length,totalCount:e.length}},[g,s]);return{width:"60%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:h.groupColumnHeader}),t(De,{text:b?He.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${b?`${v} / ${C}`:C}`,status:ft.Unknown})})]}),t(ae,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!f.length,size:le.XS,children:Tr(m)})]}),list:f.length?f:o?[t(at,{$height:"100%",children:t(ct,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(at,{$height:"100%",children:t(Ce,c?{icon:Ei,title:Sr,subTitle:h.noGroupMatchedFilter(c)}:{icon:Ei,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:k,formData:I,handleSourceChange:A,handleSelectAll:N,selectedArea:B,setSelectedArea:X,searchText:L===mt.Namespace?P:"",searchBy:L,filters:z}),U=(({formData:o,handleSourceChange:n,handleSelectAll:i,selectedArea:l,searchText:s,searchBy:r,filters:c})=>{const{tier:d,isVm:u}=y(),p=Cr(u),h=d===bt.Onprem,g=a(()=>l.value.namespaceName?o.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[o,l.value.clusterId,l.value.namespaceName]),m=a(()=>g?[...g.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ll(e,s,c)):[],[g,s,c]),f=a(()=>!!m.length&&m.every(({selected:e})=>e),[m]),b=a(()=>{if(!g)return[];const{clusterId:e}=l.value,{name:o}=g;return m.map(({name:a,selected:i,kind:l})=>{const s=!u&&!h&&_l.has(l);return t(Rr,{workloadName:a,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:o,name:a,kind:l}}),disabled:s,disabledReason:Ar},`${e}#${o}#${a}#${l}`)})},[m,g,l.value.clusterId]),{withFilterCount:v,filteredCount:C,totalCount:S}=a(()=>{const e=g?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,g]);return{width:"40%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${p.itemColumnHeader}`:p.itemColumnHeader}),t(De,{text:v?He.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${v?`${C} / ${S}`:S}`,status:ft.Unknown})})]}),t(ae,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:s,searchBy:r,filters:c}),disabled:!b.length,size:le.XS,children:Tr(f)})]}),list:b.length?b:[t(at,{$height:"100%",children:t(Ce,g?s?{icon:$i,title:Sr,subTitle:xr(s)}:{icon:$i,title:wr,subTitle:p.noItemsInGroupSubTitle}:{icon:$i,title:p.selectGroupPrompt.title,subTitle:p.selectGroupPrompt.subTitle})},"no-data")]}})({formData:I,handleSourceChange:A,handleSelectAll:N,selectedArea:{value:B},searchText:L===mt.Source?P:"",searchBy:L,filters:z});return t(Sl,{isOpen:!0,withOverlay:d,disableAnimation:u,onClose:o?()=>{T(xt.BulkInstrumenting),o()}:void 0,onBack:i?()=>i(O):void 0,onNext:l?()=>l(O):void 0,nextIsSkip:!R,onSave:()=>h.persistV2(O),header:{icon:$i,title:He.ADD_SOURCE,subTitle:He.ADD_SOURCES_DESCRIPTION},connectionIds:r&&c?{value:r,setValue:c}:void 0,search:{value:P,onChange:e=>{F(e),L===mt.Namespace&&X({clusterId:"",clusterName:"",namespaceName:""})},placeholder:S.searchPlaceholder(L),segment:{options:[{label:S.groupSegmentLabel,value:mt.Namespace},{label:S.itemSegmentLabel,value:mt.Source}],selected:L,setSelected:_}},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:kr}),t(Q,{name:"filter-selected",size:vt.S,label:$r,value:z.showOnlySelected,onChange:e=>M(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:R,isFetching:k,progress:{title:He.CREATING_SOURCES,subTitle:He.CREATING_SOURCES_SUBTITLE,percentage:x[xt.BulkInstrumenting]?.percentage||0},leftColumn:V,rightColumn:U})},zr=(e,t)=>{const o=[{id:"type",title:He.TYPE,label:t.label},{id:"status",title:He.STATUS,badge:{status:e.disabled?ft.Unknown:Ee.Success,label:e.disabled?He.DISABLED:He.ENABLED}}],n=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&o.push({id:"signals",title:He.SIGNALS_FOR_PROCESSING,label:n}),e.name&&o.push({id:"name",title:He.NAME,label:e.name}),e.notes&&o.push({id:"notes",title:He.NOTES,label:e.notes}),o},Mr=({onClose:i,actionId:r})=>{const c=f(),{actionsApi:d}=sl(),{items:u}=d.useActions(),{selectedOption:p,loadAction:h,validateFormData:g,genericForm:m}=Al(),[b,v]=s(!1),[y,C]=s(!1),[S,w]=s(null),x=b&&!!m?.isFormDirty,T=a(()=>u?.find(e=>Tt(e)===r),[r,u]),k=a(()=>nt.find(({type:e})=>e===T?.type)??null,[T?.type]);n(()=>{T&&h(T)},[T]);const $=l(()=>{T&&v(!0)},[T]),E=l(()=>{T&&(h(T),v(!1))},[T,h]),I=l(()=>{x?w("close"):i()},[x,i]),A=l(()=>{x?w("cancel"):E()},[x,E]),N=l(()=>{const e=S;w(null),"close"===e?(E(),i()):E()},[S,E,i]),O=l(async()=>{if(T){const{errorMessage:e,preparedFormData:t}=g();e||(await d.update(T.id,t),v(!1))}},[T,g,d]),R=l(()=>{T&&C(!0)},[T]),D=l(async()=>{T&&(await d.remove(T.id,T.type),i())},[T,d,i]);if(!T||!k)return null;const P=(e=>{const t=[],{type:o,fields:n}=e,a=e=>({status:e?Ee.Success:ft.Unknown,label:e?"True":"False",invertColors:!0});if(o===ye.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:a(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:a(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:a(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:a(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:o,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:o}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:o,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:o}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),o===ye.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:a(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:o},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:o})})),o===ye.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,o)=>{t.push({id:`del-attr-${o}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${o+1}`:""),label:e})}),o===ye.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,o],n)=>{t.push({id:`rename-${n}`,title:e,label:o})}),o===ye.PiiMasking&&n.piiCategories?.forEach((e,o)=>{t.push({id:`pii-${o}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${o+1}`:""),label:e})}),o===ye.ExtractAttribute){const e=n.extractAttribute?.extractions??[];e.forEach(({targetAttributeName:o,lookupKey:n,dataFormat:a,regex:i},l)=>{const s=e.length>1?`Extraction #${l+1} `:"Extraction ";t.push({id:`extract-${l}-target`,title:`${s}New Attribute Name`,label:o||"-"}),n&&t.push({id:`extract-${l}-lookupKey`,title:`${s}Lookup Key`,label:n}),a&&t.push({id:`extract-${l}-format`,title:`${s}Data Format`,label:a}),i&&t.push({id:`extract-${l}-regex`,title:`${s}Regex`,label:i})})}return o===ye.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,o)=>{const a=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${o+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${o}-ns`,title:`${a}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,i)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${o}-wf-${i}`,title:`${a}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${o}-templates`,title:`${a}Templates`,label:i}),e.notes&&t.push({id:`group-${o}-notes`,title:`${a}Notes`,label:e.notes})}),t})(T);return e(o,{children:[t(oe,{isOpen:!0,header:{icon:At(T.type),title:k.label,onClose:I,actions:[{id:"edit-action-btn-edit",label:kt.EDIT,icon:mi,active:b,onClick:$},{id:"edit-action-btn-delete",label:kt.DELETE,icon:ri,color:c.v2.colors.red[500],active:y,onClick:R}]},footer:{actions:b?[{"data-id":"edit-action-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:A},{"data-id":"edit-action-btn-save",label:kt.SAVE,variant:de.Primary,onClick:O}]:[]},children:t($t,{$padding:"4px 12px 12px",children:b&&p?t(Ds,{}):t(W,{$gap:16,children:e(Et,{bgTint:"1000",children:[e(Et,{bgTint:"900",children:[t(It,{conditions:T.conditions||[]}),t(Et,{bgTint:"800",cellsPerRow:2,items:zr(T,k)})]}),!!P?.length&&t(Et,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Et,{bgTint:"800",cellsPerRow:2,items:P})})]})})})}),t(wl,{target:"action",isOpen:y,onClose:()=>C(!1),onApprove:D}),t(xl,{isOpen:null!==S,onClose:()=>w(null),onApprove:N})]})},Br=({onClose:o,connections:l,selectedConnectionIds:r,setSelectedConnectionIds:c})=>{const{configApi:d}=sl(),[u,p]=s(""),[h,g]=s({showOnlySelected:!1}),m=a(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),o=!h.showOnlySelected||h.showOnlySelected&&r.includes(e.id);return t&&o}),[l.length,r.length,u,h]),f=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===r.length?r[0]:void 0,{data:v,loading:y}=d.useEffectiveConfig(b?{id:b}:void 0,{skip:!b}),C=a(()=>{if(b&&v)return{rollout:{automaticRolloutDisabled:v.rollout?.automaticRolloutDisabled??!1}}},[b,v]),{formData:S,handleFormChange:w,areFormValuesEqual:x,resetFormData:T}=Nt(C||{rollout:{automaticRolloutDisabled:!1}}),k=i(T);k.current=T,n(()=>{C&&k.current(C)},[C]);const $=a(()=>r.length>1||void 0!==C&&!x(C,S),[r.length,C,S]);return t(Sl,{isOpen:!0,onClose:o,onSave:async()=>await(d.applyConfigurations?.(S,r))??void 0,header:{icon:Ii,title:"Cluster Configuration"},connectionIds:{value:r,setValue:c},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:"Show only:"}),t(Q,{size:vt.S,label:"Selected",value:h.showOnlySelected,onChange:e=>g(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:$,isFetching:y,leftColumn:{width:"35%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,children:"Clusters"}),t(Be,{label:m.length,status:ft.Unknown})]}),e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,align:"right",children:"Selected clusters"}),t(Be,{label:`${r.length}/${m.length}`,status:ft.Unknown})]})]}),list:m.map(e=>t(ir,{title:e.name,isChecked:r.includes(e.id),onClick:()=>f(e.id),onCheckboxChange:()=>f(e.id)},e.id))},rightColumn:{width:"65%",header:t(ae,{size:le.XS,children:"Configurations"}),list:[t(Q,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Xr=e=>{const t=[{id:"type",title:He.TYPE,label:e.destinationType.displayName},{id:"status",title:He.STATUS,badge:{status:e.disabled?ft.Unknown:Ee.Success,label:e.disabled?He.DISABLED:He.ENABLED}}],o=Ae(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return o&&t.push({id:"monitors",title:He.MONITORS,label:o}),e.name&&t.push({id:"name",title:He.NAME,label:e.name}),t},Vr=({onClose:r,destinationId:c})=>{const d=f(),{isVm:u}=y(),{destinationsApi:p}=sl(),{items:h}=p.useDestinations(),{data:g,loading:m}=p.useDestinationCategories(),{selectedStreamName:b}=Ge(),{activeForm:v,loadDestination:C,validateFormData:S,genericForm:w}=Nl(),x=i(null),[T,k]=s(!1),[$,E]=s(!1),[I,A]=s(null),N=T&&!!w?.isFormDirty,O=a(()=>Dt(h,b),[h,b]),R=a(()=>O?.find(e=>Tt(e)===c),[c,O]),D=g?.destinationCategories?.categories??null;n(()=>{R&&D&&C(R,D)},[R,D]);const P=a(()=>R&&D?Pt(D,R):[],[R,D]),F=l(()=>{R&&k(!0)},[R]),L=l(()=>{R&&D&&(C(R,D),k(!1))},[R,D,C]),_=l(()=>{N?A("close"):r()},[N,r]),z=l(()=>{N?A("cancel"):L()},[N,L]),M=l(()=>{const e=I;A(null),"close"===e?(L(),r()):L()},[I,L,r]),B=l(async()=>{if(R){const{errorMessage:e,preparedFormData:t}=S();e||(await p.update(R.id,Oe(t)),k(!1))}},[R,S,p]),X=l(()=>{R&&E(!0)},[R]),V=l(async()=>{R&&(await p.remove(R.id),r())},[R,p,r]);if(!R)return null;const{icon:U,iconSrc:H}=ut(R.destinationType.type),G=((e,t)=>{const o=[],n=Ot(e,t),a=n.map(e=>({name:e.key,value:e.value})),i=Ae(e.exportedSignals);let l=[];const s=()=>{l.length&&(o.push({kind:"cells",id:`cells-${o.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:h,customReadDataLabels:g}=c||{};if(h?.length&&ke(h,i,a))return;const{type:m}=ht(p,{type:""}),f=d||"password"===m;if(g?.length)g.forEach(({condition:t,...o},n)=>{t==r&&l.push({id:`${e}-custom-${n}`,title:o.title,label:o.value})});else if(r)if(f)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===Rt.MultiInput){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void o.push({kind:"list",id:e,title:n,items:t.map((t,o)=>({id:`${e}-${o}`,label:String(t)}))})}if(u===Rt.KeyValuePair){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void o.push({kind:"pairs",id:e,title:n,items:t.map((t,o)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${o}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:r})}else l.push({id:e,title:n,label:"-"})}),s(),o})(R,P);return e(o,{children:[t(oe,{isOpen:!0,header:{icon:U,iconSrc:H,title:R.name||R.destinationType.displayName,onClose:_,actions:[{id:"edit-destination-btn-edit",label:kt.EDIT,icon:mi,active:T,onClick:F},{id:"edit-destination-btn-delete",label:kt.DELETE,icon:ri,color:d.v2.colors.red[500],active:$,onClick:X}]},footer:{actions:T?[{"data-id":"edit-destination-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:z},...v?.option.testConnectionSupported&&!u?[{"data-id":"edit-destination-btn-test-connection",label:kt.TEST_CONNECTION,variant:de.Secondary,onClick:()=>x.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:kt.SAVE,variant:de.Primary,onClick:B}]:[]},children:t($t,{$padding:"4px 12px 12px",children:m?t(at,{$height:"50vh",children:t(ct,{withSpinner:!0})}):T&&v?t(Ls,{ref:x,isEdit:!0}):t(W,{$gap:16,children:e(Et,{bgTint:"1000",children:[e(Et,{bgTint:"900",children:[!u&&t(It,{conditions:R.conditions||[]}),t(Et,{bgTint:"800",cellsPerRow:2,items:Xr(R)})]}),!!G.length&&t(Et,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:G.map(e=>"cells"===e.kind?t(Et,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(Et,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(wl,{target:"destination",isOpen:$,onClose:()=>E(!1),onApprove:V}),t(xl,{isOpen:null!==I,onClose:()=>A(null),onApprove:M})]})},Ur=(e,t)=>{const o=[{id:"type",title:He.TYPE,label:t.label},{id:"status",title:He.STATUS,badge:{status:e.disabled?ft.Unknown:Ee.Success,label:e.disabled?He.DISABLED:He.ENABLED}}];return e.ruleName&&o.push({id:"name",title:He.NAME,label:e.ruleName}),e.profileName&&o.push({id:"profile",title:He.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&o.push({id:"notes",title:He.NOTES,label:e.notes}),o},Hr=({onClose:i,ruleId:r})=>{const c=f(),{instrumentationRulesApi:d}=sl(),{items:u}=d.useRules(),{addNotification:p}=Lt(),{selectedOption:h,loadRule:g,validateFormData:m,genericForm:b}=Ol(),[v,y]=s(!1),[C,S]=s(!1),[w,x]=s(null),T=v&&!!b?.isFormDirty,k=a(()=>u?.find(e=>Tt(e)===r),[r,u]),$=a(()=>gt.find(({type:e})=>e===k?.type)??null,[k?.type]);n(()=>{k&&g(k)},[k]);const E=l(()=>{if(k){if(!k.mutable)return void p({type:Ee.Warning,title:_t.FORBIDDEN,message:_t.CANNOT_EDIT_RULE,crdType:mt.InstrumentationRule,target:k.ruleId,hideFromHistory:!0});y(!0)}},[k,p]),I=l(()=>{k&&(g(k),y(!1))},[k,g]),A=l(()=>{T?x("close"):i()},[T,i]),N=l(()=>{T?x("cancel"):I()},[T,I]),O=l(()=>{const e=w;x(null),"close"===e?(I(),i()):I()},[w,I,i]),R=l(async()=>{if(k){const{errorMessage:e,preparedFormData:t}=m();e||(await d.update(k.ruleId,t,k.type),y(!1))}},[k,m,d]),D=l(()=>{if(k){if(!k.mutable)return void p({type:Ee.Warning,title:_t.FORBIDDEN,message:_t.CANNOT_DELETE_RULE,crdType:mt.InstrumentationRule,target:k.ruleId,hideFromHistory:!0});S(!0)}},[k,p]),P=l(async()=>{k&&(await d.remove(k.ruleId,k.type),i())},[k,d,i]);if(!k||!$)return null;const F=((e,o)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,o])=>{o&&n.push(t(ae,{size:le.XS,children:`• ${Ft(e).toLowerCase()}`},`payload-${e}`))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,o])=>{o&&n.push(t(ae,{size:le.XS,children:`• ${Ft(e).toLowerCase()}`},`code-${e}`))}),e.headersCollection?.[Pe.HeaderKeys]?.length&&e.headersCollection[Pe.HeaderKeys].forEach((e,o)=>{e&&n.push(t(ae,{size:le.XS,children:e},`header-${o}-${e}`))}),e.customInstrumentations&&(e.customInstrumentations[ze.Java]?.forEach((e,a)=>{const i=new _e(e.className,e.methodName);if(i.Verify()){0===a&&n.push(t(ae,{size:le.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();n.push(t(ae,{size:le.XXS,color:o.v2.colors.grey[200],children:`• ${e}`},`java-probe-${a}-${e}`))}}),e.customInstrumentations[ze.Golang]?.forEach((e,a)=>{const i=new Le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===a&&n.push(t(ae,{size:le.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();n.push(t(ae,{size:le.XXS,color:o.v2.colors.grey[200],children:`• ${e}`},`golang-probe-${a}-${e}`))}})),n})(k,c);return e(o,{children:[t(oe,{isOpen:!0,header:{icon:Mt(k.type),title:$.label,onClose:A,actions:[{id:"edit-rule-btn-edit",label:kt.EDIT,icon:mi,active:v,onClick:E},{id:"edit-rule-btn-delete",label:kt.DELETE,icon:ri,color:c.v2.colors.red[500],active:C,onClick:D}]},footer:{actions:v?[{"data-id":"edit-rule-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:N},{"data-id":"edit-rule-btn-save",label:kt.SAVE,variant:de.Primary,onClick:R}]:[]},children:t($t,{$padding:"4px 12px 12px",children:v&&h?t(Hs,{}):t(W,{$gap:16,children:e(Et,{bgTint:"1000",children:[e(Et,{bgTint:"900",children:[t(It,{conditions:k.conditions||[]}),t(Et,{bgTint:"800",cellsPerRow:2,items:Ur(k,$)})]}),t(ul,{readOnly:!0,scopes:k.sourceScopes??null}),!!F.length&&t(Et,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Et,{bgTint:"800",children:F})}),!!$.supportedLanguages.length&&t(Et,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Et,{bgTint:"800",children:t(se,{$gap:12,$wrap:"wrap",children:$.supportedLanguages.map(e=>t(zt,{label:Xe[e],leftIcon:Ve(e),flex:"0.5"},e))})})})]})})})}),t(wl,{target:"instrumentation rule",isOpen:C,onClose:()=>S(!1),onApprove:P}),t(xl,{isOpen:null!==w,onClose:()=>x(null),onApprove:O})]})};var Gr;!function(e){e.Overview="overview",e.Pods="pods",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"}(Gr||(Gr={}));const jr=({collapseIsDefaultOpen:e,isJumpToTarget:o,onClickRestartPod:n,namespace:i,podName:l,nodeName:s,startTime:r,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:u,children:p})=>{const{formatDurationAgo:h}=Bt(),g=Xt(!!o),m=a(()=>({title:l,icon:Ai,withCopy:!0}),[l]),f=a(()=>{const e=[],t=Vt(c);t&&e.push(t);const o=Vt(d,Ni,"health");o&&e.push(o);const n=Vt(u,Oi,"health");return n&&e.push(n),e},[c,d,u]),b=a(()=>n?[{id:`restart-pod-${l}`,icon:Ri,label:kt.RESTART_POD,onClick:()=>n(i,l)}]:void 0,[n,i,l]),v=a(()=>[{id:"nodeName",title:He.NODE,label:s,withCopy:!0},{id:"age",title:He.AGE,label:r?h(r,{style:"short"}):He.NOT_RUNNING,labelTooltip:r}],[s,r,h]);return t("div",{ref:g,children:t(Et,{bgTint:"900",richTitle:m,badges:f,dropDataActions:b,items:v,withCollapse:!0,collapseIsDefaultOpen:e,children:p})})},Wr=m.div`
|
|
191
|
+
`,Fr=({clusterId:o,namespaceName:n,checkbox:a,isFutureApps:i,selectedCounts:l,isActive:s,onActive:r,handleSourceChange:c})=>{const{isVm:d}=y(),u=e=>{r(),c({clusterId:o,workloadId:{namespace:n},auto:e.auto,selected:e.all})};return t(Dr,{children:t(ir,{dataId:`namespace-${n}`,withCarret:!0,title:n,isSelected:s,onClick:r,isPartiallyChecked:a.partial,isChecked:a.all,onCheckboxChange:e=>u({auto:e,all:e}),children:e(se,{$gap:12,children:[!d&&t(Pr,{$visible:s||i,children:t(De,{text:Ir,children:t(Q,{label:Er,labelAlign:ee.Left,size:vt.S,value:i,onChange:e=>u({auto:e,all:e||void 0})})})}),e(se,{$gap:8,children:[t(ae,{variant:yt.Span,size:le.XXXS,color:ie.Secondary,align:"right",children:$r}),t(Be,{label:`${l.sourced}/${l.total}`,status:s?Ee.Default:ft.Unknown,minWidth:"42px"})]})]})})})},Lr=({withCollapse:e,clusterId:o,clusterName:n,namespaces:i,selectedArea:l,setSelectedArea:s,handleSourceChange:r})=>{const c=a(()=>i.map(({name:e,totalWorkloads:a,selectedCount:i,isAllSourced:c,isSomeSourced:d,isFutureApps:u})=>t(Fr,{clusterId:o,namespaceName:e,isFutureApps:u,checkbox:{all:c||u,partial:d},selectedCounts:{sourced:i,total:a},isActive:l.clusterId===o&&l.namespaceName===e,onActive:()=>s({clusterId:o,clusterName:n,namespaceName:e}),handleSourceChange:r},`${o}#${e}`)),[o,n,i,l]);return e?t(dr,{title:n,list:c,noBgColor:!0}):c},_r=({onClose:o,onBack:i,onNext:l,selectedConnectionIds:r,setSelectedConnectionIds:c,withOverlay:d,disableAnimation:u})=>{const{isVm:p}=y(),{sourcesApi:h,snapshotsApi:g,namespacesApi:m}=sl(),{data:f,loading:b,refetch:v}=g.useSnapshots(),{items:C,loading:S,refetch:w}=m.useNamespaces(),x=Cr(p),{selectedStreamName:T}=Ge(),{progress:k,resetProgress:$}=Ct(),{isFetching:E,setIsFetching:I,setSnapshots:A,formData:N,handleSourceChange:O,handleSelectAll:R,formDiff:D,isFormDirty:P}=Bl();n(()=>{v(),w()},[]);const F=a(()=>{if(f)return f;const e=C;return e.length?{clusters:[{clusterId:wt,clusterName:St,namespaces:e.map(e=>({name:e.name,selected:e.markedForInstrumentation&&e.dataStreamNames.includes(T),workloads:e.workloads?.map(e=>({namespace:e.id.namespace,name:e.id.name,kind:e.id.kind,selected:(e.markedForInstrumentation?.markedForInstrumentation??!1)&&(e.dataStreamNames?.includes(T)??!1)}))||[]}))}]}:null},[f,C,T]);n(()=>{I(b||S),F&&A(F)},[F,b,S,I,A]);const[L,_]=s(""),[z,M]=s(mt.Namespace),[B,X]=s({showOnlySelected:!1}),[V,U]=s({clusterId:"",clusterName:"",namespaceName:""}),H=(({isFetching:o,formData:n,handleSourceChange:i,handleSelectAll:l,selectedArea:s,setSelectedArea:r,searchText:c,searchBy:d,filters:u})=>{const{isVm:p}=y(),h=Cr(p),g=a(()=>n.map(e=>{const t=[...e.namespaces].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>zl(e,c,u)).map(e=>({name:e.name,totalWorkloads:e.workloads.length,...Ml(e)}));return{clusterId:e.clusterId,clusterName:e.clusterName,visibleNamespaces:t}}),[n,c,u]),m=a(()=>{let e=!1;for(const{visibleNamespaces:t}of g)for(const{totalWorkloads:o,selectedCount:n}of t)if(e=!0,n!==o)return!1;return e},[g]),{list:f,withFilterCount:b,filteredCount:v,totalCount:C}=a(()=>{const e=g.map(({clusterId:e,clusterName:o,visibleNamespaces:n})=>n.length?t(Lr,{withCollapse:g.length>1,clusterId:e,clusterName:o,namespaces:n,selectedArea:s,setSelectedArea:r,handleSourceChange:i},e):null),o=e.filter(e=>null!==e);return{list:o,withFilterCount:o.length!==e.length,filteredCount:o.length,totalCount:e.length}},[g,s]);return{width:"60%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:h.groupColumnHeader}),t(De,{text:b?He.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${b?`${v} / ${C}`:C}`,status:ft.Unknown})})]}),t(ae,{"data-id":"namespaces-select-all",onClick:()=>l({boolean:!m,searchText:c,searchBy:d,filters:u}),disabled:!f.length,size:le.XS,children:Tr(m)})]}),list:f.length?f:o?[t(at,{$height:"100%",children:t(ct,{title:h.fetchingGroups.title,subTitle:h.fetchingGroups.subTitle,withSpinner:!0})},"loading")]:[t(at,{$height:"100%",children:t(Ce,c?{icon:Ei,title:Sr,subTitle:h.noGroupMatchedFilter(c)}:{icon:Ei,title:h.noGroups.title,subTitle:h.noGroups.subTitle})},"no-data")]}})({isFetching:E,formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:V,setSelectedArea:U,searchText:z===mt.Namespace?L:"",searchBy:z,filters:B}),G=(({formData:o,handleSourceChange:n,handleSelectAll:i,selectedArea:l,searchText:s,searchBy:r,filters:c})=>{const{tier:d,isVm:u}=y(),p=Cr(u),h=d===bt.Onprem,g=a(()=>l.value.namespaceName?o.find(({clusterId:e})=>e===l.value.clusterId)?.namespaces.find(({name:e})=>e===l.value.namespaceName):void 0,[o,l.value.clusterId,l.value.namespaceName]),m=a(()=>g?[...g.workloads].sort((e,t)=>e.name.localeCompare(t.name)).filter(e=>Ll(e,s,c)):[],[g,s,c]),f=a(()=>!!m.length&&m.every(({selected:e})=>e),[m]),b=a(()=>{if(!g)return[];const{clusterId:e}=l.value,{name:o}=g;return m.map(({name:a,selected:i,kind:l})=>{const s=!u&&!h&&_l.has(l);return t(Rr,{workloadName:a,workloadKind:l,isChecked:!s&&(i||!1),onToggle:()=>n({clusterId:e,workloadId:{namespace:o,name:a,kind:l}}),disabled:s,disabledReason:Ar},`${e}#${o}#${a}#${l}`)})},[m,g,l.value.clusterId]),{withFilterCount:v,filteredCount:C,totalCount:S}=a(()=>{const e=g?.workloads.length??0;return{withFilterCount:m.length!==e,filteredCount:m.length,totalCount:e}},[m,g]);return{width:"40%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,nowrap:!0,children:l.value.namespaceName?`${l.value.namespaceName} > ${p.itemColumnHeader}`:p.itemColumnHeader}),t(De,{text:v?He.FILTERED_COUNT_TOOLTIP:void 0,children:t(Be,{label:`${v?`${C} / ${S}`:S}`,status:ft.Unknown})})]}),t(ae,{"data-id":"workloads-select-all",onClick:()=>i({clusterId:l.value.clusterId,namespaceName:l.value.namespaceName,boolean:!f,searchText:s,searchBy:r,filters:c}),disabled:!b.length,size:le.XS,children:Tr(f)})]}),list:b.length?b:[t(at,{$height:"100%",children:t(Ce,g?s?{icon:$i,title:Sr,subTitle:xr(s)}:{icon:$i,title:wr,subTitle:p.noItemsInGroupSubTitle}:{icon:$i,title:p.selectGroupPrompt.title,subTitle:p.selectGroupPrompt.subTitle})},"no-data")]}})({formData:N,handleSourceChange:O,handleSelectAll:R,selectedArea:{value:V},searchText:z===mt.Source?L:"",searchBy:z,filters:B});return t(Sl,{isOpen:!0,withOverlay:d,disableAnimation:u,onClose:o?()=>{$(xt.BulkInstrumenting),o()}:void 0,onBack:i?()=>i(D):void 0,onNext:l?()=>l(D):void 0,nextIsSkip:!P,onSave:()=>h.persistV2(D),header:{icon:$i,title:He.ADD_SOURCE,subTitle:He.ADD_SOURCES_DESCRIPTION},connectionIds:r&&c?{value:r,setValue:c}:void 0,search:{value:L,onChange:e=>{_(e),z===mt.Namespace&&U({clusterId:"",clusterName:"",namespaceName:""})},placeholder:x.searchPlaceholder(z),segment:{options:[{label:x.groupSegmentLabel,value:mt.Namespace},{label:x.itemSegmentLabel,value:mt.Source}],selected:z,setSelected:M}},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:kr}),t(Q,{name:"filter-selected",size:vt.S,label:$r,value:B.showOnlySelected,onChange:e=>X(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:P,isFetching:E,progress:{title:He.CREATING_SOURCES,subTitle:He.CREATING_SOURCES_SUBTITLE,percentage:k[xt.BulkInstrumenting]?.percentage||0},leftColumn:H,rightColumn:G})},zr=(e,t)=>{const o=[{id:"type",title:He.TYPE,label:t.label},{id:"status",title:He.STATUS,badge:{status:e.disabled?ft.Unknown:Ee.Success,label:e.disabled?He.DISABLED:He.ENABLED}}],n=e.signals?.map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return n&&o.push({id:"signals",title:He.SIGNALS_FOR_PROCESSING,label:n}),e.name&&o.push({id:"name",title:He.NAME,label:e.name}),e.notes&&o.push({id:"notes",title:He.NOTES,label:e.notes}),o},Mr=({onClose:i,actionId:r})=>{const c=f(),{actionsApi:d}=sl(),{items:u,refetch:p}=d.useActions(),{selectedOption:h,loadAction:g,validateFormData:m,genericForm:b}=Al();n(()=>{p()},[]);const[v,y]=s(!1),[C,S]=s(!1),[w,x]=s(null),T=v&&!!b?.isFormDirty,k=a(()=>u?.find(e=>Tt(e)===r),[r,u]),$=a(()=>nt.find(({type:e})=>e===k?.type)??null,[k?.type]);n(()=>{k&&g(k)},[k]);const E=l(()=>{k&&y(!0)},[k]),I=l(()=>{k&&(g(k),y(!1))},[k,g]),A=l(()=>{T?x("close"):i()},[T,i]),N=l(()=>{T?x("cancel"):I()},[T,I]),O=l(()=>{const e=w;x(null),"close"===e?(I(),i()):I()},[w,I,i]),R=l(async()=>{if(k){const{errorMessage:e,preparedFormData:t}=m();e||(await d.update(k.id,t),y(!1))}},[k,m,d]),D=l(()=>{k&&S(!0)},[k]),P=l(async()=>{k&&(await d.remove(k.id,k.type),i())},[k,d,i]);if(!k||!$)return null;const F=(e=>{const t=[],{type:o,fields:n}=e,a=e=>({status:e?Ee.Success:ft.Unknown,label:e?"True":"False",invertColors:!0});if(o===ye.K8sAttributes&&(t.push({id:"collectContainerAttributes",title:"Collect Container Attributes",badge:a(n.collectContainerAttributes)}),t.push({id:"collectReplicaSetAttributes",title:"Collect ReplicaSet Attributes",badge:a(n.collectReplicaSetAttributes)}),t.push({id:"collectWorkloadId",title:"Collect Workload ID",badge:a(n.collectWorkloadId)}),t.push({id:"collectClusterId",title:"Collect Cluster ID",badge:a(n.collectClusterId)}),n.labelsAttributes?.forEach(({labelKey:e,attributeKey:o,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(n.labelsAttributes?.length??0)>1?`Label #${l+1} `:"Label ";t.push({id:`label-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`label-${l}-attr`,title:`${r}Attribute Key`,label:o}),t.push({id:`label-${l}-from`,title:`${r}From`,label:s})}),n.annotationsAttributes?.forEach(({annotationKey:e,attributeKey:o,from:a,fromSources:i},l)=>{const s=i?.length?i.join(", "):a||Z.Pod,r=(n.annotationsAttributes?.length??0)>1?`Annotation #${l+1} `:"Annotation ";t.push({id:`annotation-${l}-key`,title:`${r}Key`,label:e}),t.push({id:`annotation-${l}-attr`,title:`${r}Attribute Key`,label:o}),t.push({id:`annotation-${l}-from`,title:`${r}From`,label:s})})),o===ye.AddClusterInfo&&(t.push({id:"overwriteExistingValues",title:"Overwrite Existing Values",badge:a(n.overwriteExistingValues)}),n.clusterAttributes?.forEach(({attributeName:e,attributeStringValue:o},n)=>{t.push({id:`cluster-attr-${n}`,title:e,label:o})})),o===ye.DeleteAttributes&&n.attributeNamesToDelete?.forEach((e,o)=>{t.push({id:`del-attr-${o}`,title:"Attribute"+((n.attributeNamesToDelete?.length??0)>1?` #${o+1}`:""),label:e})}),o===ye.RenameAttributes&&Object.entries(n.renames||{}).forEach(([e,o],n)=>{t.push({id:`rename-${n}`,title:e,label:o})}),o===ye.PiiMasking&&n.piiCategories?.forEach((e,o)=>{t.push({id:`pii-${o}`,title:"Category"+((n.piiCategories?.length??0)>1?` #${o+1}`:""),label:e})}),o===ye.ExtractAttribute){const e=n.extractAttribute?.extractions??[];e.forEach(({targetAttributeName:o,lookupKey:n,dataFormat:a,regex:i},l)=>{const s=e.length>1?`Extraction #${l+1} `:"Extraction ";t.push({id:`extract-${l}-target`,title:`${s}New Attribute Name`,label:o||"-"}),n&&t.push({id:`extract-${l}-lookupKey`,title:`${s}Lookup Key`,label:n}),a&&t.push({id:`extract-${l}-format`,title:`${s}Data Format`,label:a}),i&&t.push({id:`extract-${l}-regex`,title:`${s}Regex`,label:i})})}return o===ye.URLTemplatization&&n.urlTemplatizationRulesGroups?.forEach((e,o)=>{const a=(n.urlTemplatizationRulesGroups?.length??0)>1?`Group #${o+1} `:"Group ";e.filterK8sNamespace&&t.push({id:`group-${o}-ns`,title:`${a}Namespace`,label:e.filterK8sNamespace}),e.workloadFilters?.forEach((n,i)=>{const l=[n.kind,n.name].filter(Boolean).join("/");l&&t.push({id:`group-${o}-wf-${i}`,title:`${a}Workload${(e.workloadFilters?.length??0)>1?` #${i+1}`:""}`,label:l})});const i=e.templatizationRules?.map(e=>e.template).filter(Boolean).join(", ");i&&t.push({id:`group-${o}-templates`,title:`${a}Templates`,label:i}),e.notes&&t.push({id:`group-${o}-notes`,title:`${a}Notes`,label:e.notes})}),t})(k);return e(o,{children:[t(oe,{isOpen:!0,header:{icon:At(k.type),title:$.label,onClose:A,actions:[{id:"edit-action-btn-edit",label:kt.EDIT,icon:mi,active:v,onClick:E},{id:"edit-action-btn-delete",label:kt.DELETE,icon:ri,color:c.v2.colors.red[500],active:C,onClick:D}]},footer:{actions:v?[{"data-id":"edit-action-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:N},{"data-id":"edit-action-btn-save",label:kt.SAVE,variant:de.Primary,onClick:R}]:[]},children:t($t,{$padding:"4px 12px 12px",children:v&&h?t(Ds,{}):t(W,{$gap:16,children:e(Et,{bgTint:"1000",children:[e(Et,{bgTint:"900",children:[t(It,{conditions:k.conditions||[]}),t(Et,{bgTint:"800",cellsPerRow:2,items:zr(k,$)})]}),!!F?.length&&t(Et,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Et,{bgTint:"800",cellsPerRow:2,items:F})})]})})})}),t(wl,{target:"action",isOpen:C,onClose:()=>S(!1),onApprove:P}),t(xl,{isOpen:null!==w,onClose:()=>x(null),onApprove:O})]})},Br=({onClose:o,connections:l,selectedConnectionIds:r,setSelectedConnectionIds:c})=>{const{configApi:d}=sl(),[u,p]=s(""),[h,g]=s({showOnlySelected:!1}),m=a(()=>l.filter(e=>{const t=!u||e.name.toLowerCase().includes(u.toLowerCase()),o=!h.showOnlySelected||h.showOnlySelected&&r.includes(e.id);return t&&o}),[l.length,r.length,u,h]),f=e=>{c(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=1===r.length?r[0]:void 0,{data:v,loading:y}=d.useEffectiveConfig(b?{id:b}:void 0,{skip:!b}),C=a(()=>{if(b&&v)return{rollout:{automaticRolloutDisabled:v.rollout?.automaticRolloutDisabled??!1}}},[b,v]),{formData:S,handleFormChange:w,areFormValuesEqual:x,resetFormData:T}=Nt(C||{rollout:{automaticRolloutDisabled:!1}}),k=i(T);k.current=T,n(()=>{C&&k.current(C)},[C]);const $=a(()=>r.length>1||void 0!==C&&!x(C,S),[r.length,C,S]);return t(Sl,{isOpen:!0,onClose:o,onSave:async()=>await(d.applyConfigurations?.(S,r))??void 0,header:{icon:Ii,title:"Cluster Configuration"},connectionIds:{value:r,setValue:c},search:{placeholder:"Search by cluster name",value:u,onChange:p},filters:e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,nowrap:!0,children:"Show only:"}),t(Q,{size:vt.S,label:"Selected",value:h.showOnlySelected,onChange:e=>g(t=>({...t,showOnlySelected:e}))})]}),isFormDirty:$,isFetching:y,leftColumn:{width:"35%",header:e(se,{$width:"100%",$gap:12,$justifyContent:"space-between",children:[e(se,{$gap:8,children:[t(ae,{size:le.XS,children:"Clusters"}),t(Be,{label:m.length,status:ft.Unknown})]}),e(se,{$gap:8,children:[t(ae,{size:le.XXXS,color:ie.Secondary,align:"right",children:"Selected clusters"}),t(Be,{label:`${r.length}/${m.length}`,status:ft.Unknown})]})]}),list:m.map(e=>t(ir,{title:e.name,isChecked:r.includes(e.id),onClick:()=>f(e.id),onCheckboxChange:()=>f(e.id)},e.id))},rightColumn:{width:"65%",header:t(ae,{size:le.XS,children:"Configurations"}),list:[t(Q,{label:"Automatic rollout disabled",tooltip:"Odigos automatically triggers a one-time rollout for workloads when instrumenting or uninstrumenting, ensuring that changes are applied without requiring manual intervention. When automatic rollout is disabled, Odigos will not restart workloads, and users will need to manually trigger rollouts after adding or removing sources.",value:S.rollout?.automaticRolloutDisabled||!1,onChange:e=>w("rollout.automaticRolloutDisabled",e)},"automatic-rollout-disabled")]}})},Xr=e=>{const t=[{id:"type",title:He.TYPE,label:e.destinationType.displayName},{id:"status",title:He.STATUS,badge:{status:e.disabled?ft.Unknown:Ee.Success,label:e.disabled?He.DISABLED:He.ENABLED}}],o=Ae(e.exportedSignals).map(e=>{let t=e.toLowerCase();return t=`${t.charAt(0).toUpperCase()}${t.slice(1)}`,t}).join(", ");return o&&t.push({id:"monitors",title:He.MONITORS,label:o}),e.name&&t.push({id:"name",title:He.NAME,label:e.name}),t},Vr=({onClose:r,destinationId:c})=>{const d=f(),{isVm:u}=y(),{destinationsApi:p}=sl(),{selectedStreamName:h}=Ge(),{items:g,refetch:m}=p.useDestinations(),{data:b,loading:v}=p.useDestinationCategories(),{activeForm:C,loadDestination:S,validateFormData:w,genericForm:x}=Nl();n(()=>{m()},[]);const T=i(null),[k,$]=s(!1),[E,I]=s(!1),[A,N]=s(null),O=k&&!!x?.isFormDirty,R=a(()=>Dt(g,h),[g,h]),D=a(()=>R?.find(e=>Tt(e)===c),[c,R]),P=b?.destinationCategories?.categories??null;n(()=>{D&&P&&S(D,P)},[D,P]);const F=a(()=>D&&P?Pt(P,D):[],[D,P]),L=l(()=>{D&&$(!0)},[D]),_=l(()=>{D&&P&&(S(D,P),$(!1))},[D,P,S]),z=l(()=>{O?N("close"):r()},[O,r]),M=l(()=>{O?N("cancel"):_()},[O,_]),B=l(()=>{const e=A;N(null),"close"===e?(_(),r()):_()},[A,_,r]),X=l(async()=>{if(D){const{errorMessage:e,preparedFormData:t}=w();e||(await p.update(D.id,Oe(t)),$(!1))}},[D,w,p]),V=l(()=>{D&&I(!0)},[D]),U=l(async()=>{D&&(await p.remove(D.id),r())},[D,p,r]);if(!D)return null;const{icon:H,iconSrc:G}=ut(D.destinationType.type),j=((e,t)=>{const o=[],n=Ot(e,t),a=n.map(e=>({name:e.key,value:e.value})),i=Ae(e.exportedSignals);let l=[];const s=()=>{l.length&&(o.push({kind:"cells",id:`cells-${o.length}`,items:l}),l=[])};return n.forEach(({key:e,name:n,value:r})=>{const c=t.find(t=>t.name===e),{secret:d,componentType:u,componentProperties:p,hideFromReadData:h,customReadDataLabels:g}=c||{};if(h?.length&&ke(h,i,a))return;const{type:m}=ht(p,{type:""}),f=d||"password"===m;if(g?.length)g.forEach(({condition:t,...o},n)=>{t==r&&l.push({id:`${e}-custom-${n}`,title:o.title,label:o.value})});else if(r)if(f)l.push({id:e,title:n,label:new Array(10).fill("•").join("")});else{if(u===Rt.MultiInput){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void o.push({kind:"list",id:e,title:n,items:t.map((t,o)=>({id:`${e}-${o}`,label:String(t)}))})}if(u===Rt.KeyValuePair){const t=ht(r,null);if(Array.isArray(t)&&t.length)return s(),void o.push({kind:"pairs",id:e,title:n,items:t.map((t,o)=>{const n=t&&"object"==typeof t?t:{};return{id:`${e}-${o}`,title:null!=n.key?String(n.key):"",label:null!=n.value?String(n.value):""}})})}l.push({id:e,title:n,label:r})}else l.push({id:e,title:n,label:"-"})}),s(),o})(D,F);return e(o,{children:[t(oe,{isOpen:!0,header:{icon:H,iconSrc:G,title:D.name||D.destinationType.displayName,onClose:z,actions:[{id:"edit-destination-btn-edit",label:kt.EDIT,icon:mi,active:k,onClick:L},{id:"edit-destination-btn-delete",label:kt.DELETE,icon:ri,color:d.v2.colors.red[500],active:E,onClick:V}]},footer:{actions:k?[{"data-id":"edit-destination-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:M},...C?.option.testConnectionSupported&&!u?[{"data-id":"edit-destination-btn-test-connection",label:kt.TEST_CONNECTION,variant:de.Secondary,onClick:()=>T.current?.testConnection()}]:[],{"data-id":"edit-destination-btn-save",label:kt.SAVE,variant:de.Primary,onClick:X}]:[]},children:t($t,{$padding:"4px 12px 12px",children:v?t(at,{$height:"50vh",children:t(ct,{withSpinner:!0})}):k&&C?t(Ls,{ref:T,isEdit:!0}):t(W,{$gap:16,children:e(Et,{bgTint:"1000",children:[e(Et,{bgTint:"900",children:[!u&&t(It,{conditions:D.conditions||[]}),t(Et,{bgTint:"800",cellsPerRow:2,items:Xr(D)})]}),!!j.length&&t(Et,{bgTint:"900",richTitle:{title:"Configuration"},withCollapse:!0,collapseIsDefaultOpen:!0,children:j.map(e=>"cells"===e.kind?t(Et,{bgTint:"800",cellsPerRow:2,items:e.items},e.id):(e.kind,t(Et,{bgTint:"800",richTitle:{title:e.title},cellsPerRow:2,items:e.items},e.id)))})]})})})}),t(wl,{target:"destination",isOpen:E,onClose:()=>I(!1),onApprove:U}),t(xl,{isOpen:null!==A,onClose:()=>N(null),onApprove:B})]})},Ur=(e,t)=>{const o=[{id:"type",title:He.TYPE,label:t.label},{id:"status",title:He.STATUS,badge:{status:e.disabled?ft.Unknown:Ee.Success,label:e.disabled?He.DISABLED:He.ENABLED}}];return e.ruleName&&o.push({id:"name",title:He.NAME,label:e.ruleName}),e.profileName&&o.push({id:"profile",title:He.MANAGED_BY_PROFILE,label:e.profileName}),e.notes&&o.push({id:"notes",title:He.NOTES,label:e.notes}),o},Hr=({onClose:i,ruleId:r})=>{const c=f(),{addNotification:d}=Lt(),{instrumentationRulesApi:u}=sl(),{items:p,refetch:h}=u.useRules(),{selectedOption:g,loadRule:m,validateFormData:b,genericForm:v}=Ol();n(()=>{h()},[]);const[y,C]=s(!1),[S,w]=s(!1),[x,T]=s(null),k=y&&!!v?.isFormDirty,$=a(()=>p?.find(e=>Tt(e)===r),[r,p]),E=a(()=>gt.find(({type:e})=>e===$?.type)??null,[$?.type]);n(()=>{$&&m($)},[$]);const I=l(()=>{if($){if(!$.mutable)return void d({type:Ee.Warning,title:_t.FORBIDDEN,message:_t.CANNOT_EDIT_RULE,crdType:mt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});C(!0)}},[$,d]),A=l(()=>{$&&(m($),C(!1))},[$,m]),N=l(()=>{k?T("close"):i()},[k,i]),O=l(()=>{k?T("cancel"):A()},[k,A]),R=l(()=>{const e=x;T(null),"close"===e?(A(),i()):A()},[x,A,i]),D=l(async()=>{if($){const{errorMessage:e,preparedFormData:t}=b();e||(await u.update($.ruleId,t,$.type),C(!1))}},[$,b,u]),P=l(()=>{if($){if(!$.mutable)return void d({type:Ee.Warning,title:_t.FORBIDDEN,message:_t.CANNOT_DELETE_RULE,crdType:mt.InstrumentationRule,target:$.ruleId,hideFromHistory:!0});w(!0)}},[$,d]),F=l(async()=>{$&&(await u.remove($.ruleId,$.type),i())},[$,u,i]);if(!$||!E)return null;const L=((e,o)=>{const n=[];return e.payloadCollection&&Object.entries(e.payloadCollection).forEach(([e,o])=>{o&&n.push(t(ae,{size:le.XS,children:`• ${Ft(e).toLowerCase()}`},`payload-${e}`))}),e.codeAttributes&&Object.entries(e.codeAttributes).forEach(([e,o])=>{o&&n.push(t(ae,{size:le.XS,children:`• ${Ft(e).toLowerCase()}`},`code-${e}`))}),e.headersCollection?.[Pe.HeaderKeys]?.length&&e.headersCollection[Pe.HeaderKeys].forEach((e,o)=>{e&&n.push(t(ae,{size:le.XS,children:e},`header-${o}-${e}`))}),e.customInstrumentations&&(e.customInstrumentations[ze.Java]?.forEach((e,a)=>{const i=new _e(e.className,e.methodName);if(i.Verify()){0===a&&n.push(t(ae,{size:le.XS,children:"Java Custom Probes:"},"java-custom-probes"));const e=i.toString();n.push(t(ae,{size:le.XXS,color:o.v2.colors.grey[200],children:`• ${e}`},`java-probe-${a}-${e}`))}}),e.customInstrumentations[ze.Golang]?.forEach((e,a)=>{const i=new Le(e.packageName,e.functionName,e.receiverName,e.receiverMethodName);if(i.Verify()){0===a&&n.push(t(ae,{size:le.XS,children:"Golang Custom Probes:"},"golang-custom-probes"));const e=i.toString();n.push(t(ae,{size:le.XXS,color:o.v2.colors.grey[200],children:`• ${e}`},`golang-probe-${a}-${e}`))}})),n})($,c);return e(o,{children:[t(oe,{isOpen:!0,header:{icon:Mt($.type),title:E.label,onClose:N,actions:[{id:"edit-rule-btn-edit",label:kt.EDIT,icon:mi,active:y,onClick:I},{id:"edit-rule-btn-delete",label:kt.DELETE,icon:ri,color:c.v2.colors.red[500],active:S,onClick:P}]},footer:{actions:y?[{"data-id":"edit-rule-btn-cancel",label:kt.CANCEL,variant:de.Secondary,onClick:O},{"data-id":"edit-rule-btn-save",label:kt.SAVE,variant:de.Primary,onClick:D}]:[]},children:t($t,{$padding:"4px 12px 12px",children:y&&g?t(Hs,{}):t(W,{$gap:16,children:e(Et,{bgTint:"1000",children:[e(Et,{bgTint:"900",children:[t(It,{conditions:$.conditions||[]}),t(Et,{bgTint:"800",cellsPerRow:2,items:Ur($,E)})]}),t(ul,{readOnly:!0,scopes:$.sourceScopes??null}),!!L.length&&t(Et,{bgTint:"900",richTitle:{title:"Collect"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Et,{bgTint:"800",children:L})}),!!E.supportedLanguages.length&&t(Et,{bgTint:"900",richTitle:{title:"Supported languages"},withCollapse:!0,collapseIsDefaultOpen:!0,children:t(Et,{bgTint:"800",children:t(se,{$gap:12,$wrap:"wrap",children:E.supportedLanguages.map(e=>t(zt,{label:Xe[e],leftIcon:Ve(e),flex:"0.5"},e))})})})]})})})}),t(wl,{target:"instrumentation rule",isOpen:S,onClose:()=>w(!1),onApprove:F}),t(xl,{isOpen:null!==x,onClose:()=>T(null),onApprove:R})]})};var Gr;!function(e){e.Overview="overview",e.Pods="pods",e.PeerSources="peer-sources",e.Profiling="profiling",e.Sampling="sampling",e.Debug="debug"}(Gr||(Gr={}));const jr=({collapseIsDefaultOpen:e,isJumpToTarget:o,onClickRestartPod:n,namespace:i,podName:l,nodeName:s,startTime:r,agentInjectedStatus:c,odigosHealthStatus:d,k8sHealthStatus:u,children:p})=>{const{formatDurationAgo:h}=Bt(),g=Xt(!!o),m=a(()=>({title:l,icon:Ai,withCopy:!0}),[l]),f=a(()=>{const e=[],t=Vt(c);t&&e.push(t);const o=Vt(d,Ni,"health");o&&e.push(o);const n=Vt(u,Oi,"health");return n&&e.push(n),e},[c,d,u]),b=a(()=>n?[{id:`restart-pod-${l}`,icon:Ri,label:kt.RESTART_POD,onClick:()=>n(i,l)}]:void 0,[n,i,l]),v=a(()=>[{id:"nodeName",title:He.NODE,label:s,withCopy:!0},{id:"age",title:He.AGE,label:r?h(r,{style:"short"}):He.NOT_RUNNING,labelTooltip:r}],[s,r,h]);return t("div",{ref:g,children:t(Et,{bgTint:"900",richTitle:m,badges:f,dropDataActions:b,items:v,withCollapse:!0,collapseIsDefaultOpen:e,children:p})})},Wr=m.div`
|
|
192
192
|
display: flex;
|
|
193
193
|
align-items: center;
|
|
194
194
|
justify-content: space-between;
|
package/lib/containers.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import o,{useTheme as r}from"styled-components";import{memo as a,useState as s,useCallback as n,useEffect as d,useMemo as l,createContext as c,useContext as p,useRef as u}from"react";import{U as m}from"./chunks/consts-D6GCMJ6c.js";import{MarkerType as g,useNodesState as h,useEdgesState as f,Handle as v,Position as y,getSmoothStepPath as N,BaseEdge as S,EdgeLabelRenderer as b,ReactFlowProvider as x,ReactFlow as w,Background as k,Controls as M,ControlButton as T,useReactFlow as C}from"@xyflow/react";import{N as I,o as $,p as E,q as K,r as V,v as _,w as z,b as A,c as L,x as R,y as X,B as j,z as D,L as P,M as q,O as G,Q as F,R as H}from"./chunks/ui-components-B1TCLO_N.js";import{UserIcon as O,ImageErrorIcon as B,RefreshIcon as U}from"./icons.js";import Y from"elkjs/lib/elk.bundled.js";import{d as W}from"./chunks/use-odigos-api-
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as i}from"react/jsx-runtime";import o,{useTheme as r}from"styled-components";import{memo as a,useState as s,useCallback as n,useEffect as d,useMemo as l,createContext as c,useContext as p,useRef as u}from"react";import{U as m}from"./chunks/consts-D6GCMJ6c.js";import{MarkerType as g,useNodesState as h,useEdgesState as f,Handle as v,Position as y,getSmoothStepPath as N,BaseEdge as S,EdgeLabelRenderer as b,ReactFlowProvider as x,ReactFlow as w,Background as k,Controls as M,ControlButton as T,useReactFlow as C}from"@xyflow/react";import{N as I,o as $,p as E,q as K,r as V,v as _,w as z,b as A,c as L,x as R,y as X,B as j,z as D,L as P,M as q,O as G,Q as F,R as H}from"./chunks/ui-components-B1TCLO_N.js";import{UserIcon as O,ImageErrorIcon as B,RefreshIcon as U}from"./icons.js";import Y from"elkjs/lib/elk.bundled.js";import{d as W}from"./chunks/use-odigos-api-BMcghWbA.js";import"@xyflow/react/dist/style.css";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const Z=o.div`
|
|
2
2
|
padding: 12px;
|
|
3
3
|
border-radius: 12px;
|
|
4
4
|
background-color: ${({theme:e})=>e.v2.colors.silver[750]};
|
|
@@ -17,6 +17,9 @@ export interface UseSnapshotsResult {
|
|
|
17
17
|
loading: boolean;
|
|
18
18
|
/** True when the host adapter doesn't expose `GET_ALL_CLUSTER_SNAPSHOTS` at all. */
|
|
19
19
|
unsupported: boolean;
|
|
20
|
+
refetch: () => Promise<{
|
|
21
|
+
data?: AllClusterSnapshots;
|
|
22
|
+
} | undefined>;
|
|
20
23
|
}
|
|
21
24
|
export interface SnapshotsApi {
|
|
22
25
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e as o,r,f as t}from"../chunks/use-odigos-api-
|
|
1
|
+
import{e as o,r,f as t}from"../chunks/use-odigos-api-BMcghWbA.js";export{O as OdigosApiProvider,p as prepareNamespacePayloads,a as prepareSourcePayloads,u as useApiLazyQuery,b as useApiMutation,c as useApiQuery,d as useOdigosApi}from"../chunks/use-odigos-api-BMcghWbA.js";export{O as OdigosApiConnectionsScope}from"../chunks/connections-scope-D_2Q866B.js";import{useApolloClient as e}from"@apollo/client";import{P as s,t as i}from"../chunks/ui-components-B1TCLO_N.js";import"react";import"react/jsx-runtime";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";import"styled-components";import"../icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"../chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";const n=()=>{const s=e(),{operations:i,context:n}=o();return{multiFetch:async(o,r,e)=>{const a=i[o];return a?t(s,a,r,e,n):{results:[],allSucceeded:!1,anySucceeded:!1,successCount:0,failureCount:r.length,error:`Operation ${String(o)} not configured`}},bulkPersistSources:async(o,t)=>{const e=[];for(const a of o){const o={...n,proxyID:a},{error:c}=await r(s,i.PERSIST_SOURCES,t,o);c&&e.push(`${a}: ${c}`)}return e.length?{error:e.join(", ")}:void 0},applyConfigurations:async(o,t)=>{if(!i.UPDATE_REMOTE_CONFIG)return{error:"UPDATE_REMOTE_CONFIG not configured"};const{error:e}=await r(s,i.UPDATE_REMOTE_CONFIG,{formData:t,connectionIds:o},n);return e?{error:e}:void 0}}},m=(o,r)=>o.platformType===s.K8s?r.K8s:o.platformType===s.Vm?r.Vm:void 0,l=o=>r=>{const t=o[r.platformType];if(!t)return;const e=Object.keys(t);if(0===e.length)return;const s=i(r.schemaVersion??r.version),n=[...e].sort((o,r)=>i(r)-i(o)).find(o=>s>=i(o));return n?t[n]:void 0},f=(o,r)=>{const t={};for(const e of Object.keys(o))t[e]=r(o[e]);return t};export{m as pickByPlatform,n as useApiForConnections,l as versionedDocument,f as vmDialectMap};
|
package/lib/contexts.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{A as ActionFormContextProvider,D as DataStreamFormContextProvider,a as DestinationFormContextProvider,R as RuleFormContextProvider,S as SamplingRuleFormType,b as SamplingRulesFormProvider,c as SourceEditFormContextProvider,d as SourceInstrumentFormContextProvider,u as useActionFormContext,e as useDataStreamFormContext,f as useDestinationFormContext,g as useRuleFormContext,h as useSamplingRulesFormContext,i as useSourceEditFormContext,j as useSourceInstrumentFormContext}from"./chunks/source-instrument-form-context-
|
|
1
|
+
export{A as ActionFormContextProvider,D as DataStreamFormContextProvider,a as DestinationFormContextProvider,R as RuleFormContextProvider,S as SamplingRuleFormType,b as SamplingRulesFormProvider,c as SourceEditFormContextProvider,d as SourceInstrumentFormContextProvider,u as useActionFormContext,e as useDataStreamFormContext,f as useDestinationFormContext,g as useRuleFormContext,h as useSamplingRulesFormContext,i as useSourceEditFormContext,j as useSourceInstrumentFormContext}from"./chunks/source-instrument-form-context-DaQkZ03_.js";export{O as OdigosProvider,c as checkVersionSupport,u as useOdigos}from"./chunks/helpers-CUmUiA_l.js";import{jsx as o}from"react/jsx-runtime";import{useMemo as r,useContext as t,createContext as s}from"react";export{O as OdigosApiConnectionsScope}from"./chunks/connections-scope-D_2Q866B.js";export{O as OdigosApiProvider,p as prepareNamespacePayloads,a as prepareSourcePayloads,u as useApiLazyQuery,b as useApiMutation,c as useApiQuery,d as useOdigosApi}from"./chunks/use-odigos-api-BMcghWbA.js";export{pickByPlatform,useApiForConnections,versionedDocument,vmDialectMap}from"./contexts/odigos-api.js";import"./chunks/ui-components-B1TCLO_N.js";import"styled-components";import"./icons.js";import"zustand";import"javascript-time-ago";import"javascript-time-ago/locale/en";import"prism-react-renderer";import"./chunks/vendor-BFqT13Me.js";import"zustand/middleware";import"react-error-boundary";import"react-dom";import"virtua";import"@apollo/client";import"@apollo/client/link/error";import"@apollo/client/link/context";import"@apollo/client/utilities";const n=s({formType:void 0}),m=({children:e,formType:t})=>{const s=r(()=>({formType:t}),[t]);return o(n.Provider,{value:s,children:e})},l=()=>t(n);export{m as StorybookProvider,l as useStorybook};
|