Archived
cleaned up some legacy code and restructured form
This commit is contained in:
1 parent
faab2fd921
commit
d6c1fc7f52
4 files changed
+117
-57
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import React, { Component } from "react";
|
||||
import { Link as a } from "react-router-dom";
|
||||
|
||||
import InLineSearch from "./common/Functionality/InlineSearchBar";
|
||||
|
||||
// Navbar class component, Just simple href's to retain styling
|
||||
@@ -23,10 +23,17 @@ export class Navigation extends Component {
|
||||
<Link to="/migrations">Migrations</Link>
|
||||
</li> */}
|
||||
<li>
|
||||
<a href="/reports" className="hide-on-med-and-down">Reports</a>
|
||||
<a href="/reports" className="hide-on-med-and-down">
|
||||
Reports
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/historical-migrations" className="hide-on-med-and-down">Historical Migrations</a>
|
||||
<a
|
||||
href="/historical-migrations"
|
||||
className="hide-on-med-and-down"
|
||||
>
|
||||
Historical Migrations
|
||||
</a>
|
||||
</li>
|
||||
<li className="orange accent-4 active">
|
||||
<a href="/book">Book</a>
|
||||
|
||||
@@ -8,22 +8,13 @@ import { Input, Submit } from "formstrap";
|
||||
import { callAPI } from "../../../actions/API";
|
||||
import Msgbox from "../../../actions/Msgbox";
|
||||
import { builfArrayFromObject } from "../../../actions/Error";
|
||||
import TextareaAutosize from "react-textarea-autosize";
|
||||
|
||||
// Main form and POST Request to add migrations
|
||||
// found at /book under the web hosting migration tab
|
||||
// Things to add:
|
||||
// better date time picking.
|
||||
|
||||
const timezoneList = {
|
||||
losAngeles: "America/Los_Angeles", // -8:00 (-7)
|
||||
berlin: "Europe/Berlin", // +2:00 (-1)
|
||||
newYork: "America/New_York", // -5:00 (-4)
|
||||
melbourne: "Australia/Melbourne", // +8:00
|
||||
tongatapu: "Pacific/Tongatapu", // +13:00 (+14)
|
||||
djibouti: "Africa/Djibouti", // +3:00
|
||||
};
|
||||
const timezone = timezoneList.melbourne;
|
||||
|
||||
const InputValidation = Yup.object().shape({
|
||||
domain: Yup.string()
|
||||
.matches(
|
||||
@@ -64,6 +55,7 @@ export const CPanelBooking = () => {
|
||||
};
|
||||
|
||||
const onSubmit = async (values, { setSubmitting, resetForm }) => {
|
||||
console.log(values);
|
||||
callAPI
|
||||
.post("/", values)
|
||||
.then(function (response) {
|
||||
@@ -85,8 +77,16 @@ export const CPanelBooking = () => {
|
||||
onSubmit={onSubmit}
|
||||
validationSchema={InputValidation}
|
||||
>
|
||||
{({ errors, touched }) => (
|
||||
<Form>
|
||||
{({
|
||||
handleSubmit,
|
||||
handleChange,
|
||||
handleBlur,
|
||||
values,
|
||||
touched,
|
||||
isValid,
|
||||
errors,
|
||||
}) => (
|
||||
<Form noValidate onSubmit={handleSubmit}>
|
||||
<Container>
|
||||
<Row>
|
||||
<Col>
|
||||
@@ -100,11 +100,14 @@ export const CPanelBooking = () => {
|
||||
mindate={Date()}
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedTime">Timeslot *</Label>
|
||||
<Input type="select" name="booked_time" id="bookedTime">
|
||||
<Input
|
||||
type="select"
|
||||
name="booked_time"
|
||||
id="bookedTime"
|
||||
className="has-success"
|
||||
>
|
||||
<option>Select</option>
|
||||
<option>00:00-03:00</option>
|
||||
<option>03:00-06:00</option>
|
||||
@@ -125,8 +128,6 @@ export const CPanelBooking = () => {
|
||||
placeholder="example.com.au"
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedUsername">cPanel username *</Label>
|
||||
<Input
|
||||
@@ -137,8 +138,6 @@ export const CPanelBooking = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedSource">Original server *</Label>
|
||||
@@ -146,22 +145,21 @@ export const CPanelBooking = () => {
|
||||
type="text"
|
||||
name="original_server"
|
||||
id="bookedSource"
|
||||
placeholder="1.2.3.4"
|
||||
placeholder="1.2.3.4 / example.com"
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedDestination">New server *</Label>
|
||||
<Input
|
||||
type="text"
|
||||
name="new_server"
|
||||
id="bookedDestination"
|
||||
placeholder="1.2.3.4"
|
||||
placeholder="1.2.3.4 / S111.SYD1"
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
|
||||
<Row>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
@@ -185,17 +183,6 @@ export const CPanelBooking = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedType">Migration type *</Label>
|
||||
<Input type="select" name="migration_type" id="bookedType">
|
||||
<option>Select</option>
|
||||
<option>cPanel</option>
|
||||
<option>Plesk</option>
|
||||
<option>Other</option>
|
||||
</Input>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedAgent">Agent Initials *</Label>
|
||||
@@ -207,27 +194,43 @@ export const CPanelBooking = () => {
|
||||
/>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col>
|
||||
<FormGroup>
|
||||
<Label for="bookedType">Migration type *</Label>
|
||||
<Input type="select" name="migration_type" id="bookedType">
|
||||
<option>Select</option>
|
||||
<option>cPanel</option>
|
||||
<option>Plesk</option>
|
||||
<option>Other</option>
|
||||
</Input>
|
||||
</FormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
<Row>
|
||||
<Col md={4}>
|
||||
<FormGroup>
|
||||
<Label for="bookedAdditionalDomains">Addon Domains</Label>
|
||||
<Input
|
||||
type="text"
|
||||
name="additional_domains"
|
||||
id="bookedAdditionalDomains"
|
||||
placeholder="example.com.au,example.net.au"
|
||||
/>
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
<Label for="bookedTermDate">
|
||||
Estimated termination date (internal migrations only)
|
||||
</Label>
|
||||
<Input type="date" name="term_date" id="bookedTermDate" />
|
||||
</FormGroup>
|
||||
</Col>
|
||||
<Col md={8}>
|
||||
<FormGroup>
|
||||
<Label for="bookedNotes">Notes</Label>
|
||||
<Input name="notes" id="notes" type="textarea" rows={6} />
|
||||
</FormGroup>
|
||||
</Col>
|
||||
</Row>
|
||||
<FormGroup>
|
||||
<Label for="bookedAdditionalDomains">Addon Domains</Label>
|
||||
<Input
|
||||
type="text"
|
||||
name="additional_domains"
|
||||
id="bookedAdditionalDomains"
|
||||
placeholder="example.com.au,example.net.au"
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup>
|
||||
<Label for="bookedTermDate">
|
||||
Estimated termination date (internal migrations only)
|
||||
</Label>
|
||||
<Input type="date" name="term_date" id="bookedTermDate" />
|
||||
</FormGroup>
|
||||
<FormGroup>
|
||||
<Label for="bookedNotes">Notes</Label>
|
||||
<Input type="textarea" name="notes" id="notes" />
|
||||
</FormGroup>
|
||||
<Submit withSpinner>Submit</Submit>
|
||||
</Container>
|
||||
{respID ? <Msgbox linkid={respID}></Msgbox> : null}
|
||||
|
||||
Reference in new issue
Block a user