"use strict";(self.webpackChunkgrafana=self.webpackChunkgrafana||[]).push([[8504],{52236(y,s,t){t.r(s),t.d(s,{default:()=>C});var a=t(74848),M=t(29189),O=t(54148),u=t(16817),i=t(92745),d=t(36490),h=t(34999),A=t(1506),v=t(64762),o=t(36826),l=t(77256),g=t(66769),m=t(8900),c=t(69730),f=t(98040),P=t(21779),p=t(49366);function I(){const{enrichmentK8sName:n}=(0,O.g)(),e=(0,p.P)(n),{data:_,isLoading:r,error:E}=m.q.useGetAlertEnrichmentQuery(n?{name:n}:M.hT);return E?(0,a.jsx)(o.d,{navId:"alerting-admin",pageNav:e,children:(0,a.jsx)(h.F,{severity:"error",title:(0,i.t)("alerting.enrichment.load-error","Failed to load enrichment"),children:(0,l.JZ)(E)})}):!r&&!_?(0,a.jsx)(o.d,{navId:"alerting-admin",pageNav:e,children:(0,a.jsx)(A.L,{entity:"Alert Enrichment"})}):(0,a.jsx)(o.d,{navId:"alerting-admin",pageNav:e,isLoading:r,children:_&&(0,a.jsx)(L,{enrichment:_})})}function L({enrichment:n}){const[e,{isLoading:_}]=m.q.useReplaceAlertEnrichmentMutation(),r=(0,v._2)(),{value:E}=(0,u.A)(g.QX),T=()=>{d.Ny.push(c.b.list)},K=async U=>{if(!n.metadata){r.error((0,i.t)("alert-enrichment.metadata-error","Invalid enrichment metadata"));return}const W={metadata:{name:n.metadata.name},spec:(0,P.Y5)(U)},B={name:n.metadata.name||"",alertEnrichment:W};try{await e(B).unwrap(),r.success((0,i.t)("alert-enrichment.update-success","Alert enrichment updated successfully!")),d.Ny.push(c.b.list)}catch(D){console.error("Failed to update alert enrichment:",D),r.error((0,i.t)("alert-enrichment.update-error","Failed to update alert enrichment"),(0,l.JZ)(D))}},R=(0,P.HQ)(n);return(0,a.jsx)(f._,{onSubmit:K,onCancel:T,editPayload:R,isLoading:_,llmEnabled:!!E})}const C=I}}]);

//# sourceMappingURL=EditEnrichment.de6e207b337d742a693a.js.map