import{j as t,S as m,H as d,h as p}from"./vendor-ClLR6ncd.js";import{j as g,i as s,f as u,h}from"./index-OtVJl4GC.js";import"./lodash-ZyeDnt0e.js";import{I as b,a as i,n as a,u as c,C as o}from"./inputsContext-DcO_XRZd.js";import{B as f}from"./index-BpKmttxq.js";import{P as x}from"./ui-CsX5tAWu.js";import{u as T}from"./useCleaningReplQueriesCache-Cg0Wo1gv.js";import"./model-mC-LLJuv.js";import"./Messages-BRmQDxrZ.js";const y={transactionLatencyCount:{isInvalid:i,errorMessage:a("Transaction Latency Count")},distributedTransactionTimeout:{isInvalid:i,errorMessage:a("Distributed Transaction Timeout")},transactionLatencyTimeout:{isInvalid:i,errorMessage:a("Transaction Latency Timeout")},durability:{isInvalid:e=>!(i(e)||e==="min"||e==="max"||e==="quorum"),errorMessage:`${a("Durability")} or one of the following strings: "min", "max", "quorum"`}};function C(){return g(["repl","settings"],e=>s({url:u(e,"repl/settings")}))}function j(){const{options:e}=c(),r=T();return h((n,l)=>s({method:"POST",url:u(l,"repl/settings"),params:e}),{onSuccess:r})}function v(){const{queryHook:{isLoading:e},invalid:r}=c(),n=j();return t.jsxs(x,{title:"Cluster settings",SuccessMessage:n.isSuccess?t.jsx(p,{children:"Settings are changed successfully!"}):null,error:n.error,children:[t.jsx(o,{disabled:e,required:!0,label:"Durability",optionName:"durability",helperText:"The number of instances that must have a copy of a commit before it's considered durable. The value can be a positive integer or one of the three strings: min (meaning 1), max (meaning all instances) or quorum (meaning the next integer greater than half of the instances)"}),t.jsx(o,{disabled:e,required:!0,label:"Distributed Transaction Timeout",optionName:"distributedTransactionTimeout",helperText:"Number of seconds to wait for a transaction to become durable until letting the commit finish"}),t.jsx(o,{disabled:e,required:!0,label:"Transaction Latency Count",optionName:"transactionLatencyCount",helperText:"How many non-durable transactions are permitted (a non-negative value) before a commit will not be permitted"}),t.jsx(o,{disabled:e,required:!0,label:"Transaction Latency Timeout",optionName:"transactionLatencyTimeout",helperText:"Number of seconds to wait for the transactionLatencyCount to be satisified when committing before signalling an error"}),t.jsxs(m,{direction:"row",alignItems:"center",justifyContent:"center",spacing:2,children:[t.jsx(d,{variant:"contained",disabled:n.isLoading||e||r,onClick:n.mutate,children:"Change"}),t.jsx(f,{disabled:n.isLoading})]})]})}function k(){const e=C();return t.jsx(b,{queryHook:e,initOptions:y,children:t.jsx(v,{})})}export{k as default};
