UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

121 lines (120 loc) 4.06 kB
import { jsxs as C, Fragment as w, jsx as e } from "react/jsx-runtime"; 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 "@sage-bionetworks/synapse-types"; import "../../utils/functions/EntityTypeUtils.js"; import "../../utils/SynapseConstants.js"; import "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../utils/PermissionLevelToAccessType.js"; import { useCallback as l } from "react"; import { useSynapseContext as E } from "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import { Box as s, Button as T } from "@mui/material"; 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 "@tanstack/query-core"; import "lodash-es/isEmpty"; import "lodash-es/isEqual"; import "lodash-es/xorWith"; import "react-router"; import { EntityType as m } from "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useAddFileBatchToDownloadList as g } from "../../synapse-queries/download/useDownloadList.js"; import A from "@mui/icons-material/AddCircleTwoTone"; import { EntityChildrenDetails as S } from "../EntityFinder/details/configurations/EntityChildrenDetails.js"; import { DetailsViewColumn as i } from "../EntityFinder/details/view/DetailsView.js"; import { useEntitySelection as x } from "../EntityFinder/useEntitySelection.js"; import { VersionSelectionType as b } from "../EntityFinder/VersionSelectionType.js"; import { displayToast as p } from "../ToastMessage/ToastMessage.js"; function ao({ parentContainerId: a }) { const { downloadCartPageUrl: d } = E(), c = !0, { selectedEntities: o, toggleSelection: u, setInitialVersion: f } = x(c), { mutate: r } = g({ onSuccess: () => { p( "File(s) were successfully added to your Download List.", "success", { primaryButtonConfig: { text: "View Download List", onClick: () => window.location.href = d } } ); }, onError: (t) => { p( `Unable to add the file to your Download List. ${t.reason}`, "danger" ); } }), D = l( (t) => o.has(t.id), [o] ), h = l(() => { const t = Array.from(o.values()).map((n) => ({ fileEntityId: n.targetId, versionNumber: n.targetVersionNumber })); r(t); }, [o, r]), y = { versionSelection: b.REQUIRED, selectColumnType: "checkbox", enableSelectAll: !0, visibleTypes: [m.file], selected: o, selectableTypes: [m.file], isIdSelected: D, isSelectable: () => !0, toggleSelection: u, setInitialVersion: f, hiddenColumns: [ i.BADGES, i.ADD_TO_DOWNLOAD_CART, i.CREATED_ON, i.VERSION, i.MODIFIED_BY ] }; return /* @__PURE__ */ C(w, { children: [ /* @__PURE__ */ e(s, { children: /* @__PURE__ */ e( S, { parentContainerId: a, ...y } ) }), /* @__PURE__ */ e( s, { sx: { mt: 4 }, children: /* @__PURE__ */ e( T, { endIcon: /* @__PURE__ */ e(A, {}), variant: "outlined", sx: { alignSelf: "flex-end", height: "47px" }, onClick: h, disabled: !o.toArray().length, children: "Add to Download List" } ) } ) ] }); } export { ao as ChallengeDataDownload }; //# sourceMappingURL=ChallengeDataDownload.js.map