@powerhousedao/design-system 5.1.0-dev.1 → 5.1.0-dev.11

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.
Files changed (71) hide show
  1. package/dist/src/connect/components/db-explorer/components/index.d.ts +3 -0
  2. package/dist/src/connect/components/db-explorer/components/index.d.ts.map +1 -0
  3. package/dist/src/connect/components/db-explorer/components/index.js +3 -0
  4. package/dist/src/connect/components/db-explorer/components/index.js.map +1 -0
  5. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.d.ts +15 -0
  6. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.d.ts.map +1 -0
  7. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.js +47 -0
  8. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.js.map +1 -0
  9. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.d.ts +12 -0
  10. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.d.ts.map +1 -0
  11. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.js +119 -0
  12. package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.js.map +1 -0
  13. package/dist/src/connect/components/db-explorer/components/table-view.d.ts +26 -0
  14. package/dist/src/connect/components/db-explorer/components/table-view.d.ts.map +1 -0
  15. package/dist/src/connect/components/db-explorer/components/table-view.js +67 -0
  16. package/dist/src/connect/components/db-explorer/components/table-view.js.map +1 -0
  17. package/dist/src/connect/components/db-explorer/components/table-view.stories.d.ts +14 -0
  18. package/dist/src/connect/components/db-explorer/components/table-view.stories.d.ts.map +1 -0
  19. package/dist/src/connect/components/db-explorer/components/table-view.stories.js +203 -0
  20. package/dist/src/connect/components/db-explorer/components/table-view.stories.js.map +1 -0
  21. package/dist/src/connect/components/db-explorer/db-explorer.d.ts +32 -0
  22. package/dist/src/connect/components/db-explorer/db-explorer.d.ts.map +1 -0
  23. package/dist/src/connect/components/db-explorer/db-explorer.js +102 -0
  24. package/dist/src/connect/components/db-explorer/db-explorer.js.map +1 -0
  25. package/dist/src/connect/components/db-explorer/db-explorer.stories.d.ts +11 -0
  26. package/dist/src/connect/components/db-explorer/db-explorer.stories.d.ts.map +1 -0
  27. package/dist/src/connect/components/db-explorer/db-explorer.stories.js +182 -0
  28. package/dist/src/connect/components/db-explorer/db-explorer.stories.js.map +1 -0
  29. package/dist/src/connect/components/db-explorer/index.d.ts +2 -0
  30. package/dist/src/connect/components/db-explorer/index.d.ts.map +1 -0
  31. package/dist/src/connect/components/db-explorer/index.js +2 -0
  32. package/dist/src/connect/components/db-explorer/index.js.map +1 -0
  33. package/dist/src/connect/components/index.d.ts +2 -0
  34. package/dist/src/connect/components/index.d.ts.map +1 -1
  35. package/dist/src/connect/components/index.js +2 -0
  36. package/dist/src/connect/components/index.js.map +1 -1
  37. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.d.ts +9 -0
  38. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.d.ts.map +1 -0
  39. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.js +38 -0
  40. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.js.map +1 -0
  41. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts +12 -0
  42. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts.map +1 -0
  43. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js +113 -0
  44. package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js.map +1 -0
  45. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.d.ts +14 -0
  46. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.d.ts.map +1 -0
  47. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.js +97 -0
  48. package/dist/src/connect/components/remotes-inspector/components/mailbox-table.js.map +1 -0
  49. package/dist/src/connect/components/remotes-inspector/components/sort-icon.d.ts +7 -0
  50. package/dist/src/connect/components/remotes-inspector/components/sort-icon.d.ts.map +1 -0
  51. package/dist/src/connect/components/remotes-inspector/components/sort-icon.js +10 -0
  52. package/dist/src/connect/components/remotes-inspector/components/sort-icon.js.map +1 -0
  53. package/dist/src/connect/components/remotes-inspector/index.d.ts +3 -0
  54. package/dist/src/connect/components/remotes-inspector/index.d.ts.map +1 -0
  55. package/dist/src/connect/components/remotes-inspector/index.js +3 -0
  56. package/dist/src/connect/components/remotes-inspector/index.js.map +1 -0
  57. package/dist/src/connect/components/remotes-inspector/remotes-inspector.d.ts +7 -0
  58. package/dist/src/connect/components/remotes-inspector/remotes-inspector.d.ts.map +1 -0
  59. package/dist/src/connect/components/remotes-inspector/remotes-inspector.js +86 -0
  60. package/dist/src/connect/components/remotes-inspector/remotes-inspector.js.map +1 -0
  61. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.d.ts +11 -0
  62. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.d.ts.map +1 -0
  63. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.js +138 -0
  64. package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.js.map +1 -0
  65. package/dist/src/connect/components/remotes-inspector/utils.d.ts +12 -0
  66. package/dist/src/connect/components/remotes-inspector/utils.d.ts.map +1 -0
  67. package/dist/src/connect/components/remotes-inspector/utils.js +6 -0
  68. package/dist/src/connect/components/remotes-inspector/utils.js.map +1 -0
  69. package/dist/style.css +77 -0
  70. package/dist/tsconfig.tsbuildinfo +1 -1
  71. package/package.json +6 -5
@@ -0,0 +1,97 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Icon } from "@powerhousedao/design-system";
3
+ import { SyncOperationStatus } from "@powerhousedao/reactor";
4
+ import { twMerge } from "tailwind-merge";
5
+ import { SortIcon } from "./sort-icon.js";
6
+ import { truncateId } from "../utils.js";
7
+ const COLUMNS = [
8
+ { key: "id", label: "ID", width: "120px" },
9
+ { key: "documentId", label: "Document ID", width: "150px" },
10
+ { key: "branch", label: "Branch", width: "100px" },
11
+ { key: "status", label: "Status", width: "150px" },
12
+ { key: "opsCount", label: "Ops Count", width: "80px" },
13
+ ];
14
+ const DEAD_LETTER_COLUMNS = [
15
+ { key: "id", label: "ID", width: "120px" },
16
+ { key: "documentId", label: "Document ID", width: "150px" },
17
+ { key: "branch", label: "Branch", width: "100px" },
18
+ { key: "error", label: "Error", width: "200px" },
19
+ ];
20
+ function getStatusLabel(status) {
21
+ switch (status) {
22
+ case SyncOperationStatus.Unknown:
23
+ return "Unknown";
24
+ case SyncOperationStatus.TransportPending:
25
+ return "Transport Pending";
26
+ case SyncOperationStatus.ExecutionPending:
27
+ return "Execution Pending";
28
+ case SyncOperationStatus.Applied:
29
+ return "Applied";
30
+ case SyncOperationStatus.Error:
31
+ return "Error";
32
+ default:
33
+ return "Unknown";
34
+ }
35
+ }
36
+ function getStatusIcon(status) {
37
+ switch (status) {
38
+ case SyncOperationStatus.TransportPending:
39
+ case SyncOperationStatus.ExecutionPending:
40
+ return _jsx("span", { children: "\u23F3" });
41
+ case SyncOperationStatus.Applied:
42
+ return _jsx("span", { children: "\u2705" });
43
+ case SyncOperationStatus.Error:
44
+ return _jsx("span", { children: "\u274C" });
45
+ default:
46
+ return _jsx("span", { children: "\u2753" });
47
+ }
48
+ }
49
+ function getErrorMessage(error) {
50
+ if (!error)
51
+ return "";
52
+ return error.error.message;
53
+ }
54
+ function sortOperations(operations, sort) {
55
+ const ops = [...operations];
56
+ if (!sort)
57
+ return ops;
58
+ return ops.sort((a, b) => {
59
+ let comparison = 0;
60
+ switch (sort.column) {
61
+ case "id":
62
+ comparison = a.id.localeCompare(b.id);
63
+ break;
64
+ case "documentId":
65
+ comparison = a.documentId.localeCompare(b.documentId);
66
+ break;
67
+ case "branch":
68
+ comparison = a.branch.localeCompare(b.branch);
69
+ break;
70
+ case "status":
71
+ comparison = a.status - b.status;
72
+ break;
73
+ case "opsCount":
74
+ comparison = a.operations.length - b.operations.length;
75
+ break;
76
+ case "error":
77
+ comparison = getErrorMessage(a.error).localeCompare(getErrorMessage(b.error));
78
+ break;
79
+ default:
80
+ return 0;
81
+ }
82
+ return sort.direction === "asc" ? comparison : -comparison;
83
+ });
84
+ }
85
+ export function MailboxTable({ title, mailboxType, operations, sort, onSort, collapsed, onToggleCollapse, }) {
86
+ const columns = mailboxType === "deadLetter" ? DEAD_LETTER_COLUMNS : COLUMNS;
87
+ const sortedOps = sortOperations(operations, sort);
88
+ const handleSort = (columnKey) => {
89
+ onSort(mailboxType, columnKey);
90
+ };
91
+ return (_jsxs("div", { className: "flex flex-col gap-2", children: [_jsxs("button", { className: "flex items-center gap-2 text-left text-sm font-medium text-gray-700 hover:text-gray-900", onClick: onToggleCollapse, type: "button", children: [_jsx(Icon, { className: twMerge("transition-transform", collapsed && "-rotate-90"), name: "ChevronDown", size: 14 }), title, " (", operations.length, " item", operations.length !== 1 ? "s" : "", ")"] }), !collapsed && (_jsx("div", { className: "max-h-64 overflow-auto rounded-lg border border-gray-300", children: _jsxs("table", { className: "w-full border-collapse", children: [_jsx("thead", { className: "sticky top-0 bg-gray-100", children: _jsx("tr", { children: columns.map((column, index) => {
92
+ const isActive = sort?.column === column.key;
93
+ const sortDirection = isActive ? sort.direction : "asc";
94
+ return (_jsx("th", { className: twMerge("group cursor-pointer px-3 py-2 text-left text-xs font-medium text-gray-600 hover:bg-gray-200 hover:text-gray-900", index > 0 && "border-l border-gray-300"), onClick: () => handleSort(column.key), style: { width: column.width }, children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: "truncate", children: column.label }), _jsx(SortIcon, { active: isActive, direction: sortDirection })] }) }, column.key));
95
+ }) }) }), _jsx("tbody", { children: sortedOps.length === 0 ? (_jsx("tr", { children: _jsx("td", { className: "px-3 py-4 text-center text-sm text-gray-500", colSpan: columns.length, children: "No operations" }) })) : (sortedOps.map((op) => (_jsxs("tr", { className: "odd:bg-white even:bg-gray-50 hover:bg-blue-50", children: [_jsx("td", { className: "px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: op.id, children: truncateId(op.id) }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: op.documentId, children: truncateId(op.documentId) }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: op.branch, children: op.branch }) }), mailboxType === "deadLetter" ? (_jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs", children: _jsxs("span", { className: "block truncate text-red-600", title: getErrorMessage(op.error), children: ["\u274C ", getErrorMessage(op.error) || "Unknown error"] }) })) : (_jsxs(_Fragment, { children: [_jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: _jsxs("span", { className: "flex items-center gap-1", children: [getStatusIcon(op.status), getStatusLabel(op.status)] }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: op.operations.length })] }))] }, op.id)))) })] }) }))] }));
96
+ }
97
+ //# sourceMappingURL=mailbox-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailbox-table.js","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/mailbox-table.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAsB,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAoC,UAAU,EAAE,MAAM,aAAa,CAAC;AAI3E,MAAM,OAAO,GAAgB;IAC3B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;IAC1C,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,OAAO,EAAE;IAC3D,EAAE,G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ACL,aAAI,SAAS,EAAC,0DAA0D,YACtE,eAAM,SAAS,EAAC,gBAAgB,EAAC,KAAK,EAAE,EAAE,CAAC,MAAM,YAC9C,EAAE,CAAC,MAAM,GACL,GACJ,EACJ,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,CAC9B,aAAI,SAAS,EAAC,4CAA4C,YACxD,gBACE,SAAS,EAAC,6BAA6B,EACvC,KAAK,EAAE,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,wBAE7B,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,eAAe,IAC1C,GACJ,CACN,CAAC,CAAC,CAAC,CACF,8BACE,aAAI,SAAS,EAAC,0DAA0D,YACtE,gBAAM,SAAS,EAAC,yBAAyB,aACtC,aAAa,CAAC,EAAE,CAAC,MAAM,CAAC,EACxB,cAAc,CAAC,EAAE,CAAC,MAAM,CAAC,IACrB,GACJ,EACL,aAAI,SAAS,EAAC,0DAA0D,YACrE,EAAE,CAAC,UAAU,CAAC,MAAM,GAClB,IACJ,CACJ,KAvCI,EAAE,CAAC,EAAE,CAwCP,CACN,CAAC,CACH,GACK,IACF,GACJ,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type SortDirection } from "../utils.js";
2
+ export type SortIconProps = {
3
+ readonly direction: SortDirection;
4
+ readonly active: boolean;
5
+ };
6
+ export declare function SortIcon({ direction, active }: SortIconProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=sort-icon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-icon.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/sort-icon.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,QAAQ,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,aAAa,2CAkB5D"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Icon } from "@powerhousedao/design-system";
3
+ import {} from "../utils.js";
4
+ export function SortIcon({ direction, active }) {
5
+ if (!active) {
6
+ return (_jsx(Icon, { className: "opacity-0 group-hover:opacity-50", name: "CaretSort", size: 12 }));
7
+ }
8
+ return (_jsx(Icon, { className: direction === "asc" ? "rotate-180" : undefined, name: "TriangleDown", size: 12 }));
9
+ }
10
+ //# sourceMappingURL=sort-icon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-icon.js","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/sort-icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAsB,MAAM,aAAa,CAAC;AAOjD,MAAM,UAAU,QAAQ,CAAC,EAAE,SAAS,EAAE,MAAM,EAAiB;IAC3D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAC,kCAAkC,EAC5C,IAAI,EAAC,WAAW,EAChB,IAAI,EAAE,EAAE,GACR,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CACL,KAAC,IAAI,IACH,SAAS,EAAE,SAAS,KAAK,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,EACzD,IAAI,EAAC,cAAc,EACnB,IAAI,EAAE,EAAE,GACR,CACH,CAAC;AACJ,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./remotes-inspector.js";
2
+ export * from "./components/channel-inspector.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./remotes-inspector.js";
2
+ export * from "./components/channel-inspector.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { type Remote } from "@powerhousedao/reactor";
2
+ export type RemotesInspectorProps = {
3
+ readonly remotes: Remote[];
4
+ readonly onRefresh?: () => void;
5
+ };
6
+ export declare function RemotesInspector({ remotes, onRefresh, }: RemotesInspectorProps): import("react/jsx-runtime").JSX.Element;
7
+ //# sourceMappingURL=remotes-inspector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remotes-inspector.d.ts","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/remotes-inspector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAYrD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC,CAAC;AAgEF,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,SAAS,GACV,EAAE,qBAAqB,2CAoJvB"}
@@ -0,0 +1,86 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Icon } from "@powerhousedao/design-system";
3
+ import {} from "@powerhousedao/reactor";
4
+ import { useState } from "react";
5
+ import { twMerge } from "tailwind-merge";
6
+ import { ChannelInspector } from "./components/channel-inspector.js";
7
+ import { SortIcon } from "./components/sort-icon.js";
8
+ import { truncateId, } from "./utils.js";
9
+ const COLUMNS = [
10
+ { key: "id", label: "ID", width: "120px" },
11
+ { key: "name", label: "Name", width: "150px" },
12
+ { key: "collectionId", label: "Collection ID", width: "200px" },
13
+ { key: "filter", label: "Filter", width: "200px" },
14
+ { key: "channel", label: "Channel", width: "100px" },
15
+ ];
16
+ function formatFilter(filter) {
17
+ const parts = [];
18
+ if (filter.branch) {
19
+ parts.push(`branch:${filter.branch}`);
20
+ }
21
+ if (filter.documentId.length > 0) {
22
+ parts.push(`${filter.documentId.length} doc(s)`);
23
+ }
24
+ if (filter.scope.length > 0) {
25
+ parts.push(`${filter.scope.length} scope(s)`);
26
+ }
27
+ return parts.length > 0 ? parts.join(", ") : "-";
28
+ }
29
+ function sortRemotes(remotes, sort) {
30
+ if (!sort)
31
+ return remotes;
32
+ return [...remotes].sort((a, b) => {
33
+ let aValue;
34
+ let bValue;
35
+ switch (sort.column) {
36
+ case "id":
37
+ aValue = a.id;
38
+ bValue = b.id;
39
+ break;
40
+ case "name":
41
+ aValue = a.name;
42
+ bValue = b.name;
43
+ break;
44
+ case "collectionId":
45
+ aValue = a.collectionId;
46
+ bValue = b.collectionId;
47
+ break;
48
+ case "filter":
49
+ aValue = formatFilter(a.filter);
50
+ bValue = formatFilter(b.filter);
51
+ break;
52
+ default:
53
+ return 0;
54
+ }
55
+ const comparison = aValue.localeCompare(bValue);
56
+ return sort.direction === "asc" ? comparison : -comparison;
57
+ });
58
+ }
59
+ export function RemotesInspector({ remotes, onRefresh, }) {
60
+ const [sort, setSort] = useState();
61
+ const [selectedRemote, setSelectedRemote] = useState();
62
+ const handleSort = (columnKey) => {
63
+ if (columnKey === "channel")
64
+ return;
65
+ const newDirection = sort?.column === columnKey && sort.direction === "asc" ? "desc" : "asc";
66
+ setSort({ column: columnKey, direction: newDirection });
67
+ };
68
+ const handleViewChannel = (remote) => {
69
+ setSelectedRemote(remote);
70
+ };
71
+ const handleBack = () => {
72
+ setSelectedRemote(undefined);
73
+ };
74
+ if (selectedRemote) {
75
+ return (_jsx(ChannelInspector, { channel: selectedRemote.channel, onBack: handleBack, onRefresh: onRefresh, remoteName: selectedRemote.name }));
76
+ }
77
+ const sortedRemotes = sortRemotes(remotes, sort);
78
+ return (_jsxs("div", { className: "flex h-full flex-col gap-2 p-4", children: [_jsxs("div", { className: "flex shrink-0 items-center justify-between", children: [_jsx("h2", { className: "text-lg font-semibold text-gray-900", children: "Remotes Inspector" }), onRefresh && (_jsxs("button", { className: "flex items-center gap-1 rounded border border-gray-300 bg-white px-3 py-1.5 text-sm text-gray-700 hover:bg-gray-100", onClick: onRefresh, type: "button", children: [_jsx(Icon, { name: "Reload", size: 14 }), "Refresh"] }))] }), _jsx("div", { className: "max-h-full overflow-auto rounded-lg border border-gray-300", children: _jsxs("table", { className: "w-full border-collapse", children: [_jsx("thead", { className: "sticky top-0 bg-gray-100", children: _jsx("tr", { children: COLUMNS.map((column, index) => {
79
+ const isActive = sort?.column === column.key;
80
+ const sortDirection = isActive ? sort.direction : "asc";
81
+ const isSortable = column.key !== "channel";
82
+ return (_jsx("th", { className: twMerge("group px-3 py-2 text-left text-xs font-medium text-gray-600", index > 0 && "border-l border-gray-300", isSortable &&
83
+ "cursor-pointer hover:bg-gray-200 hover:text-gray-900"), onClick: () => isSortable && handleSort(column.key), style: { width: column.width }, children: _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("span", { className: "truncate", children: column.label }), isSortable && (_jsx(SortIcon, { active: isActive, direction: sortDirection }))] }) }, column.key));
84
+ }) }) }), _jsx("tbody", { children: sortedRemotes.length === 0 ? (_jsx("tr", { children: _jsx("td", { className: "px-3 py-8 text-center text-sm text-gray-500", colSpan: COLUMNS.length, children: "No remotes configured" }) })) : (sortedRemotes.map((remote) => (_jsxs("tr", { className: "odd:bg-white even:bg-gray-50 hover:bg-blue-50", children: [_jsx("td", { className: "px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: remote.id, children: truncateId(remote.id) }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: remote.name, children: remote.name }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: remote.collectionId, children: remote.collectionId }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2 text-xs text-gray-900", children: _jsx("span", { className: "block truncate", title: formatFilter(remote.filter), children: formatFilter(remote.filter) }) }), _jsx("td", { className: "border-l border-gray-300 px-3 py-2", children: _jsxs("button", { className: "flex items-center gap-1 rounded bg-blue-50 px-2 py-1 text-xs text-blue-700 hover:bg-blue-100", onClick: () => handleViewChannel(remote), type: "button", children: ["View", _jsx(Icon, { name: "CaretRight", size: 12 })] }) })] }, remote.id)))) })] }) }), _jsxs("div", { className: "shrink-0 text-sm text-gray-600", children: ["Showing ", sortedRemotes.length, " remote(s)"] })] }));
85
+ }
86
+ //# sourceMappingURL=remotes-inspector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remotes-inspector.js","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/remotes-inspector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAe,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAIL,UAAU,GACX,MAAM,YAAY,CAAC;AAOpB,MAAM,OAAO,GAAgB;IAC3B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;IAC1C,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE;IAC9C,EAAE,GAAG,EAAE,cAA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ACtE,eACE,SAAS,EAAC,gBAAgB,EAC1B,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,YAEjC,YAAY,CAAC,MAAM,CAAC,MAAM,CAAC,GACvB,GACJ,EACL,aAAI,SAAS,EAAC,oCAAoC,YAChD,kBACE,SAAS,EAAC,8FAA8F,EACxG,OAAO,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,MAAM,CAAC,EACxC,IAAI,EAAC,QAAQ,qBAGb,KAAC,IAAI,IAAC,IAAI,EAAC,YAAY,EAAC,IAAI,EAAE,EAAE,GAAI,IAC7B,GACN,KAtCA,MAAM,CAAC,EAAE,CAuCX,CACN,CAAC,CACH,GACK,IACF,GACJ,EAEN,eAAK,SAAS,EAAC,gCAAgC,yBACpC,aAAa,CAAC,MAAM,kBACzB,IACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from "@storybook/react";
2
+ import { RemotesInspector } from "./remotes-inspector.js";
3
+ declare const meta: Meta<typeof RemotesInspector>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof RemotesInspector>;
6
+ export declare const Default: Story;
7
+ export declare const EmptyRemotes: Story;
8
+ export declare const SingleRemote: Story;
9
+ export declare const WithoutRefresh: Story;
10
+ export declare const ManyRemotes: Story;
11
+ //# sourceMappingURL=remotes-inspector.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remotes-inspector.stories.d.ts","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/remotes-inspector.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAQvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,gBAAgB,CAavC,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAiJ/C,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAI5B,CAAC;AA8CF,eAAO,MAAM,WAAW,EAAE,KAKzB,CAAC"}
@@ -0,0 +1,138 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { fn } from "@storybook/test";
3
+ import { SyncOperationStatus, } from "@powerhousedao/reactor";
4
+ import { RemotesInspector } from "./remotes-inspector.js";
5
+ const meta = {
6
+ title: "Connect/Components/RemotesInspector/RemotesInspector",
7
+ component: RemotesInspector,
8
+ parameters: {
9
+ layout: "fullscreen",
10
+ },
11
+ decorators: [
12
+ (Story) => (_jsx("div", { className: "h-[600px] w-full", children: _jsx(Story, {}) })),
13
+ ],
14
+ };
15
+ export default meta;
16
+ function createMockMailbox(items) {
17
+ return {
18
+ get items() {
19
+ return items;
20
+ },
21
+ };
22
+ }
23
+ function createMockSyncOperation(id, documentId, branch, status, opsCount, errorMessage) {
24
+ return {
25
+ id,
26
+ remoteName: "mock-remote",
27
+ documentId,
28
+ scopes: ["global"],
29
+ branch,
30
+ operations: Array(opsCount).fill({ type: "mock" }),
31
+ status,
32
+ error: errorMessage
33
+ ? { source: "channel", error: new Error(errorMessage) }
34
+ : undefined,
35
+ };
36
+ }
37
+ function createMockChannel(inboxOps, outboxOps, deadLetterOps) {
38
+ return {
39
+ inbox: createMockMailbox(inboxOps),
40
+ outbox: createMockMailbox(outboxOps),
41
+ deadLetter: createMockMailbox(deadLetterOps),
42
+ };
43
+ }
44
+ const mockRemotes = [
45
+ {
46
+ id: "abc-123-def-456",
47
+ name: "remote-main",
48
+ collectionId: "drive:main/documents",
49
+ filter: {
50
+ documentId: [],
51
+ scope: [],
52
+ branch: "main",
53
+ },
54
+ options: {},
55
+ channel: createMockChannel([
56
+ createMockSyncOperation("op-001", "doc-abc", "main", SyncOperationStatus.TransportPending, 5),
57
+ createMockSyncOperation("op-002", "doc-def", "main", SyncOperationStatus.ExecutionPending, 3),
58
+ createMockSyncOperation("op-003", "doc-ghi", "dev", SyncOperationStatus.Applied, 2),
59
+ ], [
60
+ createMockSyncOperation("op-101", "doc-xyz", "main", SyncOperationStatus.TransportPending, 7),
61
+ createMockSyncOperation("op-102", "doc-uvw", "feat", SyncOperationStatus.TransportPending, 1),
62
+ ], [
63
+ createMockSyncOperation("op-050", "doc-err", "main", SyncOperationStatus.Error, 4, "SIGNATURE_INVALID"),
64
+ ]),
65
+ },
66
+ {
67
+ id: "ghi-789-jkl-012",
68
+ name: "remote-dev",
69
+ collectionId: "drive:dev/experiments",
70
+ filter: {
71
+ documentId: ["doc-1", "doc-2"],
72
+ scope: ["scope-a"],
73
+ branch: "dev",
74
+ },
75
+ options: {},
76
+ channel: createMockChannel([
77
+ createMockSyncOperation("op-201", "doc-test", "dev", SyncOperationStatus.Applied, 10),
78
+ ], [], []),
79
+ },
80
+ {
81
+ id: "mno-345-pqr-678",
82
+ name: "remote-feature",
83
+ collectionId: "drive:feature/new-ui",
84
+ filter: {
85
+ documentId: [],
86
+ scope: ["ui", "components"],
87
+ branch: "feature/new-ui",
88
+ },
89
+ options: {},
90
+ channel: createMockChannel([], [], []),
91
+ },
92
+ ];
93
+ export const Default = {
94
+ args: {
95
+ remotes: mockRemotes,
96
+ onRefresh: fn(),
97
+ },
98
+ };
99
+ export const EmptyRemotes = {
100
+ args: {
101
+ remotes: [],
102
+ onRefresh: fn(),
103
+ },
104
+ };
105
+ export const SingleRemote = {
106
+ args: {
107
+ remotes: [mockRemotes[0]],
108
+ onRefresh: fn(),
109
+ },
110
+ };
111
+ export const WithoutRefresh = {
112
+ args: {
113
+ remotes: mockRemotes,
114
+ },
115
+ };
116
+ const manyRemotes = Array.from({ length: 20 }, (_, i) => ({
117
+ id: `remote-id-${i + 1}-${Math.random().toString(36).slice(2, 8)}`,
118
+ name: `remote-${i + 1}`,
119
+ collectionId: `drive:collection-${i + 1}/path`,
120
+ filter: {
121
+ documentId: i % 3 === 0 ? [`doc-${i}`] : [],
122
+ scope: i % 2 === 0 ? ["scope-a"] : [],
123
+ branch: i % 4 === 0 ? "main" : i % 4 === 1 ? "dev" : `feature-${i}`,
124
+ },
125
+ options: {},
126
+ channel: createMockChannel(Array.from({ length: i % 5 }, (_, j) => createMockSyncOperation(`op-${i}-${j}`, `doc-${i}-${j}`, "main", SyncOperationStatus.TransportPending, j + 1)), Array.from({ length: (i + 1) % 3 }, (_, j) => createMockSyncOperation(`op-out-${i}-${j}`, `doc-out-${i}-${j}`, "main", SyncOperationStatus.ExecutionPending, j + 2)), i % 7 === 0
127
+ ? [
128
+ createMockSyncOperation(`op-dead-${i}`, `doc-dead-${i}`, "main", SyncOperationStatus.Error, 1, "HASH_MISMATCH"),
129
+ ]
130
+ : []),
131
+ }));
132
+ export const ManyRemotes = {
133
+ args: {
134
+ remotes: manyRemotes,
135
+ onRefresh: fn(),
136
+ },
137
+ };
138
+ //# sourceMappingURL=remotes-inspector.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remotes-inspector.stories.js","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/remotes-inspector.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAIL,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,IAAI,GAAkC;IAC1C,KAAK,EAAE,sDAAsD;IAC7D,SAAS,EAAE,gBAAgB;IAC3B,UAAU,EAAE;QACV,MAAM,EAAE,YAAY;KACrB;IACD,UAAU,EAAE;QACV,CAAC,KAAK,EAAE,EAAE,CAAC,CACT,cAAK,SAAS,EAAC,kBAAkB,YAC/B,KAAC,KAAK,KAAG,GACL,CACP;KACF;CAC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CAAC,CAAC,CAAC,WAAW,CAAC,EAAE;KACpE;IACD,OAAO,EAAE,EAAE;IACX,OAAO,EAAE,iBAAiB,CACxB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACrC,uBAAuB,CACrB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,OAAO,CAAC,IAAI,CAAC,EAAE,EACf,MAAM,EACN,mBAAmB,CAAC,gBAAgB,EACpC,CAAC,GAAG,CAAC,CACN,CACF,EACD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAC3C,uBAAuB,CACrB,UAAU,CAAC,IAAI,CAAC,EAAE,EAClB,WAAW,CAAC,IAAI,CAAC,EAAE,EACnB,MAAM,EACN,mBAAmB,CAAC,gBAAgB,EACpC,CAAC,GAAG,CAAC,CACN,CACF,EACD,CAAC,GAAG,CAAC,KAAK,CAAC;QACT,CAAC,CAAC;YACE,uBAAuB,CACrB,WAAW,CAAC,EAAE,EACd,YAAY,CAAC,EAAE,EACf,MAAM,EACN,mBAAmB,CAAC,KAAK,EACzB,CAAC,EACD,eAAe,CAChB;SACF;QACH,CAAC,CAAC,EAAE,CACP;CACF,CAAC,CAAC,CAAC;AAEJ,MAAM,CAAC,MAAM,WAAW,GAAU;IAChC,IAAI,EAAE;QACJ,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,EAAE,EAAE;KAChB;CACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ export type SortDirection = "asc" | "desc";
2
+ export type SortOptions = {
3
+ readonly column: string;
4
+ readonly direction: SortDirection;
5
+ };
6
+ export type ColumnDef = {
7
+ readonly key: string;
8
+ readonly label: string;
9
+ readonly width?: string;
10
+ };
11
+ export declare function truncateId(id: string, maxLength?: number): string;
12
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/utils.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C,MAAM,MAAM,WAAW,GAAG;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,GAAE,MAAW,GAAG,MAAM,CAGrE"}
@@ -0,0 +1,6 @@
1
+ export function truncateId(id, maxLength = 12) {
2
+ if (id.length <= maxLength)
3
+ return id;
4
+ return id.slice(0, maxLength) + "...";
5
+ }
6
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../src/connect/components/remotes-inspector/utils.ts"],"names":[],"mappings":"AAaA,MAAM,UAAU,UAAU,CAAC,EAAU,EAAE,YAAoB,EAAE;IAC3D,IAAI,EAAE,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,EAAE,CAAC;IACtC,OAAO,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC;AACxC,CAAC"}