D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
opt
/
psa
/
admin
/
cp
/
public
/
javascript
/
views
/
admin
/
ip-address
/
Filename :
clients.js
back
Copy
(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["views/admin/ip-address/clients"],{1411:(e,t,n)=>{"use strict";n.r(t),n.d(t,{SORT_ASC:()=>c,SORT_DESC:()=>m,default:()=>k});var i=n(285),s=n(596),a=n.n(s),r=n(286),o=n(89);const l=o.Locale.getTranslate("components.list"),d=o.Locale.getSection("components.list"),c="ASC",m="DESC",u="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}`,v=({id:e,data:t,columns:n,itemsPerPage:s=25,itemsPerPageOptions:a=[10,25,100,u],sortColumn:o,sortDirection:m=c,searchField:v,locale:k={},emptyView:h,emptyFilteredView:S,toolbar:y,selection:P=[],onSelectionChange:b,searchBarInputProps:w,rowKey:x="key",useStorage:j=!0,...F})=>{const{sortColumn:C,sortDirection:N,setSortState:R}=((e,{sortColumn:t,sortDirection:n})=>{const[{sortColumn:s,sortDirection:a},r]=(0,i.useState)({sortColumn:p.get(g(e))?.sortColumn??t,sortDirection:p.get(g(e))?.sortDirection??n});return{sortColumn:s,sortDirection:a,setSortState:t=>{r((e=>({...e,...t}))),p.set(g(e),{...p.get(g(e)),...t})}}})(e,{sortColumn:o??n.find((({sortable:e})=>e))?.key,sortDirection:m}),{page:D,itemsPerPage:E,searchPattern:L,setPageState:T}=((e,{itemsPerPage:t},n=!0)=>{const s=n?{page:p.get(f(e))?.page,itemsPerPage:p.get(f(e))?.itemsPerPage,searchPattern:p.get(f(e))?.searchPattern}:{},[{page:a,itemsPerPage:r,searchPattern:o},l]=(0,i.useState)({page:s.page??1,itemsPerPage:s.itemsPerPage??t,searchPattern:s.searchPattern??""});return{page:a,itemsPerPage:r,searchPattern:o,setPageState:t=>{l((e=>({...e,...t}))),n&&p.set(f(e),{...p.get(f(e)),...t})}}})(e,{itemsPerPage:a.includes(s)?s:a[0]},j),A=(0,i.useMemo)((()=>L?S??(0,i.jsx)(r.ListEmptyView,{reason:"filtered",title:(0,i.jsx)(l,{content:"emptyViewFilteredTitle"}),description:(0,i.jsx)(l,{content:"emptyViewFilteredDescription"}),"data-testid":"list-empty-view-filtered"}):h??(0,i.jsx)(r.ListEmptyView,{title:(0,i.jsx)(l,{content:"emptyViewTitle"})})),[L,h,S]),V=(0,i.useMemo)((()=>n.map((({sortDataField:e,...t})=>t))),[n]),O=(0,i.useMemo)((()=>v&&L?t.filter((e=>(Array.isArray(v)?v:[v]).some((t=>e[t]&&String(e[t]).toLowerCase().includes(L.toLowerCase()))))):t),[t,L,v]),I=(0,i.useMemo)((()=>{if(!C)return O;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[...O].sort(((e,n)=>c===N?t(e,n):t(n,e)))}),[O,C,N,n]),M=(0,i.useMemo)((()=>{if(E===u)return I;const e=E*(D-1),t=e+E;return I.slice(e,t)}),[D,I,E]),B=(0,i.useCallback)((e=>{T({searchPattern:e}),e!==L&&T({page:1})}),[L]),$=(0,i.useCallback)((e=>{T({itemsPerPage:e});(e===u?1:Math.ceil(O.length/e))<D&&T({page:1})}),[O.length,D]);return(0,i.useEffect)((()=>{if("function"==typeof b&&P.length){const e=O.map((e=>{return t=e,"function"==typeof(n=x)?n(t):t[n];var t,n})).filter((e=>P.includes(e)));b(e)}}),[O]),(0,i.jsx)(r.List,{pagination:(0,i.jsx)(r.Pagination,{current:D,total:E===u?1:Math.ceil(O.length/E),onSelect:e=>T({page:e}),itemsPerPage:E,itemsPerPageOptions:a,onItemsPerPageChange:$}),toolbar:(y||v)&&(0,i.jsxs)(r.Toolbar,{children:[y,v&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.ToolbarExpander,{}),(0,i.jsx)(r.ToolbarGroup,{title:"",children:(0,i.jsx)(r.SearchBar,{inputProps:{placeholder:d.lmsg("searchPlaceholder"),"data-testid":"list-searchbar",value:L,...w??{}},onTyping:B})})]})]}),totalRows:O.length,sortColumn:C,sortDirection:N,onSortChange:R,columns:V,data:M,filtered:!!L,locale:{totalRows:({totalRows:e})=>d.formatMessage("recordsTotal",{total:e}),...k},emptyView:A,onSelectionChange:b,selection:P,rowKey:x,...F})};v.propTypes={id:a().string.isRequired,data:a().array.isRequired,columns:a().array.isRequired,itemsPerPage:a().number,itemsPerPageOptions:a().array,sortColumn:a().string,sortDirection:a().string,searchField:a().oneOfType([a().string,a().arrayOf(a().string.isRequired)]),locale:a().object,emptyView:a().node,emptyFilteredView:a().node,toolbar:a().node,onSelectionChange:a().func,selection:a().array,rowKey:a().oneOfType([a().string,a().func]),searchBarInputProps:a().object,useStorage:a().bool};const k=v},2502:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>y});var i=n(285),s=n(580),a=n(1411),r=n(646),o=n(586),l=n(628),d=n(286),c=n(594),m=n(536),u=n(89),p=n(1268),g=n.n(p),f=n(2503),v=n.n(f);const k=u.Locale.getTranslate("components.lists.ip-address-reseller-usage"),h=u.Locale.getSection("components.lists.ip-address-reseller-usage"),S=u.Locale.getTranslate("components.buttons"),y=()=>{const e=(0,s.useParams)(),{data:{ipAddress:{id:t,clients:n,unassignedResellers:p}}}=(0,o.useQuery)(g(),{variables:{id:e.id}}),[f,{loading:y}]=(0,l.useMutation)(v(),{onCompleted:e=>{const{deleteIpAddressFormResellers:{removedClients:t}}=e;b([]),(0,m.addToast)({intent:"success",message:h.formatMessage("removeSuccess",{name:(0,i.jsx)("b",{children:t[0].name}),count:t.length})})}}),[P,b]=(0,i.useState)([]),w=p?.length??0,x=[{key:"id",title:(0,i.jsx)(k,{content:"nameColumnHeader"}),type:"title",sortable:!0,render:({id:e,name:t})=>(0,i.jsx)(r.default,{to:`/admin/reseller/overview/id/${(0,c.getId)(e)}`,children:t})}],j=(0,i.useCallback)((()=>{f({variables:{input:{ipAddressId:t,clientIds:P}}})}),[f,t,P]),F=(0,i.useMemo)((()=>(0,i.jsx)(d.ListEmptyView,{title:u.Locale.getSection("components.list").lmsg("emptyViewTitle"),actions:w?(0,i.jsx)(d.Button,{"data-action":"empty-view-add-ip-address",component:r.default,intent:"primary",to:"assign",icon:"plus",children:(0,i.jsx)(k,{content:"assignButton"})}):null})),[w]);return(0,i.jsx)(a.default,{id:"ip-address-resellers-list",rowKey:"id",searchField:"name",columns:x,loadingRows:y?P:void 0,data:n,selection:P,onSelectionChange:b,emptyView:F,toolbar:(0,i.jsxs)(d.ToolbarGroup,{title:"",children:[(0,i.jsx)(d.Button,{component:r.default,intent:"primary",to:"assign",icon:"plus",tooltip:w?null:(0,i.jsx)(k,{content:"alreadyAssignedToAllClients"}),disabled:!w,children:(0,i.jsx)(k,{content:"assignButton"})},"add-ip-address"),(0,i.jsx)(d.ListOperation,{"data-action":"remote-ip-address",critical:!0,noSelectionText:u.Locale.getSection("components.list").lmsg("itemsNotSelected"),confirmationText:()=>h.formatMessage("removeConfirmation",{name:(0,i.jsx)("b",{children:n.find((({id:e})=>P[0]===e)).name}),count:P.length}),actionButtonText:(0,i.jsx)(S,{content:"yesRemove"}),cancelButtonText:(0,i.jsx)(S,{content:"cancel"}),children:(0,i.jsx)(d.Button,{icon:"recycle",onClick:j,children:(0,i.jsx)(k,{content:"removeButton"})})},"remote-ip-address")]})})}},2501:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>d});var i=n(603),s=n(580),a=n(335),r=n(89),o=n(2502),l=n(285);const d=(0,i.withPageLayout)((()=>(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.default,{}),(0,l.jsx)(s.Outlet,{})]})),(e=>{const{showFrames:t,pageHeader:n,pageSidebar:i}=(0,a.default)(),{data:{ipAddress:{type:o,ipAddress:l}}}=(0,s.useLoaderData)(),d=r.Locale.getSection("components.lists.ip-address-reseller-usage"),c=d.formatMessage("title",{ipAddress:l,type:d.lmsg(`type${o}`)});return{...e,showFrames:t,pageHeader:{...n,helpMenu:{...n.helpMenu,helpContext:"server.ip-address.client"}},pageSidebar:i,pageContentHeader:{pageTitle:c,breadcrumbs:[i.isPowerUserPanel?null:{title:r.Locale.getSection("admin.controllers.home.admin").lmsg("title"),href:"/admin/home/"},{title:r.Locale.getSection("admin.controllers.server.tools").lmsg("title"),href:"/admin/server/tools/"},{title:r.Locale.getSection("admin.controllers.ip-address.list").lmsg("title"),href:"/cp/ip-address/"},{title:c}].filter(Boolean)},pageTitle:c}}))},2500:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>i.default});var i=n(2501)},2503:e=>{var t={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"DeleteIpAddressFromResellers"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"DeleteIpAddressFromResellersInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"deleteIpAddressFormResellers"},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:"ipAddress"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"ipAddress"},arguments:[],directives:[]},{kind:"Field",alias:{kind:"Name",value:"unassignedResellers"},name:{kind:"Name",value:"clients"},arguments:[{kind:"Argument",name:{kind:"Name",value:"filter"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"type"},value:{kind:"EnumValue",value:"RESELLER"}},{kind:"ObjectField",name:{kind:"Name",value:"unassigned"},value:{kind:"BooleanValue",value:!0}}]}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}},{kind:"Field",name:{kind:"Name",value:"clients"},arguments:[{kind:"Argument",name:{kind:"Name",value:"filter"},value:{kind:"ObjectValue",fields:[{kind:"ObjectField",name:{kind:"Name",value:"type"},value:{kind:"EnumValue",value:"RESELLER"}}]}}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}},{kind:"Field",name:{kind:"Name",value:"removedClients"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"name"},arguments:[],directives:[]}]}}]}}]}}],loc:{start:0,end:521}};t.loc.source={body:"mutation DeleteIpAddressFromResellers($input: DeleteIpAddressFromResellersInput!) {\n deleteIpAddressFormResellers(input: $input) {\n ipAddress {\n id\n ipAddress\n unassignedResellers: clients(filter:{ type: RESELLER, unassigned: true }) {\n id\n name\n }\n clients(filter:{ type: RESELLER }) {\n id\n name\n }\n }\n removedClients {\n id\n name\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 s(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.DeleteIpAddressFromResellers=function(e,t){var n={kind:e.kind,definitions:[s(e,t)]};e.hasOwnProperty("loc")&&(n.loc=e.loc);var a=i[t]||new Set,r=new Set,o=new Set;for(a.forEach((function(e){o.add(e)}));o.size>0;){var l=o;o=new Set,l.forEach((function(e){r.has(e)||(r.add(e),(i[e]||new Set).forEach((function(e){o.add(e)})))}))}return r.forEach((function(t){var i=s(e,t);i&&n.definitions.push(i)})),n}(t,"DeleteIpAddressFromResellers")}}]); //# sourceMappingURL=clients.js.map?7dd063c4442ebfddbb1d