1"use strict";(globalThis.webpackChunktidb_cloud_ui=globalThis.webpackChunktidb_cloud_ui||[]).push([["2261"],{230237:function(e,a,i){i.d(a,{kH:()=>r,z8:()=>t});var n=i(322634);let t=2e3;function r(){let e=(0,n.useHistory)();return()=>e.goBack()}},967001:function(e,a,i){i.r(a),i.d(a,{default:()=>n});let n=i(992974).H},988007:function(e,a,i){i.d(a,{Ar:()=>b,JF:()=>g,Vj:()=>v,ax:()=>f,bC:()=>x});var n=i(672170),t=i(882822),r=i(275271),l=i(737613),o=i(844172),s=i(356186),c=i(701079),d=i(622063),u=i(294859),m=i(566249),p=i(70181),h=i(701234);let x=l.Ry({provider:l.Z_().nonempty({message:"Please select a cloud provider."}),region:l.Z_().nonempty({message:"Please select a region."}),name:l.Z_({required_error:h.xx.required}).regex(h.xx.pattern.value,h.xx.pattern.message)}),g=()=>{let{store:{tenantData:{id:e},activeProjectId:a}}=(0,m.Z)(),[i,t]=(0,r.useState)(""),{mutateAsync:l,isLoading:o,isSuccess:c}=(0,s.dPU)(),d=(0,n.Z)(async()=>{if(e&&a)try{let{name:i=""}=await l({orgId:e,projectId:a});t(i)}catch{t("")}});return(0,r.useEffect)(()=>{d()},[d]),{name:i,isLoading:o,isSuccess:c}},v=(e,a)=>{let{store:{tenantData:{id:i}}}=(0,m.Z)(),{data:n,isLoading:t,isSuccess:l}=(0,c.YV)({orgId:i,servicePlan:a},{query:{refetchOnWindowFocus:!1,enabled:!!i,select:e=>null==e?void 0:e.regions}}),o=(0,r.useMemo)(()=>Array.from(new Set(null==n?void 0:n.map(e=>e.cloudProvider||""))),[n]),s=(0,r.useMemo)(()=>(null==n?void 0:n.filter(a=>a.cloudProvider===e&&!!(a.name&&a.displayName)))||[],[n,e]);return{providers:o.filter(Boolean),regions:s,isLoading:t,isSuccess:l}};function f(){let{store:{lastVisitLocation:{orgId:e,projectId:a}}}=(0,m.Z)(),i=(0,c.Eq)(),r=(0,n.Z)(async n=>{if(!e||!a||!n.provider||!n.region||!n.name)return{clusterId:"",isError:!0,errorMsg:""};let r={clusterId:"",isError:!1,errorMsg:""},l={region:{cloudProvider:n.provider,name:n.region},displayName:n.name,encryptionConfig:{enhancedEncryptionEnabled:n.encrypted},highAvailabilityType:n.highAvailabilityType,autoScaling:n.autoScaling,servicePlan:n.servicePlan,spendingLimit:(0,t.Z)(n.spendLimit)?{monthly:(0,p.nP)(n.spendLimit)}:void 0};try{var s;let n=await i.mutateAsync({params:{orgId:e,projectId:a},data:l});r.clusterId=null!==(s=null==n?void 0:n.clusterId)&&void 0!==s?s:""}catch(e){r.isError=!0,r.errorMsg=(0,u.e$)(e),o.c.error("Create Serverless Cluster Error",e)}return r});return{mutation:i,createCluster:r,isComputing:!1,isCreating:i.isLoading}}let b={[d.E.Starter]:"Starter",[d.E.Essential]:"Essential"}},195722:function(e,a,i){i.d(a,{Cr:()=>u,aV:()=>c,hV:()=>d,y:()=>m,z8:()=>s});var n=i(158483),t=i(146969),r=i(386028),l=i(566249),o=i(988007);let s=2e3,c=1e5,d=100,u=(e,a)=>{let{name:i,isLoading:n,isSuccess:t}=(0,o.JF)(),{providers:r,regions:l,isLoading:s,isSuccess:c}=(0,o.Vj)(e,a);return{name:i,regions:l,providers:r,isLoading:n||s,isSuccess:t&&c}};function m(){var e;let{store:{tenantData:{id:a},isThirdParty:i}}=(0,l.Z)(),{data:o,refetch:s}=(0,r.yx)(a),c=null==o?void 0:null===(e=o.effective_plan)||void 0===e?void 0:e.toUpperCase(),d=c===t.K.ON_DEMAND||c===t.K.POC&&Number.parseFloat((null==o?void 0:o.poc_credits)||"0")>0||i,[u,m]=(0,n.q)(!1,{onClose(){s()}});return{creditAddVisible:!d,creditModalVisible:u,creditModalHandlers:m}}},527321:function(e,a,i){i.d(a,{U:()=>l});var n=i(552676),t=i(128177),r=i(98172);let l=({labelProps:e={},valueProps:a={},label:i,children:l,...o})=>(0,n.jsxs)(t.Z,{wrap:"nowrap",align:"flex-start",...o,children:[(0,n.jsx)(r.Z,{variant:"label-lg",component:"div",w:80,sx:{flexShrink:0},...e,children:i}),(0,n.jsx)(r.Z,{variant:"body-lg",component:"div",sx:{wordBreak:"break-word"},...a,children:null!=l?l:""})]})},904184:function(e,a,i){i.d(a,{q:()=>o});var n=i(552676),t=i(775364),r=i(98172),l=i(18190);let o=()=>(0,n.jsxs)(t.x,{children:[(0,n.jsx)(r.Z,{variant:"title-md",children:"Capacity"}),(0,n.jsxs)(r.Z,{variant:"body-lg",mt:8,children:["Instance provisioned capacity is measured in Request Capacity Units (RCUs). TiDB Cloud automatically creates scaling rules based on the minimum and maximum capacity setting."," ",(0,n.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-billing/#pricing-for-tidb-cloud-essential",children:"Learn more"}),"."]}),(0,n.jsx)(l.d,{mt:24})]})},857977:function(e,a,i){i.d(a,{J:()=>m});var n=i(552676),t=i(775364),r=i(915030),l=i(619102),o=i(275271),s=i(469987),c=i(187692),d=i(904184),u=i(147643);let m=({cluster:e})=>{var a,i,m,p;let h=(0,s.cI)({mode:"onChange",defaultValues:{autoScaling:{minRcu:null===(a=e.autoScaling)||void 0===a?void 0:a.minRcu,maxRcu:null===(i=e.autoScaling)||void 0===i?void 0:i.maxRcu}}}),{setValue:x}=h;return(0,o.useEffect)(()=>{var a,i;e.computed.loading||(null===(a=e.autoScaling)||void 0===a?void 0:a.minRcu)===void 0||(null===(i=e.autoScaling)||void 0===i?void 0:i.maxRcu)===void 0||(x("autoScaling.minRcu",e.autoScaling.minRcu),x("autoScaling.maxRcu",e.autoScaling.maxRcu))},[e.computed.loading,null===(m=e.autoScaling)||void 0===m?void 0:m.minRcu,null===(p=e.autoScaling)||void 0===p?void 0:p.maxRcu,x]),(0,n.jsx)(s.RV,{...h,children:(0,n.jsx)(t.x,{h:"100vh",sx:{maxWidth:1248,margin:"0 auto"},children:(0,n.jsx)(c.M,{title:"Update capacity",headerProps:{withBack:!0},children:(0,n.jsxs)(r.k,{gap:16,children:[(0,n.jsx)(l.Z,{shadow:"none",p:"xl",sx:{alignSelf:"baseline"},children:(0,n.jsx)(t.x,{component:"form",sx:{position:"relative"},children:(0,n.jsx)(d.q,{})})}),(0,n.jsx)(t.x,{children:(0,n.jsx)(u.c_,{cluster:e})})]})})})})}},992974:function(e,a,i){i.d(a,{H:()=>c});var n=i(552676),t=i(275271),r=i(932643),l=i(765803),o=i(15086),s=i(857977);let c=({cluster:e})=>((0,t.useEffect)(()=>{document.title=`${r.ZP.PAGE_TITLE_PREFIX}Update Capacity`},[]),(0,n.jsx)(l.H,{id:"TidbxCapacityUpdate",scopeProps:{tidbId:e.id},fallback:e=>(0,n.jsx)(o.R,{title:"Update capacity",headerProps:{withBack:!0,p:0},bodyProps:{p:0},children:e}),children:(0,n.jsx)(s.J,{cluster:e})}))},147643:function(e,a,i){i.d(a,{__:()=>U,c_:()=>Z});var n=i(552676),t=i(740521),r=i(680424),l=i(98172),o=i(125385),s=i(619102),c=i(150288),d=i(915030),u=i(366130),m=i(826444),p=i(672170),h=i(582473),x=i(469987),g=i(322634),v=i(527321),f=i(671948),b=i(988007),y=i(838423),j=i(701079),C=i(294859),R=i(566249),w=i(230237);let S=({label:e,value:a="",isError:i,errors:t,labelProps:r={}})=>(0,n.jsx)(v.U,{label:e,labelProps:{w:112,...r},valueProps:{color:i?"red":"carbon.8"},children:i?null!=t?t:`Invalid ${e}`:a}),U=({cloudProvider:e,regionName:a,minRcu:i,maxRcu:o,wrapperProps:s})=>{var c,d;let[u]=(0,m.c)(i,500),[p]=(0,m.c)(o,500),h=Math.max(u||w.z8,w.z8),x=Math.max(p||w.z8,w.z8),{data:g}=(0,y.ql9)({cloud_provider:e,region:a,rcu:h},{query:{enabled:!!(e&&a),select:e=>({monthly:Number((null==e?void 0:e.rcu_cost_monthly)||0)}),keepPreviousData:!0,refetchOnWindowFocus:!1}}),{data:v}=(0,y.ql9)({cloud_provider:e,region:a,rcu:x},{query:{enabled:!!(e&&a),select:e=>({monthly:Number((null==e?void 0:e.rcu_cost_monthly)||0)}),keepPreviousData:!0,refetchOnWindowFocus:!1}});return(0,n.jsxs)(t.K,{gap:4,py:"xl",...s,children:[(0,n.jsx)(r.z,{value:null!==(c=null==g?void 0:g.monthly)&&void 0!==c?c:0,format:{maximumFractionDigits:5,minimumFractionDigits:2},prefix:"From $",suffix:"/month",c:"carbon.9",fw:700,fz:20,sx:{"&::part(suffix)":{color:"var(--mantine-color-carbon-8)",fontWeight:400,fontSize:14,marginLeft:4}}}),(0,n.jsxs)(l.Z,{variant:"body-md",c:"carbon.8",inline:!0,children:["Pay only for your actual usage. Monthly fees are limited by your maximum RCU setting, up to a maximum cost of"," ",(0,n.jsxs)(l.Z,{variant:"title-md",component:"span",children:["$",(null!==(d=null==v?void 0:v.monthly)&&void 0!==d?d:0).toFixed(2)]})," ","per month. Learn more"," ",(0,n.jsx)("a",{target:"_blank",rel:"noreferrer",href:"https://www.pingcap.com/tidb-cloud-essential-pricing-details/",children:"TiDB Cloud Essential pricing"})]})]})},Z=(0,h.Pi)(({cluster:e})=>{var a,i,r;let{store:{lastVisitLocation:{orgId:m,projectId:h}}}=(0,R.Z)(),v=(0,w.kH)(),y=(0,g.useHistory)(),{handleSubmit:Z,watch:P,formState:{errors:_}}=(0,x.Gc)(),k=P("autoScaling.minRcu"),z=P("autoScaling.maxRcu"),V=Number(null===(a=e.autoScaling)||void 0===a?void 0:a.maxRcu),E=Number(z),q=Number.isFinite(V)&&Number.isFinite(E)&&E!==V,I=(0,j.o4)({mutation:{onSuccess:()=>{e.id&&(o.r.success("Capacity updated successfully!"),setTimeout(()=>{y.push(`/clusters/${e.id}/overview`,{from:"edit-capacity"})},1200))},onError:e=>{let a=(0,C.e$)(e);o.r.error((0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:a}}))}}}),T=Z((0,p.Z)(async a=>{if(!m||!(null==e?void 0:e.id)){o.r.error((0,n.jsx)("div",{dangerouslySetInnerHTML:{__html:"Failed to update Capacity"}}));return}return await I.mutateAsync({clusterId:e.id,data:{cluster:{autoScaling:{minRcu:a.autoScaling.minRcu,maxRcu:a.autoScaling.maxRcu}},updateMask:"autoScaling"},params:{orgId:m,projectId:h}})}));return(0,n.jsxs)(s.Z,{shadow:"none",p:"xl",miw:400,children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(l.Z,{variant:"title-lg",children:"Summary"}),(0,n.jsx)(l.Z,{variant:"body-lg",c:"carbon.7",mt:4,children:"Your new instance will be"})]}
1),(0,n.jsxs)(t.K,{justify:"flex-start",gap:8,my:"xl",children:[(0,n.jsx)(S,{label:"Plan",value:b.Ar[e.servicePlan||""]}),(0,n.jsx)(S,{label:"Provider",value:f.YV[e.provider]}),(0,n.jsx)(S,{label:"Region",value:e.regionDisplayName}),(0,n.jsx)(S,{label:"Name",value:null==e?void 0:e.displayName})]}),(0,n.jsx)(c.i,{}),(0,n.jsx)(U,{cloudProvider:e.provider,regionName:e.region,minRcu:k,maxRcu:z}),(0,n.jsxs)(d.k,{align:"center",gap:"md",children:[(0,n.jsx)(u.z,{variant:"default",onClick:v,"data-mp-event":"Cancel Update Capacity Button Clicked",children:"Cancel"}),(0,n.jsx)(u.z,{disabled:!!(null===(i=_.autoScaling)||void 0===i?void 0:i.maxRcu)||!!(null===(r=_.autoScaling)||void 0===r?void 0:r.minRcu)||!q,loading:I.isLoading,onClick:T,sx:{flexGrow:1},"data-mp-event":" Update Capacity Button Clicked","data-mp-ev-alias":" Update Capacity Button Clicked",children:"Update Capacity"})]})]})})},738770:function(e,a,i){i.d(a,{x:()=>l});var n=i(552676),t=i(65954),r=i(98172);let l=({children:e,label:a,description:i,defaultExpanded:l=!0})=>(0,n.jsx)(t.U,{defaultValue:l?"1":"0",styles:()=>({control:{padding:24,"&:hover":{background:"none"}},label:{paddingTop:0,paddingBottom:0},item:{borderBottom:"none"},content:{padding:24,paddingTop:0}}),children:(0,n.jsxs)(t.U.Item,{value:"1",children:[(0,n.jsxs)(t.U.Control,{"data-mp-no-event":!0,children:[(0,n.jsx)(r.Z,{variant:"title-lg",children:a}),i&&(0,n.jsx)(r.Z,{variant:"body-lg",component:"div",c:"carbon.7",mt:4,children:i})]}),(0,n.jsx)(t.U.Panel,{children:e})]},"1")})},18190:function(e,a,i){i.d(a,{I:()=>v,d:()=>g});var n=i(552676),t=i(740521),r=i(98172),l=i(128177),o=i(105881),s=i(915030),c=i(150288),d=i(775364),u=i(866981),m=i(365582),p=i(469987),h=i(738770),x=i(195722);let g=({...e})=>{let{watch:a,trigger:i}=(0,p.Gc)(),h=a("autoScaling.minRcu");return(0,n.jsxs)(t.K,{gap:8,...e,children:[(0,n.jsx)(r.Z,{variant:"label-md",children:"Autoscaling"}),(0,n.jsxs)(l.Z,{align:"flex-start",gap:24,children:[(0,n.jsx)(u.$,{name:"autoScaling.minRcu",leftAddon:(0,n.jsxs)(l.Z,{gap:4,wrap:"nowrap",component:"span",children:["min",(0,n.jsxs)(o.z,{shadow:"md",withArrow:!0,width:400,children:[(0,n.jsx)(o.z.Target,{children:(0,n.jsx)(m.Us8,{sx:{cursor:"pointer"}})}),(0,n.jsx)(o.z.Dropdown,{children:(0,n.jsxs)(r.Z,{variant:"body-lg",children:["Keep the value at the minimum (",x.z8,") if cost is a concern and traffic is bursty. Increase it if you require more consistent performance, smoother autoscaling, or better readiness for sudden surges."]})})]})]}),sx:{flex:1},suffix:" RCUs",min:x.z8,max:x.aV,step:x.hV,rules:{required:"Required",min:{value:x.z8,message:`RCUs should be greater than ${x.z8}`},max:{value:x.aV,message:`RCUs should be less than ${x.aV}`},validate:e=>e%x.hV==0||`RCUs should be in increments of ${x.hV}`},onChange:()=>{i("autoScaling")}}),(0,n.jsx)(s.k,{h:40,align:"center",children:(0,n.jsx)(c.i,{w:16,color:"carbon.5"})}),(0,n.jsx)(u.$,{name:"autoScaling.maxRcu",leftAddon:(0,n.jsxs)(l.Z,{gap:4,wrap:"nowrap",component:"span",children:["max",(0,n.jsxs)(o.z,{shadow:"md",withArrow:!0,width:400,children:[(0,n.jsx)(o.z.Target,{children:(0,n.jsx)(m.Us8,{sx:{cursor:"pointer"}})}),(0,n.jsx)(o.z.Dropdown,{children:(0,n.jsx)(r.Z,{variant:"body-lg",children:"TiDB Cloud offers a small buffer above the maximum RCU to accommodate short bursts in demand and lower the chance of throttling. Continuous demand that exceeds the maximum, though, may still lead to throttling."})})]})]}),sx:{flex:1},suffix:" RCUs",min:x.z8,max:x.aV,step:x.hV,rules:{required:"Required",min:{value:x.z8,message:`RCUs should be greater than ${x.z8}`},max:{value:x.aV,message:`RCUs should be less than ${x.aV}`},validate:e=>e%x.hV!=0?`RCUs should be in increments of ${x.hV}`:!e||!h||!(e<h)||"Max RCUs should be greater or equal to min RCUs"},onChange:()=>{i("autoScaling")}})]}),(0,n.jsxs)(r.Z,{variant:"body-md",c:"carbon.7",children:[(0,n.jsxs)(d.x,{component:"span",fw:500,children:["Minimum Billing RCUs = ",h&&h>x.z8?h:x.z8,"."]})," ","If your actual usage is below this limit, you will be billed for this amount. RCUs start from 2,000 and can be increased up to 100,000 in increments of 100."]})]})},v=()=>(0,n.jsx)(h.x,{label:"Capacity",description:(0,n.jsxs)(r.Z,{variant:"body-md",c:"carbon.7",children:["Cluster provisioned capacity is measured in Request Capacity Units (RCUs). TiDB Cloud automatically creates scaling rules based on the minimum and maximum capacity setting."," ",(0,n.jsx)("a",{href:"https://www.pingcap.com/tidb-cloud-essential-pricing-details/",target:"_blank",rel:"noreferrer",children:"Learn more"}),"."]}),children:(0,n.jsx)(g,{})})}}]);
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.