Archived
Dashboard is now clean
This commit is contained in:
1 parent
fe2477c921
commit
7b19edccb6
13 files changed
+363
-149
No files matched your search
@@ -1,38 +0,0 @@
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
}
|
||||
+22
-44
@@ -1,55 +1,33 @@
|
||||
import React, { Component } from 'react';
|
||||
import './App.css';
|
||||
import Migrations from './Migrations/Migrations';
|
||||
import SideMigrations from './Migrations/SideMigrations';
|
||||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
|
||||
|
||||
|
||||
// Routes
|
||||
import Upcoming from './root/Upcoming';
|
||||
import Reports from './root/Reports';
|
||||
import Historical from './root/Historical';
|
||||
|
||||
// Components
|
||||
import Home from './root/Home'
|
||||
import Navigation from './root/Navigation';
|
||||
|
||||
class App extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
migs1: {
|
||||
type: 'top-headlines',
|
||||
query: 'migration_status'
|
||||
},
|
||||
migs2: {
|
||||
type: 'top-headlines',
|
||||
query: 'country=us&category=business'
|
||||
},
|
||||
migs3: {
|
||||
type: 'top-headlines',
|
||||
query: 'sources=bbc-news'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="container-fluid">
|
||||
<div className="navbar-fixed">
|
||||
<nav>
|
||||
<div className="nav-wrapper">
|
||||
<a href="/" className="brand-logo center">Logo</a>
|
||||
<ul id="nav-mobile" className="left hide-on-med-and-down">
|
||||
<li className="active"><a href="/">Dashboard</a></li>
|
||||
<li><a href="/">Upcoming Migrations</a></li>
|
||||
<li><a href="/">Reports</a></li>
|
||||
<li><a href="/">Historical Migrations</a></li>
|
||||
<Router>
|
||||
<div className="container-fluid">
|
||||
<Navigation />
|
||||
<Switch>
|
||||
<Route exact path="/" component={Home} />
|
||||
<Route exact path="/upcoming-migrations" component={Upcoming} />
|
||||
<Route exact path="/reports" component={Reports} />
|
||||
<Route exact path="/historical-migrations" component={Historical} />
|
||||
</Switch>
|
||||
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
<div className="row">
|
||||
<div className="col s8">
|
||||
<Migrations migs={this.state.migs1} />
|
||||
<Migrations migs={this.state.migs2} />
|
||||
</div>
|
||||
<div className="col s4">
|
||||
<SideMigrations migs={this.state.migs3} />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,10 @@ const Error = () => (
|
||||
<div>
|
||||
|
||||
|
||||
<div class="card-panel blue-grey darken-1">
|
||||
<div class="card-content white-text">
|
||||
<div className="card-panel blue-grey darken-1">
|
||||
<div className="card-content white-text">
|
||||
<center>
|
||||
<span class="card-title"><i className="large material-icons">do_not_disturb</i></span>
|
||||
<span className="card-title"><i className="large material-icons">do_not_disturb</i></span>
|
||||
</center>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,21 +1,22 @@
|
||||
import React from 'react';
|
||||
import React from "react";
|
||||
|
||||
const MigrationSingle = ({ item }) => (
|
||||
|
||||
<div className="col s4 m4">
|
||||
<div className="card-panel">
|
||||
<div className="card-content black-text">
|
||||
<ul className="collection with-header">
|
||||
<li className="collection-header"><a href={item.id}><p>{item.migration_status}</p></a></li>
|
||||
<li className="collection-item">{item.domain}</li>
|
||||
<li className="collection-item">{item.booked_time}</li>
|
||||
<li className="collection-item">{item.migration_status}</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div className="col s4 m4">
|
||||
<div className="card-panel">
|
||||
<div className="card-content black-text">
|
||||
<ul className="collection with-header">
|
||||
<li className="collection-header">
|
||||
<a href={item.id}>
|
||||
<p>{item.migration_status}</p>
|
||||
</a>
|
||||
</li>
|
||||
<li className="collection-item">{item.domain}</li>
|
||||
<li className="collection-item">{item.booked_time}</li>
|
||||
<li className="collection-item">{item.migration_status}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
|
||||
export default MigrationSingle;
|
||||
@@ -1,58 +1,98 @@
|
||||
import React, { Component } from 'react';
|
||||
import axios from 'axios';
|
||||
import MigrationSingle from './MigrationSingle';
|
||||
import Error from './Error';
|
||||
import React, { Component } from "react";
|
||||
import axios from "axios";
|
||||
|
||||
import MigrationSingle from "./MigrationSingle";
|
||||
import Error from "./Error";
|
||||
|
||||
class Migrations extends Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
migs: [],
|
||||
error: false,
|
||||
};
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
migs: [],
|
||||
migs1: [],
|
||||
error: false,
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const url = `https://devapi.benjamyn.love/migrations/`;
|
||||
|
||||
axios
|
||||
.get(url)
|
||||
.then((response) => {
|
||||
this.setState({
|
||||
migs: response.data,
|
||||
migs1: response.data.migration_status,
|
||||
});
|
||||
})
|
||||
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
error: true,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
renderItems() {
|
||||
if (!this.state.error) {
|
||||
return this.state.migs.map((item) => (
|
||||
<MigrationSingle key={item.id} item={item} />
|
||||
));
|
||||
} else {
|
||||
return <Error />;
|
||||
}
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const url = `https://devapi.benjamyn.love/migrations/`;
|
||||
bookedMig() {
|
||||
return this.state.migs.filter(
|
||||
(booked) => booked.migration_status === "Booked"
|
||||
).length;
|
||||
}
|
||||
waitingMig() {
|
||||
return this.state.migs.filter(
|
||||
(waiting) => waiting.migration_status === "Waiting Termination"
|
||||
).length;
|
||||
}
|
||||
completedMig() {
|
||||
return this.state.migs.filter(
|
||||
(complete) => complete.migration_status === "Completed"
|
||||
).length;
|
||||
}
|
||||
|
||||
axios.get(url)
|
||||
.then((response) => {
|
||||
this.setState({
|
||||
migs: response.data
|
||||
});
|
||||
|
||||
})
|
||||
|
||||
.catch((error) => {
|
||||
this.setState({
|
||||
error: true
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
renderItems() {
|
||||
if (!this.state.error) {
|
||||
return this.state.migs.map((item) => (
|
||||
<MigrationSingle key={item.id} item={item} />
|
||||
));
|
||||
} else {
|
||||
return <Error />
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
{this.state.migs.filter(mig => mig.migration_status = ('Booked')).map(filteredMig => (
|
||||
<div className="col s3">
|
||||
{filteredMig.migration_status}
|
||||
</div>
|
||||
))};
|
||||
render() {
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col s6 m4">
|
||||
<div className="card blue-grey darken-1">
|
||||
<div className="card-content white-text">
|
||||
<span className="card-title">Booked Migrations</span>
|
||||
{this.bookedMig()}
|
||||
</div>
|
||||
<div className="card-action">View all...</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
</div>
|
||||
<div className="col s6 m4">
|
||||
<div className="card blue-grey darken-1">
|
||||
<div className="card-content white-text">
|
||||
<span className="card-title">Waiting Termination</span>
|
||||
{this.waitingMig()}
|
||||
</div>
|
||||
<div className="card-action">View all...</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="col s6 m4">
|
||||
<div className="card blue-grey darken-1">
|
||||
<div className="card-content white-text">
|
||||
<span className="card-title">Completed</span>
|
||||
{this.completedMig()}
|
||||
</div>
|
||||
<div className="card-action">View all...</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default Migrations;
|
||||
Whitespace-only changes.
@@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
const Historical = () => {
|
||||
return (
|
||||
<h1>Historical</h1>
|
||||
);
|
||||
}
|
||||
|
||||
export default Historical;
|
||||
@@ -0,0 +1,41 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
import Migrations from '../Migrations/Migrations';
|
||||
import SideMigrations from '../Migrations/SideMigrations';
|
||||
|
||||
export class Home extends Component {
|
||||
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
migs1: {
|
||||
type: 'top-headlines',
|
||||
query: 'migration_status'
|
||||
},
|
||||
migs2: {
|
||||
type: 'top-headlines',
|
||||
query: 'country=us&category=business'
|
||||
},
|
||||
migs3: {
|
||||
type: 'top-headlines',
|
||||
query: 'sources=bbc-news'
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="row">
|
||||
<div className="col s8">
|
||||
<Migrations />
|
||||
|
||||
</div>
|
||||
<div className="col s4">
|
||||
<SideMigrations migs={this.state.migs3} />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
||||
@@ -0,0 +1,23 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
export class Navigation extends Component {
|
||||
render() {
|
||||
return (
|
||||
<nav>
|
||||
<div className="navbar-fixed">
|
||||
<div className="nav-wrapper">
|
||||
<ul className="left hide-on-med-and-down">
|
||||
<li><Link className="active" to="/">Dashboard</Link></li>
|
||||
<li><Link to="/upcoming-migrations">Upcoming Migrations</Link></li>
|
||||
<li><Link to="/reports">Reports</Link></li>
|
||||
<li><Link to="/historical-migrations">Historical Migrations</Link></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export default Navigation
|
||||
@@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
const Reports = () => {
|
||||
return (
|
||||
<h1>Reports</h1>
|
||||
);
|
||||
}
|
||||
|
||||
export default Reports;
|
||||
@@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
const Upcoming = () => {
|
||||
return (
|
||||
<h1>Upcoming</h1>
|
||||
);
|
||||
}
|
||||
|
||||
export default Upcoming;
|
||||
Reference in new issue
Block a user