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

113 lines (112 loc) 3.6 kB
import { jsx as m } from "react/jsx-runtime"; import w from "../../synapse-queries/entity/useGetQueryResultBundle.js"; import "../../utils/PermissionLevelToAccessType.js"; import { BUNDLE_MASK_QUERY_SELECT_COLUMNS as D, BUNDLE_MASK_QUERY_RESULTS as Q } from "../../utils/SynapseConstants.js"; import { useState as R, useEffect as k } from "react"; 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 "lodash-es"; import "@sage-bionetworks/synapse-client/util/synapseClientFetch"; import { useSynapseContext as C } from "../../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 "@mui/material"; import "@sage-bionetworks/synapse-client"; 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 "../../utils/types/IsType.js"; import { getFieldIndex as e } from "../../utils/functions/queryUtils.js"; import { ErrorBanner as b } from "../error/ErrorBanner.js"; import { FeaturedToolCard as A } from "./FeaturedToolCard.js"; function Tr({ entityId: i, toolDetailPageURL: x, toolURLColumnName: u, idColumnName: d = "id", nameColumnName: c = "name", descriptionColumnName: a = "description", typeColumnName: l = "type", dateColumnName: n, filterClause: T }) { const q = `SELECT * FROM ${i} ${T} LIMIT 3`, L = { concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest", entityId: i, partMask: D | Q, query: { sql: q } }, { accessToken: S } = C(), [v, B] = R([]), [f, I] = R(), { data: r, error: p } = w(L); return k(() => { (() => { try { const s = e(d, r), _ = e(c, r), g = e(l, r), M = e( a, r ), U = e(n, r), h = e( u, r ), y = r?.queryResult.queryResults.rows.map((E) => { E.values.some((F) => F === null) && console.warn("Row has null value(s)"); const o = E.values; return { name: o[_], description: o[M], type: o[g], id: o[s], date: n ? o[U] : void 0, url: u ? o[h] : void 0 }; }) ?? []; if (p) throw p; if (y.length === 0) return; B(y); } catch (s) { console.error(s), I(s); } })(); }, [ i, S, r, p, d, c, l, a, n ]), f ? /* @__PURE__ */ m(b, { error: f }) : /* @__PURE__ */ m("div", { className: "FeaturedToolList", children: v.map((t) => /* @__PURE__ */ m( A, { name: t.name, type: t.type, description: t.description, id: t.id, date: t.date, toolDetailPageURL: x, url: t.url }, t.id )) }); } export { Tr as FeaturedToolsList, Tr as default }; //# sourceMappingURL=FeaturedToolsList.js.map