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

143 lines (142 loc) 3.57 kB
import { jsxs as l, jsx as o } from "react/jsx-runtime"; import { useGetDockerTags as M } from "../../synapse-queries/docker/useGetDockerTag.js"; import { formatDate as D } from "../../utils/functions/DateFormatter.js"; import { Box as r, Typography as w, Radio as y } from "@mui/material"; import { DataGrid as F } from "@mui/x-data-grid"; import { Direction as R, SortBy as N } from "@sage-bionetworks/synapse-types"; import S from "dayjs"; import { useState as v } from "react"; function H({ repository: s, selectedCommit: u, onCommitChanged: g }) { const [d, f] = v(0), i = 10, { isLoading: m, data: n } = M( s.id, d * i, i, N.CREATED_ON, R.DESC ), c = (e) => { const t = (n?.results ?? []).find((x) => x.digest === e); t && g(t); }, h = [ { field: "radiobutton", headerName: "", width: 25, sortable: !1, filterable: !1, hideable: !1, disableColumnMenu: !0, renderCell: (e) => /* @__PURE__ */ o( y, { value: e.id, checked: e.id === u?.digest, onChange: (a) => c(a.target.value) } ) }, { field: "tag", headerName: "Tag", flex: 1, filterable: !1, hideable: !1, disableColumnMenu: !0 }, { field: "createdOn", headerName: "Created On", width: 100, filterable: !1, hideable: !1, disableColumnMenu: !0 }, { field: "digest", headerName: "Digest", width: 200, filterable: !1, hideable: !1, disableColumnMenu: !0 } ], p = (e) => { const a = []; return e.forEach((t) => { a.push({ id: t.digest, tag: t.tag, digest: t.digest, createdOn: D(S(t.createdOn), "MM/DD/YY") }); }), a; }, C = () => p(n?.results ?? []), b = (e) => { f(e); }; return /* @__PURE__ */ l(r, { children: [ /* @__PURE__ */ o( r, { sx: { display: "flex", backgroundColor: "#FBFBFC", padding: "10px", justifyContent: "space-between" }, children: /* @__PURE__ */ l( w, { variant: "h6", sx: { fontSize: "18px", lineHeight: "20px", fontWeight: 700 }, children: [ "Available commits for ", s.repositoryName ] } ) } ), /* @__PURE__ */ o(r, { children: /* @__PURE__ */ o( F, { loading: m, columns: h, rows: C(), rowCount: n?.totalNumberOfResults ?? 0, pagination: !0, paginationMode: "server", paginationModel: { page: d, pageSize: i }, onPaginationModelChange: ({ page: e }) => b(e), pageSizeOptions: [i], density: "compact", autoHeight: !0, sx: { fontSize: "14px", border: "none", height: "100%", "& .MuiDataGrid-columnHeader": { backgroundColor: "#F1F3F5" }, "& .Mui-odd": { backgroundColor: "#FBFBFC" }, ".MuiDataGrid-columnHeaderTitleContainer": { justifyContent: "space-between" }, ".radio": { display: "flex", alignItems: "center", height: "100%" } }, getRowClassName: (e) => e.indexRelativeToCurrentPage % 2 === 0 ? "Mui-even" : "Mui-odd" } ) }) ] }); } export { H as default }; //# sourceMappingURL=SubmissionCommitList.js.map