From bf8da6da3c583b2f7cbf16180cfed89c6bc2bef6 Mon Sep 17 00:00:00 2001 From: rbokhorst <rbokhorst@astron.nl> Date: Mon, 22 Oct 2018 12:47:46 +0000 Subject: [PATCH] OSB-29: cleanup --- .../MDB_WebView/maintenancedb_view/src/App.js | 10 ++-------- .../src/components/StationTestSummary.js | 11 ++++------- .../MDB_WebView/maintenancedb_view/src/index.js | 1 - .../maintenancedb_view/src/utils/autoLoader.js | 4 ---- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/App.js b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/App.js index 9d19c0c0910..96d66c71a26 100644 --- a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/App.js +++ b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/App.js @@ -3,7 +3,6 @@ import LandingPage from './pages/LandingPage.js' import StationOverviewPage from './pages/StationOverviewPage.js' import TilesPage from './pages/TilesPage.js' import DetailsPage from './pages/DetailsPage.js' -import Header from './components/header.js' import { connect } from "react-redux"; import { fetchErrorTypes } from "./redux/actions/appInitData.js"; @@ -12,24 +11,19 @@ import { fetchErrorTypes } from "./redux/actions/appInitData.js"; import './App.css'; import { BrowserRouter as Router, - Route, - Link + Route } from 'react-router-dom'; class AppC extends Component { - constructor(props){ - super(props); - } - componentDidMount( ) { + // Load initial application data this.props.dispatch(fetchErrorTypes()); } render(){ - console.log(this.props.location); return ( <Router> <div> diff --git a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/components/StationTestSummary.js b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/components/StationTestSummary.js index ccb8efd0962..638adb6aefc 100644 --- a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/components/StationTestSummary.js +++ b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/components/StationTestSummary.js @@ -1,10 +1,9 @@ import React, { Component } from 'react'; import { connect } from "react-redux"; -import { Table, Popover, PopoverHeader, PopoverBody, Button, ButtonGroup } from 'reactstrap'; -import { unique_id, capitalize } from '../utils/utils.js' +import { Table, Button } from 'reactstrap'; +import { unique_id } from '../utils/utils.js' import { componentErrorTypes } from '../utils/constants.js' import AutoLoadWrapper from '../utils/autoLoader.js' -import axios from 'axios'; //import stdata from '../testdata/station_test_summary.js' @@ -72,8 +71,6 @@ class ToolBar extends Component { */ class StationTestSummaryC extends Component { - static errorTypesURL = '/api/view/ctrl_list_component_error_types'; - activeErrorTypes = []; // Result of filtering state.errorTypes state = { @@ -129,7 +126,7 @@ class StationTestSummaryC extends Component { prevDate = null; this.props.data.forEach( (stationData) => { - let date = (stationData.date != prevDate ? stationData.date : ""); + let date = (stationData.date !== prevDate ? stationData.date : ""); let components = Object.keys(stationData.component_error_summary).sort(); let station = stationData.station_name; let time = (stationData.start_datetime.match(/T(.*):..Z/))[1]; @@ -156,7 +153,6 @@ class StationTestSummaryC extends Component { } render() { - console.log("render stationTestSummary"); this.setActiveErrorTypes(); @@ -188,6 +184,7 @@ class StationTestSummaryC extends Component { } +// Map the appInitData from store for the error types const mapStateToProps = state => { return { ...state.appInitData }; }; diff --git a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/index.js b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/index.js index 239f1053f0d..560ea3fe281 100644 --- a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/index.js +++ b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/index.js @@ -4,7 +4,6 @@ import './index.css'; import App from './App'; import 'bootstrap/dist/css/bootstrap.min.css'; import registerServiceWorker from './registerServiceWorker'; -import { BrowserRouter } from 'react-router-dom' // Redux import { Provider } from "react-redux"; diff --git a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/utils/autoLoader.js b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/utils/autoLoader.js index c6fd9b85eb8..953aff96601 100644 --- a/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/utils/autoLoader.js +++ b/LCU/Maintenance/MDB_WebView/maintenancedb_view/src/utils/autoLoader.js @@ -26,7 +26,6 @@ function AutoLoadWrapper(WrappedComponent) { static getDerivedStateFromProps(props, state) { // Store prevUrl in state so we can compare when props change. if (props.url !== state.prevUrl) { - console.log('getDerived; '); return { isLoading: true, prevUrl: props.url @@ -78,14 +77,12 @@ function AutoLoadWrapper(WrappedComponent) { } componentDidMount() { - console.log('did mount'); this.fetchData(); this._intervalId = setInterval(() => this.fetchData(), this.props.reloadInterval); } componentDidUpdate(prevProps, prevState) { if (prevProps.url !== this.props.url) { - console.log('props changed: ' + prevProps.url+ ' '+this.props.url); this.fetchData(); } } @@ -95,7 +92,6 @@ function AutoLoadWrapper(WrappedComponent) { } render() { - console.log('render', this); let loadingHtml = ""; if (this.state.isLoading) { loadingHtml = <div className="alLoading"></div>; -- GitLab