diff --git a/package-lock.json b/package-lock.json
index 2c77c65..ab5b992 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2010,6 +2010,17 @@
"resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.5.4.tgz",
"integrity": "sha512-ZpKr+WTb8zsajqgDkvCEWgp6d5eJT6Q63Ng2neTbzBO76Lbe91vX/iVIW9dikq+Fs3yEo+ls4cxeXABD2LtcbQ=="
},
+ "@reach/router": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/@reach/router/-/router-1.3.4.tgz",
+ "integrity": "sha512-+mtn9wjlB9NN2CNnnC/BRYtwdKBfSyyasPYraNAyvaV1occr/5NnB4CVzjEZipNHwYebQwcndGUmpFzxAUoqSA==",
+ "requires": {
+ "create-react-context": "0.3.0",
+ "invariant": "^2.2.3",
+ "prop-types": "^15.6.1",
+ "react-lifecycles-compat": "^3.0.4"
+ }
+ },
"@restart/context": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/@restart/context/-/context-2.1.4.tgz",
diff --git a/package.json b/package.json
index 3236da7..a1f5b7d 100644
--- a/package.json
+++ b/package.json
@@ -5,6 +5,7 @@
"dependencies": {
"@date-io/date-fns": "^2.10.6",
"@material-ui/pickers": "^3.2.10",
+ "@reach/router": "^1.3.4",
"@testing-library/jest-dom": "^5.11.5",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
diff --git a/public/index.html b/public/index.html
index a10b1fc..7432a06 100644
--- a/public/index.html
+++ b/public/index.html
@@ -4,7 +4,7 @@
+ href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14/svgs/solid/book.svg" />
diff --git a/src/components/App.js b/src/components/App.js
index 5b49e7d..4ab896a 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -6,6 +6,7 @@ import Upcoming from "./root/Pages/Upcoming";
import Reports from "./root/Pages/Reports";
import Historical from "./root/Pages/Historical";
import Book from "./root/Pages/Book";
+import IDSingle from "./root/Pages/IDSingle";
// Components
import Home from "./root/Home";
import Navigation from "./root/Navigation";
@@ -22,6 +23,7 @@ class App extends Component {
+
diff --git a/src/components/root/Home.js b/src/components/root/Home.js
index 9015c85..b5ca84f 100644
--- a/src/components/root/Home.js
+++ b/src/components/root/Home.js
@@ -9,7 +9,6 @@ export class Home extends Component {
super(props);
this.state = {
migs: [],
- error: false,
};
}
@@ -27,6 +26,7 @@ export class Home extends Component {
});
});
}
+
render() {
return (
@@ -51,7 +51,7 @@ export class Home extends Component {
diff --git a/src/components/root/Navigation.js b/src/components/root/Navigation.js
index bb0ac15..305c549 100644
--- a/src/components/root/Navigation.js
+++ b/src/components/root/Navigation.js
@@ -13,9 +13,6 @@ export class Navigation extends Component {
Dashboard
-
- Book
-
Upcoming Migrations
@@ -25,6 +22,9 @@ export class Navigation extends Component {
Historical Migrations
+
+ Book
+
diff --git a/src/components/root/Pages/AllReports/GetSingleMigration.js b/src/components/root/Pages/AllReports/GetSingleMigration.js
index 23fdcc0..168072b 100644
--- a/src/components/root/Pages/AllReports/GetSingleMigration.js
+++ b/src/components/root/Pages/AllReports/GetSingleMigration.js
@@ -4,7 +4,6 @@ import { Col, FormGroup, Row, Container, Label } from "reactstrap";
import { Formik, Form } from "formik";
import { Input, Submit } from "formstrap";
import { callAPI } from "../../../actions/API";
-import ShowMigrations from "./ShowMigrations";
const initialValues = {
submit_time: moment().format("YYYY-MM-DD"),
@@ -55,7 +54,7 @@ export default class GetSingleMigration extends Component {
-
+ {/* */}
);
}
diff --git a/src/components/root/Pages/AllReports/IdSearchForm.js b/src/components/root/Pages/AllReports/IdSearchForm.js
new file mode 100644
index 0000000..e341303
--- /dev/null
+++ b/src/components/root/Pages/AllReports/IdSearchForm.js
@@ -0,0 +1,32 @@
+import React from "react";
+
+import { Col, FormGroup, Row, Container, Label } from "reactstrap";
+import { Formik, Form } from "formik";
+import { Input, Submit } from "formstrap";
+
+export default function IdSearchForm({ api }) {
+ const initialValues = {};
+
+ return (
+
+
+
+
+
+ );
+}
diff --git a/src/components/root/Pages/Forms/CPanelBooking.js b/src/components/root/Pages/Forms/CPanelBooking.js
index 523df0e..efbacf3 100644
--- a/src/components/root/Pages/Forms/CPanelBooking.js
+++ b/src/components/root/Pages/Forms/CPanelBooking.js
@@ -11,8 +11,7 @@ export const CPanelBooking = () => {
submit_time: moment().format("YYYY-MM-DD"),
};
- const onSubmit = async (values, { setSubmitting }) => {
- console.log(values);
+ const onSubmit = async (values, { setSubmitting, resetForm }) => {
callAPI
.post("/", values)
.then(function (response) {
@@ -23,6 +22,7 @@ export const CPanelBooking = () => {
console.log(error);
});
setSubmitting(false);
+ resetForm({ values: "" });
};
return (
@@ -168,7 +168,7 @@ export const CPanelBooking = () => {
- Save
+ Submit
diff --git a/src/components/root/Pages/IDSingle.js b/src/components/root/Pages/IDSingle.js
new file mode 100644
index 0000000..40e7c5d
--- /dev/null
+++ b/src/components/root/Pages/IDSingle.js
@@ -0,0 +1,29 @@
+import React, { Component } from "react";
+
+import ReportSingleMigration from "./Migrations/ReportSingleMigration";
+import { callAPI } from "../../actions/API";
+
+export default class Reports extends Component {
+ render() {
+ const migrationId = ({ migrationId }) => {
+ console.log(migrationId.migrationId);
+ callAPI
+ .get(`/${migrationId.migrationId}/`)
+ .then((response) =>
+ this.setState({
+ redirect: true,
+ migs: response.data,
+ })
+ )
+ .catch(function (error) {
+ console.log(error);
+ });
+ };
+
+ return (
+
+
+
+ );
+ }
+}
diff --git a/src/components/root/Pages/Migrations.js b/src/components/root/Pages/Migrations.js
index af09e21..0c55fcf 100644
--- a/src/components/root/Pages/Migrations.js
+++ b/src/components/root/Pages/Migrations.js
@@ -1,19 +1,6 @@
import React, { Component } from "react";
-import MigrationSingle from "./Migrations/MigrationSingle";
-import Error from "../../actions/Error";
-
class Migrations extends Component {
- renderItems() {
- if (!this.props.error) {
- return this.props.migs.map((item) => (
-
- ));
- } else {
- return ;
- }
- }
-
bookedMig() {
return this.props.migs.filter(
(booked) => booked.migration_status === "Booked"
diff --git a/src/components/root/Pages/Migrations/ReportSingleMigration.js b/src/components/root/Pages/Migrations/ReportSingleMigration.js
new file mode 100644
index 0000000..5b06dde
--- /dev/null
+++ b/src/components/root/Pages/Migrations/ReportSingleMigration.js
@@ -0,0 +1,198 @@
+import React from "react";
+import "bootstrap/dist/css/bootstrap.min.css";
+import { Col, FormGroup, Row, Container, Label } from "reactstrap";
+import { Formik, Form } from "formik";
+import { Input, Submit } from "formstrap";
+import { callAPI } from "../../../actions/API";
+
+const ReportSingleMigration = ({ item }) => {
+ const initialValues = {
+ submit_time: item.submit_time,
+ domain: item.domain,
+ booked_date: item.booked_date,
+ booked_time: item.booked_time,
+ username: item.username,
+ original_server: item.original_server,
+ new_server: item.new_server,
+ brand: item.brand,
+ ticket_id: item.ticket_id,
+ migration_type: item.migration_type,
+ agent_booked: item.agent_booked,
+ additional_domains: item.additional_domains,
+ term_date: item.term_date,
+ notes: item.notes,
+ };
+
+ const onSubmit = async (values, { setSubmitting }) => {
+ callAPI
+ .put(`/${item.id}/`, values)
+ .then(function (response) {
+ console.log(JSON.stringify(response.values));
+ })
+ .catch(function (error) {
+ console.log(error);
+ });
+ setSubmitting(false);
+ };
+ return (
+
+
+
+ );
+};
+
+export default ReportSingleMigration;
diff --git a/src/components/root/Pages/Migrations/SideMigrations.js b/src/components/root/Pages/Migrations/SideMigrations.js
index cfd4bc3..569e05c 100644
--- a/src/components/root/Pages/Migrations/SideMigrations.js
+++ b/src/components/root/Pages/Migrations/SideMigrations.js
@@ -1,22 +1,29 @@
import React, { Component } from "react";
-
import { SingleSide } from "./SingleSide";
+import { callAPI } from "../../../actions/API";
-class SideMigrations extends Component {
+export default class SideMigrations extends Component {
constructor(props) {
super(props);
this.state = {
migs: [],
- e: false,
};
}
-
+ componentDidMount() {
+ callAPI
+ .get("/pending/")
+ .then((request) => {
+ this.setState({
+ migs: request.data,
+ });
+ })
+ .catch((error) => {
+ this.setState({
+ error: true,
+ });
+ });
+ }
render() {
- return ;
+ return ;
}
}
-
-export default SideMigrations;
-
-//return
-//
diff --git a/src/components/root/Pages/Reports.js b/src/components/root/Pages/Reports.js
index 27bf59f..685874d 100644
--- a/src/components/root/Pages/Reports.js
+++ b/src/components/root/Pages/Reports.js
@@ -1,9 +1,41 @@
-import React from "react";
+import React, { Component } from "react";
-import GetSingleMigration from "./AllReports/GetSingleMigration";
+import IdSearchForm from "./AllReports/IdSearchForm";
+import ReportSingleMigration from "./Migrations/ReportSingleMigration";
+import { callAPI } from "../../actions/API";
-const Reports = () => {
- return ;
-};
+export default class Reports extends Component {
+ constructor(props) {
+ super(props);
+ this.state = {
+ migs: [],
+ redirect: false,
+ };
+ }
-export default Reports;
+ render() {
+ const onSubmit = async (migrationId, { setSubmitting }) => {
+ callAPI
+ .get(`/${migrationId.migrationId}/`)
+ .then((response) =>
+ this.setState({
+ redirect: true,
+ migs: response.data,
+ })
+ )
+ .catch(function (error) {
+ console.log(error);
+ });
+ setSubmitting(false);
+ };
+ return (
+
+
+
+
+ );
+ }
+}