1(globalThis.webpackChunkvar=globalThis.webpackChunkvar||[]).push([[2751],{86418(e,s,t){t.d(s,{A:()=>y});var a=t(64810),i=t(6874),r=t.n(i),n=t(12136),o=t(3626),l=t(38401),d=t(78593),c=t(16300),m=t(5776);const h=e=>{const{componentCls:s,borderRadius:t,paddingSM:a,colorBorder:i,paddingXS:r,fontSizeLG:n,fontSizeSM:o,borderRadiusLG:l,borderRadiusSM:d,colorBgContainerDisabled:m,lineWidth:h}=e;return{[s]:[{display:"inline-flex",alignItems:"center",gap:0,paddingInline:a,margin:0,background:m,borderWidth:h,borderStyle:"solid",borderColor:i,borderRadius:t,"&-large":{fontSize:n,borderRadius:l},"&-small":{paddingInline:r,borderRadius:d,fontSize:o},"&-compact-last-item":{borderEndStartRadius:0,borderStartStartRadius:0},"&-compact-first-item":{borderEndEndRadius:0,borderStartEndRadius:0},"&-compact-item:not(:first-child):not(:last-child)":{borderRadius:0},"&-compact-item:not(:last-child)":{borderInlineEndWidth:0}},(0,c.G)(e,{focus:!1})]}},p=(0,m.OF)(["Space","Addon"],e=>[h(e)]),u=a.forwardRef((e,s)=>{const{className:t,children:i,style:n,prefixCls:o}=e,c=function(e,s){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&s.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)s.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["className","children","style","prefixCls"]),{getPrefixCls:m,direction:h}=a.useContext(l.QO),u=m("space-addon",o),[b,v,g]=p(u),{compactItemClassnames:f,compactSize:x}=(0,d.RQ)(u,h),N=r()(u,v,f,g,{[`${u}-${x}`]:x},t);return b(a.createElement("div",Object.assign({ref:s,className:N,style:n},c),i))}),b=a.createContext({latestIndex:0}),v=b.Provider,g=({className:e,index:s,children:t,split:i,style:r})=>{const{latestIndex:n}=a.useContext(b);return null==t?null:a.createElement(a.Fragment,null,a.createElement("div",{className:e,style:r},t),s<n&&i&&a.createElement("span",{className:`${e}-split`},i))};var f=t(46504);const x=e=>{const{componentCls:s,antCls:t}=e;return{[s]:{display:"inline-flex","&-rtl":{direction:"rtl"},"&-vertical":{flexDirection:"column"},"&-align":{flexDirection:"column","&-center":{alignItems:"center"},"&-start":{alignItems:"flex-start"},"&-end":{alignItems:"flex-end"},"&-baseline":{alignItems:"baseline"}},[`${s}-item:empty`]:{display:"none"},[`${s}-item > ${t}-badge-not-a-wrapper:only-child`]:{display:"block"}}}},N=e=>{const{componentCls:s}=e;return{[s]:{"&-gap-row-small":{rowGap:e.spaceGapSmallSize},"&-gap-row-middle":{rowGap:e.spaceGapMiddleSize},"&-gap-row-large":{rowGap:e.spaceGapLargeSize},"&-gap-col-small":{columnGap:e.spaceGapSmallSize},"&-gap-col-middle":{columnGap:e.spaceGapMiddleSize},"&-gap-col-large":{columnGap:e.spaceGapLargeSize}}}},A=(0,m.OF)("Space",e=>{const s=(0,f.oX)(e,{spaceGapSmallSize:e.paddingXS,spaceGapMiddleSize:e.padding,spaceGapLargeSize:e.paddingLG});return[x(s),N(s)]},()=>({}),{resetStyle:!1}),j=a.forwardRef((e,s)=>{var t;const{getPrefixCls:i,direction:d,size:c,className:m,style:h,classNames:p,styles:u}=(0,l.TP)("space"),{size:b=(null!=c?c:"small"),align:f,className:x,rootClassName:N,children:j,direction:y="horizontal",prefixCls:w,split:k,style:C,wrap:I=!1,classNames:T,styles:D}=e,R=function(e,s){var t={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&s.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(a=Object.getOwnPropertySymbols(e);i<a.length;i++)s.indexOf(a[i])<0&&Object.prototype.propertyIsEnumerable.call(e,a[i])&&(t[a[i]]=e[a[i]])}return t}(e,["size","align","className","rootClassName","children","direction","prefixCls","split","style","wrap","classNames","styles"]),[O,P]=Array.isArray(b)?b:[b,b],E=(0,o.X)(P),S=(0,o.X)(O),M=(0,o.m)(P),_=(0,o.m)(O),q=(0,n.A)(j,{keepEmpty:!0}),G=void 0===f&&"horizontal"===y?"center":f,W=i("space",w),[L,F,B]=A(W),$=r()(W,m,F,`${W}-${y}`,{[`${W}-rtl`]:"rtl"===d,[`${W}-align-${G}`]:G,[`${W}-gap-row-${P}`]:E,[`${W}-gap-col-${O}`]:S},x,N,B),Y=r()(`${W}-item`,null!==(t=null==T?void 0:T.item)&&void 0!==t?t:p.item),z=Object.assign(Object.assign({},u.item),null==D?void 0:D.item),V=q.map((e,s)=>{const t=(null==e?void 0:e.key)||`${Y}-${s}`;return a.createElement(g,{className:Y,key:t,index:s,split:k,style:z},e)}),U=a.useMemo(()=>({latestIndex:q.reduce((e,s,t)=>null!=s?t:e,0)}),[q]);if(0===q.length)return null;const Q={};return I&&(Q.flexWrap="wrap"),!S&&_&&(Q.columnGap=O),!E&&M&&(Q.rowGap=P),L(a.createElement("div",Object.assign({ref:s,className:$,style:Object.assign(Object.assign(Object.assign({},Q),h),C)},R),a.createElement(v,{value:U},V)))});j.Compact=d.Ay,j.Addon=u;const y=j},2751(e,s,t){t.r(s),t.d(s,{default:()=>O});var a=t(85186),i=t(64810),r=t(66551),n=t(72234),o=t.n(n);class l extends i.Component{constructor(e){super(e)}render(){let e="",s=this.props.vmNicRemove&&this.props.osNicRemove,t=this.props.vmNicRemove;return this.props.manualConfigEnabled||(e=" hidden",t=!1),(0,a.jsxs)("div",{className:"modal modal-open",children:[(0,a.jsx)("div",{className:"modal-backdrop fade in"}),(0,a.jsx)("div",{className:"modal-dialog",children:(0,a.jsxs)("div",{className:"modal-content",children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("button",{type:"button",className:"close",onClick:this.closeClicked.bind(this),children:(0,a.jsx)("span",{children:"Ã"})}),(0,a.jsx)("div",{className:"modal-title",children:(0,a.jsxs)("span",{className:"cwm-title",children:["Remove Network Interface - ",this.props.name]})})]}),t?(0,a.jsxs)("div",{className:"form-horizontal",children:[(0,a.jsx)("div",{className:"modal-body fs",children:(0,a.jsxs)("p",{className:"alert alert-warning",children:["Are you sure you want to Remove the selected network interface (",this.props.mac,")"]})}),(0,a.jsxs)("div",{className:"modal-footer",children:[(0,a.jsx)("button",{type:"button",className:"btn btn-primary btn-squared",onClick:s?this.provisionClicked.bind(this):null,disabled:!s,children:this.props.serverPoweredOn?"Reboot and Remove Automatically":"Remove Automatically"}),e?null:(0,a.jsx)("button",{type:"button",className:"btn btn-primary btn-squared",onClick:this.removeClicked.bind(this),children:"Remove Manually"}),(0,a.jsx)("button",{type:"button",className:"btn btn-default btn-squared",onClick:this.closeClicked.bind(this),children:"Cancel"}),(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-sm-4 add-nic-modal-footer remove-interface-auto",children:[(0,a.jsx)("b",{children:"Remove Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-sm-3",children:"Remove network interface and remove the network configuration automatically in the operating system."})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-4 add-nic-modal-footer remove-interface-manually",children:[(0,a.jsx)("b",{children:"Remove Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-0",children:"Remove the network interface and do not remove the network configuration in the operating system. The user is required to remove the network configuration in the operating system manually"})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing."]})]})]}):(0,a.jsxs)("div",{className:"form-horizontal",children:[(0,a.jsx)("div",{className:"modal-body fs",children:(0,a.jsx)("p",{className:"alert alert-warning",children:"Due to VM limitation, Remove Network Interface is non-supported operation."})}),(0,a.jsx)("div",{className:"modal-footer",children:(0,a.jsx)("button",{type:"button",className:"btn btn-default btn-squared",onClick:this.closeClicked.bind(this),children:"Cancel"})})]})]})})]})}closeClicked(e){this.props.fnClose()}provisionClicked(e){this.props.fnProvision()}removeClicked(e){this.props.fnAction()}}
1l.propTypes={serverId:o().string.isRequired,name:o().string.isRequired,fnClose:o().func.isRequired,mac:o().string.isRequired,fnAction:o().func.isRequired,fnProvision:o().func.isRequired,manualConfigEnabled:o().bool.isRequired};var d=t(13491);class c extends i.Component{constructor(e){super(e),this.focusRef=null,this.state={serverName:d.A.serverName(this.props.serverId)}}componentDidMount(){this.focusRef&&this.focusRef.focus()}renderPowerWarningMessage(){return this.props.serverPoweredOn?(0,a.jsxs)("div",{className:"alert alert-warning text-align-left margin-top-20 margin-bottom-0",children:["Note: Reboot will perform a Force Reboot to the server. Please make sure there are no running application on the server to avoid any damage to files or applications.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"It is recommended to shutdown the server from within the Operating System."]}):null}renderRemoveIPExplanation(e){return this.props.serverPoweredOn?(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-5 add-nic-modal-footer reboot-remove-ip-auto",children:[(0,a.jsx)("b",{children:"Reboot and Remove Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-7 padding-left-sm-3",children:"Reboot Server, Remove IP assignment and remove IP automatically in the operating system."})]}),e?(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-3 add-nic-modal-footer remove-ip-manually",children:[(0,a.jsx)("b",{children:"Remove Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:"Remove IP assignment and do not remove IP in the operating system. User is required to remove IP in the operating system manually."})]}):null,(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing.",this.renderPowerWarningMessage()]}):(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-4 add-nic-modal-footer remove-ip-auto",children:[(0,a.jsx)("b",{children:"Remove Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-sm-3",children:"Remove IP assignment and remove IP automatically in the operating system."})]}),e?(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-3 add-nic-modal-footer remove-ip-manually",children:[(0,a.jsx)("b",{children:"Remove Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:"Remove IP assignment and do not remove IP in the operating system. User is required to remove IP in the operating system manually."})]}):null,(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing."]})}renderServerLimitation(){return this.props.manualConfigEnabled&&!this.props.osIpRemove?(0,a.jsx)("div",{className:"alert alert-warning text-align-left margin-top-20 margin-bottom-0",children:"Due to OS limitation, Remove IP Address is non-supported automatically operation. User can connect to the server and remove IP address manually."}):null}render(){let e=this.props.manualConfigEnabled,s=this.props.osIpRemove;return(0,a.jsxs)("div",{className:"modal modal-open",children:[(0,a.jsx)("div",{className:"modal-backdrop fade in"}),(0,a.jsx)("div",{className:"modal-dialog",children:(0,a.jsxs)("div",{className:"modal-content",children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("button",{type:"button",className:"close",onClick:this.closeClicked.bind(this),children:(0,a.jsx)("span",{children:"Ã"})}),(0,a.jsx)("div",{className:"modal-title",children:(0,a.jsxs)("span",{className:"cwm-title",children:["Remove IP Address - ",this.state.serverName]})})]}),e||s?(0,a.jsxs)("div",{className:"form-info",children:[(0,a.jsx)("div",{className:"modal-body fs",children:(0,a.jsxs)("div",{className:"alert alert-info",children:["Choose remove IP Address ",this.props.ip," operation method:"]})}
1),(0,a.jsxs)("div",{className:this.props.serverPoweredOn?"modal-footer removeIp":"modal-footer removeIp-off",children:[(0,a.jsx)("button",{type:"button",className:"btn btn-squared btn-primary reboot",onClick:s?this.provisionClicked.bind(this):null,disabled:!s,children:this.props.serverPoweredOn?"Reboot and Remove Automatically":"Remove Automatically"}),e?(0,a.jsx)("button",{type:"button",className:"btn btn-squared btn-primary manually",onClick:this.removeClicked.bind(this),children:"Remove Manually"}):null,(0,a.jsx)("button",{type:"button",className:"btn btn-squared btn-default "+(this.props.manualConfigEnabled?"cancel":this.props.serverPoweredOn?"remove-ip-cancel server-on":""),onClick:this.closeClicked.bind(this),ref:e=>{this.focusRef=e},children:"Cancel"}),this.renderRemoveIPExplanation(e),this.renderServerLimitation()]})]}):(0,a.jsxs)("div",{className:"form-info",children:[(0,a.jsx)("div",{className:"modal-body fs",children:(0,a.jsx)("div",{className:"alert alert-warning",children:"Due to OS limitation, Remove IP Address is non-supported operation."})}),(0,a.jsx)("div",{className:"modal-footer",children:(0,a.jsx)("button",{type:"button",className:"btn btn-squared btn-default cancel",onClick:this.closeClicked.bind(this),children:"Cancel"})})]})]})})]})}closeClicked(e){this.props.fnClose()}provisionClicked(e){this.props.fnProvision()}removeClicked(e){this.props.fnAction()}}c.propTypes={serverId:o().string.isRequired,ip:o().string.isRequired,fnAction:o().func.isRequired,fnProvision:o().func.isRequired,fnClose:o().func.isRequired,manualConfigEnabled:o().bool.isRequired};var m=t(68342),h=t(78866),p=t(81160),u=t(16598),b=t(80313),v=t(55901),g=t(1930);class f extends i.Component{constructor(e){super(e),this.focusRef=null,this.state={status:p.A.DATA_INIT,error:null,networkError:null,networks:[],ips:[],network:e.mode===f.MODE_ADD_IP?e.network:"",selectedNetworkIdx:-2,selectedNetworkName:e.mode===f.MODE_ADD_IP?e.network:"",selectedNetworkType:0,networkType:"",ip:"",networkName:"",networkFullName:"",subnetIp:"",subnetBit:"",gateway:"",dns1:"",dns2:"",subnetDescription:"",ipCustom:"",validIp:!0}}componentDidMount(){this.props.mode===f.MODE_ADD_IP?h.A.availableIps(this.props.serverId,this.props.network).then(e=>{this.setState({status:p.A.DATA_READY,ips:e.data})}).catch(e=>{this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})}):this.listNetworks()}listNetworks(){h.A.availableNetworks(this.props.serverId,this.props.mode===f.MODE_CHANGE_NETWORK?this.props.mac:"").then(e=>{this.setState({status:p.A.DATA_READY,error:null,networks:e.data})}).catch(e=>{this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})})}onChange(e,s){let t={};t[e]=s,(t.gateway===this.state.ip||t.ips&&"custom"!==t.ips[0])&&(t.ip=""),this.setState(t)}networkChanged(e){let s=e.target.value;if(s>=0){let e=this.state.networks[s];this.networkSelected(s,e.name,e.type)}else this.networkSelected(s,"","")}networkSelected(e,s,t){e>=0?(this.setState({error:null,status:p.A.DATA_LOADING,selectedNetworkIdx:parseInt(e),selectedNetworkName:s,selectedNetworkType:parseInt(t),ipCustom:"",ip:"",ips:[]}),h.A.availableIps(this.props.serverId,s).then(e=>{let s=e.data,t="";1===s.length&&"custom"!==s[0]&&(t=s[0]),this.setState({status:p.A.DATA_READY,ips:s,ip:t})}).catch(e=>{this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})})):this.setState({error:null,networkError:null,selectedNetworkIdx:e,selectedNetworkName:s,selectedNetworkType:parseInt(t),ips:[],ip:"",ipCustom:""})}ipChanged(e){this.setState({ip:e.target.value})}formSubmit(e){if(this.props.serverEnabled)return void p.A.errorToast(name,"Server is currently running a background process and is locked to changes. Try again later.");if(this.state.status!==p.A.DATA_READY)return;let s;if(this.setState({status:p.A.DATA_UPDATING,error:null,networkError:null}),this.props.mode===f.MODE_ADD_INTERFACE){if(!this.state.selectedNetworkName&&-1===parseInt(this.state.selectedNetworkIdx))return void v.A.networkCreateIPCheck(this.state.subnetBit,this.state.subnetIp,this.state.ip).then(s=>{!1===s.data&&this.setState({error:api.NET_INVALID_IP,status:p.A.DATA_INIT,validIp:!1}),this.state.validIp&&v.A.networkCreateFromServer(this.props.datacenter,this.state.networkName,this.state.subnetIp,this.state.subnetBit,this.state.gateway,this.state.dns1,this.state.dns2,this.state.subnetDescription,this.state.ip).then(s=>{this.setState({status:p.A.DATA_UPDATED}),h.A.nicAdd(this.props.serverId,this.state.networkFullName,this.state.ip,e).then(e=>{p.A.successToast(this.props.name,"Add Network Interface task added to Tasks Queue."),this.closeClicked(),m.A.setPending(this.props.serverId)}).catch(e=>{this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})})}).catch(e=>{this.setState({status:p.A.DATA_READY,error:null,networkError:(0,r.Sg)(e)}),this.listNetworks()})}).catch(e=>{});s=h.A.nicAdd(this.props.serverId,this.state.selectedNetworkName,this.state.ip,e).then(e=>{p.A.successToast(this.props.name,"Add Network Interface task added to Tasks Queue."),this.closeClicked(),m.A.setPending(this.props.serverId)})}else s=this.props.mode===f.MODE_ADD_IP?h.A.nicAddIp(this.props.serverId,this.props.mac,this.state.ip,e).then(e=>{p.A.successToast(this.props.name,"Add IP Address task added to Tasks Queue."),this.closeClicked(),m.A.setPending(this.props.serverId)}):h.A.nicSetNetwork(this.props.serverId,this.props.mac,this.state.selectedNetworkName,this.state.ip,e).then(e=>{p.A.successToast(this.props.name,"Change Network task added to Tasks queue."),this.closeClicked(),m.A.setPending(this.props.serverId)});s.catch(e=>{this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})})}customIpSelected(e){this.setState({ip:"custom"===e.target.value?"":e.target.value,ipCustom:e.target.value})}renderContent(e){const s=this.state.status===p.A.DATA_READY,t=(this.state.selectedNetworkName||this.state.networkName)&&this.state.ips&&this.state.ips.length&&s,i=this.state.selectedNetworkName&&!this.state.ips.length;let r=null;
1-1===parseInt(this.state.selectedNetworkIdx)&&(r=(0,a.jsx)(b.A,{mode:f.CREATE_NETWORK,datacenter:this.props.datacenter,onChange:this.onChange.bind(this)}));let n=p.A.getIpRange(this.state.subnetIp,this.state.subnetBit);return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-sm-3 col-xs-12 control-label",children:"Network:"}),(0,a.jsx)("div",{className:"col-sm-9 col-xs-12",children:this.props.mode===f.MODE_ADD_IP?(0,a.jsx)("label",{className:"control-label",children:this.state.selectedNetworkName}):(0,a.jsx)("span",{className:"cwm-select full-select",children:(0,a.jsxs)("select",{onChange:this.networkChanged.bind(this),value:this.state.selectedNetworkIdx,readOnly:!s,disabled:this.state.status===p.A.DATA_UPDATING||!e,children:[(0,a.jsx)("option",{value:-2,hidden:!0,disabled:!0,children:"Select Network"}),this.props.mode===f.MODE_ADD_INTERFACE?(0,a.jsx)("option",{value:-1,children:"Create New Vlan"}):null,this.state.networks.map((e,s)=>(0,a.jsx)("option",{value:s,children:"auto"===e.name?"wan":e.name},e.name)),";"]})})})]}),r,(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-sm-3 col-xs-12 control-label",children:"Select IP:"}),this.state.ips&&"custom"===this.state.ips[0]?(0,a.jsxs)("div",{className:"col-sm-9 col-xs-12",children:[(0,a.jsx)("span",{className:"cwm-select full-select",children:(0,a.jsxs)("select",{value:this.state.ipCustom,onChange:this.customIpSelected.bind(this),disabled:!((this.state.selectedNetworkName||this.state.networkName)&&this.state.status===p.A.DATA_READY),children:[(0,a.jsx)("option",{value:"",hidden:!0,disabled:!0,children:"Select IP Address"}),(0,a.jsx)("option",{value:"auto",children:"Auto"}),(0,a.jsx)("option",{value:"custom",children:"Custom"})]})}),"custom"===this.state.ipCustom?(0,a.jsx)("div",{className:"input-ip-create-server",children:(0,a.jsx)("input",{disabled:!((this.state.selectedNetworkName||this.state.networkName)&&this.state.status===p.A.DATA_READY),type:"text",spellCheck:"false",className:"form-control",onChange:this.ipChanged.bind(this),placeholder:n,value:this.state.ip})}):null]}):(0,a.jsx)("div",{className:"col-sm-9 col-xs-12",children:(0,a.jsx)("span",{className:"cwm-select full-select",children:(0,a.jsxs)("select",{onChange:this.ipChanged.bind(this),value:this.state.ip,disabled:!t,children:[(0,a.jsx)("option",{value:"",hidden:!0,disabled:!0,children:i?"IP addresses not available":"Select IP Address"}),this.state.ips.map(e=>(0,a.jsx)("option",{value:e,disabled:e===this.state.gateway,children:e},e)),";"]})})})]})]})}renderError(){let e=null;if(this.state.networkError&&(e=v.A.errorMessage(this.state.networkError)),this.state.error){let s=this.state.error.errCode(),t=this.state.error.errMessage();e=1===s&&"Forbidden"===t?"Invalid IP address Selected":h.A.errorMessage(this.state.error)}return e?(0,a.jsx)("div",{className:"alert alert-danger",children:e}):null}renderPowerWarningMessage(){return this.props.serverPoweredOn?(0,a.jsxs)("div",{className:"alert alert-warning text-align-left margin-top-20 margin-bottom-0",children:["Note: Reboot will perform a Force Reboot to the server. Please make sure there are no running application on the server to avoid any damage to files or applications.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"It is recommended to shutdown the server from within the Operating System."]}):null}renderAddInterfaceExplanation(e){return this.props.serverPoweredOn?(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-5 add-nic-modal-footer reboot-add-auto",children:[(0,a.jsx)("b",{children:"Reboot and Add Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-7 padding-left-sm-3",children:"Reboot Server, Add network interface and configure IP address automatically in the operating system."})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-4 add-nic-modal-footer reboot-add-manually",children:[(0,a.jsx)("b",{children:"Reboot and Add Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-sm-0",children:"Reboot Server, Add network interface and do not configure IP address in the operating system."})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing.",this.renderPowerWarningMessage()]}):(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-sm-3 add-nic-modal-footer add-automatically",children:[(0,a.jsx)("b",{children:"Add Automatically"})," -"]}),(0,a.jsxs)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:["Add network interface and configure IP address automatically ",(0,a.jsx)("br",{className:"hidden-xs"}),"in the operating system."]})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-sm-3 add-nic-modal-footer add-manually",children:[(0,a.jsx)("b",{children:"Add Manually"})," -"]}),(0,a.jsxs)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:["Add network interface and do not configure IP address in the ",(0,a.jsx)("br",{className:"hidden-xs"}),"operating system."]})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing."]})}renderAddIpExplanation(e){return this.props.serverPoweredOn?(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-sm-5 add-nic-modal-footer reboot-add-auto",children:[(0,a.jsx)("b",{children:"Reboot and Add Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-7 padding-left-sm-3",children:"Reboot Server, Add IP and configure IP automatically in the operating system."})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-sm-3 add-nic-modal-footer add-manually",children:[(0,a.jsx)("b",{children:"Add Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:"Add IP and do not configure IP in the operating system. User is required to configure IP in the operating system manually."})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing.",this.renderPowerWarningMessage()]}):(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-sm-3 add-nic-modal-footer add-automatically",children:[(0,a.jsx)("b",{children:"Add Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:"Add IP and configure IP automatically in the operating system."})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-sm-3 add-nic-modal-footer add-manually",children:[(0,a.jsx)("b",{children:"Add Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-9 padding-left-sm-0",children:"Add IP and do not configure IP in the operating system. User is required to configure IP in the operating system manually."})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing."]})}renderChangeNetworkExplanation(e){return this.props.serverPoweredOn?(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-sm-5 add-nic-modal-footer reboot-change-network-add-auto",children:[(0,a.jsx)("b",{children:"Reboot and Change Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-7 padding-left-sm-3",children:"Reboot server, Change Network and configure IP address in the operating system automatically."})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-4 add-nic-modal-footer change-network-add-manually",children:[(0,a.jsx)("b",{children:"Change Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-sm-0",children:"Change Network and do not configure IP in the operating system. User is required to configure IP in the operating system manually."})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing.",this.renderPowerWarningMessage()]}):(0,a.jsxs)("div",{className:"text-align-left margin-top-20",children:[(0,a.jsxs)("div",{className:"row margin-bottom-10",children:[(0,a.jsxs)("div",{className:"col-sm-4 add-nic-modal-footer change-network-add-auto",children:[(0,a.jsx)("b",{children:"Change Automatically"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-sm-3",children:"Change Network and configure IP address in the operating system automatically."})]}),(0,a.jsxs)("div",{className:"row margin-bottom-10 "+e,children:[(0,a.jsxs)("div",{className:"col-xs-12 col-sm-4 add-nic-modal-footer change-network-add-manually",children:[(0,a.jsx)("b",{children:"Change Manually"})," -"]}),(0,a.jsx)("div",{className:"col-xs-12 col-sm-8 padding-left-sm-0",children:"Change Network and do not configure IP in the operating system. User is required to configure IP in the operating system manually."})]}),(0,a.jsx)("b",{children:"Cancel"})," - Cancel and do nothing."]})}getNicServerLimitationMessage(){let e="";if(this.props.manualConfigEnabled&&(this.props.mode===f.MODE_ADD_IP||2!==this.state.selectedNetworkType||this.props.manualConfigToWanEnabled)||(e=" hidden"),this.props.mode===f.MODE_ADD_INTERFACE){if(!this.props.vmNicAdd)return"Due to VM limitation, Add Network Interface is non-supported operation.";if(!this.props.osNicAdd)return"Due to OS limitation, Add Network Interface is non-supported automatically operation. User can connect to the server and configure the network manually."}else if(this.props.mode===f.MODE_ADD_IP){if(!this.props.osIpAdd)return e?"Due to OS and NIC limitations, Add IP Address is non-supported operation.":"Due to OS limitation, Add IP Address is non-supported automatically operation. User can connect to the server and add IP address manually."}else if(this.props.mode===f.MODE_CHANGE_NETWORK){if(!this.props.vmChangeNetwork)return"Due to OS limitation, Change Network Interface is non-supported operation.";if(!this.props.osChangeNetwork)return" Due to VM limitation, Change Network Interface automatically is non-supported operation. User can connect to the server and configure the network manually."}return null}render(){let e,s,t,i,r,n,o,l=this.state.status===p.A.DATA_READY,d=!0,c=!0,m=this.getNicServerLimitationMessage(),h=""!==this.state.ip;if(this.props.manualConfigEnabled&&(this.props.mode===f.MODE_ADD_IP||1!==this.state.selectedNetworkType||this.props.manualConfigToWanEnabled)||(r=" hidden"),this.props.mode===f.MODE_ADD_INTERFACE?(e="Add Network Interface",s=this.props.serverPoweredOn?"Reboot and Add Automatically":"Add Automatically",t=this.props.serverPoweredOn?"Reboot and Add Manually":"Add Manually",i=this.props.serverPoweredOn?"modal
1-footer network-interface":"modal-footer network-interface-off",o="cancel",n=this.renderAddInterfaceExplanation(r),c=this.props.vmNicAdd,d=this.props.vmNicAdd&&this.props.osNicAdd):this.props.mode===f.MODE_ADD_IP?(0===this.state.ips.length&&(l=!1),e="Add IP Address",s=this.props.serverPoweredOn?"Reboot and Add Automatically":"Add Automatically",t="Add Manually",i=this.props.serverPoweredOn?"modal-footer ip-address":"modal-footer ip-address-off",o=r?this.props.serverPoweredOn?"add-ip-cancel server-on":"add-ip-cancel server-off":"cancel",n=this.renderAddIpExplanation(r),c=!r,d=this.props.osIpAdd):(e="Change Network",s=this.props.serverPoweredOn?"Reboot and Change Automatically":"Change Automatically",t="Change Manually",i=this.props.serverPoweredOn?"modal-footer change-network":"modal-footer change-network-off",o=r?this.props.serverPoweredOn?"change-network-cancel server-on":"change-network-cancel server-off":"cancel",n=this.renderChangeNetworkExplanation(r),c=this.props.vmChangeNetwork,d=this.props.vmChangeNetwork&&this.props.osChangeNetwork),m&&!c&&!d)return e=e+" - "+this.props.name,(0,a.jsx)(g.A,{fnClose:this.props.fnClose.bind(this),title:e,text:m});const b=this.state.status===p.A.DATA_UPDATING;return(0,a.jsxs)("div",{className:"modal modal-open",children:[(0,a.jsx)("div",{className:"modal-backdrop fade in"}),(0,a.jsx)("div",{className:"modal-dialog",children:(0,a.jsxs)("div",{className:"modal-content",children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("button",{type:"button",className:"close",disabled:this.state.status===p.A.DATA_UPDATING,onClick:this.closeClicked.bind(this),children:(0,a.jsx)("span",{children:"Ã"})}),(0,a.jsx)("div",{className:"modal-title",children:(0,a.jsxs)("span",{className:"cwm-title",children:[e," - ",this.props.name]})})]}),(0,a.jsxs)("form",{className:"form-horizontal",onSubmit:this.submit.bind(this),children:[(0,a.jsxs)("div",{className:"modal-body fg",children:[this.renderError(),this.state.status===p.A.DATA_INIT?(0,a.jsx)(u.A,{children:"Loading Network Information"}):this.renderContent(c)]}),(0,a.jsxs)("div",{className:i,children:[b?(0,a.jsxs)("button",{type:"button",className:"btn btn-squared btn-primary",disabled:!0,children:["Processing ",(0,a.jsx)("i",{className:"fa spinner"})]}):null,b?null:(0,a.jsx)("button",{type:"button",onClick:h?this.submitAuto.bind(this):null,className:"btn btn-primary btn-squared manual",disabled:!l||!d||!h,children:s}),b||r?null:(0,a.jsx)("button",{type:"button",onClick:h?this.submitMan.bind(this):null,className:"btn btn-primary btn-squared manually",disabled:!l||!c||!h,children:t}),(0,a.jsx)("button",{type:"button",className:"btn btn-default btn-squared "+o,onClick:this.closeClicked.bind(this),disabled:this.state.status!==p.A.DATA_READY,children:"Cancel"}),n,m?(0,a.jsx)("div",{className:"alert alert-warning text-align-left margin-top-10 margin-bottom-0",children:m}):null]})]})]})})]})}closeClicked(e){this.props.fnClose()}submit(e){e.preventDefault()}submitAuto(){this.formSubmit(!0)}submitMan(){this.formSubmit(!1)}}f.propTypes={serverId:o().string.isRequired,ip:o().string,mac:o().string,ipOnly:o().bool,serverPoweredOn:o().bool,fnClose:o().func.isRequired,name:o().string.isRequired,mode:o().number.isRequired,datacenter:o().string.isRequired,manualConfigEnabled:o().bool.isRequired,manualConfigToWanEnabled:o().bool.isRequired,serverEnabled:o().bool},f.MODE_ADD_IP=0,f.MODE_CHANGE_NETWORK=1,f.MODE_ADD_INTERFACE=2,f.CREATE_NETWORK=0;var x=t(52273),N=t(65771);class A extends i.Component{constructor(e){super(e),this.state={status:p.A.DATA_READY,error:"",ips:[],routedIps:[],gateway:"",subnetMask:"",dns1:"",dns2:""}}componentDidMount(){this.setState({status:p.A.DATA_LOADING}),h.A.networkInfo(this.props.serverId,this.props.mac).then(e=>{let s=e.data;this.setState({status:p.A.DATA_READY,ips:s.ips,routedIps:s.routedIps,gateway:s.gateway,subnetMask:s.subnetMask,dns1:s.dns1,dns2:s.dns2})}).catch(e=>{this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})})}renderError(){if(!this.state.error)return null;let e=h.A.errorMessage(this.state.error.errCode());return(0,a.jsx)("div",{className:"alert alert-danger",children:e})}closeClicked(e){e.preventDefault(),this.props.fnClose()}render(){return(0,a.jsxs)("div",{className:"modal modal-open",children:[(0,a.jsx)("div",{className:"modal-backdrop fade in"}),(0,a.jsx)("div",{className:"modal-dialog",children:(0,a.jsxs)("div",{className:"modal-content",children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("button",{type:"button",className:"close",onClick:this.closeClicked.bind(this),disabled:this.state.status===p.A.DATA_LOADING,children:(0,a.jsx)("span",{children:"Ã"})}),(0,a.jsx)("div",{className:"modal-title",children:(0,a.jsxs)("span",{className:"cwm-title",children:["Network Info - ",this.props.networkName]})})]}),(0,a.jsxs)("form",{className:"form-info",onSubmit:this.closeClicked.bind(this),children:[(0,a.jsx)("div",{className:"modal-body fs",children:(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("div",{className:"col-xs-12",children:(0,a.jsxs)("div",{className:"form-horizontal",children:[(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-xs-4 control-label align",children:"IP:"}),this.renderIpList()]}),(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-xs-4 control-label align",children:"Subnet Mask:"}),(0,a.jsx)("label",{className:"col-xs-8 control-label align",children:this.state.subnetMask})]}),this.state.gateway?(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-xs-4 control-label align",children:"Default Gateway:"}),(0,a.jsx)("label",{className:"col-xs-8 control-label align",children:this.state.gateway})]}):null,this.state.dns1?(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-xs-4 control-label align",children:"DNS #1:"}),(0,a.jsx)("label",{className:"col-xs-8 control-label align",children:this.state.dns1})]}):null,this.state.dns2?(0,a.jsxs)("div",{className:"form-group",children:[(0,a.jsx)("label",{className:"col-xs-4 control-label align",children:"DNS #2:"}),(0,a.jsx)("label",{className:"col-xs-8 control-label align",children:this.state.dns2})]}):null,(0,a.jsx)("br",{}),(0,a.jsx)("br",{})]})})})}),(0,a.jsx)("div",{className:"modal-footer",children:(0,a.jsx)("button",{type:"submit",className:"btn btn-default btn-squared",onClick:this.closeClicked.bind(this),disabled:this.state.status===p.A.DATA_LOADING,children:"Close"})})]})]})})]})}renderIpList(){let e=this.state.ips.map(e=>(0,a.jsxs)("div",{className:"filter-elipsis",children:[e,(0,a.jsx)("br",{})]})),s=this.state.routedIps.map(e=>(0,a.jsxs)("div",{children:[e.ip," (Routed from ",e.network,")",(0,a.jsx)("br",{})]},e.ip));return(0,a.jsxs)("label",{className:"col-xs-8 control-label align",children:[e,s]})}}
1A.propTypes={serverId:o().string.isRequired,mac:o().string.isRequired,networkName:o().string.isRequired,fnClose:o().func.isRequired};var j=t(81829),y=t(93927),w=t(39478),k=t(84710);class C extends i.Component{constructor(e){super(e),this.state={isKVM:d.A.serverIsKvm(this.props.serverId),status:p.A.DATA_READY,error:"",nicType:""}}submitInterfaceType(e){this.props.serverEnabled?p.A.errorToast(name,"Server is currently running a background process and is locked to changes. Try again later."):(this.setState({status:p.A.DATA_LOADING,error:null}),h.A.changeInterfaceType(this.props.serverId,this.props.mac,e.nicType).then(()=>{p.A.successToast(this.props.networkName,"Add Network Interface task added to Tasks Queue."),this.props.fnClose()}).catch(e=>{let s=404===e.response.status?e.response.statusText:e.response.data.info[0];this.setState({error:s})}).finally(()=>{this.setState({status:p.A.DATA_READY})}))}getHeaderMessage(){return this.state.error?{type:"error",msg:this.state.error}:null}getFooterMessages(){const e=[{type:"warning",msg:(0,a.jsxs)("div",{children:["Note: Changing Network Interface Type might cause server to lose network access because of operating system drivers or incompatibility with the device.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"Please make sure you know what you are doing to avoid any damage."]})}];return this.props.serverPoweredOn&&e.push({type:"warning",msg:(0,a.jsxs)("div",{children:["Note: Reboot will perform a Force Reboot to the server. Please make sure there are no running application on the server to avoid any damage to files or applications.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"It is recommended to shutdown the server from within the Operating System."]})}),e}getNicTypeOptions(){const e=this.state.isKVM?p.A.qemuNicTypes:p.A.nicTypes;return this.props.availableNicTypes.map(s=>({value:s,label:e[s]||s}))}render(){const e=this.state.status===p.A.DATA_LOADING,s=this.props.serverPoweredOn?"Reboot and Change":"Change";return(0,a.jsxs)(k.v,{isOpen:!0,onClose:this.props.fnClose,title:`Change Network Interface Type - ${this.props.name}`,onOk:this.submitInterfaceType.bind(this),okText:s,loadingOkBth:e,headerMessage:this.getHeaderMessage(),footerMessage:this.getFooterMessages(),formName:"networkType",validateEditChange:!0,initialValues:{nicType:this.props.currentInterfaceType},children:[(0,a.jsx)(y.A.Item,{label:"Current Interface Type",children:(0,a.jsx)("span",{children:(this.state.isKVM?p.A.qemuNicTypes:p.A.nicTypes)[this.props.currentInterfaceType]||this.props.currentInterfaceType})}),(0,a.jsx)(y.A.Item,{label:"Network Interface Type",name:"nicType",rules:[{required:!0,message:"Please select a NIC type"}],children:(0,a.jsx)(w.A,{placeholder:"Select NIC Type",options:this.getNicTypeOptions(),disabled:e})})]})}}C.propTypes={serverEnabled:o().bool};var I=t(58709),T=t(86418),D=t(94190),R=t(82089);class O extends i.Component{constructor(e){super(e),this._isActive=!1,this.state={status:p.A.DATA_LOADING,error:null,items:[],modal:"",name:d.A.serverName(e.params.serverId),addEnabled:!1,hasSnapshots:!1,powerSuspend:"suspended"===d.A.serverPowerState(e.params.serverId),datacenter:"",manualConfigToWanEnabled:!1,wanInfo:[],availableNicTypes:[],limits:{osNicAdd:!0,vmNicAdd:!0,vmChangeNetwork:!0,osChangeNetwork:!0,osIpAdd:!0,osNicRemove:!0,vmNicRemove:!0,vmNicDisconnect:!0,vmNicConnect:!0,vmNicAdapter:!0}}}componentDidMount(){this._isActive=!0,this.loadData()}componentDidUpdate(e,s){this.props.serverEnabled!==e.serverEnabled&&this.props.serverEnabled&&this.loadData()}loadData(){h.A.nics(this.props.params.serverId).then(e=>{const s=e.data;this._isActive&&this.setState({status:p.A.DATA_READY,addEnabled:s.addEnabled,hasSnapshots:s.hasSnapshots,powerSuspend:"suspended"===d.A.serverPowerState(this.props.params.serverId),datacenter:s.datacenter,manualConfigToWanEnabled:s.manualConfigToWanEnabled,items:s.nics,powerOffBeforeAddNic:s.powerOffBeforeAddNic,availableNicTypes:s.availableNicTypes,limits:s.limits})}).catch(e=>{this.setError(e)})}componentWillUnmount(){this._isActive=!1}setProcessing(){this.setState({status:p.A.DATA_LOADING,error:null})}isProcessing(){return this.state.status!==p.A.DATA_READY}setError(e){this.setState({error:(0,r.Sg)(e),status:p.A.DATA_READY})}_call(e,s){this.closeModalClicked(),this.props.serverEnabled?this.isProcessing()||(this.setProcessing(),e().then(e=>{m.A.setPending(this.props.params.serverId),s(e)}).catch(e=>{this.setError(e)})):p.A.errorToast(name,"Server is currently running a background process and is locked to changes. Try again later.")}connectNic(){this._call(()=>h.A.nicConnect(this.props.params.serverId,this.state.selNic.mac,!0),e=>{p.A.successToast(this.state.name,"Network Interface Connect task added to Tasks Queue.")})}disconnectNic(){this._call(()=>h.A.nicConnect(this.props.params.serverId,this.state.selNic.mac,!1),e=>{p.A.successToast(this.state.name,"Network Interface Disconnect task added to Tasks Queue.")})}removeNic(){this._call(()=>h.A.nicRemove(this.props.params.serverId,this.state.selNic.mac,!1),e=>{p.A.successToast(this.state.name,"Network Interface Removal task added to Tasks Queue.")})}removeNicAndProvision(){this._call(()=>h.A.nicRemove(this.props.params.serverId,this.state.selNic.mac,!0),e=>{p.A.successToast(this.state.name,"Network Interface Removal task added to Tasks Queue.")})}removeIp(){this._call(()=>h.A.nicRemoveIp(this.props.params.serverId,this.state.selNic.mac,this.state.selIp,!1),e=>{p.A.successToast(this.state.name,"Network Interface IP Removal task added to Tasks Queue.")})}removeIpAndProvision(){this._call(()=>h.A.nicRemoveIp(this.props.params.serverId,this.state.selNic.mac,this.state.selIp,!0),e=>{p.A.successToast(this.state.name,"Network Interface IP Removal task added to Tasks Queue.")})}renderActiveModal(){if("connect"===this.state.modal){if(!this.state.limits.vmNicConnect)return(0,a.jsx)(g.A,{fnClose:this.closeModalClicked.bind(this),title:`Connect - ${this.state.name}`,text:"Due to VM limitation, Connect Network Interface is non-supported operation"});this.connectNic(),this.closeModalClicked()}else{if("disconnect"===this.state.modal)return this.state.limits.vmNicDisconnect?(0,a.jsx)(N.default,{fnAction:this.disconnectNic.bind(this),fnClose:this.closeModalClicked.bind(this),actionText:"Disconnect Network Interface",title:`Disconnect - ${this.state.name}`,asWarning:!1,children:(0,a.jsx)("p",{className:"alert alert-info",children:"Disconnect Network Interface will disable all traffic going in and out of this interface"})}):(0,a.jsx)(g.A,{fnClose:this.closeModalClicked.bind(this),title:`Disconnect - ${this.state.name}`,text:"Due to VM limitation, Disconnect Network Interface is non-supported operation"});if("remove.nic"===this.state.modal)return(0,a.jsx)(l,{serverId:this.props.params.serverId,mac:this.state.selNic.mac,name:this.state.name,vmNicRemove:this.state.limits.vmNicRemove,osNicRemove:this.state.limits.osNicRemove,fnAction:this.removeNic.bind(this),fnProvision:this.removeNicAndProvision.bind(this),fnClose:this.closeModalClicked.bind(this),serverPoweredOn:this.state.powerOffBeforeAddNic,manualConfigEnabled:this.state.selNic.manualConfigEnabled});if("remove.ip"===this.state.modal)return(0,a.jsx)(c,{serverId:this.props.params.serverId,name:this.state.name,ip:this.state.selIp,osIpRemove:this.state.limits.osIpRemove,fnAction:this.removeIp.bind(this),fnProvision:this.removeIpAndProvision.bind(this),fnClose:this.closeModalClicked.bind(this),serverPoweredOn:this.state.powerOffBeforeAddNic,manualConfigEnabled:this.state.selNic.manualConfigEnabled});if("network.change"===this.state.modal)return(0,a.jsx)(f,{serverId:this.props.params.serverId,name:this.state.name,mac:this.state.selNic.mac,fnClose:this.closeModalClicked.bind(this),ipOnly:!1,vmChangeNetwork:this.state.limits.vmChangeNetwork,osChangeNetwork:this.state.limits.osChangeNetwork,mode:f.MODE_CHANGE_NETWORK,manualConfigEnabled:this.state.selNic.manualConfigEnabled,manualConfigToWanEnabled:this.state.manualConfigToWanEnabled,serverPoweredOn:this.state.powerOffBeforeAddNic,datacenter:this.state.datacenter});if("add.ip"===this.state.modal)return(0,a.jsx)(f,{serverId:this.props.params.serverId,name:this.state.name,mac:this.state.selNic.mac,network:this.state.selNic.network,fnClose:this.closeModalClicked.bind(this),ipOnly:!0,osIpAdd:this.state.limits.osIpAdd,mode:f.MODE_ADD_IP,manualConfigEnabled:this.state.selNic.manualConfigEnabled,manualConfigToWanEnabled:this.state.manualConfigToWanEnabled,datacenter:this.state.datacenter,serverPoweredOn:this.state.powerOffBeforeAddNic});if("add.nic"===this.state.modal)return(0,a.jsx)(f,{serverId:this.props.params.serverId,name:this.state.name,fnClose:this.closeModalClicked.bind(this),ipOnly:!1,mode:f.MODE_ADD_INTERFACE,osNicAdd:this.state.limits.osNicAdd,vmNicAdd:this.state.limits.vmNicAdd,manualConfigEnabled:!0,manualConfigToWanEnabled:this.state.manualConfigToWanEnabled,datacenter:this.state.datacenter,serverPoweredOn:this.state.powerOffBeforeAddNic});if("info"===this.state.modal)return(0,a.jsx)(A,{serverId:this.props.params.serverId,mac:this.state.selNic.mac,networkName:this.state.selNic.network,fnClose:this.closeModalClicked.bind(this)});if("network.type"===this.state.modal)return this.state.limits.vmNicAdapter?(0,a.jsx)(C,{serverId:this.props.params.serverId,mac:this.state.selNic.mac,name:this.state.name,serverPoweredOn:this.state.powerOffBeforeAddNic,networkName:this.state.selNic.network,availableNicTypes:this.state.availableNicTypes,fnClose:this.closeModalClicked.bind(this),currentInterfaceType:this.state.selNic.interfaceType}):(0,a.jsx)(g.A,{fnClose:this.closeModalClicked.bind(this),title:`Change Network Interface Type - ${this.state.name}`,text:"Due to VM limitation, Change Network Interface Type is non-supported operation."})}return null}renderError(){if(!this.state.error)return null;let e=h.A.errorMessage(this.state.error);return(0,a.jsx)(I.A,{type:"error",message:e})}renderWarning(){if(!d.A.serversIsUserAdmin())return null;const{server:e}=this.props;if((null==e?void 0:e.isKVM)&&Array.isArray(e.nics)){const s=e.nics.filter(e=>"virtio"!==e.type);if(s.length>0)return(0,a.jsx)(D.D,{type:"warning",showIcon:!0,closable:!0,header:(0,a.jsxs)("b",{children:[s.length," network interface",s.length>
11?"s":""," is not using VirtIO"]}),message:(0,a.jsxs)("div",{children:["For best performance and stability, switch all NICs to ",(0,a.jsx)("b",{children:"VirtIO"}),s.map(e=>(0,a.jsxs)("div",{className:"add-flex",children:[(0,a.jsx)("span",{className:"margin-right-5",children:"â¢"}),(0,a.jsxs)("span",{children:[e.network," using ",p.A.qemuNicTypes[e.type]]})]}))]})})}return null}renderSuspendedMsg(){return this.state.error?null:(0,a.jsx)(R.g,{color:"orange",showIcon:!0,style:{margin:0},header:(0,a.jsx)("b",{children:"Your server is suspended"}),messages:[(0,a.jsxs)("div",{children:["Adding, removing or reconfiguring network interfaces and IP addresses canât be done while the server is suspended.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"Please resume the server to proceed."]},"suspended")]})}renderSnapshotsMsg(){return this.state.error?null:(0,a.jsx)(D.D,{type:"warning",showIcon:!0,header:(0,a.jsx)("b",{children:"Your server has active snapshots"}),message:(0,a.jsxs)("div",{children:["Reconfiguring serverâs CPU, RAM or Hard Disk canât be done while server has active snapshots.",(0,a.jsx)("br",{}),(0,a.jsx)("br",{}),"Please commit all ",(0,a.jsx)("a",{onClick:this.openSnapshotsClicked.bind(this),children:"Snapshots"})," to proceed."]})})}openSnapshotsClicked(){let e={pathname:`/servers/${this.props.params.serverId}/snapshots`,query:this.props.location.query};this.context.router.push(e)}checkMaxAllowedNICs(){return this.state.items.length>=p.A.SERVER_NICS_MAX?(0,a.jsx)(I.A,{type:"info",message:"Server reached the maximum number of allowed network interfaces."}):null}renderListHeading(){return(0,a.jsx)("div",{children:(0,a.jsxs)("div",{className:"row cwm-listing-head",children:[(0,a.jsx)("div",{className:"col-xs-4 col-sm-3 cwm-listing-item-first",children:(0,a.jsx)("label",{children:"Network "})}),(0,a.jsx)("div",{className:"hidden-xs col-sm-3",children:(0,a.jsx)("label",{children:"MAC "})}),(0,a.jsx)("div",{className:"col-xs-3 col-sm-3",children:(0,a.jsx)("label",{className:"label-nowrap",children:"IP Address "})}),(0,a.jsx)("div",{className:"col-xs-5 col-sm-3 cwm-listing-item-last text-right",children:(0,a.jsx)("label",{children:"Actions"})})]})})}renderList(){return this.state.items.length?this.state.items.map(e=>(0,a.jsxs)("div",{className:"row no-open cwm-listing-item"+(e.connected?"":"-grey"),children:[(0,a.jsx)("div",{className:"col-xs-4 col-sm-3 cwm-listing-item-first",children:(0,a.jsxs)("label",{className:"filter-elipsis",title:e.network,children:[e.network," "]})}),(0,a.jsxs)("div",{className:"hidden-xs col-sm-3 servers-mac clipboard-elipsis-holder",title:e.mac,children:[(0,a.jsx)("label",{className:"control-label align filter-elipsis",children:e.mac}),(0,a.jsx)("label",{className:"control-label",children:(0,a.jsx)(j.A,{value:e.mac,button:(0,a.jsx)("i",{className:"fal fa-copy",children:" "})})})]}),this.renderIpList(e.ips,e.routedIps),(0,a.jsx)("div",{className:"col-xs-2 col-sm-2 col-lg-2 actions cwm-listing-item-last server-networks",children:this.renderActions(e)})]},`${e.mac}:${e.ip}`)):(0,a.jsx)("div",{className:"row cwm-listing-item no-items",children:(0,a.jsx)("div",{className:"col-xs-12 cwm-listing-item-first",children:(0,a.jsx)("label",{children:"Server has no network interfaces defined."})})})}renderIpList(e,s){let t=e.map(e=>(0,a.jsxs)("div",{className:"server-networks-ip-list",children:[(0,a.jsx)("label",{className:"filter-elipsis",title:e,children:e}),(0,a.jsx)("label",{className:"control-label",children:(0,a.jsx)(j.A,{value:e,button:(0,a.jsx)("i",{className:"fal fa-copy",children:" "})})})]})),i=null;return e.length<O.IPS_IN_LIST&&(i=s.map((s,t)=>{if(t<O.IPS_IN_LIST-e.length)return(0,a.jsxs)("div",{className:"server-networks-ip-list",children:[(0,a.jsxs)("div",{className:"control-label filter-elipsis ",title:s.ip,children:[s.ip," "]}),(0,a.jsx)(j.A,{value:s.ip,button:(0,a.jsx)("i",{className:"fal fa-copy ",children:" "})}),(0,a.jsxs)("div",{className:"filter-elipsis width-30-pr",title:`Routed from ${s.network}`,children:["(Routed from ",s.network,")"]}),(0,a.jsx)("div",{className:"control-label",title:s.network,children:(0,a.jsx)(j.A,{value:s.network,button:(0,a.jsx)("i",{className:"fal fa-copy",children:" "})})})]},s.ip)})),(0,a.jsxs)("div",{className:"col-xs-6 col-sm-4 col-lg-4 clipboard-elipsis-holder display-block-important",style:{"padding-top":"inherit"},children:[t,i]})}renderActions(e){const s=this.state.status===p.A.DATA_READY,t=[["nic.connect","Connect"],["nic.disconnect","Disconnect"],["nic.change","Change Network"],["nic.ip.add","Add IP Address"],["nic.ip.remove","Remove IP: "],["nic.remove","Remove Interface"],["nic.info","Network Info"],["nic.network.type","Change Interface Type"]];let i=[],r=e.actions;i.push({value:"none",text:"MANAGE",disabled:!0},{isDivider:!0});for(let a in t){let[s,n]=t[a];r.hasOwnProperty(s)&&("nic.ip.remove"!==s?i.push({value:s,text:n,disabled:!r[s]}
1):e.ips.forEach(e=>{let t=n+e;i.push({value:s,text:t,disabled:!r[s]})}))}return s&&i.length?(this.props.serverEnabled||i.map(e=>("nic.info"!==e.value&&(e.disabled=!0),e)),(0,a.jsx)(x.A,{className:"btn btn-squared btn-sm btn-primary action-button",items:i,onSelect:this.actionSelected.bind(this,e),children:(0,a.jsx)("i",{className:"fas fa-wrench fa-fw"})})):(0,a.jsxs)("button",{className:"btn btn-squared btn-sm btn-primary action-button",disabled:!0,children:[(0,a.jsx)("i",{className:"fas fa-wrench fa-fw"}),(0,a.jsx)("span",{className:"hidden-xs hidden-lg",children:" Actions"})]})}renderNetworkInterfaces(){const e=this.props.serverEnabled&&this.state.status===p.A.DATA_READY&&this.state.addEnabled;return(0,a.jsxs)("fieldset",{className:"fs-info",children:[(0,a.jsx)("legend",{className:"list",children:"Network Interfaces"}),(0,a.jsxs)("div",{className:"list-container-tabbed networks-list",children:[this.renderListHeading(),this.renderList()]}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("div",{className:"col-xs-12 inner-view-actions margin-top-20 margin-bottom-20",children:(0,a.jsx)("button",{type:"button",className:"btn btn-primary btn-squared",onClick:this.addInterfaceClicked.bind(this),disabled:!e||this.state.powerSuspend,children:"Add Network Interface"})})})]})}render(){return this.state.status===p.A.DATA_LOADING?(0,a.jsx)(u.A,{children:"Loading Network Information"}):(0,a.jsxs)("div",{children:[(0,a.jsxs)(T.A,{direction:"vertical",size:"middle",style:{width:"100%"},children:[this.renderError(),this.state.powerSuspend?this.renderSuspendedMsg():null,this.state.hasSnapshots?this.renderSnapshotsMsg():null,this.renderWarning(),this.checkMaxAllowedNICs()]}),this.renderNetworkInterfaces(),this.renderActiveModal()]})}actionSelected(e,s){"nic.connect"===s.value?this.connectNicClicked(e):"nic.disconnect"===s.value?this.disconnectNicClicked(e):0===s.value.indexOf("nic.ip.remove")?this.removeIpClicked(e,s.text.substring(11,s.text.length-1)):"nic.change"===s.value?this.changeNetworkClicked(e):"nic.ip.add"===s.value?this.addIpClicked(e):"nic.remove"===s.value?this.removeNicClicked(e):"nic.info"===s.value?this.networkInfoClicked(e):"nic.network.type"===s.value&&this.networkTypeClicked(e)}closeModalClicked(){this.setState({modal:null})}connectNicClicked(e){this.setState({modal:"connect",selNic:e})}disconnectNicClicked(e){this.setState({modal:"disconnect",selNic:e})}removeIpClicked(e,s){this.setState({modal:"remove.ip",selNic:e,selIp:s})}removeNicClicked(e){this.setState({modal:"remove.nic",selNic:e})}changeNetworkClicked(e){this.setState({modal:"network.change",selNic:e})}addIpClicked(e){this.setState({modal:"add.ip",selNic:e})}addInterfaceClicked(){this.setState({modal:"add.nic",selNic:null})}networkInfoClicked(e){this.setState({modal:"info",selNic:e})}networkTypeClicked(e){this.setState({modal:"network.type",selNic:e})}}O.IPS_IN_LIST=10,O.propTypes={serverEnabled:o().bool},O.contextTypes={router:o().object.isRequired}},43752(e,s,t){t.d(s,{F:()=>o,Z:()=>l});var a=t(85186),i=t(64810);const r=(0,i.createContext)(null);let n=!1;function o(){return(0,i.useContext)(r)||(n||(n=!0),{setFieldPending:()=>{},clearAllPending:()=>{},isAnyPending:0})}function l({formId:e,children:s}){const t=(0,i.useRef)(new Map),[n,o]=(0,i.useState)(0),l=(0,i.useCallback)((s,a)=>{const i=t.current,r=!0===i.get(e+":"+s);a?r||(i.set(e+":"+s,!0),o(e=>e+1)):r&&(i.delete(e+":"+s),o(e=>Math.max(0,e-1)))},[e]),d=(0,i.useCallback)(()=>{const e=t.current;0!==e.size&&(e.clear(),o(0))},[]),c=(0,i.useMemo)(()=>({setFieldPending:l,clearAllPending:d,isAnyPending:n>0}),[e,l,d,n]);return(0,i.useEffect)(()=>()=>d(),[e]),(0,a.jsx)(r.Provider,{value:c,children:s})}},81829(e,s,t){t.d(s,{A:()=>d,B:()=>l});var a=t(85186),i=t(64810),r=t(63237),n=t(72234),o=t.n(n);const l=({value:e,className:s="",button:t="copyToClipBoard"})=>{const[n,o]=(0,i.useState)(!1),l=(0,i.useMemo)(()=>n?"Copied to Clipboard":"Copy to Clipboard",[n]),d=(0,i.useMemo)(()=>`clipboard ${s}`,[s]),c=(0,i.useCallback)(()=>{navigator.clipboard.writeText(e).then(()=>o(!0)).catch(e=>{})},[e]);return(0,a.jsx)(r.A,{title:l,placement:"top",children:(0,a.jsx)("div",{onClick:c,onMouseEnter:()=>o(!1),className:d,children:(0,a.jsx)("span",{className:"copy_to_clipboard",children:t})})})};l.propTypes={value:o().string.isRequired,className:o().string,button:o().node};const d=l},1930(e,s,t){t.d(s,{A:()=>o});var a=t(85186),i=t(64810),r=t(72234),n=t.n(r);class o extends i.Component{constructor(e){super(e)}closeClicked(e){e.preventDefault(),this.props.fnClose()}render(){return(0,a.jsxs)("div",{className:"modal modal-open",children:[(0,a.jsx)("div",{className:"modal-backdrop fade in"}),(0,a.jsx)("div",{className:"modal-dialog",children:(0,a.jsxs)("div",{className:"modal-content bg-white",children:[(0,a.jsxs)("div",{className:"modal-header",children:[(0,a.jsx)("button",{type:"button",className:"close",onClick:this.closeClicked.bind(this),children:(0,a.jsx)("span",{children:"Ã"})}),(0,a.jsx)("div",{className:"modal-title",children:(0,a.jsx)("span",{className:"cwm-title",children:this.props.title})})]}),(0,a.jsx)("div",{className:"modal-body",children:(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("div",{className:"col-xs-12",children:(0,a.jsx)("div",{className:"alert alert-warning",children:this.props.text})})})}),(0,a.jsx)("div",{className:"modal-footer",children:(0,a.jsx)("button",{type:"button",className:"btn btn-default btn-squared",onClick:this.closeClicked.bind(this),children:"Cancel"})})]})})]})}}o.propTypes={title:n().string.isRequired,text:n().string.isRequired,fnClose:n().func.isRequired}},16163(e,s,t){t.d(s,{i:()=>c});var a=t(85186),i=t(64810),r=t(80571),n=t(72234),o=t.n(n);const l={"smartInfo-default":"GlVxwA7LXxBPpOZjiRTE","smartInfo-warning":"MkrMwy6IlPZZkOZaj3Qh","smartInfo-info":"xXQUyJMe93HPj6eJkIbT","smartInfo-error":"dqoVw5QukeMI5gySKrR3","smartInfo-success":"YJAwAJyRPdKBrrwTjW4k"},{Text:d}=r.A,c=({type:e="default",isError:s=!1,children:t,className:r,scrollSelector:n=".modal
1-header"})=>{(0,i.useEffect)(()=>{var e;s&&n&&(null==(e=document.querySelector(n))||e.scrollIntoView({behavior:"smooth",block:"start"}))},[s,n]);const o=[l["smartInfo-"+e],r].filter(Boolean).join(" ");return(0,a.jsx)(d,{className:o,children:t})};c.propTypes={type:o().oneOf(["default","warning","info","error","success"]),isError:o().bool,children:o().node.isRequired,className:o().string,scrollSelector:o().string}},94190(e,s,t){t.d(s,{D:()=>j});var a=t(85186),i=t(64810),r=t(72234),n=t.n(r),o=t(58709),l=t(99812),d=t(44004),c=t(61194),m=t(15449),h=t(26497),p=t(94566),u=Object.defineProperty,b=Object.defineProperties,v=Object.getOwnPropertyDescriptors,g=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,N=(e,s,t)=>s in e?u(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,A=(e,s)=>{for(var t in s||(s={}))f.call(s,t)&&N(e,t,s[t]);if(g)for(var t of g(s))x.call(s,t)&&N(e,t,s[t]);return e};const j=({header:e,message:s,type:t="info",showIcon:r=!1,closable:n=!1})=>{const u=(0,i.useMemo)(()=>{const e={color:{success:"var(--ant-color-success)",warning:"var(--ant-color-warning)",error:"var(--ant-color-error)",info:"var(--ant-color-info)"}[t]};switch(t){case"success":return(0,a.jsx)(c.A,{style:e});case"warning":return(0,a.jsx)(h.A,{style:e});case"error":return(0,a.jsx)(m.A,{style:e});default:return(0,a.jsx)(p.A,{style:e})}},[t]),g=(0,i.useMemo)(()=>[{key:"1",classNames:{header:"padding-0 user-select-none",body:"padding-bottom-0"},styles:{body:{paddingInlineStart:r?25:0}},label:(0,a.jsxs)(d.A,{gap:10,children:[r&&(0,a.jsx)("div",{children:u}),e]}),children:(0,a.jsx)("div",{children:s})}],[e,s,r,u]);return(0,a.jsx)(o.A,{className:"collapsible-alert",message:(0,a.jsx)(l.A,(f=A({style:{width:"100%"},ghost:!0},n?{expandIcon:()=>null}:{expandIconPosition:"end"}),x={items:g},b(f,v(x)))),type:t,closable:n});var f,x};j.displayName="CollapsibleAlert",j.propTypes={header:n().node.isRequired,message:n().node.isRequired,type:n().oneOf(["info","success","warning","error"]),showIcon:n().bool,closable:n().bool}},82089(e,s,t){t.d(s,{g:()=>I});var a=t(85186),i=t(64810),r=t(72234),n=t.n(r),o=t(58709),l=t(15751),d=t(99812),c=t(44004),m=t(63237),h=t(61194),p=t(15449),u=t(26497),b=t(94566),v=t(94190),g=Object.defineProperty,f=Object.defineProperties,x=Object.getOwnPropertyDescriptors,N=Object.getOwnPropertySymbols,A=Object.prototype.hasOwnProperty,j=Object.prototype.propertyIsEnumerable,y=(e,s,t)=>s in e?g(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,w=(e,s)=>{for(var t in s||(s={}))A.call(s,t)&&y(e,t,s[t]);if(N)for(var t of N(s))j.call(s,t)&&y(e,t,s[t]);return e};const k={green:{type:"success",IconComp:h.A,iconColor:"var(--ant-color-success)"},blue:{type:"info",IconComp:b.A,iconColor:"var(--ant-color-info)"},orange:{type:"warning",IconComp:u.A,iconColor:"var(--ant-color-warning)"},red:{type:"error",IconComp:p.A,iconColor:"var(--ant-color-error)"},purple:{type:null,IconComp:h.A,iconColor:"#531dab",alertStyle:{backgroundColor:"#f9f0ff",border:"1px solid #d3adf7"}}},C={marginTop:20,marginBottom:20},I=({color:e,header:s,messages:t,items:r,onAction:n,buttonProps:h,disabled:p=!1,showIcon:u=!1,closable:b=!1,style:g})=>{const N=k[e]||k.blue,{type:A,IconComp:j,iconColor:y,alertStyle:I}=N,T=(0,i.useMemo)(()=>(0,a.jsx)(j,{style:{color:y}}),[j,y]),D=null!=g?g:C,R=(null==r?void 0:r.length)>0,O=(null==t?void 0:t.length)>0,P=R||O,E=(0,i.useMemo)(()=>R?r.map((e,s)=>(0,a.jsxs)(c.A,{align:"center",gap:5,children:[(0,a.jsx)("div",{style:{flex:1,minWidth:0,overflow:"hidden"},children:(0,a.jsx)(m.A,{styles:{body:{maxWidth:"none",width:"max-content"}},title:(null==e?void 0:e.assign)?e.label+" -> "+(null==e?void 0:e.assign):e.label,placement:"right",children:(0,a.jsx)("span",{children:e.label})})}),e.value,n&&(0,a.jsx)(l.Ay,{color:(null==h?void 0:h.color)||"green",variant:(null==h?void 0:h.variant)||"solid",size:"small",disabled:p,onClick:()=>n(e),children:(null==h?void 0:h.text)||"Change"})]},s)):O?t.map((e,s)=>(0,a.jsx)("div",{children:e},s)):null,[R,O,r,t,n,h,p]);if(void 0!==r&&!R||void 0!==t&&!O)return null;if(!P)return(0,a.jsx)("div",{style:D,children:(0,a.jsx)(o.A,{type:A||"info",style:I,showIcon:u,icon:u?T:void 0,message:s,closable:b})});if("purple"===e){const e=[{key:"1",classNames:{header:"padding-0 user-select-none",body:"padding-bottom-0"},styles:{body:{paddingInlineStart:u?25:0}},label:(0,a.jsxs)(c.A,{gap:10,children:[u&&(0,a.jsx)("div",{children:T}),s]}),children:(0,a.jsx)("div",{children:E})}];return(0,a.jsx)("div",{style:D,children:(0,a.jsx)(o.A,{className:"collapsible-alert",style:I,message:(0,a.jsx)(d.A,(S=w({style:{width:"100%"},ghost:!0},b?{expandIcon:()=>null}:{expandIconPosition:"end"}),M={items:e},f(S,x(M)))),closable:b})})}var S,M;return(0,a.jsx)("div",{style:D,children:(0,a.jsx)(v.D,{type:A,showIcon:u,closable:b,header:s,message:E})})};I.displayName="SmartAlert",I.propTypes={color:n().oneOf(["green","blue","orange","red","purple"]).isRequired,header:n().node.isRequired,messages:n().arrayOf(n().node),items:n().arrayOf(n().shape({label:n().node.isRequired,value:n().node,assign:n().string})),onAction:n().func,buttonProps:n().shape({text:n().string,color:n().string,variant:n().string}),disabled:n().bool,showIcon:n().bool,closable:n().bool,style:n().object}},84710(e,s,t){t.d(s,{v:()=>D});var a=t(85186),i=t(58709),r=t(15751),n=t(44004),o=t(93927),l=t(75319),d=t(80571),c=t(64810),m=t(72234),h=t.n(m),p=t(16598),u=t(16163),b=t(43752),v=Object.defineProperty,g=Object.defineProperties,f=Object.getOwnPropertyDescriptors,x=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable,j=(e,s,t)=>s in e?v(e,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[s]=t,y=(e,s)=>{for(var t in s||(s={}))N.call(s,t)&&j(e,t,s[t]);if(x)for(var t of x(s))A.call(s,t)&&j(e,t,s[t]);return e};const w=d.A.Text,k={header:{marginBottom:"20px"},content:{borderRadius:"5px"},footer:{marginTop:0,borderTop:"1px solid var(--col-general-hr)",paddingTop:"20px"}},C=e=>{if(!e)return null;if(Array.isArray(e)){const s=e.length-1;return e.map((e,t)=>(0,a.jsx)(u.i,{type:e.type,className:t<s?"margin-bottom-8 margin-top-0":"margin-bottom-0 margin-top-0",children:e.msg},t))}return(0,a.jsx)(i.A,{type:e.type,message:e.msg,description:e.dsc,showIcon:e.showIcon})},I=(e,{required:s})=>{const t="string"==typeof e;return(0,a.jsxs)(n.A,{gap:5,children:[e," ",t&&":"," ",s&&(0,a.jsx)("div",{style:{color:"red"},children:"*"})]})},T=({isOpen:e,loading:s,onClose:t,title:i,onOk:n,onFieldsChange:d,children:m,footer:h,afterClose:u,headerMessage:v,footerMessage:g,disableOkBtn:f,loadingOkBth:x,disableCancelBtn:N,initialValues:A,mask:j=!0,maskClosable:y=!0,keyboard:T=!0,okText:D="OK",cancelText:R="Cancel",loaderText:O="Loading",closable:P=!0,width:E=600,dangerBtn:S=!1,formName:M="smart_modal",validateEditChange:_=!1})=>{const{isAnyPending:q,clearAllPending:G}=(0,b.F)(),[W,L]=(0,c.useState)(!0),[F]=o.A.useForm(),B=o.A.useWatch([],F),$=(0,c.useMemo)(()=>"function"==typeof n,[n]),Y=(0,c.useMemo)(()=>v?(0,a.jsx)("div",{className:"smart-modal-header-message",children:C(v)}):null,[v]),z=(0,c.useMemo)(()=>g?(0,a.jsx)("div",{className:"smart-modal-footer-message",children:C(g)}):null,[g]),V=(0,c.useCallback)(e=>{G(),$?n(e):setTimeout(()=>{t()},2e3)},[n,$,t]),U=(0,c.useCallback)(()=>{x||(t(),u&&u())},[x,t,u]),Q=(()=>
1{if(h)return h;const e=[];return $&&e.push((0,a.jsx)(r.Ay,{htmlType:"submit",type:"primary",danger:S,loading:x,disabled:f||W||s||q,children:D},"submit")),e.push((0,a.jsx)(r.Ay,{onClick:U,disabled:x||N,children:R},"back")),e})();return(0,c.useEffect)(()=>{s||F.validateFields({validateOnly:!0}).then(e=>{if(_){const e=F.getFieldsValue(),s=JSON.stringify(e)!==JSON.stringify(A);L(!s)}else L(!1)}).catch(e=>{e.errorFields.length&&L(!0)})},[F,B,s]),(0,a.jsxs)(l.A,{style:{minWidth:400},zIndex:9998,title:(0,a.jsx)(w,{ellipsis:!0,style:{font:"inherit",width:"95%"},title:i||"Modal Title",children:i||"Modal Title"}),closable:P,open:e,width:E,onCancel:U,styles:k,mask:j,maskClosable:y,keyboard:T,destroyOnHidden:!0,modalRender:e=>(0,a.jsx)(o.A,{labelAlign:"left",style:{maxWidth:E},labelCol:{span:8},autoComplete:"off",colon:!1,requiredMark:I,children:e,form:F,onFinish:V,disabled:x,name:M,initialValues:A,onFieldsChange:d,clearOnDestroy:!0}),footer:(0,a.jsxs)(a.Fragment,{children:[z,Q]}),children:[Y,s?(0,a.jsx)(p.A,{children:O}):m]})},D=e=>{var s=e,{formName:t}=s,i=((e,s)=>{var t={};for(var a in e)N.call(e,a)&&s.indexOf(a)<0&&(t[a]=e[a]);if(null!=e&&x)for(var a of x(e))s.indexOf(a)<0&&A.call(e,a)&&(t[a]=e[a]);return t})(s,["formName"]);const r=(0,c.useMemo)(()=>function(e="form"){return`${e}_${Math.random().toString(36).substring(2,10)}`}(t),[t]);return(0,a.jsx)(b.Z,{formId:r,children:(0,a.jsx)(T,(n=y({},i),o={formName:r},g(n,f(o))))});var n,o},R=h().shape({type:h().oneOfType([h().oneOf(["success","warning","error","info"]),h().string]).isRequired,msg:h().node.isRequired});D.propTypes={isOpen:h().bool.isRequired,loading:h().bool,onClose:h().func.isRequired,title:h().node,onOk:h().func,onFieldsChange:h().func,children:h().node,footer:h().node,afterClose:h().func,headerMessage:h().oneOfType([R,h().arrayOf(R),h().oneOf([null])]),footerMessage:h().oneOfType([R,h().arrayOf(R),h().oneOf([null])]),disableOkBtn:h().bool,loadingOkBth:h().bool,disableCancelBtn:h().bool,mask:h().bool,keyboard:h().bool,okText:h().node,loaderText:h().node,closable:h().bool,width:h().oneOfType([h().number,h().string]),dangerBtn:h().bool,validateEditChange:h().bool}}}]); 2//# sourceMappingURL=2751.0d09551a.js.map
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.