PageSourceSearch

https://tidbcloud.com/static/js/async/1641.e4509274.js

js tidbcloud.com collected 2026-10-02 07:06:23 UTC 123,487 bytes, 1 lines download raw bytes

1"use strict";(globalThis.webpackChunktidb_cloud_ui=globalThis.webpackChunktidb_cloud_ui||[]).push([["1641"],{353512:function(e,t,l){l.d(t,{Z:()=>i});let i={fileName:"fileName-S1dFQ6"}},356383:function(e,t,l){e.exports=l.p+"static/image/azure-step1.4bfd2827.png"},639183:function(e,t,l){e.exports=l.p+"static/image/azure-step2.b3040f77.png"},585125:function(e,t,l){l.d(t,{i:()=>o});var i=l(356186),a=l(28143),n=l(348980),r=l(566249);let o=e=>{let t={"node-group":n.Fn.DedicatedArch2024Exp,other:""}[e],{store:{lastVisitLocation:{orgId:l,projectId:o}}}=(0,r.Z)(),s=(0,i.pYk)(l,void 0,{query:{select:e=>{var l;return null==e?void 0:null===(l=e.exp_names)||void 0===l?void 0:l.includes(t)},refetchOnWindowFocus:!1,refetchOnMount:!1}}),d=(0,a.S1z)(l,o,{query:{select:e=>null==e?void 0:e.three_arch,refetchOnWindowFocus:!1,refetchOnMount:!1}});return{expEnabled:!!(s.data&&d.data),isLoading:s.isLoading||d.isLoading,isFetching:s.isFetching||d.isFetching,isRefetching:s.isRefetching||d.isRefetching}}},102806:function(e,t,l){l.d(t,{l:()=>r});var i=l(275271),a=l(822982),n=l(920501);let r=(e,t)=>{let l=(0,n.NQ)(e),r=e.computed.isEssential&&"ClusterAuditSwitch"===t?{id:"TidbxDBAuditLogSwitch",scopeProps:{tidbId:e.id}}:e.computed.isEssential&&("ClusterAuditFilterCreation"===t||"ClusterAuditFilterDelete"===t)?{id:"TidbxDBAuditLogFilterRulesActions",scopeProps:{tidbId:e.id}}:{id:t},{reason:o,accessible:s}=(0,a.$)(r);return{accessDeniedReason:o,invalidReason:(0,i.useMemo)(()=>{var t;return{id:"clusterInvalid",when:l,content:`The function is unavailable in a ${null===(t=e.state)||void 0===t?void 0:t.toLowerCase()} state.`}},[e.state,l]),accessible:s,isInvalid:l}}},509203:function(e,t,l){l.d(t,{$:()=>a});var i=l(254023);let a=()=>{let e=[],t=l=>{l.forEach(l=>{e.push(l.value),l.children&&t(l.children)})};return t(i.GM),e}},900361:function(e,t,l){l.d(t,{In:()=>s,K3:()=>d,Ur:()=>r,_L:()=>n,kH:()=>c,mz:()=>o});var i=l(148397),a=l(712853);let n=[{label:"1 minute",value:"60"},{label:"5 minutes",value:"300"},{label:"10 minutes",value:"600"},{label:"15 minutes",value:"900"},{label:"20 minutes",value:"1200"},{label:"30 minutes",value:"1800"},{label:"45 minutes",value:"2700"}],r=[{label:"Disabled",value:"0"}],o=[{label:"1 hour",value:"3600"},{label:"2 hours",value:"7200"},{label:"3 hours",value:"10800"},{label:"5 hours",value:"18000"},{label:"8 hours",value:"28800"},{label:"10 hours",value:"36000"},{label:"12 hours",value:"43200"},{label:"16 hours",value:"57600"},{label:"20 hours",value:"72000"},{label:"1 day",value:"86400"},{label:"2 days",value:"172800"},{label:"3 days",value:"259200"},{label:"4 days",value:"345600"},{label:"5 days",value:"432000"},{label:"6 days",value:"518400"},{label:"7 days",value:"604800"},{label:"10 days",value:"864000"},{label:"14 days",value:"1209600"},{label:"21 days",value:"1814400"},{label:"30 days",value:"2592000"}],s=[{value:"5",label:"5 MiB"},{value:"10",label:"10 MiB"}];[i.y.TEXT,i.y.JSON].map(e=>({label:e,value:e}));let d=e=>{let{version:t}=e,l=(0,a.yC)(t,"7.5.6","<"),i=(0,a.yC)(t,"8.1.0",">=")&&(0,a.yC)(t,"8.1.2","<="),n=(0,a.yC)(t,"8.5.0",">=")&&(0,a.yC)(t,"8.5.2","<");return l||i||n},c=e=>{let t=d(e);return{format:i.y.TEXT,rotationPolicy:{maxAgeSecond:`${t?0:86400}`,maxSizeMib:"10"},unredacted:!1,redacted:!0}}},379281:function(e,t,l){l.d(t,{$:()=>a});var i=l(254023);let a=()=>{let e=[],t=l=>{l.forEach(l=>{e.push(l.value),l.children&&t(l.children)})};return t(i.GM),e}},448758:function(e,t,l){l.d(t,{k:()=>n,r:()=>a});var i=l(275271);let a=(0,i.createContext)(null),n=()=>{let e=(0,i.useContext)(a);if(null===e)throw Error("dedicated DBAuditLogContext must not be null");return e}},59837:function(e,t,l){l.d(t,{x:()=>n,y:()=>a});var i=l(275271);let a=(0,i.createContext)(null),n=()=>{let e=(0,i.useContext)(a);if(null===e)throw Error("starter DBAuditLogContext must not be null");return e}},254023:function(e,t,l){l.d(t,{GM:()=>n,Nr:()=>a});var i,a=((i={}).Initial="Initial",i.Config="Config",i.Settings="Settings",i);let n=[{label:"CONNECTION",value:"CONNECTION",isLeaf:!1,children:[{label:"CONNECT",value:"CONNECT",isLeaf:!0},{label:"DISCONNECT",value:"DISCONNECT",isLeaf:!0},{label:"CHANGE_USER",value:"CHANGE_USER",isLeaf:!0}]}
1,{label:"QUERY",value:"QUERY",isLeaf:!1,children:[{label:"TRANSACTION",value:"TRANSACTION",isLeaf:!0},{label:"EXECUTE",value:"EXECUTE",isLeaf:!0},{label:"QUERY_DML",value:"QUERY_DML",isLeaf:!1,children:[{label:"INSERT",value:"INSERT",isLeaf:!0},{label:"REPLACE",value:"REPLACE",isLeaf:!0},{label:"UPDATE",value:"UPDATE",isLeaf:!0},{label:"DELETE",value:"DELETE",isLeaf:!0},{label:"LOAD_DATA",value:"LOAD_DATA",isLeaf:!0}]},{label:"SELECT",value:"SELECT",isLeaf:!0},{label:"QUERY_DDL",value:"QUERY_DDL",isLeaf:!0}]}]},187758:function(e,t,l){l.d(t,{AN:()=>b,C9:()=>m,L3:()=>v,eA:()=>x,kT:()=>j});var i=l(672170),a=l(996928),n=l(247191),r=l(379809),o=l(307456),s=l(275271),d=l(356186),c=l(199436),u=l(584110),g=l(565818),h=l(566249),p=l(420313);function v(e,t){let{store:{lastVisitLocation:{orgId:l,projectId:a}}}=(0,h.Z)(),[n,r]=(0,s.useState)([]),[o,c]=(0,s.useState)(!1),{mutateAsync:u,isLoading:g,isError:p,error:v,isSuccess:x}=(0,d._xL)(),m=(0,i.Z)(async()=>{var i,n;if(l&&a){c(!1);try{let{cloud_providers:n=[]}=await u({orgId:l,projectId:a,data:{is_dev_tier:(null==e?void 0:e.tier)==="serverless"}});c(!0),r(n),null==t||null===(i=t.onSuccess)||void 0===i||i.call(t,n)}catch{c(!0),r([]),null==t||null===(n=t.onError)||void 0===n||n.call(t)}}});return(0,s.useEffect)(()=>{e.enabled&&m()},[m,e.enabled]),{providers:n,isLoading:g,isError:p,error:v,isSuccess:x,isFetched:o}}function x(){let{store:{tenantData:{id:e},activeProjectId:t}}
1=(0,h.Z)(),[l,a]=(0,s.useState)(""),{mutateAsync:n,isLoading:r,isError:o,error:c,isSuccess:u}=(0,d.dPU)(),g=(0,i.Z)(async()=>{if(e&&t)try{let{name:l=""}=await n({orgId:e,projectId:t});a(l)}catch{a("")}});return(0,s.useEffect)(()=>{g()},[g]),{name:l,reMutate:g,fetch:()=>n({orgId:e,projectId:t}),isLoading:r,isError:o,error:c,isSuccess:u}}function m(e,t){let{store:{tenantData:{id:l},activeProjectId:o}}=(0,h.Z)(),[d,u]=(0,s.useState)([]),[g,v]=(0,s.useState)(!1),{data:x,isLoading:m,isError:b,error:j}=(0,c.AT)((0,p.gd)(e.provider,e.region),{projectId:o,orgId:l,pageSize:99,tidbVersion:e.tidbVersion},{query:{enabled:!!e.region,refetchOnWindowFocus:!1}}),f=(0,i.Z)(async()=>{var i,a;let s=[];if(l&&o&&e.provider&&e.region){v(!1);try{s=(0,n.Z)((0,r.Z)(null==x?void 0:x.nodeSpecs,"componentType"),(e,t)=>({componentType:t,nodeSpecs:e.map(e=>({...e,name:e.nodeSpecKey}))})),u(s),null==t||null===(i=t.onSuccess)||void 0===i||i.call(t,s),v(!0)}catch{u([]),v(!0),null==t||null===(a=t.onError)||void 0===a||a.call(t)}}});return(0,a.Z)(()=>{f()},[f,e.provider,e.region,x],{wait:500}),{nodeProfiles:d,refetch:f,isLoading:m,isError:b,error:j,isFetched:g}}let b=e=>{if(!e)return"-";switch(e){case u.Q.Standard:return"Standard";case u.Q.Performance:return"Performance";default:return e}},j=(e,t,l)=>{var i;let a=[u.Q.Standard,u.Q.Performance,u.Q.Basic,u.Q.Plus];return null!==(i=e.sort((e,t)=>a.indexOf(e)-a.indexOf(t)).map(e=>{let i="",a=!1;switch(e){case u.Q.Basic:t===g.k.TIKV?i="A general-purpose storage type which provides lower performance than the Standard Type.":t===g.k.TIFLASH&&(i="A general-purpose storage type which is well-suited for the majority of workloads."),a=!(0,o.Z)(l)&&l!==u.Q.Plus&&l!==e;break;case u.Q.Standard:i="Well-suited for the majority of workloads due to its balanced performance and cost ratio.",a=!(0,o.Z)(l)&&l!==u.Q.Performance&&l!==e;break;case u.Q.Performance:i="Offers greater performance and stability.",a=!(0,o.Z)(l)&&l!==u.Q.Standard&&l!==e;break;case u.Q.Plus:i="Offers highest performance and unwavering stability.",a=!(0,o.Z)(l)&&l!==u.Q.Basic&&l!==e}return{label:b(e),value:e,desc:i,disabled:a}}))&&void 0!==i?i:[]}},12537:function(e,t,l){l.d(t,{h:()=>i});let i={CUSTOMER:"CUSTOMER",PINGCAP:"PINGCAP"}},565818:function(e,t,l){l.d(t,{k:()=>i});let i={TIKV:"TIKV",TIDB:"TIDB",TIFLASH:"TIFLASH",PD:"PD",TIPROXY:"TIPROXY"}},148397:function(e,t,l){l.d(t,{y:()=>i});let i={TEXT:"TEXT",JSON:"JSON"}},705374:function(e,t,l){l.d(t,{$_:()=>k,AM:()=>d,Bi:()=>g,Rf:()=>b,Sl:()=>n,ge:()=>A,h:()=>x,nQ:()=>m,pv:()=>v,s$:()=>r,tC:()=>o,vv:()=>j,vx:()=>C});var i=l(381674),a=l(308058);let n=(e,t,l,i,n)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/config`,method:"get",signal:n},{_metadata:{operationName:"databaseAuditLogServiceGetAuditLogConfig",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/config",swaggerName:"essential.swagger.json"},...i}),r=(e,t,l)=>[`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/config`],o=(e,t,l,a)=>{var o;let{query:s,request:d}=null!=a?a:{},c=null!==(o=null==s?void 0:s.queryKey)&&void 0!==o?o:r(e,t,l),u=(0,i.useQuery)({queryKey:c,queryFn:({signal:i})=>n(e,t,l,d,i),enabled:!!(e&&t&&l),...s});return u.queryKey=c,u},s=(e,t,l,i,n)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/config`,method:"patch",headers:{"Content-Type":"application/json"},data:i},{_metadata:{operationName:"databaseAuditLogServiceUpdateAuditLogConfig",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/config",swaggerName:"essential.swagger.json"},...n}),d=e=>{let{mutation:t,request:l}=null!=e?e:{};return(0,i.useMutation)(e=>{let{orgId:t,projectId:i,clusterId:a,data:n}=null!=e?e:{};return s(t,i,a,n,l)},t)},c=(e,t,l,i,n)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/config:getCloudStorageProfile`,method:"get",signal:n},{_metadata:{operationName:"databaseAuditLogServiceGetCloudStorageProfile",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/config:getCloudStorageProfile",swaggerName:"essential.swagger.json"},...i}),u=(e,t,l)=>[`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/config:getCloudStorageProfile`],g=(e,t,l,a)=>{var n;let{query:r,request:o}=null!=a?a:{},s=null!==(n=null==r?void 0:r.queryKey)&&void 0!==n?n:u(e,t,l),d=(0,i.useQuery)({queryKey:s,queryFn:({signal:i})=>c(e,t,l,o,i),enabled:!!(e&&t&&l),...r});return d.queryKey=s,d},h=(e,t,l,i,n,r)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/files`,method:"get",params:i,signal:r},{_metadata:{operationName:"databaseAuditLogServiceListAuditLogFiles",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/files",swaggerName:"essential.swagger.json"},...n}),p=(e,t,l,i)=>[`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/files`,...i?[i]:[]],v=(e,t,l,a,n)=>{var r;let{query:o,request:s}=null!=n?n:{},d=null!==(r=null==o?void 0:o.queryKey)&&void 0!==r?r:p(e,t,l,a),c=(0,i.useQuery)({queryKey:d,queryFn:({signal:i})=>h(e,t,l,a,s,i),enabled:!!(e&&t&&l),...o});return c.queryKey=d,c},x=(e,t,l,i,n)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/files:download`,method:"post",headers:{"Content-Type":"application/json"},data:i},{_metadata:{operationName:"databaseAuditLogServiceDownloadAuditLogFiles",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/files:download",swaggerName:"essential.swagger.json"},...n}),m=(e,t,l,i,n,r)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/filterRules`,method:"get",params:i,signal:r},{_metadata:{operationName:"databaseAuditLogServiceListAuditLogFilterRules",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/filterRules",swaggerName:"essential.swagger.json"},...n}),b=(e,t,l,i)=>[`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/filterRules`,...i?[i]:[]],j=(e,t,l,a,n)=>{var r;let{query:o,request:s}=null!=n?n:{},d=null!==(r=null==o?void 0:o.queryKey)&&void 0!==r?r:b(e,t,l,a),c=(0,i.useQuery)({queryKey:d,queryFn:({signal:i})=>m(e,t,l,a,s,i),enabled:!!(e&&t&&l),...o});return c.queryKey=d,c},f=(e,t,l,i,n)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/filterRules`,method:"post",headers:{"Content-Type":"application/json"},data:i},{_metadata:{operationName:"databaseAuditLogServiceCreateAuditLogFilterRule",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/filterRules",swaggerName:"essential.swagger.json"},...n}),C=e=>{let{mutation:t,request:l}=null!=e?e:{};return(0,i.useMutation)(e=>{let{orgId:t,projectId:i,clusterId:a,data:n}=null!=e?e:{};return f(t,i,a,n,l)},t)},y=(e,t,l,i,n)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/filterRules/${i}`,method:"delete"},{_metadata:{operationName:"databaseAuditLogServiceDeleteAuditLogFilterRule",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/filterRules/{filter_rule_id}",swaggerName:"essential.swagger.json"},...n}),k=e=>{let{mutation:t,request:l}=null!=e?e:{};return(0,i.useMutation)(e=>{let{orgId:t,projectId:i,clusterId:a,filterRuleId:n}=null!=e?e:{};return y(t,i,a,n,l)},t)},S=(e,t,l,i,n,r)=>(0,a.zq)({url:`/api/v1/serverless/orgs/${e}/projects/${t}/clusters/${l}/auditLog/filterRules/${i}`,method:"patch",headers:{"Content-Type":"application/json"},data:n},{_metadata:{operationName:"databaseAuditLogServiceUpdateAuditLogFilterRule",pathRoute:"/api/v1/serverless/orgs/{org_id}/projects/{project_id}/clusters/{cluster_id}/auditLog/filterRules/{filter_rule_id}",swaggerName:"essential.swagger.json"},...r}),A=e=>{let{mutation:t,request:l}=null!=e?e:{};return(0,i.useMutation)(e=>{let{orgId:t,projectId:i,clusterId:a,filterRuleId:n,data:r}=null!=e?e:{};return S(t,i,a,n,r,l)},t)}},786796:function(e,t,l){l.d(t,{X:()=>i});let i={SAS_TOKEN:"SAS_TOKEN"}},243954:function(e,t,l){l.d(t,{r:()=>i});let i={TIDB_CLOUD:"TIDB_CLOUD",S3:"S3",GCS:"GCS",AZURE_BLOB:"AZURE_BLOB",OSS:"OSS"}},324939:function(e,t,l){l.d(t,{Q:()=>i});let i={SERVICE_ACCOUNT_KEY:"SERVICE_ACCOUNT_KEY"}},558761:function(e,t,l){l.d(t,{p:()=>i});let i={ACCESS_KEY:"ACCESS_KEY",ROLE_ARN:"ROLE_ARN"}},147215:function(e,t,l){l.d(t,{I:()=>i});let i={ROLE_ARN:"ROLE_ARN",ACCESS_KEY:"ACCESS_KEY"}},142611:function(e,t,l){l.d(t,{gc:()=>i.g,pJ:()=>i.p}),l(214462);var i=l(82276)},734880:function(e,t,l){l.d(t,{gc:()=>i.gc,pJ:()=>i.pJ});var i=l(142611)},701134:function(e,t,l){l.d(t,{gc:()=>i.gc,pJ:()=>i.pJ});var i=l(734880)},168553:function(e,t,l){l.d(t,{P:()=>m});var i=l(552676),a=l(971798),n=l(740521),r=l(98172),o=l(829860),s=l(190439),d=l(128177),c=l(366130),u=l(825539),g=l(158483),h=l(275271),p=l(469987),v=l(356383),x=l(639183);let m=({name:e,label:t,placeholder:l,docLink:m,templateLink:b,rules:j})=>{let[f,{toggle:C,close:y}]=(0,g.q)(),[k,S]=(0,h.useState)(""),{setValue:A}=(0,p.Gc)();return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(u.c,{name:e,label:t||"SAS Token",placeholder:l||"Enter a SAS token that provides access to the storage resource",inputWrapperOrder:["label","input","description","error"],rules:j,description:(0,i.jsxs)("span",{children:["Don't have a SAS Token?"," ",(0,i.jsx)("a",{onClick:C,target:"_blank",rel:"noopener noreferrer",children:"Click here to create a new one with Azure ARM template."})]})}),(0,i.jsx)(a.u,{centered:!0,title:"Generate New SAS Token via ARM Template Deployment",opened:f,onClose:y,size:732,children:(0,i.jsxs)(n.K,{children:[(0,i.jsxs)(r.Z,{variant:"body-lg",children:[(0,i.jsx)("a",{href:b,target:"_blank",rel:"noopener noreferrer",children:"Click to open the Azure Portal with the pre-configured ARM template"}),", fill in the necessary details in the Azure Portal, like Subscription and Resource Group, and click ‘Review + create’."]}),(0,i.jsx)(o.E,{src:v}),(0,i.jsx)(r.Z,{variant:"body-lg",children:"Review and click ‘Create’ to proceed with the deployment. Once it completes, navigate to the Outputs section."}),(0,i.jsx)(o.E,{src:x}),(0,i.jsxs)("div",{children:[(0,i.jsx)(r.Z,{variant:"body-lg",mb:8,children:"Copy the generated SAS token (accountSas) and paste into the field below."}),(0,i.jsx)(s.o,{placeholder:"Paste the SAS token value here",value:k,onChange:e=>S(e.target.value)})]}),(0,i.jsxs)(d.Z,{justify:"space-between",children:[(0,i.jsxs)(r.Z,{variant:"body-lg",children:["Having trouble?"," ",(0,i.jsx)("a",{href:m,target:"_blank",rel:"noopener noreferrer",children:"Create a SAS token manually."})]}),(0,i.jsxs)(d.Z,{children:[(0,i.jsx)(c.z,{variant:"default",onClick:y,children:"Cancel"}),(0,i.jsx)(c.z,{onClick:()=>{A(e,k),y()},disabled:!k,children:"Confirm"})]})]})]})})]})}},969416:function(e,t,l){l.d(t,{D:()=>g});var i=l(552676),a=l(701134),n=l(775364),r=l(98172),o=l(74652),s=l(128177),d=l(402899),c=l(365582),u=l(469987);let g=({name:e,label:t})=>(0,i.jsx)(u.Qr,{name:e,render:({field:e})=>{var l,u;return(0,i.jsxs)(n.x,{children:[(0,i.jsx)(r.Z,{variant:"label-lg",mb:8,children:t}),(0,i.jsx)(o.f,{multiple:!1,onDrop:async t=>{let l=await (0,a.pJ)(t[0]);e.onChange({content:window.btoa(l),name:t[0].name})},sx:t=>{var l;return{backgroundColor:t.colors.gray[2],display:(null===(l=e.value)||void 0===l?void 0:l.content)?"none":"block",border:`1px dashed ${t.colors.gray[7]}`,"& .mantine-Text-root":{color:t.colors.carbon[7]},"&:hover":{backgroundColor:t.colors.gray[2]},"&[data-accept]":{backgroundColor:t.colors.peacock[1],borderColor:t.colors.peacock[7],"& .mantine-Text-root":{color:t.colors.peacock[7]}},"&[data-reject]":{backgroundColor:t.colors.red[1],borderColor:t.colors.red[7],"& .mantine-Text-root":{color:t.colors.red[7]}}}},py:24,children:(0,i.jsxs)(s.Z,{children:[(0,i.jsx)(o.f.Idle,{children:(0,i.jsx)(c.HNW,{size:32,c:"carbon.7"})}),(0,i.jsx)(o.f.Accept,{children:(0,i.jsx)(c.Bu,{size:32,c:"peacock.7"})}),(0,i.jsx)(o.f.Reject,{children:(0,i.jsx)(c.IF3,{size:32,c:"red.7"})}),(0,i.jsx)(r.Z,{fw:700,fz:16,children:"Drag and drop or click and select to upload the Service Account Key."})]})}),!(null===(l=e.value)||void 0===l?void 0:l.content)&&(0,i.jsxs)(r.Z,{variant:"body-sm",c:"carbon.7",children:["Not sure what is Service Account Key?"," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/configure-external-storage-access/#configure-gcs-access",target:"_blank",rel:"noopener noreferrer",children:"Click here to learn how to get one."})]}),(null===(u=e.value)||void 0===u?void 0:u.content)&&(0,i.jsxs)(s.Z,{children:[(0,i.jsxs)(s.Z,{gap:8,children:[(0,i.jsx)(c.HNW,{size:16}),(0,i.jsx)(r.Z,{variant:"body-lg",children:e.value.name})]}),(0,i.jsx)(d.A,{variant:"transparent",onClick:()=>e.onChange({content:"",name:""}),children:(0,i.jsx)(c.Q4p,{size:16})})]})]})}})},980746:function(e,t,l){l.d(t,{y:()=>m});var i=l(552676),a=l(619102),n=l(128177),r=l(740521),o=l(98172),s=l(915030),d=l(156102),c=l(366130),u=l(185917),g=l(775364),h=l(287096),p=l(365582),v=l(187371),x=l(102806);let m=({cluster:e,loading:t,enabled:l,docLink:m,onSettingClick:b,onConfigureClick:j,onDisableClick:f,onEnableClick:C})=>{let{accessDeniedReason:y,invalidReason:k,isInvalid:S,accessible:A}=(0,x.l)(e,"ClusterAuditSwitch");return(0,i.jsx)(a.Z,{p:"xl",children:(0,i.jsxs)(n.Z,{justify:"space-between",gap:48,children:[(0,i.jsxs)(r.K,{gap:4,sx:{flex:1},children:[(0,i.jsxs)(n.Z,{gap:"md",children:[(0,i.jsx)(o.Z,{variant:"title-lg",children:"Database Audit Logging"}),!t&&(0,i.jsx)(h.k,{color:l?"green":"gray",children:l?"Enabled":"Disabled"})]}),(0,i.jsx)(s.k,{gap:4,children:(0,i.jsxs)(o.Z,{variant:"body-lg",c:"carbon.7",children:["Track various behaviors and operations of database users."," ",(0,i.jsx)("a",{href:null!=m?m:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing",target:"_blank",rel:"noreferrer","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log","data-mp-content":"about user access and history",children:"Learn more"}),"."]})})]}),t&&(0,i.jsx)(d.a,{size:"sm"}),!t&&(0,i.jsxs)(i.Fragment,{children:[l&&(0,i.jsxs)(s.k,{gap:8,children:[(0,i.jsx)(v.u,{reasons:[y,k],children:({matched:e})=>(0,i.jsx)(c.z,{size:"sm",variant:"outline","data-mp-event":"DB Audit Logging Edit Config Button Clicked","data-testid":"audit-log-settings",onClick:b,disabled:e,children:"Settings"})}),(0,i.jsxs)(u.v,{children:[(0,i.jsx)(u.v.Target,{children:(0,i.jsx)(c.z,{variant:"outline",size:"sm","data-testid":"audit-log-actions",children:(0,i.jsx)(g.x,{c:"carbon.8",component:p.aQl,size:20})})}),(0,i.jsxs)(u.v.Dropdown,{children:[(0,i.jsx)(u.v.Item,{"data-mp-event":"DB Audit Logging Storage Configuration Button Clicked","data-testid":"audit-log-storage-configuration",disabled:S||!A,onClick:j,children:"Storage Configuration"}),(0,i.jsx)(u.v.Item,{c:"red","data-mp-event":"DB Audit Logging Disable Config Button Click","data-testid":"audit-log-disable",disabled:S||!A,onClick:f,children:"Disable"})]})]})]}),!l&&(0,i.jsx)(v.u,{reasons:[y,k],children:({matched:e})=>(0,i.jsx)(c.z,{size:"sm",disabled:e,"data-mp-event":"DB Audit Logging Enable Entrance Button Clicked","data-testid":"audit-log-enable",onClick:C,children:"Enable"})})]})]})})}},432999:function(e,t,l){l.d(t,{D:()=>s});var i=l(552676),a=l(971798),n=l(98172),r=l(915030),o=l(366130);let s=(0,l(582473).Pi)(({opened:e,loading:t,plan:l,onClose:s,disableHandler:d})=>(0,i.jsxs)(a.u,{opened:e,centered:!0,title:"Disable Database Audit Logging",size:480,trapFocus:!1,onClose:s,children:[(0,i.jsx)(n.Z,{mb:32,variant:"body-lg",children:"When disabled, the database will no longer generate audit log files."}),(0,i.jsxs)(r.k,{justify:"flex-end",gap:16,children:[(0,i.jsx)(o.z,{variant:"outline","data-mp-event":"Disable DB Audit Logging Cancel Button Clicked",onClick:s,children:"Cancel"}),(0,i.jsx)(o.z,{variant:"outline",color:"red",loading:t,"data-mp-event":"Disable DB Audit Logging Confirm Button Clicked","data-mp-plan":l,onClick:d,children:"Disable"})]})]}))},210932:function(e,t,l){l.d(t,{Z:()=>o});var i=l(552676),a=l(740521),n=l(98172),r=l(775364);let o=({docLink:e})=>(0,i.jsxs)(a.K,{gap:4,children:[(0,i.jsx)(n.Z,{variant:"title-lg",children:"Audit Log Access"}),(0,i.jsxs)(r.x,{children:[(0,i.jsx)(n.Z,{variant:"body-lg",mr:4,compone
1nt:"span",children:"Audit logs are stored in TiDB Cloud. You can download log files based on their generation time."}),(0,i.jsx)("a",{href:null!=e?e:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing/#view-audit-logs",target:"_blank",rel:"noreferrer","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log Access","data-mp-content":"about audit logs stored in TiDB Cloud",children:"Learn more"}),"."]})]})},860990:function(e,t,l){l.d(t,{Z:()=>g,e:()=>u});var i=l(552676),a=l(915030),n=l(775364),r=l(98172),o=l(712995),s=l(98455),d=l(365582),c=l(469987);let u=({redactedName:e,tips:t,entityName:l="cluster"})=>{let{watch:u}=(0,c.Gc)(),g=u(e);return(0,i.jsxs)(a.k,{justify:"space-between",align:"center",gap:32,children:[(0,i.jsxs)(n.x,{children:[(0,i.jsx)(r.Z,{variant:"label-lg",children:"Log Redaction"}),(0,i.jsx)(r.Z,{variant:"body-lg",mt:4,children:t||`Sensitive information contained in SQL text in the ${l} log will be replaced by "?".`}),!g&&(0,i.jsx)(o.b,{color:"yellow",icon:(0,i.jsx)(d.DpU,{size:16}),mt:8,children:"Database audit log redaction is currently disabled, resulting in log files pushed to the user's cloud storage service containing sensitive information. This configuration is not recommended due to potential security risks."})]}),(0,i.jsx)(s.j,{name:e})]})},g=u},594755:function(e,t,l){l.d(t,{e:()=>h});var i=l(552676),a=l(775364),n=l(98172),r=l(915030),o=l(150288),s=l(866981),d=l(490764),c=l(275271),u=l(469987),g=l(860990);let h=({maxSizeName:e,maxSizeOptions:t,maxSizeNumber:l,minSizeNumber:h,maxAgeSecondName:p,maxAgeSecondsOptions:v,maxAgeSecondsNumber:x,minAgeSecondsNumber:m,redactedName:b,fileSizeMode:j,rotationMode:f,entityName:C="cluster"})=>{let{setValue:y}=(0,u.Gc)(),k=e=>({root:{flex:1},section:{'&[data-position="left"]':{color:e.colors.carbon[9],borderRight:`1px solid ${e.colors.carbon[4]}`,backgroundColor:e.colors.carbon[2],marginRight:10}},input:{flex:1}});return(0,c.useEffect)(()=>{y(e,h)},[h]),(0,i.jsxs)(a.x,{children:[(0,i.jsx)(n.Z,{variant:"label-lg",mb:8,children:"Log File Rotation"}),(0,i.jsxs)(r.k,{gap:16,children:["input"===j?(0,i.jsx)(s.$,{name:e,suffix:" MiB",min:h,max:l,rules:{required:"Required",min:{value:null!=h?h:0,message:`File Size Limit should be greater than ${h}`},max:{value:null!=l?l:0,message:`File Size Limit should be less than ${l}`},validate:e=>e%1==0||"File Size Limit should be integer"},leftAddon:"File Size Limit"}):(0,i.jsx)(d.i,{name:e,leftSectionWidth:112,leftSection:"File Size Limit",styles:e=>({...k(e),input:{paddingLeft:126}}),data:t}),"input"===f?(0,i.jsx)(s.$,{name:p,suffix:" minutes",min:m,max:x,step:10,rules:{required:"Required",min:{value:null!=m?m:0,message:`Rotation Interval should be greater than ${m}`},max:{value:null!=x?x:0,message:`Rotation Interval should be less than ${x}`},validate:e=>e%1==0||"Rotation Interval should be integer"},leftAddon:"Rotation Interval"}):(0,i.jsx)(d.i,{name:p,leftSectionWidth:132,leftSection:"Rotation Interval",data:v,styles:e=>({...k(e),input:{paddingLeft:146}})})]}),(0,i.jsx)(o.i,{mx:-24,my:24}),(0,i.jsx)(g.Z,{redactedName:b,entityName:C})]})}},241852:function(e,t,l){l.d(t,{Z:()=>r});var i=l(552676),a=l(712995),n=l(365582);let r=()=>(0,i.jsx)(a.b,{color:"peacock",icon:(0,i.jsx)(n.Us8,{size:12}),children:"When you store audit logs in TiDB Cloud, it will incur additional costs. This feature is currently in the trial stage and you are not charged for the time being."})},704790:function(e,t,l){l.d(t,{j:()=>o});var i=l(552676),a=l(65954),n=l(98172),r=l(827547);let o=({accessTypeList:e})=>(0,i.jsx)(a.U,{chevronPosition:"left",defaultValue:"",styles:{item:{border:"none"},control:{padding:8,paddingLeft:0,"&:hover":{backgroundColor:"transparent"}},chevron:{marginLeft:-6}},children:(0,i.jsxs)(a.U.Item,{value:"total",children:[(0,i.jsx)(a.U.Control,{children:(0,i.jsxs)(n.Z,{variant:"body-lg",children:["Total: ",e.length]})}),(0,i.jsx)(a.U.Panel,{children:e.map((e,t)=>(0,i.jsxs)(n.Z,{variant:"body-lg",sx:{textIndent:"1rem"},children:[t+1,". ",(0,r.Z)(e)]},e+t.toString()))})]})})},854489:function(e,t,l){l.d(t,{U:()=>d,p:()=>s});var i=l(552676),a=l(827547),n=l(275271),r=l(469987),o=l(941880);let s=["AlterTable","AnalyzeTable","Begin","Change","Commit","CreateDatabase","CreateIndex","CreateTable","CreateView","CreateUser","Delete","DropDatabase","DropIndex","DropView","DropTable","DescTable","ExplainAnalyzeSQL","ExplainSQL","Replace","Insert","LoadData","RollBack","Select","Set","Show","TruncateTable","Update","Grant","Revoke","Deallocate","Execute","Prepare","Use","CreateBinding","IndexAdvise","DropBinding","Trace","Shutdown","other"],d=()=>{let{control:e,setValue:t,watch:l,formState:d,getFieldState:c}=(0,r.Gc)(),{error:u}=c("accessType",d),g=l("accessType"),h=[{label:"All",value:"*"}].concat(s.map(e=>({label:(0,a.Z)(e),value:e,disabled:1===g.length&&"*"===g[0]})));return(0,n.useEffect)(()=>{1!==g.length&&g.includes("*")&&t("accessType",["*"])},[g,t]),(0,i.jsx)(r.Qr,{name:"accessType",control:e,rules:{required:"Required"},render:({field:e})=>{let{value:t,onChange:l,...a}=e;return(0,i.jsx)(o.a,{label:"Access Type",kind:"accessType",value:t,data:h,maxDisplayItem:4,onChange:l,...a,error:null==u?void 0:u.message})}})}},220953:function(e,t,l){l.d(t,{L:()=>x});var i=l(552676),a=l(185917),n=l(402899),r=l(797e3),o=l(158483),s=l(365582),d=l(582473),c=l(275271),u=l(324178),g=l(199436),h=l(566249),p=l(704790),v=l(784839);let x=(0,d.Pi)(({clusterId:e})=>{var t,l,d,x;let m;let{store:{lastVisitLocation:{orgId:b,projectId:j}}}=(0,h.Z)(),[f,C]=(0,c.useState)(0),{data:y,isLoading:k,refetch:S}=(0,g.md)(e,{orgId:b,projectId:j,pageSize:10,skip:10*f},{query:{refetchOnWindowFocus:!1}}),A=(0,u.x)("ClusterAuditFilterDelete"),[w,I]=(0,o.q)(),[L,z]=(0,c.useState)(),_=[{header:"User",accessorKey:"userExpr"},{header:"Database",accessorKey:"dbExpr"},{header:"Table",accessorKey:"tableExpr"},{header:"Access Type",minSize:200,accessorFn:e=>{var t;return(0,i.jsx)(p.j,{accessTypeList:null!==(t=e.accessTypeList)&&void 0!==t?t:[]})}},{header:"Actions",size:100,accessorFn:e=>(0,i.jsxs)(a.v,{withinPortal:!0,position:"bottom-end",children:[(0,i.jsx)(a.v.Target,{children:(0,i.jsx)(n.A,{variant:"subtle",children:(0,i.jsx)(s.aQl,{size:16})})}),(0,i.jsx)(a.v.Dropdown,{children:(0,i.jsx)(a.v.Item,{onClick:()=>{I.open(),z(e)},"data-mp-event":"Delete an Log Filter Rule Clicked",disabled:!A,children:"Delete"})})]})}];return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.Q,{loading:k,columns:_,data:null!==(t=null==y?void 0:y.auditLogFilterRules)&&void 0!==t?t:[],emptyMessage:"No Data",manualPagination:!0,pagination:(null!==(l=null==y?void 0:y.totalSize)&&void 0!==l?l:0)?{value:f+1,showTotal:!0,total:Math.ceil((null!==(d=null==y?void 0:y.totalSize)&&void 0!==d?d:0)/10),localization:{total:"Total: "}}:void 0,onPaginationChange:(m=(e,t)=>{C(e)},e=>{let t="function"==typeof e?e({pageIndex:f,pageSize:10}):e;(t.pageIndex!==f||10!==t.pageSize)&&m(t.pageIndex,t.pageSize)})}),(0,i.jsx)(v.A,{opened:w,onClose:I.close,clusterId:e,id:null!==(x=null==L?void 0:L.auditLogFilterRuleId)&&void 0!==x?x:"",onConfirm:S})]})})},565498:function(e,t,l){l.d(t,{s:()=>u});var i=l(552676),a=l(971798),n=l(359697),r=l(825539),o=l(469987),s=l(199436),d=l(566249),c=l(854489);let u=({opened:e,clusterId:t,onClose:l,onConfirm:u})=>{let g=(0,o.cI)({defaultValues:{accessType:[]}}),{store:{lastVisitLocation:{orgId:h,projectId:p}}}=(0,d.Z)(),{mutateAsync:v,isLoading:x}=(0,s.vx)(),m=async e=>{let l=1===e.accessType.length&&"*"===e.accessType[0]?[...c.p]:e.accessType;await v({clusterId:t,data:{accessTypeList:l,dbExpr:e.database,tableExpr:e.table,userExpr:e.user},params:{orgId:h,projectId:p}}),b(),null==u||u()},b=()=>{g.reset(),l()};return(0,i.jsx)(a.u,{opened:e,title:"Add Filter Rule",centered:!0,closeOnClickOutside:!1,onClose:b,children:(0,i.jsxs)(n.l,{form:g,onSubmit:m,onCancel:b,actionsProps:{confirmProps:{loading:x}},children:[(0,i.jsx)(r.c,{name:"user",label:"User",withAsterisk:!0,rules:{required:"Required"},placeholder:"Enter user"}),(0,i.jsx)(r.c,{name:"database",label:"Database",withAsterisk:!0,rules:{required:"Required",maxLength:{value:32,message:"Database names must be at most 32 characters. If longer, shorten them with a regex."}},placeholder:"Enter database"}),(0,i.jsx)(r.c,{name:"table",label:"Table",withAsterisk:!0,rules:{required:"Required",maxLength:{value:32,message:"Table names must be at most 32 characters. If longer, shorten them with a regex."}},placeholder:"Enter table"}),(0,i.jsx)(c.U,{})]})})}},784839:function(e,t,l){l.d(t,{A:()=>u});var i=l(552676),a=l(971798),n=l(98172),r=l(150288),o=l(128177),s=l(366130),d=l(199436),c=l(566249);let u=({opened:e,clusterId:t,id:l,onClose:u,onConfirm:g})=>{let{store:{lastVisitLocation:{orgId:h,projectId:p}}}=(0,c.Z)(),{mutateAsync:v,isLoading:x}=(0,d.$_)(),m=async()=>{await v({clusterId:t,auditLogFilterRuleId:l,params:{orgId:h,projectId:p}}),u(),null==g||g()};return(0,i.jsxs)(a.u,{opened:e,title:"Delete",centered:!0,onClose:u,styles:{body:{padding:0}},children:[(0,i.jsx)(n.Z,{variant:"body-lg",mt:"xl",mb:36,mx:"xl",children:"After deleting this audit filter rule, the related events will not be audited. Please confirm whether to delete it."}),(0,i.jsx)(r.i,{}),(0,i.jsxs)(o.Z,{justify:"flex-end",mx:"xl",my:"md",children:[(0,i.jsx)(s.z,{onClick:u,variant:"default",children:"Cancel"}),(0,i.jsx)(s.z,{color:"red",variant:"light",loading:x,onClick:m,"data-mp-event":"Deleted an Log Filter Rule",children:"I understand, Delete it"})]})]})}},963075:function(e,t,l){l.d(t,{i:()=>b});var i=l(552676),a=l(619102),n=l(740521),r=l(128177),o=l(98172),s=l(366130),d=l(158483),c=l(582473),u=l(187371),g=l(44028),h=l(199436),p=l(566249),v=l(102806),x=l(220953),m=l(565498);let b=(0,c.Pi)(({cluster:e})=>{let[t,l]=(0,d.q)(),c=e.id,{store:{lastVisitLocation:{orgId:b,projectId:j}}}
1=(0,p.Z)(),{accessDeniedReason:f,invalidReason:C}=(0,v.l)(e,"ClusterAuditFilterCreation");return(0,i.jsx)(a.Z,{p:"lg",children:(0,i.jsxs)(n.K,{gap:"xl",children:[(0,i.jsxs)(r.Z,{justify:"space-between",children:[(0,i.jsxs)(n.K,{gap:4,children:[(0,i.jsx)(o.Z,{variant:"title-lg",children:"Log Filter Rules"}),(0,i.jsxs)(o.Z,{variant:"body-lg",color:"carbon.7",children:["What is log filter rules, learn how to"," ",(0,i.jsx)("a",{target:"_blank",href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing#specify-auditing-filter-rules","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log","data-mp-content":"set up filter rules",rel:"noreferrer",children:"set up filter rules"})]})]}),(0,i.jsx)(u.u,{reasons:[f,C],children:({matched:e})=>(0,i.jsx)(s.z,{size:"sm",variant:"default",mr:16,"data-mp-event":"DB Audit Logging Add Filter Rule Button Clicked",onClick:l.open,disabled:e,children:"Add Filter Rule"})})]}),(0,i.jsx)(x.L,{clusterId:c}),(0,i.jsx)(m.s,{clusterId:c,opened:t,onConfirm:()=>{g.E.invalidateQueries((0,h.Rf)(c,{orgId:b,projectId:j}))},onClose:l.close})]})})})},696245:function(e,t,l){l.d(t,{Z:()=>h});var i=l(552676),a=l(125385),n=l(971798),r=l(98172),o=l(915030),s=l(366130),d=l(582473),c=l(199436),u=l(294859),g=l(566249);let h=(0,d.Pi)(({opened:e,cluster:t,onClose:l})=>{let{store:{tenantData:d,activeProjectId:h}}=(0,g.Z)(),p=(0,c.AM)(),v=async()=>{await x(),l()},x=async()=>{try{await p.mutateAsync({clusterId:t.id,data:{enabled:!1},params:{orgId:d.id,projectId:h}})}catch(e){a.r.error((0,u.e$)(e,!0))}};return(0,i.jsxs)(n.u,{opened:e,centered:!0,title:"Disable Database Audit Logging",size:480,trapFocus:!1,onClose:l,children:[(0,i.jsx)(r.Z,{mt:12,mb:52,variant:"body-lg",children:"When disabled, the database will no longer generate audit log files."}),(0,i.jsxs)(o.k,{justify:"flex-end",gap:16,children:[(0,i.jsx)(s.z,{variant:"outline","data-mp-event":"Disable DB Audit Logging Cancel Button Clicked",onClick:l,children:"Cancel"}),(0,i.jsx)(s.z,{variant:"outline",color:"red",loading:p.isLoading,"data-mp-event":"Disable DB Audit Logging Confirm Button Clicked","data-mp-plan":"Dedicated",onClick:v,children:"Disable"})]})]})})},50022:function(e,t,l){l.d(t,{Z:()=>C});var i=l(552676),a=l(971798),n=l(775364),r=l(150288),o=l(98172),s=l(91913),d=l(128177),c=l(359697),u=l(582473),g=l(275271),h=l(469987),p=l(671948),v=l(12537),x=l(566249),m=l(712853),b=l(860990),j=l(994619),f=l(511364);let C=(0,u.Pi)(({opened:e,cluster:t,orgId:l,projectId:u,config:C,onClose:y})=>{var k;let{store:{config:S}}=(0,x.Z)(),[A,w]=(0,g.useState)(C),I=(0,h.cI)({mode:"onChange"}),L=(0,g.useMemo)(()=>{var e;return t.provider===p.nq.AZURE?v.h.CUSTOMER:null!==(e=null==A?void 0:A.bucketManager)&&void 0!==e?e:""},[A]),z=(0,g.useMemo)(()=>t.provider!==p.nq.AZURE&&((0,m.yC)(t.version,"8.5.4",">=")||S.enableAuditLogV1Redaction),[t]);return(0,g.useEffect)(()=>{w(C)},[C]),(0,g.useEffect)(()=>{z&&(null==C?void 0:C.unredacted)!==void 0&&e&&I.setValue("redacted",C.redacted)},[C,I,z,e]),(0,i.jsx)(a.u,{title:"Enable Database Audit Logging",opened:e,onClose:y,size:t.provider===p.nq.AZURE?560:800,centered:!0,trapFocus:!1,closeOnClickOutside:!1,children:(0,i.jsxs)(c.l,{layout:"none",form:I,withActions:!1,onSubmit:()=>{},onCancel:y,children:[z&&(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.x,{children:(0,i.jsx)(b.e,{redactedName:"redacted",tips:"Sensitive information contained in SQL statements within the cluster log will be redacted."})}),(0,i.jsx)(r.i,{my:24,mx:-24})]}),S.enableAuditLogStoreTiDB&&t.provider!==p.nq.AZURE&&(0,i.jsxs)(n.x,{mb:24,children:[(0,i.jsx)(o.Z,{children:"Database Audit Logs Store in"}),(0,i.jsx)(s.Y.Group,{name:"managedBy",value:null!==(k=null==A?void 0:A.bucketManager)&&void 0!==k?k:v.h.CUSTOMER,onChange:e=>{let t={...A};t.bucketManager=e,w(t)},children:(0,i.jsxs)(d.Z,{mt:"xs",gap:48,children:[(0,i.jsx)(s.Y,{value:v.h.CUSTOMER,label:"Customer Storage"}),(0,i.jsx)(s.Y,{value:v.h.PINGCAP,label:"TiDB Cloud Storage"})]})})]}),L===v.h.PINGCAP?(0,i.jsx)(f.Z,{onClose:y,cluster:t,orgId:l,projectId:u}):(0,i.jsx)(j.Z,{cluster:t,opened:e,onClose:y,orgId:l,projectId:u,config:C})]})})})},137404:function(e,t,l){l.d(t,{Z:()=>u});var i=l(552676),a=l(775364),n=l(98172),r=l(105881),o=l(825539),s=l(490764),d=l(365582),c=l(671948);let u=({provider:e,disabled:t,regions:l})=>{let u=`${e}-`;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.c,{name:"bucketUri",autoComplete:"off",placeholder:`Example: ${e===c.nq.AWS?"s3":"gcs"}://bucket-name/path/to/dump/`,label:`Bucket ${e===c.nq.AZURE?"URL":"URI"}`,required:!0,rules:{required:"Required"},disabled:t}),(0,i.jsx)(s.i,{name:"bucketRegionId",label:"Bucket Region",placeholder:"Select a regi
1on",data:l.map(e=>({label:e.display_name,value:`${u}${e.name}`})),rules:{required:"Required"},required:!0,my:24,disabled:t}),e===c.nq.AWS&&(0,i.jsx)(o.c,{disabled:t,name:"awsRoleArn",autoComplete:"off",rules:{required:"Required"},required:!0,placeholder:"arn:aw:iam:001234567890:role/myrole",label:(0,i.jsxs)(a.x,{sx:{display:"inline-flex",alignItems:"center"},children:[(0,i.jsx)(n.Z,{variant:"label-lg",children:"Role ARN"}),(0,i.jsxs)(r.z,{withArrow:!0,withinPortal:!0,shadow:"md",position:"top",width:500,children:[(0,i.jsx)(r.z.Target,{children:(0,i.jsx)(d.Us8,{size:14,className:"wd-ml-2 wd-cursor-pointer"})}),(0,i.jsx)(r.z.Dropdown,{children:(0,i.jsxs)(n.Z,{mb:8,children:["Enter your AWS S3 IAM Role ARN Information, refer to"," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing/#step-2-configure-amazon-s3-access",target:"_blank",rel:"noopener noreferrer",children:"documentation"}),"."]})})]})]})})]})}},139560:function(e,t,l){l.d(t,{Z:()=>n});var i=l(552676),a=l(825539);let n=({disabled:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(a.c,{name:"bucketUri",autoComplete:"off",placeholder:"https://xxxxxx.blob.core.windows.net/path",label:"Blob URL",required:!0,rules:{required:"Required"},disabled:e}),(0,i.jsx)(a.c,{mt:24,name:"azureSasToken",autoComplete:"off",placeholder:"Example: se=2024-09-07T00:00ZSt=2024-08-24T00:00Z",label:"SAS Token",required:!0,rules:{required:"Required"},disabled:e})]})},249397:function(e,t,l){l.d(t,{JT:()=>p});var i=l(552676),a=l(775364),n=l(98172),r=l(915030),o=l(779533),s=l(593001),d=l(402899),c=l(365582);l(275271);var u=l(671948),g=l(57737),h=l(566249);let p=({clusterId:e,provider:t})=>{let{store:{tenantData:l,activeProjectId:n}}=(0,h.Z)(),{data:r}=(0,g.IIo)(l.id,n,e,{query:{enabled:!!(e&&l.id&&n)}}),o=null!=r?r:{type:"",aws_external_id:"",aws_account_id:"",gcp_account_id:""};return(0,i.jsx)(a.x,{w:296,p:24,sx:e=>({backgroundColor:e.colors.carbon[2],borderRadius:e.defaultRadius}),children:t===u.nq.AWS?(0,i.jsx)(v,{accountId:o.aws_account_id,externalId:o.aws_external_id}):(0,i.jsx)(x,{accountId:o.gcp_account_id})})},v=({accountId:e,externalId:t})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Z,{variant:"title-sm",mb:8,children:"AWS IAM Policy Settings"}),(0,i.jsxs)(n.Z,{variant:"body-sm",children:["Retrieve the policy settings that TiDB Cloud needs to access you AWS sources. Refer to"," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing#enable-audit-logging-for-aws",target:"_blank",rel:"noopener noreferrer",children:"documentation link"}),"."]}),(0,i.jsx)(n.Z,{variant:"body-lg",mt:16,mb:8,children:"TiDB Cloud Account ID"}),(0,i.jsxs)(r.k,{children:[(0,i.jsx)(n.Z,{variant:"title-md",sx:{wordBreak:"break-all"},children:e}),(0,i.jsx)(o.q,{value:e,timeout:2e3,children:({copied:e,copy:t})=>(0,i.jsx)(s.u,{label:e?"Copied":"Copy",withArrow:!0,position:"right",children:(0,i.jsx)(d.A,{variant:"transparent",size:"sm",c:"carbon.8",onClick:t,children:e?(0,i.jsx)(c.NOm,{size:14}):(0,i.jsx)(c.xty,{size:14,strokeWidth:2,onClick:t})})})})]}),(0,i.jsx)(n.Z,{variant:"body-lg",my:8,children:"TiDB Cloud External ID"}),(0,i.jsxs)(r.k,{children:[(0,i.jsx)(n.Z,{variant:"title-md",sx:{wordBreak:"break-all"},children:t}),(0,i.jsx)(o.q,{value:t,timeout:2e3,children:({copied:e,copy:t})=>(0,i.jsx)(s.u,{label:e?"Copied":"Copy",withArrow:!0,position:"right",children:(0,i.jsx)(d.A,{variant:"transparent",size:"sm",c:"carbon.8",onClick:t,children:e?(0,i.jsx)(c.NOm,{size:14}):(0,i.jsx)(c.xty,{size:14,strokeWidth:2,onClick:t})})})})]})]}),x=({accountId:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Z,{variant:"title-sm",mb:8,children:"Google Cloud Server Account ID"}),(0,i.jsxs)(n.Z,{variant:"body-sm",children:["Use this information in the Google Cloud Platform Console to configure access. Refer to",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing#enable-audit-logging-for-google-cloud",target:"_blank",rel:"noopener noreferrer",children:"documentation link"}),"."]}),(0,i.jsx)(n.Z,{variant:"body-lg",mt:16,mb:8,children:"Service Account ID"}),(0,i.jsxs)(r.k,{children:[(0,i.jsx)(n.Z,{variant:"title-md",children:e}),(0,i.jsx)(o.q,{value:e,timeout:2e3,children:({copied:e,copy:t})=>(0,i.jsx)(s.u,{label:e?"Copied":"Copy",withArrow:!0,position:"right",children:(0,i.jsx)(d.A,{variant:"transparent",size:"sm",c:"carbon.8",onClick:t,children:e?(0,i.jsx)(c.NOm,{size:14}):(0,i.jsx)(c.xty,{size:14,strokeWidth:2,onClick:t})})})})]})]})},725399:function(e,t,l){l.d(t,{Z:()=>A});var i=l(552676),a=l(125385),n=l(619102),r=l(128177),o=l(740521),s=l(98172),d=l(915030),c=l(156102),u=l(366130),g=l(712995),h=l(287096),p=l(365582),v=l(582473),x=l(275271),m=l(187371),b=l(199436),j=l(12537),f=l(294859),C=l(566249),y=l(102806),k=l(696245),S=l(50022);let A=(0,v.Pi)(({cluster:e})=>{var t,l;let[v,A]=(0,x.useState)(!1),[w,I]=(0,x.useState)(!1),{store:{tenantData:L,activeProjectId:z}}=(0,C.Z)(),{accessDeniedReason:_,invalidReason:E}=(0,y.l)(e,"ClusterAuditSwitch"),{data:R,isFetching:D,refetch:Z}=(0,b.tC)(null==e?void 0:e.id,{orgId:L.id,projectId:z},{query:{enabled:!!(L.id&&z&&(null==e?void 0:e.id)),refetchInterval:!1,refetchOnWindowFocus:!1,retry:!1,onError:e=>{let t=(0,f.e$)(e);a.r.error(t)}}}),T=null==R?void 0:R.enabled,F=(0,x.useMemo)(()=>(null==R?void 0:R.bucketManager)===j.h.PINGCAP?{...R,awsRoleArn:"",azureSasToken:"",bucketRegionId:"",bucketUri:"",redacted:(null==R?void 0:R.unredacted)===void 0?void 0:!R.unredacted}:{...R,redacted:(null==R?void 0:R.unredacted)===void 0?void 0:!R.unredacted},[R]);return(0,i.jsxs)(n.Z,{p:"xl",children:[(0,i.jsxs)(r.Z,{justify:"space-between",gap:48,children:[(0,i.jsxs)(o.K,{gap:4,sx:{flex:1},children:[(0,i.jsxs)(r.Z,{gap:"md",children:[(0,i.jsx)(s.Z,{variant:"title-lg",children:"Database Audit Logging"}),!D&&(0,i.jsx)(h.k,{color:T?"peacock":"gray",children:T?"Enabled":"Disabled"})]}),(0,i.jsx)(d.k,{gap:4,children:(0,i.jsxs)(s.Z,{variant:"body-lg",color:"carbon.7",children:["DB audit logging is used to record various SQL commands executed by users on the TiDB Cluster. It supports administrators to audit user behaviors based on log information."," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing",target:"_blank",rel:"noreferrer","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log","data-mp-content":"about user access and history",children:"Learn more"})]})})]}),D&&(0,i.jsx)(c.a,{size:"sm"}),!D&&(0,i.jsx)(m.u,{reasons:[_,E],children:({matched:e})=>(0,i.jsx)(i.Fragment,{children:T?(0,i.jsxs)(d.k,{gap:8,children:[(0,i.jsx)(u.z,{size:"sm",variant:"outline",disabled:e,"data-mp-event":"DB Audit Logging Edit Config Button Clicked",onClick:()=>A(!0),children:"Edit"}),(0,i.jsx)(u.z,{size:"sm",variant:"outline",disabled:e,"data-mp-event":"DB Audit Logging Disable Config Button Click",onClick:()=>I(!0),children:"Disable"})]}):(0,i.jsx)(u.z,{size:"sm",variant:"default",disabled:e,"data-mp-event":"DB Audit Logging Enable Entrance Button Clicked",onClick:()=>A(!0),children:"Enable"})})})]}),!(null==R?void 0:null===(t=R.bucketWriteCheck)||void 0===t?void 0:t.writable)&&(null==R?void 0:null===(l=R.bucketWriteCheck)||void 0===l?void 0:l.errorReason)&&(0,i.jsx)(g.b,{color:"red",children:(0,i.jsxs)(d.k,{align:"center",gap:8,children:[(0,i.jsx)(p.IF3,{}),null==R?void 0:R.bucketWriteCheck.errorReason]})}),(0,i.jsx)(S.Z,{opened:v,cluster:e,orgId:L.id,projectId:z,config:F,onClose:()=>{A(!1),Z()}}),(0,i.jsx)(k.Z,{opened:w,cluster:e,config:F,onClose:()=>{I(!1),Z()}})]})})},994619:function(e,t,l){l.d(t,{Z:()=>w});var i=l(552676),a=l(125385),n=l(915030),r=l(775364),o=l(712995),s=l(150288),d=l(366130),c=l(365582),u=l(379809),g=l(582473),h=l(275271),p=l(469987),v=l(585125),x=l(671948),m=l(420313),b=l(187758),j=l(199436),f=l(12537),C=l(294859),y=l(90206),
1k=l(137404),S=l(139560),A=l(249397);let w=(0,g.Pi)(({opened:e,cluster:t,orgId:l,projectId:g,config:w,onClose:I})=>{var L;let[z,_]=(0,h.useState)("initial"),[E,R]=(0,h.useState)(!1),[D,Z]=(0,h.useState)(!1),{watch:T,reset:F,getValues:P}=(0,p.Gc)(),N=T("bucketUri"),B=T("awsRoleArn"),O=T("bucketRegionId"),U=T("azureSasToken"),$=(0,j.AM)(),M=(0,j.AM)(),{expEnabled:q}=(0,v.i)("node-group"),{providers:Q}=(0,b.L3)({tier:"dedicated",enabled:!!e}),{data:K=[]}=(0,j.Ov)({orgId:l,projectId:g,pageSize:99},{query:{enabled:!!(l&&q&&e),select:e=>{let t=(0,u.Z)((null==e?void 0:e.regions)||[],"cloudProvider");return Object.keys(t).map(e=>{var l;return{name:e,regions:null===(l=t[e])||void 0===l?void 0:l.map(e=>{var t,l,i;return{name:null!==(l=null===(t=e.regionId)||void 0===t?void 0:t.replace(/^(aws|gcp|azure)-/,""))&&void 0!==l?l:"",display_name:null!==(i=e.displayName)&&void 0!==i?i:"",cross_account_deployment_id:""}})}})}}}),W=(0,m.JM)({providers:q?K:Q,currentProvider:t.provider});(0,h.useEffect)(()=>{if(R(!1),"initial"===z){Z(!1);return}_("initial"),Z(!0)},[N,B,O,U]),(0,h.useEffect)(()=>{F({...w,redacted:void 0===P("redacted")?(null==w?void 0:w.unredacted)===void 0?void 0:!w.unredacted:P("redacted")})},[w]);let G=()=>{F(),_("initial"),Z(!1),R(!1),I()},V=async e=>{try{await M.mutateAsync({clusterId:null==t?void 0:t.id,data:{awsRoleArn:e.awsRoleArn,azureSasToken:e.azureSasToken,bucketRegionId:e.bucketRegionId,bucketUri:e.bucketUri,enabled:!0,unredacted:void 0!==e.redacted?!e.redacted:void 0},params:{projectId:g,orgId:l}}),(0,y.fn)("DB Audit Logging V1 Enabled",{storeIn:f.h.CUSTOMER,unredacted:void 0!==e.redacted?!e.redacted:void 0}),G()}catch(e){a.r.error((0,C.e$)(e,!0))}},Y=async e=>{try{R(!0),await $.mutateAsync({clusterId:null==t?void 0:t.id,data:{awsRoleArn:e.awsRoleArn,azureSasToken:e.azureSasToken,bucketRegionId:e.bucketRegionId,bucketUri:e.bucketUri},params:{projectId:g,orgId:l,validateOnly:!0}}),_("passed"),Z(!1)}catch(e){}},H=(0,h.useMemo)(()=>{switch(t.provider){case x.nq.AZURE:return!(N&&U);case x.nq.AWS:return!(N&&B&&O);case x.nq.GCP:return!(N&&O)}},[N,O,B,U]),J=(0,h.useMemo)(()=>{if("initial"===z||D||H||$.isError)return!0},[z,D,H]),X=$.isLoading,ee=M.isLoading;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.k,{align:"top",gap:16,children:[(0,i.jsx)(r.x,{sx:{flex:1},children:(null==t?void 0:t.provider)===x.nq.AZURE?(0,i.jsx)(S.Z,{disabled:X||ee}):(0,i.jsx)(k.Z,{provider:t.provider,disabled:X||ee,regions:W})}),t.provider!==x.nq.AZURE&&(0,i.jsx)(A.JT,{clusterId:null==t?void 0:t.id,provider:t.provider})]}),!X&&E&&$.isError&&(0,i.jsx)(o.b,{mt:16,color:"red",children:(0,i.jsxs)(n.k,{align:"center",gap:8,children:[(0,i.jsx)(r.x,{component:c.IF3,size:18}),null===(L=$.error)||void 0===L?void 0:L.message]})}),!X&&E&&$.isSuccess&&(0,i.jsx)(o.b,{mt:16,color:"green",children:(0,i.jsxs)(n.k,{align:"center",gap:8,children:[(0,i.jsx)(r.x,{component:c.Bu,size:18}),"The connection is successful"]})}),(0,i.jsx)(s.i,{mx:"-xl",my:16}),(0,i.jsxs)(n.k,{justify:"space-between",align:"center",children:[(0,i.jsx)(d.z,{color:"peacock",variant:"default",disabled:!J||X||H,loading:X,"data-mp-event":"Database Audit Logging Test Connection Button Clicked ",onClick:()=>{Y(P())},children:"Test Connection"}),(0,i.jsxs)(n.k,{align:"center",children:[(0,i.jsx)(d.z,{variant:"default",onClick:G,children:"Cancel"}),(0,i.jsx)(d.z,{ml:16,type:"submit",disabled:J,loading:ee,"data-mp-event":"DB Audit Logging Enable Button Clicked","data-mp-source":"Store in Customer",onClick:()=>{V(P())},children:"Enable"})]})]})]})})},511364:function(e,t,l){l.d(t,{Z:()=>x});var i=l(552676),a=l(125385),n=l(775364),r=l(712995),o=l(150288),s=l(915030),d=l(366130),c=l(365582),u=l(469987),g=l(199436),h=l(12537),p=l(294859),v=l(90206);let x=({cluster:e,projectId:t,orgId:l,onClose:x})=>{let m=(0,g.AM)(),{getValues:b}=(0,u.Gc)(),j=async()=>{let i=b();try{await m.mutateAsync({clusterId:null==e?void 0:e.id,data:{enabled:!0,bucketManager:h.h.PINGCAP,unredacted:void 0!==i.redacted?!i.redacted:void 0},params:{projectId:t,orgId:l}}),(0,v.fn)("DB Audit Logging V1 Enabled",{storeIn:h.h.PINGCAP,unredacted:void 0!==i.redacted?!i.redacted:void 0}),x()}catch(e){a.r.error((0,p.e$)(e,!0))}};return(0,i.jsxs)(n.x,{children:[(0,i.jsx)(r.b,{color:"yellow",icon:(0,i.jsx)(c.DpU,{size:12}),children:"This feature is available after application. You will not be charged for the time being."}),(0,i.jsx)(o.i,{mx:"-xl",my:16}
1),(0,i.jsxs)(s.k,{align:"center",justify:"flex-end",children:[(0,i.jsx)(d.z,{variant:"default",onClick:x,children:"Cancel"}),(0,i.jsx)(d.z,{ml:16,type:"submit",loading:m.isLoading,"data-mp-event":"DB Audit Logging Enable Button Clicked","data-mp-source":"Store in TiDB",onClick:j,children:"Enable"})]})]})}},619389:function(e,t,l){l.d(t,{Z:()=>c});var i=l(552676),a=l(740521),n=l(275271),r=l(932643),o=l(965453),s=l(963075),d=l(725399);let c=({cluster:e})=>((0,n.useEffect)(()=>{document.title=`${r.ZP.PAGE_TITLE_PREFIX}Audit Log`},[]),(0,i.jsxs)(a.K,{gap:"xl",children:[(0,i.jsx)(d.Z,{cluster:e}),(0,i.jsx)(s.i,{cluster:e}),(0,i.jsx)(o.y,{clusterId:e.id})]}))},71159:function(e,t,l){l.d(t,{s:()=>j});var i=l(552676),a=l(125385),n=l(971798),r=l(775364),o=l(98172),s=l(892654),d=l(359697),c=l(825539),u=l(275271),g=l(469987),h=l(236910),p=l(199436),v=l(294859),x=l(566249),m=l(254023),b=l(509203);let j=({opened:e,clusterId:t,data:l,onClose:j,onConfirm:f})=>{let C=(0,g.cI)({defaultValues:{}}),{store:{lastVisitLocation:{orgId:y,projectId:k}}}=(0,x.Z)(),[S,A]=(0,u.useState)((0,b.$)()),w=C.watch("displayName"),I=C.watch("userExpr"),{mutateAsync:L,isLoading:z}=(0,p.vx)(),{mutateAsync:_,isLoading:E}=(0,p.AR)();(0,u.useEffect)(()=>{var e,t,i;l&&(C.setValue("displayName",null!==(e=l.displayName)&&void 0!==e?e:""),C.setValue("userExpr",null!==(t=null==l?void 0:l.userExpr)&&void 0!==t?t:""),A(null!==(i=l.eventTypes)&&void 0!==i?i:[]))},[null==l?void 0:l.displayName,null==l?void 0:l.userExpr,null==l?void 0:l.eventTypes]),(0,u.useEffect)(()=>{e||A((0,b.$)())},[e]);let R=async e=>{try{l?await Z(e):await D(e),T(),null==f||f()}catch(e){a.r.error((0,v.e$)(e))}},D=async e=>{try{await L({clusterId:t,data:{displayName:e.displayName,userExpr:e.userExpr,disabled:!1,eventTypes:S},params:{orgId:y,projectId:k}})}catch(e){throw e}},Z=async e=>{try{var i;await _({clusterId:t,auditLogFilterRuleId:encodeURIComponent(null!==(i=null==l?void 0:l.auditLogFilterRuleId)&&void 0!==i?i:""),data:{...l,displayName:e.displayName,userExpr:e.userExpr,eventTypes:S},params:{orgId:y,projectId:k}})}catch(e){throw e}},T=()=>{C.reset(),j()},F=(0,u.useMemo)(()=>`${l?"Edit":"Add"} Filter Rule`,[l]);return(0,i.jsx)(n.u,{opened:e,size:640,title:F,centered:!0,closeOnClickOutside:!1,onClose:T,children:(0,i.jsxs)(d.l,{form:C,onSubmit:R,onCancel:T,actionsProps:{confirmProps:{loading:l?E:z,disabled:!w||!I||0===S.length}},children:[(0,i.jsx)(c.c,{name:"displayName",label:"Filter Name",placeholder:"Enter filter name"}),(0,i.jsxs)(r.x,{children:[(0,i.jsx)(c.c,{name:"userExpr",disabled:!!l,label:"SQL User",placeholder:"Enter SQL user"}),(0,i.jsxs)(o.Z,{variant:"body-md",c:"carbon.7",mt:8,children:["The SQL user format is ",(0,i.jsx)(s.E,{children:"<user>@<host>"}),", where username and hostname can use"," ",(0,i.jsx)(s.E,{children:"%"})," for any value or ",(0,i.jsx)(s.E,{children:"_"})," for any character. The ",(0,i.jsx)(s.E,{children:"@"})," and host are optional."]})]}),(0,i.jsxs)(r.x,{children:[(0,i.jsx)(o.Z,{variant:"label-lg",mb:6,children:"Filter Events"}),(0,i.jsx)(h.m,{value:S,onChange:e=>A(e.length?e:(0,b.$)()),allWithEmpty:!0,placeholder:"Selet filter rules",selectItemProps:{miw:590,sx:{"::-webkit-scrollbar":{width:0}},textProps:{sx:{wordBreak:"break-word",whiteSpace:"normal",maxWidth:"90%"}}},options:m.GM,maxContentHeight:280,isShouldParentSelectable:!0})]})]})})}},613321:function(e,t,l){l.d(t,{A:()=>p});var i=l(552676),a=l(125385),n=l(971798),r=l(98172),o=l(128177),s=l(366130),d=l(381674),c=l(18067),u=l(199436),g=l(294859),h=l(566249);let p=({opened:e,clusterId:t,data:l,onClose:p,onConfirm:v})=>{let{store:{lastVisitLocation:{orgId:x,projectId:m}}}=(0,h.Z)(),b=(0,d.useQueryClient)(),{mutateAsync:j,isLoading:f}=(0,u.$_)(),C=async()=>{try{var e;await j({clusterId:t,auditLogFilterRuleId:encodeURIComponent(null!==(e=null==l?void 0:l.auditLogFilterRuleId)&&void 0!==e?e:""),params:{orgId:x,projectId:m}}),b.fetchQuery((0,u.Rf)(null!=t?t:"",{orgId:x,projectId:m}),()=>(0,u.nQ)(null!=t?t:"",{orgId:x,projectId:m})),p(),null==v||v()}catch(e){a.r.error((0,g.e$)(e))}};return(0,i.jsxs)(n.u,{opened:e,size:560,title:"Delete Filter Rule",centered:!0,onClose:p,styles:{body:{padding:0}},children:[(0,i.jsxs)(r.Z,{variant:"body-lg",mt:"xl",mb:36,mx:"xl",children:["The audit log filter rule ",(0,i.jsx)(c.r,{children:null==l?void 0:l.displayName})," will be permanently deleted and cannot be recovered. Are you sure to delete it?"]}),(0,i.jsxs)(o.Z,{justify:"flex-end",mx:"xl",my:"md",children:[(0,i.jsx)(s.z,{onClick:p,variant:"default",children:"Cancel"}),(0,i.jsx)(s.z,{color:"red",variant:"light",loading:f,onClick:C,"data-mp-event":"Deleted an Log Filter Rule",children:"I understand, Delete it"})]})]})}},164615:function(e,t,l){l.d(t,{L:()=>y});var i=l(552676),a=l(125385),n=l(156102),r=l(855242),o=l(185917),s=l(402899),d=l(797e3),c=l(158483),u=l(365582),g=l(582473),h=l(275271),p=l(324178),v=l(44028),x=l(199436),m=l(294859),b=l(566249),j=l(448758),f=l(711
159),C=l(613321);let y=(0,g.Pi)(({clusterId:e})=>{var t,l,g;let y;let{store:{lastVisitLocation:{orgId:k,projectId:S}}}=(0,b.Z)(),{setFilterRulesLen:A}=(0,j.k)(),[w,I]=(0,h.useState)(0),{data:L,isFetching:z,refetch:_}=(0,x.md)(e,{orgId:k,projectId:S,pageSize:5,skip:5*w},{query:{refetchOnWindowFocus:!1,onSuccess:e=>{var t,l;A(null!==(l=null===(t=e.auditLogFilterRules)||void 0===t?void 0:t.length)&&void 0!==l?l:0)}}}),E=(0,p.x)("ClusterAuditFilterDelete"),[R,D]=(0,c.q)(),[Z,T]=(0,c.q)(),[F,P]=(0,h.useState)(),[N,B]=(0,h.useState)(),{mutateAsync:O,isLoading:U}=(0,x.AR)(),$=async t=>{try{var l;B(t),await O({clusterId:e,auditLogFilterRuleId:encodeURIComponent(null!==(l=t.auditLogFilterRuleId)&&void 0!==l?l:""),data:{...t,disabled:!t.disabled},params:{orgId:k,projectId:S}}),await v.E.invalidateQueries((0,x.Rf)(e,{orgId:k,projectId:S})).finally(()=>{B(void 0)})}catch(e){a.r.error((0,m.e$)(e)),B(void 0)}},M=(0,h.useMemo)(()=>[{Header:(0,i.jsx)(i.Fragment,{}),header:"Enabled",size:100,Cell:({row:e})=>{let t=e.original;return(0,i.jsx)(i.Fragment,{children:(null==N?void 0:N.auditLogFilterRuleId)===t.auditLogFilterRuleId?(0,i.jsx)(n.a,{size:"xs",ml:4}):(0,i.jsx)(r.r,{size:"sm",checked:!t.disabled,disabled:!E,onClick:e=>{$(t)}})})}},{header:"Filter Name",accessorKey:"displayName"},{header:"SQL User",accessorKey:"userExpr"},{header:"Filter Events",accessorFn:e=>{var t;return null===(t=e.eventTypes)||void 0===t?void 0:t.map(e=>e.toLowerCase()).join(", ")}},{Header:(0,i.jsx)(i.Fragment,{}),header:"Actions",size:20,Cell:({row:e})=>{let t=e.original;return(0,i.jsxs)(o.v,{withinPortal:!0,position:"bottom-end",children:[(0,i.jsx)(o.v.Target,{children:(0,i.jsx)(s.A,{variant:"subtle",children:(0,i.jsx)(u.aQl,{size:16})})}),(0,i.jsxs)(o.v.Dropdown,{children:[(0,i.jsx)(o.v.Item,{onClick:()=>{P(t),setTimeout(()=>{T.open()})},disabled:!E,"data-mp-event":"Edit an Log Filter Rule Clicked",children:"Edit"}),(0,i.jsx)(o.v.Item,{onClick:()=>{D.open(),P(t)},c:"red","data-mp-event":"Delete an Log Filter Rule Clicked",disabled:!E,children:"Delete"})]})]})}}],[U,F,null==L?void 0:L.auditLogFilterRules]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Q,{loading:z,columns:M,data:null!==(t=null==L?void 0:L.auditLogFilterRules)&&void 0!==t?t:[],emptyMessage:"No Data",manualPagination:!0,pagination:(null!==(l=null==L?void 0:L.totalSize)&&void 0!==l?l:0)?{value:w+1,showTotal:!0,total:Math.ceil((null!==(g=null==L?void 0:L.totalSize)&&void 0!==g?g:0)/5),localization:{total:"Total: "}}:void 0,onPaginationChange:(y=(e,t)=>{I(e)},e=>{let t="function"==typeof e?e({pageIndex:w,pageSize:5}):e;(t.pageIndex!==w||5!==t.pageSize)&&y(t.pageIndex,t.pageSize)})}),(0,i.jsx)(C.A,{opened:R,onClose:D.close,clusterId:e,data:F,onConfirm:_}),(0,i.jsx)(f.s,{clusterId:e,opened:Z,data:F,onConfirm:()=>{v.E.invalidateQueries((0,x.Rf)(e,{orgId:k,projectId:S}))},onClose:T.close})]})})},615902:function(e,t,l){l.d(t,{i:()=>b});var i=l(552676),a=l(619102),n=l(740521),r=l(128177),o=l(98172),s=l(366130),d=l(158483),c=l(582473),u=l(187371),g=l(44028),h=l(199436),p=l(566249),v=l(102806),x=l(71159),m=l(164615);let b=(0,c.Pi)(({cluster:e})=>{let[t,l]=(0,d.q)(),c=e.id,{store:{lastVisitLocation:{orgId:b,projectId:j}}}=(0,p.Z)(),{accessDeniedReason:f,invalidReason:C}=(0,v.l)(e,"ClusterAuditFilterCreation");return(0,i.jsx)(a.Z,{p:"lg",children:(0,i.jsxs)(n.K,{gap:"xl",children:[(0,i.jsxs)(r.Z,{justify:"space-between",wrap:"nowrap",gap:24,children:[(0,i.jsxs)(n.K,{gap:4,maw:700,children:[(0,i.jsx)(o.Z,{variant:"title-lg",children:"Audit Filters"}),(0,i.jsxs)(o.Z,{variant:"body-lg",c:"carbon.7",inline:!0,children:["Filter rules determine which events will be audited. If there are no filter rules, nothing will be audited except audit management events. Learn how to"," ",(0,i.jsx)("a",{target:"_blank",href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing#specify-auditing-filter-rules","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log","data-mp-content":"set up filter rules",rel:"noreferrer",children:"set up filter rules"}),"."]})]}),(0,i.jsx)(u.u,{reasons:[f,C],children:({matched:e})=>(0,i.jsx)(s.z,{size:"sm",variant:"default",mr:16,"data-mp-event":"DB Audit Logging Add Filter Rule Button Clicked",onClick:e=>{e.stopPropagation(),l.open()},disabled:e,children:"Add Filter Rule"})})]}
1),(0,i.jsx)(m.L,{clusterId:c}),(0,i.jsx)(x.s,{clusterId:c,opened:t,onConfirm:()=>{g.E.invalidateQueries((0,h.Rf)(c,{orgId:b,projectId:j}))},onClose:l.close})]})})})},555473:function(e,t,l){l.d(t,{Z:()=>p});var i=l(552676),a=l(915030),n=l(156102),r=l(740521),o=l(582473),s=l(712853),d=l(448758),c=l(619389),u=l(615902),g=l(965453),h=l(16087);let p=(0,o.Pi)(({cluster:e})=>{let{config:t,isInitingConfig:l}=(0,d.k)(),o=(0,s.yC)(e.version,"7.1.0",">=");return(0,i.jsx)(i.Fragment,{children:l?(0,i.jsx)(a.k,{h:"100%",align:"center",justify:"center",children:(0,i.jsx)(n.a,{})}):(0,i.jsx)(i.Fragment,{children:!o||(null==t?void 0:t.legacy)?(0,i.jsx)(c.Z,{cluster:e}):(0,i.jsxs)(r.K,{gap:"xl",children:[(0,i.jsx)(h.Z,{cluster:e}),(0,i.jsx)(u.i,{cluster:e}),(0,i.jsx)(g.y,{clusterId:e.id})]})})})})},889692:function(e,t,l){l.d(t,{U:()=>S});var i=l(552676),a=l(105012),n=l(185917),r=l(402899),o=l(775364),s=l(915030),d=l(98172),c=l(366130),u=l(426913),g=l(797e3),h=l(365582),p=l(416483),v=l.n(p),x=l(582473),m=l(275271),b=l(69609),j=l(616658),f=l(199436),C=l(566249);let y={type:"relative",value:1800},k=[300,600,1800,3600,10800,43200,86400,604800,1209600,2592e3],S=(0,x.Pi)(({clusterId:e})=>{var t,l,p;let x,S,A;let[w,I]=(0,m.useState)(y),[L,z]=(0,m.useState)({}),[_,E]=(0,m.useState)({pageIndex:0,pageSize:5}),[R,D]=(0,m.useState)((0,u.HO)(y)),[Z,T]=(0,m.useState)(!1),{store:{tenantData:F,activeProjectId:P}}=(0,C.Z)(),{data:N,isLoading:B}=(0,f.oT)(e,{startTime:`${new Date(1e3*R[0]).toISOString()}`,endTime:`${new Date(1e3*R[1]).toISOString()}`,pageSize:_.pageSize,skip:_.pageIndex*_.pageSize,orgId:F.id,projectId:P},{query:{refetchOnWindowFocus:!1,refetchInterval:!1,enabled:!!(F.id&&P)}}),O=(0,m.useMemo)(()=>Object.keys(L).filter(e=>L[e]),[null==N?void 0:N.auditLogFiles,L]),U=async e=>{let t=document.createElement("a");t.href=e,document.body.appendChild(t),t.click(),document.body.removeChild(t)},$=[{header:"Name",accessorKey:"filename"},{header:"Time",accessorFn:e=>(0,i.jsx)(j.Z,{time:e.createTime,format:"YYYY-MM-DD HH:mm:ss"})},{header:"Size",accessorFn:({sizeByte:e})=>(0,b.f)(null!=e?e:0,!1)},{Header:(0,i.jsx)(i.Fragment,{}),header:"Actions",size:20,accessorFn:e=>(0,i.jsxs)(n.v,{withinPortal:!0,position:"bottom-start",children:[(0,i.jsx)(n.v.Target,{children:(0,i.jsx)(r.A,{variant:"subtle",children:(0,i.jsx)(h.aQl,{size:16})})}),(0,i.jsx)(n.v.Dropdown,{children:(0,i.jsx)(n.v.Item,{onClick:()=>{var t;return M([null!==(t=e.uri)&&void 0!==t?t:""])}
1,"data-mp-event":"Download an Log Clicked",children:"Download"})})]})}],M=async t=>{if(t.length){T(!0);try{let l=await Promise.all(t.map(t=>(0,f.NV)(e,{auditLogFileUri:null!=t?t:"",orgId:F.id,projectId:P}).then(e=>({downloadAddress:e.downloadAddress}))));T(!1);let i=0;for(let{downloadAddress:e}of l)i++,e&&await new Promise(t=>{U(e),setTimeout(t,(i+1)*500)})}catch(e){T(!1)}}};return(0,i.jsxs)(o.x,{mt:24,children:[(0,i.jsx)(a.Z,{value:w,onChange:e=>{I(e),D((0,u.HO)(e))},quickRanges:k,minDateTime:()=>v()().subtract(730,"day").toDate(),maxDateTime:()=>v()().toDate()}),(0,i.jsxs)(o.x,{sx:{position:"relative"},mt:8,children:[(0,i.jsx)(g.Q,{loading:B,columns:$,data:null!==(t=null==N?void 0:N.auditLogFiles)&&void 0!==t?t:[],enableRowSelection:!0,state:{rowSelection:L,pagination:{pageIndex:_.pageIndex,pageSize:_.pageSize}},mantineSelectCheckboxProps:{size:"xs"},mantineSelectAllCheckboxProps:{size:"xs"},onRowSelectionChange:z,getRowId:e=>{var t;return null!==(t=e.uri)&&void 0!==t?t:""},manualPagination:!0,pagination:(null!==(l=null==N?void 0:N.totalSize)&&void 0!==l?l:0)&&!O.length?{value:_.pageIndex+1,showTotal:!0,showRowsPerPage:!0,total:Math.ceil((null!==(p=null==N?void 0:N.totalSize)&&void 0!==p?p:0)/_.pageSize),rowsPerPageOptions:[5,10,15].map(e=>({value:String(e),label:`${e} / page`})),localization:{total:"Total: "},onChange:e=>{E({pageSize:_.pageSize,pageIndex:e-1})}}:void 0,onPaginationChange:(x=_.pageIndex,S=_.pageSize,A=(e,t)=>{E({pageIndex:0,pageSize:t})},e=>{let t="function"==typeof e?e({pageIndex:x,pageSize:S}):e;t.pageSize!==S&&A(t.pageIndex,t.pageSize)}),emptyMessage:"No Data"}),!!O.length&&(0,i.jsxs)(s.k,{align:"center",gap:24,pt:8,children:[(0,i.jsxs)(d.Z,{variant:"label-md",children:[O.length," selected"]}),(0,i.jsx)(c.z,{variant:"subtle",color:"sky",size:"compact-lg",loading:Z,"data-mp-event":"DB Audit Logging Selected Files Download Button Clicked",onClick:()=>M(Object.keys(L)),children:"Download"}),(0,i.jsx)(c.z,{variant:"subtle",size:"compact-lg",disabled:Z,"data-mp-event":"DB Audit Logging Selected Files Cancel Button Clicked",onClick:()=>z({}),children:"Cancel"})]})]})]})})},965453:function(e,t,l){l.d(t,{y:()=>u});var i=l(552676),a=l(619102),n=l(582473),r=l(12537),o=l(566249),s=l(210932),d=l(448758),c=l(889692);let u=(0,n.Pi)(({clusterId:e})=>{let{store:{config:t}}=(0,o.Z)(),{config:l}=(0,d.k)();return(null==l?void 0:l.enabled)&&(null==l?void 0:l.bucketManager)===r.h.PINGCAP?(0,i.jsx)(i.Fragment,{children:t.enableAuditLogStoreTiDB&&(0,i.jsxs)(a.Z,{p:"lg",children:[(0,i.jsx)(s.Z,{}),(0,i.jsx)(c.U,{clusterId:e})]})}):null})},974638:function(e,t,l){l.d(t,{Z:()=>p});var i=l(552676),a=l(125385),n=l(971798),r=l(98172),o=l(915030),s=l(366130),d=l(582473),c=l(381674),u=l(199436),g=l(294859),h=l(566249);let p=(0,d.Pi)(({opened:e,cluster:t,orgId:l,projectId:d,onClose:p})=>{let{store:{tenantData:v,activeProjectId:x}}=(0,h.Z)(),m=(0,u.AM)(),b=(0,c.useQueryClient)(),j=async()=>{var e;try{await m.mutateAsync({clusterId:t.id,data:{enabled:!1},params:{orgId:v.id,projectId:x}})}catch(e){a.r.error((0,g.e$)(e,!0))}b.fetchQuery((0,u.s$)(null!==(e=null==t?void 0:t.id)&&void 0!==e?e:"",{orgId:l,projectId:d}),()=>{var e;return(0,u.Sl)(null!==(e=null==t?void 0:t.id)&&void 0!==e?e:"",{orgId:l,projectId:d})}),p()};return(0,i.jsxs)(n.u,{opened:e,centered:!0,title:"Disable Database Audit Logging",size:480,trapFocus:!1,onClose:p,children:[(0,i.jsx)(r.Z,{mb:32,variant:"body-lg",children:"When disabled, the database will no longer generate audit log files."}),(0,i.jsxs)(o.k,{justify:"flex-end",gap:16,children:[(0,i.jsx)(s.z,{variant:"outline","data-mp-event":"Disable DB Audit Logging Cancel Button Clicked",onClick:p,children:"Cancel"}),(0,i.jsx)(s.z,{variant:"outline",color:"red",loading:m.isLoading,"data-mp-event":"Disable DB Audit Logging Confirm Button Clicked","data-mp-plan":"Dedicated",onClick:j,children:"Disable"})]})]})})},223e3:function(e,t,l){l.d(t,{Z:()=>m});var i=l(552676),a=l(971798),n=l(775364),r=l(98172),o=l(696387),s=l(582473),d=l(275271),c=l(671948),u=l(12537),g=l(566249),h=l(448758),p=l(254023),v=l(151043),x=l(341249);let m=(0,s.Pi)(({opened:e,cluster:t,orgId:l,projectId:s,config:m,onClose:b})=>{var j;let{store:{config:f}}=(0,g.Z)(),{setConfigStep:C,configStep:y}=(0,h.k)(),[k,S]=(0,d.useState)(m),A=(0,d.useMemo)(()=>{var e;return null!==(e=null==k?void 0:k.bucketManager)&&void 0!==e?e:""},[k]);return(0,d.useEffect)(()=>{S(m)},[m]),(0,d.useEffect)(()=>{e&&C(p.Nr.Config)},[e]),(0,i.jsxs)(a.u,{title:m?"Database Audit Log Storage Configuration":"Enable Database Audit Logging",opened:e,onClose:b,size:t.provider===c.nq.AZURE?560:800,centered:!0,trapFocus:!1,closeOnClickOutside:!1,children:[f.enableAuditLogStoreTiDB&&(null==t?void 0:t.provider)===c.nq.AWS&&y===p.Nr.Config&&(0,i.jsxs)(n.x,{mb:24,children:[(0,i.jsx)(r.Z,{mb:8,variant:"label-lg",children:"Log Storage Location"}),(0,i.jsx)(o.s,{fullWidth:!0,name:"managedBy",value:null!==(j=null==k?void 0:k.bucketManager)&&void 0!==j?j:u.h.CUSTOMER,onChange:e=>{let t={...k};t.bucketManager=e,S(t)},data:[{label:"Customer Storage",value:u.h.CUSTOMER},{label:"TiDB Cloud Storage",value:u.h.PINGCAP}]})]}),A===u.h.PINGCAP?(0,i.jsx)(x.Z,{cluster:t,orgId:l,projectId:s,onClose:b}):(0,i.jsx)(v.Z,{cluster:t,opened:e,orgId:l,projectId:s,onClose:b})]})})},864193:function(e,t,l){l.d(t,{Z:()=>u});var i=l(552676),a=l(775364),n=l(98172),r=l(105881),o=l(825539),s=l(490764),d=l(365582),c=l(671948);let u=({provider:e,disabled:t,regions:l})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(o.c,{name:"bucketUri",autoComplete:"off",placeholder:`Example: ${e===c.nq.AWS?"s3":"gcs"}://bucket-name/path/to/dump/`,label:`Bucket ${e===c.nq.AZURE?"URL":"URI"}`,disabled:t}),(0,i.jsx)(s.i,{name:"bucketRegionId",label:"Bucket Region",placeholder:"Select a regi
1on",data:l.map(t=>({label:t.display_name,value:`${e}-${t.name}`})),my:24,disabled:t}),e===c.nq.AWS&&(0,i.jsx)(o.c,{disabled:t,name:"awsRoleArn",autoComplete:"off",placeholder:"arn:aw:iam:001234567890:role/myrole",label:(0,i.jsxs)(a.x,{sx:{display:"inline-flex",alignItems:"center"},children:[(0,i.jsx)(n.Z,{variant:"label-lg",children:"Role ARN"}),(0,i.jsxs)(r.z,{withArrow:!0,withinPortal:!0,shadow:"md",position:"top",width:500,children:[(0,i.jsx)(r.z.Target,{children:(0,i.jsx)(d.Us8,{size:14,className:"wd-ml-2 wd-cursor-pointer"})}),(0,i.jsx)(r.z.Dropdown,{children:(0,i.jsxs)(n.Z,{mb:8,children:["Enter your AWS S3 IAM Role ARN Information, refer to"," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing/#step-2-configure-amazon-s3-access",target:"_blank",rel:"noopener noreferrer",children:"documentation"}),"."]})})]})]})})]})},690847:function(e,t,l){l.d(t,{Z:()=>s});var i=l(552676),a=l(915030),n=l(98172),r=l(144369),o=l(825539);let s=({disabled:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.k,{mb:24,children:[(0,i.jsx)(n.Z,{variant:"body-lg",children:"Connect your Azure Blob Storage to store database audit logs."}),(0,i.jsx)(r.e,{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing/#enable-audit-logging-for-azure",target:"_blank",ml:4,children:"Learn more"})]}),(0,i.jsx)(o.c,{name:"bucketUri",autoComplete:"off",placeholder:"https://xxxxxx.blob.core.windows.net/path",label:"Blob URL",disabled:e}),(0,i.jsx)(o.c,{mt:24,name:"azureSasToken",autoComplete:"off",placeholder:"Example: se=2024-09-07T00:00ZSt=2024-08-24T00:00Z",label:"SAS Token",disabled:e})]})},904100:function(e,t,l){l.d(t,{JT:()=>v});var i=l(552676),a=l(775364),n=l(98172),r=l(915030),o=l(779533),s=l(593001),d=l(402899),c=l(144369),u=l(365582);l(275271);var g=l(671948),h=l(57737),p=l(566249);let v=({clusterId:e,provider:t})=>{let{store:{tenantData:l,activeProjectId:n}}=(0,p.Z)(),{data:r}=(0,h.IIo)(l.id,n,e,{query:{enabled:!!(e&&l.id&&n)}}),o=null!=r?r:{type:"",aws_external_id:"",aws_account_id:"",gcp_account_id:""};return(0,i.jsx)(a.x,{w:296,p:24,sx:e=>({backgroundColor:e.colors.carbon[2],borderRadius:e.defaultRadius}),children:t===g.nq.AWS?(0,i.jsx)(x,{accountId:o.aws_account_id,externalId:o.aws_external_id}):(0,i.jsx)(m,{accountId:o.gcp_account_id})})},x=({accountId:e,externalId:t})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Z,{variant:"title-sm",mb:8,children:"AWS IAM Policy Settings"}),(0,i.jsxs)(n.Z,{variant:"body-sm",children:["Retrieve the policy settings that TiDB Cloud needs to access you AWS sources. Refer to"," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing#enable-audit-logging-for-aws",target:"_blank",rel:"noopener noreferrer",children:"documentation link"}),"."]}),(0,i.jsx)(n.Z,{variant:"body-lg",mt:16,mb:8,children:"TiDB Cloud Account ID"}),(0,i.jsxs)(r.k,{children:[(0,i.jsx)(n.Z,{variant:"title-md",sx:{wordBreak:"break-all"},children:e}),(0,i.jsx)(o.q,{value:e,timeout:2e3,children:({copied:e,copy:t})=>(0,i.jsx)(s.u,{label:e?"Copied":"Copy",withArrow:!0,position:"right",children:(0,i.jsx)(d.A,{variant:"transparent",size:"sm",c:"carbon.8",onClick:t,children:e?(0,i.jsx)(u.NOm,{size:14}):(0,i.jsx)(u.xty,{size:14,strokeWidth:2,onClick:t})})})})]}),(0,i.jsx)(n.Z,{variant:"body-lg",my:8,children:"TiDB Cloud External ID"}),(0,i.jsxs)(r.k,{children:[(0,i.jsx)(n.Z,{variant:"title-md",sx:{wordBreak:"break-all"},children:t}),(0,i.jsx)(o.q,{value:t,timeout:2e3,children:({copied:e,copy:t})=>(0,i.jsx)(s.u,{label:e?"Copied":"Copy",withArrow:!0,position:"right",children:(0,i.jsx)(d.A,{variant:"transparent",size:"sm",c:"carbon.8",onClick:t,children:e?(0,i.jsx)(u.NOm,{size:14}):(0,i.jsx)(u.xty,{size:14,strokeWidth:2,onClick:t})})})})]})]}),m=({accountId:e})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Z,{variant:"title-sm",mb:8,children:"Google Cloud Server Account ID"}),(0,i.jsxs)(n.Z,{variant:"body-sm",children:["Use this information in the Google Cloud Platform Console to configure access. Refer to",(0,i.jsx)(c.e,{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing#enable-audit-logging-for-google-cloud",target:"_blank",rel:"noopener noreferrer",ml:4,children:"documentation link"}),"."]}),(0,i.jsx)(n.Z,{variant:"body-lg",mt:16,mb:8,children:"Service Account ID"}),(0,i.jsxs)(r.k,{children:[(0,i.jsx)(n.Z,{variant:"title-md",children:e}),(0,i.jsx)(o.q,{value:e,timeout:2e3,children:({copied:e,copy:t})=>(0,i.jsx)(s.u,{label:e?"Copied":"Copy",withArrow:!0,position:"right",children:(0,i.jsx)(d.A,{variant:"transparent",size:"sm",c:"carbon.8",onClick:t,children:e?(0,i.jsx)(u.NOm,{size:14}):(0,i.jsx)(u.xty,{size:14,strokeWidth:2,onClick:t})})})})]})]})},444242:function(e,t,l){l.d(t,{g:()=>C});var i=l(552676),a=l(125385),n=l(775364),r=l(712995),o=l(98172),s=l(915030),d=l(150288),c=l(366130),u=l(490764),g=l(98455),h=l(365582),p=l(469987),v=l(381674),x=l(199436),m=l(294859),b=l(566249),j=l(448758),f=l(900361);let C=({isUpdate:e,clusterId:t,cluster:l,orgId:C,projectId:y,bucketManager:k,onCancel:S,onPrevious:A})=>{let{store:{config:w}}=(0,b.Z)(),{getValues:I,watch:L}=(0,p.Gc)(),z=(0,x.AM)(),_=(0,v.useQueryClient)(),E=L("redacted"),{filterRulesLen:R}=(0,j.k)(),D=async()=>{let e=I();try{await z.mutateAsync({clusterId:null!=t?t:"",data:{awsRoleArn:e.awsRoleArn,azureSasToken:e.azureSasToken,bucketRegionId:e.bucketRegionId,bucketUri:e.bucketUri,enabled:!0,rotationPolicy:e.rotationPolicy,unredacted:!e.redacted,bucketManager:k||e.bucketManager},params:{projectId:y,orgId:C}}),R||a.r.success("Database audit logging is enabled. Please proceed to set audit filters to 
1select the events to be audited."),_.fetchQuery((0,x.s$)(null!=t?t:"",{orgId:C,projectId:y}),()=>(0,x.Sl)(null!=t?t:"",{orgId:C,projectId:y})),S()}catch(e){a.r.error((0,m.e$)(e,!0))}},Z=e=>({root:{flex:1},section:{'&[data-position="left"]':{color:e.colors.carbon[9],borderRight:`1px solid ${e.colors.carbon[4]}`,backgroundColor:e.colors.carbon[2],marginRight:10}},input:{flex:1}}),T=[...f.Ur,...w.enableAuditLogRotation?f._L:[],...f.mz];return(0,i.jsxs)(n.x,{children:[!e&&(0,i.jsx)(r.b,{color:"green",mb:24,icon:(0,i.jsx)(h.Bu,{}),children:"The connection is successful"}),(0,i.jsx)(o.Z,{variant:"label-lg",mb:8,children:"Log File Rotation"}),(0,i.jsxs)(s.k,{gap:16,children:[(0,i.jsx)(u.i,{name:"rotationPolicy.maxSizeMib",leftSectionWidth:112,leftSection:"File Size Limit",styles:e=>({...Z(e),input:{paddingLeft:126}}),sx:{maxWidth:"50%"},data:f.In}),l&&!(0,f.K3)(l)&&(0,i.jsx)(u.i,{name:"rotationPolicy.maxAgeSecond",leftSectionWidth:132,leftSection:"Rotation Interval",data:T,styles:e=>({...Z(e),input:{paddingLeft:146}})})]}),(0,i.jsx)(d.i,{mx:-24,my:24}),(0,i.jsxs)(s.k,{justify:"space-between",align:"center",gap:32,children:[(0,i.jsxs)(n.x,{children:[(0,i.jsx)(o.Z,{variant:"label-lg",children:"Log Redaction"}),(0,i.jsx)(o.Z,{variant:"body-lg",mt:4,children:'Sensitive information contained in SQL text in the cluster log will be replaced by "?".'}),!E&&(0,i.jsx)(r.b,{color:"yellow",icon:(0,i.jsx)(h.DpU,{size:16}),mt:8,children:"Database audit log redaction is currently disabled, resulting in log files pushed to the user's cloud storage service containing sensitive information. This configuration is not recommended due to potential security risks."})]}),(0,i.jsx)(g.j,{name:"redacted"})]}),(0,i.jsx)(d.i,{mx:-24,my:24}),(0,i.jsxs)(s.k,{gap:16,justify:"flex-end",children:[(0,i.jsx)(c.z,{variant:"default",onClick:S,children:"Cancel"}),!e&&(0,i.jsx)(c.z,{variant:"default",onClick:()=>null==A?void 0:A(),children:"Previous"}),(0,i.jsxs)(c.z,{type:"submit",loading:z.isLoading,onClick:D,children:["Save ",e?"":"and Enable"]})]})]})}},755940:function(e,t,l){l.d(t,{w:()=>c});var i=l(552676),a=l(971798),n=l(359697),r=l(582473),o=l(275271),s=l(469987),d=l(444242);let c=(0,r.Pi)(({opened:e,clusterId:t,cluster:l,orgId:r,projectId:c,config:u,onCancel:g})=>{let h=(0,s.cI)();return(0,o.useEffect)(()=>{var t,l,i,a;e&&(null==u?void 0:u.enabled)&&h.reset({...u,redacted:!u.unredacted,rotationPolicy:{maxAgeSecond:null===(l=u.rotationPolicy)||void 0===l?void 0:null===(t=l.maxAgeSecond)||void 0===t?void 0:t.toString(),maxSizeMib:null===(a=u.rotationPolicy)||void 0===a?void 0:null===(i=a.maxSizeMib)||void 0===i?void 0:i.toString()}})},[u,h,e]),(0,i.jsx)(a.u,{opened:e,centered:!0,trapFocus:!1,size:800,title:"Database Audit Logging Settings",closeOnClickOutside:!1,onClose:g,children:(0,i.jsx)(n.l,{layout:"none",form:h,withActions:!1,onSubmit:()=>{},onCancel:()=>{},children:(0,i.jsx)(d.g,{isUpdate:!0,cluster:l,clusterId:t,orgId:r,projectId:c,onCancel:g})})})})},151043:function(e,t,l){l.d(t,{Z:()=>z});var i=l(552676),a=l(775364),n=l(915030),r=l(712995),o=l(150288),s=l(366130),d=l(359697),c=l(365582),u=l(379809),g=l(582473),h=l(275271),p=l(469987),v=l(381674),x=l(585125),m=l(671948),b=l(420313),j=l(187758),f=l(199436),C=l(12537),y=l(448758),k=l(254023),S=l(864193),A=l(690847),w=l(900361),I=l(904100),L=l(444242);let z=(0,g.Pi)(({opened:e,cluster:t,orgId:l,projectId:g,onClose:z})=>{var _;let[E,R]=(0,h.useState)("initial"),[D,Z]=(0,h.useState)(!1),[T,F]=(0,h.useState)(!1),[P,N]=(0,h.useState)(!1),{config:B,setConfigStep:O}=(0,y.k)(),U=(0,p.cI)({mode:"onChange"}),{watch:$}=U,M=$("bucketUri"),q=$("awsRoleArn"),Q=$("bucketRegionId"),K=$("azureSasToken"),W=(0,f.AM)(),G=(0,f.AM)(),V=(0,v.useQueryClient)(),{expEnabled:Y}=(0,x.i)("node-group"),{providers:H}=(0,j.L3)({tier:"dedicated",enabled:!!e}),{data:J=[]}=(0,f.Ov)({orgId:l,projectId:g,pageSize:99},{query:{enabled:!!(l&&Y&&e),select:e=>{let t=(0,u.Z)((null==e?void 0:e.regions)||[],"cloudProvider");return Object.keys(t).map(e=>{var l;return{name:e,regions:null===(l=t[e])||void 0===l?void 0:l.map(e=>{var t,l,i;return{name:null!==(l=null===(t=e.regionId)||void 0===t?void 0:t.replace(/^(aws|gcp|azure)-/,""))&&void 0!==l?l:"",display_name:null!==(i=e.displayName)&&void 0!==i?i:"",cross_account_deployment_id:""}})}})}}}),X=(0,b.JM)({providers:Y?J:H,currentProvider:t.provider});(0,h.useEffect)(()=>
1{if(Z(!1),"initial"===E){F(!1);return}R("initial"),F(!0)},[M,q,Q,K]),(0,h.useEffect)(()=>{let e=(0,w.kH)(t),l=(null==B?void 0:B.enabled)?{...B,redacted:!B.unredacted}:{...B,...e};l.bucketManager===C.h.PINGCAP&&(l={...l,awsRoleArn:"",azureSasToken:"",bucketRegionId:"",bucketUri:""}),U.reset(l)},[B]);let ee=()=>{U.reset(),R("initial"),O(k.Nr.Initial),F(!1),Z(!1),z(),N(!1)},et=async e=>{try{Z(!0),await W.mutateAsync({clusterId:null==t?void 0:t.id,data:{awsRoleArn:e.awsRoleArn,azureSasToken:e.azureSasToken,bucketRegionId:e.bucketRegionId,bucketUri:e.bucketUri,bucketManager:C.h.CUSTOMER},params:{projectId:g,orgId:l,validateOnly:!0}}),R("passed"),O(k.Nr.Settings),F(!1),N(!0)}catch(e){}},el=async e=>{var i;await G.mutateAsync({clusterId:null==t?void 0:t.id,data:{...B,awsRoleArn:e.awsRoleArn,azureSasToken:e.azureSasToken,bucketRegionId:e.bucketRegionId,bucketUri:e.bucketUri,bucketManager:C.h.CUSTOMER},params:{projectId:g,orgId:l}}),V.fetchQuery((0,f.s$)(null!==(i=null==t?void 0:t.id)&&void 0!==i?i:"",{orgId:l,projectId:g}),()=>{var e;return(0,f.Sl)(null!==(e=null==t?void 0:t.id)&&void 0!==e?e:"",{orgId:l,projectId:g})}),z()},ei=(0,h.useMemo)(()=>{switch(t.provider){case m.nq.AZURE:return!(M&&K);case m.nq.AWS:return!(M&&q&&Q);case m.nq.GCP:return!(M&&Q)}},[M,Q,q,K]),ea=(0,h.useMemo)(()=>{if("initial"===E||T||ei||W.isError)return!0},[E,T,ei,P]),en=W.isLoading,er=G.isLoading;return(0,i.jsxs)(d.l,{layout:"none",form:U,withActions:!1,onSubmit:()=>{},onCancel:ee,children:[(0,i.jsxs)(a.x,{sx:{height:P?0:"auto",overflow:P?"hidden":"visible"},children:[(0,i.jsxs)(n.k,{align:"top",gap:16,children:[(0,i.jsx)(a.x,{sx:{flex:1},children:(null==t?void 0:t.provider)===m.nq.AZURE?(0,i.jsx)(A.Z,{disabled:en||er}):(0,i.jsx)(S.Z,{provider:t.provider,disabled:en||er,regions:X})}),t.provider!==m.nq.AZURE&&(0,i.jsx)(I.JT,{clusterId:null==t?void 0:t.id,provider:t.provider})]}),!en&&D&&W.isError&&(0,i.jsx)(r.b,{mt:16,color:"red",children:(0,i.jsxs)(n.k,{align:"center",gap:8,children:[(0,i.jsx)(a.x,{component:c.IF3,size:18}),null===(_=W.error)||void 0===_?void 0:_.message]})}),(0,i.jsx)(o.i,{mx:"-xl",my:16}),(0,i.jsxs)(n.k,{justify:"flex-end",align:"center",gap:16,children:[(0,i.jsx)(s.z,{variant:"default",onClick:ee,children:"Cancel"}),(0,i.jsxs)(s.z,{disabled:!ea||en||ei,loading:(null==B?void 0:B.enabled)?er:en,"data-mp-event":"Database Audit Logging Test Connection Button Clicked ",onClick:()=>{let e=U.getValues();(null==B?void 0:B.enabled)?el(e):et(e)},children:["Test Connection and ",(null==B?void 0:B.enabled)?"Save":"Next"]})]})]}),(0,i.jsx)(a.x,{sx:{height:P?"auto":0,overflow:P?"visible":"hidden"},children:(0,i.jsx)(L.g,{clusterId:null==t?void 0:t.id,cluster:t,orgId:l,isUpdate:!1,projectId:g,bucketManager:C.h.CUSTOMER,onCancel:()=>ee(),onPrevious:()=>{N(!1),R("initial"),O(k.Nr.Config)}})})]})})},341249:function(e,t,l){l.d(t,{Z:()=>C});var i=l(552676),a=l(125385),n=l(775364),r=l(150288),o=l(915030),s=l(366130),d=l(359697),c=l(275271),u=l(469987),g=l(381674),h=l(199436),p=l(12537),v=l(294859),x=l(241852),m=l(448758),b=l(254023),j=l(900361),f=l(444242);let C=({cluster:e,projectId:t,orgId:l,onClose:C})=>{let y=(0,h.AM)(),{setConfigStep:k,configStep:S,config:A}=(0,m.k)(),w=(0,u.cI)({mode:"onChange"}),I=(0,g.useQueryClient)(),L=async()=>{try{if(await y.mutateAsync({clusterId:null==e?void 0:e.id,data:{...A,bucketManager:p.h.PINGCAP},params:{projectId:t,orgId:l}}),null==A?void 0:A.enabled){var i;I.fetchQuery((0,h.s$)(null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"",{orgId:l,projectId:t}),()=>{var i;return(0,h.Sl)(null!==(i=null==e?void 0:e.id)&&void 0!==i?i:"",{orgId:l,projectId:t})}),C()}else k(b.Nr.Settings)}catch(e){a.r.error((0,v.e$)(e,!0))}},z=(0,c.useMemo)(()=>S===b.Nr.Settings,[S]);return(0,c.useEffect)(()=>{S===b.Nr.Settings&&w.reset((0,j.kH)(e))},[S]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.x,{sx:{height:z?0:"auto",overflow:z?"hidden":"visible"},children:[(0,i.jsx)(x.Z,{}),(0,i.jsx)(r.i,{mx:"-xl",my:16}),(0,i.jsxs)(o.k,{align:"center",justify:"flex-end",children:[(0,i.jsx)(s.z,{variant:"default",onClick:C,children:"Cancel"}),(0,i.jsx)(s.z,{ml:16,type:"submit",loading:y.isLoading,"data-mp-event":"DB Audit Logging Enable Button Clicked","data-mp-source":"Store in TiDB",onClick:L,children:(null==A?void 0:A.enabled)?"Save":"Next"})]})]}),(0,i.jsx)(d.l,{layout:"none",form:w,withActions:!1,onSubmit:()=>{},onCancel:C,children:(0,i.jsx)(n.x,{sx:{height:z?"auto":0,overflow:z?"visible":"hidden"},children:(0,i.jsx)(f.g,{clusterId:null==e?void 0:e.id,cluster:e,orgId:l,isUpdate:!1,projectId:t,bucketManager:p.h.PINGCAP,onCancel:C,onPrevious:()=>{k(b.Nr.Config)}})})})]})}},16087:function(e,t,l){l.d(t,{Z:()=>S});var i=l(552676),a=l(619102),n=l(128177),r=l(740521),o=l(98172),s=l(915030),d=l(156102),c=l(366130),u=l(185917),g=l(775364),h=l(287096),p=l(365582),v=l(582473),x=l(275271),m=l(187371),b=l(566249),j=l(448758),f=l(102806),C=l(974638),y=l(223e3),k=l(755940);let S=(0,v.Pi)(({cluster:e})=>{let[t,l]=(0,x.useState)(!1),[v,S]=(0,x.useState)(!1),[A,w]=(0,x.useState)(!1),{store:{tenantData:I,activeProjectId:L}}=(0,b.Z)(),{config:z,isLoadingConfig:_}=(0,j.k)(),E=null==z?void 0:z.enabled,{accessDeniedReason:R,invalidReason:D,accessible:Z,isInvalid:T}=(0,f.l)(e,"ClusterAuditSwitch");return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)(a.Z,{p:"xl",children:[(0,i.jsxs)(n.Z,{justify:"space-between",gap:48,children:[(0,i.jsxs)(r.K,{gap:4,sx:{flex:1},children:[(0,i.jsxs)(n.Z,{gap:"md",children:[(0,i.jsx)(o.Z,{variant:"title-lg",children:"Database Audit Logging"}),!_&&(0,i.jsx)(h.k,{color:E?"green":"gray",children:E?"Enabled":"Disabled"})]}),(0,i.jsx)(s.k,{gap:4,children:(0,i.jsxs)(o.Z,{variant:"body-lg",c:"carbon.7",children:["Track various behaviors and operations of database users."," ",(0,i.jsx)("a",{href:"https://docs.pingcap.com/tidbcloud/tidb-cloud-auditing",target:"_blank",rel:"noreferrer","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log","data-mp-content":"about user access and history",children:"Learn more"}),"."]})})]}),_&&(0,i.jsx)(d.a,{size:"sm"}),!_&&(0,i.jsxs)(i.Fragment,{children:[E&&(0,i.jsxs)(s.k,{gap:8,children:[(0,i.jsx)(m.u,{reasons:[R,D],children:({matched:e})=>(0,i.jsx)(c.z,{size:"sm",variant:"outline",disabled:e,"data-mp-event":"DB Audit Logging Edit Config Button Clicked",onClick:()=>w(!0),children:"Settings"})}),(0,i.jsxs)(u.v,{children:[(0,i.jsx)(u.v.Target,{children:(0,i.jsx)(c.z,{variant:"outline",size:"sm",children:(0,i.jsx)(g.x,{c:"carbon.8",component:p.aQl,size:20})})}),(0,i.jsxs)(u.v.Dropdown,{children:[(0,i.jsx)(u.v.Item,{disabled:T||!Z,"data-mp-event":"DB Audit Logging Storage Configuration Button Clicked",onClick:()=>l(!0),children:"Storage Configuration"}),(0,i.jsx)(u.v.Item,{c:"red",disabled:T||!Z,"data-mp-event":"DB Audit Logging Disable Config Button Click",onClick:()=>S(!0),children:"Disable"})]})]})]}),!E&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(m.u,{reasons:[R,D],children:({matched:e})=>(0,i.jsx)(c.z,{size:"sm",disabled:e,"data-mp-event":"DB Audit Logging Enable Entrance Button Clicked",onClick:()=>l(!0),children:"Enable"})})})]})]}),(0,i.jsx)(y.Z,{opened:t,cluster:e,orgId:I.id,projectId:L,config:z,onClose:()=>l(!1)}),(0,i.jsx)(C.Z,{opened:v,cluster:e,config:z,orgId:I.id,projectId:L,onClose:()=>S(!1)}),(0,i.jsx)(k.w,{opened:A,config:z,clusterId:e.id,cluster:e,orgId:I.id,projectId:L,onCancel:()=>w(!1)})]})})})},140015:function(e,t,l){l.d(t,{s:()=>f});var i=l(552676),a=l(125385),n=l(971798),r=l(775364),o=l(98172),s=l(892654),d=l(359697),c=l(825539),u=l(275271),g=l(469987),h=l(236910),p=l(705374),v=l(294859),x=l(566249),m=l(59837),b=l(254023),j=l(379281);let f=({opened:e,data:t,onClose:l,onConfirm:f})=>{var C;let y=(0,g.cI)({defaultValues:{}}),{store:{lastVisitLocation:{orgId:k,projectId:S}}}=(0,x.Z)(),[A,w]=(0,u.useState)((0,j.$)()),I=y.watch("display_name"),L=y.watch("userExpr"),{cluster:z}=(0,m.x)(),{mutateAsync:_,isLoading:E}=(0,p.vx)(),{mutateAsync:R,isLoading:D}=(0,p.ge)();(0,u.useEffect)(()=>{var e,l,i,a;t&&(y.setValue("display_name",null!==(i=t.display_name)&&void 0!==i?i:""),y.setValue("userExpr",(null===(e=t.users)||void 0===e?void 0:e.length)?t.users[0]:""),w((null==t?void 0:null===(l=t.filters)||void 0===l?void 0:l.length)&&null!==(a=null==t?void 0:t.filters[0].classes)&&void 0!==a?a:[]))},[null==t?void 0:t.display_name,null==t?void 0:t.users,null==t?void 0:t.filters]),(0,u.useEffect)(()=>{e||w((0,j.$)())},[e]);let Z=async e=>{try{t?await F(e):await T(e),P(),null==f||f()}catch(e){a.r.error((0,v.e$)(e,!0))}},T=async e=>{try{await _({orgId:k,projectId:S,clusterId:z.id,data:{filter_rule:{display_name:e.display_name,disabled:!1,users:[e.userExpr],filters:[{classes:A}]}}})}catch(e){throw e}},F=async e=>{try{var l;await R({orgId:k,projectId:S,clusterId:z.id,filterRuleId:null!==(l=null==t?void 0:t.filter_rule_id)&&void 0!==l?l:"",data:{...t,display_name:e.display_name,users:[e.userExpr],filters:[{classes:A}]}})}catch(e){throw e}},P=()=>{y.reset(),l()},N=(0,u.useMemo)(()=>`${t?"Edit":"Add"} Filter Rule`,[t]);return(0,i.jsx)(n.u,{opened:e,size:640,title:N,centered:!0,closeOnClickOutside:!1,onClose:P,children:(0,i.jsxs)(d.l,{form:y,onSubmit:Z,onCancel:P,actionsProps:{confirmProps:{loading:t?D:E,disabled:!I||!L||0===A.length,"data-testid":t?"audit-log-submit-filter-rule-update":"audit-log-submit-filter-rule-create"}},children:[(0,i.jsx)(c.c,{name:"display_name",label:"Filter Name",placeholder:"Enter filter name"}),(0,i.jsxs)(r.x,{children:[(0,i.jsx)(c.c,{name:"userExpr",disabled:!!t,label:"SQL User",placeholder:"Enter SQL user"}),(0,i.jsxs)(o.Z,{variant:"body-md",c:"carbon.7",mt:8,children:["The SQL user format is ",(0,i.jsxs)(s.E,{children:["<",null===(C=z.serverless)||void 0===C?void 0:C.userPrefix,".user>@<host>"]}),", where username and hostname can use ",(0,i.jsx)(s.E,{children:"%"})," for any value or ",(0,i.jsx)(s.E,{children:"_"})," for any character. The"," ",(0,i.jsx)(s.E,{children:"@"})," and host are optional."]})]}),(0,i.jsxs)(r.x,{children:[(0,i.jsx)(o.Z,{variant:"label-lg",mb:6,children:"Filter Events"}),(0,i.jsx)(h.m,{value:A,onChange:e=>w(e.length?e:(0,j.$)()),allWithEmpty:!0,placeholder:"Selet filter rules",selectItemProps:{miw:590,sx:{"::-webkit-scrollbar":{width:0}},textProps:{sx:{wordBreak:"break-word",whiteSpace:"normal",maxWidth:"90%"}}},options:b.GM,maxContentHeight:280,isShouldParentSelectable:!0})]})]})})}},123324:function(e,t,l){l.d(t,{A:()=>p});var i=l(552676),a=l(125385),n=l(971798),r=l(98172),o=l(128177),s=l(366130),d=l(381674),c=l(18067),u=l(705374),g=l(294859),h=l(566249);let p=({opened:e,clusterId:t,data:l,onClose:p,onConfirm:v})=>{let{store:{lastVisitLocation:{orgId:x,projectId:m}}}=(0,h.Z)(),b=(0,d.useQueryClient)(),{mutateAsync:j,isLoading:f}=(0,u.$_)(),C=async()=>{try{var e;await j({orgId:x,projectId:m,clusterId:t,filterRuleId:encodeURIComponent(null!==(e=null==l?void 0:l.filter_rule_id)&&void 0!==e?e:"")}
1),b.fetchQuery((0,u.Rf)(x,m,null!=t?t:""),()=>(0,u.nQ)(x,m,null!=t?t:"")),p(),null==v||v()}catch(e){a.r.error((0,g.e$)(e))}};return(0,i.jsxs)(n.u,{opened:e,size:560,title:"Delete Filter Rule",centered:!0,onClose:p,styles:{body:{padding:0}},children:[(0,i.jsxs)(r.Z,{variant:"body-lg",mt:"xl",mb:36,mx:"xl",children:["The audit log filter rule ",(0,i.jsx)(c.r,{children:null==l?void 0:l.display_name})," will be permanently deleted and cannot be recovered. Are you sure to delete it?"]}),(0,i.jsxs)(o.Z,{justify:"flex-end",mx:"xl",my:"md",children:[(0,i.jsx)(s.z,{onClick:p,variant:"default",children:"Cancel"}),(0,i.jsx)(s.z,{color:"red",variant:"light",loading:f,onClick:C,"data-mp-event":"Deleted an Log Filter Rule",children:"I understand, Delete it"})]})]})}},376174:function(e,t,l){l.d(t,{Z:()=>C});var i=l(552676),a=l(125385),n=l(156102),r=l(855242),o=l(185917),s=l(402899),d=l(797e3),c=l(158483),u=l(365582),g=l(582473),h=l(275271),p=l(324178),v=l(44028),x=l(705374),m=l(294859),b=l(566249),j=l(140015),f=l(123324);let C=(0,g.Pi)(({clusterId:e})=>{var t,l,g;let C;let{store:{lastVisitLocation:{orgId:y,projectId:k}}}=(0,b.Z)(),[S,A]=(0,h.useState)(0),{data:w,isFetching:I,refetch:L}=(0,x.vv)(y,k,e,{page_size:5,page_token:`${S+1}`},{query:{refetchOnWindowFocus:!1,refetchInterval:!1}}),z=(0,p.x)("TidbxDBAuditLogFilterRulesActions",{tidbId:e}),[_,E]=(0,c.q)(),[R,D]=(0,c.q)(),[Z,T]=(0,h.useState)(),[F,P]=(0,h.useState)(),{mutateAsync:N,isLoading:B}=(0,x.ge)(),O=async t=>{try{var l;P(t),await N({clusterId:e,orgId:y,projectId:k,filterRuleId:null!==(l=t.filter_rule_id)&&void 0!==l?l:"",data:{disabled:!t.disabled}}),await v.E.invalidateQueries((0,x.Rf)(y,k,e)).finally(()=>{P(void 0)})}catch(e){a.r.error((0,m.e$)(e)),P(void 0)}},U=(0,h.useMemo)(()=>[{Header:(0,i.jsx)(i.Fragment,{}),header:"Enabled",size:100,Cell:({row:e})=>{let t=e.original;return(0,i.jsx)(i.Fragment,{children:(null==F?void 0:F.filter_rule_id)===t.filter_rule_id?(0,i.jsx)(n.a,{size:"xs",ml:4}):(0,i.jsx)(r.r,{size:"sm",checked:!t.disabled,"data-testid":"audit-log-filter-switch",onClick:e=>{O(t)}})})}},{header:"Filter Name",accessorKey:"display_name"},{header:"SQL User",accessorFn:e=>{var t;return null===(t=e.users)||void 0===t?void 0:t.join(", ")}},{header:"Filter Events",accessorFn:e=>{var t;return null===(t=e.filters)||void 0===t?void 0:t.map(e=>{var t;return null===(t=e.classes)||void 0===t?void 0:t.join(", ")}).join(", ")}},{Header:(0,i.jsx)(i.Fragment,{}),header:"Actions",size:20,Cell:({row:e})=>{let t=e.original;return(0,i.jsxs)(o.v,{withinPortal:!0,position:"bottom-end",children:[(0,i.jsx)(o.v.Target,{children:(0,i.jsx)(s.A,{variant:"subtle","data-testid":"audit-log-filter-row-actions",children:(0,i.jsx)(u.aQl,{size:16})})}),(0,i.jsxs)(o.v.Dropdown,{children:[(0,i.jsx)(o.v.Item,{onClick:()=>{T(t),setTimeout(()=>{D.open()})},"data-mp-event":"Edit an Log Filter Rule Clicked","data-testid":"audit-log-filter-edit",children:"Edit"}),(0,i.jsx)(o.v.Item,{onClick:()=>{E.open(),T(t)},c:"red","data-mp-event":"Delete an Log Filter Rule Clicked","data-testid":"audit-log-filter-delete",disabled:!z,children:"Delete"})]})]})}}],[B,Z,null==w?void 0:w.filter_rules]);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(d.Q,{loading:I,columns:U,data:null!==(t=null==w?void 0:w.filter_rules)&&void 0!==t?t:[],emptyMessage:"No Data",manualPagination:!0,pagination:(null!==(l=null==w?void 0:w.total_size)&&void 0!==l?l:0)?{value:S+1,showTotal:!0,total:Math.ceil((null!==(g=null==w?void 0:w.total_size)&&void 0!==g?g:0)/5),localization:{total:"Total: "}}:void 0,onPaginationChange:(C=(e,t)=>{A(e)},e=>{let t="function"==typeof e?e({pageIndex:S,pageSize:5}):e;(t.pageIndex!==S||5!==t.pageSize)&&C(t.pageIndex,t.pageSize)})}),(0,i.jsx)(f.A,{opened:_,onClose:E.close,clusterId:e,data:Z,onConfirm:()=>{A(0),L()}}),(0,i.jsx)(j.s,{opened:R,data:Z,onConfirm:()=>{A(0),L()},onClose:D.close})]})})},328802:function(e,t,l){l.d(t,{i:()=>b});var i=l(552676),a=l(619102),n=l(740521),r=l(128177),o=l(98172),s=l(366130),d=l(158483),c=l(582473),u=l(381674),g=l(187371),h=l(705374),p=l(566249),v=l(102806),x=l(140015),m=l(376174);let b=(0,c.Pi)(({cluster:e})=>{let{store:{lastVisitLocation:{orgId:t,projectId:l}}}=(0,p.Z)(),[c,b]=(0,d.q)(),j=e.id,f=(0,u.useQueryClient)(),{accessDeniedReason:C,invalidReason:y}=(0,v.l)(e,"ClusterAuditFilterCreation");return(0,i.jsxs)(a.Z,{p:"lg",children:[(0,i.jsxs)(n.K,{gap:"xl",children:[(0,i.jsxs)(r.Z,{justify:"space-between",wrap:"nowrap",gap:24,children:[(0,i.jsxs)(n.K,{gap:4,maw:700,children:[(0,i.jsx)(o.Z,{variant:"title-lg",children:"Audit Filters"}),(0,i.jsxs)(o.Z,{variant:"body-lg",c:"carbon.7",inline:!0,children:["Filter rules determine which events will be audited."," ",(0,i.jsx)("b",{children:"If there are no filter rules, nothing will be audited"})," except audit management events. Learn how to"," ",(0,i.jsx)("a",{target:"_blank",href:"https://docs.pingcap.com/tidbcloud/essential-database-audit-logging/?plan=essential#manage-audit-logging-filter-rules","data-mp-event":"Documentation Link Clicked","data-mp-source":"Audit Log","data-mp-content":"set up filter rules",rel:"noreferrer",children:"set up filter rules"}),"."]})]}),(0,i.jsx)(g.u,{reasons:[C,y],children:({matched:e})=>(0,i.jsx)(s.z,{size:"sm",variant:"default",mr:16,"data-mp-event":"DB Audit Logging Add Filter Rule Button Clicked","data-testid":"audit-log-add-filter-rule",onClick:e=>{e.stopPropagation(),b.open()},disabled:e,children:"Add Filter Rule"})})]}),(0,i.jsx)(m.Z,{clusterId:j})]}),(0,i.jsx)(x.s,{opened:c,onClose:b.close,onConfirm:()=>{b.close(),f.invalidateQueries((0,h.Rf)(t,l,j))}})]})})},376183:function(e,t,l){l.d(t,{Z:()=>g});var i=l(552676),a=l(915030),n=l(156102),r=l(740521),o=l(582473),s=l(59837),d=l(328802),c=l(195884),u=l(382023);let g=(0,o.Pi)(({cluster:e})=>{let{isInitingConfig:t}=(0,s.x)();return(0,i.jsx)(i.Fragment,{children:t?(0,i.jsx)(a.k,{h:"100%",align:"center",justify:"center",children:(0,i.jsx)(n.a,{})}):(0,i.jsxs)(r.K,{gap:"xl",children:[(0,i.jsx)(u.Z,{cluster:e}),(0,i.jsx)(d.i,{cluster:e}),(0,i.jsx)(c.y,{clusterId:e.id})]})})})},501767:function(e,t,l){l.d(t,{Z:()=>k});var i=l(552676),a=l(125385),n=l(185917),r=l(402899),o=l(775364),s=l(366130),d=l(941794),c=l(915030),u=l(98172),g=l(797e3),h=l(365582),p=l(416483),v=l.n(p),x=l(582473),m=l(275271),b=l(69609),j=l(705374),f=l(294859),C=l(566249);let y="YYYY-MM-DD",k=(0,x.Pi)(({clusterId:e})=>{var t,l,p,x,k;let S,A,w;let[I,L]=(0,m.useState)({}),[z,_]=(0,m.useState)({pageIndex:0,pageSize:5}),[E,R]=(0,m.useState)(!1),[D,Z]=(0,m.useState)(new Date),{store:{tenantData:T,activeProjectId:F}}=(0,C.Z)(),[P,N]=(0,m.useState)(!1),{data:B,isLoading:O}=(0,j.pv)(T.id,F,e,{date:v()(D).format(y),page_size:1e3,page_token:""},{query:{refetchOnWindowFocus:!1,refetchInterval:!1,enabled:!!(T.id&&F),onError:e=>{a.r.error((0,f.e$)(e,!0))}}});(0,m.useEffect)(()=>{});let U=(0,m.useMemo)(()=>Object.keys(I).filter(e=>I[e]),[null==B?void 0:B.audit_log_files,I]),$=async(e,t)=>{try{let l=await fetch(e).then(e=>e.blob()),i=URL.createObjectURL(l),a=document.createElement("a");document.body.appendChild(a),a.href=i,a.download=t,a.click(),setTimeout(()=>{document.body.removeChild(a)}
1,0)}catch(e){a.r.error((0,f.e$)(e,!0))}},M=[{header:"Name",accessorKey:"name"},{header:"Size",accessorFn:({size_bytes:e})=>(0,b.f)(null!=e?e:0,!1)},{Header:(0,i.jsx)(i.Fragment,{}),header:"Actions",size:20,accessorFn:e=>(0,i.jsxs)(n.v,{withinPortal:!0,position:"bottom-start",children:[(0,i.jsx)(n.v.Target,{children:(0,i.jsx)(r.A,{variant:"subtle",children:(0,i.jsx)(h.aQl,{size:16})})}),(0,i.jsx)(n.v.Dropdown,{children:(0,i.jsx)(n.v.Item,{onClick:()=>{var t;return q([null!==(t=e.name)&&void 0!==t?t:""])},"data-mp-event":"Download an Log Clicked",children:"Download"})})]})}],q=async t=>{if(t.length){R(!0);try{var l;let i=await (0,j.h)(T.id,F,e,{audit_log_file_names:t}).then(e=>({downloadAddress:null==e?void 0:e.audit_log_files}));for(let{url:e,name:t}of(R(!1),null!==(l=i.downloadAddress)&&void 0!==l?l:[]))e&&await $(e,null!=t?t:"")}catch(e){R(!1)}}};return(0,i.jsxs)(o.x,{mt:24,children:[(0,i.jsxs)(n.v,{position:"bottom-end",opened:P,onChange:N,withArrow:!1,children:[(0,i.jsx)(n.v.Target,{children:(0,i.jsxs)(s.z,{variant:"outline",onClick:()=>N(!P),sx:{background:"transparent"},children:[(0,i.jsx)(h.Eef,{mr:8,size:16}),v()(D).format(y)]})}),(0,i.jsx)(n.v.Dropdown,{children:(0,i.jsx)(d.M,{value:D,type:"default",maxDate:new Date,onChange:e=>{Z(null!=e?e:new Date),N(!1),L({})}})})]}),(0,i.jsxs)(o.x,{sx:{position:"relative"},mt:8,children:[(0,i.jsx)(g.Q,{loading:O,columns:M,data:null!==(p=null==B?void 0:null===(t=B.audit_log_files)||void 0===t?void 0:t.slice(z.pageIndex*z.pageSize,z.pageIndex*z.pageSize+z.pageSize))&&void 0!==p?p:[],enableRowSelection:!0,state:{rowSelection:I,pagination:{pageIndex:z.pageIndex,pageSize:z.pageSize}},mantineSelectCheckboxProps:{size:"xs"},mantineSelectAllCheckboxProps:{size:"xs"},onRowSelectionChange:L,getRowId:e=>{var t;return null!==(t=e.name)&&void 0!==t?t:""},manualPagination:!0,pagination:(null!==(x=null==B?void 0:B.audit_log_files)&&void 0!==x?x:0)&&!U.length?{value:z.pageIndex+1,showTotal:!0,showRowsPerPage:!0,total:Math.ceil((null!==(k=null==B?void 0:null===(l=B.audit_log_files)||void 0===l?void 0:l.length)&&void 0!==k?k:0)/z.pageSize),rowsPerPageOptions:[5,10,15].map(e=>({value:String(e),label:`${e} / page`})),localization:{total:"Total: "},onChange:e=>{_({pageSize:z.pageSize,pageIndex:e-1})}}:void 0,onPaginationChange:(S=z.pageIndex,A=z.pageSize,w=(e,t)=>{_({pageIndex:0,pageSize:t})},e=>{let t="function"==typeof e?e({pageIndex:S,pageSize:A}):e;t.pageSize!==A&&w(t.pageIndex,t.pageSize)}),emptyMessage:"No Data"}),!!U.length&&(0,i.jsxs)(c.k,{align:"center",gap:24,pt:8,children:[(0,i.jsxs)(u.Z,{variant:"label-md",children:[U.length," selected"]}),(0,i.jsx)(s.z,{variant:"subtle",color:"sky",size:"compact-lg",loading:E,"data-mp-event":"DB Audit Logging Selected Files Download Button Clicked",onClick:()=>q(Object.keys(I)),children:"Download"}),(0,i.jsx)(s.z,{variant:"subtle",size:"compact-lg",disabled:E,"data-mp-event":"DB Audit Logging Selected Files Cancel Button Clicked",onClick:()=>L({}),children:"Cancel"})]})]})]})})},195884:function(e,t,l){l.d(t,{y:()=>c});var i=l(552676),a=l(619102),n=l(582473),r=l(243954),o=l(210932),s=l(59837),d=l(501767);let c=(0,n.Pi)(({clusterId:e})=>{var t;let{config:l}=(0,s.x)();return(null==l?void 0:l.enabled)&&(null===(t=l.cloud_storage)||void 0===t?void 0:t.type)===r.r.TIDB_CLOUD?(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(o.Z,{docLink:"https://docs.pingcap.com/tidbcloud/essential-database-audit-logging/?plan=essential#access-audit-logging-with-tidb-cloud-storage"}),(0,i.jsx)(d.Z,{clusterId:e})]}):null})},221194:function(e,t,l){l.d(t,{Z:()=>m});var i=l(552676),a=l(712995),n=l(150288),r=l(128177),o=l(366130),s=l(365582),d=l(582473),c=l(275271),u=l(469987),g=l(705374),h=l(243954),p=l(294859),v=l(566249),x=l(59837);let m=(0,d.Pi)(({onCancel:e,onSucc:t,cancelText:l,confirmText:d,clusterId:m,isConfirmDisabled:b})=>{let j=(0,g.AM)(),{watch:f,handleSubmit:C}=(0,u.Gc)(),{store:{tenantData:y,activeProjectId:k}}=(0,v.Z)(),{config:S}=(0,x.x)(),A=f("storage_type"),w=A===h.r.TIDB_CLOUD,I=(0,c.useMemo)(()=>w?"":"Test Connection and",[w]),L=async e=>{let l=A.toLowerCase();if(A===h.r.GCS){var i,a;e.gcs.service_account_key=null!==(a=null===(i=e.gcs.service_account_key)||void 0===i?void 0:i.content)&&void 0!==a?a:""}let n={...S,cluster_id:null!=m?m:"",cloud_storage:{type:A,[l]:{...e[l]}}};delete n.base_resp;try{await j.mutateAsync({clusterId:null!=m?m:"",orgId:y.id,projectId:k,data:{audit_log_config:n}}),t()}catch(e){}};return(0,i.jsxs)(i.Fragment,{children:[!j.isLoading&&j.isError&&(0,i.jsx)(a.b,{color:"red",mt:"lg",icon:(0,i.jsx)(s.IF3,{}),children:(0,p.e$)(j.error,!0)}),(0,i.jsx)(n.i,{mx:-24,mt:"lg"}),(0,i.jsxs)(r.Z,{justify:"flex-end",mt:16,gap:16,children:[(0,i.jsx)(o.z,{variant:"outline",onClick:e,children:null!=l?l:"Cancel"}),(0,i.jsx)(o.z,{type:"submit",loading:j.isLoading,disabled:b,onClick:C(L),children:null!=d?d:`${I} ${(null==S?void 0:S.enabled)?"Save":"Next"}`})]})]})})},510281:function(e,t,l){l.d(t,{$:()=>v});var i=l(552676),a=l(740521),n=l(775364),r=l(825539),o=l(582473),s=l(275271),d=l(469987),c=l(84241),u=l(558761),g=l(59837),h=l(221194),p=l(747282);let v=(0,o.Pi)(({clusterId:e,onCancel:t,onSucc:l})=>{let{config:o}=(0,g.x)(),{setValue:v,watch:x}=(0,d.Gc)(),m=x("oss.uri"),b=x("oss.access_key.id"),j=x("oss.access_key.secret"),f=(0,s.useMemo)(()=>!m||!b||!j,[m,b,j]);return(0,s.useEffect)(()=>{var e,t;(null==o?void 0:null===(e=o.cloud_storage)||void 0===e?void 0:e.oss)&&v("oss",{...null==o?void 0:null===(t=o.cloud_storage)||void 0===t?void 0:t.oss,"access_key.secret":""})},[o]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.K,{gap:"lg",children:[(0,i.jsxs)(n.x,{children:[(0,i.jsx)(r.c,{name:"oss.uri",label:"Destination Files URI",placeholder:"oss://auditlog-bucket/auditlog-folder/"}),(0,i.jsx)(p.Z,{name:"oss.auth_type",value:u.p.ACCESS_KEY,data:[{value:u.p.ACCESS_KEY}]})]}),(0,i.jsx)(c.D,{accessKeyFormName:"oss.access_key.id",accessKeySecretFormName:"oss.access_key.secret",accessKeyDocLink:"https://docs.pingcap.com/tidbcloud/configure-external-storage-access/?plan=e
1ssential#configure-alibaba-cloud-object-storage-service-oss-access"})]}),(0,i.jsx)(h.Z,{clusterId:e,isConfirmDisabled:f,onCancel:t,onSucc:l})]})})},218874:function(e,t,l){l.d(t,{Z:()=>y});var i=l(552676),a=l(971798),n=l(775364),r=l(359697),o=l(490764),s=l(582473),d=l(275271),c=l(469987),u=l(381674),g=l(705374),h=l(243954),p=l(147215),v=l(566249),x=l(59837),m=l(510281),b=l(651207),j=l(988636),f=l(489790),C=l(474842);let y=(0,s.Pi)(({opened:e,clusterId:t,onClose:l,onSucc:s})=>{let{config:y}=(0,x.x)(),[k,S]=(0,d.useState)(y),A=h.r.S3,{store:{tenantData:w,activeProjectId:I}}=(0,v.Z)(),L=(0,c.cI)({mode:"onChange"}),z=(0,u.useQueryClient)(),{watch:_}=L,E=_("storage_type");(0,d.useEffect)(()=>{let e={...y};e.enabled||(e.cloud_storage?e.cloud_storage.type=A:e.cloud_storage={type:A}),S(e)},[y]),(0,d.useEffect)(()=>{if(e){var t,l;L.setValue("storage_type",null!==(l=null==k?void 0:null===(t=k.cloud_storage)||void 0===t?void 0:t.type)&&void 0!==l?l:A),(null==k?void 0:k.enabled)||L.setValue("s3.auth_type",p.I.ROLE_ARN)}},[e]);let R=()=>{D(),null==s||s()},D=()=>{z.fetchQuery((0,g.s$)(w.id,I,null!=t?t:""),()=>(0,g.Sl)(w.id,I,null!=t?t:""))};return(0,i.jsx)(i.Fragment,{children:(0,i.jsx)(a.u,{title:y?"Database Audit Log Storage Configuration":"Enable Database Audit Logging",opened:e,onClose:l,size:800,centered:!0,trapFocus:!1,closeOnClickOutside:!1,children:(0,i.jsxs)(r.l,{layout:"none",form:L,withActions:!1,onSubmit:()=>{},onCancel:l,children:[(0,i.jsx)(o.i,{name:"storage_type",label:"Log Storage Location",data:[{label:"AWS S3",value:h.r.S3},{label:"Azure Blob Storage",value:h.r.AZURE_BLOB},{label:"Google Cloud Storage",value:h.r.GCS},{label:"Alibaba Cloud OSS",value:h.r.OSS},{label:"TiDB Cloud",value:h.r.TIDB_CLOUD}]}),(0,i.jsxs)(n.x,{mt:"lg",children:[E===h.r.S3&&(0,i.jsx)(b.E,{clusterId:t,onSucc:R,onCancel:l}),E===h.r.AZURE_BLOB&&(0,i.jsx)(j.J,{clusterId:t,onSucc:R,onCancel:l}),E===h.r.GCS&&(0,i.jsx)(f.o,{clusterId:t,onCancel:l,onSucc:R}),E===h.r.OSS&&(0,i.jsx)(m.$,{clusterId:t,onCancel:l,onSucc:R}),E===h.r.TIDB_CLOUD&&(0,i.jsx)(C.Z,{clusterId:t,onCancel:l,onSucc:R})]})]})})})})},747282:function(e,t,l){l.d(t,{Z:()=>s});var i=l(552676),a=l(440494),n=l(582473),r=l(275271),o=l(469987);let s=(0,n.Pi)(({name:e,value:t,data:l})=>{let{setValue:n}=(0,o.Gc)();return(0,r.useEffect)(()=>{n(e,t)},[]),(0,i.jsx)(a.H,{name:e,data:l,sx:{height:0,overflow:"hidden"}})})},651207:function(e,t,l){l.d(t,{E:()=>x});var i=l(552676),a=l(740521),n=l(825539),r=l(582473),o=l(275271),s=l(469987),d=l(671948),c=l(84241),u=l(705374),g=l(147215),h=l(566249),p=l(59837),v=l(221194);let x=(0,r.Pi)(({clusterId:e,onSucc:t,onCancel:l})=>{var r,x;let{store:{tenantData:m,activeProjectId:b}}=(0,h.Z)(),{watch:j,setValue:f}=(0,s.Gc)(),C=j("s3.uri"),y=j("s3.auth_type"),k=j("s3.role_arn"),S=j("s3.access_key.id"),A=j("s3.access_key.secret"),{config:w,cluster:I}=(0,p.x)(),L=(0,o.useMemo)(()=>{let e=y===g.I.ROLE_ARN?k:S&&A;return!C||!e},[C,y,k,S,A]),z=I.provider===d.nq.ALICLOUD,{data:_}=(0,u.Bi)(m.id,b,e);return(0,o.useEffect)(()=>{switch(y){case g.I.ROLE_ARN:f("s3.access_key",void 0);break;case g.I.ACCESS_KEY:f("s3.role_arn",void 0)}},[y]),(0,o.useEffect)(()=>{if(z){f("s3.auth_type",g.I.ACCESS_KEY);return}y||f("s3.auth_type",g.I.ROLE_ARN)},[C]),(0,o.useEffect)(()=>{var e,t;(null==w?void 0:null===(e=w.cloud_storage)||void 0===e?void 0:e.s3)&&f("s3",{...null==w?void 0:null===(t=w.cloud_storage)||void 0===t?void 0:t.s3,"access_Key.secret":""})},[w]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(a.K,{gap:"lg",children:[(0,i.jsx)(n.c,{name:"s3.uri",label:"Destination Files URI",placeholder:"s3://auditlog-bucket/auditlog-folder/"}),(0,i.jsx)(c.p,{bucketUri:C,bucketUriName:"Folder URI",authTypeFormName:"s3.auth_type",roleArnFormName:"s3.role_arn",accessKeyFormName:"s3.access_key.id",accessKeySecretFormName:"s3.access_key.secret",roleArnOptionName:g.I.ROLE_ARN,accessKeyOptionName:g.I.ACCESS_KEY,cloudformationTemplateUrl:"https://tidbcloud-prod-public-cloudformation-templates.s3.us-west-2.amazonaws.com/auditlog-role.json",cloudformationStackName:`TiDBCloud-Auditlog-${Date.now()}`,pathHashUrl:"stacks/quickcreate",roleArnDocLink:"https://docs.pingcap.com/tidbcloud/configure-external-storage-access/?plan=e
1ssential#configure-amazon-s3-access-using-a-role-arn",accessKeyDocLink:"https://docs.pingcap.com/tidbcloud/configure-external-storage-access/?plan=essential#configure-amazon-s3-access-using-an-aws-access-key",supportedMethods:I.provider===d.nq.ALICLOUD?["access_key"]:["manual","access_key"],awsAccountIdVal:null==_?void 0:null===(r=_.s3_profile)||void 0===r?void 0:r.aws_account_id,awsExternalIdVal:null==_?void 0:null===(x=_.s3_profile)||void 0===x?void 0:x.aws_external_id})]}),(0,i.jsx)(v.Z,{clusterId:e,onCancel:l,onSucc:t,isConfirmDisabled:L})]})})},988636:function(e,t,l){l.d(t,{J:()=>v});var i=l(552676),a=l(775364),n=l(740521),r=l(825539),o=l(582473),s=l(275271),d=l(469987),c=l(168553),u=l(786796),g=l(59837),h=l(221194),p=l(747282);let v=(0,o.Pi)(({clusterId:e,onCancel:t,onSucc:l})=>{let{watch:o,setValue:v}=(0,d.Gc)(),x=o("azure_blob.uri"),m=o("azure_blob.sas_token"),{config:b}=(0,g.x)(),j=(0,s.useMemo)(()=>!x||!m,[x,m]);return(0,s.useEffect)(()=>{var e,t;(null==b?void 0:null===(e=b.cloud_storage)||void 0===e?void 0:e.azure_blob)&&v("azure_blob",{...null==b?void 0:null===(t=b.cloud_storage)||void 0===t?void 0:t.azure_blob,sas_token:""})},[b]),(0,i.jsxs)(a.x,{children:[(0,i.jsxs)(n.K,{gap:"lg",children:[(0,i.jsx)(r.c,{name:"azure_blob.uri",label:"Destination Files URI",placeholder:" https://myaccount.blob.core.windows.net/auditlog-container/auditlog-folder/"}),(0,i.jsxs)(a.x,{children:[(0,i.jsx)(p.Z,{name:"azure_blob.auth_type",value:u.X.SAS_TOKEN,data:[{value:u.X.SAS_TOKEN}]}),(0,i.jsx)(c.P,{name:"azure_blob.sas_token",label:"SAS Token",placeholder:"Enter a SAS token that provides access to the storage account",docLink:"https://docs.pingcap.com/tidbcloud/configure-external-storage-access/?plan=essential#configure-azure-blob-storage-access",templateLink:"https://portal.azure.com/#create/Microsoft.Template/uri/https%3A%2F%2Ftidbserverless.blob.core.windows.net%2Fserverless-template%2Fsas-token-auditlog-template.json"})]})]}),(0,i.jsx)(h.Z,{onCancel:t,onSucc:l,clusterId:e,isConfirmDisabled:j})]})})},489790:function(e,t,l){l.d(t,{o:()=>v});var i=l(552676),a=l(775364),n=l(740521),r=l(825539),o=l(582473),s=l(275271),d=l(469987),c=l(969416),u=l(324939),g=l(59837),h=l(221194),p=l(747282);let v=(0,o.Pi)(({clusterId:e,onSucc:t,onCancel:l})=>{let{config:o}=(0,g.x)(),{watch:v,setValue:x}=(0,d.Gc)(),m=v("gcs.uri"),b=v("gcs.service_account_key");(0,s.useEffect)(()=>{var e,t;(null==o?void 0:null===(e=o.cloud_storage)||void 0===e?void 0:e.gcs)&&x("gcs",{...null==o?void 0:null===(t=o.cloud_storage)||void 0===t?void 0:t.gcs,service_account_key:""})},[o]);let j=(0,s.useMemo)(()=>!m||!b,[m,b]);return(0,i.jsxs)(a.x,{children:[(0,i.jsxs)(n.K,{gap:"lg",children:[(0,i.jsx)(r.c,{name:"gcs.uri",label:"Destination Files URI",placeholder:"gs://auditlog-bucket/auditlog-folder/"}),(0,i.jsxs)(a.x,{children:[(0,i.jsx)(p.Z,{name:"gcs.auth_type",value:u.Q.SERVICE_ACCOUNT_KEY,data:[{value:u.Q.SERVICE_ACCOUNT_KEY}]}),(0,i.jsx)(c.D,{name:"gcs.service_account_key",label:"Bucket Access"})]})]}),(0,i.jsx)(h.Z,{onCancel:l,onSucc:t,clusterId:e,isConfirmDisabled:j})]})})},342072:function(e,t,l){l.d(t,{Z:()=>b});var i=l(552676),a=l(125385),n=l(971798),r=l(150288),o=l(128177),s=l(366130),d=l(359697),c=l(582473),u=l(275271),g=l(469987),h=l(705374),p=l(294859),v=l(566249),x=l(594755),m=l(59837);let b=(0,c.Pi)(({opened:e,clusterId:t,onClose:l,onSucc:c})=>{let{store:{tenantData:b,activeProjectId:j}}=(0,v.Z)(),{config:f}=(0,m.x)(),C=(0,g.cI)({mode:"onChange"}),{getValues:y,setValue:k,formState:{isValid:S}}=C,A=(0,h.AM)(),w=async()=>{let e=y();try{await A.mutateAsync({clusterId:null!=t?t:"",orgId:b.id,projectId:j,data:{audit_log_config:{cluster_id:null!=t?t:"",enabled:!0,unredacted:!(null==e?void 0:e.redacted),rotation_interval_minutes:Number(null==e?void 0:e.intervalMinutes),rotation_size_mib:Number(null==e?void 0:e.maxSizeMib)}}}),c()}catch(e){a.r.error((0,p.e$)(e,!0))}};return(0,u.useEffect)(()=>{var t,l;e&&C&&(k("intervalMinutes",null!==(t=null==f?void 0:f.rotation_interval_minutes)&&void 0!==t?t:"10"),k("maxSizeMib",`${null!==(l=null==f?void 0:f.rotation_size_mib)&&void 0!==l?l:100}`),k("redacted",!(null==f?void 0:f.unredacted)))},[e,C]),(0,i.jsx)(n.u,{opened:e,size:800,title:"Database Audit Logging Settings",onClose:l,children:(0,i.jsxs)(d.l,{layout:"none",form:C,withActions:!1,onSubmit:()=>{},onCancel:()=>{},children:[(0,i.jsx)(x.e,{maxSizeName:"maxSizeMib",maxAgeSecondName:"intervalMinutes",minAgeSecondsNumber:10,maxAgeSecondsNumber:1440,minSizeNumber:10,maxSizeNumber:1024,fileSizeMode:"input",rotationMode:"input",redactedName:"redacted",entityName:"instance"}),(0,i.jsx)(r.i,{mt:"lg",mx:"-24"}),(0,i.jsxs)(o.Z,{justify:"flex-end",mt:"lg",children:[(0,i.jsx)(s.z,{variant:"outline",onClick:l,children:"Cancel"}),(0,i.jsx)(s.z,{loading:A.isLoading,disabled:!S,onClick:w,children:"Save"})]})]})})})},474842:function(e,t,l){l.d(t,{Z:()=>o});var i=l(552676),a=l(582473),n=l(241852),r=l(221194);let o=(0,a.Pi)(({clusterId:e,onCancel:t,onSucc:l})=>(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(n.Z,{}),(0,i.jsx)(r.Z,{clusterId:e,onCancel:t,onSucc:l})]}))},382023:function(e,t,l){l.d(t,{Z:()=>m});var i=l(552676),a=l(125385),n=l(775364),r=l(582473),o=l(275271),s=l(381674),d=l(705374),c=l(294859),u=l(566249),g=l(980746),h=l(432999),p=l(59837),v=l(218874),x=l(342072);let m=(0,r.Pi)(({cluster:e})=>{var t;let l=(0,d.AM)(),r=(0,s.useQueryClient)(),{store:{tenantData:m,activeProjectId:b}}=(0,u.Z)(),[j,f]=(0,o.useState)(!1),{config:C,isLoadingConfig:y}=(0,p.x)(),[k,S]=(0,o.useState)(!1),[A,w]=(0,o.useState)(!1),I=async()=>{try{await l.mutateAsync({clusterId:e.id,orgId:m.id,projectId:b,data:{audit_log_config:{enabled:!1}}})}catch(e){a.r.error((0,c.e$)(e,!0))}L(),f(!1)},L=()=>{var t;r.fetchQuery((0,d.s$)(m.id,b,null!==(t=null==e?void 0:e.id)&&void 0!==t?t:""),()=>{var t;return(0,d.Sl)(m.id,b,null!==(t=null==e?void 0:e.id)&&void 0!==t?t:"")})};return(0,o.useEffect)(()=>{A&&S(!1)},[A]),(0,i.jsxs)(n.x,{children:[(0,i.jsx)(g.y,{docLink:"https://docs.pingcap.com/tidbcloud/essential-database-audit-logging/?plan=essential",onSettingClick:()=>w(!0),onConfigureClick:()=>S(!0),onDisableClick:()=>f(!0),onEnableClick:()=>S(!0),loading:y,enabled:null!==(t=null==C?void 0:C.enabled)&&void 0!==t&&t,cluster:e}),(0,i.jsx)(h.D,{opened:j,disableHandler:I,loading:l.isLoading,plan:"Essential",onClose:()=>f(!1)}),(0,i.jsx)(v.Z,{opened:k,clusterId:null==e?void 0:e.id,onClose:()=>S(!1),onSucc:()=>{(null==C?void 0:C.enabled)?S(!1):w(!0)}}),(0,i.jsx)(x.Z,{opened:A,clusterId:null==e?void 0:e.id,onClose:()=>w(!1),onSucc:()=>{w(!1),L()}})]})})},128277:function(e,t,l){l.d(t,{k:()=>g});var i=l(552676),a=l(125385),n=l(275271),r=l(213073),o=l(199436),s=l(294859),d=l(566249),c=l(254023),u=l(448758);let g=e=>{let{store:{activeProjectId:t,tenantData:l}}
1=(0,d.Z)(),[g,h]=(0,n.useState)(c.Nr.Initial),{cluster:p}=e,[v,x]=(0,n.useState)(0),{data:m,isFetched:b,isError:j,isFetching:f,isLoading:C}=(0,o.tC)(null==p?void 0:p.id,{orgId:l.id,projectId:t},{query:{enabled:!!(l.id&&t&&(null==p?void 0:p.id)&&p.computed.isDedicated),refetchInterval:!1,refetchOnWindowFocus:!1,retry:!1,onError:e=>{let t=(0,s.e$)(e);a.r.error(t)}}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.xS,{ready:(0,r.DY)({isFetched:b,isError:j})}),(0,i.jsx)(u.r.Provider,{value:{config:m,isLoadingConfig:f,isInitingConfig:C,configStep:g,setConfigStep:h,filterRulesLen:v,setFilterRulesLen:x,cluster:p},children:e.children})]})}},690937:function(e,t,l){l.d(t,{O:()=>g});var i=l(552676),a=l(125385),n=l(275271),r=l(213073),o=l(705374),s=l(294859),d=l(566249),c=l(254023),u=l(59837);let g=e=>{let{store:{activeProjectId:t,tenantData:l}}=(0,d.Z)(),[g,h]=(0,n.useState)(c.Nr.Initial),{cluster:p}=e,[v,x]=(0,n.useState)(0),{data:m,isFetched:b,isError:j,isFetching:f,isLoading:C}=(0,o.tC)(l.id,t,null==p?void 0:p.id,{query:{enabled:!!(l.id&&t&&(null==p?void 0:p.id)&&!p.computed.isDedicated),refetchInterval:!1,refetchOnWindowFocus:!1,retry:!1,onError:e=>{let t=(0,s.e$)(e);a.r.error(t)}}});return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.xS,{ready:(0,r.DY)({isFetched:b,isError:j})}),(0,i.jsx)(u.y.Provider,{value:{config:m,isLoadingConfig:f,isInitingConfig:C,configStep:g,setConfigStep:h,filterRulesLen:v,setFilterRulesLen:x,cluster:p},children:e.children})]})}},153785:function(e,t,l){l.r(t),l.d(t,{default:()=>m});var i=l(552676),a=l(128177),n=l(491757),r=l(619102),o=l(275271),s=l(932643),d=l(213073),c=l(15086),u=l(920501),g=l(96017),h=l(128277),p=l(690937),v=l(555473),x=l(376183);let m=({cluster:e})=>{(0,o.useEffect)(()=>{document.title=`${s.ZP.PAGE_TITLE_PREFIX}Audit Log`},[]);let t=e.computed.isServerless?"TiDB instance":"TiDB Cluster",l=(0,g.Kh)(e),m=e.computed.isEssential||e.computed.isDedicated&&!l;return(0,i.jsx)(c.R,{title:(0,i.jsxs)(a.Z,{gap:8,children:["DB Audit Logging",m?(0,i.jsx)(n.C,{variant:"outline",size:"sm",color:"carbon",c:"carbon.7",fw:500,children:"Preview"}):null]}),wrapperProps:{display:"flex",h:"100%",sx:{flexDirection:"column"}},bodyProps:{sx:{flex:"auto"}},children:(0,u.NQ)(e)?(0,i.jsxs)(r.Z,{shadow:"none",h:"calc(100vh - 152px)",children:[(0,i.jsx)(d.xS,{}),(0,i.jsx)(u.zq,{cluster:e,featureName:"DB Audit Logging",featureDesc:`DB audit logging is used to record various SQL commands executed by users on the ${t}. It supports administrators to audit user behaviors based on log information.`})]}):(0,i.jsx)(i.Fragment,{children:e.computed.isServerless?(0,i.jsx)(p.O,{cluster:e,children:(0,i.jsx)(x.Z,{cluster:e})}):(0,i.jsx)(h.k,{cluster:e,children:(0,i.jsx)(v.Z,{cluster:e})})})})}},941880:function(e,t,l){l.d(t,{a:()=>v});var i=l(552676),a=l(767068),n=l(782527),r=l(237385),o=l(128177),s=l(98172),d=l(431070),c=l(283462),u=l(775364),g=l(315982),h=l(365582),p=l(275271);function v({kind:e,data:t,value:l,onChange:v,width:x,disabled:m,error:b,label:j,maxDisplayItem:f}){let C=(0,a.rZ)(),[y,k]=(0,p.useState)(""),S=(0,n.K)({onDropdownClose:()=>{S.resetSelectedOption(),k("")},onDropdownOpen:()=>{S.focusSearchInput()}}),A=t.filter(e=>e.label.toLowerCase().includes(y.toLowerCase().trim())).map(e=>(0,i.jsx)(r.h.Option,{value:e.value,styles:{option:{"&:hover":{backgroundColor:C.colors.carbon[3]}}},children:(0,i.jsxs)(o.Z,{children:[e.label,(0,i.jsx)(o.Z,{ml:"auto",children:l.includes(e.value)&&(0,i.jsx)(h.NOm,{size:16,strokeWidth:2,color:C.colors.peacock[7]})})]})},e.value));return(0,i.jsxs)(r.h,{store:S,withinPortal:!0,onOptionSubmit:function(e){v(l.includes(e)?l.filter(t=>t!==e):[...l,e])},shadow:"sm",styles:{search:{border:"none",borderBottom:`1px solid ${C.colors.carbon[3]}`,"&:hover":{borderBottom:`1px solid ${C.colors.carbon[3]}`},"&:focus":{borderBottom:`1px solid ${C.colors.carbon[3]}`}}},children:[(0,i.jsx)(r.h.Target,{children:(0,i.jsx)(d.M,{w:x,disabled:m,component:"button",type:"button",pointer:!0,rightSection:l.length>0?(0,i.jsx)(c.P,{size:"sm",onMouseDown:e=>e.preventDefault(),onClick:()=>v([]),"aria-label":"Clear value"}):(0,i.jsx)(r.h.Chevron,{}),label:j?(0,i.jsx)(u.x,{sx:e=>({color:e.colors.carbon[8]}),mb:"6",children:j}):void 0,error:b?(0,i.jsx)(u.x,{sx:e=>({color:e.colors.red[7]}),children:b}):void 0,onClick:()=>S.toggleDropdown(),rightSectionPointerEvents:null===l?"none":"all",children:0===l.length?(0,i.jsx)(s.Z,{c:"carbon",truncate:!0,children:`Select ${e}...`}):l.length<(f||2)?(0,i.jsxs)(o.Z,{gap:4,wrap:"nowrap",children:[(0,i.jsx)(s.Z,{c:"carbon",fw:500,truncate:!0,children:e}),(0,i.jsx)(s.Z,{fw:500,truncate:!0,children:l.map(e=>{var l;return null===(l=t.find(t=>t.value===e))||void 0===l?void 0:l.label}).join(", ")})]}):(0,i.jsxs)(o.Z,{gap:4,wrap:"nowrap",children:[(0,i.jsx)(s.Z,{c:"carbon",fw:500,truncate:!0,children:e}),(0,i.jsxs)(s.Z,{fw:500,truncate:!0,children:[l.length," selected"]})]})})}),(0,i.jsxs)(r.h.Dropdown,{children:[(0,i.jsx)(r.h.Search,{value:y,onChange:e=>k(e.currentTarget.value),placeholder:`Search ${e.toLowerCase()}`,styles:{input:{border:"none"}}}),(0,i.jsx)(g.x.Autosize,{type:"scroll",mah:200,children:(0,i.jsx)(r.h.Options,{children:A.length>0?A:(0,i.jsx)(r.h.Empty,{children:"Nothing found"})})})]})]})}},236910:function(e,t,l){l.d(t,{m:()=>C});var i=l(552676),a=l(771766),n=l(560162),r=l(775364),o=l(150288),s=l(915030),d=l(128177),c=l(366130),u=l(111816),g=l(586085),h=l(826444),p=l(365582),v=l(275271);let x=(e,t)=>e.map(e=>({...e,isChecked:!e.disabled&&t,indeterminate:!1,children:e.children?x(e.children,t):void 0})),m=(e,t)=>
1e.map(e=>{var l;if(null===(l=e.children)||void 0===l||!l.length)return{...e,isChecked:t.includes(e.value),indeterminate:!1};{let l=m(e.children,t),i=l.every(e=>e.isChecked),a=l.some(e=>e.isChecked);return{...e,children:l,isChecked:i,indeterminate:a&&!i}}}),b=(e,t)=>e.reduce((e,l)=>(l.isLeaf&&!l.disabled&&e.push(l),l.children&&(l.children.every(e=>e.isChecked)&&t&&(l.isChecked=!0,e.push(l)),e.push(...b(l.children,t))),e),[]),j=e=>e.reduce((e,t)=>(t.disabled||e.push(t),t.children&&e.push(...j(t.children)),e),[]),f=(e,t)=>{var l,i;return!!(!t||e.label.toLowerCase().includes(t))||null!==(i=null===(l=e.children)||void 0===l?void 0:l.some(e=>f(e,t)))&&void 0!==i&&i},C=({options:e,value:t,disabled:l,onChange:u,popoverProps:g,invalid:C,renderSelectItem:k,placeholder:A,allWithEmpty:w=!0,emptyMessage:I="No data",selectItemProps:L,maxContentHeight:z,isShouldParentSelectable:_=!1,searchable:E=!1,searchProps:R})=>{var D,Z,T;let[F,P]=(0,v.useState)(!1),[N,B]=(0,v.useState)(""),[O,U]=(0,v.useState)(void 0),$=(0,v.useMemo)(()=>O||e,[e,O]),M=(0,v.useMemo)(()=>b($),[$]),q=(0,v.useMemo)(()=>j($),[$]),Q=_?q.length:M.length,K=t&&(!t.length||t.length===Q),W=void 0===t?"":K?`All (${Q})`:`Checked ${t.length} (Total ${Q})`,G=M.every(e=>e.isChecked),V=M.some(e=>e.isChecked),Y=M.every(e=>!e.isChecked),H=null!==(D=null==R?void 0:R.placeholder)&&void 0!==D?D:"Search",J=null!==(Z=null==R?void 0:R.emptyMessage)&&void 0!==Z?Z:"No matches found",X=null==R?void 0:R.inputTestId,ee=null!==(T=null==R?void 0:R.debounceMs)&&void 0!==T?T:200,[et]=(0,h.c)(N,ee),el=(N?et:"").trim().toLowerCase(),ei=$.some(e=>f(e,el)),ea=()=>U(m($,t||[]));return(0,v.useEffect)(()=>{U(m(e,t||[]))},[e,t]),(0,i.jsxs)(a.J,{position:"bottom-end",...g,opened:F,onChange:P,shadow:"sm",onClose:()=>{ea(),B("")},children:[(0,i.jsx)(a.J.Target,{children:(0,i.jsx)(n.I,{styles:{input:{userSelect:"none",height:"40px",lineHeight:"38px",paddingRight:"40px",":hover":{cursor:l?"not-allowed":"pointer"},"::selection":{backgroundColor:"transparent"}},section:{width:"40px",pointerEvents:"none"}},sx:{lineHeight:"1.55"},value:W,disabled:l,placeholder:A,readOnly:!0,rightSection:(0,i.jsx)(p.mer,{size:16,color:"var(--mantine-color-carbon-7)!important"}),onClick:()=>P(e=>!e),"data-invalid":C})}),(0,i.jsxs)(a.J.Dropdown,{p:0,children:[E&&$.length?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(r.x,{p:"sm",children:(0,i.jsx)(n.I,{value:N,placeholder:H,onChange:e=>B(e.currentTarget.value),"data-testid":X})}),(0,i.jsx)(o.i,{color:"carbon.3"})]}):null,$.length?(0,i.jsx)(S,{label:W,value:"all",isLeaf:!0,isChecked:G,indeterminate:V&&!G,onChange:e=>{U(x($,e))},...L}):(0,i.jsx)(s.k,{my:16,justify:"center",children:I}),(0,i.jsx)(o.i,{color:"carbon.3"}),(0,i.jsx)(r.x,{mah:null!=z?z:240,sx:{overflow:"auto"},children:$.length?ei?(0,i.jsx)(y,{value:$,renderSelectItem:k,onChange:U,searchKeyword:el,...L}):(0,i.jsx)(s.k,{my:16,justify:"center",children:E&&el?J:I}):null}),(0,i.jsx)(o.i,{color:"carbon.3"}),(0,i.jsxs)(d.Z,{p:"md",gap:8,justify:"flex-end",children:[(0,i.jsx)(c.z,{variant:"default",size:"xs",onClick:()=>{ea(),P(!1)},children:"Cancel"}),(0,i.jsx)(c.z,{size:"xs",onClick:()=>{let e=b($,_);u(e.every(e=>e.isChecked)&&w?[]:e.filter(e=>e.isChecked).map(e=>e.value)),P(!1)},disabled:Y,children:"Apply"})]})]})]})},y=({value:e,level:t=0,onChange:l,searchKeyword:a,...n})=>(0,i.jsx)(i.Fragment,{children:e.map((r,o)=>a&&!f(r,a)?null:(0,i.jsx)(k,{value:r,level:t,onChange:t=>l([...e.slice(0,o),t,...e.slice(o+1)]),onChildrenChange:t=>{let i={...r,children:t};
1l([...e.slice(0,o),i,...e.slice(o+1)])},searchKeyword:a,...n},r.value))}),k=({value:e,level:t=0,onChange:l,onChildrenChange:a,renderSelectItem:n,searchKeyword:r,...o})=>{let s=b(e.children||[]).some(e=>e.isChecked),d=b(e.children||[]).every(e=>e.isChecked),c=!!r||e.showChildren;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(S,{...e,level:t,showChildren:c,setShowChildren:t=>l({...e,showChildren:t}),someChildrenChecked:s,everyChildrenChecked:d,onChange:t=>{l({...e,isChecked:t,children:e.isLeaf?e.children:x(e.children,t)})},renderSelectItem:n,...o}),e.children&&c&&(0,i.jsx)(y,{value:e.children,level:t+1,onChange:a,renderSelectItem:n,searchKeyword:r,...o})]})},S=({label:e,indeterminate:t,level:l=0,isLeaf:a,someChildrenChecked:n,everyChildrenChecked:o,showChildren:s,setShowChildren:c,isChecked:h,onChange:v,disabled:x,renderSelectItem:m,value:b,...j})=>{let{textProps:f,...C}=j;return(0,i.jsx)(r.x,{pl:8+24*l,...C,children:(0,i.jsxs)(d.Z,{p:"sm",gap:8,onClick:()=>{a?v(!h):null==c||c(!s)},sx:{cursor:"pointer",userSelect:"none"},children:[(0,i.jsx)(u.X,{indeterminate:!a&&n&&!o||t,checked:a?h:o,onClick:e=>{e.stopPropagation(),v(a?!h:!o)},disabled:x,readOnly:!0}),!a&&(s?(0,i.jsx)(p.C26,{size:16}):(0,i.jsx)(p.VG8,{size:16})),m?m({label:e,value:b,disabled:x}):(0,i.jsx)(g.x,{truncate:!0,maw:"80%",...f,children:e})]})})}},214462:function(e,t,l){l.d(t,{S:()=>n});var i=l(552676),a=l(275271);let n=(0,a.forwardRef)((e,t)=>{let{onChange:l,children:n,accept:r,multiple:o=!1,name:s,form:d,disabled:c,...u}=e,g=(0,a.useRef)(null);return(0,a.useImperativeHandle)(t,()=>({reset:()=>{g.current.value=""}})),(0,i.jsxs)(i.Fragment,{children:[n({onClick:()=>{var e;c||null===(e=g.current)||void 0===e||e.click()},...u}),(0,i.jsx)("input",{style:{display:"none"},type:"file",accept:r,multiple:o,onChange:e=>{var t,i,a;o?l(Array.from(null!==(t=e.currentTarget.files)&&void 0!==t?t:[])):l(null!==(a=null===(i=e.currentTarget.files)||void 0===i?void 0:i[0])&&void 0!==a?a:null)},ref:g,name:s,form:d})]})})},82276:function(e,t,l){l.d(t,{g:()=>h,p:()=>g});var i=l(552676),a=l(128177),n=l(775364),r=l(366130),o=l(586085),s=l(365582),d=l(275271),c=l(214462),u=l(353512);let g=e=>new Promise((t,l)=>{let i=new FileReader;i.readAsText(e,"UTF-8"),i.onload=function(e){var l;t(null===(l=e.target)||void 0===l?void 0:l.result)},i.onerror=function(){l(`Error occurred reading file: ${e.name}`)}}),h=({hideButtonAfterUpload:e=!1,...t})=>{let[l,h]=(0,d.useState)(null),p=(0,d.useRef)(null),v=async e=>{var l,i,a;if(e){let i=await g(e),a={name:e.name,content:i};h(a),null===(l=t.onChange)||void 0===l||l.call(t,a)}else h(null),null===(i=p.current)||void 0===i||i.reset(),null===(a=t.onChange)||void 0===a||a.call(t,null)};return(0,i.jsxs)(a.Z,{children:[(0,i.jsx)(n.x,{sx:e?{display:l?"none":"block"}:void 0,children:(0,i.jsx)(c.S,{...t,onChange:v,ref:p,children:e=>(0,i.jsx)(r.z,{...e,variant:"outline",type:"button",children:"Click to Upload",size:"sm",leftSection:(0,i.jsx)(s.qOk,{size:16})})})}),l&&(0,i.jsxs)(a.Z,{className:u.Z.fileName,gap:4,h:30,children:[(0,i.jsx)(n.x,{component:s.slp,size:16,c:"peacock.5"}),(0,i.jsx)(o.x,{fz:14,fw:500,color:"peacock.5",children:l.name}),(0,i.jsx)(n.x,{component:s.Q4p,size:16,onClick:()=>v(null),c:"carbon.6"})]})]})}}}]);

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.