From 7e23087bb52ae2bff56fe8ce660df794d1f38425 Mon Sep 17 00:00:00 2001 From: pepper Date: Sun, 17 Jan 2021 22:53:32 -0500 Subject: [PATCH] Changed table pages into generic --- src/components/App.js | 24 ++++++++-- .../Pages/{Upcoming.js => GenericList.js} | 9 ++-- src/components/root/Pages/Historical.js | 47 ------------------- src/components/root/Pages/Reports.js | 7 ++- 4 files changed, 31 insertions(+), 56 deletions(-) rename src/components/root/Pages/{Upcoming.js => GenericList.js} (83%) delete mode 100644 src/components/root/Pages/Historical.js diff --git a/src/components/App.js b/src/components/App.js index 43f5f54..f18c6aa 100644 --- a/src/components/App.js +++ b/src/components/App.js @@ -2,9 +2,8 @@ import React, { Component } from "react"; import { BrowserRouter as Router, Route, Switch } from "react-router-dom"; // Routes -import Upcoming from "./root/Pages/Upcoming"; import Migrations from "./root/Pages/Migrations"; -import Historical from "./root/Pages/Historical"; +import GenericList from "./root/Pages/GenericList"; import Reports from "./root/Pages/Reports"; import Book from "./root/Pages/Book"; import IDSingle from "./root/Pages/IDSingle"; @@ -12,6 +11,7 @@ import IDSingle from "./root/Pages/IDSingle"; import Home from "./root/Home"; import Navigation from "./root/Navigation"; + // Main app component, react-router comes from here, // and links to all of the sub pages @@ -24,11 +24,27 @@ class App extends Component { - - + ( + + )} /> + ( + + )} /> + ( + + )} /> + ( + + )} /> + ( + + )} /> + ( + + )} /> diff --git a/src/components/root/Pages/Upcoming.js b/src/components/root/Pages/GenericList.js similarity index 83% rename from src/components/root/Pages/Upcoming.js rename to src/components/root/Pages/GenericList.js index 2c83291..e6171cb 100644 --- a/src/components/root/Pages/Upcoming.js +++ b/src/components/root/Pages/GenericList.js @@ -3,13 +3,13 @@ import CompTable from "../common/Tables/CompTable"; import { callAPI } from "../../actions/API" import Error from "../../actions/Error"; -// Upcoming parent page, +// Missing parent page, // Most of the good stuff is happening in UpcomingSingle, which does the // main rendering of the table, // may want to eventually do the API call here, to re-use the table // instead of duplicating it. -class Upcoming extends Component { +class GenericList extends Component { constructor(props) { super(props); this.state = { @@ -18,8 +18,9 @@ class Upcoming extends Component { } renderItems() { + console.log(this.props.APILINK) if (!this.state.error) { - return ; + return ; } else { console.log("error"); return ; @@ -43,4 +44,4 @@ class Upcoming extends Component { } } -export default Upcoming; +export default GenericList; diff --git a/src/components/root/Pages/Historical.js b/src/components/root/Pages/Historical.js deleted file mode 100644 index 379b1a0..0000000 --- a/src/components/root/Pages/Historical.js +++ /dev/null @@ -1,47 +0,0 @@ -import React, { Component } from "react"; - -import { callAPI } from "../../actions/API"; -import CompTable from "../common/Tables/CompTable"; -import Error from "../../actions/Error"; - -// Parent page for the /historical-migrations page, -// is referenced in the react route, and calls the main table using -// HIstoricalSingle, -// All migrations are called, and can be searched -// It actuall does error reporting, using `renderItems` - -class Historical extends Component { - constructor(props) { - super(props); - this.state = { - error: false, - }; - } - - renderItems() { - if (!this.state.error) { - return ; - } else { - console.log("error"); - return ; - } - } - - render() { - return ( -
-
-
-
-
-
-
-
{this.renderItems()}
-
-
-
- ); - } -} - -export default Historical; diff --git a/src/components/root/Pages/Reports.js b/src/components/root/Pages/Reports.js index 3ee1b12..d7d899d 100644 --- a/src/components/root/Pages/Reports.js +++ b/src/components/root/Pages/Reports.js @@ -1,4 +1,6 @@ import React, { Component } from "react"; +import { Link } from "react-router-dom"; + // This page was should hold a way to generate reports/lists of // Migrations in varied statuses. @@ -7,7 +9,10 @@ export default class Reports extends Component { render() { return (
-

Reports

+ Missed migrations

+ Upcoming Terminations

+ All waiting terminations

+ Completed Migrations

); }