From 3d470d55c8925f7601ed09f34de3d49f2d3a3b60 Mon Sep 17 00:00:00 2001 From: Frank Niessink Date: Tue, 24 Dec 2024 15:16:48 +0100 Subject: [PATCH] Migrate SUIR components to MUI. --- components/frontend/src/App.css | 20 +- components/frontend/src/App.js | 10 +- components/frontend/src/AppUI.js | 106 +++--- components/frontend/src/PageContent.js | 32 +- components/frontend/src/PageContent.test.js | 2 +- components/frontend/src/app_ui_settings.js | 26 -- .../src/dashboard/CardDashboard.test.js | 13 +- .../frontend/src/dashboard/ExportCard.css | 35 -- .../frontend/src/dashboard/ExportCard.js | 79 ----- .../src/dashboard/FilterCardWithTable.js | 6 +- .../frontend/src/dashboard/IssuesCard.js | 23 +- .../frontend/src/dashboard/LegendCard.js | 2 +- .../src/dashboard/MetricSummaryCard.js | 9 +- .../dashboard/MetricsRequiringActionCard.js | 34 +- .../frontend/src/dashboard/PageHeader.js | 43 +++ ...{ExportCard.test.js => PageHeader.test.js} | 28 +- components/frontend/src/errorMessage.js | 25 +- components/frontend/src/fields/Comment.js | 21 -- .../frontend/src/fields/Comment.test.js | 8 - .../frontend/src/fields/CommentField.js | 23 ++ components/frontend/src/fields/TextField.js | 102 ++++++ components/frontend/src/fields/TextInput.js | 76 ----- .../frontend/src/fields/TextInput.test.js | 76 ----- .../frontend/src/header_footer/Footer.js | 2 +- .../src/header_footer/buttons/HomeButton.js | 2 +- components/frontend/src/issue/IssueStatus.js | 136 +++++--- .../frontend/src/issue/IssueStatus.test.js | 48 +-- components/frontend/src/issue/IssuesRows.js | 90 +++-- .../src/measurement/MeasurementSources.js | 3 +- .../measurement/MeasurementSources.test.js | 3 +- .../src/measurement/MeasurementTarget.js | 11 +- .../src/measurement/MeasurementValue.js | 97 +++--- .../src/measurement/MeasurementValue.test.js | 3 - .../frontend/src/measurement/Overrun.js | 115 ++++--- .../frontend/src/measurement/SourceStatus.js | 22 +- .../frontend/src/measurement/StatusIcon.js | 4 +- .../frontend/src/measurement/TimeLeft.js | 14 +- .../metric/MetricConfigurationParameters.js | 215 ++++++------ .../MetricConfigurationParameters.test.js | 4 +- .../src/metric/MetricDebtParameters.js | 116 ++++--- .../frontend/src/metric/MetricDetails.js | 115 +++---- .../frontend/src/metric/MetricDetails.test.js | 28 +- .../frontend/src/metric/MetricTypeHeader.js | 17 +- components/frontend/src/metric/Target.js | 311 ++--------------- components/frontend/src/metric/Target.test.js | 266 +-------------- .../frontend/src/metric/TargetVisualiser.js | 225 +++++++++++++ .../src/metric/TargetVisualiser.test.js | 250 ++++++++++++++ components/frontend/src/metric/TrendGraph.js | 17 +- components/frontend/src/metric/status.js | 9 - .../notification/NotificationDestinations.js | 102 +++--- .../NotificationDestinations.test.js | 2 +- .../frontend/src/report/IssueTracker.js | 313 +++++++++--------- .../frontend/src/report/IssueTracker.test.js | 46 +-- components/frontend/src/report/Report.js | 50 +-- .../frontend/src/report/ReportErrorMessage.js | 33 -- components/frontend/src/report/ReportTitle.js | 221 ++++++------- .../frontend/src/report/ReportTitle.test.js | 76 +++-- .../frontend/src/report/ReportsOverview.js | 19 +- .../src/report/ReportsOverview.test.js | 2 +- .../src/report/ReportsOverviewTitle.js | 159 +++++---- .../src/report/ReportsOverviewTitle.test.js | 2 +- .../src/semantic_ui_react_wrappers.js | 8 - .../src/semantic_ui_react_wrappers/Card.css | 11 - .../src/semantic_ui_react_wrappers/Card.js | 17 - .../semantic_ui_react_wrappers/Dropdown.css | 3 - .../semantic_ui_react_wrappers/Dropdown.js | 16 - .../src/semantic_ui_react_wrappers/Header.css | 3 - .../src/semantic_ui_react_wrappers/Header.js | 13 - .../src/semantic_ui_react_wrappers/Message.js | 14 - .../src/semantic_ui_react_wrappers/Popup.css | 14 - .../src/semantic_ui_react_wrappers/Popup.js | 12 - .../semantic_ui_react_wrappers/Segment.css | 12 - .../src/semantic_ui_react_wrappers/Segment.js | 10 - .../src/semantic_ui_react_wrappers/Tab.css | 3 - .../src/semantic_ui_react_wrappers/Tab.js | 17 - .../src/semantic_ui_react_wrappers/Table.css | 20 -- .../src/semantic_ui_react_wrappers/Table.js | 17 - components/frontend/src/sharedPropTypes.js | 2 + components/frontend/src/source/Logo.js | 13 +- components/frontend/src/source/Source.js | 113 +++---- components/frontend/src/source/Source.test.js | 2 +- .../frontend/src/source/SourceEntities.css | 8 - .../frontend/src/source/SourceEntities.js | 102 +++--- .../src/source/SourceEntities.test.js | 2 +- .../frontend/src/source/SourceEntity.css | 43 --- .../frontend/src/source/SourceEntity.js | 28 +- .../frontend/src/source/SourceEntity.test.js | 6 +- .../src/source/SourceEntityDetails.js | 120 ++++--- .../src/source/SourceEntityDetails.test.js | 2 +- .../frontend/src/source/SourceParameter.js | 49 +-- .../src/source/SourceParameter.test.js | 6 +- .../frontend/src/source/SourceParameters.js | 25 +- components/frontend/src/source/SourceType.js | 36 +- .../frontend/src/source/SourceType.test.js | 7 +- .../frontend/src/source/SourceTypeHeader.js | 24 +- components/frontend/src/source/Sources.js | 12 +- .../frontend/src/source/Sources.test.js | 11 +- components/frontend/src/subject/Subject.css | 2 +- components/frontend/src/subject/Subject.js | 6 +- .../frontend/src/subject/SubjectParameters.js | 84 ++--- .../frontend/src/subject/SubjectTable.css | 120 +------ .../frontend/src/subject/SubjectTable.js | 60 ++-- .../frontend/src/subject/SubjectTable.test.js | 7 +- .../frontend/src/subject/SubjectTableBody.js | 6 +- .../src/subject/SubjectTableFooter.js | 14 +- .../src/subject/SubjectTableFooter.test.js | 2 +- .../src/subject/SubjectTableHeader.js | 65 ++-- .../src/subject/SubjectTableHeader.test.js | 12 +- .../frontend/src/subject/SubjectTableRow.js | 75 ++--- .../src/subject/SubjectTableRow.test.js | 6 +- .../frontend/src/subject/SubjectTitle.js | 61 ++-- .../frontend/src/subject/SubjectTitle.test.js | 11 +- .../frontend/src/subject/SubjectType.js | 29 +- .../frontend/src/subject/SubjectsButtonRow.js | 2 +- components/frontend/src/theme.js | 119 +++++++ components/frontend/src/utils.js | 1 - .../frontend/src/widgets/CommentSegment.js | 9 +- components/frontend/src/widgets/Header.js | 18 + .../src/widgets/HeaderWithDetails.css | 9 - .../frontend/src/widgets/HeaderWithDetails.js | 65 ++-- .../src/widgets/HeaderWithDetails.test.js | 10 +- components/frontend/src/widgets/HyperLink.js | 1 + components/frontend/src/widgets/Label.js | 28 ++ .../frontend/src/widgets/LabelWithDropdown.js | 34 +- .../src/widgets/LabelWithDropdown.test.js | 80 +---- .../frontend/src/widgets/LabelWithHelp.js | 17 +- .../src/widgets/LabelWithHyperLink.js | 2 +- .../frontend/src/widgets/ReadTheDocsLink.js | 7 +- components/frontend/src/widgets/TabPane.css | 14 - components/frontend/src/widgets/TabPane.js | 57 ---- .../frontend/src/widgets/TabPane.test.js | 41 --- .../frontend/src/widgets/TableHeaderCell.js | 30 +- .../src/widgets/TableHeaderCell.test.js | 18 +- .../src/widgets/TableRowWithDetails.js | 33 +- .../src/widgets/TableRowWithDetails.test.js | 6 +- components/frontend/src/widgets/Tabs.js | 46 +++ .../frontend/src/widgets/WarningMessage.js | 37 ++- .../src/widgets/WarningMessage.test.js | 6 +- components/frontend/src/widgets/icons.js | 2 +- tests/application_tests/src/test_report.py | 6 +- 140 files changed, 2706 insertions(+), 3300 deletions(-) delete mode 100644 components/frontend/src/dashboard/ExportCard.css delete mode 100644 components/frontend/src/dashboard/ExportCard.js create mode 100644 components/frontend/src/dashboard/PageHeader.js rename components/frontend/src/dashboard/{ExportCard.test.js => PageHeader.test.js} (65%) delete mode 100644 components/frontend/src/fields/Comment.js delete mode 100644 components/frontend/src/fields/Comment.test.js create mode 100644 components/frontend/src/fields/CommentField.js create mode 100644 components/frontend/src/fields/TextField.js delete mode 100644 components/frontend/src/fields/TextInput.js delete mode 100644 components/frontend/src/fields/TextInput.test.js create mode 100644 components/frontend/src/metric/TargetVisualiser.js create mode 100644 components/frontend/src/metric/TargetVisualiser.test.js delete mode 100644 components/frontend/src/report/ReportErrorMessage.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Card.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Card.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Dropdown.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Dropdown.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Header.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Header.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Message.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Popup.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Popup.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Segment.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Segment.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Tab.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Tab.js delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Table.css delete mode 100644 components/frontend/src/semantic_ui_react_wrappers/Table.js delete mode 100644 components/frontend/src/source/SourceEntity.css create mode 100644 components/frontend/src/theme.js create mode 100644 components/frontend/src/widgets/Header.js delete mode 100644 components/frontend/src/widgets/HeaderWithDetails.css create mode 100644 components/frontend/src/widgets/Label.js delete mode 100644 components/frontend/src/widgets/TabPane.css delete mode 100644 components/frontend/src/widgets/TabPane.js delete mode 100644 components/frontend/src/widgets/TabPane.test.js create mode 100644 components/frontend/src/widgets/Tabs.js diff --git a/components/frontend/src/App.css b/components/frontend/src/App.css index 610c057fed..95ccba6113 100644 --- a/components/frontend/src/App.css +++ b/components/frontend/src/App.css @@ -1,21 +1,3 @@ -.MainContainer { - flex: 1; - margin-top: 6em; - padding-left: 1em; - padding-right: 1em; -} - -@media print { - .MainContainer { - margin-top: 0em; - } -} - html { - scroll-padding-top: 163px; /* height of sticky header */ -} - -:root { - --inverted-menu-background-color: #1b1c1d; - --selection-color: #2185d0; + scroll-padding-top: 176px; /* height of sticky header */ } diff --git a/components/frontend/src/App.js b/components/frontend/src/App.js index 6ee06731d5..0dc59896da 100644 --- a/components/frontend/src/App.js +++ b/components/frontend/src/App.js @@ -1,6 +1,6 @@ import "./App.css" -import { createTheme, ThemeProvider } from "@mui/material/styles" +import { ThemeProvider } from "@mui/material/styles" import { Action } from "history" import history from "history/browser" import { Component } from "react" @@ -11,16 +11,10 @@ import { nr_measurements_api } from "./api/measurement" import { get_report, get_reports_overview } from "./api/report" import { AppUI } from "./AppUI" import { registeredURLSearchParams } from "./hooks/url_search_query" +import { theme } from "./theme" import { isValidDate_YYYYMMDD, toISODateStringInCurrentTZ } from "./utils" import { showConnectionMessage, showMessage } from "./widgets/toast" -const theme = createTheme({ - colorSchemes: { - dark: true, // Add a dark theme (light theme is available by default) - }, - components: { MuiTooltip: { defaultProps: { arrow: true }, styleOverrides: { tooltip: { fontSize: "1em" } } } }, -}) - class App extends Component { constructor(props) { super(props) diff --git a/components/frontend/src/AppUI.js b/components/frontend/src/AppUI.js index 4b35645ba8..7494a249df 100644 --- a/components/frontend/src/AppUI.js +++ b/components/frontend/src/AppUI.js @@ -66,65 +66,55 @@ export function AppUI({ } const darkMode = userPrefersDarkMode(mode) - const backgroundColor = darkMode ? "rgb(40, 40, 40)" : "white" return ( -
- - - - - } - settings={settings} - setUIMode={setMode} - uiMode={mode} - /> - - - - - - -
- - -
+ + + + + } + settings={settings} + setUIMode={setMode} + uiMode={mode} + /> + + + + + + +