UNPKG

harperdb

Version:

HarperDB is a distributed database, caching service, streaming broker, and application development platform focused on performance and ease of use.

1 lines 32.1 kB
"use strict";(self.webpackChunkharperdb_studio=self.webpackChunkharperdb_studio||[]).push([[741],{7368:(e,t,s)=>{s.r(t),s.d(t,{default:()=>Y});var n=s(9950),i=s(7176),r=s(6114),a=s(3452),l=s(4084),o=s(8156),c=s(6713),d=s(625),u=s(9435),m=s(9163),p=s.n(m),h=s(5269),_=s(5553),x=s(6359),v=s(7348),A=s(5996),j=s(4414);const g=function(e){let{which:t,compute:s,storage:n,total:a}=e;return(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsxs)(o.A,{className:"p-2 text-small",children:[(0,j.jsxs)(i.A,{children:[(0,j.jsxs)(r.A,{xs:"6",className:"text-nowrap",children:["Compute","compute"===t&&" (new)"]}),(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap text-end text-truncate",children:s}),(0,j.jsx)(r.A,{xs:"12",children:(0,j.jsx)("hr",{className:"my-1"})})]}),(0,j.jsxs)(i.A,{children:[(0,j.jsxs)(r.A,{xs:"6",className:"text-nowrap",children:["Storage","storage"===t&&" (new)"]}),(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap text-end text-truncate",children:n}),(0,j.jsx)(r.A,{xs:"12",children:(0,j.jsx)("hr",{className:"my-1"})})]}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap",children:(0,j.jsx)("b",{children:"New Total"})}),(0,j.jsx)(r.A,{xs:"6",className:"text-nowrap text-end text-truncate",children:(0,j.jsx)("b",{children:a})})]})]})})};var f=s(5887),b=s(1943),y=s(2714);const w=async e=>(0,y.A)({endpoint:"updateInstance",method:"POST",payload:Object.entries({stripe_plan_id:e.stripe_plan_id,compute_stack_id:e.compute_stack_id,customer_id:e.customer_id,data_volume_size:e.data_volume_size,stripe_storage_plan_id:e.stripe_storage_plan_id,compute_subscription_id:e.compute_subscription_id,storage_subscription_id:e.storage_subscription_id}).reduce(((e,t)=>{let[s,n]=t;return null==n||(e[s]=n),e}),{}),auth:e.auth});var O=s(4549);const N=function(e){let{setInstanceAction:t,showPrepaidStorage:s}=e;const{customer_id:u,compute_stack_id:m}=(0,d.g)(),y=(0,d.Zp)(),N=(0,v.MW)(),$=(0,c.O$)(_.A,(e=>e.auth)),k=(0,c.O$)(_.A,(e=>e.hasCard)),C=(0,c.O$)(_.A,(e=>{var t,s;return"invoice.payment_failed"===(null===(t=e.customer)||void 0===t||null===(s=t.current_payment_status)||void 0===s?void 0:s.status)})),S=(0,c.O$)(h.A,(e=>e.compute)),E=(0,c.O$)(h.A,(e=>e.storage)),P=(0,c.O$)(h.A,(e=>e.is_local)),T=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),R=(0,c.O$)(h.A,(e=>e.last_volume_resize)),I=(0,c.O$)(h.A,(e=>e.data_volume_size)),z=(0,c.O$)(_.A,(e=>e.products.cloud_storage.filter((e=>e.value.data_volume_size>=(null===E||void 0===E?void 0:E.data_volume_size))))),D=(0,c.O$)(_.A,(e=>e.subscriptions.cloud_storage.filter((e=>(e.value.data_volume_size===I||e.value.storage_quantity_available>=e.value.data_volume_size)&&e.value.data_volume_size>=(null===E||void 0===E?void 0:E.data_volume_size))))),[L,F]=(0,n.useState)({}),[M,U]=(0,n.useState)({compute_stack_id:m,customer_id:u,...E}),[H,B]=(0,n.useState)(!1),W=s?D:z,q=W.find((e=>e.value.data_volume_size===M.data_volume_size&&e.value.stripe_storage_plan_id===M.stripe_storage_plan_id&&e.value.storage_subscription_id===M.storage_subscription_id)),V=$.orgs.filter((e=>$.user_id===e.owner_user_id)).reduce(((e,t)=>e+t.free_cloud_instance_count),0)<A.A.free_cloud_instance_limit,Y=((null===M||void 0===M?void 0:M.storage_price)||0)+((null===S||void 0===S?void 0:S.compute_price)||0),Z=Y?`${(0,O.A)(Y.toFixed(2))}/${S.compute_interval}`:"FREE",G=!R||(Date.now()-new Date(R).getTime())/1e3/3600>6,K=()=>U({compute_stack_id:m,customer_id:u,...E});return p()(K,[s]),p()((()=>{B((null===E||void 0===E?void 0:E.data_volume_size)!==M.data_volume_size||(null===E||void 0===E?void 0:E.stripe_storage_plan_id)!==M.stripe_storage_plan_id||(null===E||void 0===E?void 0:E.storage_subscription_id)!==M.storage_subscription_id)}),[M]),p()((()=>{B(!1)}),[m]),p()((async()=>{const{submitted:e}=L;if(e){t("Updating");(await w({auth:$,...M})).error?(N.error("There was an error updating your instance. Please try again later."),t(!1)):(window._kmq&&window._kmq.push(["record","upgrade instance - disk size",{totalPrice:null===M||void 0===M?void 0:M.compute_price,currency:"USD",products:[{name:"storage",id:q.data_volume_size_string,price:(null===M||void 0===M?void 0:M.storage_price)||0}]}]),N.success("Instance update initialized successfully"),_.A.update((e=>{e.lastUpdate=Date.now()})),setTimeout((()=>y(`/o/${u}/instances`)),100))}}),[L]),T?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.Ay,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:t}=e;return U({...M,...t})},options:W.filter((e=>e.value.active)),value:q,defaultValue:E,isSearchable:!1,isClearable:!1,isLoading:!W,placeholder:"Select Data Volume Size",styles:{placeholder:e=>({...e,textAlign:"center",width:"100%",color:"#BCBCBC"})}}),!H||M.storage_subscription_id||Y||P||V?H&&!G?(0,j.jsx)(l.A,{className:"error mt-3 text-start",children:(0,j.jsxs)(o.A,{children:["You may update disk size every 6 hours",(0,j.jsx)("br",{}),(0,j.jsx)("br",{}),"Last resize: ",new Date(R).toLocaleTimeString(),(0,j.jsx)("br",{}),(0,j.jsx)("br",{}),"Try again at: ",new Date(new Date(R).getTime()+216e5).toLocaleTimeString()]})}):H&&(null!==M&&void 0!==M&&M.storage_price||null!==S&&void 0!==S&&S.compute_price)&&C?(0,j.jsxs)("div",{className:"mt-3",children:[(0,j.jsx)(f.A,{}),(0,j.jsx)(b.A,{disabled:!H||L.submitted,label:"Update Credit Card",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)})]}):H&&(null!==M&&void 0!==M&&M.storage_price||null!==S&&void 0!==S&&S.compute_price)&&!k?(0,j.jsx)(b.A,{disabled:!H||L.submitted,label:"Add Credit Card To Account",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)}):H?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(g,{which:"storage",compute:null===S||void 0===S?void 0:S.compute_price_string_with_interval,storage:(null===M||void 0===M?void 0:M.storage_price_string_with_interval)||"FREE",total:Z}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"cancelChange",onClick:K,title:"Cancel",block:!0,disabled:L.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"confirmChange",onClick:()=>F({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:!H||L.submitted,color:"success",children:"Update"})})]})]}):null:(0,j.jsx)(l.A,{className:"error mt-3",children:(0,j.jsxs)(o.A,{children:["You are limited to ",A.A.free_cloud_instance_limit," free cloud instance",1!==A.A.free_cloud_instance_limit?"s":""]})})]})};const $=function(e){let{setInstanceAction:t,showPrepaidCompute:s}=e;const{customer_id:u,compute_stack_id:m}=(0,d.g)(),y=(0,d.Zp)(),N=(0,v.MW)(),$=(0,c.O$)(_.A,(e=>e.auth)),k=(0,c.O$)(_.A,(e=>e.hasCard)),C=(0,c.O$)(_.A,(e=>{var t,s;return"invoice.payment_failed"===(null===(t=e.customer)||void 0===t||null===(s=t.current_payment_status)||void 0===s?void 0:s.status)})),S=(0,c.O$)(h.A,(e=>e.compute)),E=(0,c.O$)(h.A,(e=>e.storage)),P=(0,c.O$)(h.A,(e=>e.is_local)),T=(0,c.O$)(h.A,(e=>e.wavelength_zone_id)),R=(0,c.O$)(h.A,(e=>e.compute_subscription_id)),I=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),z=(0,c.O$)(_.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.is_unpaid})),D=(0,c.O$)(_.A,(e=>e.products[P?"local_compute":T?"wavelength_compute":"cloud_compute"])),L=(0,c.O$)(_.A,(e=>e.subscriptions[P?"local_compute":T?"wavelength_compute":"cloud_compute"].filter((e=>e.value.compute_subscription_id===R||e.value.compute_quantity_available)))),[F,M]=(0,n.useState)({}),[U,H]=(0,n.useState)({compute_stack_id:m,customer_id:u,...S}),[B,W]=(0,n.useState)(!1),q=s?L:D,V=q.find((e=>e.value.stripe_plan_id===U.stripe_plan_id&&e.value.compute_subscription_id===U.compute_subscription_id)),Y=$.orgs.filter((e=>$.user_id===e.owner_user_id)).reduce(((e,t)=>e+t.free_cloud_instance_count),0)<A.A.free_cloud_instance_limit,Z=((null===E||void 0===E?void 0:E.storage_price)||0)+((null===U||void 0===U?void 0:U.compute_price)||0),G=Z?`${(0,O.A)(Z.toFixed(2))}/${S.compute_interval}`:"FREE",K=()=>H({compute_stack_id:m,customer_id:u,...S});return p()(K,[s]),p()((()=>{W((null===S||void 0===S?void 0:S.stripe_plan_id)!==U.stripe_plan_id||U.compute_subscription_id!==(null===S||void 0===S?void 0:S.compute_subscription_id))}),[U]),p()((()=>{W(!1)}),[m]),p()((async()=>{const{submitted:e}=F;if(e)if(Z||U.compute_subscription_id||P||Y){t("Updating");(await w({auth:$,...U})).error?(N.error("There was an error updating your instance. Please try again later."),t(!1)):(window._kmq&&window._kmq.push(["record","upgrade instance - RAM",{totalPrice:null===U||void 0===U?void 0:U.compute_price,currency:"USD",products:[{name:"compute",id:V.compute_ram_string,price:(null===U||void 0===U?void 0:U.compute_price)||0}]}]),N.success("Instance update initialized successfully"),_.A.update((e=>{e.lastUpdate=Date.now()})),setTimeout((()=>y(`/o/${u}/instances`)),100))}else N.error(`You are limited to ${A.A.free_cloud_instance_limit} free cloud instance${1!==A.A.free_cloud_instance_limit?"s":""}`),K(),M({})}),[F]),I?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(x.Ay,{className:"react-select-container",classNamePrefix:"react-select",onChange:e=>{let{value:t}=e;return H({...U,...t})},options:q.filter((e=>e.value.active)),value:V,defaultValue:S,isSearchable:!1,isClearable:!1,isLoading:!q,placeholder:"select a RAM allotment",styles:{placeholder:e=>({...e,textAlign:"center",width:"100%",color:"#BCBCBC"})}}),!B||Z||U.compute_subscription_id||P||Y?B&&(null!==E&&void 0!==E&&E.storage_price||null!==U&&void 0!==U&&U.compute_price)&&C?(0,j.jsxs)("div",{className:"mt-3",children:[(0,j.jsx)(f.A,{}),(0,j.jsx)(b.A,{disabled:!B||F.submitted,label:"Update Credit Card",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)})]}):B&&(null!==E&&void 0!==E&&E.storage_price||null!==U&&void 0!==U&&U.compute_price)&&!k&&!z?(0,j.jsx)(b.A,{disabled:!B||F.submitted,label:"Add Credit Card To Account",onClick:()=>y(`/o/${u}/billing?returnURL=/${u}/i/${m}/config`)}):B?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(g,{which:"compute",compute:U.compute_price_string_with_interval,storage:(null===E||void 0===E?void 0:E.storage_price_string_with_interval)||"FREE",total:G}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"cancelChange",onClick:K,title:"Cancel",block:!0,disabled:F.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"confirmChange",onClick:()=>M({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:!B||F.submitted,color:"success",children:"Update"})})]})]}):null:(0,j.jsx)(l.A,{className:"error mt-2",children:(0,j.jsxs)(o.A,{children:["You are limited to ",A.A.free_cloud_instance_limit," free cloud instance",1!==A.A.free_cloud_instance_limit?"s":""]})})]})};var k=s(5488),C=s(6404);const S=function(e){let{setInstanceAction:t}=e;const{customer_id:s,compute_stack_id:u}=(0,d.g)(),m=(0,d.Zp)(),x=(0,v.MW)(),A=(0,c.O$)(_.A,(e=>e.auth)),g=(0,c.O$)(h.A,(e=>e.instance_name)),f=(0,c.O$)(h.A,(e=>e.is_local)),b=(0,c.O$)(h.A,(e=>e.wavelength_zone_id)),y=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),[w,O]=(0,n.useState)({}),[N,$]=(0,n.useState)({});return p()((async()=>{const{submitted:e}=w;if(e){const{delete_instance_name:e}=N;if(g!==e)O({error:"instance name is not correct"});else{t("Removing");(await(0,C.A)({auth:A,customer_id:s,compute_stack_id:u,wavelength_zone_id:b})).error?(x.error("There was an error removing your instance. Please try again later."),t(!1)):(x.success("Instance deletion initiated"),_.A.update((e=>{e.lastUpdate=Date.now()})),setTimeout((()=>m(`/o/${s}/instances`)),3e3))}}}),[w]),y?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k.A,{id:"instance_name_remove",onChange:e=>$({delete_instance_name:e.target.value}),type:"text",title:"instance_name",placeholder:`Enter "${g}" here to confirm.`,value:N.delete_instance_name||""}),N.delete_instance_name===g&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.A,{className:"my-2",children:(0,j.jsx)(o.A,{className:"px-2 pb-2 pt-3 text-small",children:f?(0,j.jsxs)("ul",{className:"text-small mb-0",children:[(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"DOES NOT"})," uninstall Harper."]}),(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"DOES"})," leave all your data intact."]}),(0,j.jsx)("li",{children:"REMOVES your instance license."}),(0,j.jsx)("li",{children:"STOPS recurring license charges."}),(0,j.jsx)("li",{children:"LIMITS instance to 1GB RAM."}),(0,j.jsx)("li",{children:"REMOVES instance from the Studio."}),(0,j.jsx)("li",{children:"RESTARTS the instance."})]}):(0,j.jsxs)("ul",{className:"text-small mb-0",children:[(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"THIS IS"})," an irreversible process."]}),(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"IT CANNOT"})," be undone."]}),(0,j.jsx)("li",{children:"DELETES your instance completely."}),(0,j.jsx)("li",{children:"STOPS recurring license charges."}),(0,j.jsx)("li",{children:"REMOVES instance from the Studio."})]})})}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"cancelDeleteInstance",onClick:()=>$({delete_instance_name:""}),title:"Cancel",block:!0,disabled:w.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{id:"removeInstance",onClick:()=>O({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:w.submitted,color:"danger",children:"Remove"})})]})]})]})};var E=s(135),P=s(5911),T=s(2010);const R=function(e){let{instanceAction:t,setInstanceAction:s}=e;const d=(0,v.MW)(),u=(0,c.O$)(h.A,(e=>e.auth)),m=(0,c.O$)(h.A,(e=>e.url)),_=(0,c.O$)(h.A,(e=>e.instance_name)),x=(0,c.O$)(h.A,(e=>!["CREATE_COMPLETE","UPDATE_COMPLETE"].includes(e.status))),[g,f]=(0,n.useState)({}),[b,y]=(0,n.useState)({});return p()((async()=>{const{submitted:e}=g;if(e){s("Restarting");const e=await(0,T.A)({auth:u,url:m});null!==e&&void 0!==e&&e.error&&(s(!1),d.error("There was an error restarting your instance. Please try again later."))}}),[g]),(0,E.A)((()=>{"Restarting"===t&&(async()=>{(await(0,P.A)({auth:u,url:m})).error||(y({}),f({}),s(!1),d.success("Instance restarted successfully"))})()}),A.A.refresh_content_interval),"Restarting"===t?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsxs)(o.A,{children:[(0,j.jsx)("i",{className:"fa fa-spin fa-spinner me-2"}),"instance restarting. please wait."]})}):!A.A.is_local_studio&&x?(0,j.jsx)(l.A,{className:"error",children:(0,j.jsx)(o.A,{children:"instance updating. please wait."})}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(k.A,{id:"instance_name_restart",onChange:e=>y({restart_instance_name:e.target.value}),type:"text",title:"instance_name",placeholder:`Enter "${_}" here to confirm.`,value:b.restart_instance_name||""}),b.restart_instance_name===_&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(l.A,{className:"my-2",children:(0,j.jsx)(o.A,{className:"px-2 pb-2 pt-3 text-small",children:(0,j.jsxs)("ul",{className:"text-small mb-0",children:[(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"WILL"})," interrupt connectivity."]}),(0,j.jsxs)("li",{children:[(0,j.jsx)("b",{children:"WILL"})," leave all your data intact."]})]})})}),(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{onClick:()=>y({restart_instance_name:""}),title:"Cancel",block:!0,disabled:g.submitted,color:"grey",children:"Cancel"})}),(0,j.jsx)(r.A,{children:(0,j.jsx)(a.A,{onClick:()=>f({submitted:!0}),title:"Confirm Instance Details",block:!0,disabled:g.submitted,color:"danger",children:"Restart"})})]})]})]})};var I=s(1652),z=s(7666);const D=function(e){var t,s,n,a,d,u,m,p,_,x,v,g,f,b,y,w,O,N;let{clusterNodeName:$,instanceConfig:k}=e;const C=(0,c.O$)(h.A,(e=>e.url)),S=(0,c.O$)(h.A,(e=>e.auth)),E=(0,c.O$)(h.A,(e=>e.totalPriceStringWithInterval)),P=(0,c.O$)(h.A,(e=>e.compute)),T=(0,c.O$)(h.A,(e=>!!e.compute_subscription_id)),R=(0,c.O$)(h.A,(e=>!!e.storage_subscription_id)),D=(0,c.O$)(h.A,(e=>e.creation_date)),L=(0,c.O$)(h.A,(e=>e.instance_region)),F=(0,c.O$)(h.A,(e=>e.storage)),M=(0,c.O$)(h.A,(e=>e.is_local)),U=null!==S&&void 0!==S&&S.user?`${btoa(`${S.user}:${S.pass}`)}`:"...",H=M?"HARDWARE LIMIT":`${null===F||void 0===F?void 0:F.iops}`,B=D?new Date(D).toLocaleDateString():"N/A",{hostname:W,origin:q}=window.location,V=new URL(A.A.is_local_studio?q:C),Y=A.A.is_local_studio?`${null!==(m=k.operationsApi)&&void 0!==m&&null!==(p=m.network)&&void 0!==p&&p.securePort?"https://":"http://"}${W}:${(null===(_=k.operationsApi)||void 0===_||null===(x=_.network)||void 0===x?void 0:x.securePort)||(null===(v=k.operationsApi)||void 0===v||null===(g=v.network)||void 0===g?void 0:g.port)}`:`${null!==(t=k.operationsApi)&&void 0!==t&&null!==(s=t.network)&&void 0!==s&&s.securePort?"https://":"http://"}${V.hostname}:${(null===(n=k.operationsApi)||void 0===n||null===(a=n.network)||void 0===a?void 0:a.securePort)||(null===(d=k.operationsApi)||void 0===d||null===(u=d.network)||void 0===u?void 0:u.port)}`,Z=A.A.is_local_studio?`${null!==(w=k.http)&&void 0!==w&&w.securePort?"https://":"http://"}${W}:${(null===(O=k.http)||void 0===O?void 0:O.securePort)||(null===(N=k.http)||void 0===N?void 0:N.port)}`:`${null!==(f=k.http)&&void 0!==f&&f.securePort?"https://":"http://"}${V.hostname}:${(null===(b=k.http)||void 0===b?void 0:b.securePort)||(null===(y=k.http)||void 0===y?void 0:y.port)}`,G=(0,c.O$)(h.A,(e=>{var t;return null===(t=e.registration)||void 0===t?void 0:t.version})),[K,J]=(null===G||void 0===G?void 0:G.split("."))||[],Q=parseFloat(`${K}.${J}`);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)("span",{className:"floating-card-header",children:"instance overview"}),(0,j.jsx)(l.A,{className:"mt-3 mb-4 instance-details",children:(0,j.jsx)(o.A,{children:(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:"Instance URL",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:(0,j.jsx)(z.A,{text:Y})})})}),(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:(Q>=4.2?"Applications":"Custom Functions")+" URL",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:(0,j.jsx)(z.A,{text:Z})})})}),(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:"Instance Node Name (for clustering)",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:$?(0,j.jsx)(z.A,{text:$}):"clustering not enabled"})})}),!A.A.is_local_studio&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.A,{md:"4",xs:"12",children:(0,j.jsx)(I.A,{header:"Instance API Auth Header (this user)",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:(0,j.jsx)(z.A,{text:U,beforeText:"Basic ",obscure:!0})})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Created",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:B})})}),L&&(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Region",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:L})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Total Price",className:"mb-3",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:E})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"RAM",className:"mb-3",children:(0,j.jsxs)("div",{className:"nowrap-scroll",children:[null===P||void 0===P?void 0:P.compute_ram_string," ",T&&"(PREPAID)"]})})}),!M&&(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Storage",className:"mb-3 text-nowrap",children:(0,j.jsxs)("div",{className:"nowrap-scroll",children:[null===F||void 0===F?void 0:F.data_volume_size_string," ",R&&"(PREPAID)"]})})}),(0,j.jsx)(r.A,{md:"2",sm:"4",xs:"6",children:(0,j.jsx)(I.A,{header:"Disk IOPS",className:"mb-3 text-nowrap",children:(0,j.jsx)("div",{className:"nowrap-scroll",children:H})})})]})]})]})})})]})};var L=s(4979),F=s(3150),M=s(3628),U=s(7596),H=s(5012),B=s(2594);const W=function(e){let{instanceConfig:t}=e;const s=(0,c.O$)(_.A,(e=>e.theme));return(0,j.jsx)(B.A,{placeholder:t,height:"calc(100vh - 568px)",theme:"light_mitsuketa_tribute",viewOnly:!0,colors:{background:"transparent",default:"dark"===s?"#aaa":"#000",colon:"dark"===s?"#aaa":"#000",keys:"dark"===s?"#aaa":"#000",string:"#13c664",number:"#ea4c89",primitive:"#ffa500"},style:{warningBox:{display:"none"},body:{padding:"8px 0 0 0"}},locale:H.A,width:"100%",confirmGood:!1,waitAfterKeyPress:3e4})};var q=s(8750);const V=function(){return(0,j.jsx)("div",{className:"configLoader",children:(0,j.jsx)("i",{className:"fa fa-spinner fa-spin"})})};const Y=function(){const{customer_id:e,compute_stack_id:t}=(0,d.g)(),s=(0,c.O$)(_.A,(e=>e.auth)),m=(0,c.O$)(_.A,(e=>e.theme)),x=(0,c.O$)(h.A,(e=>e.auth),[t]),v=(0,c.O$)(h.A,(e=>e.url),[t]),A=(0,c.O$)(_.A,(e=>{var t;return null===(t=e.customer)||void 0===t?void 0:t.stripe_id})),g=(0,c.O$)(h.A,(e=>e.is_local),[t]),f=(0,c.O$)(h.A,(e=>{var t;return parseFloat(null===(t=e.registration)||void 0===t?void 0:t.version)>=4?"nats":"socketcluster"}),[t]),b=(0,c.O$)(h.A,(e=>e.compute_subscription_id),[t]),y=(0,c.O$)(h.A,(e=>e.storage_subscription_id),[t]),w=(0,c.O$)(_.A,(t=>{var s,n;return null===(s=t.auth)||void 0===s||null===(n=s.orgs)||void 0===n?void 0:n.find((t=>{var s;return(null===(s=t.customer_id)||void 0===s?void 0:s.toString())===e}))}),[e]),O="owner"===(null===w||void 0===w?void 0:w.status),[k,C]=(0,n.useState)(!1),[E,P]=(0,n.useState)(!1),[T,I]=(0,n.useState)(""),z=(0,c.O$)(_.A,(e=>{var t;return(null===(t=e.subscriptions[g?"local_compute":"cloud_compute"])||void 0===t?void 0:t.filter((e=>!e.value.compute_subscription_name||e.value.compute_quantity_available)))||[]})),H=(0,c.O$)(_.A,(e=>{var t,s;return(null===(t=e.subscriptions)||void 0===t||null===(s=t.cloud_storage)||void 0===s?void 0:s.filter((e=>!e.value.storage_subscription_name||e.value.storage_quantity_available)))||[]})),[B,Y]=(0,n.useState)(!!b),[Z,G]=(0,n.useState)(!!y);return p()((async()=>{s&&e&&A&&(0,U.A)({auth:s,customer_id:e,stripe_id:A})}),[s,e,A]),p()((async()=>{if(x&&v){I("..."),P(!1);const t=await(0,q.A)({auth:x,url:v});if(!t.error){var e;const s="nats"===f?null===(e=t.clustering)||void 0===e?void 0:e.nodeName:t.NODE_NAME;I(s),P(t)}}}),[x]),k&&"Restarting"!==k?(0,j.jsx)(L.A,{header:`${k} Instance`,spinner:!0}):(0,j.jsxs)(i.A,{id:"config",children:[(0,j.jsx)(r.A,{xs:"12",children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:(0,j.jsx)(D,{clusterNodeName:T,instanceConfig:E})})}),O&&"akamai"!==m&&(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)("span",{className:"floating-card-header",children:"update ram"})}),(0,j.jsx)(r.A,{className:"text-end",children:(!!b||!!z.length)&&(0,j.jsxs)("span",{className:"floating-card-header",children:["prepaid:"," ",(0,j.jsx)(a.A,{id:"showPrepaidCompute",color:"link",onClick:()=>Y(!B),children:(0,j.jsx)("i",{className:"fa fa-lg fa-toggle-"+(B?"on":"off")})})]})})]}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:E?(0,j.jsx)($,{setInstanceAction:C,showPrepaidCompute:B}):(0,j.jsx)(V,{})})})})]}),O&&!g&&"akamai"!==m&&(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsxs)(i.A,{children:[(0,j.jsx)(r.A,{children:(0,j.jsx)("span",{className:"floating-card-header",children:"update storage"})}),(0,j.jsx)(r.A,{className:"text-end",children:(!!y||!!H.length)&&(0,j.jsxs)("span",{className:"floating-card-header",children:["prepaid:"," ",(0,j.jsx)(a.A,{id:"showPrepaidStorage",color:"link",onClick:()=>G(!Z),children:(0,j.jsx)("i",{className:"fa fa-lg fa-toggle-"+(Z?"on":"off")})})]})})]}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:E?(0,j.jsx)(N,{setInstanceAction:C,showPrepaidStorage:Z}):(0,j.jsx)(V,{})})})})]}),O&&(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsx)("span",{className:"floating-card-header",children:"remove instance"}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:(0,j.jsx)(S,{setInstanceAction:C,instanceAction:k})})})})]}),(0,j.jsxs)(r.A,{lg:"3",sm:"6",xs:"12",children:[(0,j.jsx)("span",{className:"floating-card-header",children:"restart instance"}),(0,j.jsx)(l.A,{className:"my-3",children:(0,j.jsx)(o.A,{children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:(0,j.jsx)(R,{setInstanceAction:C,instanceAction:k})})})})]}),(0,j.jsxs)(r.A,{xs:"12",children:[(0,j.jsx)("span",{className:"floating-card-header",children:"instance config (read only)"}),(0,j.jsx)(l.A,{className:"mt-3 mb-4",children:(0,j.jsx)(o.A,{className:"p-0",children:(0,j.jsx)(u.tH,{onError:(e,t)=>(0,M.A)({error:{message:e.message,componentStack:t}}),FallbackComponent:F.A,children:E?(0,j.jsx)(W,{instanceConfig:E}):(0,j.jsx)(V,{})})})})]})]})}},5887:(e,t,s)=>{s.d(t,{A:()=>i});s(9950);var n=s(4414);const i=function(){return(0,n.jsxs)("div",{className:"text-danger",children:[(0,n.jsx)("i",{children:"Your most recent card payment failed. Please update your card below."}),(0,n.jsx)("hr",{className:"mt-3 mb-2"})]})}},1652:(e,t,s)=>{s.d(t,{A:()=>i});s(9950);var n=s(4414);const i=function(e){let{children:t,header:s,subheader:i,maxHeight:r="auto",minHeight:a="auto",className:l}=e;return(0,n.jsxs)("div",{className:`content-container ${l}`,children:[(0,n.jsxs)("div",{className:"header-container",children:[(0,n.jsx)("span",{className:"header",children:s}),(0,n.jsx)("span",{className:"subheader",children:i})]}),(0,n.jsx)("div",{className:"auto"!==r?"scrollable":"",style:{maxHeight:r,minHeight:a},children:t})]})}},7666:(e,t,s)=>{s.d(t,{A:()=>c});var n=s(9950),i=s(7176),r=s(6114),a=s(3452),l=s(7348),o=s(4414);const c=function(e){let{text:t,beforeText:s,afterText:c,obscure:d=!1}=e;const u=(0,l.MW)(),m=navigator.clipboard,p=(0,n.useCallback)((async e=>{e.stopPropagation(),await navigator.clipboard.writeText(t),u.success("Text copied to clipboard")}),[u,t]);return(0,o.jsxs)(i.A,{className:"copyable-text-holder g-0",children:[m&&t&&(0,o.jsx)(r.A,{className:"copy-icon",children:(0,o.jsx)(a.A,{title:"Copy this value",onClick:p,color:"link",children:(0,o.jsx)("i",{className:"fa fa-copy text-small"})})}),(0,o.jsx)(r.A,{className:"text-container",children:t?(0,o.jsxs)(o.Fragment,{children:[s,d?t.replace(/./g,"*"):t,c]}):(0,o.jsx)("span",{children:"\xa0"})})]})}},1943:(e,t,s)=>{s.d(t,{A:()=>r});s(9950);var n=s(3452),i=s(4414);const r=function(e){let{disabled:t,label:s,onClick:r}=e;return(0,i.jsx)(n.A,{onClick:r,title:s,block:!0,disabled:t,color:"danger",className:"mt-2",id:"visitCreditCard",children:s})}},8750:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(127);const i=async e=>{let{auth:t,url:s}=e;return(0,n.A)({operation:{operation:"get_configuration"},auth:t,url:s})}},2010:(e,t,s)=>{s.d(t,{A:()=>r});var n=s(127),i=s(5269);const r=async e=>{let{auth:t,url:s}=e;return i.A.update((e=>{e.restarting=!0})),(0,n.A)({operation:{operation:"restart"},auth:t,url:s})}},6404:(e,t,s)=>{s.d(t,{A:()=>i});var n=s(2714);const i=async e=>{let{auth:t,customer_id:s,compute_stack_id:i,is_verizon:r,is_akamai:a}=e;return(0,n.A)({endpoint:r?"wl/removeWavelengthInstance":a?"removeAkamaiInstance":"removeInstance",method:"POST",payload:{customer_id:s,compute_stack_id:i,compute_stack_wl_id:i},auth:t})}},5488:(e,t,s)=>{s.d(t,{A:()=>g});var n=s(9950),i=s(1942),r=s.n(i),a=s(8738),l=s.n(a),o=s(1497);function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}var d=["className","cssModule","type","bsSize","valid","invalid","tag","addon","plaintext","innerRef"];function u(){return u=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(e[n]=s[n])}return e},u.apply(this,arguments)}function m(e,t){if(null==e)return{};var s,n,i=function(e,t){if(null==e)return{};var s,n,i={},r=Object.keys(e);for(n=0;n<r.length;n++)s=r[n],t.indexOf(s)>=0||(i[s]=e[s]);return i}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n<r.length;n++)s=r[n],t.indexOf(s)>=0||Object.prototype.propertyIsEnumerable.call(e,s)&&(i[s]=e[s])}return i}function p(e,t){for(var s=0;s<t.length;s++){var n=t[s];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function _(e){var t=function(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var s,n=v(e);if(t){var i=v(this).constructor;s=Reflect.construct(n,arguments,i)}else s=n.apply(this,arguments);return function(e,t){if(t&&("object"===c(t)||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return x(e)}(this,s)}}function x(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function v(e){return v=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},v(e)}var A={children:r().node,type:r().string,size:r().oneOfType([r().number,r().string]),bsSize:r().string,valid:r().bool,invalid:r().bool,tag:o.Wx,innerRef:r().oneOfType([r().object,r().func,r().string]),plaintext:r().bool,addon:r().bool,className:r().string,cssModule:r().object},j=function(e){!function(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}(a,e);var t,s,i,r=_(a);function a(e){var t;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,a),(t=r.call(this,e)).getRef=t.getRef.bind(x(t)),t.focus=t.focus.bind(x(t)),t}return t=a,(s=[{key:"getRef",value:function(e){this.props.innerRef&&this.props.innerRef(e),this.ref=e}},{key:"focus",value:function(){this.ref&&this.ref.focus()}},{key:"render",value:function(){var e=this.props,t=e.className,s=e.cssModule,i=e.type,r=void 0===i?"text":i,a=e.bsSize,c=e.valid,p=e.invalid,h=e.tag,_=e.addon,x=e.plaintext,v=e.innerRef,A=m(e,d),j=["switch","radio","checkbox"].indexOf(r)>-1,g="select"===r,f="range"===r,b=h||(g||"textarea"===r?r:"input"),y="form-control";x?(y="".concat(y,"-plaintext"),b=h||"input"):f?y="form-range":g?y="form-select":j&&(y=_?null:"form-check-input"),A.size&&/\D/g.test(A.size)&&((0,o.mc)('Please use the prop "bsSize" instead of the "size" to bootstrap\'s input sizing.'),a=A.size,delete A.size);var w=(0,o.qO)(l()(t,p&&"is-invalid",c&&"is-valid",!!a&&(g?"form-select-".concat(a):"form-control-".concat(a)),y),s);return("input"===b||h&&"function"===typeof h)&&(A.type="switch"===r?"checkbox":r),A.children&&!x&&"select"!==r&&"string"===typeof b&&"select"!==b&&((0,o.mc)('Input with a type of "'.concat(r,'" cannot have children. Please use "value"/"defaultValue" instead.')),delete A.children),n.createElement(b,u({},A,{ref:v,className:w,"aria-invalid":p}))}}])&&p(t.prototype,s),i&&p(t,i),Object.defineProperty(t,"prototype",{writable:!1}),a}(n.Component);j.propTypes=A;const g=j}}]);