PageSourceSearch

https://portal.servers.com/assets/section_cloud-computing_block-st…create_views_CreateBlockStorage-bEobUzZn.js

js servers.com collected 2026-09-25 20:08:27 UTC 10,171 bytes, 3 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-DBDdmZqK.js","assets/index-CuvIegpc.js","assets/react-vendor-QB-SHznt.js","assets/index-BWcUzr5c.css","assets/shared_packages-BXKKObPK.js","assets/shared_packages-gbR9ZUfs.js","assets/graphql-vendor-B33ouNNi.js","assets/index-Cy_JeFHc.css","assets/shared_packages_portal-shared_src_contexts-BZxAX688.js","assets/useStateService-cstAWhFK.css","assets/app-D1MkCl4f.css"])))=>i.map(i=>d[i]);
2var $=Object.defineProperty,X=Object.defineProperties;var J=Object.getOwnPropertyDescriptors;var W=Object.getOwnPropertySymbols;var H=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var k=(e,t,s)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,C=(e,t)=>{for(var s in t||(t={}))H.call(t,s)&&k(e,s,t[s]);if(W)for(var s of W(t))q.call(t,s)&&k(e,s,t[s]);return e},B=(e,t)=>X(e,J(t));var L=(e,t,s)=>new Promise((f,S)=>{var n=m=>{try{c(s.next(m))}catch(p){S(p)}},d=m=>{try{c(s.throw(m))}catch(p){S(p)}},c=m=>m.done?f(m.value):Promise.resolve(m.value).then(n,d);c((s=s.apply(e,t)).next())});import{_ as ee}from"./index-CuvIegpc.js";import{b as u,j as a,R as U}from"./react-vendor-QB-SHznt.js";import{cp as Q,b$ as te,ej as se,dM as F,ac as ae,c0 as ie,al as oe,ed as ne,d2 as re,ae as l,af as ce,cR as le,cS as ue,d6 as K,aL as de,c4 as me,a4 as pe,bG as he,ar as fe,bL as Y,ek as ge,bu as P,el as Se,em as be,dh as Ie}from"./shared_packages-BXKKObPK.js";import{aQ as o,u as Ee,aR as _e,aS as Ce,n as ze,G as Te}from"./app-DBDdmZqK.js";import{P as Ae}from"./shared_components_ProductConfigurator-Cm0pveU2.js";import{m as Ne,ag as ve,s as R,M as D}from"./shared_packages-gbR9ZUfs.js";import{N as Re}
2from"./shared_packages_portal-shared_src_components_Redesign_Tabs-DDjVZzWB.js";import{g as Z,S as xe}from"./shared_sections_cloud-computing_block-storage-Cs-caKDa.js";import{F as je}from"./shared_packages_portal-shared_src_components_Redesign_Editor_components-lWC1-pAZ.js";import{T as Me}from"./shared_packages_portal-shared_src_components_Redesign_ConfigSummary-DFzBo3rP.js";import{V as ye}from"./shared_packages_portal-shared_src-CgXbIckR.js";import{R as Oe}from"./shared_packages_types-graphql_build_generated_enums-Ct3jWr5G.js";import"./graphql-vendor-B33ouNNi.js";import"./shared_packages_portal-shared_src_contexts-BZxAX688.js";(function(){try{var e=typeof window!="undefined"?window:typeof global!="undefined"?global:typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:{};e.SENTRY_RELEASE={id:"nightly-2026.09.24"};var t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="0e484c96-b007-4043-bfe1-f8af493e517e",e._sentryDebugIdIdentifier="sentry-dbid-0e484c96-b007-4043-bfe1-f8af493e517e")}catch(s){}})();globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Ve=R("div")({name:"TabsBlock",class:"t1mlazss",propsAsIs:!1}),we=()=>ae,Be=R(we())({name:"CustomInput",class:"c1umvsbn",propsAsIs:!0}),Le=R("div")({name:"CustomSizeBlock",class:"c1u0mhzv",propsAsIs:!1}),v={NEW:"NEW",BACKUP:"BACKUP"},Pe=[30,50,100,200],De=({backups:e,cloudComputingRegion:t,formHook:s,maxSize:f})=>{const{formState:{errors:S},setValue:n}=s,d=Q({control:s.control,name:"size"}),[c,m]=u.useState(d===-1),p=Ne(),g=te(S,"customSize"),[_,I]=u.useState(v.NEW),E=_===v.NEW,x=u.useMemo(()=>a.jsxs(Le,{children:[p.formatMessage(o.CUSTOM_SIZE),c&&a.jsxs(a.Fragment,{children:[a.jsx(Be,{formHook:s,inline:!0,innerField:!0,name:"customSize",type:"text"}),p.formatMessage(se.GIGABYTES)]})]}),[s,p,d,g]),T=u.useMemo(()=>[...Pe.filter(i=>i<=f).map(i=>({label:`${i} GB`,value:i,prices:Z(i,t,E)}
2)),{label:x,value:-1}],[x,f,t,E]),V=u.useMemo(()=>(e==null?void 0:e.data.filter(i=>i.status===xe.AVAILABLE).map(i=>({label:a.jsxs(a.Fragment,{children:[i.name," (",a.jsx(ve,{day:"2-digit",hour:"numeric",minute:"numeric",month:"short",second:"numeric",value:i.created_at,year:"numeric"}),")"]}),value:i.id,prices:Z(i.size,t,E)})))||[],[e==null?void 0:e.data,t,E]),j=U.useMemo(()=>{const i=[{id:v.NEW,label:o.NEW}];return e&&e.data.length>0&&i.push({id:v.BACKUP,label:o.FROM_BACKUP}),i},[e]),b=u.useCallback(i=>{I(i);const z=i===v.NEW;n("isNewVolume",z),n("backupId","")},[n]),M=u.useMemo(()=>a.jsx(Ve,{children:a.jsx(Re,{activeTab:_,onChange:b,tabs:j,underlined:!1})}),[_,b,j]),w=u.useCallback(i=>{i===-1&&n("customSize",0),m(i===-1)},[n]),A=E?o.VOLUME_SIZE:o.CHOOSE_BACKUP;return E?a.jsx(F,{formHook:s,label:A,name:"size",notice:d===-1?o.NOTICE:null,onChange:w,options:T,tabsBlock:M},"size"):a.jsx(F,{formHook:s,label:A,name:"backupId",options:V,tabsBlock:M},"backupId")};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Ue=({cancelState:e,disabled:t})=>{const s=Ee(e);return a.jsxs(a.Fragment,{children:[a.jsx(ie,C({title:oe.CANCEL,transparent:!0,type:"button"},s)),a.jsx(je,{disabled:t,title:o.CREATE_VOLUME})]})};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const Fe=R("div")({name:"Notice",class:"n13mza82",propsAsIs:!1}),Ze=R("p")({name:"VatDisclaimerWrapper",class:"v121e17n",propsAsIs:!1}),Ge=({backups:e,formHook:t,region:s})=>{const f=ne(),[S,n,d,c]=Q({control:t.control,name:["backupId","customSize","isNewVolume","size"]});if(d&&!c&&!n)return null;const p=Z((()=>{var g;if(d){if(typeof c!="number")throw new Error("Invalid size provided. Please provide a valid number.");if(c===-1){if(typeof n=="number"||typeof n=="string")return Number(n);throw new Error("Invalid custom size provided. Please provide a valid number or string.")}return c}return e&&((g=e.data.find(_=>_.id===S))==null?void 0:g.size)||0})(),s,d);return p?a.jsxs(a.Fragment,{children:[a.jsxs(Me,{children:[a.jsx(D,C({},o.TOTAL_PRICE)),":"," ",a.jsx(re,{inline:!0,per:"month",children:p})]}),a.jsxs(Fe,{children:[a.jsx(ye,{renderWrapper:g=>a.jsx(Ze,{children:g})}),f&&a.jsx("p",{children:a.jsx(D,C({},o.MONTHLY_PRICE_VAT))}),a.jsx(D,C({},o.NO_PREPAYMENTS_NOTICE))]})]}):null};globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const We=l.object({regionId:l.number().nullable().optional(),attachServerId:l.string().nullable().optional(),resource_group_id:l.string().optional(),name:ce(l.string().min(1).max(225),"cloud_computing_name"),isNewVolume:l.boolean(),size:l.number().nullable().optional(),maxSize:l.number().nullable().optional(),backupId:l.string().optional(),iam_enabled:l.boolean().optional(),customSize:l.string().transform((e,t)=>{if(!e)return 0;const s=parseInt(e,10);return Number.isNaN(s)?(t.addIssue({code:l.ZodIssueCode.invalid_type,message:o.TYPE_NUMBER.id,path:[],expected:"number",received:"nan"}),0):s}).optional()}).refine(e=>!(e.iam_enabled===!0&&!e.resource_group_id),B(C({},le(ue.required)),{path:["resource_group_id"]})).superRefine((e,t)=>{!e.isNewVolume&&!e.backupId&&t.addIssue(K(["backupId"],"string",o.SIZE_REQUIRED))}).superRefine((e,t)=>{if(e.isNewVolume&&e.size===-1){const s=e.customSize;s==null?t.addIssue(K(["customSize"],"number",o.SIZE_REQUIRED)):s<1?t.addIssue({code:l.ZodIssueCode.custom,params:{message:o.MIN_SIZE_ERROR,min:1},path:["customSize"]}):e.maxSize&&s>e.maxSize&&t.addIssue({code:l.ZodIssueCode.custom,params:{max:e.maxSize,message:o.MAX_SIZE_ERROR},path:["customSize"]})}});globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(e,t){return this.cache.has(e)?this.cache.get(e):(this.cache.set(e,t),t)}};const ke="cynu6cz",Ke=()=>ee(()=>import("./app-DBDdmZqK.js").then(e=>e.jr),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])),lt=({$region_id:e,backups:t,baseState:s,cloudComputingRegion:f,cloudComputingRegionsList:S,quotas:n,servers:d})=>{var G;
2const c=de(),m=me(),p=pe("account","iamEnabled"),[g,_]=U.useState(!1),I=(G=f==null?void 0:f.data)!=null?G:null,[E,x]=u.useState(!1),T=n!=null&&n.data&&n.data.gigabytes?n.data.gigabytes.limit-n.data.gigabytes.in_use:0,V=u.useMemo(()=>_e(S.data),[S.data]),j=u.useMemo(()=>{const r=d?d.data.filter(h=>h.status&&h.status.toLocaleUpperCase()==="ACTIVE"&&!he(h.id)).filter(Ce("id")).map(h=>({label:h.name,value:h.id.toString()})):[];return r.length>0&&r.unshift({label:o.DO_NOT_ATTACH,value:""}),r},[d]),b=U.useMemo(()=>({iam_enabled:p,regionId:e,attachServerId:"",isNewVolume:!0,backupId:"",name:"",size:30,customSize:"0",maxSize:T}),[p,T,e]),M=u.useCallback(r=>L(null,null,function*(){const{getValues:h,setValue:N}=r,y=h(),{regionId:O}=y;if(O===null)return;!fe(Y(b,["regionId"]),Y(y,["regionId"]))&&O!==b.regionId&&!(yield m({notice:ge.CHANGE_CONFIRM}))?N("regionId",b.regionId):O!==b.regionId&&(_(!0),yield c.go(".",{region_id:O}))}),[m,b,c]),w=u.useCallback(r=>{const{getValues:h,setValue:N}=r,{size:y}=h();y===-1&&N("customSize","0")},[]),A=ze(),i=u.useCallback(r=>L(null,null,function*(){x(!0);const h=B(C({},r),{attachServerId:r.attachServerId===""?null:r.attachServerId,size:r.size===-1?r.customSize:r.size}),N=(yield Ke()).default;yield A.set("redirect_state",null),yield c.go(N.name,{config:h},{reload:!0})}),[A,c]),z=!P(I)&&!g;return new Ae("blockstorage-configuration").configurator(r=>r.sideEffect(["regionId"],M,!1).sideEffect(["size"],w,!1).field("regionId",{component:Se,label:o.REGION_LABEL,notice:o.REGION_NOTICE,props:{locations:V}},{visible:!g}).customBlock("spinner",{component:Te},{visible:g}).customBlock("customSize",{component:De,props:{maxSize:T,backups:t,cloudComputingRegion:I}},{visible:z}).field("attachServerId",{component:F,label:o.SERVERS,props:{options:j,noOptionsNotice:o.NO_SERVERS,className:ke}},{visible:z}).field("resource_group_id",{component:be,props:{permission:[Oe.CloudServerVolumesManagement]}},{visible:z}).field("name",{component:Ie},{visible:z}),{data:b,schema:We,summary:I&&!P(I)?r=>a.jsx(Ge,{backups:t,formHook:r,region:I}):null,actions:P(I)?null:a.jsx(Ue,{cancelState:s,disabled:E}),onSubmit:i})};export{lt as default};
3//# sourceMappingURL=section_cloud-computing_block-storage_create_views_CreateBlockStorage-bEobUzZn.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.