@powerhousedao/design-system 5.1.0-dev.2 → 5.1.0-dev.21
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/src/connect/components/db-explorer/components/index.d.ts +3 -0
- package/dist/src/connect/components/db-explorer/components/index.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/components/index.js +3 -0
- package/dist/src/connect/components/db-explorer/components/index.js.map +1 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.d.ts +15 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.js +47 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.js.map +1 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.d.ts +12 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.js +119 -0
- package/dist/src/connect/components/db-explorer/components/schema-tree-sidebar.stories.js.map +1 -0
- package/dist/src/connect/components/db-explorer/components/table-view.d.ts +26 -0
- package/dist/src/connect/components/db-explorer/components/table-view.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/components/table-view.js +67 -0
- package/dist/src/connect/components/db-explorer/components/table-view.js.map +1 -0
- package/dist/src/connect/components/db-explorer/components/table-view.stories.d.ts +14 -0
- package/dist/src/connect/components/db-explorer/components/table-view.stories.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/components/table-view.stories.js +203 -0
- package/dist/src/connect/components/db-explorer/components/table-view.stories.js.map +1 -0
- package/dist/src/connect/components/db-explorer/db-explorer.d.ts +32 -0
- package/dist/src/connect/components/db-explorer/db-explorer.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/db-explorer.js +119 -0
- package/dist/src/connect/components/db-explorer/db-explorer.js.map +1 -0
- package/dist/src/connect/components/db-explorer/db-explorer.stories.d.ts +11 -0
- package/dist/src/connect/components/db-explorer/db-explorer.stories.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/db-explorer.stories.js +182 -0
- package/dist/src/connect/components/db-explorer/db-explorer.stories.js.map +1 -0
- package/dist/src/connect/components/db-explorer/index.d.ts +2 -0
- package/dist/src/connect/components/db-explorer/index.d.ts.map +1 -0
- package/dist/src/connect/components/db-explorer/index.js +2 -0
- package/dist/src/connect/components/db-explorer/index.js.map +1 -0
- package/dist/src/connect/components/index.d.ts +2 -0
- package/dist/src/connect/components/index.d.ts.map +1 -1
- package/dist/src/connect/components/index.js +2 -0
- package/dist/src/connect/components/index.js.map +1 -1
- package/dist/src/connect/components/modal/index.d.ts +1 -0
- package/dist/src/connect/components/modal/index.d.ts.map +1 -1
- package/dist/src/connect/components/modal/index.js +1 -0
- package/dist/src/connect/components/modal/index.js.map +1 -1
- package/dist/src/connect/components/modal/inspector-modal/index.d.ts +2 -0
- package/dist/src/connect/components/modal/inspector-modal/index.d.ts.map +1 -0
- package/dist/src/connect/components/modal/inspector-modal/index.js +2 -0
- package/dist/src/connect/components/modal/inspector-modal/index.js.map +1 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.d.ts +18 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.d.ts.map +1 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.js +13 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.js.map +1 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.d.ts +10 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.d.ts.map +1 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.js +226 -0
- package/dist/src/connect/components/modal/inspector-modal/inspector-modal.stories.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.d.ts +9 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.js +38 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts +12 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js +113 -0
- package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/mailbox-table.d.ts +14 -0
- package/dist/src/connect/components/remotes-inspector/components/mailbox-table.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/mailbox-table.js +97 -0
- package/dist/src/connect/components/remotes-inspector/components/mailbox-table.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/sort-icon.d.ts +7 -0
- package/dist/src/connect/components/remotes-inspector/components/sort-icon.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/components/sort-icon.js +10 -0
- package/dist/src/connect/components/remotes-inspector/components/sort-icon.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/index.d.ts +3 -0
- package/dist/src/connect/components/remotes-inspector/index.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/index.js +3 -0
- package/dist/src/connect/components/remotes-inspector/index.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.d.ts +6 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.js +104 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.d.ts +10 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.js +128 -0
- package/dist/src/connect/components/remotes-inspector/remotes-inspector.stories.js.map +1 -0
- package/dist/src/connect/components/remotes-inspector/utils.d.ts +12 -0
- package/dist/src/connect/components/remotes-inspector/utils.d.ts.map +1 -0
- package/dist/src/connect/components/remotes-inspector/utils.js +6 -0
- package/dist/src/connect/components/remotes-inspector/utils.js.map +1 -0
- package/dist/src/connect/components/sidebar/sidebar-footer.d.ts +1 -0
- package/dist/src/connect/components/sidebar/sidebar-footer.d.ts.map +1 -1
- package/dist/src/connect/components/sidebar/sidebar-footer.js +2 -2
- package/dist/src/connect/components/sidebar/sidebar-footer.js.map +1 -1
- package/dist/src/connect/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/src/connect/components/sidebar/sidebar.js +2 -2
- package/dist/src/connect/components/sidebar/sidebar.js.map +1 -1
- package/dist/style.css +90 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
import { fn } from "@storybook/test";
|
|
2
|
+
import { SyncOperationStatus, } from "@powerhousedao/reactor";
|
|
3
|
+
import { InspectorModal } from "./inspector-modal.js";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: "Connect/Components/Modal/InspectorModal",
|
|
6
|
+
component: InspectorModal,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: "centered",
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
// DB Explorer mock data
|
|
13
|
+
const mockTables = [
|
|
14
|
+
{
|
|
15
|
+
name: "users",
|
|
16
|
+
columns: [
|
|
17
|
+
{ name: "id", dataType: "int4", isNullable: false },
|
|
18
|
+
{ name: "name", dataType: "varchar", isNullable: false },
|
|
19
|
+
{ name: "email", dataType: "varchar", isNullable: false },
|
|
20
|
+
{ name: "created_at", dataType: "timestamp", isNullable: true },
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "posts",
|
|
25
|
+
columns: [
|
|
26
|
+
{ name: "id", dataType: "int4", isNullable: false },
|
|
27
|
+
{ name: "title", dataType: "varchar", isNullable: false },
|
|
28
|
+
{ name: "content", dataType: "text", isNullable: true },
|
|
29
|
+
{ name: "author_id", dataType: "int4", isNullable: false },
|
|
30
|
+
],
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: "comments",
|
|
34
|
+
columns: [
|
|
35
|
+
{ name: "id", dataType: "int4", isNullable: false },
|
|
36
|
+
{ name: "post_id", dataType: "int4", isNullable: false },
|
|
37
|
+
{ name: "body", dataType: "text", isNullable: false },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
function generateMockRows(table, limit, offset) {
|
|
42
|
+
const rows = [];
|
|
43
|
+
for (let i = 0; i < limit; i++) {
|
|
44
|
+
const rowNum = offset + i + 1;
|
|
45
|
+
if (table === "users") {
|
|
46
|
+
rows.push({
|
|
47
|
+
id: rowNum,
|
|
48
|
+
name: `User ${rowNum}`,
|
|
49
|
+
email: `user${rowNum}@example.com`,
|
|
50
|
+
created_at: `2024-01-${String((rowNum % 28) + 1).padStart(2, "0")}`,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
else if (table === "posts") {
|
|
54
|
+
rows.push({
|
|
55
|
+
id: rowNum,
|
|
56
|
+
title: `Post Title ${rowNum}`,
|
|
57
|
+
content: `This is the content of post ${rowNum}...`,
|
|
58
|
+
author_id: (rowNum % 10) + 1,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
else if (table === "comments") {
|
|
62
|
+
rows.push({
|
|
63
|
+
id: rowNum,
|
|
64
|
+
post_id: (rowNum % 20) + 1,
|
|
65
|
+
body: `Comment ${rowNum}: This is a sample comment.`,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return rows;
|
|
70
|
+
}
|
|
71
|
+
const tableTotals = {
|
|
72
|
+
users: 234,
|
|
73
|
+
posts: 567,
|
|
74
|
+
comments: 1234,
|
|
75
|
+
};
|
|
76
|
+
const mockGetTableRows = async (table, options) => {
|
|
77
|
+
await new Promise((resolve) => setTimeout(resolve, 300));
|
|
78
|
+
const total = tableTotals[table] ?? 100;
|
|
79
|
+
const actualLimit = Math.min(options.limit, total - options.offset);
|
|
80
|
+
return {
|
|
81
|
+
columns: mockTables.find((t) => t.name === table)?.columns.map((c) => c.name) ??
|
|
82
|
+
[],
|
|
83
|
+
rows: generateMockRows(table, Math.max(0, actualLimit), options.offset),
|
|
84
|
+
total,
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
// Remotes Inspector mock data
|
|
88
|
+
function createMockMailbox(items) {
|
|
89
|
+
return {
|
|
90
|
+
get items() {
|
|
91
|
+
return items;
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function createMockSyncOperation(id, documentId, branch, status, opsCount, errorMessage) {
|
|
96
|
+
return {
|
|
97
|
+
id,
|
|
98
|
+
remoteName: "mock-remote",
|
|
99
|
+
documentId,
|
|
100
|
+
scopes: ["global"],
|
|
101
|
+
branch,
|
|
102
|
+
operations: Array(opsCount).fill({ type: "mock" }),
|
|
103
|
+
status,
|
|
104
|
+
error: errorMessage
|
|
105
|
+
? { source: "channel", error: new Error(errorMessage) }
|
|
106
|
+
: undefined,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function createMockChannel(inboxOps, outboxOps, deadLetterOps) {
|
|
110
|
+
return {
|
|
111
|
+
inbox: createMockMailbox(inboxOps),
|
|
112
|
+
outbox: createMockMailbox(outboxOps),
|
|
113
|
+
deadLetter: createMockMailbox(deadLetterOps),
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const mockRemotes = [
|
|
117
|
+
{
|
|
118
|
+
id: "abc-123-def-456",
|
|
119
|
+
name: "remote-main",
|
|
120
|
+
collectionId: "drive:main/documents",
|
|
121
|
+
filter: {
|
|
122
|
+
documentId: [],
|
|
123
|
+
scope: [],
|
|
124
|
+
branch: "main",
|
|
125
|
+
},
|
|
126
|
+
options: {},
|
|
127
|
+
channel: createMockChannel([
|
|
128
|
+
createMockSyncOperation("op-001", "doc-abc", "main", SyncOperationStatus.TransportPending, 5),
|
|
129
|
+
createMockSyncOperation("op-002", "doc-def", "main", SyncOperationStatus.Applied, 3),
|
|
130
|
+
], [
|
|
131
|
+
createMockSyncOperation("op-101", "doc-xyz", "main", SyncOperationStatus.TransportPending, 7),
|
|
132
|
+
], [
|
|
133
|
+
createMockSyncOperation("op-050", "doc-err", "main", SyncOperationStatus.Error, 4, "SIGNATURE_INVALID"),
|
|
134
|
+
]),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "ghi-789-jkl-012",
|
|
138
|
+
name: "remote-dev",
|
|
139
|
+
collectionId: "drive:dev/experiments",
|
|
140
|
+
filter: {
|
|
141
|
+
documentId: ["doc-1", "doc-2"],
|
|
142
|
+
scope: ["scope-a"],
|
|
143
|
+
branch: "dev",
|
|
144
|
+
},
|
|
145
|
+
options: {},
|
|
146
|
+
channel: createMockChannel([
|
|
147
|
+
createMockSyncOperation("op-201", "doc-test", "dev", SyncOperationStatus.Applied, 10),
|
|
148
|
+
], [], []),
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
id: "mno-345-pqr-678",
|
|
152
|
+
name: "remote-feature",
|
|
153
|
+
collectionId: "drive:feature/new-ui",
|
|
154
|
+
filter: {
|
|
155
|
+
documentId: [],
|
|
156
|
+
scope: ["ui", "components"],
|
|
157
|
+
branch: "feature/new-ui",
|
|
158
|
+
},
|
|
159
|
+
options: {},
|
|
160
|
+
channel: createMockChannel([], [], []),
|
|
161
|
+
},
|
|
162
|
+
];
|
|
163
|
+
// Stories
|
|
164
|
+
export const Default = {
|
|
165
|
+
args: {
|
|
166
|
+
open: true,
|
|
167
|
+
onOpenChange: fn(),
|
|
168
|
+
defaultTab: "Database",
|
|
169
|
+
dbExplorerProps: {
|
|
170
|
+
schema: "public",
|
|
171
|
+
getTables: () => Promise.resolve(mockTables),
|
|
172
|
+
getTableRows: mockGetTableRows,
|
|
173
|
+
},
|
|
174
|
+
remotesInspectorProps: {
|
|
175
|
+
getRemotes: () => Promise.resolve(mockRemotes),
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
export const DatabaseTab = {
|
|
180
|
+
args: {
|
|
181
|
+
open: true,
|
|
182
|
+
onOpenChange: fn(),
|
|
183
|
+
defaultTab: "Database",
|
|
184
|
+
dbExplorerProps: {
|
|
185
|
+
schema: "public",
|
|
186
|
+
getTables: () => Promise.resolve(mockTables),
|
|
187
|
+
getTableRows: mockGetTableRows,
|
|
188
|
+
onImportDb: (sql) => console.log("Import:", sql.slice(0, 50)),
|
|
189
|
+
onExportDb: () => console.log("Export clicked"),
|
|
190
|
+
},
|
|
191
|
+
remotesInspectorProps: {
|
|
192
|
+
getRemotes: () => Promise.resolve(mockRemotes),
|
|
193
|
+
},
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
export const RemotesTab = {
|
|
197
|
+
args: {
|
|
198
|
+
open: true,
|
|
199
|
+
onOpenChange: fn(),
|
|
200
|
+
defaultTab: "Remotes",
|
|
201
|
+
dbExplorerProps: {
|
|
202
|
+
schema: "public",
|
|
203
|
+
getTables: () => Promise.resolve(mockTables),
|
|
204
|
+
getTableRows: mockGetTableRows,
|
|
205
|
+
},
|
|
206
|
+
remotesInspectorProps: {
|
|
207
|
+
getRemotes: () => Promise.resolve(mockRemotes),
|
|
208
|
+
},
|
|
209
|
+
},
|
|
210
|
+
};
|
|
211
|
+
export const EmptyData = {
|
|
212
|
+
args: {
|
|
213
|
+
open: true,
|
|
214
|
+
onOpenChange: fn(),
|
|
215
|
+
defaultTab: "Database",
|
|
216
|
+
dbExplorerProps: {
|
|
217
|
+
schema: "public",
|
|
218
|
+
getTables: () => Promise.resolve([]),
|
|
219
|
+
getTableRows: mockGetTableRows,
|
|
220
|
+
},
|
|
221
|
+
remotesInspectorProps: {
|
|
222
|
+
getRemotes: () => Promise.resolve([]),
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
//# sourceMappingURL=inspector-modal.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspector-modal.stories.js","sourceRoot":"","sources":["../../../../../../src/connect/components/modal/inspector-modal/inspector-modal.stories.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAIL,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAMhC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,IAAI,GAAgC;IACxC,KAAK,EAAE,yCAAyC;IAChD,SAAS,EAAE,cAAc;IACzB,UAAU,EAAE;QACV,MAAM,EAAE,UAAU;KACnB;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB,wBAAwB;AACxB,MAAM,UAAU,GAAgB;IAC9B;QACE,IAAI,EAAE,OAAO;QACb,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE;YACnD,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE;YACxD,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE;YACzD,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE;SAChE;KACF;IACD;QACE,IAAI,EAAE,OAAO;QACb,OAAO,EAAE;YACP,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE;YACnD,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE;YACzD,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE;YACvD,EAAE,IAAI,EAAE,WAAW,EA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S,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;YACpC,YAAY,EAAE,gBAAgB;SAC/B;QACD,qBAAqB,EAAE;YACrB,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;SACtC;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IChannel } from "@powerhousedao/reactor";
|
|
2
|
+
export type ChannelInspectorProps = {
|
|
3
|
+
readonly remoteName: string;
|
|
4
|
+
readonly channel: IChannel;
|
|
5
|
+
readonly onBack: () => void;
|
|
6
|
+
readonly onRefresh?: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare function ChannelInspector({ remoteName, channel, onBack, onRefresh, }: ChannelInspectorProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=channel-inspector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-inspector.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/channel-inspector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAKvD,MAAM,MAAM,qBAAqB,GAAG;IAClC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC,CAAC;AAEF,wBAAgB,gBAAgB,CAAC,EAC/B,UAAU,EACV,OAAO,EACP,MAAM,EACN,SAAS,GACV,EAAE,qBAAqB,2CAkGvB"}
|
|
@@ -0,0 +1,38 @@
|
|
|
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 { MailboxTable } from "./mailbox-table.js";
|
|
6
|
+
import {} from "../utils.js";
|
|
7
|
+
export function ChannelInspector({ remoteName, channel, onBack, onRefresh, }) {
|
|
8
|
+
const [sorts, setSorts] = useState({
|
|
9
|
+
inbox: undefined,
|
|
10
|
+
outbox: undefined,
|
|
11
|
+
deadLetter: undefined,
|
|
12
|
+
});
|
|
13
|
+
const [collapsed, setCollapsed] = useState({
|
|
14
|
+
inbox: false,
|
|
15
|
+
outbox: false,
|
|
16
|
+
deadLetter: false,
|
|
17
|
+
});
|
|
18
|
+
const handleToggleCollapse = (mailbox) => {
|
|
19
|
+
setCollapsed((prev) => ({
|
|
20
|
+
...prev,
|
|
21
|
+
[mailbox]: !prev[mailbox],
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
const handleSort = (mailbox, columnKey) => {
|
|
25
|
+
setSorts((prev) => {
|
|
26
|
+
const currentSort = prev[mailbox];
|
|
27
|
+
const newDirection = currentSort?.column === columnKey && currentSort.direction === "asc"
|
|
28
|
+
? "desc"
|
|
29
|
+
: "asc";
|
|
30
|
+
return {
|
|
31
|
+
...prev,
|
|
32
|
+
[mailbox]: { column: columnKey, direction: newDirection },
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
return (_jsxs("div", { className: "flex h-full flex-col gap-4 p-4", children: [_jsxs("div", { className: "flex shrink-0 items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsxs("button", { className: "flex items-center gap-1 rounded border border-gray-300 bg-white px-2 py-1 text-sm text-gray-700 hover:bg-gray-100", onClick: onBack, type: "button", children: [_jsx(Icon, { className: "rotate-90", name: "ChevronDown", size: 14 }), "Back"] }), _jsxs("h2", { className: "text-lg font-semibold text-gray-900", children: ["Channel: ", remoteName] })] }), 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"] }))] }), _jsxs("div", { className: "flex flex-1 flex-col gap-6 overflow-auto", children: [_jsx(MailboxTable, { collapsed: collapsed.inbox, mailboxType: "inbox", onSort: handleSort, onToggleCollapse: () => handleToggleCollapse("inbox"), operations: channel.inbox.items, sort: sorts.inbox, title: "Inbox" }), _jsx(MailboxTable, { collapsed: collapsed.outbox, mailboxType: "outbox", onSort: handleSort, onToggleCollapse: () => handleToggleCollapse("outbox"), operations: channel.outbox.items, sort: sorts.outbox, title: "Outbox" }), _jsx(MailboxTable, { collapsed: collapsed.deadLetter, mailboxType: "deadLetter", onSort: handleSort, onToggleCollapse: () => handleToggleCollapse("deadLetter"), operations: channel.deadLetter.items, sort: sorts.deadLetter, title: "Dead Letter" })] })] }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=channel-inspector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-inspector.js","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/channel-inspector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjC,OAAO,EAAE,YAAY,EAAoB,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAwC,MAAM,aAAa,CAAC;AASnE,MAAM,UAAU,gBAAgB,CAAC,EAC/B,UAAU,EACV,OAAO,EACP,MAAM,EACN,SAAS,GACa;IACtB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAEhC;QACA,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,SAAS;KACtB,CAAC,CAAC;IAEH,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG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AClB,IAAI,EAAC,QAAQ,aAEb,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAE,EAAE,GAAI,eAEzB,CACV,IACG,EAEN,eAAK,SAAS,EAAC,0CAA0C,aACvD,KAAC,YAAY,IACX,SAAS,EAAE,SAAS,CAAC,KAAK,EAC1B,WAAW,EAAC,OAAO,EACnB,MAAM,EAAE,UAAU,EAClB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,EACrD,UAAU,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,EAC/B,IAAI,EAAE,KAAK,CAAC,KAAK,EACjB,KAAK,EAAC,OAAO,GACb,EAEF,KAAC,YAAY,IACX,SAAS,EAAE,SAAS,CAAC,MAAM,EAC3B,WAAW,EAAC,QAAQ,EACpB,MAAM,EAAE,UAAU,EAClB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EACtD,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,EAChC,IAAI,EAAE,KAAK,CAAC,MAAM,EAClB,KAAK,EAAC,QAAQ,GACd,EAEF,KAAC,YAAY,IACX,SAAS,EAAE,SAAS,CAAC,UAAU,EAC/B,WAAW,EAAC,YAAY,EACxB,MAAM,EAAE,UAAU,EAClB,gBAAgB,EAAE,GAAG,EAAE,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAC1D,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK,EACpC,IAAI,EAAE,KAAK,CAAC,UAAU,EACtB,KAAK,EAAC,aAAa,GACnB,IACE,IACF,CACP,CAAC;AACJ,CAAC"}
|
package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import { ChannelInspector } from "./channel-inspector.js";
|
|
3
|
+
declare const meta: Meta<typeof ChannelInspector>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof ChannelInspector>;
|
|
6
|
+
export declare const Default: Story;
|
|
7
|
+
export declare const EmptyChannel: Story;
|
|
8
|
+
export declare const OnlyInbox: Story;
|
|
9
|
+
export declare const OnlyDeadLetter: Story;
|
|
10
|
+
export declare const ManyOperations: Story;
|
|
11
|
+
export declare const WithoutRefresh: Story;
|
|
12
|
+
//# sourceMappingURL=channel-inspector.stories.d.ts.map
|
package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-inspector.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/channel-inspector.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAOvD,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;AAgG/C,eAAO,MAAM,OAAO,EAAE,KAOrB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAO1B,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,KA0BvB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAoC5B,CAAC;AAqCF,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAM5B,CAAC"}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { fn } from "@storybook/test";
|
|
3
|
+
import { SyncOperationStatus, } from "@powerhousedao/reactor";
|
|
4
|
+
import { ChannelInspector } from "./channel-inspector.js";
|
|
5
|
+
const meta = {
|
|
6
|
+
title: "Connect/Components/RemotesInspector/ChannelInspector",
|
|
7
|
+
component: ChannelInspector,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: "fullscreen",
|
|
10
|
+
},
|
|
11
|
+
decorators: [
|
|
12
|
+
(Story) => (_jsx("div", { className: "h-[700px] 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 fullChannel = createMockChannel([
|
|
45
|
+
createMockSyncOperation("inbox-op-001", "doc-abc-123", "main", SyncOperationStatus.TransportPending, 5),
|
|
46
|
+
createMockSyncOperation("inbox-op-002", "doc-def-456", "main", SyncOperationStatus.ExecutionPending, 3),
|
|
47
|
+
createMockSyncOperation("inbox-op-003", "doc-ghi-789", "dev", SyncOperationStatus.Applied, 2),
|
|
48
|
+
], [
|
|
49
|
+
createMockSyncOperation("outbox-op-101", "doc-xyz-111", "main", SyncOperationStatus.TransportPending, 7),
|
|
50
|
+
createMockSyncOperation("outbox-op-102", "doc-uvw-222", "feat", SyncOperationStatus.TransportPending, 1),
|
|
51
|
+
], [
|
|
52
|
+
createMockSyncOperation("dead-op-050", "doc-err-333", "main", SyncOperationStatus.Error, 4, "SIGNATURE_INVALID"),
|
|
53
|
+
]);
|
|
54
|
+
export const Default = {
|
|
55
|
+
args: {
|
|
56
|
+
remoteName: "remote-main",
|
|
57
|
+
channel: fullChannel,
|
|
58
|
+
onBack: fn(),
|
|
59
|
+
onRefresh: fn(),
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
export const EmptyChannel = {
|
|
63
|
+
args: {
|
|
64
|
+
remoteName: "remote-empty",
|
|
65
|
+
channel: createMockChannel([], [], []),
|
|
66
|
+
onBack: fn(),
|
|
67
|
+
onRefresh: fn(),
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export const OnlyInbox = {
|
|
71
|
+
args: {
|
|
72
|
+
remoteName: "remote-inbox",
|
|
73
|
+
channel: createMockChannel([
|
|
74
|
+
createMockSyncOperation("op-1", "doc-1", "main", SyncOperationStatus.TransportPending, 5),
|
|
75
|
+
createMockSyncOperation("op-2", "doc-2", "main", SyncOperationStatus.Applied, 3),
|
|
76
|
+
], [], []),
|
|
77
|
+
onBack: fn(),
|
|
78
|
+
onRefresh: fn(),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
export const OnlyDeadLetter = {
|
|
82
|
+
args: {
|
|
83
|
+
remoteName: "remote-errors",
|
|
84
|
+
channel: createMockChannel([], [], [
|
|
85
|
+
createMockSyncOperation("dead-1", "doc-fail-1", "main", SyncOperationStatus.Error, 2, "SIGNATURE_INVALID"),
|
|
86
|
+
createMockSyncOperation("dead-2", "doc-fail-2", "dev", SyncOperationStatus.Error, 1, "HASH_MISMATCH"),
|
|
87
|
+
createMockSyncOperation("dead-3", "doc-fail-3", "main", SyncOperationStatus.Error, 5, "MISSING_OPERATIONS"),
|
|
88
|
+
]),
|
|
89
|
+
onBack: fn(),
|
|
90
|
+
onRefresh: fn(),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
const manyOperations = createMockChannel(Array.from({ length: 15 }, (_, i) => createMockSyncOperation(`inbox-${i + 1}`, `doc-inbox-${i + 1}`, i % 3 === 0 ? "main" : i % 3 === 1 ? "dev" : "feature", i % 4 === 0
|
|
94
|
+
? SyncOperationStatus.TransportPending
|
|
95
|
+
: i % 4 === 1
|
|
96
|
+
? SyncOperationStatus.ExecutionPending
|
|
97
|
+
: SyncOperationStatus.Applied, (i % 10) + 1)), Array.from({ length: 10 }, (_, i) => createMockSyncOperation(`outbox-${i + 1}`, `doc-outbox-${i + 1}`, "main", SyncOperationStatus.TransportPending, (i % 5) + 1)), Array.from({ length: 5 }, (_, i) => createMockSyncOperation(`dead-${i + 1}`, `doc-dead-${i + 1}`, "main", SyncOperationStatus.Error, i + 1, i % 2 === 0 ? "SIGNATURE_INVALID" : "HASH_MISMATCH")));
|
|
98
|
+
export const ManyOperations = {
|
|
99
|
+
args: {
|
|
100
|
+
remoteName: "remote-busy",
|
|
101
|
+
channel: manyOperations,
|
|
102
|
+
onBack: fn(),
|
|
103
|
+
onRefresh: fn(),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
export const WithoutRefresh = {
|
|
107
|
+
args: {
|
|
108
|
+
remoteName: "remote-main",
|
|
109
|
+
channel: fullChannel,
|
|
110
|
+
onBack: fn(),
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
//# sourceMappingURL=channel-inspector.stories.js.map
|
package/dist/src/connect/components/remotes-inspector/components/channel-inspector.stories.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel-inspector.stories.js","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/channel-inspector.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EA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CAAC,mBAAmB,CAAC,gBAAgB;QACtC,CAAC,CAAC,mBAAmB,CAAC,OAAO,EACjC,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CACb,CACF,EACD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAClC,uBAAuB,CACrB,UAAU,CAAC,GAAG,CAAC,EAAE,EACjB,cAAc,CAAC,GAAG,CAAC,EAAE,EACrB,MAAM,EACN,mBAAmB,CAAC,gBAAgB,EACpC,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CACZ,CACF,EACD,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACjC,uBAAuB,CACrB,QAAQ,CAAC,GAAG,CAAC,EAAE,EACf,YAAY,CAAC,GAAG,CAAC,EAAE,EACnB,MAAM,EACN,mBAAmB,CAAC,KAAK,EACzB,CAAC,GAAG,CAAC,EACL,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe,CACpD,CACF,CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE;QACJ,UAAU,EAAE,aAAa;QACzB,OAAO,EAAE,cAAc;QACvB,MAAM,EAAE,EAAE,EAAE;QACZ,SAAS,EAAE,EAAE,EAAE;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAU;IACnC,IAAI,EAAE;QACJ,UAAU,EAAE,aAAa;QACzB,OAAO,EAAE,WAAW;QACpB,MAAM,EAAE,EAAE,EAAE;KACb;CACF,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type SyncOperation } from "@powerhousedao/reactor";
|
|
2
|
+
import { type SortOptions } from "../utils.js";
|
|
3
|
+
export type MailboxType = "inbox" | "outbox" | "deadLetter";
|
|
4
|
+
export type MailboxTableProps = {
|
|
5
|
+
readonly title: string;
|
|
6
|
+
readonly mailboxType: MailboxType;
|
|
7
|
+
readonly operations: readonly SyncOperation[];
|
|
8
|
+
readonly sort: SortOptions | undefined;
|
|
9
|
+
readonly onSort: (mailbox: MailboxType, column: string) => void;
|
|
10
|
+
readonly collapsed: boolean;
|
|
11
|
+
readonly onToggleCollapse: () => void;
|
|
12
|
+
};
|
|
13
|
+
export declare function MailboxTable({ title, mailboxType, operations, sort, onSort, collapsed, onToggleCollapse, }: MailboxTableProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
//# sourceMappingURL=mailbox-table.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mailbox-table.d.ts","sourceRoot":"","sources":["../../../../../../src/connect/components/remotes-inspector/components/mailbox-table.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAkB,KAAK,WAAW,EAAc,MAAM,aAAa,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,GAAG,YAAY,CAAC;AA4F5D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,SAAS,aAAa,EAAE,CAAC;IAC9C,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,IAAI,CAAC;CACvC,CAAC;AAEF,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,WAAW,EACX,UAAU,EACV,IAAI,EACJ,MAAM,EACN,SAAS,EACT,gBAAgB,GACjB,EAAE,iBAAiB,2CAiHnB"}
|
|
@@ -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,EAEL,mBAAmB,GACpB,MAAM,wBAAwB,CAAC;AAChC,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,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;IAClD,EAAE,GAAG,EA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AAM,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 @@
|
|
|
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 @@
|
|
|
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,6 @@
|
|
|
1
|
+
import { type Remote } from "@powerhousedao/reactor";
|
|
2
|
+
export type RemotesInspectorProps = {
|
|
3
|
+
readonly getRemotes: () => Promise<Remote[]>;
|
|
4
|
+
};
|
|
5
|
+
export declare function RemotesInspector({ getRemotes }: RemotesInspectorProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# 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,UAAU,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;CAC9C,CAAC;AAgEF,wBAAgB,gBAAgB,CAAC,EAAE,UAAU,EAAE,EAAE,qBAAqB,2CAiLrE"}
|