1import{j as e,S as h,aB as re,H as I,a7 as z,a8 as U,r as S,aJ as W,h as f,f as ie,ai as oe,T as N,aZ as ae,s as ce}from"./vendor-ClLR6ncd.js";import{j as X,i as K,f as v,X as le,L as R,aK as de,b as L,h as ue,ar as me,aw as pe,g as he}from"./index-CbnzZ4aF.js";import{C as fe,i as xe,u as ge,N as je,I as ye}from"./NewClusterInputs-D15iTI6S.js";import{u as Ce}from"./inputsContext-DinH8pU2.js";import{P as J,D as be}from"./ui-ConPqek6.js";import{d as Se}from"./Add-CLrXAvOx.js";import{d as ve}from"./Settings-BVMXIKfp.js";import{A as Ie,o as Re,s as Z}from"./lodash-hEutbni1.js";import{d as we}from"./Delete-BD9BsoWc.js";import{d as Te}from"./Stop-D8ZTRatE.js";import{d as ke}from"./PlayArrow-C5BebwRO.js";import{p as Me}from"./model-DAvH-x8m.js";import{E as Be}from"./Messages-BUkK3IJR.js";import{D as $e}from"./index-DY-IkI-n.js";import{C as De}from"./CreateDialogContext-D0PP4On8.js";import{O as Ne}from"./OptionallyDenseMuiTable-Ddo5q_Vu.js";import{B as j}from"./Box-Co2WcNPC.js";import{c as Ke,T as V,b,a as Le}from"./TableRow-CGDSOtFZ.js";import{L as Ae}from"./Link-BLwKPJFF.js";import{T as _e}from"./Toolbar-Dprnudzf.js";import{T as qe}from"./TableSortLabel-BJFq2axQ.js";import{H as Fe}from"./index-P0l3Ayr4.js";import{C as Oe,B as Pe,a as Ee}from"./ChartContainer-DmIC-cS7.js";import{B as Qe}from"./ResponsiveContainer-_qZhE4lH.js";import{u as He}from"./useCleaningReplQueriesCache-3UdnPwBK.js";import{R as Ge}from"./RefreshDataButton-BMv_Vwgi.js";import{a as ze}from"./ui-Dw2y4wnH.js";import"./WarningMessage-4TK5GdCH.js";import"./Warning-DsmyDRzF.js";import"./SmallStandardSelect-7k6-Wr8Q.js";import"./MenuItem-CCerWMyq.js";import"./dividerClasses-DvO85-mA.js";import"./Autocomplete-Cjt7Q9VV.js";import"./Chip-DoCs8Smb.js";import"./DialogContent-DR8Wx7Lo.js";import"./DialogTitle-i0lt2jWQ.js";import"./RadioButtons-D8nvWmPm.js";import"./_commonjs-dynamic-modules-TDtrdbi3.js";function Ue(){const{invalid:t,options:n,queryHook:{isLoading:s}}=Ce(),i=ge(n,"createCluster");return e.jsxs(J,{title:"Create Multi-Master Replication (MMR)",error:i.error,children:[e.jsxs(h,{direction:"row",spacing:4,children:[e.jsx(re,{sx:{p:2,width:.6,height:"fit-content"},children:e.jsx(je,{})}),e.jsx(h,{width:"0.4",spacing:2,children:e.jsx(ye,{startMessage:`This operation converts a normal AllegroGraph repository into the 2 first instance of a replication cluster. No data is lost. After 3 creating the first instance you can run replicas of this instance on 4 this or other machines.`,warningMessage:"Once a repository becomes a replication instance it can not be converted back to a normal repository."})})]}),e.jsx(I,{sx:{width:"min-content",alignSelf:"center"},variant:"contained",disabled:i.isLoading||s||t,onClick:i.mutate,children:"convert"})]})}function We(){return e.jsx(fe,{initOptions:xe,children:e.jsx(Ue,{})})}var A={},Xe=U;Object.defineProperty(A,"__esModule",{value:!0});var _=A.default=void 0,Je=Xe(z()),Ze=e;_=A.default=(0,Je.default)((0,Ze.jsx)("path",{d:"M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"}),"Star");var q={},Ve=U;Object.defineProperty(q,"__esModule",{value:!0});var Y=q.default=void 0,Ye=Ve(z()),et=e;Y=q.default=(0,Ye.default)((0,et.jsx)("path",{d:"M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"}),"ChevronRight");function F(){const{data:t}=X(["repl","clusterReport"],async n=>(await K({url:v(n,"/repl/clusterReport")})).map(s=>{const{catalogId:i,repositoryId:a}=Me(s.repoName);return{...s,link:s.state==="running"?`${s.scheme}://${s.host}:${s.port}/webview${le({catalogId:i,repositoryId:a,suffixes:["replication"]})}`:""}}));return t}function O(){const{data:t,...n}=X(["repl","isRepl"],s=>K({url:v(s,"repl/running")}));return{data:t&&{isReplication:t!=="no",isControllingReplication:t==="controlling"},...n}}const{useDialogContext:ee,DialogContextProvider:tt}=De(),B=[{id:"instanceId",numeric:!0,label:"ID"},{id:"instanceName",numeric:!1,label:"Name"},{id:"repoName",numeric:!1,label:"Repo"},{id:"host",numeric:!1,label:"Host"},{id:"port",numeric:!0,label:"Port"},{id:"group",numeric:!1,label:"Group"},{id:"state",numeric:!1,label:"State"},{label:"Link"}];function nt({isGroupEmpty:t,disabled:n,onSelectAllClick:s,order:i,orderBy:a,numSelected:c,rowCount:d,onRequestSort:r}){const u=o=>x=>{r(x,o)};return e.jsx(Le,{children:e.jsxs(V,{sx:{verticalAlign:"bottom"},children:[e.jsx(b,{style:{paddingBottom:"4px"},padding:"checkbox",children:e.jsx(W,{disabled:n,color:"primary",indeterminate:c>0&&c<d,checked:d>0&&c===d,onChange:s})}),B.map(o=>o.id==="group"&&t?null:e.jsx(b,{align:"left",padding:"normal",sortDirection:a===o.id?i:!1,children:o.id?e.jsxs(qe,{active:a===o.id,direction:a===o.id?i:"asc",onClick:u(o.id),children:[o.label,a===o.id?e.jsx(j,{component:"span",sx:oe,children:i==="desc"?"sorted descending":"sorted ascending"}):null]}):o.label},o.label))]})})}function st({openDialogParameter:t,label:n,disabledTitle:s,...i}){const a=ee(),c=e.jsx(I,{...i,children:n});return i.disabled?e.jsx(N,{title:s,children:e.jsx("span",{children:c})}):t!=null&&t.message?e.jsx(I,{...Re(i,["onClick"]),onClick:()=>a.open(t),children:n}):c}const T=t=>t===0;function rt({selectedRows:t,disableAll:n,resetSelected:s}){const i=de(),{catalogId:a}=L(),c=ie();return ue((d,r)=>Promise.all(t.map(({instanceName:u})=>{const o=new URL(v(r,"repl",d),window.origin);return d==="controllingInstance"&&o.searchParams.append("force",!0),o.searchParams.append("instanceName",u),K({url:o.toString(),method:"put",headers:{Accept:"text/plain, */*"}})})),{onMutate:()=>{n(!0)},onSuccess:(d,r)=>
4{me.invalidateQueries(i),(r==="stop"||r==="remove")&&t.some(({thisInstance:u})=>u==="yes")?c(v(a)):s()},onSettled:()=>{n(!1)}})}const it=[{label:"Start",confirmMessage:()=>"",forNonControlling:!1,StartIcon:ke,urlSuffix:"start",disabledTitle:'Select instances with "unreachable" status',disabled:(t,n)=>T(t)||n.some(({state:s})=>s!=="unreachable")},{label:"Stop",confirmMessage:t=>t.some(({thisInstance:n})=>n==="yes")?"Stopping currently opened instance will redirect you to the catalog page":"",forNonControlling:!1,StartIcon:Te,urlSuffix:"stop",disabledTitle:'Select instances with "running" status',disabled:(t,n)=>T(t)||n.some(({state:s})=>s!=="running")},{label:"Remove",confirmMessage:()=>"Removing is irreversable action. Are you sure?",forNonControlling:!1,StartIcon:we,urlSuffix:"remove",disabledTitle:'Select instances with "running" status',disabled:(t,n)=>T(t)||n.some(({state:s})=>s!=="running")},{label:"Set controlling",confirmMessage:(t,n)=>n?"":"If at all possible the controlling instance should only be changed by sending a command to the current controlling instance. Do you really want to issue this command on the webview page for a non controlling instance?",forNonControlling:!0,StartIcon:_,urlSuffix:"controllingInstance",disabledTitle:'Select only one non-controlling instance with "running" status',disabled:(t,[{controlling:n,state:s}={}])=>t!==1||n==="yes"||s!=="running"}],Q={pr:3};function ot({numSelected:t,selectedRows:n,disabled:s,mutation:i}){var r;const{data:a}=O(),c=ee(),d=e.jsx(f,{sx:Q,variant:"h6",children:"Instances"});return e.jsxs(e.Fragment,{children:[e.jsx($e,{...c,onSubmit:()=>i.mutate(c.openParameter.suffix),submitTitle:"OK",dialogTitle:"Confirmation",dialogBodyMessage:(r=c.openParameter)==null?void 0:r.message}),e.jsxs(_e,{disableGutters:!0,children:[t>0?e.jsxs(f,{sx:Q,color:"inherit",variant:"subtitle1",children:[t," selected instances"]}):d,it.filter(({forNonControlling:u})=>(a==null?void 0:a.isControllingReplication)||u).map(({label:u,confirmMessage:o,StartIcon:x,disabled:y,urlSuffix:C,disabledTitle:w})=>e.jsx(st,{label:u,openDialogParameter:{message:o(n,a==null?void 0:a.isControllingReplication),suffix:C},disabledTitle:s?"Wait for the current action to finish":w,startIcon:e.jsx(x,{}),disabled:s||y(t,n),onClick:()=>i.mutate(C)},u))]})]})}function at({row:t}){return t.controlling==="yes"?e.jsx(N,{title:"controlling instance",children:e.jsx(_,{sx:{color:"primary.main"}})}):null}function ct({row:t}){return t.thisInstance==="yes"?e.jsx(N,{title:"current instance",children:e.jsx(Y,{})}):null}const lt=t=>{t.stopPropagation()};function dt(){const t=F(),[n,s]=S.useState("asc"),[i,a]=S.useState("instanceId"),[c,d]=S.useState([]),[r,u]=S.useState(!1),o=c.map(l=>(t||[]).find(({instanceId:p})=>p===l)),x=rt({selectedRows:o,disableAll:u,resetSelected:()=>d([])}),y=(l,p)=>{s(i===p&&n==="asc"?"desc":"asc"),a(p)},C=l=>{if(l.target.checked){const p=t.map(m=>m.instanceId);d(p);return}d([])},w=(l,p)=>{const m=c.indexOf(p);let g=[];m===-1?g=g.concat(c,p):m===0?g=g.concat(c.slice(1)):m===c.length-1?g=g.concat(c.slice(0,-1)):m>0&&(g=g.concat(c.slice(0,m),c.slice(m+1))),d(g)},se=l=>c.includes(l);if(!t)return e.jsx(R,{});const E=t.every(({group:l})=>l==="");return e.jsxs(h,{children:[e.jsx(Be,{error:x.error,resetError:x.reset}),e.jsxs(j,{sx:{width:"100%",overflow:"auto",flexGrow:1},children:[e.jsx(tt,{children:e.jsx(ot,{disabled:r,numSelected:c.length,selectedRows:o,mutation:x})}),e.jsxs(Ne,{children:[e.jsx(nt,{isGroupEmpty:E,disabled:r,numSelected:c.length,order:n,orderBy:i,onSelectAllClick:C,onRequestSort:y,rowCount:t.length}),e.jsx(Ke,{children:Ie(t,i,n).map(l=>{const p=se(l.instanceId);return e.jsxs(V,{hover:!r,onClick:m=>!r&&w(m,l.instanceId),tabIndex:-1,selected:p,children:[e.jsx(b,{padding:"checkbox",children:e.jsx(W,{disabled:r,color:"primary",checked:p})}),e.jsx(b,{children:e.jsxs(j,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(at,{row:l}),e.jsx(ct,{row:l}),l[B[0].id]]})}),B.slice(1,-1).map(({id:m})=>m==="group"&&E?null:e.jsx(b,{children:l[m]},m)),e.jsx(b,{children:l.link?e.jsx(Ae,{onClick:lt,href:l.link,target:"_blank",children:"visit"}):e.jsx(f,{children:"unreachable"})})]},l.instanceId)})})]})]})]})}function P({tooltip:t,title:n}){return e.jsxs(h,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(f,{variant:"h6",children:n}),e.jsx(Fe,{title:t})]})}const te="fully connected",ut="partially connected",ne="disconnected",$={[te]:{color:"green",dataKey:"fullyConnected"},[ut]:{color:"yellow",dataKey:"partiallyConnected"},[ne]:{color:"red",dataKey:"unconnected"}},H=Object.entries($);function mt(t){if($[t])return $[t].color;throw new Error(`unsupported status "${t}"`)}function pt(){const t=F();if(!t)return e.jsx(R,{});const n=Z(t,"instanceId"),s=n.filter(({state:r})=>r!=="unreachable"),i=Object.assign({},...s.map(({instanceId:r,...u})=>({[r]:Object.assign({},...n.map(o=>({[o.instanceId]:o.instanceId!==r?ne:te})),...H.map(([o,{dataKey:x}])=>{const y=u[x]||"";return y===""?{}:Object.assign({},...y.split(", ").map(C=>({[C]:o})))}))}))),a=32,c=`repeat(${s.length+1}, minmax(${a}px, max-content))`,d=`repeat(${n.length+1}, minmax(${a}px, max-content))`;return e.jsxs(h,{spacing:2,children:[e.jsx(P,{title:"Connection matrix across instances",tooltip:"The matrix shows the websocket connection status between each instance. Instance A is fully connected to instance B if there's a socket connection from A to B and another one from B to A. If only one of those is present then the link is partially connected."}),e.jsxs(j,{sx:{display:"grid",gridTemplateRows:c,gridTemplateColumns:d,justifyItems:"center",alignItems:"center",gap:"1px"},children:[e.jsx(f,{variant:"subtitle2",children:"ID"}),n.map(({instanceId:r})=>e.jsx("div",{children:r},r)),s.map(({instanceId:r})=>{const u=i[r];return e.jsxs(S.Fragment,{children:[e.jsx("div",{children:r},"id-title"),n.map(({instanceId:o})=>e.jsx("div",{style:{backgroundColor:mt(u[o]),width:"100%",height:"100%"},children:" "},`${r}-${o}`))]},r)})]}),e.jsx(h,{direction:"row",alignSelf:"center",spacing:2,children:H.map(([r,{color:u}])=>e.jsxs(h,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{sx:{backgroundColor:u,width:`${a/2}
4px`,height:`${a/2}px`}}),e.jsx(f,{variant:"body2",children:r})]},r))})]})}const ht={left:-30};function D(t){return e.jsx(Oe,{...t,Chart:Pe,chartMargin:ht,Figure:Qe,colorProp:"fill"})}function ft(t){return e.jsxs(e.Fragment,{children:[e.jsxs(j,{children:[e.jsx(f,{children:"Commits"}),e.jsx(D,{...t,firstFigureDataKey:"cb",firstFigureName:"Commits Behind",secondFigureDataKey:"iq",secondFigureName:"Ingest Queue Length"})]}),e.jsxs(j,{children:[e.jsx(f,{children:"Commits per minute"}),e.jsx(D,{...t,firstFigureDataKey:"lcpm",firstFigureName:"Local Commits",secondFigureDataKey:"imported",secondFigureName:"Imported Commits"})]})]})}const xt=["cb","iq","lcpm"];function gt(t){return t.map(n=>Object.assign({imported:Math.round(n.incpm-n.lcpm)},n,...xt.map(s=>({[s]:Math.round(n[s])}))))}function jt(){const t=L(),s=[...pe(),"repl","chart-stats"],i=v(he(t),"repl/replStats");return e.jsxs(h,{spacing:2,children:[e.jsx(P,{title:"Current instance performance charts",tooltip:"Charts show the synchronization progress between this instance and the rest of the cluster. Empty charts indicate that the instance is synced up"}),e.jsx(Ee,{Charts:ft,queryKey:s,queryUrl:i,transformChart:gt})]})}const yt=250,Ct=t=>`Instance ID : ${t}`;function k({children:t}){return e.jsxs(h,{spacing:2,children:[e.jsx(P,{title:"Instances commits",tooltip:"The chart displays numerical indicators (commits behind, ingested queue length) of the synchronization status in the cluster"}),t]})}function bt(){const t=F()||[],n=t.filter(({state:i})=>i==="running"),s=Z(n.filter(({commitsBehind:i,ingestQueueLength:a})=>!!i||!!a),"instanceId");return t?n.length===0?e.jsx(k,{children:e.jsx(f,{children:"All instances aren unreachable"})}):s.length===0?e.jsx(k,{children:e.jsx(f,{children:"All fully connected instances are synced up!"})}):e.jsx(k,{children:e.jsx(D,{height:yt,chartData:s,firstBarDataKey:"commitsBehind",firstBarName:"Commits Behind",secondBarDataKey:"ingestQueueLength",secondBarName:"Ingested Queue Length",XAxisLabel:"ID",XAxisDataKey:"instanceId",labelFormatter:Ct})}):e.jsx(R,{})}function G({label:t,...n}){return e.jsx(I,{component:ce,variant:"outlined",...n,children:t})}const M={flexShrink:0};function St(){const{catalogId:t,repositoryId:n}=L(),{data:s,error:i}=O(),c=ae([t,n,"repl"]),d=He();if(!s)return null;const r=c!==0;return e.jsx(J,{error:i,Title:e.jsxs(h,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(be,{title:"Replication cluster management"}),e.jsx(Ge,{disabled:r,onClick:d,sx:M}),s.isControllingReplication?e.jsxs(e.Fragment,{children:[e.jsx(G,{sx:M,label:"New instance",to:"new",startIcon:e.jsx(Se,{})}),e.jsx(G,{sx:M,label:"Settings",to:"settings",startIcon:e.jsx(ve,{})})]}):null]}),children:e.jsxs(h,{sx:{flexGrow:1},spacing:4,children:[e.jsx(dt,{}),e.jsx(pt,{}),e.jsx(bt,{}),e.jsx(jt,{})]})})}function vt(){const{data:t,isSuccess:n}=O();return n?t.isReplication?e.jsx(St,{}):e.jsx(We,{}):e.jsx(j,{sx:{width:1,height:1},children:e.jsx(R,{})})}const ln=ze({pageName:"Replication Management",Component:vt});export{ln as default};
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.