"use strict";(self.webpackChunkportal_ui=self.webpackChunkportal_ui||[]).push([[6405],{96405:function(e,n,t){t.r(n);var a=t(93433),i=t(29439),l=t(1413),s=t(72791),o=t(60364),c=t(51691),r=t(13400),u=t(42419),d=t(51979),v=t(11135),f=t(25787),x=t(61889),m=t(23814),h=t(21435),Z=t(25469),g=t(38734),j=t(87995),p=t(81207),y=t(23508),k=t(72401),b=t(75952),C=t(45248),A=t(80184),_=(0,o.$j)((function(e){return{loadingTenant:e.tenants.loadingTenant,selectedTenant:e.tenants.currentTenant,tenant:e.tenants.tenantInfo}}),null);n.default=(0,f.Z)((function(e){return(0,v.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)((0,l.Z)({},m.oZ),m.bK),{},{envVarRow:{display:"flex",alignItems:"center",justifyContent:"flex-start","&:last-child":{borderBottom:0},"@media (max-width: 900px)":{flex:1,"& div label":{minWidth:50}}},rowActions:{display:"flex",justifyContent:"flex-end","@media (max-width: 900px)":{flex:1}},overlayAction:{marginLeft:10,"& svg":{width:15,height:15,maxWidth:15,maxHeight:15},"& button":{background:"#EAEAEA"}},loaderAlign:{textAlign:"center"},bold:{fontWeight:"bold"},italic:{fontStyle:"italic"},fileItem:{marginRight:10,display:"flex","& div label":{minWidth:50},"@media (max-width: 900px)":{flexFlow:"column"}}},(0,m.Bz)(e.spacing(4))),m.QV),m.DF),m.oO),m.AK))}))(_((function(e){var n=e.classes,t=(0,Z.TL)(),l=(0,o.v9)((function(e){return e.tenants.tenantInfo})),v=(0,o.v9)((function(e){return e.tenants.loadingTenant})),f=(0,s.useState)(!1),m=(0,i.Z)(f,2),_=m[0],w=m[1],T=(0,s.useState)(!1),S=(0,i.Z)(T,2),I=S[0],N=S[1],P=(0,s.useState)([]),V=(0,i.Z)(P,2),E=V[0],R=V[1],z=(0,s.useState)([]),F=(0,i.Z)(z,2),K=F[0],W=F[1],B=(0,s.useCallback)((function(){p.Z.invoke("GET","/api/v1/namespaces/".concat(null===l||void 0===l?void 0:l.namespace,"/tenants/").concat(null===l||void 0===l?void 0:l.name,"/configuration")).then((function(e){e.environmentVariables&&R(e.environmentVariables)})).catch((function(e){t((0,j.Ih)(e))}))}),[l,t]);(0,s.useEffect)((function(){l&&B()}),[l,B]);return(0,A.jsxs)(s.Fragment,{children:[(0,A.jsx)(y.Z,{title:"Save and Restart",confirmText:"Restart",cancelText:"Cancel",titleIcon:(0,A.jsx)(g.EjK,{}),isLoading:_,onClose:function(){return N(!1)},isOpen:I,onConfirm:function(){w(!0);var e={environmentVariables:E.filter((function(e){return""!==e.key})),keysToBeDeleted:K};p.Z.invoke("PATCH","/api/v1/namespaces/".concat(null===l||void 0===l?void 0:l.namespace,"/tenants/").concat(null===l||void 0===l?void 0:l.name,"/configuration"),e).then((function(){w(!1),N(!1),B()})).catch((function(e){t((0,j.Ih)(e)),w(!1)}))},confirmationContent:(0,A.jsx)(c.Z,{children:"Are you sure you want to save the changes and restart the service?"})}),v?(0,A.jsx)("div",{className:n.loaderAlign,children:(0,A.jsx)(k.Z,{})}):(0,A.jsxs)(x.ZP,{container:!0,spacing:1,children:[(0,A.jsxs)(x.ZP,{item:!0,xs:12,children:[(0,A.jsx)("h1",{className:n.sectionTitle,children:"Configuration"}),(0,A.jsx)("hr",{className:n.hrClass})]}),(0,A.jsx)(x.ZP,{container:!0,spacing:1,children:E.map((function(e,t){return(0,A.jsxs)(x.ZP,{item:!0,xs:12,className:"".concat(n.formFieldRow," ").concat(n.envVarRow),children:[(0,A.jsx)(x.ZP,{item:!0,xs:5,className:n.fileItem,children:(0,A.jsx)(h.Z,{id:"env_var_key",name:"env_var_key",label:"Key",value:e.key,onChange:function(e){var n=(0,a.Z)(E);R(n.map((function(n,a){return a===t?{key:e.target.value,value:n.value}:n})))},index:t},"env_var_key_".concat(t.toString()))}),(0,A.jsx)(x.ZP,{item:!0,xs:5,className:n.fileItem,children:(0,A.jsx)(h.Z,{id:"env_var_value",name:"env_var_value",label:"Value",value:e.value,onChange:function(e){var n=(0,a.Z)(E);R(n.map((function(n,a){return a===t?{key:n.key,value:e.target.value}:n})))},index:t,type:C.Gq[e.key]&&C.Gq[e.key].secret?"password":"text"},"env_var_value_".concat(t.toString()))}),(0,A.jsxs)(x.ZP,{item:!0,xs:2,className:n.rowActions,children:[(0,A.jsx)("div",{className:n.overlayAction,children:(0,A.jsx)(r.Z,{size:"small",onClick:function(){var e=(0,a.Z)(E);e.push({key:"",value:""}),R(e)},disabled:t!==E.length-1,children:(0,A.jsx)(u.Z,{})})}),(0,A.jsx)("div",{className:n.overlayAction,children:(0,A.jsx)(r.Z,{size:"small",onClick:function(){var n=E.filter((function(e,n){return n!==t}));R(n),W([].concat((0,a.Z)(K),[e.key]))},disabled:E.length<=1,children:(0,A.jsx)(d.Z,{})})})]})]},"tenant-envVar-".concat(t.toString()))}))}),(0,A.jsx)(x.ZP,{item:!0,xs:12,sx:{display:"flex",justifyContent:"flex-end"},children:(0,A.jsx)(b.z,{id:"save-environment-variables",type:"submit",variant:"callAction",disabled:I||_,onClick:function(){return N(!0)},label:"Save"})})]})]})})))},42419:function(e,n,t){var a=t(64836);n.Z=void 0;var i=a(t(45649)),l=t(80184),s=(0,i.default)((0,l.jsx)("path",{d:"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"}),"Add");n.Z=s}}]);
//# sourceMappingURL=6405.61f72110.chunk.js.map