synapse-react-client 4.0.6 → 4.0.7
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/SWC.index.js +1 -1
- package/dist/components/CardDeck/TableQueryCardDeck.js +3 -4
- package/dist/components/CardDeck/TableQueryCardDeck.js.map +1 -1
- package/dist/components/ChangePassword/useChangePasswordFormState.js +2 -3
- package/dist/components/ChangePassword/useChangePasswordFormState.js.map +1 -1
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.css +1 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.d.ts +8 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.d.ts.map +1 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.js +21 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.js.map +1 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.module.scss +32 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.module.scss.js +14 -0
- package/dist/components/ColoredBulletListItem/ColoredBulletListItem.module.scss.js.map +1 -0
- package/dist/components/ColoredBulletListItem/index.d.ts +5 -0
- package/dist/components/ColoredBulletListItem/index.d.ts.map +1 -0
- package/dist/components/ColoredBulletListItem/index.js +6 -0
- package/dist/components/ColoredBulletListItem/index.js.map +1 -0
- package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.js +3 -4
- package/dist/components/CreateOrUpdateAccessRequirementWizard/CreateOrUpdateAccessRequirementWizard.js.map +1 -1
- package/dist/components/CreateProjectModal/CreateProjectModal.d.ts.map +1 -1
- package/dist/components/CreateProjectModal/CreateProjectModal.js +120 -46
- package/dist/components/CreateProjectModal/CreateProjectModal.js.map +1 -1
- package/dist/components/CreateProjectModal/ProjectVisibilityRadioGroup.d.ts +7 -0
- package/dist/components/CreateProjectModal/ProjectVisibilityRadioGroup.d.ts.map +1 -0
- package/dist/components/CreateProjectModal/ProjectVisibilityRadioGroup.js +132 -0
- package/dist/components/CreateProjectModal/ProjectVisibilityRadioGroup.js.map +1 -0
- package/dist/components/DataGrid/DataGrid.d.ts +2 -0
- package/dist/components/DataGrid/DataGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/DataGrid.js +69 -67
- package/dist/components/DataGrid/DataGrid.js.map +1 -1
- package/dist/components/DataGrid/MergeGridWithSourceTableButton.js +2 -3
- package/dist/components/DataGrid/MergeGridWithSourceTableButton.js.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.d.ts.map +1 -1
- package/dist/components/DataGrid/SynapseGrid.js +117 -111
- package/dist/components/DataGrid/SynapseGrid.js.map +1 -1
- package/dist/components/DataGrid/components/UploadCsvToGridDialog.js +2 -3
- package/dist/components/DataGrid/components/UploadCsvToGridDialog.js.map +1 -1
- package/dist/components/DataGrid/hooks/useRemoteSelections.d.ts +16 -0
- package/dist/components/DataGrid/hooks/useRemoteSelections.d.ts.map +1 -0
- package/dist/components/DataGrid/hooks/useRemoteSelections.js +30 -0
- package/dist/components/DataGrid/hooks/useRemoteSelections.js.map +1 -0
- package/dist/components/DataGrid/utils/getCellClassName.d.ts +3 -0
- package/dist/components/DataGrid/utils/getCellClassName.d.ts.map +1 -1
- package/dist/components/DataGrid/utils/getCellClassName.js +21 -12
- package/dist/components/DataGrid/utils/getCellClassName.js.map +1 -1
- package/dist/components/DataGrid/utils/replicaSelectionToGridSelection.d.ts +15 -0
- package/dist/components/DataGrid/utils/replicaSelectionToGridSelection.d.ts.map +1 -0
- package/dist/components/DataGrid/utils/replicaSelectionToGridSelection.js +43 -0
- package/dist/components/DataGrid/utils/replicaSelectionToGridSelection.js.map +1 -0
- package/dist/components/DialogBase.d.ts +3 -1
- package/dist/components/DialogBase.d.ts.map +1 -1
- package/dist/components/DialogBase.js +75 -56
- package/dist/components/DialogBase.js.map +1 -1
- package/dist/components/Ecosystem/EcosystemSkeleton.js +2 -3
- package/dist/components/Ecosystem/EcosystemSkeleton.js.map +1 -1
- package/dist/components/FeaturedDataTabs/FacetPlotsCard.js +2 -3
- package/dist/components/FeaturedDataTabs/FacetPlotsCard.js.map +1 -1
- package/dist/components/FeaturedDataTabs/FeaturedDataTabs.js +2 -3
- package/dist/components/FeaturedDataTabs/FeaturedDataTabs.js.map +1 -1
- package/dist/components/GenericCard/GenericCard.js +3 -4
- package/dist/components/GenericCard/GenericCard.js.map +1 -1
- package/dist/components/HeaderCard.js +2 -3
- package/dist/components/HeaderCard.js.map +1 -1
- package/dist/components/IconSvg/IconSvg.d.ts +1 -1
- package/dist/components/IconSvg/IconSvg.d.ts.map +1 -1
- package/dist/components/IconSvg/IconSvg.js +168 -165
- package/dist/components/IconSvg/IconSvg.js.map +1 -1
- package/dist/components/StorybookComponentWrapper.js +3 -4
- package/dist/components/StorybookComponentWrapper.js.map +1 -1
- package/dist/components/SynapseForm/SynapseFormSubmissionGrid.d.ts +1 -0
- package/dist/components/SynapseForm/SynapseFormSubmissionGrid.d.ts.map +1 -1
- package/dist/components/SynapseForm/SynapseFormSubmissionGrid.js +23 -16
- package/dist/components/SynapseForm/SynapseFormSubmissionGrid.js.map +1 -1
- package/dist/components/TextField/TextField.css +1 -1
- package/dist/components/TextField/TextField.d.ts +1 -0
- package/dist/components/TextField/TextField.d.ts.map +1 -1
- package/dist/components/TextField/TextField.js +32 -20
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TextField/TextField.module.scss +7 -0
- package/dist/components/TextField/TextField.module.scss.js +5 -3
- package/dist/components/TextField/TextField.module.scss.js.map +1 -1
- package/dist/components/download_list/AddToDownloadListConfirmationAlert/AddToDownloadListConfirmationAlert.js +2 -3
- package/dist/components/download_list/AddToDownloadListConfirmationAlert/AddToDownloadListConfirmationAlert.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +242 -240
- package/dist/components/index.js.map +1 -1
- package/dist/components/styled/StyledFormControl.js +1 -1
- package/dist/components/styled/StyledFormControl.js.map +1 -1
- package/dist/components/table/CsvPreview/CsvPreview.js +2 -3
- package/dist/components/table/CsvPreview/CsvPreview.js.map +1 -1
- package/dist/components/table/CsvPreview/CsvPreviewDialog.js +2 -3
- package/dist/components/table/CsvPreview/CsvPreviewDialog.js.map +1 -1
- package/dist/features/curator/GridPage/GridPage.js +2 -3
- package/dist/features/curator/GridPage/GridPage.js.map +1 -1
- package/dist/features/curator/GridPage/components/GridPageTitle.js +2 -3
- package/dist/features/curator/GridPage/components/GridPageTitle.js.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.d.ts.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.js +49 -180
- package/dist/features/entity/metadata-task/components/MetadataTaskTableActionCell.js.map +1 -1
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js +2 -3
- package/dist/features/entity/metadata-task/components/MetadataTasksTableAssigneeCell.js.map +1 -1
- package/dist/index.js +306 -304
- package/dist/index.js.map +1 -1
- package/dist/style/components/_data-grid-extra.css +1 -1
- package/dist/style/components/_data-grid-extra.scss +16 -0
- package/dist/synapse-client/SynapseClient.d.ts +1 -1
- package/dist/synapse-client/SynapseClient.d.ts.map +1 -1
- package/dist/synapse-client/SynapseClient.js +3 -2
- package/dist/synapse-client/SynapseClient.js.map +1 -1
- package/dist/theme/palette/Palettes.d.ts +2 -0
- package/dist/theme/palette/Palettes.d.ts.map +1 -1
- package/dist/theme/palette/Palettes.js +46 -40
- package/dist/theme/palette/Palettes.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/assets/ArcusBioIcon.svg +0 -1
- package/dist/assets/ArcusBioIcon.svg.js +0 -7
- package/dist/assets/ArcusBioIcon.svg.js.map +0 -1
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { jsx as t, jsxs as n, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import { jsx as t, jsxs as n, Fragment as w } from "react/jsx-runtime";
|
|
2
|
+
import nt from "./components/GridMenuButton/GridMenuButton.js";
|
|
3
|
+
import mt from "./components/UploadCsvToGridButton.js";
|
|
4
4
|
import pt from "./components/ExportCsvFromGridButton.js";
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
5
|
+
import st from "./hooks/useGetSchemaForGrid.js";
|
|
6
|
+
import ct from "./MergeGridWithSourceTableButton.js";
|
|
7
|
+
import lt from "./utils/computeReplicaSelectionModel.js";
|
|
8
|
+
import dt from "./utils/modelRowsToGrid.js";
|
|
9
9
|
import "../../assets/icons/error_page/maintenance.svg.js";
|
|
10
10
|
import "../../assets/icons/error_page/no-access.svg.js";
|
|
11
11
|
import "../../assets/icons/error_page/unavailable.svg.js";
|
|
12
12
|
import "../../utils/PermissionLevelToAccessType.js";
|
|
13
13
|
import "../../utils/SynapseConstants.js";
|
|
14
|
-
import { forwardRef as
|
|
14
|
+
import { forwardRef as at, useState as S, useRef as I, useCallback as d, useImperativeHandle as ut, useEffect as R, useMemo as P } from "react";
|
|
15
15
|
import "../../synapse-client/SynapseClient.js";
|
|
16
16
|
import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode";
|
|
17
17
|
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
|
|
@@ -27,11 +27,11 @@ import "@tanstack/query-core";
|
|
|
27
27
|
import "lodash-es/isEmpty";
|
|
28
28
|
import "lodash-es/isEqual";
|
|
29
29
|
import "lodash-es/xorWith";
|
|
30
|
-
import { Tooltip as
|
|
30
|
+
import { Tooltip as ht, Stack as ft } from "@mui/material";
|
|
31
31
|
import "@sage-bionetworks/synapse-client";
|
|
32
|
-
import { useGetEntity as
|
|
32
|
+
import { useGetEntity as gt } from "../../synapse-queries/entity/useEntity.js";
|
|
33
33
|
import "../../utils/types/IsType.js";
|
|
34
|
-
import { useGetCurrentUserBundle as
|
|
34
|
+
import { useGetCurrentUserBundle as St } from "../../synapse-queries/user/useUserBundle.js";
|
|
35
35
|
import "../../utils/hooks/useCookiePreferences.js";
|
|
36
36
|
import "../../utils/hooks/useSourceAppConfigs.js";
|
|
37
37
|
import "universal-cookie";
|
|
@@ -58,7 +58,6 @@ import "../../assets/icons/account-validated.svg.js";
|
|
|
58
58
|
import "../../utils/functions/DateFormatter.js";
|
|
59
59
|
import "@react-hookz/web";
|
|
60
60
|
import "dayjs";
|
|
61
|
-
import "../../assets/ArcusBioIcon.svg.js";
|
|
62
61
|
import "@mui/material/SvgIcon";
|
|
63
62
|
import "../../assets/icons/AccessPending.svg.js";
|
|
64
63
|
import "../../assets/icons/AccessPendingCloud.svg.js";
|
|
@@ -115,7 +114,7 @@ import "../QueryContext/QueryContext.js";
|
|
|
115
114
|
import "../QueryVisualizationWrapper/QueryVisualizationContext.js";
|
|
116
115
|
import "react-share";
|
|
117
116
|
import "../GenericCard/GenericCard.js";
|
|
118
|
-
import { SkeletonTable as
|
|
117
|
+
import { SkeletonTable as Ct } from "../Skeleton/SkeletonTable.js";
|
|
119
118
|
import "@mui/system";
|
|
120
119
|
import "../GenericCard/Linkify.js";
|
|
121
120
|
import "jotai";
|
|
@@ -223,110 +222,116 @@ import s from "@mui/material/Grid";
|
|
|
223
222
|
import "@mui/icons-material/ArrowForwardIos";
|
|
224
223
|
import "../PortalAclEditor/PortalAclEditor.js";
|
|
225
224
|
import "../SynapseHomepageV2/HomepageStyles.js";
|
|
226
|
-
import { getSchemaPropertiesInfo as
|
|
227
|
-
import { ClickableJsonCrdt as
|
|
228
|
-
import { GridAgentChat as
|
|
229
|
-
import
|
|
230
|
-
import { useGridUndoRedo as
|
|
231
|
-
import { StartGridSession as
|
|
232
|
-
import { useDataGridWebSocket as
|
|
233
|
-
import { applyModelChange as
|
|
234
|
-
import { removeNoOpOperations as
|
|
235
|
-
import { mapOperationsToModelChanges as
|
|
236
|
-
import { useListGridReplicas as
|
|
237
|
-
import
|
|
238
|
-
import
|
|
239
|
-
|
|
225
|
+
import { getSchemaPropertiesInfo as yt } from "../../utils/jsonschema/getSchemaPropertyInfo.js";
|
|
226
|
+
import { ClickableJsonCrdt as Rt } from "clickable-json";
|
|
227
|
+
import { GridAgentChat as Et } from "../SynapseChat/GridAgentChat.js";
|
|
228
|
+
import xt from "./DataGrid.js";
|
|
229
|
+
import { useGridUndoRedo as Gt } from "./hooks/useGridUndoRedo.js";
|
|
230
|
+
import { StartGridSession as vt } from "./StartGridSession.js";
|
|
231
|
+
import { useDataGridWebSocket as bt } from "./useDataGridWebsocket.js";
|
|
232
|
+
import { applyModelChange as Tt } from "./utils/applyModelChange.js";
|
|
233
|
+
import { removeNoOpOperations as wt } from "./utils/DataGridUtils.js";
|
|
234
|
+
import { mapOperationsToModelChanges as Nt } from "./utils/mapOperationsToModelChanges.js";
|
|
235
|
+
import { useListGridReplicas as kt } from "../../synapse-queries/grid/useGridSession.js";
|
|
236
|
+
import { useRemoteSelections as Ot } from "./hooks/useRemoteSelections.js";
|
|
237
|
+
import zt from "../AccessRequirementList/RequirementItem/CertificationRequirement.js";
|
|
238
|
+
import { ValidationAlert as Mt } from "./components/ValidationAlert.js";
|
|
239
|
+
const en = at(
|
|
240
240
|
({ agentRegistrationId: A, showDebugInfo: E = !1 }, j) => {
|
|
241
|
-
const [o, F] =
|
|
241
|
+
const [o, F] = S(null), [m, J] = S(null), [W, N] = S(!1), [H, k] = S(
|
|
242
242
|
null
|
|
243
|
-
),
|
|
243
|
+
), h = I(null), f = I(null), { data: V, isLoading: _ } = St(), { data: x = [], refetch: O } = kt(o?.sessionId), G = d(() => {
|
|
244
244
|
O();
|
|
245
245
|
}, [O]);
|
|
246
|
-
|
|
246
|
+
ut(
|
|
247
247
|
j,
|
|
248
248
|
() => ({
|
|
249
249
|
initializeGrid: (i) => {
|
|
250
|
-
|
|
250
|
+
h.current && h.current.handleStartSession(i);
|
|
251
251
|
},
|
|
252
252
|
loadExistingSession: (i) => {
|
|
253
|
-
|
|
253
|
+
h.current && h.current.handleLoadSession(i);
|
|
254
254
|
}
|
|
255
255
|
}),
|
|
256
256
|
[]
|
|
257
257
|
);
|
|
258
258
|
const {
|
|
259
|
-
isConnected:
|
|
259
|
+
isConnected: p,
|
|
260
260
|
websocketInstance: z,
|
|
261
261
|
hasCompletedInitialSync: $,
|
|
262
262
|
model: e,
|
|
263
|
-
modelSnapshot:
|
|
263
|
+
modelSnapshot: a,
|
|
264
264
|
connect: M,
|
|
265
265
|
presignedUrl: c,
|
|
266
266
|
hasSufficientData: U
|
|
267
|
-
} =
|
|
268
|
-
onGridReady:
|
|
269
|
-
onReplicaConnected:
|
|
270
|
-
onReplicaDisconnected:
|
|
271
|
-
}), C =
|
|
267
|
+
} = bt({
|
|
268
|
+
onGridReady: G,
|
|
269
|
+
onReplicaConnected: G,
|
|
270
|
+
onReplicaDisconnected: G
|
|
271
|
+
}), C = I(null);
|
|
272
272
|
R(() => {
|
|
273
273
|
C.current = z;
|
|
274
274
|
}, [z]);
|
|
275
|
-
const
|
|
275
|
+
const v = I(null);
|
|
276
276
|
R(() => {
|
|
277
|
-
if (
|
|
278
|
-
|
|
277
|
+
if (m == null || !o?.sessionId) {
|
|
278
|
+
v.current = null;
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
281
|
const i = {
|
|
282
|
-
replicaId:
|
|
282
|
+
replicaId: m,
|
|
283
283
|
sessionId: o.sessionId
|
|
284
|
-
}, r =
|
|
285
|
-
r && r.replicaId === i.replicaId && r.sessionId === i.sessionId || (
|
|
286
|
-
}, [
|
|
287
|
-
e === null && (
|
|
284
|
+
}, r = v.current;
|
|
285
|
+
r && r.replicaId === i.replicaId && r.sessionId === i.sessionId || (v.current = i, M(m, o.sessionId));
|
|
286
|
+
}, [m, o?.sessionId, M]), R(() => {
|
|
287
|
+
e === null && (k(null), f.current && f.current.setActiveCell(null));
|
|
288
288
|
}, [e]);
|
|
289
|
-
const
|
|
289
|
+
const b = st(o), { data: q } = gt(
|
|
290
290
|
o?.sourceEntityId,
|
|
291
291
|
void 0,
|
|
292
292
|
{
|
|
293
293
|
enabled: !!o?.sourceEntityId
|
|
294
294
|
}
|
|
295
|
-
), Y = q?.concreteType === "org.sagebionetworks.repo.model.table.EntityView",
|
|
296
|
-
|
|
297
|
-
|
|
295
|
+
), Y = q?.concreteType === "org.sagebionetworks.repo.model.table.EntityView", T = P(() => yt(b ?? null), [b]), K = p ? "Connected" : "Disconnected", Q = Ot(
|
|
296
|
+
a,
|
|
297
|
+
e,
|
|
298
|
+
x,
|
|
299
|
+
m
|
|
300
|
+
), g = P(
|
|
301
|
+
() => a ? dt(e, a) : [],
|
|
302
|
+
[e, a]
|
|
298
303
|
), y = d(() => {
|
|
299
|
-
!
|
|
300
|
-
}, [
|
|
304
|
+
!p || !C.current || C.current.sendPatch();
|
|
305
|
+
}, [p, C]);
|
|
301
306
|
R(() => {
|
|
302
|
-
|
|
303
|
-
}, [
|
|
304
|
-
const
|
|
307
|
+
p && y();
|
|
308
|
+
}, [p, y]);
|
|
309
|
+
const u = d(
|
|
305
310
|
(i, r) => {
|
|
306
311
|
r.forEach((l) => {
|
|
307
|
-
|
|
312
|
+
Tt(i, l, T);
|
|
308
313
|
}), y();
|
|
309
314
|
},
|
|
310
|
-
[y,
|
|
311
|
-
),
|
|
315
|
+
[y, T]
|
|
316
|
+
), X = d(
|
|
312
317
|
(i) => {
|
|
313
318
|
if (!e) {
|
|
314
319
|
console.error("Model is not initialized");
|
|
315
320
|
return;
|
|
316
321
|
}
|
|
317
|
-
i.type === "DELETE" &&
|
|
322
|
+
i.type === "DELETE" && f.current && f.current.setActiveCell(null), u(e, [i]);
|
|
318
323
|
},
|
|
319
|
-
[e,
|
|
320
|
-
), { undoUI:
|
|
324
|
+
[e, u]
|
|
325
|
+
), { undoUI: Z, redoUI: tt, addOperationsToUndoStack: D, clearRedoStack: L } = Gt(X), ot = d(
|
|
321
326
|
(i, r) => {
|
|
322
327
|
if (!e) {
|
|
323
328
|
console.error("Model is not initialized");
|
|
324
329
|
return;
|
|
325
330
|
}
|
|
326
|
-
if (r =
|
|
331
|
+
if (r = wt(i, g, r), r.length > 0) {
|
|
327
332
|
L(), D(r, g, i);
|
|
328
|
-
const l =
|
|
329
|
-
|
|
333
|
+
const l = Nt(r, i);
|
|
334
|
+
u(e, l);
|
|
330
335
|
}
|
|
331
336
|
},
|
|
332
337
|
[
|
|
@@ -334,37 +339,37 @@ const on = dt(
|
|
|
334
339
|
g,
|
|
335
340
|
L,
|
|
336
341
|
D,
|
|
337
|
-
|
|
342
|
+
u
|
|
338
343
|
]
|
|
339
|
-
),
|
|
344
|
+
), it = d(
|
|
340
345
|
(i) => {
|
|
341
346
|
const { selection: r } = i;
|
|
342
|
-
if (r != null && (
|
|
343
|
-
const l =
|
|
347
|
+
if (r != null && (k(r), e != null && m != null)) {
|
|
348
|
+
const l = lt(
|
|
344
349
|
r,
|
|
345
350
|
e
|
|
346
351
|
);
|
|
347
|
-
|
|
352
|
+
u(e, [
|
|
348
353
|
{
|
|
349
354
|
type: "SET_SELECTION",
|
|
350
|
-
replicaId:
|
|
355
|
+
replicaId: m.toString(),
|
|
351
356
|
selection: l
|
|
352
357
|
}
|
|
353
358
|
]);
|
|
354
359
|
}
|
|
355
360
|
},
|
|
356
|
-
[
|
|
357
|
-
), B =
|
|
361
|
+
[u, e, m]
|
|
362
|
+
), B = I(null), [, rt] = S({}), et = d(
|
|
358
363
|
(i, r) => {
|
|
359
|
-
i !== null && (B.current = i,
|
|
364
|
+
i !== null && (B.current = i, rt({}));
|
|
360
365
|
},
|
|
361
366
|
[]
|
|
362
367
|
);
|
|
363
|
-
return !_ && !V?.isCertified ? /* @__PURE__ */ t(
|
|
368
|
+
return !_ && !V?.isCertified ? /* @__PURE__ */ t(zt, {}) : /* @__PURE__ */ t("div", { children: /* @__PURE__ */ n(s, { container: !0, spacing: 2, children: [
|
|
364
369
|
/* @__PURE__ */ t(s, { size: { xs: 12, xl: 8 }, children: /* @__PURE__ */ t(
|
|
365
|
-
|
|
370
|
+
vt,
|
|
366
371
|
{
|
|
367
|
-
ref:
|
|
372
|
+
ref: h,
|
|
368
373
|
onSessionChange: F,
|
|
369
374
|
onReplicaChange: J,
|
|
370
375
|
show: E
|
|
@@ -377,7 +382,7 @@ const on = dt(
|
|
|
377
382
|
] }),
|
|
378
383
|
/* @__PURE__ */ n("p", { children: [
|
|
379
384
|
"Replica ID: ",
|
|
380
|
-
|
|
385
|
+
m || "No replica created"
|
|
381
386
|
] }),
|
|
382
387
|
/* @__PURE__ */ n("p", { children: [
|
|
383
388
|
"Source Entity ID:",
|
|
@@ -397,22 +402,22 @@ const on = dt(
|
|
|
397
402
|
/* @__PURE__ */ n("p", { children: [
|
|
398
403
|
"WebSocket Status:",
|
|
399
404
|
" ",
|
|
400
|
-
/* @__PURE__ */ t("span", { style: { color:
|
|
405
|
+
/* @__PURE__ */ t("span", { style: { color: p ? "green" : "red" }, children: K })
|
|
401
406
|
] }),
|
|
402
407
|
/* @__PURE__ */ t("p", { children: (() => {
|
|
403
|
-
const i =
|
|
408
|
+
const i = x.filter(
|
|
404
409
|
(r) => r.isConnected
|
|
405
410
|
);
|
|
406
|
-
return /* @__PURE__ */ n(
|
|
411
|
+
return /* @__PURE__ */ n(w, { children: [
|
|
407
412
|
"Connected Replicas (",
|
|
408
413
|
i.length,
|
|
409
414
|
" /",
|
|
410
415
|
" ",
|
|
411
|
-
|
|
416
|
+
x.length,
|
|
412
417
|
" total):",
|
|
413
418
|
" ",
|
|
414
419
|
i.length === 0 ? "none" : i.map((r, l) => /* @__PURE__ */ t(
|
|
415
|
-
|
|
420
|
+
ht,
|
|
416
421
|
{
|
|
417
422
|
title: /* @__PURE__ */ t("pre", { style: { margin: 0, fontSize: "11px" }, children: JSON.stringify(r, null, 2) }),
|
|
418
423
|
children: /* @__PURE__ */ n(
|
|
@@ -434,50 +439,50 @@ const on = dt(
|
|
|
434
439
|
] });
|
|
435
440
|
})() })
|
|
436
441
|
] }) }),
|
|
437
|
-
o && /* @__PURE__ */ n(
|
|
442
|
+
o && /* @__PURE__ */ n(w, { children: [
|
|
438
443
|
!U && /* @__PURE__ */ n(s, { size: 12, children: [
|
|
439
444
|
/* @__PURE__ */ t("h3", { children: "Setting up grid..." }),
|
|
440
445
|
/* @__PURE__ */ n("div", { style: { marginBottom: "10px" }, children: [
|
|
441
446
|
!o && /* @__PURE__ */ t("p", { children: "Creating grid session..." }),
|
|
442
|
-
o && !
|
|
443
|
-
o &&
|
|
444
|
-
o &&
|
|
445
|
-
|
|
446
|
-
/* @__PURE__ */ t(
|
|
447
|
+
o && !m && /* @__PURE__ */ t("p", { children: "Setting up real-time sync..." }),
|
|
448
|
+
o && m && !c && /* @__PURE__ */ t("p", { children: "Establishing secure connection..." }),
|
|
449
|
+
o && m && c && !p && /* @__PURE__ */ t("p", { children: "Connecting to server..." }),
|
|
450
|
+
p && !$ && /* @__PURE__ */ t("p", { children: "Loading table data..." }),
|
|
451
|
+
/* @__PURE__ */ t(Ct, { numRows: 4, numCols: 1 })
|
|
447
452
|
] })
|
|
448
453
|
] }),
|
|
449
|
-
U && /* @__PURE__ */ n(
|
|
454
|
+
U && /* @__PURE__ */ n(w, { children: [
|
|
450
455
|
/* @__PURE__ */ t(s, { size: 12, children: /* @__PURE__ */ n(
|
|
451
|
-
|
|
456
|
+
ft,
|
|
452
457
|
{
|
|
453
458
|
direction: "row",
|
|
454
459
|
spacing: 1,
|
|
455
460
|
sx: { justifyContent: "flex-end" },
|
|
456
461
|
children: [
|
|
457
|
-
X,
|
|
458
462
|
Z,
|
|
463
|
+
tt,
|
|
459
464
|
/* @__PURE__ */ t(
|
|
460
|
-
|
|
465
|
+
nt,
|
|
461
466
|
{
|
|
462
467
|
variant: "outlined",
|
|
463
|
-
onClick: () =>
|
|
468
|
+
onClick: () => N(!0),
|
|
464
469
|
startIcon: /* @__PURE__ */ t(It, {}),
|
|
465
470
|
children: "Open chat"
|
|
466
471
|
}
|
|
467
472
|
),
|
|
468
473
|
/* @__PURE__ */ t(
|
|
469
|
-
|
|
474
|
+
Et,
|
|
470
475
|
{
|
|
471
476
|
agentRegistrationId: A,
|
|
472
477
|
open: W,
|
|
473
|
-
onClose: () =>
|
|
478
|
+
onClose: () => N(!1),
|
|
474
479
|
gridSessionId: o.sessionId,
|
|
475
|
-
usersReplicaId:
|
|
480
|
+
usersReplicaId: m,
|
|
476
481
|
chatbotName: "Grid Assistant"
|
|
477
482
|
}
|
|
478
483
|
),
|
|
479
484
|
o.sourceEntityId && /* @__PURE__ */ t(
|
|
480
|
-
|
|
485
|
+
mt,
|
|
481
486
|
{
|
|
482
487
|
sourceEntityId: o.sourceEntityId,
|
|
483
488
|
gridSessionId: o.sessionId
|
|
@@ -491,7 +496,7 @@ const on = dt(
|
|
|
491
496
|
}
|
|
492
497
|
),
|
|
493
498
|
o.sourceEntityId && /* @__PURE__ */ t(
|
|
494
|
-
|
|
499
|
+
ct,
|
|
495
500
|
{
|
|
496
501
|
sourceEntityId: o.sourceEntityId,
|
|
497
502
|
gridSessionId: o.sessionId
|
|
@@ -501,23 +506,24 @@ const on = dt(
|
|
|
501
506
|
}
|
|
502
507
|
) }),
|
|
503
508
|
/* @__PURE__ */ t(s, { size: 12, children: /* @__PURE__ */ t(
|
|
504
|
-
|
|
509
|
+
xt,
|
|
505
510
|
{
|
|
506
|
-
gridRef:
|
|
511
|
+
gridRef: f,
|
|
507
512
|
rowValues: g,
|
|
508
|
-
columnNames:
|
|
509
|
-
columnOrder:
|
|
510
|
-
schemaPropertiesInfo:
|
|
513
|
+
columnNames: a?.columnNames ?? [],
|
|
514
|
+
columnOrder: a?.columnOrder ?? [],
|
|
515
|
+
schemaPropertiesInfo: T,
|
|
511
516
|
entityIsView: Y,
|
|
512
|
-
jsonSchema:
|
|
517
|
+
jsonSchema: b,
|
|
513
518
|
lastSelection: H,
|
|
514
|
-
handleChange:
|
|
515
|
-
handleSelectionChange:
|
|
516
|
-
onSelectedRowChange:
|
|
519
|
+
handleChange: ot,
|
|
520
|
+
handleSelectionChange: it,
|
|
521
|
+
onSelectedRowChange: et,
|
|
522
|
+
remoteSelections: Q
|
|
517
523
|
}
|
|
518
524
|
) }),
|
|
519
525
|
/* @__PURE__ */ t(s, { size: 12, children: /* @__PURE__ */ t(
|
|
520
|
-
|
|
526
|
+
Mt,
|
|
521
527
|
{
|
|
522
528
|
selectedRowIndex: B.current,
|
|
523
529
|
rowValues: g
|
|
@@ -537,7 +543,7 @@ const on = dt(
|
|
|
537
543
|
},
|
|
538
544
|
children: [
|
|
539
545
|
/* @__PURE__ */ t("h3", { children: "Model" }),
|
|
540
|
-
e ? /* @__PURE__ */ t(
|
|
546
|
+
e ? /* @__PURE__ */ t(Rt, { model: e }) : "No model available"
|
|
541
547
|
]
|
|
542
548
|
}
|
|
543
549
|
)
|
|
@@ -546,6 +552,6 @@ const on = dt(
|
|
|
546
552
|
}
|
|
547
553
|
);
|
|
548
554
|
export {
|
|
549
|
-
|
|
555
|
+
en as default
|
|
550
556
|
};
|
|
551
557
|
//# sourceMappingURL=SynapseGrid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SynapseGrid.js","sources":["../../../src/components/DataGrid/SynapseGrid.tsx"],"sourcesContent":["import GridMenuButton from '@/components/DataGrid/components/GridMenuButton/GridMenuButton'\nimport UploadCsvToGridButton from '@/components/DataGrid/components/UploadCsvToGridButton'\nimport ExportCsvFromGridButton from '@/components/DataGrid/components/ExportCsvFromGridButton'\nimport useGetSchemaForGrid from '@/components/DataGrid/hooks/useGetSchemaForGrid'\nimport MergeGridWithSourceTableButton from '@/components/DataGrid/MergeGridWithSourceTableButton'\nimport computeReplicaSelectionModel from '@/components/DataGrid/utils/computeReplicaSelectionModel'\nimport modelRowsToGrid from '@/components/DataGrid/utils/modelRowsToGrid'\nimport { SkeletonTable } from '@/components/index'\nimport { useGetEntity } from '@/synapse-queries/index'\nimport { getSchemaPropertiesInfo } from '@/utils/jsonschema/getSchemaPropertyInfo'\nimport { SmartToyTwoTone } from '@mui/icons-material'\nimport { Stack, Tooltip } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport {\n CreateGridRequest,\n GridSession,\n} from '@sage-bionetworks/synapse-client'\nimport { ClickableJsonCrdt } from 'clickable-json'\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { DataSheetGridRef } from '@sage-bionetworks/react-datasheet-grid'\nimport { SelectionWithId } from '@sage-bionetworks/react-datasheet-grid'\nimport GridAgentChat from '../SynapseChat/GridAgentChat'\nimport DataGrid from './DataGrid'\nimport { DataGridRow, GridModel, Operation } from './DataGridTypes'\nimport { useGridUndoRedo } from './hooks/useGridUndoRedo'\nimport { StartGridSession, StartGridSessionHandle } from './StartGridSession'\nimport { useDataGridWebSocket } from './useDataGridWebsocket'\nimport { applyModelChange, ModelChange } from './utils/applyModelChange'\nimport { removeNoOpOperations } from './utils/DataGridUtils'\nimport { mapOperationsToModelChanges } from './utils/mapOperationsToModelChanges'\nimport { useGetCurrentUserBundle } from '@/synapse-queries'\nimport { useListGridReplicas } from '@/synapse-queries/grid/useGridSession'\nimport CertificationRequirement from '@/components/AccessRequirementList/RequirementItem/CertificationRequirement'\nimport { ValidationAlert } from './components/ValidationAlert'\n\nexport type SynapseGridProps = {\n agentRegistrationId?: string\n showDebugInfo?: boolean\n}\n\nexport type SynapseGridHandle = {\n initializeGrid: (request: CreateGridRequest) => void\n loadExistingSession: (sessionId: string) => void\n}\n\nconst SynapseGrid = forwardRef<SynapseGridHandle, SynapseGridProps>(\n ({ agentRegistrationId, showDebugInfo = false }, ref) => {\n const [session, setSession] = useState<GridSession | null>(null)\n const [replicaId, setReplicaId] = useState<number | null>(null)\n const [chatOpen, setChatOpen] = useState(false)\n const [lastSelection, setLastSelection] = useState<SelectionWithId | null>(\n null,\n )\n\n const startGridSessionRef = useRef<StartGridSessionHandle | null>(null)\n const gridRef = useRef<DataSheetGridRef | null>(null)\n\n const { data: userBundle, isLoading } = useGetCurrentUserBundle()\n\n const { data: replicas = [], refetch: refetchReplicas } =\n useListGridReplicas(session?.sessionId)\n\n const handleReplicaConnectionChange = useCallback(() => {\n void refetchReplicas()\n }, [refetchReplicas])\n\n useImperativeHandle(\n ref,\n () => ({\n initializeGrid: (request: CreateGridRequest) => {\n if (startGridSessionRef.current) {\n startGridSessionRef.current.handleStartSession(request)\n }\n },\n loadExistingSession: (sessionId: string) => {\n if (startGridSessionRef.current) {\n startGridSessionRef.current.handleLoadSession(sessionId)\n }\n },\n }),\n [],\n )\n\n // WebSocket state\n const {\n isConnected,\n websocketInstance,\n hasCompletedInitialSync,\n model,\n modelSnapshot,\n connect,\n presignedUrl,\n hasSufficientData,\n } = useDataGridWebSocket({\n onGridReady: handleReplicaConnectionChange,\n onReplicaConnected: handleReplicaConnectionChange,\n onReplicaDisconnected: handleReplicaConnectionChange,\n })\n\n const websocketInstanceRef = useRef<typeof websocketInstance | null>(null)\n\n useEffect(() => {\n websocketInstanceRef.current = websocketInstance\n }, [websocketInstance])\n\n // Track last connection parameters to avoid redundant connections\n const lastConnectParamsRef = useRef<{\n replicaId: number\n sessionId: string\n } | null>(null)\n\n useEffect(() => {\n if (\n replicaId === null ||\n replicaId === undefined ||\n !session?.sessionId\n ) {\n lastConnectParamsRef.current = null\n return\n }\n\n const nextParams = {\n replicaId,\n sessionId: session.sessionId,\n }\n\n const prevParams = lastConnectParamsRef.current\n\n if (\n prevParams &&\n prevParams.replicaId === nextParams.replicaId &&\n prevParams.sessionId === nextParams.sessionId\n ) {\n return\n }\n\n lastConnectParamsRef.current = nextParams\n connect(replicaId, session.sessionId)\n }, [replicaId, session?.sessionId, connect])\n\n // Reset grid state when model is reset (new session/replica)\n useEffect(() => {\n if (model === null) {\n // Clear any grid-specific state when starting a new session\n setLastSelection(null)\n // Clear active cell if grid exists\n if (gridRef.current) {\n gridRef.current.setActiveCell(null)\n }\n }\n }, [model])\n\n const jsonSchema = useGetSchemaForGrid(session)\n\n // Grid behaves differently for views vs recordSets\n // Note for future: can get modifiedOn to refresh grid when view changes\n const { data: entityData } = useGetEntity(\n session?.sourceEntityId,\n undefined,\n {\n enabled: !!session?.sourceEntityId,\n },\n )\n\n const entityIsView =\n entityData?.concreteType ===\n 'org.sagebionetworks.repo.model.table.EntityView'\n\n // Process schema properties once\n const schemaPropertiesInfo = useMemo(() => {\n return getSchemaPropertiesInfo(jsonSchema ?? null)\n }, [jsonSchema])\n\n const connectionStatus = isConnected ? 'Connected' : 'Disconnected'\n\n // Transform the model view rows and columns to DataSheetGrid format\n const rowValues = useMemo(\n () => (modelSnapshot ? modelRowsToGrid(model, modelSnapshot) : []),\n [model, modelSnapshot],\n )\n\n const commit = useCallback(() => {\n if (!isConnected || !websocketInstanceRef.current) {\n return\n }\n\n websocketInstanceRef.current.sendPatch()\n }, [isConnected, websocketInstanceRef])\n\n useEffect(() => {\n if (isConnected) {\n commit()\n }\n }, [isConnected, commit])\n\n const applyAndCommitChanges = useCallback(\n (model: GridModel, modelChanges: ModelChange[]) => {\n // Apply each change to the model\n modelChanges.forEach(change => {\n applyModelChange(model, change, schemaPropertiesInfo)\n })\n\n commit()\n },\n [commit, schemaPropertiesInfo],\n )\n\n const applyModelChangeFromUndoRedo = useCallback(\n (change: ModelChange) => {\n if (!model) {\n console.error('Model is not initialized')\n return\n }\n\n if (change.type === 'DELETE' && gridRef.current) {\n // The user may have set a cell as active that we are removing with an 'undo'. In that case, clear the active state\n gridRef.current.setActiveCell(null)\n }\n\n applyAndCommitChanges(model, [change])\n },\n [model, applyAndCommitChanges],\n )\n\n const { undoUI, redoUI, addOperationsToUndoStack, clearRedoStack } =\n useGridUndoRedo(applyModelChangeFromUndoRedo)\n\n const handleChange = useCallback(\n (newValue: DataGridRow[], operations: Operation[]) => {\n if (!model) {\n console.error('Model is not initialized')\n return\n }\n\n // Check that something changed before updating the model\n operations = removeNoOpOperations(newValue, rowValues, operations)\n\n if (operations.length > 0) {\n // Clear redo stack since new changes invalidate redo history\n clearRedoStack()\n\n // Track row creation, updates, and deletions to keep UI state and undo history in sync\n\n // Add all operations to the undo stack\n addOperationsToUndoStack(operations, rowValues, newValue)\n\n // Transform operations to model changes\n const modelChanges = mapOperationsToModelChanges(operations, newValue)\n\n applyAndCommitChanges(model, modelChanges)\n }\n },\n [\n model,\n rowValues,\n clearRedoStack,\n addOperationsToUndoStack,\n applyAndCommitChanges,\n ],\n )\n\n const handleSelectionChange = useCallback(\n (opts: { selection: SelectionWithId | null }) => {\n const { selection } = opts\n if (selection != null) {\n setLastSelection(selection)\n\n if (model != null && replicaId != null) {\n const replicaSelectionModel = computeReplicaSelectionModel(\n selection,\n model,\n )\n // insert it into the CRDT Model\n applyAndCommitChanges(model, [\n {\n type: 'SET_SELECTION',\n replicaId: replicaId.toString(),\n selection: replicaSelectionModel,\n },\n ])\n }\n }\n },\n [applyAndCommitChanges, model, replicaId],\n )\n\n // Track selected row index for validation display\n const selectedRowIndexRef = useRef<number | null>(null)\n const [, forceUpdate] = useState({})\n\n const handleSelectedRowChange = useCallback(\n (rowIndex: number | null, _row: DataGridRow | null) => {\n // Only update when a real row is selected — don't clear on blur/click-away\n // so the ValidationAlert stays open while the user interacts with it.\n if (rowIndex !== null) {\n selectedRowIndexRef.current = rowIndex\n forceUpdate({})\n }\n },\n [],\n )\n\n if (!isLoading && !userBundle?.isCertified) {\n return <CertificationRequirement />\n }\n\n return (\n <div>\n <Grid container spacing={2}>\n <Grid size={{ xs: 12, xl: 8 }}>\n <StartGridSession\n ref={startGridSessionRef}\n onSessionChange={setSession}\n onReplicaChange={setReplicaId}\n show={showDebugInfo}\n />\n </Grid>\n {/* Debug Information */}\n <Grid size={{ xs: 12, xl: 4 }}>\n {showDebugInfo && (\n <div>\n <p>Session ID: {session?.sessionId || 'No session created'}</p>\n <p>Replica ID: {replicaId || 'No replica created'}</p>\n <p>\n Source Entity ID:{' '}\n {session?.sourceEntityId || 'No source entity'}\n </p>\n <p>\n JSON Schema $id:{' '}\n {session?.gridJsonSchema$Id ||\n 'No schema attached to session'}\n </p>\n <p>\n Presigned URL:{' '}\n {presignedUrl\n ? presignedUrl.substring(0, 30) +\n (presignedUrl.length > 30\n ? ' ... ' +\n presignedUrl.substring(presignedUrl.length - 10)\n : '')\n : 'No URL generated'}\n </p>\n <p>\n WebSocket Status:{' '}\n <span style={{ color: isConnected ? 'green' : 'red' }}>\n {connectionStatus}\n </span>\n </p>\n <p>\n {(() => {\n const connectedReplicas = replicas.filter(\n r => r.isConnected,\n )\n return (\n <>\n Connected Replicas ({connectedReplicas.length} /{' '}\n {replicas.length} total):{' '}\n {connectedReplicas.length === 0\n ? 'none'\n : connectedReplicas.map((r, i) => (\n <Tooltip\n key={r.replicaId}\n title={\n <pre style={{ margin: 0, fontSize: '11px' }}>\n {JSON.stringify(r, null, 2)}\n </pre>\n }\n >\n <span\n style={{\n cursor: 'pointer',\n textDecoration: 'underline dotted',\n }}\n >\n {r.replicaId}\n {i < connectedReplicas.length - 1 ? ', ' : ''}\n </span>\n </Tooltip>\n ))}\n </>\n )\n })()}\n </p>\n </div>\n )}\n </Grid>\n\n {session && (\n <>\n {/* Grid Loading State */}\n {!hasSufficientData && (\n <Grid size={12}>\n <h3>Setting up grid...</h3>\n <div style={{ marginBottom: '10px' }}>\n {!session && <p>Creating grid session...</p>}\n {session && !replicaId && (\n <p>Setting up real-time sync...</p>\n )}\n {session && replicaId && !presignedUrl && (\n <p>Establishing secure connection...</p>\n )}\n {session && replicaId && presignedUrl && !isConnected && (\n <p>Connecting to server...</p>\n )}\n {isConnected && !hasCompletedInitialSync && (\n <p>Loading table data...</p>\n )}\n <SkeletonTable numRows={4} numCols={1} />\n </div>\n </Grid>\n )}\n {/* Grid */}\n {hasSufficientData && (\n <>\n <Grid size={12}>\n <Stack\n direction={'row'}\n spacing={1}\n sx={{ justifyContent: 'flex-end' }}\n >\n {undoUI}\n {redoUI}\n <GridMenuButton\n variant={'outlined'}\n onClick={() => setChatOpen(true)}\n startIcon={<SmartToyTwoTone />}\n >\n Open chat\n </GridMenuButton>\n <GridAgentChat\n agentRegistrationId={agentRegistrationId}\n open={chatOpen}\n onClose={() => setChatOpen(false)}\n gridSessionId={session.sessionId!}\n usersReplicaId={replicaId!}\n chatbotName=\"Grid Assistant\"\n />\n {session.sourceEntityId && (\n <UploadCsvToGridButton\n sourceEntityId={session.sourceEntityId}\n gridSessionId={session.sessionId!}\n />\n )}\n {session.sessionId && (\n <ExportCsvFromGridButton\n gridSessionId={session.sessionId}\n filename={\n 'grid-' + (session.sourceEntityId || 'export')\n }\n />\n )}\n {session.sourceEntityId && (\n <MergeGridWithSourceTableButton\n sourceEntityId={session.sourceEntityId}\n gridSessionId={session.sessionId!}\n />\n )}\n </Stack>\n </Grid>\n <Grid size={12}>\n <DataGrid\n gridRef={gridRef}\n rowValues={rowValues}\n columnNames={modelSnapshot?.columnNames ?? []}\n columnOrder={modelSnapshot?.columnOrder ?? []}\n schemaPropertiesInfo={schemaPropertiesInfo}\n entityIsView={entityIsView}\n jsonSchema={jsonSchema}\n lastSelection={lastSelection}\n handleChange={handleChange}\n handleSelectionChange={handleSelectionChange}\n onSelectedRowChange={handleSelectedRowChange}\n />\n </Grid>\n <Grid size={12}>\n <ValidationAlert\n selectedRowIndex={selectedRowIndexRef.current}\n rowValues={rowValues}\n />\n </Grid>\n </>\n )}\n {/* Debug Model Snapshot */}\n {showDebugInfo && (\n <Grid\n size={12}\n style={{\n margin: '10px 0',\n padding: '10px',\n border: '1px solid #ccc',\n maxHeight: '400px',\n overflowY: 'auto',\n }}\n >\n <h3>Model</h3>\n {model ? (\n <ClickableJsonCrdt model={model} />\n ) : (\n 'No model available'\n )}\n </Grid>\n )}\n </>\n )}\n </Grid>\n </div>\n )\n },\n)\n\nexport default SynapseGrid\n"],"names":["SynapseGrid","forwardRef","agentRegistrationId","showDebugInfo","ref","session","setSession","useState","replicaId","setReplicaId","chatOpen","setChatOpen","lastSelection","setLastSelection","startGridSessionRef","useRef","gridRef","userBundle","isLoading","useGetCurrentUserBundle","replicas","refetchReplicas","useListGridReplicas","handleReplicaConnectionChange","useCallback","useImperativeHandle","request","sessionId","isConnected","websocketInstance","hasCompletedInitialSync","model","modelSnapshot","connect","presignedUrl","hasSufficientData","useDataGridWebSocket","websocketInstanceRef","useEffect","lastConnectParamsRef","nextParams","prevParams","jsonSchema","useGetSchemaForGrid","entityData","useGetEntity","entityIsView","schemaPropertiesInfo","useMemo","getSchemaPropertiesInfo","connectionStatus","rowValues","modelRowsToGrid","commit","applyAndCommitChanges","modelChanges","change","applyModelChange","applyModelChangeFromUndoRedo","undoUI","redoUI","addOperationsToUndoStack","clearRedoStack","useGridUndoRedo","handleChange","newValue","operations","removeNoOpOperations","mapOperationsToModelChanges","handleSelectionChange","opts","selection","replicaSelectionModel","computeReplicaSelectionModel","selectedRowIndexRef","forceUpdate","handleSelectedRowChange","rowIndex","_row","CertificationRequirement","jsxs","Grid","jsx","StartGridSession","connectedReplicas","Fragment","i","Tooltip","SkeletonTable","Stack","GridMenuButton","SmartToyTwoTone","GridAgentChat","UploadCsvToGridButton","ExportCsvFromGridButton","MergeGridWithSourceTableButton","DataGrid","ValidationAlert","ClickableJsonCrdt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAMA,KAAcC;AAAA,EAClB,CAAC,EAAE,qBAAAC,GAAqB,eAAAC,IAAgB,GAAA,GAASC,MAAQ;AACvD,UAAM,CAACC,GAASC,CAAU,IAAIC,EAA6B,IAAI,GACzD,CAACC,GAAWC,CAAY,IAAIF,EAAwB,IAAI,GACxD,CAACG,GAAUC,CAAW,IAAIJ,EAAS,EAAK,GACxC,CAACK,GAAeC,CA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AAA,cACR,SAAS;AAAA,cACT,QAAQ;AAAA,cACR,WAAW;AAAA,cACX,WAAW;AAAA,YAAA;AAAA,YAGb,UAAA;AAAA,cAAA,gBAAAC,EAAC,QAAG,UAAA,QAAA,CAAK;AAAA,cACRnD,IACC,gBAAAmD,EAACgB,IAAA,EAAkB,OAAAnE,EAAA,CAAc,IAEjC;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ,EAAA,CAEJ;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA,EAEJ;AACF;"}
|
|
1
|
+
{"version":3,"file":"SynapseGrid.js","sources":["../../../src/components/DataGrid/SynapseGrid.tsx"],"sourcesContent":["import GridMenuButton from '@/components/DataGrid/components/GridMenuButton/GridMenuButton'\nimport UploadCsvToGridButton from '@/components/DataGrid/components/UploadCsvToGridButton'\nimport ExportCsvFromGridButton from '@/components/DataGrid/components/ExportCsvFromGridButton'\nimport useGetSchemaForGrid from '@/components/DataGrid/hooks/useGetSchemaForGrid'\nimport MergeGridWithSourceTableButton from '@/components/DataGrid/MergeGridWithSourceTableButton'\nimport computeReplicaSelectionModel from '@/components/DataGrid/utils/computeReplicaSelectionModel'\nimport modelRowsToGrid from '@/components/DataGrid/utils/modelRowsToGrid'\nimport { SkeletonTable } from '@/components/index'\nimport { useGetEntity } from '@/synapse-queries/index'\nimport { getSchemaPropertiesInfo } from '@/utils/jsonschema/getSchemaPropertyInfo'\nimport { SmartToyTwoTone } from '@mui/icons-material'\nimport { Stack, Tooltip } from '@mui/material'\nimport Grid from '@mui/material/Grid'\nimport {\n CreateGridRequest,\n GridSession,\n} from '@sage-bionetworks/synapse-client'\nimport { ClickableJsonCrdt } from 'clickable-json'\nimport {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useMemo,\n useRef,\n useState,\n} from 'react'\nimport { DataSheetGridRef } from '@sage-bionetworks/react-datasheet-grid'\nimport { SelectionWithId } from '@sage-bionetworks/react-datasheet-grid'\nimport GridAgentChat from '../SynapseChat/GridAgentChat'\nimport DataGrid from './DataGrid'\nimport { DataGridRow, GridModel, Operation } from './DataGridTypes'\nimport { useGridUndoRedo } from './hooks/useGridUndoRedo'\nimport { StartGridSession, StartGridSessionHandle } from './StartGridSession'\nimport { useDataGridWebSocket } from './useDataGridWebsocket'\nimport { applyModelChange, ModelChange } from './utils/applyModelChange'\nimport { removeNoOpOperations } from './utils/DataGridUtils'\nimport { mapOperationsToModelChanges } from './utils/mapOperationsToModelChanges'\nimport { useGetCurrentUserBundle } from '@/synapse-queries'\nimport { useListGridReplicas } from '@/synapse-queries/grid/useGridSession'\nimport { useRemoteSelections } from './hooks/useRemoteSelections'\nimport CertificationRequirement from '@/components/AccessRequirementList/RequirementItem/CertificationRequirement'\nimport { ValidationAlert } from './components/ValidationAlert'\n\nexport type SynapseGridProps = {\n agentRegistrationId?: string\n showDebugInfo?: boolean\n}\n\nexport type SynapseGridHandle = {\n initializeGrid: (request: CreateGridRequest) => void\n loadExistingSession: (sessionId: string) => void\n}\n\nconst SynapseGrid = forwardRef<SynapseGridHandle, SynapseGridProps>(\n ({ agentRegistrationId, showDebugInfo = false }, ref) => {\n const [session, setSession] = useState<GridSession | null>(null)\n const [replicaId, setReplicaId] = useState<number | null>(null)\n const [chatOpen, setChatOpen] = useState(false)\n const [lastSelection, setLastSelection] = useState<SelectionWithId | null>(\n null,\n )\n\n const startGridSessionRef = useRef<StartGridSessionHandle | null>(null)\n const gridRef = useRef<DataSheetGridRef | null>(null)\n\n const { data: userBundle, isLoading } = useGetCurrentUserBundle()\n\n const { data: replicas = [], refetch: refetchReplicas } =\n useListGridReplicas(session?.sessionId)\n\n const handleReplicaConnectionChange = useCallback(() => {\n void refetchReplicas()\n }, [refetchReplicas])\n\n useImperativeHandle(\n ref,\n () => ({\n initializeGrid: (request: CreateGridRequest) => {\n if (startGridSessionRef.current) {\n startGridSessionRef.current.handleStartSession(request)\n }\n },\n loadExistingSession: (sessionId: string) => {\n if (startGridSessionRef.current) {\n startGridSessionRef.current.handleLoadSession(sessionId)\n }\n },\n }),\n [],\n )\n\n // WebSocket state\n const {\n isConnected,\n websocketInstance,\n hasCompletedInitialSync,\n model,\n modelSnapshot,\n connect,\n presignedUrl,\n hasSufficientData,\n } = useDataGridWebSocket({\n onGridReady: handleReplicaConnectionChange,\n onReplicaConnected: handleReplicaConnectionChange,\n onReplicaDisconnected: handleReplicaConnectionChange,\n })\n\n const websocketInstanceRef = useRef<typeof websocketInstance | null>(null)\n\n useEffect(() => {\n websocketInstanceRef.current = websocketInstance\n }, [websocketInstance])\n\n // Track last connection parameters to avoid redundant connections\n const lastConnectParamsRef = useRef<{\n replicaId: number\n sessionId: string\n } | null>(null)\n\n useEffect(() => {\n if (\n replicaId === null ||\n replicaId === undefined ||\n !session?.sessionId\n ) {\n lastConnectParamsRef.current = null\n return\n }\n\n const nextParams = {\n replicaId,\n sessionId: session.sessionId,\n }\n\n const prevParams = lastConnectParamsRef.current\n\n if (\n prevParams &&\n prevParams.replicaId === nextParams.replicaId &&\n prevParams.sessionId === nextParams.sessionId\n ) {\n return\n }\n\n lastConnectParamsRef.current = nextParams\n connect(replicaId, session.sessionId)\n }, [replicaId, session?.sessionId, connect])\n\n // Reset grid state when model is reset (new session/replica)\n useEffect(() => {\n if (model === null) {\n // Clear any grid-specific state when starting a new session\n setLastSelection(null)\n // Clear active cell if grid exists\n if (gridRef.current) {\n gridRef.current.setActiveCell(null)\n }\n }\n }, [model])\n\n const jsonSchema = useGetSchemaForGrid(session)\n\n // Grid behaves differently for views vs recordSets\n // Note for future: can get modifiedOn to refresh grid when view changes\n const { data: entityData } = useGetEntity(\n session?.sourceEntityId,\n undefined,\n {\n enabled: !!session?.sourceEntityId,\n },\n )\n\n const entityIsView =\n entityData?.concreteType ===\n 'org.sagebionetworks.repo.model.table.EntityView'\n\n // Process schema properties once\n const schemaPropertiesInfo = useMemo(() => {\n return getSchemaPropertiesInfo(jsonSchema ?? null)\n }, [jsonSchema])\n\n const connectionStatus = isConnected ? 'Connected' : 'Disconnected'\n\n const remoteSelections = useRemoteSelections(\n modelSnapshot,\n model,\n replicas,\n replicaId,\n )\n\n // Transform the model view rows and columns to DataSheetGrid format\n const rowValues = useMemo(\n () => (modelSnapshot ? modelRowsToGrid(model, modelSnapshot) : []),\n [model, modelSnapshot],\n )\n\n const commit = useCallback(() => {\n if (!isConnected || !websocketInstanceRef.current) {\n return\n }\n\n websocketInstanceRef.current.sendPatch()\n }, [isConnected, websocketInstanceRef])\n\n useEffect(() => {\n if (isConnected) {\n commit()\n }\n }, [isConnected, commit])\n\n const applyAndCommitChanges = useCallback(\n (model: GridModel, modelChanges: ModelChange[]) => {\n // Apply each change to the model\n modelChanges.forEach(change => {\n applyModelChange(model, change, schemaPropertiesInfo)\n })\n\n commit()\n },\n [commit, schemaPropertiesInfo],\n )\n\n const applyModelChangeFromUndoRedo = useCallback(\n (change: ModelChange) => {\n if (!model) {\n console.error('Model is not initialized')\n return\n }\n\n if (change.type === 'DELETE' && gridRef.current) {\n // The user may have set a cell as active that we are removing with an 'undo'. In that case, clear the active state\n gridRef.current.setActiveCell(null)\n }\n\n applyAndCommitChanges(model, [change])\n },\n [model, applyAndCommitChanges],\n )\n\n const { undoUI, redoUI, addOperationsToUndoStack, clearRedoStack } =\n useGridUndoRedo(applyModelChangeFromUndoRedo)\n\n const handleChange = useCallback(\n (newValue: DataGridRow[], operations: Operation[]) => {\n if (!model) {\n console.error('Model is not initialized')\n return\n }\n\n // Check that something changed before updating the model\n operations = removeNoOpOperations(newValue, rowValues, operations)\n\n if (operations.length > 0) {\n // Clear redo stack since new changes invalidate redo history\n clearRedoStack()\n\n // Track row creation, updates, and deletions to keep UI state and undo history in sync\n\n // Add all operations to the undo stack\n addOperationsToUndoStack(operations, rowValues, newValue)\n\n // Transform operations to model changes\n const modelChanges = mapOperationsToModelChanges(operations, newValue)\n\n applyAndCommitChanges(model, modelChanges)\n }\n },\n [\n model,\n rowValues,\n clearRedoStack,\n addOperationsToUndoStack,\n applyAndCommitChanges,\n ],\n )\n\n const handleSelectionChange = useCallback(\n (opts: { selection: SelectionWithId | null }) => {\n const { selection } = opts\n if (selection != null) {\n setLastSelection(selection)\n\n if (model != null && replicaId != null) {\n const replicaSelectionModel = computeReplicaSelectionModel(\n selection,\n model,\n )\n // insert it into the CRDT Model\n applyAndCommitChanges(model, [\n {\n type: 'SET_SELECTION',\n replicaId: replicaId.toString(),\n selection: replicaSelectionModel,\n },\n ])\n }\n }\n },\n [applyAndCommitChanges, model, replicaId],\n )\n\n // Track selected row index for validation display\n const selectedRowIndexRef = useRef<number | null>(null)\n const [, forceUpdate] = useState({})\n\n const handleSelectedRowChange = useCallback(\n (rowIndex: number | null, _row: DataGridRow | null) => {\n // Only update when a real row is selected — don't clear on blur/click-away\n // so the ValidationAlert stays open while the user interacts with it.\n if (rowIndex !== null) {\n selectedRowIndexRef.current = rowIndex\n forceUpdate({})\n }\n },\n [],\n )\n\n if (!isLoading && !userBundle?.isCertified) {\n return <CertificationRequirement />\n }\n\n return (\n <div>\n <Grid container spacing={2}>\n <Grid size={{ xs: 12, xl: 8 }}>\n <StartGridSession\n ref={startGridSessionRef}\n onSessionChange={setSession}\n onReplicaChange={setReplicaId}\n show={showDebugInfo}\n />\n </Grid>\n {/* Debug Information */}\n <Grid size={{ xs: 12, xl: 4 }}>\n {showDebugInfo && (\n <div>\n <p>Session ID: {session?.sessionId || 'No session created'}</p>\n <p>Replica ID: {replicaId || 'No replica created'}</p>\n <p>\n Source Entity ID:{' '}\n {session?.sourceEntityId || 'No source entity'}\n </p>\n <p>\n JSON Schema $id:{' '}\n {session?.gridJsonSchema$Id ||\n 'No schema attached to session'}\n </p>\n <p>\n Presigned URL:{' '}\n {presignedUrl\n ? presignedUrl.substring(0, 30) +\n (presignedUrl.length > 30\n ? ' ... ' +\n presignedUrl.substring(presignedUrl.length - 10)\n : '')\n : 'No URL generated'}\n </p>\n <p>\n WebSocket Status:{' '}\n <span style={{ color: isConnected ? 'green' : 'red' }}>\n {connectionStatus}\n </span>\n </p>\n <p>\n {(() => {\n const connectedReplicas = replicas.filter(\n r => r.isConnected,\n )\n return (\n <>\n Connected Replicas ({connectedReplicas.length} /{' '}\n {replicas.length} total):{' '}\n {connectedReplicas.length === 0\n ? 'none'\n : connectedReplicas.map((r, i) => (\n <Tooltip\n key={r.replicaId}\n title={\n <pre style={{ margin: 0, fontSize: '11px' }}>\n {JSON.stringify(r, null, 2)}\n </pre>\n }\n >\n <span\n style={{\n cursor: 'pointer',\n textDecoration: 'underline dotted',\n }}\n >\n {r.replicaId}\n {i < connectedReplicas.length - 1 ? ', ' : ''}\n </span>\n </Tooltip>\n ))}\n </>\n )\n })()}\n </p>\n </div>\n )}\n </Grid>\n\n {session && (\n <>\n {/* Grid Loading State */}\n {!hasSufficientData && (\n <Grid size={12}>\n <h3>Setting up grid...</h3>\n <div style={{ marginBottom: '10px' }}>\n {!session && <p>Creating grid session...</p>}\n {session && !replicaId && (\n <p>Setting up real-time sync...</p>\n )}\n {session && replicaId && !presignedUrl && (\n <p>Establishing secure connection...</p>\n )}\n {session && replicaId && presignedUrl && !isConnected && (\n <p>Connecting to server...</p>\n )}\n {isConnected && !hasCompletedInitialSync && (\n <p>Loading table data...</p>\n )}\n <SkeletonTable numRows={4} numCols={1} />\n </div>\n </Grid>\n )}\n {/* Grid */}\n {hasSufficientData && (\n <>\n <Grid size={12}>\n <Stack\n direction={'row'}\n spacing={1}\n sx={{ justifyContent: 'flex-end' }}\n >\n {undoUI}\n {redoUI}\n <GridMenuButton\n variant={'outlined'}\n onClick={() => setChatOpen(true)}\n startIcon={<SmartToyTwoTone />}\n >\n Open chat\n </GridMenuButton>\n <GridAgentChat\n agentRegistrationId={agentRegistrationId}\n open={chatOpen}\n onClose={() => setChatOpen(false)}\n gridSessionId={session.sessionId!}\n usersReplicaId={replicaId!}\n chatbotName=\"Grid Assistant\"\n />\n {session.sourceEntityId && (\n <UploadCsvToGridButton\n sourceEntityId={session.sourceEntityId}\n gridSessionId={session.sessionId!}\n />\n )}\n {session.sessionId && (\n <ExportCsvFromGridButton\n gridSessionId={session.sessionId}\n filename={\n 'grid-' + (session.sourceEntityId || 'export')\n }\n />\n )}\n {session.sourceEntityId && (\n <MergeGridWithSourceTableButton\n sourceEntityId={session.sourceEntityId}\n gridSessionId={session.sessionId!}\n />\n )}\n </Stack>\n </Grid>\n <Grid size={12}>\n <DataGrid\n gridRef={gridRef}\n rowValues={rowValues}\n columnNames={modelSnapshot?.columnNames ?? []}\n columnOrder={modelSnapshot?.columnOrder ?? []}\n schemaPropertiesInfo={schemaPropertiesInfo}\n entityIsView={entityIsView}\n jsonSchema={jsonSchema}\n lastSelection={lastSelection}\n handleChange={handleChange}\n handleSelectionChange={handleSelectionChange}\n onSelectedRowChange={handleSelectedRowChange}\n remoteSelections={remoteSelections}\n />\n </Grid>\n <Grid size={12}>\n <ValidationAlert\n selectedRowIndex={selectedRowIndexRef.current}\n rowValues={rowValues}\n />\n </Grid>\n </>\n )}\n {/* Debug Model Snapshot */}\n {showDebugInfo && (\n <Grid\n size={12}\n style={{\n margin: '10px 0',\n padding: '10px',\n border: '1px solid #ccc',\n maxHeight: '400px',\n overflowY: 'auto',\n }}\n >\n <h3>Model</h3>\n {model ? (\n <ClickableJsonCrdt model={model} />\n ) : (\n 'No model available'\n )}\n </Grid>\n )}\n </>\n )}\n </Grid>\n </div>\n )\n },\n)\n\nexport default SynapseGrid\n"],"names":["SynapseGrid","forwardRef","agentRegistrationId","showDebugInfo","ref","session","setSession","useState","replicaId","setReplicaId","chatOpen","setChatOpen","lastSelection","setLastSelection","startGridSessionRef","useRef","gridRef","userBundle","isLoading","useGetCurrentUserBundle","replicas","refetchReplicas","useListGridReplicas","handleReplicaConnectionChange","useCallback","useImperativeHandle","request","sessionId","isConnected","websocketInstance","hasCompletedInitialSync","model","modelSnapshot","connect","presignedUrl","hasSufficientData","useDataGridWebSocket","websocketInstanceRef","useEffect","lastConnectParamsRef","nextParams","prevParams","jsonSchema","useGetSchemaForGrid","entityData","useGetEntity","entityIsView","schemaPropertiesInfo","useMemo","getSchemaPropertiesInfo","connectionStatus","remoteSelections","useRemoteSelections","rowValues","modelRowsToGrid","commit","applyAndCommitChanges","modelChanges","change","applyModelChange","applyModelChangeFromUndoRedo","undoUI","redoUI","addOperationsToUndoStack","clearRedoStack","useGridUndoRedo","handleChange","newValue","operations","removeNoOpOperations","mapOperationsToModelChanges","handleSelectionChange","opts","selection","replicaSelectionModel","computeReplicaSelectionModel","selectedRowIndexRef","forceUpdate","handleSelectedRowChange","rowIndex","_row","CertificationRequirement","jsxs","Grid","jsx","StartGridSession","connectedReplicas","Fragment","i","Tooltip","SkeletonTable","Stack","GridMenuButton","SmartToyTwoTone","GridAgentChat","UploadCsvToGridButton","ExportCsvFromGridButton","MergeGridWithSourceTableButton","DataGrid","ValidationAlert","ClickableJsonCrdt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAMA,KAAcC;AAAA,EAClB,CAAC,EAAE,qBAAAC,GAAqB,eAAAC,IAAgB,GAAA,GAASC,MAAQ;AACvD,UAAM,CAACC,GAASC,CAAU,IAAIC,EAA6B,IAAI,GACzD,CAACC,GAAWC,CAAY,IAAIF,EAAwB,IAAI,GACxD,CAACG,GAAUC,CAAW,IAAIJ,EAAS,EAAK,GACxC,CAACK,GAAeC,CAAgB,IAAIN;AAAA,MACxC;AAAA,IAAA,GAGIO,IAAsBC,EAAsC,IAAI,GAChEC,IAAUD,EAAgC,IAAI,GAE9C,EAAE,MAAME,GAAY,WAAAC,EAAA,IAAcC,GAAA,GAElC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A,cACR,WAAW;AAAA,cACX,WAAW;AAAA,YAAA;AAAA,YAGb,UAAA;AAAA,cAAA,gBAAAC,EAAC,QAAG,UAAA,QAAA,CAAK;AAAA,cACRrD,IACC,gBAAAqD,EAACgB,IAAA,EAAkB,OAAArE,EAAA,CAAc,IAEjC;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAEJ,EAAA,CAEJ;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA,EAEJ;AACF;"}
|
|
@@ -48,7 +48,6 @@ import "../../../assets/icons/account-validated.svg.js";
|
|
|
48
48
|
import "../../../utils/functions/DateFormatter.js";
|
|
49
49
|
import "@react-hookz/web";
|
|
50
50
|
import "dayjs";
|
|
51
|
-
import "../../../assets/ArcusBioIcon.svg.js";
|
|
52
51
|
import "@mui/material/SvgIcon";
|
|
53
52
|
import "../../../assets/icons/AccessPending.svg.js";
|
|
54
53
|
import "../../../assets/icons/AccessPendingCloud.svg.js";
|
|
@@ -224,7 +223,7 @@ function u({
|
|
|
224
223
|
let o = "";
|
|
225
224
|
return i > 0 && (o += `created ${i.toLocaleString()} rows`), i > 0 && r > 0 ? o += " and " : r == 0 && (o += "."), r > 0 && (o += `updated ${r.toLocaleString()} rows.`), I(o);
|
|
226
225
|
}
|
|
227
|
-
function
|
|
226
|
+
function St(i) {
|
|
228
227
|
const { gridSessionId: r, open: o, onClose: m, onComplete: p } = i, {
|
|
229
228
|
mutate: e,
|
|
230
229
|
isPending: s,
|
|
@@ -256,7 +255,7 @@ function yt(i) {
|
|
|
256
255
|
);
|
|
257
256
|
}
|
|
258
257
|
export {
|
|
259
|
-
|
|
258
|
+
St as default,
|
|
260
259
|
u as getUpdateMessage
|
|
261
260
|
};
|
|
262
261
|
//# sourceMappingURL=UploadCsvToGridDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadCsvToGridDialog.js","sources":["../../../../src/components/DataGrid/components/UploadCsvToGridDialog.tsx"],"sourcesContent":["import { displayToast } from '@/components/index'\nimport CsvPreviewDialog from '@/components/table/CsvPreview/CsvPreviewDialog'\nimport { useImportCsvIntoGrid } from '@/synapse-queries/grid/useImportCsvIntoGrid'\nimport { GridCsvImportResponse } from '@sage-bionetworks/synapse-client'\nimport upperFirst from 'lodash-es/upperFirst'\n\ntype UploadCsvToGridDialogProps = {\n gridSessionId: string\n open: boolean\n onClose: () => void\n onComplete: () => void\n}\n\nexport function getUpdateMessage({\n createdCount = 0,\n updatedCount = 0,\n}: GridCsvImportResponse): string {\n let message = ''\n if (createdCount > 0) {\n message += `created ${createdCount.toLocaleString()} rows`\n }\n if (createdCount > 0 && updatedCount > 0) {\n message += ' and '\n } else if (updatedCount == 0) {\n message += '.'\n }\n if (updatedCount > 0) {\n message += `updated ${updatedCount.toLocaleString()} rows.`\n }\n return upperFirst(message)\n}\n\nexport default function UploadCsvToGridDialog(\n props: UploadCsvToGridDialogProps,\n) {\n const { gridSessionId, open, onClose, onComplete } = props\n\n const {\n mutate: importCsvIntoGrid,\n isPending,\n error,\n } = useImportCsvIntoGrid({\n onSuccess: result => {\n displayToast(getUpdateMessage(result), 'success', {\n title: 'Data imported successfully',\n })\n onComplete()\n },\n })\n\n return (\n <CsvPreviewDialog\n open={open}\n onClose={onClose}\n onConfirm={(fileHandleId, schema, csvDescriptor) => {\n importCsvIntoGrid({\n concreteType:\n 'org.sagebionetworks.repo.model.grid.GridCsvImportRequest',\n sessionId: gridSessionId,\n fileHandleId,\n csvDescriptor,\n schema,\n })\n }}\n errorMessage={error?.message}\n confirmIsPending={isPending}\n />\n )\n}\n"],"names":["getUpdateMessage","createdCount","updatedCount","message","upperFirst","UploadCsvToGridDialog","props","gridSessionId","open","onClose","onComplete","importCsvIntoGrid","isPending","error","useImportCsvIntoGrid","result","displayToast","jsx","CsvPreviewDialog","fileHandleId","schema","csvDescriptor"],"mappings":"
|
|
1
|
+
{"version":3,"file":"UploadCsvToGridDialog.js","sources":["../../../../src/components/DataGrid/components/UploadCsvToGridDialog.tsx"],"sourcesContent":["import { displayToast } from '@/components/index'\nimport CsvPreviewDialog from '@/components/table/CsvPreview/CsvPreviewDialog'\nimport { useImportCsvIntoGrid } from '@/synapse-queries/grid/useImportCsvIntoGrid'\nimport { GridCsvImportResponse } from '@sage-bionetworks/synapse-client'\nimport upperFirst from 'lodash-es/upperFirst'\n\ntype UploadCsvToGridDialogProps = {\n gridSessionId: string\n open: boolean\n onClose: () => void\n onComplete: () => void\n}\n\nexport function getUpdateMessage({\n createdCount = 0,\n updatedCount = 0,\n}: GridCsvImportResponse): string {\n let message = ''\n if (createdCount > 0) {\n message += `created ${createdCount.toLocaleString()} rows`\n }\n if (createdCount > 0 && updatedCount > 0) {\n message += ' and '\n } else if (updatedCount == 0) {\n message += '.'\n }\n if (updatedCount > 0) {\n message += `updated ${updatedCount.toLocaleString()} rows.`\n }\n return upperFirst(message)\n}\n\nexport default function UploadCsvToGridDialog(\n props: UploadCsvToGridDialogProps,\n) {\n const { gridSessionId, open, onClose, onComplete } = props\n\n const {\n mutate: importCsvIntoGrid,\n isPending,\n error,\n } = useImportCsvIntoGrid({\n onSuccess: result => {\n displayToast(getUpdateMessage(result), 'success', {\n title: 'Data imported successfully',\n })\n onComplete()\n },\n })\n\n return (\n <CsvPreviewDialog\n open={open}\n onClose={onClose}\n onConfirm={(fileHandleId, schema, csvDescriptor) => {\n importCsvIntoGrid({\n concreteType:\n 'org.sagebionetworks.repo.model.grid.GridCsvImportRequest',\n sessionId: gridSessionId,\n fileHandleId,\n csvDescriptor,\n schema,\n })\n }}\n errorMessage={error?.message}\n confirmIsPending={isPending}\n />\n )\n}\n"],"names":["getUpdateMessage","createdCount","updatedCount","message","upperFirst","UploadCsvToGridDialog","props","gridSessionId","open","onClose","onComplete","importCsvIntoGrid","isPending","error","useImportCsvIntoGrid","result","displayToast","jsx","CsvPreviewDialog","fileHandleId","schema","csvDescriptor"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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