1"use strict";(globalThis.webpackChunktidb_cloud_ui=globalThis.webpackChunktidb_cloud_ui||[]).push([["4762"],{681287:function(e,t,i){i.d(t,{Z:()=>a});var r=i(552676);i(275271);let a=e=>(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",viewBox:"0 0 20 20",...e,children:(0,r.jsx)("path",{fill:"#90B3D5",d:"M8.697 16.91a.5.5 0 0 0 .71-.704l-.355.352zm-1.989-4.243.5-.03zm-.432 1.991-.492-.089zm-.444.925-.284.412a.5.5 0 0 0 .594-.02zM4.317 12.21l.5.016zm.388-2.507.486.116.044-.184-.089-.167zM2.54 3.883l-.439.24zm.493-1.307.015-.5zm2.53 1.399-.333.374.25.222.302-.147zm3.596.365-.271.42zm3.49 4.234.46-.196zm.832 2.02-.467.178.115.303.324.018zm2.29.64.249-.434zm2.061 2.453.5.015zm-2.62.261-.015.5zm2.321 4.223a.5.5 0 1 0 .598-.801l-.299.4zM7.266 6.618a.5.5 0 1 0-.273.962l.137-.481zM7.138 7.8a.5.5 0 1 0 1 0h-1m1.914 8.758.355-.352c-.302-.303-.853-1.05-1.343-1.835-.242-.387-.46-.77-.618-1.094-.17-.35-.234-.562-.239-.64l-.499.03-.499.029c.017.299.172.675.338 1.018.179.367.416.781.669 1.187.5.8 1.098 1.624 1.48 2.01zm-2.344-3.891.5-.03a2 2 0 0 0-.018-.182c-.005-.034-.02-.137-.073-.235a.512.512 0 0 0-.813-.12.6.6 0 0 0-.144.237c-.053.151-.103.428-.145.686-.096.59-.18 1.263-.231 1.546l.492.09.492.088c.048-.268.153-1.061.234-1.563a10 10 0 0 1 .087-.464l.014-.049-.002.006-.01.02c-.004.009-.029.059-.081.111a.49.49 0 0 1-.77-.108c-.041-.074-.044-.133-.04-.098q.004.018.01.094zm-.432 1.991-.492-.089c-.031.17-.087.325-.148.444-.066.131-.117.18-.115.178l.31.392.31.392c.16-.126.29-.319.387-.509.103-.202.191-.449.24-.719zm-.444.925.283-.412c-.554-.382-1.342-1.5-1.299-2.945l-.5-.016-.5-.015c-.054 1.795.905 3.23 1.732 3.8zM4.317 12.21l.5.016c.039-1.302.193-1.647.374-2.407l-.486-.116-.486-.116c-.174.73-.359 1.184-.402 2.608zm.388-2.507.441-.235c-.138-.26-.47-.955-.785-1.696-.324-.759-.596-1.487-.654-1.845l-.494.08-.493.08c.081.5.407 1.342.72 2.078.323.754.667 1.478.824 1.773zM3.213 6.007l.494-.08c-.144-.883-.26-1.426-.728-2.284l-.44.24-.438.24c.391.716.483 1.133.619 1.965zM2.54 3.883l.439-.24a2.4 2.4 0 0 1-.17-.37.6.6 0 0 1-.042-.213c0-.002-.01.033-.036.049-.002 0 .014-.01.061-.02.048-.009.121-.016.226-.013l.015-.5.015-.5c-.314-.01-.613.036-.854.189a.91.91 0 0 0-.42.684c-.027.235.027.464.089.647.064.189.153.372.238.527zm.493-1.307-.015.5c.147.004.356.063.614.184.25.118.512.276.754.44a10 10 0 0 1 .844.649l.332-.374.332-.374-.002-.002-.004-.004-.07-.06-.2-.164a11 11 0 0 0-.67-.498 6.6 6.6 0 0 0-.892-.519c-.308-.144-.662-.267-1.008-.278zm2.53 1.399.219.45c.454-.223 1.787-.516 3.106.335l.27-.42.272-.42c-1.675-1.082-3.391-.734-4.087-.394zm3.596.365-.271.42c1.77 1.143 2.596 2.353 3.301 4.01l.46-.196.46-.196c-.765-1.8-1.707-3.184-3.679-4.458zm3.49 4.234-.46.195a93 93 0 0 1 .814 1.975l.008.022.002.005.468-.177.467-.179-.001-.002-.002-.006-.01-.024a19 19 0 0 0-.186-.468 93 93 0 0 0-.64-1.537zm.832 2.02-.028.499h.009l.036.003.146.014c.126.015.306.04.514.08.424.085.937.231 1.363.476l.25-.433.249-.433c-.561-.323-1.193-.496-1.668-.59a7 7 0 0 0-.841-.116h-.002zm2.29.64-.25.432c.312.18.793.583 1.195 1.033.199.222.364.44.476.63.122.207.141.318.14.343l.5.015.5.015c.01-.316-.13-.629-.277-.879a5 5 0 0 0-.594-.791c-.447-.5-1.008-.983-1.441-1.232zm2.061 2.453-.5-.015c0 .017-.002-.002.018-.026.015-.017.016-.007-.03.009-.11.036-.306.05-.587.025a9 9 0 0 1-.822-.125c-.234-.044-.514-.101-.684-.106l-.015.5-.015.5c.068.001.23.033.528.09.266.05.598.11.922.137.31.027.678.031.989-.073.163-.054.338-.147.475-.308a.94.94 0 0 0 .221-.593zm-2.62.261.015-.5a1.1 1.1 0 0 0-.964.501c-.238.379-.193.843.095 1.254l.41-.287.409-.287c-.059-.084-.066-.132-.067-.143v-.007.002l-.001.001s.007-.01.026-.02a.13.13 0 0 1 .062-.014zm-.444.968-.41.287c.233.332.785.891 1.37 1.435a24 24 0 0 0 1.805 1.533l.3-.4.298-.401a23 23 0 0 1-1.722-1.464c-.595-.554-1.069-1.045-1.232-1.277zM7.13 7.099l-.137.48a.2.2 0 0 1 .093.075c.035.046.052.099.052.146h1c0-.559-.389-1.045-.872-1.182z"})})},906674:function(e,t,i){i.d(t,{Z:()=>a});var r=i(552676);i(275271);let a=e=>(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,fill:"none",viewBox:"0 0 20 20",...e,children:(0,r.jsx)("path",{stroke:"#9FA9AD",strokeLinecap:"round",d:"M6.73 11.367c-.388-.567-.703-1.13-.606-2.61.032-.502.012-1.05 0-1.378-.032-.854.095-1.285.437-1.998.379
1-.788 1.157-1.459 1.499-1.695.473-.434 1.837-1.151 3.509-.552m-3.51.552c-.683-.513-2.436-1.34-3.982-.552-1.932.985-2.247 2.563-2.05 3.627.197 1.065 1.183 6.506 2.287 6.506.883 0 1.979-1.267 2.416-1.9m4.839-8.233c2.09.749 3.436 2.01 3.475 3.627m-3.475-3.627c.985-.302 3.217-.725 4.258 0 1.301.907 2.05 1.025 1.301 3.627s-.946 3.388-1.3 3.861c-.285.379-.641.373-.784.557m-8.314.188q.13.19.304.362c.631.63 2.13 0 2.681.789.165.235.298.558.303.823.01.625-.358 1.264-.303 2.094.08 1.183-.078 2.445 2.13 2.681s1.892-3.588 2.01-4.376q.021-.148.028-.272c.033-.588-.097-.876.8-1.739.16-.153.277-.339.361-.55.46-1.151.033-3.052 0-4.418m0 0c-.723-.394-2.435-.85-2.687.348-.316 1.499.466 2.959.86 3.513s1.19 1.304 1.466 1.383.99.276 1.538.276c.579 0 1.66-.232 1.472.122-.565 1.065-1.348 1.337-2.649 1.337-1.04 0-1.065-.182-1.161-.272m-7.76-6.089c.494-.59 1.945-1.501 2.922-.302 1.223 1.498.375 3.363.282 3.71-.057.212-.584 1.308-.985 1.73-.237.25-.816.77-1.308 1.055-.691.4-1.144.8-.691.98 1.717.681 3.697-.967 3.675-1.21M8.06 8.307V8.26m5.643-.247v-.067"})})},630915:function(e,t,i){i.d(t,{F:()=>l});var r=i(158483),a=i(275271),n=i(381674),s=i(350447),o=i(131542),d=i(566249);let l=()=>{let{store:{lastVisitLocation:{orgId:e,projectId:t},config:{oneConsoleEnabled:i}}}=(0,d.Z)(),l=(0,n.useQueryClient)(),c=(0,a.useCallback)(()=>{if(i){let t=(0,o.yy)({orgId:e});return l.invalidateQueries(t,{refetchInactive:!0})}let r=(0,s.Hu)({orgId:e,projectId:t});return l.invalidateQueries(r,{refetchInactive:!0})},[i,e,t,l]),[u,p]=(0,r.q)(),[m,h]=(0,r.q)(),[v,j]=(0,r.q)();return{move:{opened:u,...p,onFinish:c},rename:{opened:m,...h,onFinish:c},deletion:{opened:v,...j,onFinish:c}}}},734175:function(e,t,i){i.d(t,{Z:()=>s});var r=i(356186),a=i(348980),n=i(566249);function s(){let{store:{lastVisitLocation:{orgId:e}}}=(0,n.Z)(),{data:t}=(0,r.pYk)(e,void 0,{query:{enabled:!!e,select:e=>{var t,i;return null!==(i=null==e?void 0:null===(t=e.exp_names)||void 0===t?void 0:t.includes(a.Fn.StarterPostgreSQLCompatibleEnabled))&&void 0!==i&&i},refetchOnWindowFocus:!1,refetchOnMount:!1}});return null!=t&&t}},690826:function(e,t,i){i.d(t,{B:()=>s});var r=i(356186),a=i(348980),n=i(566249);function s(){var e;let{store:{lastVisitLocation:{orgId:t}}}=(0,n.Z)(),i=(0,r.pYk)(t,void 0,{query:{select:e=>null==e?void 0:e.exp_names,refetchOnWindowFocus:!1,refetchOnMount:!1}});return{isPremiumEnabled:!0,isBYOCEnabled:(i.isError?[]:null!==(e=i.data)&&void 0!==e?e:[]).includes(a.Fn.BYOCEnable),isError:i.isError,isLoading:i.isLoading}}},316426:function(e,t,i){i.d(t,{h:()=>s});var r=i(356186),a=i(348980),n=i(566249);function s(){var e;let{store:{lastVisitLocation:{orgId:t}}}=(0,n.Z)(),i=(0,r.pYk)(t,void 0,{query:{select:e=>null==e?void 0:e.exp_names,refetchOnWindowFocus:!1,refetchOnMount:!1}}),s=i.isError?[]:null!==(e=i.data)&&void 0!==e?e:[];return{premiumReservedMode:s.includes(a.Fn.OnlyPremiumReservedEnable)?"only":s.includes(a.Fn.PremiumReservedEnable)?"optional":"hidden",isError:i.isError,isLoading:i.isLoading}}},427908:function(e,t,i){i.d(t,{A:()=>s,d:()=>o});var r=i(356186),a=i(348980),n=i(566249);function s(){let{store:{lastVisitLocation:{orgId:e}}}=(0,n.Z)(),{data:t}=(0,r.pYk)(e,void 0,{query:{enabled:!!e,select:e=>{var t,i;return null!==(i=null==e?void 0:null===(t=e.exp_names)||void 0===t?void 0:t.includes(a.Fn.Essentialv2))&&void 0!==i&&i},refetchOnWindowFocus:!1,refetchOnMount:!1}});return null!=t&&t}function o(){let{store:{lastVisitLocation:{orgId:e}}}=(0,n.Z)(),{data:t}=(0,r.pYk)(e,void 0,{query:{enabled:!!e,select:e=>{var t,i;return null!==(i=null==e?void 0:null===(t=e.exp_names)||void 0===t?void 0:t.includes(a.Fn.EssentialV2Changefeed))&&void 0!==i&&i},refetchOnWindowFocus:!1,refetchOnMount:!1}});return null!=t&&t}},561090:function(e,t,i){i.d(t,{R:()=>d});var r=i(381674),a=i(640757),n=i(131542),s=i(513382),o=i(566249);let d=()=>{let{store:e}=(0,o.Z)(),{lastVisitLocation:{orgId:t}}=e,i=(0,r.useQueryClient)(),d=()=>{let{projectId:r}=e.lastVisitLocation;return Promise.all([i.invalidateQueries((0,n.yy)({orgId:t}),{refetchInactive:!0}),i.invalidateQueries((0,s.U6z)({orgId:t,projectId:r}),{refetchInactive:!0})])}
1,{move:l,rename:c,resume:u,password:p,deletion:m}=(0,a.n)();return{move:{...l,onFinish:d},rename:{...c,onFinish:d},resume:{...u,onFinish:d},password:{...p,onFinish:d},deletion:{...m,onFinish:d}}}},525761:function(e,t,i){i.d(t,{o:()=>l});var r=i(125385),a=i(469987),n=i(381674),s=i(760998),o=i(513382),d=i(566249);function l(e,t){let{store:{lastVisitLocation:{orgId:i,projectId:l}}}=(0,d.Z)(),c=(0,a.cI)({mode:"onChange",reValidateMode:"onChange",defaultValues:{rootPwd:""}}),{handleSubmit:u}=c,p=(0,n.useQueryClient)(),m=(0,o.PuJ)({mutation:{onSuccess:(e,{data:{rootPassword:i}})=>{var r;null==t||null===(r=t.onSuccess)||void 0===r||r.call(t,i)},onError:e=>{let t=(0,s.o)(e);r.r.error(t)}}});return{formContext:c,onSubmit:u(async t=>{let{rootPwd:r}=t;return await m.mutateAsync({tidbId:e,data:{rootPassword:r},params:{orgId:i,projectId:l}}),await Promise.all([p.invalidateQueries((0,o.U6z)({orgId:i,projectId:l})),p.invalidateQueries((0,o.DeV)(e,{orgId:i,projectId:l}))])})}}},68524:function(e,t,i){i.d(t,{h:()=>r});let r={PwdSet:"tidb.cloud/has-set-password"}},778651:function(e,t,i){i.d(t,{S:()=>n,r:()=>a});var r=i(668913);let a=[{value:r.K.OrgOwner,label:r.p[r.K.OrgOwner]},{value:r.K.OrgMember,label:r.p[r.K.OrgMember]},{value:r.K.OrgBillAdmin,label:r.p[r.K.OrgBillAdmin]},{value:r.K.OrgBillViewer,label:r.p[r.K.OrgBillViewer]},{value:r.K.OrgAuditAdmin,label:r.p[r.K.OrgAuditAdmin]}],n=[{value:r.K.ProjectOwner,label:r.p[r.K.ProjectOwner]},{value:r.K.ProjectViewer,label:r.p[r.K.ProjectViewer]},{value:r.K.ProjectDev,label:r.p[r.K.ProjectDev]},{value:r.K.ProjectReadOnly,label:r.p[r.K.ProjectReadOnly]}]},634070:function(e,t,i){i.d(t,{t:()=>r});let r={SERVICE_PLAN_GROUP:"SERVICE_PLAN_GROUP",FLAT:"FLAT"}},236906:function(e,t,i){i.d(t,{Z:()=>r});let r={CREATING:"CREATING",DELETING:"DELETING",ACTIVE:"ACTIVE",RESTORING:"RESTORING",MAINTENANCE:"MAINTENANCE",DELETED:"DELETED",INACTIVE:"INACTIVE",UPGRADING:"UPGRADING",IMPORTING:"IMPORTING",MODIFYING:"MODIFYING",PAUSING:"PAUSING",PAUSED:"PAUSED",RESUMING:"RESUMING"}},865574:function(e,t,i){i.d(t,{U:()=>r});let r={aws:"aws",gcp:"gcp",azure:"azure",alicloud:"alicloud"}},68009:function(e,t,i){i.d(t,{R:()=>d});var r=i(552676),a=i(593001),n=i(402899),s=i(913251),o=i(365582);let d=({text:e,disabled:t,actionIconProps:i,iconProps:d,...l})=>{let c=(0,s.V)({timeout:1e3});return(0,r.jsx)(a.u,{label:c.copied?"Copied":"Copy",withArrow:!0,position:"right",children:(0,r.jsx)(n.A,{variant:"default",size:40,...i,disabled:null!=t?t:!e,onClick:()=>c.copy(e),...l,children:c.copied?(0,r.jsx)(o.NOm,{size:16,...d}):(0,r.jsx)(o.xty,{size:16,...d})})})}},760998:function(e,t,i){i.d(t,{o:()=>n});var r=i(552676),a=i(294859);let n=e=>{let t=(0,a.e$)(e,!0);return(0,r.jsx)("div",{dangerouslySetInnerHTML:{__html:t}})}},492713:function(e,t,i){i.d(t,{R:()=>a}),i(275271);var r=i(324178);let a=({id:e,scopeProps:t,children:i})=>{let a=(0,r.x)(e,t);return i({id:e,scopeProps:t,accessible:a})}},343959:function(e,t,i){i.d(t,{V:()=>l});var r=i(552676),a=i(128177),n=i(98172),s=i(681287),o=i(906674),d=i(820615);let l=({engineType:e})=>{if("MYSQL_COMPATIBLE"!==e&&"POSTGRESQL_COMPATIBLE"!==e)return(0,r.jsx)("span",{"data-testid":"compatibility-mode",children:"-"});let t="POSTGRESQL_COMPATIBLE"===e?o.Z:s.Z;return(0,r.jsxs)(a.Z,{gap:8,wrap:"nowrap","data-testid":"compatibility-mode","data-engine-type":e,children:[(0,r.jsx)(t,{width:20,height:20,"aria-hidden":!0}),(0,r.jsx)(n.Z,{sx:{whiteSpace:"nowrap"},variant:"body-md",children:(0,d.g)(e)})]})}},860109:function(e,t,i){i.d(t,{Y:()=>d,x:()=>l});var r=i(552676),a=i(712995),n=i(365582),s=i(275271),o=i(932643);let d="tidbs-new-dedicated-cluster-creation",l=({...e})=>{let[t,i]=(0,s.useState)(!0);return t?(0,r.jsxs)(a.b,{color:"peacock",icon:(0,r.jsx)(n.Us8,{size:14}),sx:{padding:"10px 12px"},withCloseButton:!0,mx:24,mb:16,onClose:()=>{var t;i(!1),null==e||null===(t=e.onClose)||void 0===t||t.call(e)},...e,children:["Creating Dedicated cluster typically takes about 30 minutes. If it takes much longer, please"," ",(0,r.jsx)("a",{href:o.vc.CREATE_TICKET_URL,target:"_blank",rel:"noreferrer","data-mp-event":"Cluster List Dedicated Cluster Creation Contact Us Link Clicked",children:"contact us"}),". Billing starts once the cluster is created. If you no longer need the cluster, you can delete it in time to stop charges."]}):null}},920501:function(e,t,i){i.d(t,{NQ:()=>v,sA:()=>j,zq:()=>x});var r=i(552676),a=i(775364),n=i(740521),s=i(98172),o=i(150288),d=i(366130),l=i(158483),c=i(81642),u=i(424448),p=i(325630),m=i(526255),h=i(566249);function v(e){return Array.of(m.Z.PAUSED,m.Z.PAUSING,m.Z.RESUMING,m.Z.CREATING).includes(e.state)}let j=({children:e,height:t="calc(100vh - 240px)"})=>(0,r.jsx)(a.x,{sx:{height:t,backgroundColor:"var(--mantine-color-carbon-0)"},children:e});function x({cluster:e,featureName:t,featureDesc:i,customTitle:a}){let{actions:{fetchCluster:m}}=(0,h.Z)(),[v,j]=(0,l.q)(!1),x=(0,c.z)(),b=e.computed.isDedicated?"cluster":"instance",g=null!=a?a:`The ${b} is ${e.state.toLocaleLowerCase()}, and ${t} is inaccessible.`;return(0,r.jsxs)(n.K,{align:"center",justify:"center",h:"100%",children:[(0,r.jsx)(s.Z,{variant:"body-lg",style:{textAlign:"center",maxWidth:800,textWrap:"balance"},c:"carbon.7",children:i}),(0,r.jsx)(o.i,{w:136,my:16}),(0,r.jsxs)(s.Z,{variant:e.computed.paused?"headline-sm":"body-lg",c:"carbon.7",children:[(e.computed.paused||e.computed.pausing)&&g,e.computed.resuming&&`The ${b} is resuming, and ${t} will be accessible after it is active. Please wait for a while.`]}),e.computed.paused&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(s.Z,{variant:"body-lg",c:"carbon.7",children:["Resume the ",b," to use this function."]}),(0,r.jsx)(d.z,{size:"sm",mt:24,onClick:j.open,children:"Resume"}
1),x.data?(0,r.jsx)(u.j,{clusterId:e.id,clusterName:e.displayName,opened:v,onClose:j.close,onFinish:async()=>{await m(e.id)}}):(0,r.jsx)(p.Z,{id:e.id,cluster:e,visible:v,onClose:j.close,onFinish:async()=>{await m(e.id)}})]})]})}j.displayName="TableFallback",j.Paused=x,j.Empty=({title:e,desc:t,extra:i})=>(0,r.jsxs)(n.K,{gap:24,align:"center",justify:"center",maw:720,h:"100%",m:"auto",children:[(0,r.jsx)(s.Z,{fz:18,fw:700,c:"carbon.7",ta:"center",children:e}),(0,r.jsx)(s.Z,{variant:"body-lg",c:"carbon.7",ta:"center",sx:{textWrap:"balance"},children:t}),i]})},503259:function(e,t,i){i.d(t,{t:()=>s});var r=i(552676),a=i(434443),n=i(630915);let s=({cluster:e,onMenuOpen:t})=>{let i=(0,n.F)();return(0,r.jsx)(a.h,{cluster:e,modals:i,onMenuOpen:t})}},425874:function(e,t,i){i.d(t,{k:()=>l});var r=i(552676),a=i(915030),n=i(696387),s=i(128177),o=i(98172),d=i(365582);let l=({viewMode:e,onSwitchView:t,children:i,actions:l,toolbarTestId:c="my-tidb-toolbar",filtersTestId:u="my-tidb-filters",stickyContentGap:p=0})=>(0,r.jsxs)(a.k,{justify:"space-between",align:"center","data-testid":c,sx:{position:"sticky",top:"var(--app-page-shell-header-height)",zIndex:8,backgroundColor:"var(--mantine-color-carbon-0)",paddingBottom:p},children:[(0,r.jsxs)(a.k,{gap:8,align:"center","data-testid":u,children:[(0,r.jsx)(n.s,{value:e,onChange:t,data:[{value:"list",label:(0,r.jsxs)(s.Z,{gap:4,wrap:"nowrap",justify:"center",children:[(0,r.jsx)(d.xXN,{size:18}),(0,r.jsx)(o.Z,{variant:"label-lg",children:"Resource View"})]})},{value:"project",label:(0,r.jsxs)(s.Z,{gap:4,wrap:"nowrap",justify:"center",children:[(0,r.jsx)(d.PUC,{size:18}),(0,r.jsx)(o.Z,{variant:"label-lg",children:"Project View"})]})}],"data-testid":"my-tidb-view-mode-toggle"}),i]}),l?(0,r.jsx)(s.Z,{gap:8,children:l}):null]})},200385:function(e,t,i){i.r(t),i.d(t,{MyTiDB:()=>T,default:()=>E});var r=i(552676),a=i(980373),n=i(128177),s=i(366130),o=i(185917),d=i(402899),l=i(740521),c=i(365582),u=i(582473),p=i(275271),m=i(322634),h=i(187371),v=i(492713),j=i(822982),x=i(860109),b=i(187692),g=i(973017),y=i(70711),I=i(566249),f=i(90206),w=i(199417),C=i(690826),P=i(316426),k=i(725817),z=i(600867),S=i(138718);let T=(0,u.Pi)(()=>{var e;let t=(0,m.useHistory)(),i=(0,m.useLocation)(),{store:{lastVisitLocation:{projectId:u},tenantData:T}}=(0,I.Z)(),[E,M]=(0,p.useState)(0),[D,A]=(0,p.useState)(!1),[R]=(0,a.Z)({viewMode:void 0},{navigateMode:"replace"}),O="project"===R.viewMode?"project":"list",Z=(0,g.O)(),B="list"===O&&(null===(e=i.state)||void 0===e?void 0:e.from)===x.Y,{isBYOCEnabled:F,isPremiumEnabled:N}=(0,C.B)(),{premiumReservedMode:V}=(0,P.h)(),_=e=>{let r="project"===e?"project":void 0,a=new URLSearchParams;"project"===r&&a.set("viewMode","project"),(0,f.fn)("My TiDB View Mode Changed",{source:"My TiDB",viewMode:r}),t.replace({pathname:i.pathname,search:a.toString()?`?${a.toString()}`:"",hash:i.hash})},L="hidden"!==V;return(0,r.jsxs)(b.M,{bodyProps:{pb:60,sx:{zIndex:1}},title:"My TiDB",headerProps:{sticky:!0,bg:"carbon.1",rightSection:(0,r.jsxs)(n.Z,{gap:8,children:[(0,r.jsx)(h.u,{reasons:[{when:!Z,content:j._}],children:({matched:e})=>(0,r.jsx)(s.z,{size:"sm",disabled:e,onClick:()=>{t.push("/tidbs/new")},"data-testid":"tidb-create-link","data-mp-event":w.P.TidbResource.Create.EnterClicked,children:"Create Resource"})}),(0,r.jsx)(h.u,{reasons:[{when:!Z,content:j._}],children:({matched:e})=>(0,r.jsx)(s.z,{variant:"default",size:"sm",disabled:e,onClick:()=>{A(!0)},"data-testid":"my-tidb-create-project-button","data-mp-event":"Create New Project Button Clicked",children:"Create Project"})}),(0,r.jsxs)(o.v,{withArrow:!0,position:"bottom-end",children:[(0,r.jsx)(o.v.Target,{children:(0,r.jsx)(d.A,{variant:"default",size:32,"aria-label":"More actions",children:(0,r.jsx)(c.aQl,{})})}),(0,r.jsxs)(o.v.Dropdown,{children:[N&&(0,r.jsx)(o.v.Item,{disabled:!Z,onClick:()=>{t.push("/tidbs/restore-from-cloud-storage?plan=Premium")},"data-testid":"my-tidb-restore-cloud-storage-to-premium-item",children:"Restore from Cloud Storage to Premium"}),F&&(0,r.jsx)(o.v.Item,{disabled:!Z,onClick:()=>{t.push("/tidbs/restore-from-cloud-storage?plan=BYOC")},"data-testid":"my-tidb-restore-cloud-storage-to-byoc-item",children:"Restore from Cloud Storage to BYOC"}),N&&(0,r.jsx)(o.v.Item,{disabled:!Z,onClick:()=>{t.push("/tidbs/restore-from-another-plan")},children:"Restore from Another Plan to Premium"}),(0,r.jsx)(o.v.Item,{disabled:!Z,onClick:()=>{t.push("/tidbs/restore-from-another-plan?plan=Essential_V2")},"data-testid":"my-tidb-restore-another-plan-to-essential-item","data-mp-event":w.P.EssentialRestore.Create.EnterClicked,children:"Restore from Another Plan to Essential"}),L&&(0,r.jsx)(o.v.Item,{disabled:!Z,onClick:()=>{t.push("/tidbs/restore-from-cloud-storage?plan=Premium_Reserved")}
1,"data-testid":"my-tidb-restore-cloud-storage-to-premium-reserved-item",children:"Restore from Cloud Storage to Premium Reserved"}),L&&(0,r.jsx)(o.v.Item,{disabled:!Z,onClick:()=>{t.push("/tidbs/restore-from-another-plan?plan=Premium_Reserved")},children:"Restore from Another Plan to Premium Reserved"}),(0,r.jsx)(v.R,{id:"TidbxRecycleBinView",scopeProps:{projectId:u},children:({accessible:e})=>(0,r.jsx)(o.v.Item,{disabled:!e,onClick:()=>{t.push("/tidbs/recycle-bin")},"data-mp-event":w.P.RecycleBin.View.ButtonClicked,"data-testid":"recycle-bin-link",children:"Recycle Bin"})})]})]})]})},children:[(0,r.jsxs)(l.K,{"data-testid":"my-tidb-page",children:[(0,r.jsx)(S.u,{}),B&&(0,r.jsx)(x.x,{mx:0,mb:0,onClose:()=>{t.replace(`${i.pathname}${i.search}${i.hash}`)}}),"project"===O?(0,r.jsx)(z.J,{tenantData:T,refreshKey:E,viewMode:O,onSwitchView:_}):(0,r.jsx)(k._,{viewMode:O,onSwitchView:_,isPremiumReservedEnabled:L})]}),(0,r.jsx)(y.i,{project:void 0,opened:D,onClose:()=>A(!1),onFinish:()=>{M(e=>e+1),"list"===O&&_("project")},createMode:"tidbx-or-dedicated"})]})}),E=T},725817:function(e,t,i){i.d(t,{_:()=>U});var r=i(552676),a=i(980373),n=i(98172),s=i(128177),o=i(775364),d=i(740521),l=i(366130),c=i(402899),u=i(190439),p=i(912769),m=i(566460),h=i(797e3),v=i(826444),j=i(277282),x=i(365582),b=i(582473),g=i(275271),y=i(322634),I=i(678960),f=i(213073),w=i(616658),C=i(343959),P=i(820615),k=i(671948),z=i(73078),S=i(522856),T=i(920501),E=i(503259),M=i(551645),D=i(734175),A=i(427908),R=i(155376),O=i(564027),Z=i(131542),B=i(634070),F=i(314703),N=i(865574),V=i(566249),_=i(525614),L=i(425874);let U=(0,b.Pi)(({viewMode:e,onSwitchView:t,isPremiumReservedEnabled:i})=>{let b=(0,y.useHistory)(),{store:{tenantData:U,allProjects:K},actions:{updateLastVisitLocation:q}}=(0,V.Z)(),[G,Q]=(0,a.Z)({search:void 0,tidbId:void 0,servicePlans:void 0,regionIds:void 0,projectIds:void 0,pageIndex:"0",pageSize:"10"},{navigateMode:"replace"}),Y=e=>e?Array.isArray(e)?e:[e]:[],$={search:G.search||"",tidbId:G.tidbId||"",servicePlans:Y(G.servicePlans),regionIds:Y(G.regionIds),projectIds:Y(G.projectIds)},W={pageIndex:Number(G.pageIndex||0),pageSize:Number(G.pageSize||10)},[H]=(0,v.c)($,300),X=(0,D.Z)(),J=(0,A.A)()&&H.servicePlans.includes(F.g.Essential)?[...new Set([...H.servicePlans,F.g.Essential_V2])]:H.servicePlans,ee=(0,g.useRef)(!1),[et,ei]=(0,g.useState)(!1),{open:er}=(0,M.m0)(),ea=(0,R.W)(),en=ea?{id:ea,name:"(Out of project)",org_id:U.id,is_cross_account:!1,type:k.cd.TIDBX_VIRTUAL}:void 0,es=K.filter(e=>e.org_id===U.id&&e.type!==k.cd.TIDBX_VIRTUAL),eo=en?[en,...es]:es,ed=H.search||H.tidbId.trim()||J.length>0||H.regionIds.length>0||H.projectIds.length>0,{data:el,isLoading:ec,isFetched:eu,isError:ep,refetch:em}=(0,Z.xR)({orgId:U.id,pageSize:W.pageSize,skip:W.pageIndex*W.pageSize,servicePlans:J,projectIds:H.projectIds.includes((null==en?void 0:en.id)||"")?[...H.projectIds,"0"]:H.projectIds,name:H.search,tidbIds:H.tidbId.trim()?[H.tidbId.trim()]:void 0,regionIds:H.regionIds},{query:{retry:3,retryDelay:5e3,refetchOnWindowFocus:e=>!e.state.error,onSuccess:()=>{ei(!1),ee.current||(ee.current=!0)},onError:()=>{ei(!1)},select:e=>{var t;return{...e,tidbs:null===(t=e.tidbs)||void 0===t?void 0:t.map(e=>(0,P.L)(e))}}}}),{data:eh}=(0,Z.Ov)({orgId:U.id,viewMode:B.t.FLAT},{query:{retry:3,retryDelay:5e3}}),ev=(0,g.useMemo)(()=>{var e;return(null==eh?void 0:null===(e=eh.flatView)||void 0===e?void 0:e.regions)?Object.entries(eh.flatView.regions.reduce((e,t)=>{var i,r;let a=t.cloudProvider||(null===(r=t.regionId)||void 0===r?void 0:null===(i=r.split("-"))||void 0===i?void 0:i[0]);return a&&N.U[a]&&(e[a]=[...e[a]||[],{value:t.regionId||"",label:t.displayName||""}]),e},{})).map(([e,t])=>({group:(0,k.Hq)(e),items:t})):[]},[eh]),ej=eo.map(e=>({value:e.id,label:e.name})),ex=eo.reduce((e,t)=>(e[t.id]=t,e),{}),eb=(0,j.a)("(max-width: 1500px)"),eg=[{header:"Name",Header:()=>(0,r.jsx)(n.Z,{pl:16,children:"Name"}),Cell:({row:e})=>{let t=e.original;return(0,r.jsx)(n.Z,{tabIndex:0,variant:"label-lg",c:"peacock.7",ml:16,sx:{cursor:"pointer",maxWidth:eb?300:500,overflow:"hidden",wordBreak:"keep-all",whiteSpace:"nowrap",textOverflow:"ellipsis"},onClick:()=>{q({projectId:t.projectId}),b.push(`/tidbs/${t.tidbId}/overview`)},children:t.displayName})}},{header:"Status",accessorFn:e=>(0,r.jsx)(s.Z,{children:(0,r.jsx)(z.iK,{displayStatus:e.state})}),maxSize:100},{header:"Plan",accessorFn:e=>{var t;return e.servicePlan?(0,r.jsx)(O.$,{servicePlan:(null===(t=e.instance)||void 0===t?void 0:t.computed.isCassandra)?"Cassandra Integration":e.servicePlan}):"-"},size:160},{header:"Project",accessorFn:e=>{var t,i,a,n;let s=(null===(t=ex[e.projectId])||void 0===t?void 0:t.name)||"";return e.projectId&&"0"!==e.projectId&&(null===(i=ex[e.projectId])||void 0===i?void 0:i.type)!==k.cd.TIDBX_VIRTUAL&&s?(null===(a=ex[e.projectId])||void 0===a?void 0:a.type)===k.cd.TIDBX?(null===(n=ex[e.projectId])||void 0===n?void 0:n.name)||e.projectId:(0,r.jsx)(o.x,{component:I.rU,to:`/project/network-access?orgId=${U.id}&projectId=${e.projectId}`,sx:{textDecoration:"none !important"},onClick:()=>{q({projectId:e.projectId})},children:s}):"-"}},{header:"Cloud",accessorFn:e=>(0,k.Hq)(e.cloudProvider),size:100},{header:"Region",accessorFn:e=>e.regionDisplayName},{id:"compatibilityMode",header:"Compatibility Mode",accessorFn:e=>(0,r.jsx)(C.V,{engineType:e.engineType}),size:180},{header:"Created At",accessorFn:e=>(0,r.jsx)(w.Z,{time:e.createTime||"",format:"YYYY-MM-DD HH:mm:ss"})},{id:"Action",header:"",accessorFn:e=>{var t,i;return(null===(t=e.cluster)||void 0===t?void 0:t.dedicated)?(0,r.jsx)(S.Q,{cluster:e.cluster,position:"bottom-end",actionVariant:"subtle",from:"my-tidb",onMenuOpen:()=>{q({projectId:e.projectId})}}):(null===(i=e.cluster)||void 0===i?void 0:i.serverless)?(0,r.jsx)(E.t,{cluster:e.cluster.serverless,onMenuOpen:()=>{q({projectId:e.projectId})}}):e.instance?(0,r.jsx)(_.l,{tidb:e.instance,onMenuOpen:()=>{q({projectId:e.projectId})}}):null},size:80}];return(0,r.jsxs)(o.x,{"data-testid":"my-tidb-list-view",children:[(0,r.jsx)(f.xS,{ready:(0,f.DY)({isFetched:eu,isError:ep})}),ep&&!ee.current?(0,r.jsxs)(d.K,{align:"center",mt:48,"data-testid":"my-tidb-error-state",children:[(0,r.jsx)(x.IF3,{size:48,color:"red"}),(0,r.jsx)(n.Z,{variant:"headline-lg",c:"carbon.7",children:"Fetch failed."}),(0,r.jsxs)(n.Z,{variant:"body-lg",c:"carbon.7",children:["Please retry in a short while or contact ",(0,r.jsx)("a",{onClick:()=>er(),children:"technical support"}),"."]}),(0,r.jsx)(l.z,{onClick:()=>em(),children:"Retry"})]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(L.k,{viewMode:e,onSwitchView:t,actions:(0,r.jsx)(c.A,{onClick:()=>{ei(!0),em().finally(()=>{ei(!1)})},variant:"subtle","data-mp-event":"My TiDB Refresh Button Clicked","data-testid":"my-tidb-refresh-button",children:(0,r.jsx)(x.CUg,{size:16})}),children:[(0,r.jsx)(u.o,{placeholder:"Search Name",w:220,value:$.search,"data-testid":"my-tidb-search-input",rightSection:$.search?(0,r.jsx)(x.aAu,{size:14,sx:{cursor:"pointer"},onClick:()=>{Q({search:void 0,pageIndex:"0"})}}):(0,r.jsx)(x.iVg,{size:14,sx:{cursor:"pointer"}}),onChange:e=>{Q({search:e.currentTarget.value||void 0,pageIndex:"0"})}}),(0,r.jsx)(u.o,{placeholder:"Search ID",w:220,value:$.tidbId,"data-testid":"my-tidb-id-search-input",rightSection:$.tidbId?(0,r.jsx)(x.aAu,{size:14,sx:{cursor:"pointer"},onClick:()=>{Q({tidbId:void 0,pageIndex:"0"})}}):(0,r.jsx)(x.iVg,{size:14,sx:{cursor:"pointer"}}),onChange:e=>{Q({tidbId:e.currentTarget.value||void 0,pageIndex:"0"})}}),(0,r.jsx)(m.Q,{data:[{label:"Starter",value:F.g.Starter},{label:"Essential",value:F.g.Essential},{label:"Premium",value:F.g.Premium},...i?[{label:"Premium Reserved",value:F.g.Premium_Reserved}]:[],{label:"BYOC",value:F.g.BYOC},{label:"Dedicated",value:"Dedicated"}],placeholder:"Plan",clearable:!0,width:190,value:$.servicePlans,searchable:!0,onChange:e=>{Q({servicePlans:(null==e?void 0:e.length)?e:void 0,pageIndex:"0"})},"data-testid":"my-tidb-plan-filter"}),(0,r.jsx)(m.Q,{data:ev,placeholder:"Region",clearable:!0,width:190,searchable:!0,value:$.regionIds,onChange:e=>{Q({regionIds:(null==e?void 0:e.length)?e:void 0,pageIndex:"0"})},"data-testid":"my-tidb-region-filter"}),(0,r.jsx)(m.Q,{data:ej,placeholder:"Project",clearable:!0,width:190,value:$.projectIds,searchable:!0,onChange:e=>{Q({projectIds:(null==e?void 0:e.length)?e:void 0,pageIndex:"0"})},"data-testid":"my-tidb-project-filter"}),(0,r.jsx)(l.z,{onClick:()=>{Q({search:void 0,tidbId:void 0,servicePlans:void 0,regionIds:void 0,projectIds:void 0,pageIndex:"0"})},variant:"subtle","data-testid":"my-tidb-clear-filter-button",children:"Clear Filter"})]}),(0,r.jsx)(o.x,{"data-testid":"my-tidb-list-table-container",children:(0,r.jsx)(h.Q,{columns:eg,data:(null==el?void 0:el.tidbs)||[],loading:ec||et,mantinePaperProps:{mt:16,mb:16},manualPagination:!0,renderEmptyRowsFallback:()=>ed?(0,r.jsx)(p.M,{h:40,children:ep?"Error occurred, please try again later.":"No data."}):(0,r.jsx)(T.sA,{height:"calc(100vh - 260px)",children:(0,r.jsx)(T.sA.Empty,{title:"Get started by creating a resource",desc:""})}),enablePagination:!0,state:{pagination:W,columnVisibility:{compatibilityMode:X}},onPaginationChange:e=>{let t="function"==typeof e?e(W):e;Q({pageIndex:String(t.pageIndex),pageSize:String(t.pageSize)})},rowCount:(null==el?void 0:el.totalSize)||0,pagination:{showRowsPerPage:!0,showTotal:!0},"data-testid":"my-tidb-list-table"})})]})]})})},138718:function(e,t,i){i.d(t,{u:()=>m});var r=i(552676),a=i(775364),n=i(128177),s=i(98172),o=i(366130),d=i(365582),l=i(322634),c=i(324178),u=i(199417),p=i(753446);let m=()=>{let e=(0,l.useHistory)(),t=(0,c.x)("TidbxProjectMigration"),{query:i,hasPendingTask:m}=(0,p.l)(),h=!i.isError&&m;return(0,r.jsxs)(a.x,{sx:{display:h?void 0:"none",padding:"16px 24px",borderRadius:8,border:"1px solid transparent",background:` 2 linear-gradient(90deg, var(--mantine-color-violet-2) 0%, var(--mantine-color-purple-2) 100%) padding-box, 3 linear-gradient(90deg, #2D3ED2 0%, #B423D1 100%) border-box 4 `},"data-testid":"project-migration-alert","data-accessible":t,id:"project-migration-alert",children:[(0,r.jsxs)(n.Z,{justify:"center",gap:8,mb:4,wrap:"nowrap",children:[(0,r.jsx)(d.jcS,{size:16,c:"purple.9"}),(0,r.jsx)(s.Z,{variant:"title-lg",c:"purple.9",children:"Unlock more flexibility for Starter and Essential"})]}),(0,r.jsxs)(a.x,{children:[(0,r.jsxs)(s.Z,{variant:"body-lg",c:"purple.9",ta:"center",children:["To do that, move Starter and Essential instances in your organization to a new project. Learn more about"," ",(0,r.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidbx-instance-move-faq/?plan=starter",target:"_blank",rel:"noreferrer",children:"TiDB X instance conversion"}),"."]}),(0,r.jsxs)(s.Z,{variant:"body-lg",c:"purple.9",ta:"center",children:[(0,r.jsx)("strong",{children:"Note:"})," Dedicated clusters will remain in their current projects. There is no cost for this conversion."]}),!t&&(0,r.jsx)(s.Z,{variant:"body-lg",c:"purple.9",ta:"center",children:"Please contact your org owner to move and unlock those new feature."})]}),t&&(0,r.jsx)(a.x,{ta:"center",mt:"sm",children:(0,r.jsx)(o.z,{variant:"gradient",size:"sm",gradient:{from:"#B423D1",to:"#2D3ED2",deg:90},onClick:()=>{e.push({pathname:"/tidbs/project-migration"})},"data-testid":"project-migration-alert-cta","data-mp-event":u.P.ProjectMigration.View.EnterClicked,children:"Move & Unlock"})})]})}},600867:function(e,t,i){i.d(t,{J:()=>Y});var r=i(552676),a=i(980373),n=i(98172),s=i(128177),o=i(775364),d=i(110442),l=i(779533),c=i(593001),u=i(402899),p=i(185917),m=i(912769),h=i(366130),v=i(740521),j=i(407183),x=i(156102),b=i(10647),g=i(797e3),y=i(566460),I=i(768615),f=i(365582),w=i(582473),C=i(275271),P=i(322634),k=i(213073),z=i(616658),S=i(569876),T=i(343959),E=i(820615),M=i(671948),D=i(73078),A=i(522856),R=i(920501),O=i(503259),Z=i(734175),B=i(564027),F=i(79581),N=i(70711),V=i(356186),_=i(131542),L=i(639151),U=i(566249),K=i(155376),q=i(525614),G=i(425874);let Q=(0,w.Pi)(({project:e,tenantData:t,highlight:i,onRenameProject:a,onInviteProject:h,expandAllSignal:v,expandAllOpened:j,refreshToken:x})=>{let y=(0,P.useHistory)(),{actions:{updateLastVisitLocation:I,updateActiveProjectId:w}}=(0,U.Z)(),k=(0,Z.Z)(),[F,N]=(0,C.useState)(!1),[V,K]=(0,C.useState)({pageIndex:0,pageSize:10}),G=(0,C.useRef)(!1),Q=(0,C.useRef)(!1),[Y,$]=(0,C.useState)(!1);(0,C.useEffect)(()=>{$(!1)},[x]);let W=e.type===M.cd.TIDBX_VIRTUAL||"0"===e.id?[e.id,"0"]:[e.id],{data:H,isLoading:X,refetch:J}=(0,_.xR)({orgId:t.id,projectIds:W,pageSize:V.pageSize,skip:V.pageIndex*V.pageSize},{query:{enabled:!!t.id,refetchOnWindowFocus:!1,select:e=>{var t;return{...e,tidbs:null===(t=e.tidbs)||void 0===t?void 0:t.map(e=>(0,E.L)(e))}}}});(0,C.useEffect)(()=>{N(j)},[j,v]),(0,C.useEffect)(()=>
4{if(!Q.current){Q.current=!0;return}J()},[J,x]),(0,C.useEffect)(()=>{if(F){if(!G.current){G.current=!0;return}J()}},[F,J,x]);let ee=(null==H?void 0:H.tidbs)||[],et=(null==H?void 0:H.totalSize)||0,ei=(0,C.useMemo)(()=>[{header:"Name",Header:()=>(0,r.jsx)(n.Z,{pl:16,children:"Name"}),Cell:({row:e})=>{let t=e.original;return(0,r.jsx)(n.Z,{tabIndex:0,variant:"label-lg",c:"peacock.7",ml:16,sx:{cursor:"pointer",maxWidth:500,overflow:"hidden",wordBreak:"keep-all",whiteSpace:"nowrap",textOverflow:"ellipsis"},onClick:()=>{y.push(`/tidbs/${t.tidbId}/overview`)},children:t.displayName})}},{header:"Status",accessorFn:e=>(0,r.jsx)(s.Z,{children:(0,r.jsx)(D.iK,{displayStatus:e.state})}),maxSize:100},{header:"Plan",accessorFn:e=>{var t;return e.servicePlan?(0,r.jsx)(B.$,{servicePlan:(null===(t=e.instance)||void 0===t?void 0:t.computed.isCassandra)?"Cassandra Integration":e.servicePlan}):"-"},size:126},{header:"Cloud",accessorFn:e=>(0,M.Hq)(e.cloudProvider),size:100},{header:"Region",accessorFn:e=>e.regionDisplayName},{id:"compatibilityMode",header:"Compatibility Mode",accessorFn:e=>(0,r.jsx)(T.V,{engineType:e.engineType}),size:180},{header:"Created At",accessorFn:e=>(0,r.jsx)(z.Z,{time:e.createTime||"",format:"YYYY-MM-DD HH:mm:ss"})},{id:"Action",header:"",accessorFn:e=>{var t,i;return(null===(t=e.cluster)||void 0===t?void 0:t.dedicated)?(0,r.jsx)(A.Q,{cluster:e.cluster,position:"bottom-end",actionVariant:"subtle",from:"my-tidb",onMenuOpen:()=>{I({projectId:e.projectId})}}):(null===(i=e.cluster)||void 0===i?void 0:i.serverless)?(0,r.jsx)(O.t,{cluster:e.cluster.serverless,onMenuOpen:()=>{I({projectId:e.projectId})}}):e.instance?(0,r.jsx)(q.l,{tidb:e.instance,onMenuOpen:()=>{I({projectId:e.projectId})}}):null},size:80}],[y,I]),er="0"===e.id||e.type===M.cd.TIDBX_VIRTUAL?"(Out of project)":e.name||`Project (ID: ${e.id})`,ea="0"===e.id||e.type===M.cd.TIDBX_VIRTUAL,en=e.type===M.cd.DEDICATED,es=e.type!==M.cd.TIDBX_VIRTUAL,eo="0"!==e.id&&en?1===et?"cluster":"clusters":1===et?"instance":"instances";return(0,r.jsx)(o.x,{"data-testid":"my-tidb-project-card","data-project-id":e.id,children:(0,r.jsx)(b.N,{"data-testid":"my-tidb-project-card-container",title:(0,r.jsxs)(s.Z,{wrap:"nowrap",sx:{flex:1},align:"center",children:[(0,r.jsxs)(s.Z,{wrap:"nowrap",gap:8,align:"center",sx:{minWidth:0,flex:1,overflow:"hidden"},children:[ea?null:en?(0,r.jsx)(f.VTC,{size:18,c:"carbon.8",strokeWidth:1.5}):(0,r.jsx)(f.PUC,{size:18,c:"carbon.8",strokeWidth:1}),(0,r.jsx)(n.Z,{variant:"title-md",truncate:!0,children:(0,r.jsx)(d.y,{fw:ea?void 0:700,c:"carbon.8",highlight:i||"","data-mp-event":en?"My TiDB Project Network Access Link Clicked":void 0,children:er})}),(0,r.jsxs)(n.Z,{c:"carbon.7",truncate:!0,children:["Total ",et," ",eo]}),es&&(0,r.jsxs)(s.Z,{gap:4,wrap:"nowrap",align:"center",ml:8,sx:{flexShrink:0},children:[(0,r.jsxs)(n.Z,{c:"carbon.7",children:["ID: ",e.id]}),(0,r.jsx)(l.q,{value:e.id,timeout:2e3,children:({copied:t,copy:i})=>(0,r.jsx)(c.u,{label:t?"Copied":"Copy",withArrow:!0,position:"right",children:(0,r.jsx)(u.A,{variant:"transparent",size:"sm",c:"carbon.7","aria-label":`Copy project ID ${e.id}`,"data-testid":"my-tidb-project-id-copy-button","data-project-id":e.id,"data-mp-event":"My TiDB Project ID Copy Button Clicked",onClick:e=>{e.stopPropagation(),i()},children:t?(0,r.jsx)(f.NOm,{size:16,c:"carbon.7"}):(0,r.jsx)(f.xty,{size:16,strokeWidth:1,c:"carbon.7"})})})})]})]}),!ea&&(0,r.jsxs)(s.Z,{gap:8,ml:"auto",align:"center",onClick:e=>e.stopPropagation(),children:[en&&(0,r.jsx)(u.A,{variant:"subtle",size:"md",onClick:()=>{I({projectId:e.id}),w(e.id),y.push(`/project/network-access?orgId=${t.id}&projectId=${e.id}`)},"data-testid":"my-tidb-project-network-access-button","data-mp-event":"My TiDB Project Network Access Button Clicked",children:(0,r.jsx)(f.JOo,{size:16,c:"carbon.7"})}),(0,r.jsxs)(p.v,{position:"bottom-end",onOpen:async()=>{if(en&&(null==t?void 0:t.id)&&(null==e?void 0:e.id))try{$(!1);let i=await (0,L.Axq)(t.id,e.id),r=(null==i?void 0:i.data)||[];$(!!r.length)}catch(e){$(!1)}},children:[(0,r.jsx)(p.v.Target,{children:(0,r.jsx)(u.A,{variant:"subtle",size:"md",onClick:e=>e.stopPropagation(),"data-testid":"my-tidb-project-more-actions-button","data-mp-event":"My TiDB Project More Actions Button Clicked",children:(0,r.jsx)(f.aQl,{size:16})})}),(0,r.jsxs)(p.v.Dropdown,{children:[(0,r.jsx)(p.v.Item,{onClick:()=>a(e),"data-mp-event":"My TiDB Project Rename Menu Item Clicked",children:"Rename"}),(0,r.jsx)(S.A,{id:"ProjectUsersAction",scopeProps:{projectId:e.id},children:({accessible:t})=>(0,r.jsx)(p.v.Item,{disabled:!t,onClick:()=>h(e),"data-mp-event":"My TiDB Project Invite Menu Item Clicked",children:"Invite"})}),!en&&(0,r.jsx)(p.v.Item,{rightSection:(0,r.jsx)(f.Z67,{size:14,c:"carbon.7"}),"data-mp-event":"My TiDB Project Data Service Menu Item Clicked",onClick:()=>{window.open(`/project/data-service?orgId=${t.id}&projectId=${e.id}`,"_blank")},children:"Data Service"}),en&&Y&&(0,r.jsx)(p.v.Item,{rightSection:(0,r.jsx)(f.Z67,{size:14,c:"carbon.7"}),"data-mp-event":"My TiDB Project Data Service Menu Item Clicked",onClick:()=>{window.open(`/project/data-service?orgId=${t.id}&projectId=${e.id}`,"_blank")},children:"Data Service"})]})]})]})]}),opened:F,onToggle:N,contentProps:{p:0},children:F&&(0,r.jsx)(r.Fragment,{children:X&&0===ee.length?(0,r.jsx)(m.M,{p:16,"data-testid":"my-tidb-project-card-loading",children:(0,r.jsx)(n.Z,{variant:"body-lg",c:"carbon.7",children:"Loading..."})}):0===ee.length?(0,r.jsx)(m.M,{p:16,"data-testid":"my-tidb-project-card-empty",children:(0,r.jsx)(n.Z,{variant:"body-lg",c:"carbon.7",children:e.type===M.cd.DEDICATED?"No cluster yet":"No instance yet"})}):(0,r.jsx)(g.Q,{columns:ei,data:ee,loading:X,renderEmptyRowsFallback:()=>(0,r.jsx)(R.sA,{height:"calc(100vh - 300px)",children:(0,r.jsx)(R.sA.Empty,{title:"No instances",desc:"Instances will appear here."})}),manualPagination:!0,enablePagination:!0,state:{pagination:V,columnVisibility:{compatibilityMode:k}},rowCount:et,onPaginationChange:K,withBorder:!1,pagination:{showRowsPerPage:!1,showTotal:!0,wrapperProps:{px:16,py:8,sx:{borderTop:"1px solid var(--mantine-color-carbon-3)"}}},"data-testid":"my-tidb-project-card-table"})})})})}),Y=(0,w.Pi)(({tenantData:e,refreshKey:t,viewMode:i,onSwitchView:s})=>{var d;let{store:{allProjects:l}}=(0,U.Z)(),[c,p]=(0,a.Z)({projectIds:void 0},{navigateMode:"replace"}),{ref:b,inViewport:g}=(0,I.N)(),w=(d=c.projectIds)?Array.isArray(d)?d:[d]:[],P=(0,C.useCallback)(e=>({...e,id:e.id,name:e.name,type:e.type||M.cd.TIDBX,active_cluster
4s_count:0,users_count:0}),[]),[z,S]=(0,C.useState)(1),[T,E]=(0,C.useState)([]),[D,A]=(0,C.useState)(!0),[R,O]=(0,C.useState)(!1),[Z,B]=(0,C.useState)(0),{isFetching:_,isFetched:L,isError:q}=(0,V.jKU)(e.id,{page:z,per_page:50,types:[M.cd.DEDICATED,M.cd.TIDBX]},{query:{queryKey:["my-tidb-projects",e.id,z,Z],enabled:!!e.id&&D,refetchOnWindowFocus:!1,onSuccess:e=>{E(t=>{let i=new Set(t.map(e=>e.id)),r=(e.items||[]).filter(e=>!i.has(e.id));return t.concat(r)}),A(50*z<(e.total||0)),O(!1)},onError:()=>{O(!1)}}}),Y=(0,K.W)(),[$,W]=(0,C.useState)(),[H,X]=(0,C.useState)(!1),[J,ee]=(0,C.useState)(!1),[et,ei]=(0,C.useState)(!1),[er,ea]=(0,C.useState)(0),[en,es]=(0,C.useState)(0),eo=(0,C.useCallback)((e=!1)=>{S(1),E([]),A(!0),O(!0),e&&B(e=>e+1)},[]);(0,C.useEffect)(()=>{eo()},[e.id,eo]),(0,C.useEffect)(()=>{eo(!0),es(e=>e+1)},[t,eo]),(0,C.useEffect)(()=>{!(w.length>0)&&g&&D&&!_&&S(e=>e+1)},[D,g,_,w.length]);let ed=(0,C.useMemo)(()=>P({id:Y||"0",name:"(Out of project)",type:M.cd.TIDBX_VIRTUAL}),[P,Y]),el=(0,C.useMemo)(()=>l.filter(t=>t.org_id===e.id&&(t.type===M.cd.DEDICATED||t.type===M.cd.TIDBX)),[l,e.id]),ec=(0,C.useMemo)(()=>(Y?[ed,...el]:el).map(e=>({value:e.id,label:e.name})),[el,ed,Y]),eu=(0,C.useMemo)(()=>{if(0===w.length)return Y?[ed,...T]:T;let e=new Map;return Y&&e.set(ed.id,ed),el.forEach(t=>{e.set(t.id,P(t))}),w.map(t=>e.get(t)).filter(e=>!!e)},[T,el,ed,w,P,Y]),ep=0===w.length&&(_||R)&&0===T.length,em=e=>{W(e),X(!0)},eh=e=>{W(e),ee(!0)},ev=()=>{eo(!0),es(e=>e+1)},ej=0===w.length&&!ep&&D,ex=0===w.length&&!ep&&_&&D,eb=eu.filter(e=>e.type!==M.cd.TIDBX_VIRTUAL).length,eg=0===eb?"No projects yet.":`Total ${eb} ${1===eb?"project":"projects"}`;return(0,r.jsxs)(o.x,{"data-testid":"my-tidb-project-page",children:[(0,r.jsx)(k.xS,{ready:(0,k.DY)({isFetched:L,isError:q})}),(0,r.jsxs)(G.k,{viewMode:i,onSwitchView:s,toolbarTestId:"my-tidb-project-toolbar",filtersTestId:"my-tidb-project-filters",stickyContentGap:16,actions:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(u.A,{onClick:()=>{eo(!0),es(e=>e+1)},variant:"subtle","data-mp-event":"My TiDB Refresh Button Clicked","data-testid":"my-tidb-refresh-button",children:(0,r.jsx)(f.CUg,{size:16})}),(0,r.jsx)(u.A,{variant:"subtle","aria-label":et?"Collapse all projects":"Expand all projects",onClick:()=>{ei(e=>(ea(e=>e+1),!e))},"data-testid":"my-tidb-project-expand-collapse-all-button","data-mp-event":"My TiDB Project Expand Collapse All Button Clicked",children:et?(0,r.jsx)(f.Tzd,{size:16}):(0,r.jsx)(f.j22,{size:16})})]}),children:[(0,r.jsx)(y.Q,{data:ec,placeholder:"Project",clearable:!0,width:220,value:w,searchable:!0,onChange:e=>{p({projectIds:(null==e?void 0:e.length)?e:void 0})},"data-testid":"my-tidb-project-filter"}),(0,r.jsx)(h.z,{onClick:()=>{p({projectIds:void 0})},variant:"subtle","data-testid":"my-tidb-clear-filter-button",children:"Clear Filter"})]}),(0,r.jsx)(o.x,{mt:0,"data-testid":"my-tidb-project-view-container",children:(0,r.jsxs)(v.K,{gap:16,"data-testid":"my-tidb-project-view","data-refresh-key":t,children:[ep&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(j.O,{height:100,"data-testid":"my-tidb-project-view-skeleton"}),(0,r.jsx)(j.O,{height:100,"data-testid":"my-tidb-project-view-skeleton"}),(0,r.jsx)(j.O,{height:100,"data-testid":"my-tidb-project-view-skeleton"}),(0,r.jsx)(j.O,{height:100,"data-testid":"my-tidb-project-view-skeleton"})]}),!ep&&(0,r.jsx)(r.Fragment,{children:eu.map(t=>(0,r.jsx)(Q,{project:t,tenantData:e,onRenameProject:em,onInviteProject:eh,expandAllSignal:er,expandAllOpened:et,refreshToken:en},t.id))}),ej&&(0,r.jsx)("div",{ref:b,"data-testid":"my-tidb-project-load-more-trigger"}),ex&&(0,r.jsx)(m.M,{"data-testid":"my-tidb-project-load-more-loader",children:(0,r.jsx)(x.a,{size:"md"})})]})}),!ep&&(0,r.jsx)(n.Z,{mt:16,c:"carbon.7","data-testid":"my-tidb-project-total-summary",children:eg}),(0,r.jsx)(N.i,{project:$,opened:H,onClose:()=>X(!1),onFinish:ev}),(0,r.jsx)(F.B,{mode:"free",projectId:(null==$?void 0:$.id)||"",opened:J,onClose:()=>ee(!1),onFinish:ev})]})})},525614:function(e,t,i){i.d(t,{l:()=>m});var r=i(552676),a=i(402899),n=i(365582),s=i(504934),o=i(246685),d=i(975594),l=i(810202),c=i(812024),u=i(199417),p=i(561090);let m=({tidb:e,onMenuOpen:t})=>{let i=(0,p.R)(),m=(0,l.g)(e),h=(0,d.j)(e),v=(0,c._6)(e),j=v.servicePlan;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(s.x,{servicePlan:j,onMenuOpen:t,menuTarget:(0,r.jsx)(a.A,{variant:"subtle",size:"input-xs","aria-label":"TiDB Premium operation dropdown menu","data-mp-event":u.P.TidbResource.Operate.EnterClicked,"data-mp-service-plan":j,children:(0,r.jsx)(n.aQl,{size:16})}
4),controllers:{move:{...i.move,disabled:!m.move||!h.move},rename:{...i.rename,disabled:!m.rename||!h.rename},resume:{...i.resume,disabled:!h.resume,rendered:m.resume},password:{...i.password,disabled:!m.password||!h.password},deletion:{...i.deletion,disabled:!m.deletion||!h.deletion}}}),(0,r.jsx)(o.r,{tidb:v,controllers:{move:{...i.move,rendered:m.move&&h.move},rename:{...i.rename,rendered:m.rename&&h.rename},resume:{...i.resume,rendered:m.resume&&h.resume},password:{...i.password,rendered:m.password&&h.password},deletion:{...i.deletion,rendered:m.deletion&&h.deletion}}})]})}},36966:function(e,t,i){i.d(t,{_:()=>f});var r=i(552676),a=i(366130),n=i(775364),s=i(740521),o=i(190439),d=i(128177),l=i(712995),c=i(150288),u=i(376653),p=i(365582),m=i(629545),h=i(582473),v=i(275271),j=i(469987),x=i(68009),b=i(640957),g=i(199417),y=i(701234),I=i(525761);let f=(0,h.Pi)(({tidbId:e,isEditMode:t,onDone:i,onCancel:h,onSave:f,renderActions:w})=>{let C=(0,v.useId)(),{formContext:P,onSubmit:k}=(0,I.o)(e,{onSuccess:e=>{null==f||f(e)}}),{watch:z,setValue:S,formState:{isSubmitting:T,isSubmitSuccessful:E}}=P,M=z("rootPwd"),D=(0,r.jsx)(a.z,{variant:"default",disabled:T,onClick:h,"data-mp-event":g.P.TidbRootPassword.Update.CancelClicked,"data-mp-service-plan":b.E.Premium,children:"Cancel"}),A=(0,r.jsx)(a.z,{type:"submit",form:C,loading:T,disabled:!e,"data-mp-event":g.P.TidbRootPassword.Update.SubmitClicked,"data-mp-service-plan":b.E.Premium,children:"Save"});return(0,r.jsxs)(j.RV,{...P,children:[(0,r.jsx)(n.x,{component:"form",id:C,onSubmit:k,children:(0,r.jsxs)(s.K,{justify:"flex-start",gap:"xl",p:"xl",children:[(0,r.jsx)(o.o,{label:"SQL User Name",value:"root",disabled:!0}),(0,r.jsx)(u.N,{name:"rootPwd",label:"Password",placeholder:t?"****************":"Create a password for root user",autoComplete:"new-password","data-autofocus":!0,rules:{...y.dQ,required:"Required"},styles:{visibilityToggle:{display:t&&!M?"none":void 0}}}),(0,r.jsxs)(d.Z,{children:[(0,r.jsx)(a.z,{variant:"default",leftSection:(0,r.jsx)(p.PXA,{size:16}),onClick:()=>{S("rootPwd",m.generate({length:16,numbers:!0,strict:!0}),{shouldDirty:!0})},"data-testid":"premium-auto-generate-password-btn",children:"Auto-generate Password"}),(0,r.jsx)(x.R,{text:M,disabled:!M,"data-mp-event":g.P.TidbRootPassword.Copy.ButtonClicked,"data-mp-service-plan":b.E.Premium})]}),E&&(0,r.jsx)(l.b,{color:"green",icon:(0,r.jsx)(p.Bu,{size:14}),children:"Make sure to copy your password and save it in a secure location. You won't be able to see it next time."})]})}),(0,r.jsx)(c.i,{color:"carbon.4"}),(0,r.jsxs)(d.Z,{justify:"flex-end",py:"md",px:"xl",children:[E&&(0,r.jsx)(a.z,{variant:"default",onClick:i,"data-mp-event":g.P.TidbRootPassword.Update.DoneClicked,"data-mp-service-plan":b.E.Premium,children:"Done"}),!E&&((null==w?void 0:w({submitting:T,cancelBtn:D,saveBtn:A}))||(0,r.jsxs)(r.Fragment,{children:[D,A]}))]})]})})},79581:function(e,t,i){i.d(t,{B:()=>x});var r=i(552676),a=i(125385),n=i(971798),s=i(128177),o=i(359697),d=i(825539),l=i(490764),c=i(582473),u=i(668913),p=i(634719),m=i(566249),h=i(325918),v=i(90206),j=i(778651);let x=(0,c.Pi)(({mode:e,user:t,projectId:i,opened:c=!1,onClose:x,onFinish:b})=>{let{store:{userProfile:{projects:g},tenantData:{id:y}}}=(0,m.Z)(),I=(0,p.ire)(),f=async t=>{await I.mutateAsync({orgId:y,projectId:i,data:{email:t.email,rbac_role:t.role}}),"free"===e&&(null==b||b()),a.r.success("User invitation sent."),x(),(0,v.fn)("Invite User Completed")},w="specific"===e?{email:null==t?void 0:t.email,role:null==t?void 0:t.rbac_role,project:i}:{email:"",role:u.K.ProjectReadOnly,project:i},C=g.map(e=>({value:e.id,label:e.name}));return(0,r.jsx)(n.u,{opened:c,onClose:x,title:"Invite User",centered:!0,size:"xl",children:(0,r.jsxs)(o.l,{layout:"vertical",defaultValues:w,onSubmit:f,onCancel:x,children:[(0,r.jsx)(d.c,{name:"email",label:"Email",placeholder:"Use ; to separate multiple email addresses",disabled:"specific"===e,required:!0,rules:{required:"Please enter at least one email address.",validate:e=>(function(e){for(let t=0;t<e.length;t++)if(!e[t]||!h.TH.test(e[t].trim()))return!1;return!0})(e.split(";"))||"Please enter the valid email address."},"data-autofocus":!0}),(0,r.jsxs)(s.Z,{justify:"space-between",gap:"md",grow:!0,children:[(0,r.jsx)(l.i,{name:"project",label:"Project",placeholder:"Choose Project",data:C,disabled:!0,required:!0}),(0,r.jsx)(l.i,{name:"role",label:"Role",placeholder:"Choose Role",data:j.S,disabled:"specific"===e,required:!0})]})]})})})}}]);
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.