• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

CBIIT / crdc-datahub-ui / 12936221948

23 Jan 2025 07:03PM UTC coverage: 57.932% (-0.02%) from 57.952%
12936221948

Pull #605

github

web-flow
Merge 9c041f8e4 into bc7a90325
Pull Request #605: CRDCDH-2266 Support Viewing Older Data Model Versions

2807 of 5284 branches covered (53.12%)

Branch coverage included in aggregate %.

6 of 17 new or added lines in 6 files covered. (35.29%)

45 existing lines in 1 file now uncovered.

4033 of 6523 relevant lines covered (61.83%)

144.5 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/content/ModelNavigator/NavigatorView.tsx
1
import { FC } from "react";
2
import { Box } from "@mui/material";
3
// eslint-disable-next-line import/no-extraneous-dependencies -- Required to use legacy version from DMN
4
import { Provider } from "react-redux";
5
import { ReduxDataDictionary } from "data-model-navigator";
6
import SuspenseLoader from "../../components/SuspenseLoader";
7
import { Status, useDataCommonContext } from "../../components/Contexts/DataCommonContext";
8
import useBuildReduxStore from "../../hooks/useBuildReduxStore";
9

10
type ModelNavigatorProps = {
11
  /**
12
   * The version of the model to display
13
   */
14
  version: string;
15
};
16

17
/**
18
 * Encapsulates the Data Model Navigator component
19
 *
20
 * This component handles the following:
21
 * - Loading the Data Common assets
22
 * - Building the Redux store for the Data Model Navigator
23
 * - Rendering the Data Model Navigator
24
 *
25
 * @returns The Model Navigator view
26
 */
NEW
27
const ModelNavigator: FC<ModelNavigatorProps> = ({ version = "latest" }) => {
×
28
  const { status, DataCommon } = useDataCommonContext();
×
29
  const [{ status: buildStatus, store }, , populate] = useBuildReduxStore();
×
30

31
  if (status === Status.LOADING || buildStatus === "loading") {
×
32
    return <SuspenseLoader />;
×
33
  }
34

35
  if (status === Status.LOADED && buildStatus === "waiting") {
×
NEW
36
    populate(DataCommon, version);
×
37
    return <SuspenseLoader />;
×
38
  }
39

40
  if (!DataCommon || status === Status.ERROR || buildStatus === "error") {
×
NEW
41
    throw new Error("Oops! Unable to show the requested data model or model version.");
×
42
  }
43

44
  return (
×
45
    <Box sx={{ mt: "40px" }}>
46
      <Provider store={store}>
47
        <ReduxDataDictionary pdfDownloadConfig={DataCommon.configuration?.pdfConfig} />
48
      </Provider>
49
    </Box>
50
  );
51
};
52

53
export default ModelNavigator;
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc