Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
assets.8332.9bf1d89926b9972b5b0a.js Maven / Gradle / Ivy
"use strict";(self.webpackChunkopen_metadata=self.webpackChunkopen_metadata||[]).push([[8332],{58332:function(e,t,n){n.r(t),n.d(t,{default:function(){return D}});var a=n(70655),r=n(49409),l=n(71230),i=n(15746),s=n(56256),c=n(4107),u=n(71577),o=n(50963),m=n(96486),d=n(67294),p=n(68432),f=n(15137),E=n(30743),g=n(35850),Z=n(89011),b=n(97359),v=n(36169),h=n(62761),y=n(23051),I=n(5397),k=n(55538),C=n(48794),x=n(66537),N=n(46923),T=n(63866),A=n(96840),R=n(46321),w=n(20897),F=n(77743),M=n(88433),S=n(54549),V=n(34041),P=n(12028),L=n(47485),z=function(e){var t,n=e.supportedTriggers,c=(0,p.$)().t,o=r.Z.useFormInstance(),f=r.Z.useWatch(["input","actions"],o),E=(0,a.CR)(null!==(t=r.Z.useWatch(["resources"],o))&&void 0!==t?t:[],1)[0],g=(0,d.useMemo)((function(){return(0,T.Ju)(f,n)}),[f,n]);return d.createElement(L.Z,{heading:c("label.trigger"),subHeading:c("message.alerts-trigger-description")},d.createElement(r.Z.List,{name:["input","actions"]},(function(e,t,a){var p,Z=t.add,b=t.remove,v=a.errors,h=e.length<(null!==(p=null==n?void 0:n.length)&&void 0!==p?p:1);return d.createElement(l.Z,{"data-testid":"triggers-list",gutter:[16,16],key:"triggers"},e.map((function(e){var t,a,p=e.key,Z=e.name,v=null!==(t=o.getFieldValue(["input","actions",Z,"effect"]))&&void 0!==t?t:k.Qm.Include,h=!(0,m.isNil)(n)&&!(0,m.isEmpty)(f)&&f[Z];return d.createElement(i.Z,{"data-testid":"trigger-"+Z,key:"observability-"+p,span:24},d.createElement("div",{className:"flex gap-4"},d.createElement("div",{className:"flex-1 w-min-0"},d.createElement(l.Z,{gutter:[8,8]},d.createElement(i.Z,{span:12},d.createElement(r.Z.Item,{key:"trigger-"+p,name:[Z,"name"],rules:[{required:!0,message:c("message.field-text-is-required",{fieldText:c("label.trigger")})}]},d.createElement(V.Z,{"data-testid":"trigger-select-"+Z,options:g,placeholder:c("label.select-field",{field:c("label.trigger")}),onChange:function(){o.setFieldValue(["input","actions",Z,"arguments"],[])}}))),h&&(0,T.xI)(null!==(a=f[Z].name)&&void 0!==a?a:"",Z,E,n))),d.createElement("div",null,d.createElement(u.Z,{"data-testid":"remove-trigger-"+Z,icon:d.createElement(S.Z,null),onClick:function(){return b(Z)}}))),d.createElement(r.Z.Item,{label:d.createElement(s.Z.Text,null,c("label.include")),name:[Z,"effect"],normalize:function(e){return e?k.Qm.Include:k.Qm.Exclude}},d.createElement(P.Z,{checked:v===k.Qm.Include,"data-testid":"trigger-switch-"+Z})))})),h&&d.createElement(i.Z,{span:24},d.createElement(u.Z,{"data-testid":"add-trigger",disabled:(0,m.isEmpty)(E)||(0,m.isNil)(E),type:"primary",onClick:function(){return Z({effect:k.Qm.Include})}},c("label.add-entity",{entity:c("label.trigger")}))),d.createElement(r.Z.ErrorList,{errors:v}))})))},D=function(){var e,t,n=this,S=(0,p.$)().t,V=(0,f.k6)(),P=(0,a.CR)((0,o.useForm)(),1)[0],L=(0,x.f)().fqn,D=(0,C.N)(),G=D.setInlineAlertDetails,J=D.inlineAlertDetails,Q=(0,a.CR)((0,d.useState)([]),2),W=Q[0],q=Q[1],B=(0,a.CR)((0,d.useState)(),2),U=B[0],_=B[1],O=(0,a.CR)((0,d.useState)(0),2),$=O[0],H=O[1],K=(0,a.CR)((0,d.useState)(!1),2),X=K[0],Y=K[1],j=(0,d.useMemo)((function(){return!(0,m.isEmpty)(L)}),[L]),ee=(0,I.o)().getResourceLimit;(0,d.useEffect)((function(){(0,a.mG)(n,void 0,void 0,(function(){var e;return(0,a.Jh)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,3,4]),H((function(e){return e+1})),[4,(0,N.UT)()];case 1:return e=t.sent(),q(e.data),[3,4];case 2:return t.sent(),(0,R.Eo)(S("server.entity-fetch-error",{entity:S("label.config")})),[3,4];case 3:return H((function(e){return e-1})),[7];case 4:return[2]}}))})),L&&(0,a.mG)(n,void 0,void 0,(function(){var e,t,n;return(0,a.Jh)(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,3,4]),H((function(e){return e+1})),[4,(0,N.af)(L)];case 1:return e=r.sent(),t=(0,a.pi)((0,a.pi)({},e),{timeout:null!==(n=e.destinations[0].timeout)&&void 0!==n?n:10,destinations:e.destinations.map((function(e){var t=e.category===k.bz.External;return(0,a.pi)((0,a.pi)({},e),{destinationType:t?e.type:e.category})}))}),_(t),[3,4];case 2:return r.sent(),[3,4];case 3:return H((function(e){return e-1})),[7];case 4:return[2]}}))}))}),[L]);var te=(0,d.useMemo)((function(){return[{name:S("label.observability"),url:""},{name:S("label.alert-plural"),url:h.Z6.OBSERVABILITY_ALERTS},{name:S(L?"label.edit-entity":"label.create-entity",{entity:S("label.alert")}),url:""}]}),[L]),ne=(0,d.useCallback)((function(e){return(0,a.mG)(n,void 0,void 0,(function(){var t=this;return(0,a.Jh)(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,3,4]),Y(!0),[4,(0,T.Xn)({data:e,fqn:L,createAlertAPI:N.AI,updateAlertAPI:N.kD,afterSaveAction:function(){return(0,a.mG)(t,void 0,void 0,(function(){return(0,a.Jh)(this,(function(t){switch(t.label){case 0:return L?[3,2]:[4,ee("eventsubscription",!0,!0)];case 1:t.sent(),t.label=2;case 2:return V.push((0,A.mD)(e.name)),[2]}}))}))},setInlineAlertDetails:G})];case 1:case 2:return n.sent(),[3,4];case 3:return Y(!1),[7];case 4:return[2]}}))}))}),[L,V]),ae=(0,a.CR)(null!==(e=r.Z.useWatch(["resources"],P))&&void 0!==e?e:[],1)[0],re=(0,d.useMemo)((function(){var e;return null===(e=W.find((function(e){return e.name===ae})))||void 0===e?void 0:e.supportedFilters}),[W,ae]),le=(0,d.useMemo)((function(){var e;return null===(e=W.find((function(e){return e.name===ae})))||void 0===e?void 0:e.supportedActions}),[W,ae]),ie=(0,d.useMemo)((function(){return!ae||!(0,m.isEmpty)(re)}),[ae,re]),se=(0,d.useMemo)((function(){return!ae||!(0,m.isEmpty)(le)}),[ae,le]);return $?d.createElement(g.Z,null):d.createElement(Z.Z,{hideSecondPanel:!0,className:"content-height-with-resizable-panel",firstPanel:{className:"content-resizable-panel-container",children:d.createElement("div",{className:"steps-form-container"},d.createElement(l.Z,{className:"p-x-lg p-t-md",gutter:[16,16]},d.createElement(i.Z,{span:24},d.createElement(v.Z,{titleLinks:te})),d.createElement(i.Z,{span:24},d.createElement(s.Z.Title,{level:5},S("label."+(j?"edit":"add")+"-entity",{entity:S("label.alert")})),d.createElement(s.Z.Text,null,S("message.alerts-description"))),d.createElement(i.Z,{span:24},d.createElement(r.Z,{form:P,initialValues:(0,a.pi)((0,a.pi)({},U),{resources:null===(t=null==U?void 0:U.filteringRules)||void 0===t?void 0:t.resources}),validateMessages:h.NG,onFinish:ne},d.createElement(l.Z,{gutter:[20,20]},d.createElement(i.Z,{span:24},d.createElement(r.Z.Item,{label:S("label.name"),labelCol:{span:24},name:"name",rules:y.m},d.createElement(c.Z,{disabled:j,placeholder:S("label.name")}))),d.createElement(i.Z,{span:24},d.createElement(r.Z.Item,{label:S("label.description"),labelCol:{span:24},name:"description",trigger:"onTextChange",valuePropName:"initialValue"},d.createElement(b.Z,{"data-testid":"description",height:"200px",initialValue:""}))),d.createElement(i.Z,{span:24},d.createElement(w.Z,{filterResources:W})),ie&&d.createElement(i.Z,{span:24},d.createElement(M.Z,{supportedFilters:re})),se&&d.createElement(i.Z,{span:24},d.createElement(z,{supportedTriggers:le})),d.createElement(r.Z.Item,{hidden:!0,initialValue:k.NK.Observability,name:"alertType"}),d.createElement(r.Z.Item,{hidden:!0,initialValue:k.lP.User,name:"provider"}),d.createElement(i.Z,{span:24},d.createElement(F.Z,null)),!(0,m.isUndefined)(J)&&d.createElement(i.Z,{span:24},d.createElement(E.Z,(0,a.pi)({},J))),d.createElement(i.Z,{flex:"auto"}),d.createElement(i.Z,{flex:"300px",pull:"right"},d.createElement(u.Z,{className:"m-l-sm float-right","data-testid":"save-button",htmlType:"submit",loading:X,type:"primary"},S("label.save")),d.createElement(u.Z,{className:"float-right","data-testid":"cancel-button",onClick:function(){return V.goBack()}},S("label.cancel")))))))),minWidth:700,flex:.7},pageTitle:S("label.entity-detail-plural",{entity:S("label.alert")}),secondPanel:{children:d.createElement(d.Fragment,null),minWidth:0,className:"content-resizable-panel-container"}})}}}]);