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