1(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/FirewallGeneralPage"],{1096:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SORT_ASC:()=>d,SORT_DESC:()=>u,default:()=>k});var i=n(245),a=n(247),s=n.n(a),o=n(246),r=n(90);const l=r.Locale.getTranslate("components.list"),c=r.Locale.getSection("components.list"),d="ASC",u="DESC",m="all",p={set(e,t){localStorage.setItem(e,JSON.stringify(t))},get(e){const t=localStorage.getItem(e);return JSON.parse(t)}},g=e=>`list-sort_${e}`,f=e=>`list-page_${e}`,h=({id:e,data:t,columns:n,itemsPerPage:a,itemsPerPageOptions:s,sortColumn:r,sortDirection:u,searchField:h,locale:k,emptyView:v,emptyFilteredView:y,toolbar:P,selection:S,onSelectionChange:w,searchBarInputProps:b,rowKey:x,...j})=>{const{sortColumn:C,sortDirection:T,setSortState:F}=((e,{sortColumn:t,sortDirection:n})=>{const[{sortColumn:a,sortDirection:s},o]=(0,i.useState)({sortColumn:p.get(g(e))?.sortColumn??t,sortDirection:p.get(g(e))?.sortDirection??n});return{sortColumn:a,sortDirection:s,setSortState:t=>{o((e=>({...e,...t}))),p.set(g(e),{...p.get(g(e)),...t})}}})(e,{sortColumn:r??n.find((({sortable:e})=>e))?.key,sortDirection:u}),{page:N,itemsPerPage:D,searchPattern:E,setPageState:M}=((e,{itemsPerPage:t})=>{const[{page:n,itemsPerPage:a,searchPattern:s},o]=(0,i.useState)({page:p.get(f(e))?.page??1,itemsPerPage:p.get(f(e))?.itemsPerPage??t,searchPattern:p.get(f(e))?.searchPattern??""});return{page:n,itemsPerPage:a,searchPattern:s,setPageState:t=>{o((e=>({...e,...t}))),p.set(f(e),{...p.get(f(e)),...t})}}})(e,{itemsPerPage:s.includes(a)?a:s[0]}),O=(0,i.useMemo)((()=>E?y??(0,i.jsx)(o.ListEmptyView,{reason:"filtered",title:(0,i.jsx)(l,{content:"emptyViewFilteredTitle"}),description:(0,i.jsx)(l,{content:"emptyViewFilteredDescription"})}):v??(0,i.jsx)(o.ListEmptyView,{title:(0,i.jsx)(l,{content:"emptyViewTitle"})})),[E,v,y]),R=(0,i.useMemo)((()=>n.map((({sortDataField:e,...t})=>t))),[n]),L=(0,i.useMemo)((()=>h&&E?t.filter((e=>(Array.isArray(h)?h:[h]).some((t=>e[t]&&String(e[t]).toLowerCase().includes(E.toLowerCase()))))):t),[t,E,h]),q=(0,i.useMemo)((()=>{if(!C)return L;const e=n.find((({key:e})=>e===C))?.sortDataField??C,t=n.find((({key:e})=>e===C))?.sort??((t,n)=>t[e]<n[e]?-1:t[e]>n[e]?1:0);return[...L].sort(((e,n)=>d===T?t(e,n):t(n,e)))}),[L,C,T,n]),V=(0,i.useMemo)((()=>{if(D===m)return q;const e=D*(N-1),t=e+D;return q.slice(e,t)}),[N,q,D]),A=(0,i.useCallback)((e=>{M({searchPattern:e}),e!==E&&M({page:1})}),[E]),B=(0,i.useCallback)((e=>{M({itemsPerPage:e});(e===m?1:Math.ceil(L.length/e))<N&&M({page:1})}),[L.length,N]);return(0,i.useEffect)((()=>{if("function"==typeof w&&S.length){const e=L.map((e=>{return t=e,"function"==typeof(n=x)?n(t):t[n];var t,n})).filter((e=>S.includes(e)));w(e)}}),[L]),(0,i.jsx)(o.List,{pagination:(0,i.jsx)(o.Pagination,{current:N,total:D===m?1:Math.ceil(L.length/D),onSelect:e=>M({page:e}),itemsPerPage:D,itemsPerPageOptions:s,onItemsPerPageChange:B}),toolbar:(P||h)&&(0,i.jsxs)(o.Toolbar,{children:[P,h&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.ToolbarExpander,{}),(0,i.jsx)(o.ToolbarGroup,{title:"",children:(0,i.jsx)(o.SearchBar,{inputProps:{placeholder:c.lmsg("searchPlaceholder"),"data-testid":"list-searchbar",value:E,...b??{}},onTyping:A})})]})]}),totalRows:L.length,sortColumn:C,sortDirection:T,onSortChange:F,columns:R,data:V,filtered:!!E,locale:{totalRows:({totalRows:e})=>c.formatMessage("recordsTotal",{total:e}),...k},emptyView:O,onSelectionChange:w,selection:S,rowKey:x,...j})};h.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},h.defaultProps={itemsPerPage:25,itemsPerPageOptions:[10,25,100,m],sortColumn:void 0,sortDirection:d,searchField:void 0,locale:{},emptyView:void 0,emptyFilteredView:void 0,toolbar:void 0,onSelectionChange:void 0,selection:[],searchBarInputProps:void 0,rowKey:"key"};const k=h}
1,1954:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>c});var i=n(247),a=n(246),s=n(90),o=n(245);const r=s.Locale.getTranslate("components.buttons"),l=({children:e,confirmationText:t,onClick:n,isCritical:i,isProcessing:s,...l})=>{const[c,d]=(0,o.useState)(!1);return(0,o.jsxs)(a.Popover,{target:(0,o.jsx)(a.Button,{onClick:()=>d(!0),state:s?"loading":null,...l,children:s?(0,o.jsx)(r,{content:"wait"}):e}),placement:"top",visible:c,onClose:()=>d(!1),children:[(0,o.jsx)(a.Paragraph,{children:t}),(0,o.jsx)(a.Button,{id:"buttonYes",intent:i?"danger":"primary",onClick:()=>{d(!1),n()},children:(0,o.jsx)(r,{content:"yes"})})," ",(0,o.jsx)(a.Button,{id:"buttonCancel",onClick:()=>d(!1),ghost:!0,children:(0,o.jsx)(r,{content:"cancel"})})]})};l.propTypes={children:i.PropTypes.node,confirmationText:i.PropTypes.node.isRequired,onClick:i.PropTypes.func.isRequired,isProcessing:i.PropTypes.bool,isCritical:i.PropTypes.bool},l.defaultProps={children:void 0,isProcessing:!1,isCritical:!1};const c=l},1952:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var i=n(247),a=n(246),s=n(90),o=n(1096),r=n(245);const l=s.Locale.getTranslate("admin.components.lists.firewallinterfaces"),c=({interfaces:e})=>{const t=(0,r.useMemo)((()=>["name","type"]),[]);return(0,r.jsx)(o.default,{id:"firewall-interfaces-list",columns:[{key:"name",title:(0,r.jsx)(l,{content:"name"}),type:"title",sortable:!0},{key:"type",title:(0,r.jsx)(l,{content:"type"}),sortable:!0},{key:"connection",title:(0,r.jsx)(l,{content:"connection"}),sortable:!0,render:({isConnected:e})=>(0,r.jsx)(a.Tooltip,{title:(0,r.jsx)(l,{content:e?"connectionOn":"connectionOff"}),children:(0,r.jsx)(a.Status,{intent:e?"success":"inactive",children:(0,r.jsx)(l,{content:e?"statusOn":"statusOff"})})})},{key:"firewall",title:(0,r.jsx)(l,{content:"firewall"}),sortable:!0,render:({isEnabled:e})=>(0,r.jsx)(a.Tooltip,{title:(0,r.jsx)(l,{content:e?"firewallOn":"firewallOff"}),children:(0,r.jsx)(a.Status,{intent:e?"success":"inactive",children:(0,r.jsx)(l,{content:e?"statusOn":"statusOff"})})})}],data:e,searchField:t,sortColumn:"name"})};c.propTypes={interfaces:i.PropTypes.arrayOf(i.PropTypes.shape({key:i.PropTypes.string.isRequired,name:i.PropTypes.string.isRequired,type:i.PropTypes.string.isRequired,isEnabled:i.PropTypes.bool.isRequired,isConnected:i.PropTypes.bool.isRequired})).isRequired};const d=c},1951:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var i=n(90),a=n(293),s=n(751),o=n(1952),r=n(1953),l=n(1954),c=n(458),d=n(745),u=n(774),m=n(246),p=n(688),g=n(936),f=n.n(g),h=n(1955),k=n.n(h),v=n(245);const y=i.Locale.getTranslate("components.pages.firewall-general"),P=c.gql` 2 mutation ToggleFirewallStatus($enable: Boolean!) { 3 toggleFirewall(input: { enable: $enable }) { 4 query { 5 server { 6 firewall { 7 isEnabled 8 } 9 } 10 } 11 } 12 } 13`,S=(0,s.withPageLayout)((0,r.withFirewallTabs)((()=>{const{data:{server:{firewall:{isEnabled:e,interfaces:t}}}}=(0,d.useQuery)(f()),[n,{loading:i}]=(0,u.useMutation)(P,{variables:{enable:!e}}),[a,{loading:s}]=(0,u.useMutation)(k(),{variables:{mode:"DEFAULT"},onCompleted:()=>(0,p.addToast)({intent:"success",message:(0,v.jsx)(y,{content:"successDefault"})})}),[r,{loading:c}]=(0,u.useMutation)(k(),{variables:{mode:"PANIC"},onCompleted:()=>(0,p.addToast)({intent:"success",message:(0,v.jsx)(y,{content:"successPanic"})})}),g=async e=>{try{await e()}catch(e){(0,p.addToast)({intent:"danger",message:e.message})}};return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(m.StatusMessage,{intent:"success",children:(0,v.jsx)(y,{content:"info"})}),(0,v.jsxs)(m.Section,{title:"",children:[(0,v.jsx)("p",{children:(0,v.jsx)(m.Switch,{id:"toggleStatus",onChange:()=>g(n),loading:i,checked:e,children:(0,v.jsx)(y,{content:"toggleStatus"})})}),(0,v.jsx)(m.Toolbar,{children:(0,v.jsxs)(m.ToolbarGroup,{title:"",children:[(0,v.jsx)(l.default,{id:"buttonDefault",confirmationText:(0,v.jsx)(y,{content:"confirmationDefault"}),onClick:()=>g(a),isProcessing:s,children:(0,v.jsx)(y,{content:"buttonDefault"})}),(0,v.jsx)(l.default,{id:"buttonPanic",confirmationText:(0,v.jsx)(y,{content:"confirmationPanic"}),onClick:()=>g(r),isProcessing:c,isCritical:!0,children:(0,v.jsx)(y,{content:"buttonPanic"})})]})})]}),(0,v.jsx)(m.Section,{title:(0,v.jsx)(y,{content:"interfaces"}),children:(0,v.jsx)(o.default,{interfaces:t})})]})})),(()=>{const{showFrames:e,pageHeader:t,pageSidebar:n}=(0,a.default)();return{showFrames:e,pageHeader:{...t,helpMenu:{...t.helpMenu,helpContext:"firewall_main"}},pageSidebar:n,pageContentHeader:{breadcrumbs:[n.isPowerUserPanel?null:{title:i.Locale.getSection("components.pages.home").lmsg("title"),href:"/admin/home"},{title:i.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools"},{title:i.Locale.getSection("components.pages.firewall").lmsg("title"),href:"/cp/firewall"},{title:i.Locale.getSection("components.pages.firewall-general").lmsg("title"),href:"/cp/firewall/general"}
13].filter(Boolean),tabs:[],tabsHasRootPage:!0}}}))},1953:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u,withFirewallTabs:()=>d});var i=n(245),a=n(739),s=n(740),o=n(246),r=n(90),l=n(787);const c=()=>{const{pathname:e}=(0,a.useLocation)(),t=(0,i.useMemo)((()=>[{title:r.Locale.getSection("components.pages.firewall-general").lmsg("title"),url:"/cp/firewall/general",id:"tabGeneral"},{title:r.Locale.getSection("components.pages.firewall-icmp").lmsg("title"),url:"/cp/firewall/icmp",id:"tabIcmp"},{title:r.Locale.getSection("components.pages.firewall-rules").lmsg("title"),url:"/cp/firewall/rules",id:"tabRules"}]),[]),n=(0,i.useMemo)((()=>t.findIndex((({url:t})=>(0,s.matchPath)(t,e)))+1),[t,e]);return(0,i.jsx)(o.Tabs,{active:n,children:t.map((({url:e,...t})=>(0,i.jsx)(o.Tab,{component:l.default,to:e,...t},e)))})},d=e=>{const t=t=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(c,{...t}),(0,i.jsx)(e,{...t})]});return t.displayName=`withFirewallTabs(${e.displayName||e.name||"Component"})`,t.WrappedComponent=e,t},u=c},1955:e=>{var t={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SetFirewallMode"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"mode"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"FirewallModeEnum"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"setFirewallMode"},arguments:[{kind:"Argument",name:{kind:"Name",value:"input"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"mode"},value:{kind:"Variable",name:{kind:"Name",value:"mode"}}}]}}],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:"firewall"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"icmpRules"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isEnabled"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"rules"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"key"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"action"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"port"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"protocol"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"profiles"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"remoteAddresses"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isEnabled"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"isReadonly"},arguments:[],directives:[]}]}}]}}]}}]}}]}}]}}],loc:{start:0,end:670}};t.loc.source={body:"mutation SetFirewallMode($mode: FirewallModeEnum!) {\n setFirewallMode(input: {mode: $mode }) {\n query {\n server {\n firewall {\n icmpRules {\n key\n isEnabled\n }\n rules {\n key\n name\n action\n port\n protocol\n profiles\n remoteAddresses\n isEnabled\n isReadonly\n }\n }\n }\n }\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function n(e,t){if("FragmentSpread"===e.kind)t.add(e.name.value);
13else if("VariableDefinition"===e.kind){var i=e.type;"NamedType"===i.kind&&t.add(i.name.value)}e.selectionSet&&e.selectionSet.selections.forEach((function(e){n(e,t)})),e.variableDefinitions&&e.variableDefinitions.forEach((function(e){n(e,t)})),e.definitions&&e.definitions.forEach((function(e){n(e,t)}))}var i={};function a(e,t){for(var n=0;n<e.definitions.length;n++){var i=e.definitions[n];if(i.name&&i.name.value==t)return i}}t.definitions.forEach((function(e){if(e.name){var t=new Set;n(e,t),i[e.name.value]=t}})),e.exports=t,e.exports.SetFirewallMode=function(e,t){var n={kind:e.kind,definitions:[a(e,t)]};e.hasOwnProperty("loc")&&(n.loc=e.loc);var s=i[t]||new Set,o=new Set,r=new Set;for(s.forEach((function(e){r.add(e)}));r.size>0;){var l=r;r=new Set,l.forEach((function(e){o.has(e)||(o.add(e),(i[e]||new Set).forEach((function(e){r.add(e)})))}))}return o.forEach((function(t){var i=a(e,t);i&&n.definitions.push(i)})),n}(t,"SetFirewallMode")}}]); 14//# sourceMappingURL=FirewallGeneralPage.js.map?032a1ec781c1649caf30
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.