synapse-react-client
Version:
[](https://badge.fury.io/js/synapse-react-client) [](https://github.com/prettier/prettie
166 lines (165 loc) • 5.7 kB
JavaScript
import { jsx as t, Fragment as R, jsxs as a } 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 { ColumnSingleValueFilterOperator as l } from "@sage-bionetworks/synapse-types";
import "../../utils/functions/EntityTypeUtils.js";
import { BUNDLE_MASK_QUERY_RESULTS as S } from "../../utils/SynapseConstants.js";
import "lodash-es";
import "@sage-bionetworks/synapse-client/util/synapseClientFetch";
import "@tanstack/react-query";
import "../../utils/PermissionLevelToAccessType.js";
import "react";
import "../../utils/context/SynapseContext.js";
import "use-deep-compare-effect";
import { Box as o, Typography as m } from "@mui/material";
import "../../utils/hooks/useCookiePreferences.js";
import { useSourceAppConfigs as v } from "../../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 "@sage-bionetworks/synapse-client";
import "../../utils/types/IsType.js";
import { useGetEntityPath as A } from "../../synapse-queries/entity/useEntity.js";
import { useGetQueryResultBundleWithAsyncStatus as T } from "../../synapse-queries/entity/useGetQueryResultBundle.js";
import { ChevronRightTwoTone as k } from "@mui/icons-material";
function se({
entityId: p,
dataCatalogEntityId: s = "syn61609402",
sourceAppConfigTableID: c = "syn45291362"
}) {
const { data: r } = A(p), u = r ? r.path.map((e) => e.id).slice(1) : [p], d = r ? [
{
concreteType: "org.sagebionetworks.repo.model.table.ColumnSingleValueQueryFilter",
columnName: "id",
operator: l.IN,
values: u
}
] : [], { data: f } = T(
{
entityId: s,
query: {
sql: `SELECT appId, link FROM ${s}`,
additionalFilters: d
},
partMask: S,
concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest"
},
{
enabled: !!r
}
), n = f?.responseBody?.queryResult?.queryResults, x = !!n && n?.rows.length > 0, y = n?.rows.map((e) => e.values[0]), g = [
{
concreteType: "org.sagebionetworks.repo.model.table.ColumnSingleValueQueryFilter",
columnName: "appId",
operator: l.EQUAL,
values: y
}
], i = v(
c,
g
), h = !!i && i.length > 0;
return !x || !h ? /* @__PURE__ */ t(R, {}) : /* @__PURE__ */ t(
o,
{
sx: {
display: "flex",
flexWrap: "wrap",
gap: "20px",
width: "100%",
alignItems: "center"
},
children: i.map((e, w) => {
const b = n.rows.find((C) => C.values[0] === e.appId)?.values[1] || e.appURL;
return /* @__PURE__ */ a(
o,
{
component: "a",
href: b,
target: "_blank",
rel: "noopener noreferrer",
flex: 1,
sx: {
display: "flex",
flexWrap: "nowrap",
padding: "16px",
justifyContent: "space-between",
border: "1px solid #ccc",
borderRadius: "8px",
backgroundColor: "#f9f9f9",
textDecoration: "none",
pointer: "cursor",
"&:hover": {
textDecoration: "none !important"
},
width: "100%",
alignItems: "center",
mt: "10px",
mb: "10px"
},
children: [
/* @__PURE__ */ a(
o,
{
flex: 1,
sx: {
display: "flex",
flexWrap: "wrap",
justifyContent: "space-between",
gap: "10px"
},
children: [
/* @__PURE__ */ t(
o,
{
sx: {
"> *": {
height: "60px"
}
},
children: e?.logo
}
),
/* @__PURE__ */ a(
o,
{
sx: {
display: "flex",
flexDirection: "column",
justifyContent: "center",
mr: "10px"
},
children: [
/* @__PURE__ */ t(m, { variant: "body1", sx: { fontWeight: 700 }, children: "This resource is part of a Portal" }),
/* @__PURE__ */ a(m, { variant: "body1", children: [
" ",
"Access it on the ",
e.friendlyName
] })
]
}
)
]
}
),
/* @__PURE__ */ t(k, {})
]
},
w
);
})
}
);
}
export {
se as default
};
//# sourceMappingURL=SynapsePortalBanners.js.map