Files
server/opt/psa/admin/cp/public/javascript/components/pages/BandwidthLimitingPage.js
cutemeli 0bfc6c8425 Initial
2025-12-22 10:32:59 +00:00

2 lines
6.7 KiB
JavaScript

(globalThis.webpackChunkPlesk=globalThis.webpackChunkPlesk||[]).push([["components/pages/BandwidthLimitingPage"],{2750:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>a.default});var a=i(2751)},2751:(e,n,i)=>{"use strict";i.r(n),i.d(n,{default:()=>u});var a=i(668),t=i.n(a),d=i(297),s=i(90),o=i(2752),r=i(296);const c=s.Locale.getTranslate("components.pages.BandwidthLimiting"),l=e=>e.domain.hosting?(0,r.jsx)(o.BandwidthLimitingForm,{...e}):(0,r.jsx)(d.StatusMessage,{intent:"info",children:(0,r.jsx)(c,{content:"virtualHostingRequired"})});l.propTypes={domain:t().shape({hosting:t().shape({performance:t().shape({trafficBandwidth:t().number.isRequired,maxConnection:t().number.isRequired}).isRequired})}).isRequired,capability:t().shape({packages:t().shape({isQoSStarted:t().bool.isRequired}).isRequired}).isRequired,params:t().shape({domainId:t().string.isRequired}).isRequired};const u=l},2752:(e,n,i)=>{"use strict";i.r(n),i.d(n,{BandwidthLimitingForm:()=>b});var a=i(296),t=i(668),d=i.n(t),s=i(696),o=i(599),r=i(297),c=i(1305),l=i(718),u=i(90),m=i(546),p=i(2753),f=i.n(p);i(2754);const h=u.Locale.getTranslate("components.pages.BandwidthLimiting"),g=({trafficBandwidth:e,maxConnection:n})=>({isTrafficBandwidthEnabled:-1!==e,trafficBandwidth:-1===e?"":e,isMaxConnectionEnabled:-1!==n,maxConnection:-1===n?"":n}),b=({domain:e,capability:n,params:i})=>{const t=(0,o.useNavigate)(),d=`/smb/web/overview/id/${i.domainId}/type/domain`,[u,p]=(0,a.useState)(()=>g(e.hosting.performance)),[b,{loading:v}]=(0,s.useMutation)(f());return(0,a.jsxs)(c.default,{values:u,mutation:b,onFieldChange:(e,n)=>{p(i=>(0,r.setIn)(i,e,n))},onSubmit:()=>({id:btoa(`Domain:${i.domainId}`),trafficBandwidth:u.isTrafficBandwidthEnabled?u.trafficBandwidth?+u.trafficBandwidth:null:-1,maxConnection:u.isMaxConnectionEnabled?u.maxConnection?+u.maxConnection:null:-1}),state:v?"loading":void 0,onSuccess:({updateHostingPerformance:{domain:e}})=>{(0,m.addToast)({intent:"success",message:(0,a.jsx)(h,{content:"success"})}),p(g(e.hosting.performance)),t(d)},applyButton:!1,cancelButton:{component:l.default,to:d},children:[!n.packages.isQoSStarted&&(0,a.jsx)(r.StatusMessage,{intent:"warning",children:(0,a.jsx)(h,{content:"bandwidthThrottling"})}),(0,a.jsx)(r.FormField,{label:(0,a.jsx)(h,{content:"bandwidthLabel"}),description:(0,a.jsx)(h,{content:"bandwidthHint"}),required:u.isTrafficBandwidthEnabled,name:"trafficBandwidth",children:({getValue:e,setValue:n,isDisabled:i})=>(0,a.jsxs)("div",{className:"bandwidth-limiting-field-complex",children:[(0,a.jsxs)("div",{className:"bandwidth-limiting-input-with-suffix-wrapper bandwidth-limiting-input-complex-wrapper",children:[(0,a.jsx)(r.Input,{onChange:e=>n(e.target.value.replace(/\D/g,"")),maxLength:7,size:8,value:e(),disabled:!u.isTrafficBandwidthEnabled||i()}),(0,a.jsx)(h,{content:"kbps"})]}),(0,a.jsx)(r.FormFieldCheckbox,{name:"isTrafficBandwidthEnabled",label:(0,a.jsx)(h,{content:"unlimited"}),checkedValue:!1,uncheckedValue:!0})]})}),(0,a.jsx)(r.FormField,{label:(0,a.jsx)(h,{content:"maxConnectionLabel"}),description:(0,a.jsx)(h,{content:"maxConnectionHint"}),required:u.isMaxConnectionEnabled,name:"maxConnection",children:({getValue:e,setValue:n,isDisabled:i})=>(0,a.jsxs)("div",{className:"bandwidth-limiting-field-complex",children:[(0,a.jsx)("div",{className:"bandwidth-limiting-input-complex-wrapper",children:(0,a.jsx)(r.Input,{onChange:e=>n(e.target.value.replace(/\D/g,"")),maxLength:10,size:11,value:e(),disabled:!u.isMaxConnectionEnabled||i()})}),(0,a.jsx)(r.FormFieldCheckbox,{name:"isMaxConnectionEnabled",label:(0,a.jsx)(h,{content:"unlimited"}),checkedValue:!1,uncheckedValue:!0})]})})]})};b.propTypes={domain:d().shape({hosting:d().shape({performance:d().shape({trafficBandwidth:d().number.isRequired,maxConnection:d().number.isRequired}).isRequired}).isRequired}).isRequired,capability:d().shape({packages:d().shape({isQoSStarted:d().bool.isRequired}).isRequired}).isRequired,params:d().shape({domainId:d().string.isRequired}).isRequired}},2753:e=>{var n={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"UpdateHostingPerformance"},variableDefinitions:[{kind:"VariableDefinition",variable:{kind:"Variable",name:{kind:"Name",value:"input"}},type:{kind:"NonNullType",type:{kind:"NamedType",name:{kind:"Name",value:"UpdateHostingPerformanceInput"}}},directives:[]}],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"updateHostingPerformance"},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:"domain"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"id"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"hosting"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"performance"},arguments:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[{kind:"Field",name:{kind:"Name",value:"trafficBandwidth"},arguments:[],directives:[]},{kind:"Field",name:{kind:"Name",value:"maxConnection"},arguments:[],directives:[]}]}}]}}]}}]}}]}}],loc:{start:0,end:327}};n.loc.source={body:"mutation UpdateHostingPerformance($input: UpdateHostingPerformanceInput!) {\n updateHostingPerformance(input: $input) {\n domain {\n id\n hosting {\n performance {\n trafficBandwidth\n maxConnection\n }\n }\n }\n }\n}\n",name:"GraphQL request",locationOffset:{line:1,column:1}};function i(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){i(e,n)}),e.variableDefinitions&&e.variableDefinitions.forEach(function(e){i(e,n)}),e.definitions&&e.definitions.forEach(function(e){i(e,n)})}var a={};function t(e,n){for(var i=0;i<e.definitions.length;i++){var a=e.definitions[i];if(a.name&&a.name.value==n)return a}}n.definitions.forEach(function(e){if(e.name){var n=new Set;i(e,n),a[e.name.value]=n}}),e.exports=n,e.exports.UpdateHostingPerformance=function(e,n){var i={kind:e.kind,definitions:[t(e,n)]};e.hasOwnProperty("loc")&&(i.loc=e.loc);var d=a[n]||new Set,s=new Set,o=new Set;for(d.forEach(function(e){o.add(e)});o.size>0;){var r=o;o=new Set,r.forEach(function(e){s.has(e)||(s.add(e),(a[e]||new Set).forEach(function(e){o.add(e)}))})}return s.forEach(function(n){var a=t(e,n);a&&i.definitions.push(a)}),i}(n,"UpdateHostingPerformance")},2754:(e,n,i)=>{"use strict";i.r(n)}}]);
//# sourceMappingURL=BandwidthLimitingPage.js.map?d652468949c8cf8872ae