D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
usr
/
local
/
psa
/
admin
/
cp
/
public
/
javascript
/
components
/
pages
/
Filename :
ServerComponentsPage.js
back
Copy
(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/ServerComponentsPage"],{1411:(e,n,t)=>{"use strict";t.r(n),t.d(n,{SORT_ASC:()=>c,SORT_DESC:()=>m,default:()=>k});var a=t(285),i=t(596),s=t.n(i),o=t(286),r=t(89);const d=r.Locale.getTranslate("components.list"),l=r.Locale.getSection("components.list"),c="ASC",m="DESC",u="all",p={set(e,n){localStorage.setItem(e,JSON.stringify(n))},get(e){const n=localStorage.getItem(e);return JSON.parse(n)}},g=e=>`list-sort_${e}`,f=e=>`list-page_${e}`,v=({id:e,data:n,columns:t,itemsPerPage:i=25,itemsPerPageOptions:s=[10,25,100,u],sortColumn:r,sortDirection:m=c,searchField:v,locale:k={},emptyView:y,emptyFilteredView:h,toolbar:C,selection:S=[],onSelectionChange:b,searchBarInputProps:N,rowKey:j="key",useStorage:F=!0,...I})=>{const{sortColumn:x,sortDirection:P,setSortState:T}=((e,{sortColumn:n,sortDirection:t})=>{const[{sortColumn:i,sortDirection:s},o]=(0,a.useState)({sortColumn:p.get(g(e))?.sortColumn??n,sortDirection:p.get(g(e))?.sortDirection??t});return{sortColumn:i,sortDirection:s,setSortState:n=>{o((e=>({...e,...n}))),p.set(g(e),{...p.get(g(e)),...n})}}})(e,{sortColumn:r??t.find((({sortable:e})=>e))?.key,sortDirection:m}),{page:O,itemsPerPage:w,searchPattern:E,setPageState:D}=((e,{itemsPerPage:n},t=!0)=>{const i=t?{page:p.get(f(e))?.page,itemsPerPage:p.get(f(e))?.itemsPerPage,searchPattern:p.get(f(e))?.searchPattern}:{},[{page:s,itemsPerPage:o,searchPattern:r},d]=(0,a.useState)({page:i.page??1,itemsPerPage:i.itemsPerPage??n,searchPattern:i.searchPattern??""});return{page:s,itemsPerPage:o,searchPattern:r,setPageState:n=>{d((e=>({...e,...n}))),t&&p.set(f(e),{...p.get(f(e)),...n})}}})(e,{itemsPerPage:s.includes(i)?i:s[0]},F),L=(0,a.useMemo)((()=>E?h??(0,a.jsx)(o.ListEmptyView,{reason:"filtered",title:(0,a.jsx)(d,{content:"emptyViewFilteredTitle"}),description:(0,a.jsx)(d,{content:"emptyViewFilteredDescription"}),"data-testid":"list-empty-view-filtered"}):y??(0,a.jsx)(o.ListEmptyView,{title:(0,a.jsx)(d,{content:"emptyViewTitle"})})),[E,y,h]),q=(0,a.useMemo)((()=>t.map((({sortDataField:e,...n})=>n))),[t]),$=(0,a.useMemo)((()=>v&&E?n.filter((e=>(Array.isArray(v)?v:[v]).some((n=>e[n]&&String(e[n]).toLowerCase().includes(E.toLowerCase()))))):n),[n,E,v]),R=(0,a.useMemo)((()=>{if(!x)return $;const e=t.find((({key:e})=>e===x))?.sortDataField??x,n=t.find((({key:e})=>e===x))?.sort??((n,t)=>n[e]<t[e]?-1:n[e]>t[e]?1:0);return[...$].sort(((e,t)=>c===P?n(e,t):n(t,e)))}),[$,x,P,t]),M=(0,a.useMemo)((()=>{if(w===u)return R;const e=w*(O-1),n=e+w;return R.slice(e,n)}),[O,R,w]),_=(0,a.useCallback)((e=>{D({searchPattern:e}),e!==E&&D({page:1})}),[E]),B=(0,a.useCallback)((e=>{D({itemsPerPage:e});(e===u?1:Math.ceil($.length/e))<O&&D({page:1})}),[$.length,O]);return(0,a.useEffect)((()=>{if("function"==typeof b&&S.length){const e=$.map((e=>{return n=e,"function"==typeof(t=j)?t(n):n[t];var n,t})).filter((e=>S.includes(e)));b(e)}}),[$]),(0,a.jsx)(o.List,{pagination:(0,a.jsx)(o.Pagination,{current:O,total:w===u?1:Math.ceil($.length/w),onSelect:e=>D({page:e}),itemsPerPage:w,itemsPerPageOptions:s,onItemsPerPageChange:B}),toolbar:(C||v)&&(0,a.jsxs)(o.Toolbar,{children:[C,v&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.ToolbarExpander,{}),(0,a.jsx)(o.ToolbarGroup,{title:"",children:(0,a.jsx)(o.SearchBar,{inputProps:{placeholder:l.lmsg("searchPlaceholder"),"data-testid":"list-searchbar",value:E,...N??{}},onTyping:_})})]})]}),totalRows:$.length,sortColumn:x,sortDirection:P,onSortChange:T,columns:q,data:M,filtered:!!E,locale:{totalRows:({totalRows:e})=>l.formatMessage("recordsTotal",{total:e}),...k},emptyView:L,onSelectionChange:b,selection:S,rowKey:j,...I})};v.propTypes={id:s().string.isRequired,data:s().array.isRequired,columns:s().array.isRequired,itemsPerPage:s().number,itemsPerPageOptions:s().array,sortColumn:s().string,sortDirection:s().string,searchField:s().oneOfType([s().string,s().arrayOf(s().string.isRequired)]),locale:s().object,emptyView:s().node,emptyFilteredView:s().node,toolbar:s().node,onSelectionChange:s().func,selection:s().array,rowKey:s().oneOfType([s().string,s().func]),searchBarInputProps:s().object,useStorage:s().bool};const k=v},2488:(e,n,t)=>{"use strict";t.r(n),t.d(n,{ComponentConfForm:()=>k,renderParameter:()=>v,validateParameters:()=>f});var a=t(285),i=t(628),s=t(596),o=t.n(s),r=t(89),d=t(286),l=t(1289),c=t(536),m=t(2489),u=t.n(m);const p=r.Locale.getSection("components.lists.server-components.componentConf"),g=r.Locale.getTranslate("components.lists.server-components.componentConf"),f=(e,n,t=e=>e)=>Object.entries(e).reduce(((e,[a,i])=>{const s=n.find((e=>e.name===a));return!i&&s?.required&&(e[t(a)]=[p.lmsg("parameterIsRequired")]),"int"===s?.type&&isNaN(+i)&&(e[t(a)]=[p.lmsg("parameterShouldBeNumber")]),e}),{}),v=(e,n)=>{let t;const i=e.disabled||void 0,s=n(e.name);switch(e.type){case"int":case"string":t=(0,a.jsx)(d.FormFieldText,{id:s,name:s,required:e.required,label:e.description,disabled:i},s);break;case"password":t=(0,a.jsx)(d.FormFieldPassword,{id:s,name:s,required:e.required,label:e.description,disabled:i,hideGenerateButton:e.hideGenerateButton||!1},s);break;case"bool":t=(0,a.jsx)(d.FormFieldCheckbox,{name:s,required:e.required,label:e.description,disabled:i},s);break;case"enum":t=(0,a.jsx)(d.FormFieldSelect,{name:s,required:e.required,label:e.description,disabled:i,children:Object.entries(e.enum).map((([e,n])=>(0,a.jsx)("option",{value:e,children:n},e)))},s);break;default:t=(0,a.jsx)(d.FormField,{name:s,label:e.description,children:(0,a.jsx)(d.Input,{type:"hidden"})},s)}return e.disabled&&e.disableReason?(0,a.jsx)(d.Tooltip,{title:e.disableReason,children:t}):t},k=({packageName:e,parameters:n,onClose:t,...s})=>{const[o,r]=(0,a.useState)((e=>e.reduce(((e,n)=>(e[n.name]="bool"===n.type?"true"===n.value:n.value,e)),{}))(n)),[m,p]=(0,a.useState)({}),[k]=(0,i.useMutation)(u(),{onCompleted:()=>{(0,c.addToast)({intent:"success",message:(0,a.jsx)(g,{content:"success"})}),t()}}),y=(0,a.useCallback)(((e,n)=>{r((t=>(0,d.setIn)(t,e,n)))}),[]),h=(0,a.useCallback)((t=>{p({});const a=f(t,n);if(0===Object.keys(a).length)return Object.entries(t).reduce(((e,[n,t])=>(e.parameters.push({name:n,value:t.toString()}),e)),{packageName:e,parameters:[]});p(a)}),[n,e]);return(0,a.jsx)(l.default,{errors:m,onSubmit:h,mutation:k,submitButton:{id:"submit",name:"submit"},cancelButton:{id:"cancel",name:"cancel",onClick:t},onFieldChange:y,applyButton:!1,values:o,...s,children:n.map((e=>v(e,(e=>e))))})};k.propTypes={packageName:o().string.isRequired,parameters:o().array.isRequired,onClose:o().func.isRequired}},2493:(e,n,t)=>{"use strict";t.r(n),t.d(n,{ComponentConfPage:()=>u});var a=t(285),i=t(596),s=t.n(i),o=t(580),r=t(286),d=t(89),l=t(2488);const c=d.Locale.getSection("components.lists.server-components"),m=d.Locale.getTranslate("components.lists.server-components.componentConf"),u=({packages:e})=>{const n=(0,o.useNavigate)(),t=(0,o.useMatch)("/cp/server/components/configuration/:name"),i=(0,a.useMemo)((()=>{if(t)return e.find((e=>e.name===t.params.name))}),[e,t]),s=(0,a.useMemo)((()=>{if(!i)return"";const e=""!==i.state?` ${c.lmsg(`defaultComponents.${i.state}`)}`:"";return i.description+e}),[i]),d=(0,a.useCallback)((()=>{n("/cp/server/components")}),[n]);return(0,a.jsx)(r.Drawer,{"data-type":"components-config",isOpen:Boolean(t),onClose:d,title:(0,a.jsx)(m,{content:"title",params:{compDesc:s}}),form:i?(0,a.jsx)(l.ComponentConfForm,{packageName:i.name,parameters:i.parameters,onClose:d}):null})};u.propTypes={packages:s().array.isRequired}},2486:(e,n,t)=>{"use strict";t.r(n),t.d(n,{DefaultComponentsForm:()=>C});var a=t(596),i=t.n(a),s=t(285),o=t(628),r=t(89),d=t(286),l=t(1289),c=t(536),m=t(2458),u=t(2487),p=t.n(u),g=t(2488),f=t(2490),v=t(2492),k=t(2491);const y=r.Locale.getSection("components.lists.server-components"),h=r.Locale.getTranslate("components.lists.server-components"),C=({packages:e,categoryName:n,onClose:t,...a})=>{const[i,r]=(0,s.useState)(!1),[u,C]=(0,s.useState)(!1),[S,b]=(0,s.useState)({}),[N]=(0,o.useMutation)(p(),{onCompleted:()=>{(0,c.addToast)({intent:"success",message:(0,s.jsx)(h,{content:"defaultComponents.success"})}),t()},update:m.deleteServerMailAntivirusCache}),{categories:j,depsError:F}=(0,s.useMemo)((()=>(0,v.splitByCategories)(e,n)),[e,n]),I=(0,s.useMemo)((()=>(0,v.prepareInitialState)(j)),[j]),[x,P]=(0,s.useState)(I),T=(0,s.useCallback)(((e,n)=>{if((0,f.isParameterChanged)(e))return void P((t=>(0,d.setIn)(t,e,n)));const[t,a]=e.split(/[\[\]]/g).filter((e=>e)),i=(0,f.getComponentParameters)(j[t].packages,"default"===a?n:a);if(t===k.DNS_SERVER&&(0,d.getIn)(I,e)===k.DEFAULT_BIND&&n===k.DEFAULT_MSDNS)return C(!0),void P((n=>(0,d.setIn)(n,e,(0,d.getIn)(n,e))));t===k.MAIL_SERVER&&r((0,d.getIn)(I,e)!==n),P((s=>{const o="default"!==a?`${t}[${a}][params]`:`${t}[params]`;return n===k.NONE_OPTION?s=(0,v.resetValues)(s,j,t):(0,d.getIn)(s,e)===k.NONE_OPTION&&(s=(0,v.resetValues)(s,j,t,I)),s=(0,d.setIn)(s,o,i),(0,d.setIn)(s,e,n)}))}),[j,I]),O=(0,s.useCallback)(((e,n)=>{const t=(0,s.jsx)(h,{content:`componentName.${e}`});return n?(0,s.jsxs)("div",{children:[t," ",(0,s.jsx)(d.Text,{intent:"danger",children:"*"})]}):t}),[]),w=(0,s.useCallback)((n=>Object.entries(n).reduce(((n,[t,a])=>{if(x[t]){if(x[t].default)return n[t]={default:a},n;const[e]=Object.keys(x[t]);return n[t]={[e]:{default:a}},n}const{categoryInfo:{name:i}}=e.find((e=>e.componentTypeInfo.name===t));return n[i]||(n[i]={}),n[i][t]={default:a},n}),{})),[x,e]),E=(0,s.useCallback)((n=>{i&&r(!1),b({});const t=[],a={};for(const i of(0,v.prepareValues)(j,n)){const{categoryName:n,componentType:s,defaultComponent:o,params:r}=i,d={componentType:s,defaultComponent:o};if(Object.values(r).length&&o!==k.NONE_OPTION){const{parameters:t}=e.find((e=>e.name===o)),i=(0,g.validateParameters)(r,t);Object.values(i).length&&(n?a[n]={...a[n]??{},[s]:{params:i}}:a[s]={params:i}),d.parameters=(0,f.adaptParameters)(r).filter((({name:e,value:n})=>t.find((n=>n.name===e)).value!==n))}t.push(d)}if(!Object.values(a).length)return t;b(a)}),[j,e,i]),D=(0,s.useCallback)((()=>{P((e=>(0,d.setIn)((0,v.resetValues)(e,j,k.DNS_SERVER),`${k.DNS_SERVER}[default]`,k.DEFAULT_MSDNS))),C(!1)}),[j]);return F?(0,s.jsx)(l.default,{submitButton:!1,applyButton:!1,...a,children:(0,s.jsx)(d.StatusMessage,{intent:"danger",children:F})}):(0,s.jsxs)(l.default,{onSubmit:E,mutation:e=>N(e).catch((e=>{throw e.graphQLErrors?.length&&"validate"===e.graphQLErrors[0].extensions?.category&&(e.graphQLErrors[0].extensions.messages=w(e.graphQLErrors[0].extensions.messages)),e})),submitButton:{id:"submit",name:"submit"},cancelButton:{id:"cancel",name:"cancel",onClick:t},onFieldChange:T,applyButton:!1,values:x,autoComplete:"do-not-autofill",errors:S,...a,children:[(0,s.jsx)(d.Dialog,{size:"xs",title:(0,s.jsx)(h,{content:"defaultComponents.warning"}),isOpen:u,onClose:()=>C(!1),form:{onSubmit:D,submitButton:{children:(0,s.jsx)(h,{content:"defaultComponents.yes"})},cancelButton:{children:(0,s.jsx)(h,{content:"defaultComponents.no"})}},children:(0,s.jsx)(h,{content:"defaultComponents.dnsserverBindToMsdnsSwitchingWarning"})}),Object.entries(j).sort((([e],[t])=>e===n||t===n?1:-1)).map((([n,t])=>(0,s.jsx)(d.Section,{title:O(n,t.isRequired),children:t.isMultiChoise?t.packages.map((t=>{const a=`${n}[${t.name}][default]`,{label:i,disabled:o,value:r,indentFields:l}=(0,v.getComponentOptions)(t,e,x,(0,d.getIn)(x,a,!1),!0);return(0,s.jsxs)("div",{children:[(0,s.jsx)(d.FormFieldCheckbox,{style:{marginBottom:0},label:i,disabled:o,name:a}),l&&(0,s.jsx)("div",{className:"pul-form-field-radio-buttons__content",children:l},`${a}_params`)]},r)})):(0,s.jsxs)(s.Fragment,{children:[n===k.MAIL_SERVER&&i&&(0,s.jsxs)(d.Alert,{intent:"warning",children:[(0,s.jsx)("h4",{children:(0,s.jsx)(h,{content:"defaultComponents.warning"})}),(0,s.jsx)(h,{content:"defaultComponents.mailserverSwitchingWarning"})]}),(0,s.jsx)(d.FormFieldRadioButtons,{label:null,name:`${n}[default]`,options:[...t.packages.map((t=>(0,v.getComponentOptions)(t,e,x,(0,d.getIn)(x,`${n}[default]`,"none")===t.name,!1))),{label:y.lmsg("defaultComponents.none"),value:k.NONE_OPTION}]})]})},n)))]})};C.propTypes={packages:i().array.isRequired,categoryName:i().string.isRequired,onClose:i().func.isRequired}},2485:(e,n,t)=>{"use strict";t.r(n),t.d(n,{DefaultComponentsPage:()=>u});var a=t(285),i=t(596),s=t.n(i),o=t(580),r=t(286),d=t(89),l=t(2486);const c=d.Locale.getSection("components.lists.server-components"),m=d.Locale.getTranslate("components.lists.server-components"),u=({packages:e})=>{const n=(0,o.useNavigate)(),t=(0,o.useMatch)("/cp/server/components/default/:name"),i=t?.params?.name,s=(0,a.useCallback)((()=>{n("/cp/server/components")}),[n]);return(0,a.jsx)(r.Drawer,{"data-type":"default-components",isOpen:Boolean(t),onClose:s,title:(0,a.jsx)(m,{content:"defaultComponents.title",params:{name:c.lmsg(`componentName.${t?.params?.name}`)}}),form:t?(0,a.jsx)(l.DefaultComponentsForm,{categoryName:i,packages:e,onClose:s}):null})};u.propTypes={packages:s().array.isRequired}},2491:(e,n,t)=>{"use strict";t.r(n),t.d(n,{DEFAULT_BIND:()=>o,DEFAULT_MSDNS:()=>r,DNS_SERVER:()=>s,MAIL_SERVER:()=>i,NONE_OPTION:()=>a});const a="none",i="mailserver",s="dnsserver",o="bind",r="msdns"},2492:(e,n,t)=>{"use strict";t.r(n),t.d(n,{getComponentOptions:()=>f,isDependOn:()=>c,isPackageMultiChoice:()=>m,prepareInitialState:()=>p,prepareValues:()=>v,resetValues:()=>g,splitByCategories:()=>u});var a=t(2491),i=t(286),s=t(89),o=t(2488),r=t(285);const d=s.Locale.getSection("components.lists.server-components"),l=s.Locale.getTranslate("components.lists.server-components"),c=(e,n)=>!(!e.depends||e.depends!==n.name)||!(!e.dependsType||e.dependsType!==n.providesType),m=e=>1===e.componentTypeInfo.packagesCount,u=(e,n)=>{const t=new Map(e.filter((e=>e.categoryInfo.name===n)).map((e=>[e.name,e]))),a={};let i=t,s=new Map,o=new Set;for(;i.size>0;){for(const n of i.values())if(!o.has(n.name)){a[n.categoryInfo.name]??=[];for(const t of e){if(c(t,n)){if(a[t.categoryInfo.name]??=[],a[n.categoryInfo.name].includes(t.categoryInfo.name))return{categories:[],depsError:(0,r.jsx)(l,{content:"defaultComponents.circularDependencies",params:{cat1:(0,r.jsx)("b",{children:(0,r.jsx)(l,{content:`componentName.${t.categoryInfo.name}`})}),cat2:(0,r.jsx)("b",{children:(0,r.jsx)(l,{content:`componentName.${n.categoryInfo.name}`})})}})};a[t.categoryInfo.name].push(n.categoryInfo.name),s.set(t.name,t)}if(c(n,t)){if(a[t.categoryInfo.name]??=[],a[t.categoryInfo.name].includes(n.categoryInfo.name))return{categories:[],depsError:(0,r.jsx)(l,{content:"defaultComponents.circularDependencies",params:{cat1:(0,r.jsx)("b",{children:(0,r.jsx)(l,{content:`componentName.${t.categoryInfo.name}`})}),cat2:(0,r.jsx)("b",{children:(0,r.jsx)(l,{content:`componentName.${n.categoryInfo.name}`})})}})};a[n.categoryInfo.name].push(t.categoryInfo.name),s.set(t.name,t)}}}o=new Set([...o,...i.keys()]),i=s,s=new Map}const d=[...new Set(Object.entries(a).reduce(((e,[n,t])=>(t.length>0&&(e=e.concat([n,...t])),e)),[n]))];return{categories:e.filter((e=>d.includes(e.categoryInfo.name))).sort((e=>e.categoryInfo.name===n?-1:1)).reduce(((e,t)=>(e[t.categoryInfo.name]??={depends:[...new Set(a[t.categoryInfo.name])],isMultiChoise:m(t),isRequired:t.componentTypeInfo.name===n||t.componentTypeInfo.required,packages:[]},e[t.categoryInfo.name].packages.push(t),e)),{}),depsError:null}},p=e=>Object.entries(e).reduce(((e,[n,t])=>{if(t.isMultiChoise)e[n]=t.packages.reduce(((e,n)=>({...e,[n.name]:{default:n.componentTypeInfo.default!==a.NONE_OPTION,params:n.parameters.reduce(((e,n)=>({...e,[n.name]:"bool"===n.type?"true"===n.value:n.value})),{})}})),{});else{const i=t.packages.find((e=>e.componentTypeInfo.default===e.name));e[n]={default:i?.name??a.NONE_OPTION,params:i?.parameters?.reduce(((e,n)=>({...e,[n.name]:"bool"===n.type?"true"===n.value:n.value})),{})??{}}}return e}),{}),g=(e,n,t,s=null)=>Object.entries(e).reduce(((e,[o,r])=>{if(n[o].depends.includes(t)){const n=r.default?{default:a.NONE_OPTION,params:{}}:Object.keys(r).reduce(((e,n)=>({...e,[n]:{default:!1,params:{}}})),{});return(0,i.setIn)(e,o,s?(0,i.getIn)(s,o):n)}return e}),e),f=(e,n,t,i,s)=>{let c="";if(e.allowedByLicense?e.state?c=d.lmsg(`defaultComponents.${e.state}`):!e.configured&&e.componentTypeInfo.required&&(c=d.lmsg("defaultComponents.not_configured")):c=d.lmsg("defaultComponents.no_license"),c)return{disabled:!0,value:e.name,label:`${e.description} ${c}`};let u=!1,p=!1;const g=[];if(e.depends){const a=n.find((n=>n.name===e.depends)),i=m(a)?t[a.categoryInfo.name][a.name]:t[a.categoryInfo.name];i&&(u="string"==typeof i.default?i.default!==e.depends:!0!==i.default),g.push(a.description)}if(e.dependsType){const i=n.find((n=>n.providesType===e.dependsType)),s=t[i.categoryInfo.name],o=n.find((e=>e.name===s?.default));p=s?.default===a.NONE_OPTION||o&&o.providesType!==e.dependsType,g.push(d.lmsg(`componentName.${i.providesType}`))}const f=g.length?d.lmsg("defaultComponents.depends_on",{name:g.join(", ")}):"";return{disabled:u||p,indentFields:i&&e.parameters.length?[(0,r.jsx)("h4",{children:(0,r.jsx)(l,{content:"defaultComponents.parametersOfComponent",params:{component:e.description}})},"header"),...e.parameters.map((n=>(0,o.renderParameter)(n,(n=>s?`${e.categoryInfo.name}[${e.name}][params][${n}]`:`${e.categoryInfo.name}[params][${n}]`))))]:[],value:e.name,label:`${e.description} ${f}`.trim()}},v=(e,n,t)=>Object.entries(n).reduce(((n,[i,s])=>{if(Object.prototype.hasOwnProperty.call(s,"default")){let o=i;t&&(o=e[t].packages.find((e=>e.name===i)).componentTypeInfo.name);let r=s.default;"boolean"==typeof s.default&&(r=s.default?i:a.NONE_OPTION),n.push({categoryName:t,componentType:o,defaultComponent:r,params:s.params})}else n=n.concat(v(e,s,i));return n}),[])},2490:(e,n,t)=>{"use strict";t.r(n),t.d(n,{adaptParameters:()=>s,getComponentParameters:()=>o,isParameterChanged:()=>i});var a=t(2491);const i=e=>e.includes("[params]"),s=e=>Object.entries(e).reduce(((e,[n,t])=>(e.push({name:n,value:t.toString()}),e)),[]),o=(e,n)=>n===a.NONE_OPTION?{}:e.find((e=>e.name===n)).parameters.reduce(((e,n)=>({...e,[n.name]:"bool"===n.type?"true"===n.value:n.value})),{})},2484:(e,n,t)=>{"use strict";t.r(n),t.d(n,{ServerComponentsPage:()=>j,default:()=>F});var a=t(285),i=t(646),s=t(89),o=t(286),r=t(1120),d=t(586),l=t(628),c=t(1411),m=t(603),u=t(335),p=t(536),g=t(2485),f=t(2493),v=t(1266),k=t.n(v);const y="/admin/server/tools",h=s.Locale.getTranslate("components.lists.server-components"),C=s.Locale.getSection("components.lists.server-components"),S={warning:"tooltip.notStarted",danger:"tooltip.notConfigured",success:"tooltip.active",inactive:"tooltip.disabled"},b=r.gql` mutation UpdateServerComponents { updateServerComponents { query { server { components { name version state status error depends dependsType providesType description isInstalled isConfigurable configured allowedByLicense parameters { name type label required description value enum disabled disableReason } componentTypeInfo { name required default packagesCount } categoryInfo { name isConfigurable } } } } } } `,N=(e,n)=>e.filter((e=>e.categoryInfo.name===n)).some((e=>e.categoryInfo.isConfigurable)),j=()=>{const{data:{os:{isUnix:e},server:{components:n}}}=(0,d.useQuery)(k()),[t,{loading:s}]=(0,l.useMutation)(b,{onCompleted:()=>{(0,p.addToast)({intent:"success",message:(0,a.jsx)(h,{content:"componentsListUpdated"})})}}),r=(0,a.useMemo)((()=>{if(e)return n.map((e=>({...e,key:e.name,information:e.version})));const t=n.reduce(((e,t)=>{if(e[t.categoryInfo.name]||(e[t.categoryInfo.name]={isConfigurable:N(n,t.categoryInfo.name),packages:[]}),t.isInstalled){const n=""!==t.state?` ${C.lmsg(`defaultComponents.${t.state}`)}`:"";e[t.categoryInfo.name].packages.push({...t,description:t.description+n})}return e}),{});return Object.entries(t).map((([e,n])=>({key:e,name:e,isCategoryConfigurable:n.isConfigurable,packages:n.packages,information:n.packages.map((({description:e})=>e)).join(" ")})))}),[n,e]),m=[{key:"name",sortable:!0,title:(0,a.jsx)(h,{content:"name"}),render:n=>e?n.name:n.isCategoryConfigurable?(0,a.jsx)(i.default,{to:`/cp/server/components/default/${n.name}`,"data-test-id":`setup-${n.name}`,children:(0,a.jsx)(h,{content:`componentName.${n.name}`})}):(0,a.jsx)(h,{content:`componentName.${n.name}`}),width:"25%"},{key:"information",sortable:!0,title:(0,a.jsx)(h,{content:"version"}),render:n=>{const{version:t,packages:s}=n;return e?t:s.length?(0,a.jsx)("div",{children:s.map((e=>(0,a.jsx)("div",{children:(0,a.jsx)(o.Tooltip,{title:(0,a.jsx)(h,{content:S[e.status]}),children:(0,a.jsx)(o.Status,{intent:e.status,children:e.isConfigurable?(0,a.jsx)(i.default,{to:`/cp/server/components/configuration/${e.name}`,"data-test-id":`configure-${e.name}`,children:e.description}):(0,a.jsx)("span",{children:e.description})})})},e.name)))}):null}}];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(c.default,{id:"server-components-list",columns:m,data:r,sortColumn:"name",searchField:["name","information"],searchBarInputProps:{placeholder:C.lmsg("componentName")},toolbar:(0,a.jsx)(o.Button,{icon:"refresh",intent:"primary",state:s?"loading":void 0,"data-cy":"update-components-list",onClick:t,children:(0,a.jsx)(h,{content:"refresh"})}),emptyView:(0,a.jsx)(o.ListEmptyView,{title:(0,a.jsx)(h,{content:"noComponents"}),actions:(0,a.jsx)(o.Button,{icon:"refresh",intent:"primary",state:s?"loading":void 0,"data-cy":"update-components-list",onClick:t,children:(0,a.jsx)(h,{content:"refresh"})})})}),!e&&(0,a.jsx)(g.DefaultComponentsPage,{packages:n}),!e&&(0,a.jsx)(f.ComponentConfPage,{packages:n})]})},F=(0,m.withPageLayout)(j,(()=>{const{showFrames:e,pageHeader:n,pageSidebar:t}=(0,u.default)(),a=[t.isPowerUserPanel?null:{title:s.Locale.getSection("admin.controllers.home.admin").lmsg("title"),href:"/admin/home"},{title:s.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:y},{title:s.Locale.getSection("components.lists.server-components").lmsg("bcTitle"),href:"/cp/server/components"}].filter(Boolean),i=s.Locale.getSection("components.lists.server-components").lmsg("title");return{showFrames:e,pageHeader:{...n,helpMenu:{...n.helpMenu,helpContext:"comp_info"}},pageSidebar:t,pageContentHeader:{breadcrumbs:a,pageTitle:i},pageTitle:i}}))},2458:(e,n,t)=>{"use strict";t.r(n),t.d(n,{deleteServerMailAntivirusCache:()=>a});const a=e=>e.modify({id:e.identify({__typename:"ServerMail"}),fields:{antivirus:(e,{DELETE:n})=>n,antivirusPolicy:(e,{DELETE:n})=>n}})},2489:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateComponentParameters"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateComponentParametersInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateComponentParameters"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"query"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"server"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"components"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"version"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"state"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"error"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"depends"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"dependsType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"providesType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isInstalled"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isConfigurable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"configured"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"allowedByLicense"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"parameters"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"type"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"label"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"required"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"value"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"enum"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"disabled"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"disableReason"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"componentTypeInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"required"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"default"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"packagesCount"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"categoryInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isConfigurable"},arguments:[],directives:[]}]}}]}}]}}]}}]}}]}}],loc:{start:0,end:1293}};n.loc.source={body:"mutation UpdateComponentParameters($input: UpdateComponentParametersInput!) {\n updateComponentParameters(input: $input) {\n query {\n server {\n components {\n name\n version\n state\n status\n error\n depends\n dependsType\n providesType\n description\n isInstalled\n isConfigurable\n configured\n allowedByLicense\n parameters {\n name\n type\n label\n required\n description\n value\n enum\n disabled\n disableReason\n }\n componentTypeInfo {\n name\n required\n default\n packagesCount\n }\n categoryInfo {\n name\n isConfigurable\n }\n }\n }\n }\n }\n}",name:"GraphQL request",locationOffset:{line:1,column:1}};function t(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var a=e.type;"NamedType"===a.kind&&n.add(a.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){t(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){t(e,n)})),e.definitions&&e.definitions.forEach((function(e){t(e,n)}))}var a={};function i(e,n){for(var t=0;t<e.definitions.length;t++){var a=e.definitions[t];if(a.name&&a.name.value==n)return a}}n.definitions.forEach((function(e){if(e.name){var n=new Set;t(e,n),a[e.name.value]=n}})),e.exports=n,e.exports.UpdateComponentParameters=function(e,n){var t={kind:e.kind,definitions:[i(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var s=a[n]||new Set,o=new Set,r=new Set;for(s.forEach((function(e){r.add(e)}));r.size>0;){var d=r;r=new Set,d.forEach((function(e){o.has(e)||(o.add(e),(a[e]||new Set).forEach((function(e){r.add(e)})))}))}return o.forEach((function(n){var a=i(e,n);a&&t.definitions.push(a)})),t}(n,"UpdateComponentParameters")},2487:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateDefaultComponents"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"ListType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateDefaultComponentsInput"}}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateDefaultComponents"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"Variable",name:{kind:"Name",value:"input"}}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"query"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"server"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"components"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"version"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"state"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"status"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"error"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"depends"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"dependsType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"providesType"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"description"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isInstalled"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isConfigurable"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"configured"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"allowedByLicense"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"componentTypeInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"required"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"default"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"packagesCount"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"categoryInfo"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isConfigurable"},arguments:[],directives:[]}]}}]}}]}}]}}]}}]}}],loc:{start:0,end:947}};n.loc.source={body:"mutation UpdateDefaultComponents($input: [UpdateDefaultComponentsInput]!) {\n updateDefaultComponents(input: $input) {\n query {\n server {\n components {\n name\n version\n state\n status\n error\n depends\n dependsType\n providesType\n description\n isInstalled\n isConfigurable\n configured\n allowedByLicense\n componentTypeInfo {\n name\n required\n default\n packagesCount\n }\n categoryInfo {\n name\n isConfigurable\n }\n }\n }\n }\n }\n}",name:"GraphQL request",locationOffset:{line:1,column:1}};function t(e,n){if("FragmentSpread"===e.kind)n.add(e.name.value);else if("VariableDefinition"===e.kind){var a=e.type;"NamedType"===a.kind&&n.add(a.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){t(e,n)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){t(e,n)})),e.definitions&&e.definitions.forEach((function(e){t(e,n)}))}var a={};function i(e,n){for(var t=0;t<e.definitions.length;t++){var a=e.definitions[t];if(a.name&&a.name.value==n)return a}}n.definitions.forEach((function(e){if(e.name){var n=new Set;t(e,n),a[e.name.value]=n}})),e.exports=n,e.exports.UpdateDefaultComponents=function(e,n){var t={kind:e.kind,definitions:[i(e,n)]};e.hasOwnProperty("loc")&&(t.loc=e.loc);var s=a[n]||new Set,o=new Set,r=new Set;for(s.forEach((function(e){r.add(e)}));r.size>0;){var d=r;r=new Set,d.forEach((function(e){o.has(e)||(o.add(e),(a[e]||new Set).forEach((function(e){r.add(e)})))}))}return o.forEach((function(n){var a=i(e,n);a&&t.definitions.push(a)})),t}(n,"UpdateDefaultComponents")}}]); //# sourceMappingURL=ServerComponentsPage.js.map?53700670c7390f67765c