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

207 lines (206 loc) 6.7 kB
import { jsxs as a, 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 { SubmissionReviewerFilterType as p, SubmissionState as S, TYPE_FILTER as P } from "@sage-bionetworks/synapse-types"; import "../../utils/functions/EntityTypeUtils.js"; import { ACT_TEAM_ID as N } from "../../utils/SynapseConstants.js"; import { omitBy as _ } from "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import "@tanstack/react-query"; import "../../utils/PermissionLevelToAccessType.js"; import { useDebouncedEffect as D } from "../../utils/hooks/useDebouncedEffect.js"; import { useState as n, useEffect as U, useCallback as R } from "react"; import "../../utils/context/SynapseContext.js"; import "use-deep-compare-effect"; import { Grid as m, Typography as u, Tooltip as z, FormControlLabel as B, Checkbox as M } 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 { useLocation as Y, useNavigate as O } from "react-router"; import "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useIsCurrentUserACTMember as V } from "../../synapse-queries/user/useUserBundle.js"; import w from "../UserSearchBox/UserSearchBox.js"; import { AccessRequestSubmissionTable as j } from "./AccessRequestSubmissionTable.js"; import k from "./AccessRequirementSearchBox/AccessRequirementSearchBox.js"; const G = (r) => { if (r && r !== N.toString()) return r; }, Fe = () => { const [r, v] = n(), [s, d] = n(), [o, f] = n(), [c, b] = n(p.ALL), [g, A] = n({ accessRequirementId: r, accessorId: s, reviewerId: o, showRequesters: !0, submissionState: S.SUBMITTED }), l = Y(), T = O(), C = 500, { data: y } = V(); U(() => { (() => { const t = new URLSearchParams(l.search); v( t.get("accessRequirementId") ?? void 0 ), d(t.get("accessorId") ?? void 0), f(t.get("reviewerId") ?? void 0), b( t.get( "reviewerFilterType" ) ?? void 0 ); })(); }, [l.search]); const F = R((i) => { d(i || void 0); }, []), q = R((i) => { f(G(i)); }, []); return D( () => { ((t, h, x, L) => { const E = new URLSearchParams( _( { accessRequirementId: t, accessorId: h, reviewerId: x, reviewerFilterType: L }, (I) => I === void 0 || I === "" ) ); T( { pathname: l.pathname, search: E.toString() }, { replace: !0 } ); })( r, s, o, c ), A({ accessRequirementId: r, accessorId: s, reviewerId: o, reviewerFilterType: c, showRequesters: !0, submissionState: S.SUBMITTED }); }, [ r, s, o, c, T, l.pathname ], C ), /* @__PURE__ */ a("div", { className: "AccessSubmissionDashboard", children: [ /* @__PURE__ */ a( m, { container: !0, spacing: 2, className: "InputPanel", sx: { alignItems: "stretch" }, children: [ /* @__PURE__ */ a(m, { size: { xs: 12, md: 4 }, children: [ /* @__PURE__ */ e( u, { component: "label", variant: "smallText2", htmlFor: "arId-filter", children: "Filter by Access Requirement Name" } ), /* @__PURE__ */ e( k, { inputId: "arId-filter", onChange: v, placeholder: "Search for an Access Requirement Name " } ) ] }), /* @__PURE__ */ a(m, { size: { xs: 12, md: 4 }, children: [ /* @__PURE__ */ e( u, { component: "label", variant: "smallText2", htmlFor: "requester-filter", children: "Filter by Requester" } ), /* @__PURE__ */ e( w, { inputId: "requester-filter", placeholder: "Search for a user name", defaultValue: s, onChange: F, typeFilter: P.USERS_ONLY } ) ] }), /* @__PURE__ */ a(m, { size: { xs: 12, md: 4 }, children: [ /* @__PURE__ */ e( u, { component: "label", variant: "smallText2", htmlFor: "reviewer-filter", children: "Filter by Reviewer" } ), /* @__PURE__ */ e( w, { inputId: "reviewer-filter", placeholder: "Search for a user or team name", defaultValue: o, onChange: q } ) ] }), y && /* @__PURE__ */ e(m, { size: 12, sx: { textAlign: "right" }, children: /* @__PURE__ */ e( z, { title: "This will hide submissions that have a reviewer specifically assigned.", children: /* @__PURE__ */ e( B, { control: /* @__PURE__ */ e(M, {}), value: c === p.ACT_ONLY, label: "Reviewed by ACT only", onChange: (i, t) => { const h = t ? p.ACT_ONLY : p.ALL; b(h); } } ) } ) }) ] } ), /* @__PURE__ */ e(u, { variant: "headline3", children: "Access Request Submissions" }), /* @__PURE__ */ e(j, { ...g }) ] }); }; export { Fe as DataAccessSubmissionDashboard, G as getReviewerFilterID }; //# sourceMappingURL=AccessSubmissionDashboard.js.map