PageSourceSearch

https://tidbcloud.com/static/js/async/6522.09badd97.js

js tidbcloud.com collected 2026-10-02 07:09:11 UTC 16,097 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunktidb_cloud_ui=globalThis.webpackChunktidb_cloud_ui||[]).push([["6522"],{976402:function(e,r,s){s.d(r,{A:()=>S,S:()=>A});var a=s(552676),l=s(971798),i=s(740521),n=s(712995),t=s(701805),o=s(150288),c=s(128177),d=s(366130),u=s(359697),b=s(490764),h=s(825539),m=s(376653),x=s(365582),p=s(275271),j=s(469987),k=s(338219),v=s(539692),g=s(834276),y=s(724738),U=s(294859),w=s(325918);let S=e=>{let{opened:r,onCancel:s}=e;return(0,a.jsx)(l.u,{title:"Add Subscriber",size:640,centered:!0,opened:r,onClose:s,closeOnClickOutside:!1,children:(0,a.jsx)(f,{...e})})},L=[g.$.EMAIL],z=()=>({dryRun:!0,name:"",subscriberType:g.$.EMAIL,email:"",slackUrl:"",zoomUrl:"",zoomToken:"",flashDutyUrl:"",pagerDutyKey:"",webhookUrl:"",larkWebhookUrl:"",larkSecret:""}),A=(e,r)=>{let{data:s}=(0,v.EB)(e,r),a=null==s?void 0:s.supportPlan;return a===y.g.Enterprise||a===y.g.Premium},f=({orgId:e,clusterId:r,isEssentialV2:s,onCancel:l,onSuccess:h})=>{let m=(0,j.cI)({mode:"onBlur",reValidateMode:"onBlur",shouldUnregister:!0,defaultValues:z()}),{watch:y,resetField:w}=m,[S]=y(["subscriberType","email","name","slackUrl","zoomToken","zoomUrl","flashDutyUrl","pagerDutyKey","webhookUrl","larkWebhookUrl","larkSecret"]),{mutateAsync:f,error:K,isError:R,reset:D,isLoading:q}=(0,v.iy)(),{isLoading:I}=(0,v.EB)(e,r),W=A(e,r),O=s?"Current Essential instance":"Current Premium instance",B=(0,p.useMemo)(()=>{let e=(0,k.z)();return W?e:e.map(e=>({...e,disabled:!L.includes(e.value)}))},[W]);return(0,a.jsxs)(u.l,{form:m,withActions:!1,onSubmit:()=>{},children:[(0,a.jsxs)(i.K,{mb:8,children:[!W&&(0,a.jsx)(n.b,{icon:(0,a.jsx)(x.Us8,{size:12}),color:"peacock",children:"The current support plan does not support external subscribers, please upgrade to Premium/Enterprise Plan via [Support] in the left navigation bar if needed."}),(0,a.jsx)(b.i,{name:"subscriberType",label:"Subscriber Type",data:B,onChange:()=>{w("name"),w("email"),w("slackUrl"),w("zoomUrl"),w("zoomToken"),w("flashDutyUrl"),w("pagerDutyKey"),w("webhookUrl"),w("larkWebhookUrl"),w("larkSecret")},rules:{required:!0},disabled:I}),S===g.$.EMAIL&&(0,a.jsx)(T,{}),S===g.$.ZOOM&&(0,a.jsx)(E,{}),S===g.$.SLACK&&(0,a.jsx)(C,{}),S===g.$.FLASHDUTY&&(0,a.jsx)(P,{}),S===g.$.PAGERDUTY&&(0,a.jsx)(F,{}),S===g.$.WEBHOOK&&(0,a.jsx)($,{}),S===g.$.LARK&&(0,a.jsx)(Z,{}),(0,a.jsx)(t.P,{label:"Subscribe Scope",value:O,data:[O],disabled:!0}),R&&(0,a.jsx)(n.b,{color:"red",icon:(0,a.jsx)(x.IF3,{size:14}),children:(0,U.e$)(K)})]}),(0,a.jsxs)(i.K,{mx:"-xl",mb:"-xl",pb:"md",children:[(0,a.jsx)(o.i,{}),(0,a.jsxs)(c.Z,{justify:"flex-end",px:"xl",children:[(0,a.jsx)(d.z,{variant:"default",onClick:l,children:"Cancel"}),(0,a.jsx)(d.z,{disabled:q,onClick:()=>{D(),m.handleSubmit(async()=>{await f({orgId:e,clusterId:r,data:{...m.getValues(),dryRun:!0}}),await f({orgId:e,clusterId:r,data:{...m.getValues(),dryRun:!1}}),h()})()},"data-mp-event":"Alerts Subscription Subscriber Save Button Clicked",children:"Save"})]})]})]})},T=()=>(0,a.jsx)(h.c,{name:"email",label:"Email Address",placeholder:"Enter subscriber's email",rules:{required:"Please enter subscriber's email",pattern:{value:w.TH,message:"Please enter a valid email address"}}}),K=e=>!!/^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$/.test(e)||"The name must be 4-64 characters that can only include numbers, letters, and hyphens, and the first and last character must be a letter or number.",R=e=>!!/^[a-zA-Z0-9._-]{1,128}$/.test(e)||"The token must be 1-128 characters that can only include numbers, letters, hyphens, underscores and dots.",E=()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.c,{name:"name",label:"Name",placeholder:"Enter subscriber's name",rules:{required:"Please enter subscriber's name",validate:K}}),(0,a.jsx)(h.c,{name:"zoomUrl",label:"URL",placeholder:"Enter zoom webhook URL",rules:{required:"Please enter zoom webhook URL",maxLength:{value:255,message:"The URL must be less than or equal to 255 characters."}}}),(0,a.jsx)(h.c,{name:"zoomToken",label:"Token",placeholder:"Enter zoom token",rules:{required:"Please enter zoom token",validate:R}})]}),C=()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.c,{name:"name",label:"Name",placeholder:"Enter subscriber's name",rules:{required:"Please enter subscriber's name",validate:K}}),(0,a.jsx)(h.c,{name:"slackUrl",label:"URL",placeholder:"Enter slack webhook URL",rules:{required:"Please enter slack webhook URL",maxLength:{value:255,message:"The URL must be less than or equal to 255 characters."}}})]}),P=()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.c,{name:"name",label:"Name",placeholder:"Enter subscriber's name",rules:{required:"Please enter subscriber's name",validate:K}}),(0,a.jsx)(h.c,{name:"flashDutyUrl",label:"Webhook URL",placeholder:"Enter flashduty webhook URL",rules:{required:"Please enter flashduty webhook URL"}})]}),F=()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(h.c,{name:"name",label:"Name",placeholder:"Enter subscriber's name",rules:{required:"Please enter subscriber's name",validate:K}}),(0,a.jsx)(h.c,{name:"pagerDutyKey",label:"Integration Key",placeholder:"Enter pagerduty integration key",rules:{required:"Please enter pagerduty integration key"}})]}),$=()=>(0,a.jsxs)(i.K,{"data-testid":"webhook-subscriber-fields",children:[(0,a.jsx)(h.c,{name:"name",label:"Name",placeholder:"Enter subscriber's name",rules:{required:"Please enter subscriber's name",validate:K}}),(0,a.jsx)(h.c,{name:"webhookUrl",label:"Webhook URL",placeholder:"Enter webhook URL",rules:{required:"Please enter webhook URL",maxLength:{value:255,message:"The URL must be less than or equal to 255 characters."}}})]}),Z=()=>(0,a.jsxs)(i.K,{"data-testid":"lark-webhook-subscriber-fields",children:[(0,a.jsx)(h.c,{name:"name",label:"Name",placeholder:"Enter subscriber's name",rules:{required:"Please enter subscriber's name",validate:K}}),(0,a.jsx)(h.c,{name:"larkWebhookUrl",label:"Webhook URL",placeholder:"Enter Lark webhook URL",rules:{required:"Please enter Lark webhook URL",maxLength:{value:255,message:"The URL must be less than or equal to 255 characters."}}}),(0,a.jsx)(m.N,{name:"larkSecret",label:"Secret",type:"password",placeholder:"Enter Lark secret",rules:{required:"Please enter Lark secret"}})]})},468329:function(e,r,s){s.d(r,{p:()=>j});var a=s(552676),l=s(971798),i=s(125385),n=s(740521),t=s(775364),o=s(98172),c=s(712995),d=s(128177),u=s(359697),b=s(365582),h=s(78723),m=s(539692),x=s(834276),p=s(294859);let j=({opened:e,orgId:r,clusterId:s,subscriber:d,onCancel:j,onDelete:v})=>{let{mutateAsync:g,error:y,isLoading:U}=(0,m.qD)(),w=null==d?void 0:d.subscriberType;return(0,a.jsx)(l.u,{centered:!0,opened:e,size:640,onClose:j,title:"Unsubscribe",children:(0,a.jsx)(u.l,{actionsProps:{confirmText:"Unsubscribe",confirmProps:{variant:"light",color:"red","data-mp-event":"Alerts Subscription Unsubscribe Confirmed Button Clicked"},loading:U},onCancel:j,onSubmit:async()=>{var e;await g({orgId:r,clusterId:s,alertSubscriberId:null!==(e=String(null==d?void 0:d.id))&&void 0!==e?e:""}),v(),i.r.success(`${w===x.$.EMAIL?null==d?void 0:d.email:null==d?void 0:d.name} has unsubscribed the alerts.`)},children:(0,a.jsxs)(n.K,{children:[(0,a.jsxs)(t.x,{children:[(0,a.jsx)(k,{label:"Subscriber Type",value:(0,h.Z)(w)}),w===x.$.EMAIL&&(0,a.jsx)(k,{label:"Email Address",value:null==d?void 0:d.email}),w===x.$.SLACK&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{label:"Name",value:null==d?void 0:d.name}),(0,a.jsx)(k,{label:"URL",value:null==d?void 0:d.slackUrl})]}),w===x.$.ZOOM&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{label:"Name",value:null==d?void 0:d.name}),(0,a.jsx)(k,{label:"URL",value:null==d?void 0:d.zoomUrl})]}),w===x.$.WEBHOOK&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{label:"Name",value:null==d?void 0:d.name}),(0,a.jsx)(k,{label:"Webhook URL",value:null==d?void 0:d.webhookUrl})]}),w===x.$.LARK&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(k,{label:"Name",value:null==d?void 0:d.name}),(0,a.jsx)(k,{label:"Webhook URL",value:null==d?void 0:d.larkWebhookUrl}),(0,a.jsx)(k,{label:"Secret",value:null==d?void 0:d.larkSecret})]})]}),(0,a.jsx)(o.Z,{variant:"body-lg",children:"Confirm if you want to unsubscribe from this instance."}),!!y&&(0,a.jsx)(c.b,{color:"red",icon:(0,a.jsx)(b.IF3,{size:14}),children:(0,p.e$)(y)})]})})})},k=({label:e,value:r})=>(0,a.jsxs)(d.Z,{gap:"md",wrap:"nowrap",mih:36,children:[(0,a.jsx)(o.Z,{variant:"body-lg",miw:150,c:"carbon.7",children:e}),(0,a.jsx)(o.Z,{variant:"body-lg",sx:{wordBreak:"break-all"},children:r})]})},222365:function(e,r,s){s.r(r),s.d(r,{AlertsSubscriptionWrapper:()=>E,default:()=>C});var a=s(552676),l=s(767068),i=s(740521),n=s(144369),t=s(619102),o=s(366130),c=s(712995),d=s(775364),u=s(98172),b=s(365582),h=s(582473),m=s(275271),x=s(187371),p=s(213073),j=s(324178),k=s(822982),v=s(338219),g=s(466560),y=s(97388),U=s(196825),w=s(539692),S=s(834276),L=s(566249),z=s(976402),A=s(468329),f=s(530610);let T={[S.$.SLACK]:(0,a.jsx)(a.Fragment,{children:"Please refer to documentation to learn how to set up."}),[S.$.ZOOM]:(0,a.jsx)(a.Fragment,{children:"Please refer to documentation to learn how to set up."})},K=Object.values(S.$).map(e=>({label:v.Q[e],value:e,tip:T[e]})),R=(0,h.Pi)(({showAddSubscriber:e,closeAddSubscriber:r})=>{let{colors:s}=(0,l.rZ)(),{store:{tenantData:o}}=(0,L.Z)(),h=(0,y.wA)(),{isFetched:x,isLoading:k,refetch:v,data:g}=(0,w.gC)(o.id,h.tidbId),[U,S]=(0,m.useState)(null),T=(0,j.x)("TidbxAlertSubscriptionAction"),R=(0,m.useMemo)(()=>
1{if(g)return K.map(e=>{var r;return{...e,data:null===(r=g.alertSubscribers)||void 0===r?void 0:r.filter(r=>r.subscriberType===e.value)}})},[g]),E=null==R?void 0:R.every(e=>{var r;return!(null===(r=e.data)||void 0===r?void 0:r.length)});return(0,a.jsxs)(i.K,{gap:"xl",children:[x&&(0,a.jsx)(p.xS,{}),(0,a.jsxs)(c.b,{icon:(0,a.jsx)(b.Us8,{size:12}),color:"peacock",children:["By subscribing to email alerts, you can receive notifications for alerts from TiDB Cloud. Refer to"," ",(0,a.jsx)(n.e,{href:"https://docs.pingcap.com/tidbcloud/monitor-built-in-alerting",target:"_blank",rel:"noreferrer","data-mp-event":"Alert Subscription Documentation Link Clicked","data-mp-source":"Alerts",children:"TiDB Cloud Built-in Alerting"})," ","to learn what alerts come with TiDB Cloud and what actions you may want to take when you receive an alert."]}),(0,a.jsxs)(d.x,{children:[E&&(0,a.jsxs)(i.K,{justify:"center",align:"center",mih:512,children:[(0,a.jsx)(b.dSJ,{size:48,color:s.carbon[7]}),(0,a.jsx)(u.Z,{variant:"title-lg",fz:18,c:"carbon.7",children:"Get started by adding subscriber"}),(0,a.jsx)(u.Z,{variant:"body-lg",c:"carbon.7",w:300,sx:{textAlign:"center"},children:"Alert subscription is used to send system notifications to subscribers."})]}),(0,a.jsx)(i.K,{gap:"xl",children:null==R?void 0:R.map(e=>{var r;return(null===(r=e.data)||void 0===r?void 0:r.length)?(0,a.jsx)(t.Z,{p:"xl",children:(0,a.jsxs)(i.K,{children:[(0,a.jsxs)(i.K,{gap:4,children:[(0,a.jsx)(u.Z,{variant:"title-lg",children:e.label}),!!e.tip&&(0,a.jsx)(u.Z,{variant:"body-lg",c:"carbon.7",children:e.tip})]}),(0,a.jsx)(f.Z,{accessible:T,showActions:T,type:e.value,subscribers:e.data||[],unsubscribe:S,loading:k})]})}):(0,a.jsx)(a.Fragment,{})})})]}),(0,a.jsx)(z.A,{opened:e,orgId:o.id,clusterId:h.tidbId,isEssentialV2:h.computed.isEssentialV2,onCancel:r,onSuccess:()=>{r(),v()}}),(0,a.jsx)(A.p,{opened:!!U,orgId:o.id,clusterId:h.tidbId,subscriber:U,onCancel:()=>S(null),onDelete:()=>{S(null),v()}})]})}),E=(0,h.Pi)(()=>{let[e,r]=(0,m.useState)(!1),{store:{tenantData:s}}=(0,L.Z)(),l=(0,y.wA)(),{isLoading:i,data:t}=(0,w.gC)(s.id,l.tidbId),{data:c,isLoading:d}=(0,w.EB)(s.id,l.tidbId),b=((null==t?void 0:t.totalSize)||0)>=((null==c?void 0:c.maxAlertSubscribersCount)||0),h=i||d||b,p=(0,z.S)(s.id,l.tidbId),j=l.computed.ready,v=(0,g.C)(l.state),{accessible:S,reason:A}=(0,k.$)({id:"TidbxAlertSubscriptionAction"}),f=(0,m.useMemo)(()=>({id:"notReady",when:!j,content:`This feature is unavailable while the instance is ${v}.`}),[v,j]),T=(0,m.useMemo)(()=>({id:"quotaLimit",when:b,content:(0,a.jsxs)(u.Z,{variant:"body-md",c:"carbon.7",children:["The number of created alert subscribers has reached the limit.",p?(0,a.jsxs)(a.Fragment,{children:[" ","If needed, please contact"," ",(0,a.jsx)(n.e,{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-support",target:"_blank",rel:"noreferrer","data-mp-event":"Technical Support Documentation Link Clicked","data-mp-source":"Alerts",children:"technical support"})," ","to adjust the quota."]}):""]}),hoverCardProps:{width:400}}),[p,b]);return(0,a.jsx)(U.U,{title:"Alert Subscription",headerProps:{rightSection:(0,a.jsx)(x.u,{reasons:[A,f,T],children:(0,a.jsx)(o.z,{"data-mp-event":"Alerts Subscription Subscribe Button Clicked",size:"sm",onClick:()=>r(!0),disabled:!S||!j||h,children:"Add Subscriber"})})},children:(0,a.jsx)(R,{showAddSubscriber:e,closeAddSubscriber:()=>r(!1)})})}),C=E},530610:function(e,r,s){s.d(r,{Z:()=>w});var a=s(552676),l=s(105881),i=s(775364),n=s(586085),t=s(98172),o=s(185917),c=s(402899),d=s(797e3),u=s(365582),b=s(275271),h=s(834276),m=s(90206);let x=({width:e,withTooltip:r,children:s})=>(0,a.jsxs)(l.z,{disabled:!r,position:"bottom",withinPortal:!0,shadow:"md",children:[(0,a.jsx)(l.z.Target,{children:(0,a.jsx)(i.x,{w:e,children:(0,a.jsx)(n.x,{truncate:!0,children:s})})}),(0,a.jsx)(l.z.Dropdown,{children:(0,a.jsx)(n.x,{children:s})})]}),p=[{id:"email",header:"Subscriber Email Address",accessorKey:"email",size:700,accessorFn:e=>(0,a.jsx)(x,{width:700,children:e.email})}],j=[{id:"name",header:"Subscriber Name",accessorKey:"name",size:200,accessorFn:e=>(0,a.jsx)(x,{width:200,children:e.name})},{id:"url",header:"URL",accessorKey:"slackUrl",size:530,accessorFn:e=>(0,a.jsx)(x,{width:500,withTooltip:!0,children:e.slackUrl})}],k=[{id:"name",header:"Subscriber Name",accessorKey:"name",size:200,accessorFn:e=>(0,a.jsx)(x,{width:200,children:e.name})},{id:"url",header:"URL",accessorKey:"zoomUrl",size:530,accessorFn:e=>(0,a.jsx)(x,{width:500,withTooltip:!0,children:e.zoomUrl})}],v=[{id:"name",header:"Subscriber Name",accessorKey:"name",size:200,accessorFn:e=>(0,a.jsx)(x,{width:200,children:e.name})},{id:"url",header:"Webhook URL",accessorKey:"flashDutyUrl",size:530,accessorFn:e=>(0,a.jsx)(x,{width:500,withTooltip:!0,children:e.flashDutyUrl})}],g=[{id:"name",header:"Subscriber Name",accessorKey:"name",size:200,accessorFn:e=>(0,a.jsx)(x,{width:200,children:e.name})},{id:"integrationKey",header:"Integration Key",accessorKey:"pagerDutyKey",size:530,accessorFn:e=>(0,a.jsx)(x,{width:500,withTooltip:!0,children:e.pagerDutyKey})}],y=[{id:"name",header:"Subscriber Name",accessorKey:"name",size:200,accessorFn:e=>(0,a.jsx)(x,{width:200,children:e.name})},{id:"url",header:"Webhook URL",accessorKey:"webhookUrl",size:530,accessorFn:e=>(0,a.jsx)(x,{width:500,withTooltip:!0,children:e.webhookUrl})}],U=[{id:"name",header:"Subscriber Name",accessorKey:"name",size:160,accessorFn:e=>(0,a.jsx)(x,{width:160,children:e.name})},{id:"url",header:"Webhook URL",accessorKey:"larkWebhookUrl",size:390,accessorFn:e=>(0,a.jsx)(x,{width:360,withTooltip:!0,children:e.larkWebhookUrl})},{id:"secret",header:"Secret",accessorKey:"larkSecret",size:180,accessorFn:e=>(0,a.jsx)(x,{width:150,withTooltip:!0,children:e.larkSecret})}],w=({accessible:e,showActions:r=e,type:s,subscribers:l,unsubscribe:i,loading:n=!1,tidbEntityName:x="instance"})=>{let w=[{id:"scope",header:"Scope",size:200,accessorFn:()=>(0,a.jsxs)(t.Z,{variant:"body-lg",children:["All alerts in current ",x]})},{id:"actions",header:"",size:50,accessorFn:r=>(0,a.jsxs)(o.v,{position:"bottom",children:[(0,a.jsx)(o.v.Target,{children:(0,a.jsx)(c.A,{size:32,children:(0,a.jsx)(u.aQl,{size:16})})}),(0,a.jsx)(o.v.Dropdown,{children:(0,a.jsx)(o.v.Item,{disabled:!e,onClick:()=>{(0,m.fn)("Alerts Subscription Unsubscribe Modal Opened"),null==i||i(r)},children:"Unsubscribe"})})]})}],S=[...(0,b.useMemo)(()=>{switch(s){case h.$.SLACK:return j;case h.$.ZOOM:return k;case h.$.FLASHDUTY:return v;case h.$.PAGERDUTY:return g;case h.$.WEBHOOK:return y;case h.$.LARK:return U;default:return p}},[s]),...w];return(0,a.jsx)(d.Q,{columns:S,data:l,state:{isLoading:n,columnVisibility:{actions:r}}})}}}]);

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.