synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
167 lines (166 loc) • 5.52 kB
JavaScript
import { jsx as q, jsxs as r, Fragment as N } from "react/jsx-runtime";
import { Typography as l } from "@mui/material";
import { upperFirst as F } from "lodash-es";
import { useState as E, useMemo as M, useCallback as Q, useEffect as V } from "react";
import { useExportTableQueryToAnalysisPlatform as I } from "../../../synapse-queries/entity/useExportTableQueryToAnalysisPlatform.js";
import { getPrimaryKeyINFilter as O } from "../../../utils/functions/QueryFilterUtils.js";
import { TableQueryActionsRequired as D } from "../../DownloadCart/TableQueryActionsRequired.js";
import { useQueryContext as L } from "../../QueryContext/QueryContext.js";
import "@sage-bionetworks/synapse-types";
import "../../../utils/PermissionLevelToAccessType.js";
import "../../../utils/SynapseConstants.js";
import "../../../synapse-client/SynapseClient.js";
import "@sage-bionetworks/synapse-client/generated/models/ErrorResponseCode";
import "@sage-bionetworks/synapse-client/generated/models/TwoFactorAuthErrorResponse";
import "@sage-bionetworks/synapse-client/util/SynapseClientError";
import "../../../utils/functions/EntityTypeUtils.js";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "../../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import "@tanstack/react-query";
import "@tanstack/query-core";
import "lodash-es/isEmpty";
import "lodash-es/isEqual";
import "lodash-es/xorWith";
import "@sage-bionetworks/synapse-client";
import "../../../utils/types/IsType.js";
import "../../../utils/hooks/useCookiePreferences.js";
import "../../../utils/hooks/useSourceAppConfigs.js";
import "universal-cookie";
import "../../../utils/AppUtils/session/ApplicationSessionContext.js";
import "../../../utils/context/FullContextProvider.js";
import "../../../utils/context/DocumentMetadataContext.js";
import '../../../style/components/_spinner.css';/* empty css */
import "react-router";
import { useGetQueryMetadata as W } from "../../QueryWrapper/useGetQueryMetadata.js";
import { useQueryVisualizationContext as Y } from "../../QueryVisualizationWrapper/QueryVisualizationContext.js";
import { useSelectedRowsAtomValue as K, useRowSelectionPrimaryKeyAtomValue as $, useHasSelectedRowsAtomValue as j } from "../../QueryWrapper/TableRowSelectionState.js";
import "@mui/material/Skeleton";
import { SkeletonParagraph as _ } from "../../Skeleton/SkeletonParagraph.js";
import { getNumberOfResultsToInvokeActionCopy as z } from "../TopLevelControls/TopLevelControlsUtils.js";
import { EXTERNAL_ANALYSIS_PLATFORMS as G } from "./ExternalAnalysisPlatformsConstants.js";
function H(i) {
return `SendTo${F(
i.replace("\\s", "")
)}ButtonFromConfirmationDialog`;
}
function Ie(i) {
const { selectedPlatform: t, onConfirmButtonPropsChange: c, onSuccessfulExport: p } = i, o = G[t], {
getCurrentQueryRequest: d,
onViewSharingSettingsClicked: S,
hasResettableFilters: k,
fileIdColumnName: T,
fileVersionColumnName: A,
fileNameColumnName: P
} = L(), { data: e, isLoading: n } = W(), a = K(), m = $(), s = j(), { unitDescription: v } = Y(), [f, B] = E(void 0), y = M(() => {
const u = d();
return s && m && e?.selectColumns && (u.query.additionalFilters = [
...u.query.additionalFilters || [],
O(
m,
a,
e.selectColumns
)
]), u;
}, [
d,
s,
m,
e?.selectColumns,
a
]), {
exportToCavatica: h,
exportToTerra: C,
exportToPluto: b,
exportToPlutoDev: x,
exportToADWorkbench: g
} = I({
queryBundleRequest: y,
selectColumns: e?.selectColumns,
fileIdColumnName: T,
fileVersionColumnName: A,
fileNameColumnName: P
}), w = `Send ${z(
k,
s,
a,
e?.queryCount,
v
)} to ${o.name}`, R = Q(async () => {
switch (t) {
case "cavatica":
await h();
break;
case "terra":
await C();
break;
case "pluto":
await b();
break;
case "plutodev":
await x();
break;
case "adworkbench":
await g();
break;
}
p();
}, [
h,
C,
b,
x,
p,
t,
g
]);
return V(() => {
c({
id: H(t),
children: w,
disabled: n || f !== 0,
onClick: () => {
R();
}
});
}, [
f,
w,
n,
R,
c,
t
]), n ? /* @__PURE__ */ q(_, { numRows: 4 }) : /* @__PURE__ */ r(N, { children: [
/* @__PURE__ */ r(l, { variant: "body1", sx: { fontWeight: 700, my: "10px" }, children: [
"Before sending the selected data to ",
o.name,
":"
] }),
/* @__PURE__ */ r(l, { variant: "body1", sx: { marginBottom: "10px" }, children: [
"You must meet all requirements to download the selected data. You must take the following actions before we can send this data to",
" ",
o.name,
"."
] }),
/* @__PURE__ */ q(
D,
{
queryBundleRequest: y,
columnModels: e?.columnModels ?? [],
onNumberOfRequiredActionsChanged: B,
onViewSharingSettingsClicked: S
}
),
/* @__PURE__ */ r(l, { variant: "body1", sx: { fontWeight: 700, marginTop: "15px" }, children: [
"When completed, click “Send to ",
o.name,
"“ to finish the process outside this application. You will be redirected to ",
o.name,
"."
] })
] });
}
export {
Ie as default
};
//# sourceMappingURL=ExternalPlatformActionsRequiredPrecheck.js.map