1(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["components/pages/FirewallGeneralPage"],{1028:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SORT_ASC:()=>d,SORT_DESC:()=>u,default:()=>k});var i=n(285),a=n(287),s=n.n(a),o=n(286),r=n(89);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=25,itemsPerPageOptions:s=[10,25,100,m],sortColumn:r,sortDirection:u=d,searchField:h,locale:k={},emptyView:v,emptyFilteredView:y,toolbar:P,selection:S=[],onSelectionChange:b,searchBarInputProps:w,rowKey:x="key",useStorage:j=!0,...T})=>{const{sortColumn:C,sortDirection:F,setSortState:N}=((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:D,itemsPerPage:E,searchPattern:M,setPageState:O}=((e,{itemsPerPage:t},n=!0)=>{const a=n?{page:p.get(f(e))?.page,itemsPerPage:p.get(f(e))?.itemsPerPage,searchPattern:p.get(f(e))?.searchPattern}:{},[{page:s,itemsPerPage:o,searchPattern:r},l]=(0,i.useState)({page:a.page??1,itemsPerPage:a.itemsPerPage??t,searchPattern:a.searchPattern??""});return{page:s,itemsPerPage:o,searchPattern:r,setPageState:t=>{l((e=>({...e,...t}))),n&&p.set(f(e),{...p.get(f(e)),...t})}}})(e,{itemsPerPage:s.includes(a)?a:s[0]},j),R=(0,i.useMemo)((()=>M?y??(0,i.jsx)(o.ListEmptyView,{reason:"filtered",title:(0,i.jsx)(l,{content:"emptyViewFilteredTitle"}),description:(0,i.jsx)(l,{content:"emptyViewFilteredDescription"}),"data-testid":"list-empty-view-filtered"}):v??(0,i.jsx)(o.ListEmptyView,{title:(0,i.jsx)(l,{content:"emptyViewTitle"})})),[M,v,y]),L=(0,i.useMemo)((()=>n.map((({sortDataField:e,...t})=>t))),[n]),q=(0,i.useMemo)((()=>h&&M?t.filter((e=>(Array.isArray(h)?h:[h]).some((t=>e[t]&&String(e[t]).toLowerCase().includes(M.toLowerCase()))))):t),[t,M,h]),V=(0,i.useMemo)((()=>{if(!C)return q;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[...q].sort(((e,n)=>d===F?t(e,n):t(n,e)))}),[q,C,F,n]),A=(0,i.useMemo)((()=>{if(E===m)return V;const e=E*(D-1),t=e+E;return V.slice(e,t)}),[D,V,E]),B=(0,i.useCallback)((e=>{O({searchPattern:e}),e!==M&&O({page:1})}),[M]),I=(0,i.useCallback)((e=>{O({itemsPerPage:e});(e===m?1:Math.ceil(q.length/e))<D&&O({page:1})}),[q.length,D]);return(0,i.useEffect)((()=>{if("function"==typeof b&&S.length){const e=q.map((e=>{return t=e,"function"==typeof(n=x)?n(t):t[n];var t,n})).filter((e=>S.includes(e)));b(e)}}),[q]),(0,i.jsx)(o.List,{pagination:(0,i.jsx)(o.Pagination,{current:D,total:E===m?1:Math.ceil(q.length/E),onSelect:e=>O({page:e}),itemsPerPage:E,itemsPerPageOptions:s,onItemsPerPageChange:I}),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:M,...w??{}},onTyping:B})})]})]}),totalRows:q.length,sortColumn:C,sortDirection:F,onSortChange:N,columns:L,data:A,filtered:!!M,locale:{totalRows:({totalRows:e})=>c.formatMessage("recordsTotal",{total:e}),...k},emptyView:R,onSelectionChange:b,selection:S,rowKey:x,...T})};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,useStorage:s().bool};const k=h},2079:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>c});var i=n(287),a=n(286),s=n(89),o=n(285);const r=s.Locale.getTranslate("components.buttons"),l=({children:e,confirmationText:t,onClick:n,isCritical:i=!1,isProcessing:s=!1,target:l,...c})=>{const[d,u]=(0,o.useState)(!1),m=(0,o.jsx)(a.Button,{onClick:()=>u(!0),state:s?"loading":null,...c,children:s?(0,o.jsx)(r,{content:"wait"}):e});return(0,o.jsxs)(a.Popover,{target:l?(0,o.cloneElement)(l,{onClick:()=>u(!0)}):m,placement:"top",visible:d,onClose:()=>u(!1),children:[(0,o.jsx)(a.Paragraph,{children:t}),(0,o.jsx)(a.Button,{id:"buttonYes",intent:i?"danger":"primary",onClick:()=>{u(!1),n()},children:(0,o.jsx)(r,{content:"yes"})})," ",(0,o.jsx)(a.Button,{id:"buttonCancel",onClick:()=>u(!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,target:i.PropTypes.node};const c=l},2077:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var i=n(287),a=n(286),s=n(89),o=n(1028),r=n(285);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,{c
1ontent:"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},2076:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>S});var i=n(89),a=n(338),s=n(602),o=n(2077),r=n(2078),l=n(2079),c=n(737),d=n(589),u=n(627),m=n(286),p=n(539),g=n(880),f=n.n(g),h=n(2080),k=n.n(h),v=n(285);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"}].filter(Boolean),tabs:[],tabsHasRootPage:!0}}}))},2078:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>u,withFirewallTabs:()=>d});var i=n(285),a=n(583),s=n(584),o=n(286),r=n(89),l=n(645);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},2080:e=>{var t={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"SetFirewallMode"}
13,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);else 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?53d39dfef426f3cd59b5
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.