synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
110 lines (109 loc) • 3.62 kB
JavaScript
import { jsx as r, Fragment as G } from "react/jsx-runtime";
import T from "../../synapse-queries/entity/useGetQueryResultBundle.js";
import "../../utils/PermissionLevelToAccessType.js";
import { BUNDLE_MASK_QUERY_SELECT_COLUMNS as w, BUNDLE_MASK_QUERY_RESULTS as D } from "../../utils/SynapseConstants.js";
import { useMemo as L } 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 "../../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 { Box as M } from "@mui/material";
import "@sage-bionetworks/synapse-client";
import b from "../../utils/hooks/useShowDesktop.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 "../../utils/types/IsType.js";
import { getFieldIndex as m } from "../../utils/functions/queryUtils.js";
import h from "../../utils/hooks/useGetGoalData.js";
import { ErrorBanner as N } from "../error/ErrorBanner.js";
import A from "./Goals.Desktop.js";
import O from "./Goals.Mobile.js";
const U = 1200;
function _o(S) {
const { entityId: l, isAssetIcon: E = !1, linkText: u } = S, R = b(U), q = {
concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest",
entityId: l,
partMask: w | D,
query: {
sql: `select *
from ${l}
order by ItemOrder`
}
}, { data: o } = T(q), { assets: c, error: d } = h(
l,
o
), i = m(
"TableId",
o
), n = m(
"CountSql",
o
), f = m(
"Title",
o
), y = m(
"Summary",
o
), x = m("Link", o), p = L(() => o?.queryResult.queryResults.rows.map(
(e, s) => {
const t = e.values;
t.some((B) => B === null) && console.warn("Row has null value(s) when no nulls expected");
const I = i > -1 ? t[i] : void 0;
let a;
n > -1 && t[n] ? a = t[n] : I && (a = `SELECT * FROM ${I}`);
const C = t[f], _ = t[y], g = t[x], k = c?.[s] ?? "";
return {
countSql: a,
title: C,
summary: _,
link: g,
asset: k,
isAssetIcon: E
};
}
), [
n,
c,
x,
o?.queryResult,
y,
i,
f
]);
return d ? /* @__PURE__ */ r(N, { error: d }) : p ? R ? /* @__PURE__ */ r(
M,
{
className: "Goals",
sx: {
display: "flex",
flexWrap: "wrap",
gap: "7px",
alignItems: "stretch",
justifyContent: "center"
},
children: p.map((e, s) => /* @__PURE__ */ r(A, { ...e, linkText: u }, s))
}
) : /* @__PURE__ */ r("div", { className: "Goals", children: p.map((e, s) => /* @__PURE__ */ r(O, { ...e, linkText: u }, s)) }) : /* @__PURE__ */ r(G, {});
}
export {
_o as Goals,
_o as default
};
//# sourceMappingURL=Goals.js.map