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

106 lines (105 loc) 3.55 kB
import { jsx as r, Fragment as w, jsxs as y } 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 { BUNDLE_MASK_QUERY_RESULTS as f } 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 _ } 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 "@sage-bionetworks/synapse-client"; import "../../utils/types/IsType.js"; import { useGetQueryResultBundleWithAsyncStatus as h } from "../../synapse-queries/entity/useGetQueryResultBundle.js"; import { SynapseByTheNumbersItem as i } from "./SynapseByTheNumbersItem.js"; const C = Intl.NumberFormat("en"); function tt({ metricsTable: l }) { const { data: c } = h({ entityId: l, query: { sql: `SELECT * FROM ${l}`, limit: 12, // past year sort: [{ column: "export_date", direction: "DESC" }] }, partMask: f, concreteType: "org.sagebionetworks.repo.model.table.QueryBundleRequest" }), t = c?.responseBody?.queryResult?.queryResults, e = t?.headers, n = e?.findIndex( (o) => o.name == "export_date" ), a = e?.findIndex( (o) => o.name == "total_data_size_in_pib" ), p = e?.findIndex( (o) => o.name == "active_users_last_month" ), m = e?.findIndex( (o) => o.name == "total_downloads_last_month" ); if (!t || t.rows.length == 0) return /* @__PURE__ */ r(w, {}); const s = t.rows[0].values, d = s[a], x = d != null ? Number(d).toFixed(2) : "-", u = s[m], I = u != null ? C.format(parseInt(u)) : "-"; return /* @__PURE__ */ y( _, { sx: { display: "flex", flexWrap: "wrap", justifyContent: "space-evenly" }, children: [ /* @__PURE__ */ r( i, { title: `${x} Petabytes`, description: "Total data", rows: t.rows, plotXColIndex: n, plotYColIndex: a } ), /* @__PURE__ */ r( i, { title: s[p] ?? "-", description: "Active users per month", rows: t.rows, plotXColIndex: n, plotYColIndex: p } ), /* @__PURE__ */ r( i, { title: I, description: "Total downloads per month", rows: t.rows, plotXColIndex: n, plotYColIndex: m } ) ] } ); } export { tt as SynapseByTheNumbers }; //# sourceMappingURL=SynapseByTheNumbers.js.map