From 334ab921eff73342b3a007c576850f045e68e798 Mon Sep 17 00:00:00 2001 From: chrisjrd Date: Fri, 11 Mar 2022 11:15:50 -0800 Subject: [PATCH 01/66] feat(bach-ui): hide unnecessary screens. updated search page size for All Data screen. Renamed widget label and related reference. Didn't rename NEN components in this commit. Refs #16 --- src/components/Sidebar/index.jsx | 22 ++++++----- src/components/Table/index.jsx | 10 ++++- src/pages/DataSummary/AllData/index.jsx | 5 +++ src/pages/Reporting/DataProcessing/index.jsx | 41 ++++++++++---------- src/pages/Reporting/index.jsx | 7 ++-- 5 files changed, 50 insertions(+), 35 deletions(-) diff --git a/src/components/Sidebar/index.jsx b/src/components/Sidebar/index.jsx index 17299d7..077eb33 100644 --- a/src/components/Sidebar/index.jsx +++ b/src/components/Sidebar/index.jsx @@ -46,21 +46,23 @@ export default function Sidebar(props) { path: "/product-accountability", icon: CheckCircleIcon, }, - { - label: "Process Monitoring", - path: "/process-monitoring", - icon: VisibilityIcon, - }, + // hidden for OPERA + // { + // label: "Process Monitoring", + // path: "/process-monitoring", + // icon: VisibilityIcon, + // }, { label: "Reporting", path: "/reporting", icon: InsertChartIcon, }, - { - label: "Cluster Health", - path: "/cluster-health", - icon: FavoriteIcon, - }, + // hidden for OPERA + // { + // label: "Cluster Health", + // path: "/cluster-health", + // icon: FavoriteIcon, + // }, ]; return ( diff --git a/src/components/Table/index.jsx b/src/components/Table/index.jsx index 43dd0d8..b8fc656 100644 --- a/src/components/Table/index.jsx +++ b/src/components/Table/index.jsx @@ -16,9 +16,11 @@ export default function Table(props) { setOpen, checkboxSelection, loading, + rowsPerPageOptions, + initialPageSize, } = props; - const [pageSize, setPageSize] = React.useState(5); + const [pageSize, setPageSize] = React.useState(initialPageSize); const [page, setPage] = React.useState(0); const classes = useStyles(); @@ -53,7 +55,7 @@ export default function Table(props) { onPageChange={handleChangePage} pageSize={pageSize} onPageSizeChange={handlePageSize} - rowsPerPageOptions={[5, 10, 20]} + rowsPerPageOptions={rowsPerPageOptions} pagination /> @@ -69,6 +71,8 @@ Table.propTypes = { setOpen: PropTypes.func, checkboxSelection: PropTypes.bool, loading: PropTypes.bool, + rowsPerPageOptions: PropTypes.arrayOf(PropTypes.number), + initialPageSize: PropTypes.number, }; Table.defaultProps = { @@ -79,4 +83,6 @@ Table.defaultProps = { setOpen: () => {}, checkboxSelection: false, loading: false, + rowsPerPageOptions: [5, 10, 20], + initialPageSize: 5, }; diff --git a/src/pages/DataSummary/AllData/index.jsx b/src/pages/DataSummary/AllData/index.jsx index 0c0b76a..af3fd18 100644 --- a/src/pages/DataSummary/AllData/index.jsx +++ b/src/pages/DataSummary/AllData/index.jsx @@ -84,6 +84,9 @@ function AllData() { const [jsonData, setJsonData] = React.useState({}); const [open, setOpen] = React.useState(false); + const rowsPerPageOptions = [10, 20, 50]; + const defaultPageSize = rowsPerPageOptions[0]; + const getJsonData = async (id) => { const paths = ["data"]; const params = { @@ -339,6 +342,8 @@ function AllData() { open={open} setOpen={setOpen} loading={loading} + rowsPerPageOptions={rowsPerPageOptions} + initialPageSize={defaultPageSize} /> diff --git a/src/pages/Reporting/DataProcessing/index.jsx b/src/pages/Reporting/DataProcessing/index.jsx index 53e0e16..a5b8a6a 100644 --- a/src/pages/Reporting/DataProcessing/index.jsx +++ b/src/pages/Reporting/DataProcessing/index.jsx @@ -22,8 +22,8 @@ import { } from "../../../contexts/ReportingContexts"; import { - StateContext as DataStateNenContext, - DispatchContext as DataDispatchNenContext, + StateContext as DataStateIncomingL2HLSFilesContext, + DispatchContext as DataDispatchL2HLSFilesContext, } from "../../../contexts/DataContexts/DataProcessing/IncomingNen"; import { @@ -66,7 +66,7 @@ function DataProcessing(props) { const { match } = props; const links = [ - { path: "incoming-nen", label: "Incoming NEN Files" }, + { path: "incoming-l2-hls", label: "Incoming L2 HLS Files" }, { path: "incoming-gds", label: "Incoming GDS Ancillary Files" }, { path: "generated-sds", label: "Generated SDS Products" }, { path: "outgoing-to-daac", label: "Outgoing Products To DAAC" }, @@ -77,8 +77,8 @@ function DataProcessing(props) { const state = React.useContext(StateContext); const dispatch = React.useContext(DispatchContext); - const nenDataState = React.useContext(DataStateNenContext); - const nenDataDispatch = React.useContext(DataDispatchNenContext); + const incomingL2HLSFilesDataState = React.useContext(DataStateIncomingL2HLSFilesContext); + const incomingL2HLSFilesDataDispatch = React.useContext(DataDispatchL2HLSFilesContext); const gdsDataState = React.useContext(DataStateGdsContext); const gdsDataDispatch = React.useContext(DataDispatchGdsContext); @@ -98,10 +98,10 @@ function DataProcessing(props) { reportType, } = state; - const nenData = nenDataState.data; - const nenSummary = nenDataState.summary; - const setNenData = nenDataDispatch.setData; - const setNenSummary = nenDataDispatch.setSummary; + const incomingL2HLSFilesData = incomingL2HLSFilesDataState.data; + const incomingL2HLSFilesSummary = incomingL2HLSFilesDataState.summary; + const setIncomingL2HLSFilesData = incomingL2HLSFilesDataDispatch.setData; + const setIncomingL2HLSFilesSummary = incomingL2HLSFilesDataDispatch.setSummary; const gdsData = gdsDataState.data; const gdsSummary = gdsDataState.summary; @@ -176,12 +176,13 @@ function DataProcessing(props) { const toggleFilters = () => setFiltersHidden(!filtersHidden); - const getIncomingNen = async () => { + const getIncomingL2HLSFiles = async () => { const paths = ["reports", "IncomingFiles"]; const params = { startDateTime: `${tempStartDate}:00Z`, endDateTime: `${tempEndDate}:00Z`, reportType: "nen", + mime: "invalid", // TODO chrisjrd: fix bug in Bach API. "json" should return JSON, but instead returns a string of JSON }; let results = {}; try { @@ -254,8 +255,8 @@ function DataProcessing(props) { const getReport = async (reportName) => { switch (reportName) { - case "incoming-nen": - return getIncomingNen(); + case "incoming-l2-hls": + return getIncomingL2HLSFiles(); case "incoming-gds": return getIncomingGds(); case "generated-sds": @@ -269,9 +270,9 @@ function DataProcessing(props) { const setReportInfo = (reportName, results) => { switch (reportName) { - case "incoming-nen": - setNenSummary(results.data.header); - setNenData(formatReportData("name", results.data.products)); + case "incoming-l2-hls": + setIncomingL2HLSFilesSummary(results.data.header); + setIncomingL2HLSFilesData(formatReportData("name", results.data.products)); return true; case "incoming-gds": setGdsSummary(results.data.header); @@ -295,8 +296,8 @@ function DataProcessing(props) { switch (currentPath) { case "data-processing": return {}; - case "incoming-nen": - return nenSummary || {}; + case "incoming-l2-hls": + return incomingL2HLSFilesSummary || {}; case "incoming-gds": return gdsSummary || {}; case "generated-sds": @@ -378,14 +379,14 @@ function DataProcessing(props) { } + render={() => } /> {/* todo: may move this to config file and map over array */} ( - + )} />