Compare commits
No commits in common. "2d4442fe763fc7fc599879f1465730e7b97298eb" and "9fffa88a1f3112874c9359b62e6ad65964c362c6" have entirely different histories.
2d4442fe76
...
9fffa88a1f
@ -2,8 +2,9 @@ import React, { Component } from "react";
|
|||||||
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
|
import { BrowserRouter as Router, Route, Switch } from "react-router-dom";
|
||||||
|
|
||||||
// Routes
|
// Routes
|
||||||
|
import Upcoming from "./root/Pages/Upcoming";
|
||||||
import Migrations from "./root/Pages/Migrations";
|
import Migrations from "./root/Pages/Migrations";
|
||||||
import GenericList from "./root/Pages/GenericList";
|
import Historical from "./root/Pages/Historical";
|
||||||
import Reports from "./root/Pages/Reports";
|
import Reports from "./root/Pages/Reports";
|
||||||
import Book from "./root/Pages/Book";
|
import Book from "./root/Pages/Book";
|
||||||
import IDSingle from "./root/Pages/IDSingle";
|
import IDSingle from "./root/Pages/IDSingle";
|
||||||
@ -11,7 +12,6 @@ import IDSingle from "./root/Pages/IDSingle";
|
|||||||
import Home from "./root/Home";
|
import Home from "./root/Home";
|
||||||
import Navigation from "./root/Navigation";
|
import Navigation from "./root/Navigation";
|
||||||
|
|
||||||
|
|
||||||
// Main app component, react-router comes from here,
|
// Main app component, react-router comes from here,
|
||||||
// and links to all of the sub pages
|
// and links to all of the sub pages
|
||||||
|
|
||||||
@ -24,27 +24,11 @@ class App extends Component {
|
|||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path="/" component={Home} />
|
<Route exact path="/" component={Home} />
|
||||||
<Route exact path="/book" component={Book} />
|
<Route exact path="/book" component={Book} />
|
||||||
|
<Route exact path="/upcoming-migrations" component={Upcoming} />
|
||||||
<Route exact path="/migrations" component={Migrations} />
|
<Route exact path="/migrations" component={Migrations} />
|
||||||
<Route exact path="/reports" component={Reports} />
|
<Route exact path="/reports" component={Reports} />
|
||||||
|
<Route exact path="/historical-migrations" component={Historical} />
|
||||||
<Route path="/migrations/:migrationId" component={IDSingle} />
|
<Route path="/migrations/:migrationId" component={IDSingle} />
|
||||||
<Route exact path="/upcoming-migrations" render={(props) => (
|
|
||||||
<GenericList {...props} APILINK="/pending/" />
|
|
||||||
)} />
|
|
||||||
<Route exact path="/missed" render={(props) => (
|
|
||||||
<GenericList {...props} APILINK="/missed/" />
|
|
||||||
)} />
|
|
||||||
<Route exact path="/completed" render={(props) => (
|
|
||||||
<GenericList {...props} APILINK="/completed/" />
|
|
||||||
)} />
|
|
||||||
<Route exact path="/pending-terminations" render={(props) => (
|
|
||||||
<GenericList {...props} APILINK="/pendingterm/" />
|
|
||||||
)} />
|
|
||||||
<Route exact path="/all-terminations" render={(props) => (
|
|
||||||
<GenericList {...props} APILINK="/waitingterm/" />
|
|
||||||
)} />
|
|
||||||
<Route exact path="/historical-migrations" render={(props) => (
|
|
||||||
<GenericList {...props} APILINK="/all/" />
|
|
||||||
)} />
|
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
|
|||||||
@ -44,7 +44,7 @@ class Cards extends Component {
|
|||||||
{this.waitingMig()}
|
{this.waitingMig()}
|
||||||
</div>
|
</div>
|
||||||
<div className="card-action">
|
<div className="card-action">
|
||||||
<a href="/pending-terminations">waiting</a>
|
<a href="/upcoming-migrations">waiting</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -56,7 +56,7 @@ class Cards extends Component {
|
|||||||
{this.completedMig()}
|
{this.completedMig()}
|
||||||
</div>
|
</div>
|
||||||
<div className="card-action">
|
<div className="card-action">
|
||||||
<a href="/completed">complete</a>
|
<a href="/historical-migrations">complete</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -67,7 +67,7 @@ class Cards extends Component {
|
|||||||
{this.missedMig()}
|
{this.missedMig()}
|
||||||
</div>
|
</div>
|
||||||
<div className="card-action">
|
<div className="card-action">
|
||||||
<a href="/missed">missed</a>
|
<a href="/historical-migrations">missed</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
47
src/components/root/Pages/Historical.js
Normal file
47
src/components/root/Pages/Historical.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
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 <CompTable data={callAPI('/all/')} />;
|
||||||
|
} else {
|
||||||
|
console.log("error");
|
||||||
|
return <Error />;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return (
|
||||||
|
<div className="row">
|
||||||
|
<div className="divider"></div>
|
||||||
|
<div className="section">
|
||||||
|
<div className="col s12"></div>
|
||||||
|
</div>
|
||||||
|
<div className="divider"></div>
|
||||||
|
<div className="section">
|
||||||
|
<div className="col s12">{this.renderItems()}</div>
|
||||||
|
</div>
|
||||||
|
<div className="divider"></div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default Historical;
|
||||||
@ -1,6 +1,4 @@
|
|||||||
import React, { Component } from "react";
|
import React, { Component } from "react";
|
||||||
import { Link } from "react-router-dom";
|
|
||||||
|
|
||||||
|
|
||||||
// This page was should hold a way to generate reports/lists of
|
// This page was should hold a way to generate reports/lists of
|
||||||
// Migrations in varied statuses.
|
// Migrations in varied statuses.
|
||||||
@ -9,10 +7,7 @@ export default class Reports extends Component {
|
|||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Link to="/missed">Missed migrations</Link><p />
|
<h1>Reports</h1>
|
||||||
<Link to="/pending-terminations">Upcoming Terminations</Link><p />
|
|
||||||
<Link to="/all-terminations">All waiting terminations</Link><p />
|
|
||||||
<Link to="/completed">Completed Migrations</Link><p />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,13 +3,13 @@ import CompTable from "../common/Tables/CompTable";
|
|||||||
import { callAPI } from "../../actions/API"
|
import { callAPI } from "../../actions/API"
|
||||||
import Error from "../../actions/Error";
|
import Error from "../../actions/Error";
|
||||||
|
|
||||||
// Missing parent page,
|
// Upcoming parent page,
|
||||||
// Most of the good stuff is happening in UpcomingSingle, which does the
|
// Most of the good stuff is happening in UpcomingSingle, which does the
|
||||||
// main rendering of the table,
|
// main rendering of the table,
|
||||||
// may want to eventually do the API call here, to re-use the table
|
// may want to eventually do the API call here, to re-use the table
|
||||||
// instead of duplicating it.
|
// instead of duplicating it.
|
||||||
|
|
||||||
class GenericList extends Component {
|
class Upcoming extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
@ -18,9 +18,8 @@ class GenericList extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderItems() {
|
renderItems() {
|
||||||
console.log(this.props.APILINK)
|
|
||||||
if (!this.state.error) {
|
if (!this.state.error) {
|
||||||
return <CompTable data={callAPI(this.props.APILINK)} />;
|
return <CompTable data={callAPI('/pending/')} />;
|
||||||
} else {
|
} else {
|
||||||
console.log("error");
|
console.log("error");
|
||||||
return <Error />;
|
return <Error />;
|
||||||
@ -44,4 +43,4 @@ class GenericList extends Component {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default GenericList;
|
export default Upcoming;
|
||||||
Reference in New Issue
Block a user