Compare commits

...

5 Commits

13 changed files with 503 additions and 63 deletions

18
01-build.sh Normal file
View File

@ -0,0 +1,18 @@
#!/bin/bash
# Author: Ben&Jamyn
# Date: 21/01/2021
PROJ_DIR="/home/dev/MigratorProject-frontend"
DEPLOY_PATH="/home/mxpoopzxzx"
echo "Removing old build files"
# Remove old build files
rm -rf $PROJ_DIR/build*
echo "Building site and creating zip"
# Build the site and zip it with the .htaccess
npm run-script build && cd build && zip -r $PROJ_DIR/build.zip * && \
zip -r $PROJ_DIR/build.zip .htaccess* && echo "Successfully built" || echo "Build Failed"
scp -P 2683 $PROJ_DIR/build.zip mxpoopzxzx@s02cd.syd6.hostingplatform.net.au:$DEPLOY_PATH
ssh -p 2683 mxpoopzxzx@s02cd.syd6.hostingplatform.net.au "bash $DEPLOY_PATH/deploy-tracker.sh"

6
deploy-tracker.sh Normal file
View File

@ -0,0 +1,6 @@
DEPLOY_PATH="/home/mxpoopzxzx/migration-tracker.pnet.app"
rm -rf $DEPLOY_PATH/*
cp build.zip $DEPLOY_PATH/
cd $DEPLOY_PATH && unzip -o $DEPLOY_PATH/build.zip && echo "Successfully Deployed" || echo "Shits gone wrong, begin crying"

View File

@ -1,28 +1,44 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="main.css">
<link rel="icon"
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14/svgs/solid/book.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta name="description" content="Web site created using create-react-app" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- Compiled and minified CSS -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css">
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table-all.min.css">
</link>
<title>Migrations Tracker</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<!-- This breaks things -->
<!-- <script src="https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table.min.js"></script> -->
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="main.css" />
<link
rel="icon"
href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@5.14/svgs/solid/book.svg"
/>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!-- Compiled and minified CSS -->
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css"
/>
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link
rel="stylesheet"
href="https://npmcdn.com/react-bootstrap-table/dist/react-bootstrap-table-all.min.css"
/>
<link
href="//netdna.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css"
rel="stylesheet"
/>
<link
href="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.css"
rel="stylesheet"
/>
</body>
<title>Migrations Tracker</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
<script src="https://unpkg.com/material-components-web@latest/dist/material-components-web.min.js"></script>
</body>
</html>

View File

@ -18,3 +18,12 @@ a.white-link:active {
.react-bootstrap-table {
overflow-x: auto !important;
}
.card-size {
min-height: 190x;
min-width: 190px;
}
.nav-link {
cursor: pointer;
}

View File

@ -1,23 +1,6 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",

View File

@ -65,9 +65,11 @@ export class Home extends Component {
<UList listItems={builfArrayFromObject(this.state.timeslots)} /> */}
<TimeSlotHelper />
</div>
<div className="row">
<div className="col s12">
<GenericList APILINK="/pending/" />
<div className="container">
<div className="row">
<div className="col s12">
<GenericList APILINK="/pending/" />
</div>
</div>
</div>
</div>

View File

@ -28,7 +28,7 @@ class Cards extends Component {
return (
<div className="row">
<div className="col s6 m4">
<div className="col s6 m6 card-size">
<div className="card grey darken-1">
<div className="card-content white-text">
<span className="card-title"></span>
@ -39,7 +39,7 @@ class Cards extends Component {
</div>
</div>
</div>
<div className="col s6 m4">
<div className="col s6 m6 card-size">
<div className="card grey darken-1">
<div className="card-content white-text">
<span className="card-title"></span>
@ -50,9 +50,9 @@ class Cards extends Component {
</div>
</div>
</div>
<div className="col s6 m3">
<div className="card grey darken-1">
<div className="card-content white-text">
<div className="col s6 m6 card-size">
<div className="card grey darken-1 ">
<div className="card-content white-text ">
<span className="card-title"></span>
{this.missedMig()}
</div>
@ -61,7 +61,7 @@ class Cards extends Component {
</div>
</div>
</div>
<div className="col s6 m4">
<div className="col s6 m6 card-size">
<div className="card grey darken-1">
<div className="card-content white-text">
<span className="card-title"></span>

View File

@ -0,0 +1,406 @@
import React, { useState } from "react";
import { Formik, Form, ErrorMessage } from "formik";
import * as Yup from "yup";
import moment from "moment";
import { callAPI } from "../../../actions/API";
import Msgbox from "../../../actions/Msgbox";
import { builfArrayFromObject } from "../../../actions/Error";
export const CPanelForm = (timeslots) => {
const [respID, setRespID] = useState(0);
const [error, setError] = useState(0);
return (
<Formik
initialValues={{
submit_time: moment().format("YYYY-MM-DD"),
dateTime: "2019-03-11T12:00:00.000Z",
migration_status: "Booked",
domain: "",
username: "",
original_server: "",
new_server: "",
agent_booked: "",
booked_time: "",
ticket_id: "",
brand: "",
migration_type: "",
booked_date: "",
term_date: "",
additional_domains: "",
notes: "",
}}
validationSchema={Yup.object().shape({
domain: Yup.string()
.matches(
/^((https?):\/\/)?(www.)?[a-z0-9]+(\.[a-z]{2,}){1,3}(#?\/?[a-zA-Z0-9#]+)*\/?(\?[a-zA-Z0-9-_]+=[a-zA-Z0-9-%]+&?)?$/i,
"Required field"
)
.required("Required field"),
username: Yup.string().min(2, "Too Short!").required("Required field"),
original_server: Yup.string().required("Required field"),
new_server: Yup.string().required("Required field"),
agent_booked: Yup.string()
.min(2, "Too short!")
.required("Required field"),
booked_time: Yup.string().required("Required field"),
ticket_id: Yup.string().required("Required field"),
brand: Yup.string().required("Required field"),
migration_type: Yup.string().required("Required field"),
booked_date: Yup.string().required("Required field"),
})}
onSubmit={(values, { resetForm }) => {
console.log(values);
callAPI
.post("/book/", values)
.then(function (response) {
setRespID(response.data.id);
resetForm({ values: "" });
})
.catch(function (error) {
setError(builfArrayFromObject(error.response.data));
setRespID(0);
});
}}
render={({
errors,
touched,
handleChange,
values,
handleBlur,
handleReset,
}) => (
<div className="container">
<Form>
<div className="row">
<div className="form-group col s3">
<label htmlFor="bookedDate">Date *</label>
<input
name="booked_date"
type="date"
id="bookedDate"
placeholder="date placeholder"
value={values.booked_date}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.booked_date && touched.booked_date
? " is-invalid"
: "")
}
/>
<ErrorMessage
name="booked_date"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedDomain">Domain *</label>
<input
name="domain"
type="text"
id="bookedDomain"
placeholder="example.com.au"
value={values.domain}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.domain && touched.domain ? " is-invalid" : "")
}
/>
<ErrorMessage
name="domain"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedSource">Original server *</label>
<input
name="original_server"
type="text"
id="bookedSource"
placeholder="1.2.3.4 / example.com"
value={values.original_server}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.original_server && touched.original_server
? " is-invalid"
: "")
}
/>
<ErrorMessage
name="original_server"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedTicket">Ticket ID *</label>
<input
name="ticket_id"
type="text"
id="bookedTicket"
placeholder="VIP-A1234567"
value={values.ticket_id}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.ticket_id && touched.ticket_id ? " is-invalid" : "")
}
/>
<ErrorMessage
name="ticket_id"
component="div"
className="invalid-feedback"
/>
</div>
</div>
<div className="row">
<div className="form-group col s3">
<label htmlFor="bookedTime">Timeslot *</label>
<select
name="booked_time"
id="bookedTime"
type="select"
value={values.booked_time}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.booked_time && touched.booked_time
? " is-invalid"
: "")
}
>
<option>Select</option>
{timeslots.timeslots.map((slot) => (
<option>{slot}</option>
))}
</select>
<ErrorMessage
name="booked_time"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3 ">
<label htmlFor="bookedUsername">cPanel username *</label>
<input
name="username"
type="text"
id="bookedUsername"
placeholder="example"
value={values.username}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.username && touched.username ? " is-invalid" : "")
}
/>
<ErrorMessage
name="username"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedDestination">New server *</label>
<input
name="new_server"
type="text"
id="bookedDestination"
placeholder="1.2.3.4 / S111.SYD1"
value={values.new_server}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.new_server && touched.new_server
? " is-invalid"
: "")
}
/>
<ErrorMessage
name="new_server"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedBrand">Brand *</label>
<select
name="brand"
type="select"
id="bookedBrand"
value={values.brand}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.brand && touched.brand ? " is-invalid" : "")
}
>
<option>Select</option>
<option>VentraIP</option>
<option>Zuver</option>
<option>Synergy</option>
</select>
<ErrorMessage
name="brand"
component="div"
className="invalid-feedback"
/>
</div>
</div>
<div className="row">
<div className="form-group col s4">
<label htmlFor="bookedAdditionalDomains">Addon Domains</label>
<input
name="additional_domains"
type="text"
id="bookedAdditionalDomains"
placeholder="example.com.au,example.net.au"
value={values.additional_domains}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.additional_domains && touched.additional_domains
? " is-invalid"
: "")
}
/>
<ErrorMessage
name="additional_domains"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedAgent">Agent Initials *</label>
<input
name="agent_booked"
type="text"
id="bookedAgent"
placeholder="SZ"
value={values.agent_booked}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.agent_booked && touched.agent_booked
? " is-invalid"
: "")
}
/>
<ErrorMessage
name="agent_booked"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s3">
<label htmlFor="bookedType">Migration type *</label>
<select
name="migration_type"
type="select"
id="bookedType"
value={values.migration_type}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.migration_type && touched.migration_type
? " is-invalid"
: "")
}
>
<option>Select</option>
<option>VentraIP</option>
<option>Zuver</option>
<option>Synergy</option>
</select>
<ErrorMessage
name="migration_type"
component="div"
className="invalid-feedback"
/>
</div>
</div>
<div className="row">
<div className="form-group col s4">
<label htmlFor="bookedTermDate">
Estimated termination date (internal migrations only)
</label>
<input
name="term_date"
id="bookedTermDate"
type="date"
value={values.term_date}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.term_date && touched.term_date ? " is-invalid" : "")
}
/>
<ErrorMessage
name="term_date"
component="div"
className="invalid-feedback"
/>
</div>
<div className="form-group col s4">
<label htmlFor="bookedNotes">Notes</label>
<textarea
name="notes"
id="notes"
rows={4}
value={values.notes}
onChange={handleChange}
onBlur={handleBlur}
className={
"form-control" +
(errors.notes && touched.notes ? " is-invalid" : "")
}
/>
<ErrorMessage
name="notes"
component="div"
className="invalid-feedback"
/>
</div>
</div>
<div className="form-group">
<button type="submit" className="btn btn-primary mr-2">
SEND IT
</button>
<button
type="reset"
className="btn btn-secondary"
onClick={handleReset}
>
Reset
</button>
</div>
</Form>
{respID ? <Msgbox linkid={respID}></Msgbox> : null}
{error ? <Msgbox error={error}></Msgbox> : null}
</div>
)}
/>
);
};

View File

@ -10,10 +10,10 @@ import {
} from "reactstrap";
import classnames from "classnames";
import { CPanelBooking } from "./CPanelBooking";
import EmailBooking from "./EmailBooking";
import { CPanelForm } from "./CPanelForm";
const FormPage = ({ timeslots, item }) => {
const FormPage = ({ timeslots, item }) => {
const [activeTab, setActiveTab] = useState("1");
const toggle = (tab) => {
@ -50,15 +50,15 @@ const FormPage = ({ timeslots, item }) => {
<TabContent activeTab={activeTab}>
<TabPane tabId="1">
<Row>
<Col sm="12">
<CPanelBooking timeslots={timeslots} />
<Col>
<CPanelForm timeslots={timeslots} key={timeslots.id} />
</Col>
</Row>
</TabPane>
<TabPane tabId="2">
<Row>
<Col sm="6">
<EmailBooking />
<Col sm="12">
<EmailBooking />{" "}
</Col>
</Row>
</TabPane>

View File

@ -62,7 +62,7 @@ const ReportSingleMigration = ({ item }) => {
<option>Status</option>
<option>Booked</option>
<option>Waiting Termination</option>
<option>Complete</option>
<option>Completed</option>
<option>Cancelled</option>
</Input>
</FormGroup>

View File

@ -2,7 +2,7 @@ import React, { useState } from "react";
import "bootstrap/dist/css/bootstrap.min.css";
import moment from "moment";
import { Col, FormGroup, Row, Container, Label } from "reactstrap";
import { Formik, Form } from "formik";
import { Formik, Form, Field } from "formik";
import * as Yup from "yup";
import { Input, Submit } from "formstrap";
import { callAPI } from "../../../actions/API";

View File

@ -17,7 +17,7 @@ class InLineSearch extends React.Component {
// This is so we can access the state within the function
if (e.keyCode === 13) {
window.location.href =
"https://devui.benjamyn.love/migrations/" + this.state.data;
process.env.REACT_APP_SITE_URL + '/migrations/' + this.state.data;
}
};
render() {

View File

@ -19,7 +19,7 @@ const TimeSlots = (props) => {
const columns = [
{
dataField: "timeslot",
text: "timeslot/date",
text: "Timeslot/Date",
},
{
dataField: "yesterday",
@ -52,10 +52,10 @@ const TimeSlots = (props) => {
columns={columns}
>
{(props) => (
<div className="py-4">
<div >
<div
id="datatable-basic_filter"
className="dataTables_filter px-4 pb-1"
className="dataTables_filter pb-1"
></div>
<BootstrapTable
{...props.baseProps}