@powerhousedao/design-system 6.2.3-dev.32 → 6.2.3-dev.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/connect/index.d.ts +54 -4
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +548 -12
- package/dist/connect/index.js.map +1 -1
- package/package.json +4 -4
package/dist/connect/index.js
CHANGED
|
@@ -328,6 +328,317 @@ function Breadcrumb(props) {
|
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
//#endregion
|
|
331
|
+
//#region src/connect/components/catch-up-inspector/catch-up-inspector.tsx
|
|
332
|
+
const COLUMNS$3 = [
|
|
333
|
+
{
|
|
334
|
+
key: "consumerId",
|
|
335
|
+
label: "Consumer",
|
|
336
|
+
width: "180px"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
key: "thread",
|
|
340
|
+
label: "Thread",
|
|
341
|
+
width: "90px"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
key: "appliedThrough",
|
|
345
|
+
label: "Applied Through",
|
|
346
|
+
width: "110px"
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
key: "lag",
|
|
350
|
+
label: "Lag",
|
|
351
|
+
width: "70px"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
key: "trackedAbove",
|
|
355
|
+
label: "Tracked Above",
|
|
356
|
+
width: "100px"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
key: "lastAdvance",
|
|
360
|
+
label: "Last Advance",
|
|
361
|
+
width: "160px"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
key: "blockedOrdinal",
|
|
365
|
+
label: "Blocked At",
|
|
366
|
+
width: "90px"
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
key: "blockedDocument",
|
|
370
|
+
label: "Document",
|
|
371
|
+
width: "150px"
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
key: "blockedScope",
|
|
375
|
+
label: "Scope",
|
|
376
|
+
width: "80px"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
key: "blockedBranch",
|
|
380
|
+
label: "Branch",
|
|
381
|
+
width: "80px"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
key: "blockedType",
|
|
385
|
+
label: "Type",
|
|
386
|
+
width: "140px"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
key: "blockedError",
|
|
390
|
+
label: "Error",
|
|
391
|
+
width: "180px"
|
|
392
|
+
}
|
|
393
|
+
];
|
|
394
|
+
const POLL_INTERVAL_MS = 2e3;
|
|
395
|
+
function truncateId$3(id, maxLength = 12) {
|
|
396
|
+
if (id.length <= maxLength) return id;
|
|
397
|
+
return id.slice(0, maxLength) + "...";
|
|
398
|
+
}
|
|
399
|
+
function formatDuration(ms) {
|
|
400
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1e3));
|
|
401
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
402
|
+
const minutes = Math.floor(totalSeconds % 3600 / 60);
|
|
403
|
+
const seconds = totalSeconds % 60;
|
|
404
|
+
if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
|
|
405
|
+
if (minutes > 0) return `${minutes}m ${seconds}s`;
|
|
406
|
+
return `${seconds}s`;
|
|
407
|
+
}
|
|
408
|
+
function Empty() {
|
|
409
|
+
return /* @__PURE__ */ jsx("span", {
|
|
410
|
+
className: "text-muted-foreground",
|
|
411
|
+
children: "-"
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function Cell({ children }) {
|
|
415
|
+
return /* @__PURE__ */ jsx("td", {
|
|
416
|
+
className: "border-l border-border px-3 py-2 text-xs text-foreground",
|
|
417
|
+
children
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
function TruncatedText({ text, className }) {
|
|
421
|
+
return /* @__PURE__ */ jsx("span", {
|
|
422
|
+
className: twMerge("block truncate", className),
|
|
423
|
+
title: text,
|
|
424
|
+
children: text
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
function CatchUpInspector({ status, onRefresh, onSweepNow }) {
|
|
428
|
+
const [loading, setLoading] = useState(true);
|
|
429
|
+
const [sweeping, setSweeping] = useState(false);
|
|
430
|
+
const [error, setError] = useState(null);
|
|
431
|
+
const [now, setNow] = useState();
|
|
432
|
+
const loadStatus = useCallback(async () => {
|
|
433
|
+
try {
|
|
434
|
+
await onRefresh();
|
|
435
|
+
setError(null);
|
|
436
|
+
setNow(Date.now());
|
|
437
|
+
} catch (e) {
|
|
438
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
439
|
+
} finally {
|
|
440
|
+
setLoading(false);
|
|
441
|
+
}
|
|
442
|
+
}, [onRefresh]);
|
|
443
|
+
useEffect(() => {
|
|
444
|
+
loadStatus();
|
|
445
|
+
const interval = setInterval(() => {
|
|
446
|
+
loadStatus();
|
|
447
|
+
}, POLL_INTERVAL_MS);
|
|
448
|
+
return () => clearInterval(interval);
|
|
449
|
+
}, [loadStatus]);
|
|
450
|
+
const handleRefresh = useCallback(async () => {
|
|
451
|
+
setLoading(true);
|
|
452
|
+
await loadStatus();
|
|
453
|
+
}, [loadStatus]);
|
|
454
|
+
const handleSweepNow = useCallback(async () => {
|
|
455
|
+
setSweeping(true);
|
|
456
|
+
try {
|
|
457
|
+
await onSweepNow();
|
|
458
|
+
setError(null);
|
|
459
|
+
} catch (e) {
|
|
460
|
+
setError(e instanceof Error ? e.message : String(e));
|
|
461
|
+
} finally {
|
|
462
|
+
setSweeping(false);
|
|
463
|
+
}
|
|
464
|
+
await loadStatus();
|
|
465
|
+
}, [onSweepNow, loadStatus]);
|
|
466
|
+
const watermark = status?.watermark;
|
|
467
|
+
const consumers = status?.consumers ?? [];
|
|
468
|
+
const settledThrough = watermark?.settledThrough ?? 0;
|
|
469
|
+
const blockedCount = consumers.filter((c) => c.blockedAt).length;
|
|
470
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
471
|
+
className: "flex h-full flex-col gap-2",
|
|
472
|
+
children: [
|
|
473
|
+
/* @__PURE__ */ jsxs("div", {
|
|
474
|
+
className: "flex shrink-0 items-center justify-between",
|
|
475
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
476
|
+
className: "text-lg font-semibold text-foreground",
|
|
477
|
+
children: "Catch-up Inspector"
|
|
478
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
479
|
+
className: "flex items-center gap-2",
|
|
480
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
481
|
+
className: "flex items-center gap-1 rounded-sm border border-border bg-background px-3 py-1.5 text-sm text-foreground hover:hover-effect disabled:disabled-effect",
|
|
482
|
+
disabled: sweeping,
|
|
483
|
+
onClick: () => void handleSweepNow(),
|
|
484
|
+
type: "button",
|
|
485
|
+
children: "Sweep now"
|
|
486
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
487
|
+
className: "flex items-center gap-1 rounded-sm border border-border bg-background px-3 py-1.5 text-sm text-foreground hover:hover-effect disabled:disabled-effect",
|
|
488
|
+
disabled: loading,
|
|
489
|
+
onClick: () => void handleRefresh(),
|
|
490
|
+
type: "button",
|
|
491
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
492
|
+
name: "Reload",
|
|
493
|
+
size: 14
|
|
494
|
+
}), "Refresh"]
|
|
495
|
+
})]
|
|
496
|
+
})]
|
|
497
|
+
}),
|
|
498
|
+
watermark && /* @__PURE__ */ jsxs("div", {
|
|
499
|
+
className: "flex shrink-0 flex-wrap items-center gap-4 rounded-lg bg-muted px-4 py-2 text-sm",
|
|
500
|
+
children: [
|
|
501
|
+
/* @__PURE__ */ jsxs("div", {
|
|
502
|
+
className: "text-foreground",
|
|
503
|
+
children: ["Head: ", /* @__PURE__ */ jsx("span", {
|
|
504
|
+
className: "font-medium",
|
|
505
|
+
children: watermark.head
|
|
506
|
+
})]
|
|
507
|
+
}),
|
|
508
|
+
/* @__PURE__ */ jsxs("div", {
|
|
509
|
+
className: "text-foreground",
|
|
510
|
+
children: [
|
|
511
|
+
"Settled through:",
|
|
512
|
+
" ",
|
|
513
|
+
/* @__PURE__ */ jsx("span", {
|
|
514
|
+
className: "font-medium",
|
|
515
|
+
children: watermark.settledThrough
|
|
516
|
+
})
|
|
517
|
+
]
|
|
518
|
+
}),
|
|
519
|
+
/* @__PURE__ */ jsxs("div", {
|
|
520
|
+
className: "text-foreground",
|
|
521
|
+
children: [
|
|
522
|
+
"Lag:",
|
|
523
|
+
" ",
|
|
524
|
+
/* @__PURE__ */ jsx("span", {
|
|
525
|
+
className: "font-medium",
|
|
526
|
+
children: watermark.head - watermark.settledThrough
|
|
527
|
+
})
|
|
528
|
+
]
|
|
529
|
+
}),
|
|
530
|
+
/* @__PURE__ */ jsxs("div", {
|
|
531
|
+
className: "text-foreground",
|
|
532
|
+
children: [
|
|
533
|
+
"Waiting on:",
|
|
534
|
+
" ",
|
|
535
|
+
/* @__PURE__ */ jsx("span", {
|
|
536
|
+
className: "font-medium",
|
|
537
|
+
children: watermark.waitingOn.length > 0 ? watermark.waitingOn.join(", ") : "none"
|
|
538
|
+
})
|
|
539
|
+
]
|
|
540
|
+
}),
|
|
541
|
+
watermark.stalledSinceUtcMs !== void 0 && now !== void 0 && /* @__PURE__ */ jsxs("div", {
|
|
542
|
+
className: "flex items-center gap-2 text-destructive",
|
|
543
|
+
children: [
|
|
544
|
+
/* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-destructive" }),
|
|
545
|
+
"Stalled for:",
|
|
546
|
+
" ",
|
|
547
|
+
/* @__PURE__ */ jsx("span", {
|
|
548
|
+
className: "font-medium",
|
|
549
|
+
title: new Date(watermark.stalledSinceUtcMs).toISOString(),
|
|
550
|
+
children: formatDuration(now - watermark.stalledSinceUtcMs)
|
|
551
|
+
})
|
|
552
|
+
]
|
|
553
|
+
}),
|
|
554
|
+
/* @__PURE__ */ jsxs("div", {
|
|
555
|
+
className: "flex items-center gap-2 text-foreground",
|
|
556
|
+
children: [
|
|
557
|
+
/* @__PURE__ */ jsx("span", { className: "size-2 rounded-full bg-destructive" }),
|
|
558
|
+
"Blocked: ",
|
|
559
|
+
/* @__PURE__ */ jsx("span", {
|
|
560
|
+
className: "font-medium",
|
|
561
|
+
children: blockedCount
|
|
562
|
+
})
|
|
563
|
+
]
|
|
564
|
+
})
|
|
565
|
+
]
|
|
566
|
+
}),
|
|
567
|
+
error && /* @__PURE__ */ jsxs("div", {
|
|
568
|
+
className: "shrink-0 rounded-lg border border-destructive bg-destructive/10 px-4 py-2 text-sm text-destructive",
|
|
569
|
+
children: ["Catch-up request failed: ", error]
|
|
570
|
+
}),
|
|
571
|
+
/* @__PURE__ */ jsx("div", {
|
|
572
|
+
className: "max-h-full overflow-auto rounded-lg border border-border",
|
|
573
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
574
|
+
className: "w-full border-collapse",
|
|
575
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
576
|
+
className: "sticky top-0 bg-muted",
|
|
577
|
+
children: /* @__PURE__ */ jsx("tr", { children: COLUMNS$3.map((column, index) => /* @__PURE__ */ jsx("th", {
|
|
578
|
+
className: twMerge("px-3 py-2 text-left text-xs font-medium text-foreground", index > 0 && "border-l border-border"),
|
|
579
|
+
style: { width: column.width },
|
|
580
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
581
|
+
className: "truncate",
|
|
582
|
+
children: column.label
|
|
583
|
+
})
|
|
584
|
+
}, column.key)) })
|
|
585
|
+
}), /* @__PURE__ */ jsx("tbody", { children: loading && !status ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
586
|
+
className: "px-3 py-8 text-center text-sm text-muted-foreground",
|
|
587
|
+
colSpan: COLUMNS$3.length,
|
|
588
|
+
children: "Loading..."
|
|
589
|
+
}) }) : consumers.length === 0 ? /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", {
|
|
590
|
+
className: "px-3 py-8 text-center text-sm text-muted-foreground",
|
|
591
|
+
colSpan: COLUMNS$3.length,
|
|
592
|
+
children: "No catch-up consumers"
|
|
593
|
+
}) }) : consumers.map((consumer) => {
|
|
594
|
+
const blocked = consumer.blockedAt;
|
|
595
|
+
const lastAdvance = new Date(consumer.lastAdvanceUtcMs);
|
|
596
|
+
return /* @__PURE__ */ jsxs("tr", {
|
|
597
|
+
className: twMerge("hover:hover-effect", blocked ? "bg-destructive/10" : "odd:bg-card even:bg-background"),
|
|
598
|
+
children: [
|
|
599
|
+
/* @__PURE__ */ jsx("td", {
|
|
600
|
+
className: "px-3 py-2 text-xs text-foreground",
|
|
601
|
+
children: /* @__PURE__ */ jsx(TruncatedText, { text: consumer.consumerId })
|
|
602
|
+
}),
|
|
603
|
+
/* @__PURE__ */ jsx(Cell, { children: consumer.thread }),
|
|
604
|
+
/* @__PURE__ */ jsx(Cell, { children: consumer.appliedThrough }),
|
|
605
|
+
/* @__PURE__ */ jsx(Cell, { children: settledThrough - consumer.appliedThrough }),
|
|
606
|
+
/* @__PURE__ */ jsx(Cell, { children: consumer.trackedAbove }),
|
|
607
|
+
/* @__PURE__ */ jsx(Cell, { children: /* @__PURE__ */ jsx("span", {
|
|
608
|
+
className: "block truncate",
|
|
609
|
+
title: lastAdvance.toISOString(),
|
|
610
|
+
children: lastAdvance.toLocaleString()
|
|
611
|
+
}) }),
|
|
612
|
+
/* @__PURE__ */ jsx(Cell, { children: blocked ? blocked.ordinal : /* @__PURE__ */ jsx(Empty, {}) }),
|
|
613
|
+
/* @__PURE__ */ jsx(Cell, { children: blocked ? /* @__PURE__ */ jsx("span", {
|
|
614
|
+
className: "block truncate",
|
|
615
|
+
title: blocked.documentId,
|
|
616
|
+
children: truncateId$3(blocked.documentId)
|
|
617
|
+
}) : /* @__PURE__ */ jsx(Empty, {}) }),
|
|
618
|
+
/* @__PURE__ */ jsx(Cell, { children: blocked ? blocked.scope : /* @__PURE__ */ jsx(Empty, {}) }),
|
|
619
|
+
/* @__PURE__ */ jsx(Cell, { children: blocked ? blocked.branch : /* @__PURE__ */ jsx(Empty, {}) }),
|
|
620
|
+
/* @__PURE__ */ jsx(Cell, { children: blocked ? /* @__PURE__ */ jsx(TruncatedText, { text: blocked.type }) : /* @__PURE__ */ jsx(Empty, {}) }),
|
|
621
|
+
/* @__PURE__ */ jsx(Cell, { children: blocked ? /* @__PURE__ */ jsx(TruncatedText, {
|
|
622
|
+
className: "text-destructive",
|
|
623
|
+
text: blocked.error
|
|
624
|
+
}) : /* @__PURE__ */ jsx(Empty, {}) })
|
|
625
|
+
]
|
|
626
|
+
}, consumer.consumerId);
|
|
627
|
+
}) })]
|
|
628
|
+
})
|
|
629
|
+
}),
|
|
630
|
+
/* @__PURE__ */ jsxs("div", {
|
|
631
|
+
className: "shrink-0 text-sm text-foreground",
|
|
632
|
+
children: [
|
|
633
|
+
"Showing ",
|
|
634
|
+
consumers.length,
|
|
635
|
+
" consumer(s)"
|
|
636
|
+
]
|
|
637
|
+
})
|
|
638
|
+
]
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
//#endregion
|
|
331
642
|
//#region src/connect/components/combobox/combobox.tsx
|
|
332
643
|
function DropdownIndicator(props) {
|
|
333
644
|
return /* @__PURE__ */ jsx(components.DropdownIndicator, {
|
|
@@ -6733,6 +7044,175 @@ function ChannelInspector({ remoteName, channel, onBack, onRefresh, connectionSt
|
|
|
6733
7044
|
});
|
|
6734
7045
|
}
|
|
6735
7046
|
//#endregion
|
|
7047
|
+
//#region src/connect/components/remotes-inspector/components/peer-agreement-panel.tsx
|
|
7048
|
+
const cell = "px-3 py-1.5 text-xs text-foreground";
|
|
7049
|
+
const head = "px-3 py-1.5 text-left text-xs font-medium text-foreground";
|
|
7050
|
+
function versions(list) {
|
|
7051
|
+
return list && list.length > 0 ? list.join(", ") : "none";
|
|
7052
|
+
}
|
|
7053
|
+
/** How a remote's peer announced itself. */
|
|
7054
|
+
function peerManifestLabel(peer) {
|
|
7055
|
+
if (peer === void 0) return "Not yet heard (baseline)";
|
|
7056
|
+
if (peer.manifest === null) return "Silent (baseline)";
|
|
7057
|
+
return `Announced, revision ${peer.manifest.revision.slice(0, 8)}`;
|
|
7058
|
+
}
|
|
7059
|
+
function PeerAgreementPanel({ remoteName, collectionId, peer, agreement, holds }) {
|
|
7060
|
+
const local = agreement.local();
|
|
7061
|
+
const theirs = agreement.peer(remoteName);
|
|
7062
|
+
const protocols = Object.keys(local.protocols).sort();
|
|
7063
|
+
const features = Object.keys(local.features).sort();
|
|
7064
|
+
return /* @__PURE__ */ jsxs("section", {
|
|
7065
|
+
"aria-label": "Peer agreement",
|
|
7066
|
+
className: "flex flex-col gap-2 rounded-lg border border-border p-3",
|
|
7067
|
+
children: [
|
|
7068
|
+
/* @__PURE__ */ jsxs("div", {
|
|
7069
|
+
className: "flex items-center justify-between",
|
|
7070
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
7071
|
+
className: "text-sm font-semibold text-foreground",
|
|
7072
|
+
children: "Peer agreement"
|
|
7073
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
7074
|
+
className: "text-xs text-muted-foreground",
|
|
7075
|
+
children: peerManifestLabel(peer)
|
|
7076
|
+
})]
|
|
7077
|
+
}),
|
|
7078
|
+
/* @__PURE__ */ jsxs("table", {
|
|
7079
|
+
className: "w-full border-collapse",
|
|
7080
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
7081
|
+
className: "bg-muted",
|
|
7082
|
+
children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
7083
|
+
/* @__PURE__ */ jsx("th", {
|
|
7084
|
+
className: head,
|
|
7085
|
+
children: "Protocol"
|
|
7086
|
+
}),
|
|
7087
|
+
/* @__PURE__ */ jsx("th", {
|
|
7088
|
+
className: head,
|
|
7089
|
+
children: "Local"
|
|
7090
|
+
}),
|
|
7091
|
+
/* @__PURE__ */ jsx("th", {
|
|
7092
|
+
className: head,
|
|
7093
|
+
children: "Peer"
|
|
7094
|
+
}),
|
|
7095
|
+
/* @__PURE__ */ jsx("th", {
|
|
7096
|
+
className: head,
|
|
7097
|
+
children: "Limits new documents"
|
|
7098
|
+
})
|
|
7099
|
+
] })
|
|
7100
|
+
}), /* @__PURE__ */ jsxs("tbody", { children: [protocols.map((protocol) => {
|
|
7101
|
+
const limits = agreement.limitedBy(collectionId, protocol).includes(remoteName);
|
|
7102
|
+
return /* @__PURE__ */ jsxs("tr", {
|
|
7103
|
+
className: "odd:bg-card even:bg-background",
|
|
7104
|
+
children: [
|
|
7105
|
+
/* @__PURE__ */ jsx("td", {
|
|
7106
|
+
className: cell,
|
|
7107
|
+
children: protocol
|
|
7108
|
+
}),
|
|
7109
|
+
/* @__PURE__ */ jsx("td", {
|
|
7110
|
+
className: cell,
|
|
7111
|
+
children: versions(local.protocols[protocol])
|
|
7112
|
+
}),
|
|
7113
|
+
/* @__PURE__ */ jsx("td", {
|
|
7114
|
+
className: cell,
|
|
7115
|
+
children: versions(theirs.protocols[protocol])
|
|
7116
|
+
}),
|
|
7117
|
+
/* @__PURE__ */ jsx("td", {
|
|
7118
|
+
className: twMerge(cell, limits && "text-warning"),
|
|
7119
|
+
children: limits ? "Yes" : "No"
|
|
7120
|
+
})
|
|
7121
|
+
]
|
|
7122
|
+
}, protocol);
|
|
7123
|
+
}), features.map((feature) => /* @__PURE__ */ jsxs("tr", {
|
|
7124
|
+
className: "odd:bg-card even:bg-background",
|
|
7125
|
+
children: [
|
|
7126
|
+
/* @__PURE__ */ jsxs("td", {
|
|
7127
|
+
className: cell,
|
|
7128
|
+
children: [feature, " (feature)"]
|
|
7129
|
+
}),
|
|
7130
|
+
/* @__PURE__ */ jsx("td", {
|
|
7131
|
+
className: cell,
|
|
7132
|
+
children: versions(local.features[feature])
|
|
7133
|
+
}),
|
|
7134
|
+
/* @__PURE__ */ jsx("td", {
|
|
7135
|
+
className: cell,
|
|
7136
|
+
children: versions(theirs.features[feature])
|
|
7137
|
+
}),
|
|
7138
|
+
/* @__PURE__ */ jsx("td", {
|
|
7139
|
+
className: cell,
|
|
7140
|
+
children: "-"
|
|
7141
|
+
})
|
|
7142
|
+
]
|
|
7143
|
+
}, feature))] })]
|
|
7144
|
+
}),
|
|
7145
|
+
/* @__PURE__ */ jsxs("h4", {
|
|
7146
|
+
className: "text-xs font-semibold text-foreground",
|
|
7147
|
+
children: [
|
|
7148
|
+
"Held documents (",
|
|
7149
|
+
holds.length,
|
|
7150
|
+
")"
|
|
7151
|
+
]
|
|
7152
|
+
}),
|
|
7153
|
+
holds.length === 0 ? /* @__PURE__ */ jsx("p", {
|
|
7154
|
+
className: "text-xs text-muted-foreground",
|
|
7155
|
+
children: "No documents held"
|
|
7156
|
+
}) : /* @__PURE__ */ jsxs("table", {
|
|
7157
|
+
className: "w-full border-collapse",
|
|
7158
|
+
children: [/* @__PURE__ */ jsx("thead", {
|
|
7159
|
+
className: "bg-muted",
|
|
7160
|
+
children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
7161
|
+
/* @__PURE__ */ jsx("th", {
|
|
7162
|
+
className: head,
|
|
7163
|
+
children: "Document"
|
|
7164
|
+
}),
|
|
7165
|
+
/* @__PURE__ */ jsx("th", {
|
|
7166
|
+
className: head,
|
|
7167
|
+
children: "Branch"
|
|
7168
|
+
}),
|
|
7169
|
+
/* @__PURE__ */ jsx("th", {
|
|
7170
|
+
className: head,
|
|
7171
|
+
children: "Requires"
|
|
7172
|
+
}),
|
|
7173
|
+
/* @__PURE__ */ jsx("th", {
|
|
7174
|
+
className: head,
|
|
7175
|
+
children: "Peer runs"
|
|
7176
|
+
}),
|
|
7177
|
+
/* @__PURE__ */ jsx("th", {
|
|
7178
|
+
className: head,
|
|
7179
|
+
children: "Held since"
|
|
7180
|
+
})
|
|
7181
|
+
] })
|
|
7182
|
+
}), /* @__PURE__ */ jsx("tbody", { children: holds.map((hold) => /* @__PURE__ */ jsxs("tr", {
|
|
7183
|
+
className: "odd:bg-card even:bg-background",
|
|
7184
|
+
children: [
|
|
7185
|
+
/* @__PURE__ */ jsx("td", {
|
|
7186
|
+
className: cell,
|
|
7187
|
+
children: hold.documentId
|
|
7188
|
+
}),
|
|
7189
|
+
/* @__PURE__ */ jsx("td", {
|
|
7190
|
+
className: cell,
|
|
7191
|
+
children: hold.branch
|
|
7192
|
+
}),
|
|
7193
|
+
/* @__PURE__ */ jsxs("td", {
|
|
7194
|
+
className: cell,
|
|
7195
|
+
children: [
|
|
7196
|
+
hold.reason.protocol,
|
|
7197
|
+
" ",
|
|
7198
|
+
hold.reason.version
|
|
7199
|
+
]
|
|
7200
|
+
}),
|
|
7201
|
+
/* @__PURE__ */ jsx("td", {
|
|
7202
|
+
className: cell,
|
|
7203
|
+
children: versions(hold.reason.peerSupports)
|
|
7204
|
+
}),
|
|
7205
|
+
/* @__PURE__ */ jsx("td", {
|
|
7206
|
+
className: cell,
|
|
7207
|
+
children: new Date(hold.heldAtUtcMs).toLocaleString()
|
|
7208
|
+
})
|
|
7209
|
+
]
|
|
7210
|
+
}, `${hold.documentId}:${hold.branch}`)) })]
|
|
7211
|
+
})
|
|
7212
|
+
]
|
|
7213
|
+
});
|
|
7214
|
+
}
|
|
7215
|
+
//#endregion
|
|
6736
7216
|
//#region src/connect/components/remotes-inspector/remotes-inspector.tsx
|
|
6737
7217
|
const BASE_COLUMNS = [
|
|
6738
7218
|
{
|
|
@@ -6760,6 +7240,11 @@ const BASE_COLUMNS = [
|
|
|
6760
7240
|
label: "Filter",
|
|
6761
7241
|
width: "200px"
|
|
6762
7242
|
},
|
|
7243
|
+
{
|
|
7244
|
+
key: "peer",
|
|
7245
|
+
label: "Peer",
|
|
7246
|
+
width: "160px"
|
|
7247
|
+
},
|
|
6763
7248
|
{
|
|
6764
7249
|
key: "channel",
|
|
6765
7250
|
label: "Channel",
|
|
@@ -6806,7 +7291,7 @@ function sortRemotes(remotes, sort) {
|
|
|
6806
7291
|
return sort.direction === "asc" ? comparison : -comparison;
|
|
6807
7292
|
});
|
|
6808
7293
|
}
|
|
6809
|
-
function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPull, connectionStates }) {
|
|
7294
|
+
function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPull, connectionStates, getAgreement, getHolds }) {
|
|
6810
7295
|
const [remotes, setRemotes] = useState([]);
|
|
6811
7296
|
const [loading, setLoading] = useState(true);
|
|
6812
7297
|
const [sort, setSort] = useState();
|
|
@@ -6814,6 +7299,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
|
|
|
6814
7299
|
const [manualUrl, setManualUrl] = useState("");
|
|
6815
7300
|
const [adding, setAdding] = useState(false);
|
|
6816
7301
|
const [addError, setAddError] = useState();
|
|
7302
|
+
const [holds, setHolds] = useState([]);
|
|
6817
7303
|
const hasRowActions = !!removeRemote || !!triggerPull;
|
|
6818
7304
|
const columns = useMemo(() => hasRowActions ? [...BASE_COLUMNS, ACTIONS_COLUMN] : BASE_COLUMNS, [hasRowActions]);
|
|
6819
7305
|
const loadRemotes = useCallback(async () => {
|
|
@@ -6825,6 +7311,18 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
|
|
|
6825
7311
|
useEffect(() => {
|
|
6826
7312
|
loadRemotes();
|
|
6827
7313
|
}, [loadRemotes]);
|
|
7314
|
+
useEffect(() => {
|
|
7315
|
+
if (!selectedRemote || !getHolds) return;
|
|
7316
|
+
let current = true;
|
|
7317
|
+
getHolds(selectedRemote.meta.name).then((loaded) => {
|
|
7318
|
+
if (current) setHolds(loaded);
|
|
7319
|
+
}).catch(() => {
|
|
7320
|
+
if (current) setHolds([]);
|
|
7321
|
+
});
|
|
7322
|
+
return () => {
|
|
7323
|
+
current = false;
|
|
7324
|
+
};
|
|
7325
|
+
}, [selectedRemote, getHolds]);
|
|
6828
7326
|
const handleRefresh = useCallback(async () => {
|
|
6829
7327
|
await loadRemotes();
|
|
6830
7328
|
if (selectedRemote) {
|
|
@@ -6837,7 +7335,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
|
|
|
6837
7335
|
remotes
|
|
6838
7336
|
]);
|
|
6839
7337
|
const handleSort = (columnKey) => {
|
|
6840
|
-
if (columnKey === "channel" || columnKey === "actions" || columnKey === "status") return;
|
|
7338
|
+
if (columnKey === "channel" || columnKey === "actions" || columnKey === "status" || columnKey === "peer") return;
|
|
6841
7339
|
const newDirection = sort?.column === columnKey && sort.direction === "asc" ? "desc" : "asc";
|
|
6842
7340
|
setSort({
|
|
6843
7341
|
column: columnKey,
|
|
@@ -6883,13 +7381,30 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
|
|
|
6883
7381
|
const handlePull = useCallback((remote) => {
|
|
6884
7382
|
triggerPull?.(remote.meta.name);
|
|
6885
7383
|
}, [triggerPull]);
|
|
6886
|
-
if (selectedRemote)
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
7384
|
+
if (selectedRemote) {
|
|
7385
|
+
let agreement;
|
|
7386
|
+
try {
|
|
7387
|
+
agreement = getAgreement?.();
|
|
7388
|
+
} catch {
|
|
7389
|
+
agreement = void 0;
|
|
7390
|
+
}
|
|
7391
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
7392
|
+
className: "flex h-full flex-col gap-2 overflow-auto",
|
|
7393
|
+
children: [agreement && /* @__PURE__ */ jsx(PeerAgreementPanel, {
|
|
7394
|
+
agreement,
|
|
7395
|
+
collectionId: selectedRemote.meta.collectionId.key,
|
|
7396
|
+
holds,
|
|
7397
|
+
peer: selectedRemote.meta.peer,
|
|
7398
|
+
remoteName: selectedRemote.meta.name
|
|
7399
|
+
}), /* @__PURE__ */ jsx(ChannelInspector, {
|
|
7400
|
+
channel: selectedRemote.channel,
|
|
7401
|
+
connectionState: connectionStates?.get(selectedRemote.meta.name),
|
|
7402
|
+
onBack: handleBack,
|
|
7403
|
+
onRefresh: () => void handleRefresh(),
|
|
7404
|
+
remoteName: selectedRemote.meta.name
|
|
7405
|
+
})]
|
|
7406
|
+
});
|
|
7407
|
+
}
|
|
6893
7408
|
const sortedRemotes = sortRemotes(remotes, sort);
|
|
6894
7409
|
return /* @__PURE__ */ jsxs("div", {
|
|
6895
7410
|
className: "flex h-full flex-col gap-2",
|
|
@@ -6946,7 +7461,7 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
|
|
|
6946
7461
|
children: /* @__PURE__ */ jsx("tr", { children: columns.map((column, index) => {
|
|
6947
7462
|
const isActive = sort?.column === column.key;
|
|
6948
7463
|
const sortDirection = isActive ? sort.direction : "asc";
|
|
6949
|
-
const isSortable = column.key !== "channel" && column.key !== "actions" && column.key !== "status";
|
|
7464
|
+
const isSortable = column.key !== "channel" && column.key !== "actions" && column.key !== "status" && column.key !== "peer";
|
|
6950
7465
|
return /* @__PURE__ */ jsx("th", {
|
|
6951
7466
|
className: twMerge("group px-3 py-2 text-left text-xs font-medium text-foreground", index > 0 && "border-l border-border", isSortable && "cursor-pointer hover:hover-effect"),
|
|
6952
7467
|
onClick: () => isSortable && handleSort(column.key),
|
|
@@ -7016,6 +7531,13 @@ function RemotesInspector({ getRemotes, removeRemote, addRemoteManual, triggerPu
|
|
|
7016
7531
|
children: formatFilter(remote.meta.filter)
|
|
7017
7532
|
})
|
|
7018
7533
|
}),
|
|
7534
|
+
/* @__PURE__ */ jsx("td", {
|
|
7535
|
+
className: "border-l border-border px-3 py-2 text-xs text-foreground",
|
|
7536
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
7537
|
+
className: "block truncate",
|
|
7538
|
+
children: peerManifestLabel(remote.meta.peer)
|
|
7539
|
+
})
|
|
7540
|
+
}),
|
|
7019
7541
|
/* @__PURE__ */ jsx("td", {
|
|
7020
7542
|
className: "border-l border-border px-3 py-2",
|
|
7021
7543
|
children: /* @__PURE__ */ jsxs("button", {
|
|
@@ -7189,7 +7711,7 @@ function InspectorUnavailable({ message }) {
|
|
|
7189
7711
|
})]
|
|
7190
7712
|
});
|
|
7191
7713
|
}
|
|
7192
|
-
function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExplorerProps, remotesInspectorProps, queueInspectorProps, processorsInspectorProps, integrityInspectorProps, workerInspectorProps, unavailableTabs, defaultTab = "Database" }) {
|
|
7714
|
+
function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExplorerProps, remotesInspectorProps, queueInspectorProps, processorsInspectorProps, integrityInspectorProps, catchUpInspectorProps, workerInspectorProps, unavailableTabs, defaultTab = "Database" }) {
|
|
7193
7715
|
return /* @__PURE__ */ jsx(Modal, {
|
|
7194
7716
|
...modalProps,
|
|
7195
7717
|
contentProps: {
|
|
@@ -7274,6 +7796,20 @@ function InspectorModal({ open, onOpenChange, modalProps, containerProps, dbExpl
|
|
|
7274
7796
|
label: "Integrity",
|
|
7275
7797
|
children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.Integrity })
|
|
7276
7798
|
}) : null,
|
|
7799
|
+
catchUpInspectorProps ? /* @__PURE__ */ jsx(TabContent, {
|
|
7800
|
+
description: "Catch-up inspector",
|
|
7801
|
+
label: "Catch-up",
|
|
7802
|
+
value: "CatchUp",
|
|
7803
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
7804
|
+
className: "h-full",
|
|
7805
|
+
children: /* @__PURE__ */ jsx(CatchUpInspector, { ...catchUpInspectorProps })
|
|
7806
|
+
})
|
|
7807
|
+
}) : unavailableTabs?.CatchUp ? /* @__PURE__ */ jsx(TabContent, {
|
|
7808
|
+
description: "Catch-up inspector",
|
|
7809
|
+
label: "Catch-up",
|
|
7810
|
+
value: "CatchUp",
|
|
7811
|
+
children: /* @__PURE__ */ jsx(InspectorUnavailable, { message: unavailableTabs.CatchUp })
|
|
7812
|
+
}) : null,
|
|
7277
7813
|
workerInspectorProps && /* @__PURE__ */ jsx(TabContent, {
|
|
7278
7814
|
description: "Worker inspector",
|
|
7279
7815
|
label: "Worker",
|
|
@@ -9755,6 +10291,6 @@ const removeSuccessFiles = (files) => {
|
|
|
9755
10291
|
return files.filter((file) => file.status !== "SUCCESS");
|
|
9756
10292
|
};
|
|
9757
10293
|
//#endregion
|
|
9758
|
-
export { About, AccountPopover, AccountPopoverLogin, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, AvailablePackagesPanel, Breadcrumb, Breadcrumbs, CONFLICT, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, CreateDocumentWithTypeModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, InstalledPackagesPanel, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, ModalButton, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageList, PackageManager, PackageManagerListItem, PackagePanelScrollArea, PackageRegistryError, PackageSubSection, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RenownLoginMethods, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, formatFileSize, generateId, getFolderStatus, locationInfoByLocation, mapProgressStageToStatus, mapUploadsToFileItems, nodeOptions, normalNodeOptions, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
|
|
10294
|
+
export { About, AccountPopover, AccountPopoverLogin, AddDriveModal, AddLocalDriveForm, AddRemoteDriveForm, AnimatedLoader, AvailablePackagesPanel, Breadcrumb, Breadcrumbs, CONFLICT, CatchUpInspector, ChannelInspector, Combobox, ConnectConfirmationModal, ConnectDeleteDriveModal, ConnectDeleteItemModal, ConnectDropdownMenu, ConnectReplaceDuplicateModal, ConnectSearchBar, ConnectSelect, ConnectSidebar, ConnectSidebarFooter, ConnectSidebarHeader, ConnectTooltip, ConnectTooltipProvider, ConnectUpgradeDriveModal, ConnectionStateBadge, CookieBanner, CreateDocumentModal, CreateDocumentWithTypeModal, DBExplorer, DangerZone, DebugInspector, DefaultEditor, DefaultEditorLoader, DefaultEditorSelect, DependencyVersions, Disclosure, Divider, DocumentStateViewer, DocumentTimeline, DocumentToolbar, DriveAuthGate, DriveSettingsModal, DropZone, DropZoneWrapper, ENSAvatar, ERROR, EditorActionButtons, EditorUndoRedoButtons, FileItem, FolderItem, Footer, FooterLink, FormInput, FormattedJsonViewer, HomeBackgroundImage, HomeScreen, HomeScreenAddDriveItem, HomeScreenItem, INITIAL_SYNC, InspectorModal, InstalledPackagesPanel, IntegrityInspector, LoadingScreen, LogoAnimation, MISSING, ModalButton, NodeInput, ObjectInspectorModal, PackageInstallModal, PackageList, PackageManager, PackageManagerListItem, PackagePanelScrollArea, PackageRegistryError, PackageSubSection, PeerAgreementPanel, ProcessorsInspector, QueueInspector, ReadRequiredModal, RemotesInspector, RenownLoginMethods, RevisionHistory, SUCCESS, SYNCING, SettingsModal, SidebarAddDriveItem, SidebarItem, SidebarLogin, SidebarUser, SyncStatusIcon, TabContent, Tabs, ThemeSwitch, Toggle, ToolbarButton, ToolbarCloseButton, ToolbarContainer, ToolbarControlsContainer, ToolbarDownloadButton, ToolbarHistoryButton, ToolbarInput, ToolbarName, ToolbarRedoButton, ToolbarSwitchboardButton, ToolbarUndoButton, UploadFileItem, UploadFileList, UploadFileListContainer, WorkerInspector, debugNodeOptions, debugNodeOptionsMap, defaultDriveOptions, defaultNodeOptions, fileNodeDropdownOptions, folderNodeDropdownOptions, formatEthAddress, formatFileSize, generateId, getFolderStatus, locationInfoByLocation, mapProgressStageToStatus, mapUploadsToFileItems, nodeOptions, normalNodeOptions, peerManifestLabel, removeSuccessFiles, sharingTypeOptions, sortFilesByStatus, syncStatuses, useEns, verifyPackageJsonFields };
|
|
9759
10295
|
|
|
9760
10296
|
//# sourceMappingURL=index.js.map
|