Compare commits
8 Commits
646e3cc9d8
...
07289a5dc9
| Author | SHA1 | Date | |
|---|---|---|---|
| 07289a5dc9 | |||
| 9e19ba37f9 | |||
| 9c745be436 | |||
| a716fa8122 | |||
| a8289e9f65 | |||
| 03bd06745b | |||
| a4772d3626 | |||
| 99abdc0a6f |
@ -27,3 +27,20 @@ a.white-link:active {
|
|||||||
.nav-link {
|
.nav-link {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
::placeholder { /* Chrome, Firefox, Opera, Safari 10.1+ */
|
||||||
|
color: rgb(155, 155, 155);
|
||||||
|
opacity: 1; /* Firefox */
|
||||||
|
}
|
||||||
|
|
||||||
|
:-ms-input-placeholder { /* Internet Explorer 10-11 */
|
||||||
|
color: rgb(155, 155, 155);;
|
||||||
|
}
|
||||||
|
|
||||||
|
::-ms-input-placeholder { /* Microsoft Edge */
|
||||||
|
color: rgb(155, 155, 155);;
|
||||||
|
}
|
||||||
|
|
||||||
|
.input-field [type=text] {
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
@ -15,7 +15,6 @@ import IDSingle from "./root/Pages/IDSingle";
|
|||||||
// Components
|
// Components
|
||||||
import Home from "./root/Home";
|
import Home from "./root/Home";
|
||||||
import Navigation from "./root/Navigation";
|
import Navigation from "./root/Navigation";
|
||||||
import Autobook from "./root/Pages/Autobook";
|
|
||||||
|
|
||||||
// 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
|
||||||
@ -74,7 +73,6 @@ class App extends Component {
|
|||||||
path="/booked"
|
path="/booked"
|
||||||
render={(props) => <GenericList {...props} APILINK="/booked/" />}
|
render={(props) => <GenericList {...props} APILINK="/booked/" />}
|
||||||
/>
|
/>
|
||||||
<Route exact path="/check" component={Autobook} />
|
|
||||||
</Switch>
|
</Switch>
|
||||||
</div>
|
</div>
|
||||||
</Router>
|
</Router>
|
||||||
|
|||||||
@ -4,13 +4,15 @@ import FormPage from "../common/Forms/FormPage";
|
|||||||
import { callAPI } from "../../actions/API";
|
import { callAPI } from "../../actions/API";
|
||||||
import { GenericForm } from "../common/Forms/GenericForm";
|
import { GenericForm } from "../common/Forms/GenericForm";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
|
import Msgbox from "../../actions/Msgbox";
|
||||||
|
|
||||||
export default class Book extends Component {
|
export default class Autobook extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
data: null,
|
data: null,
|
||||||
timeslots: [],
|
timeslots: [],
|
||||||
|
error: "",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
preBookedData = {
|
preBookedData = {
|
||||||
@ -37,21 +39,24 @@ export default class Book extends Component {
|
|||||||
this.setState({
|
this.setState({
|
||||||
timeslots: response.data,
|
timeslots: response.data,
|
||||||
});
|
});
|
||||||
// console.log(response.data);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
credCallback = (credData) => {
|
credCallback = (credData) => {
|
||||||
console.log(credData);
|
if (credData[0].data.Error) {
|
||||||
this.setState({
|
this.setState({
|
||||||
data: credData,
|
error: credData[0].data.Error,
|
||||||
});
|
});
|
||||||
console.log(this.state.data);
|
} else {
|
||||||
this.preBookedData.domain = this.state.data[0].data.main_domain;
|
this.setState({
|
||||||
this.preBookedData.additional_domains = this.state.data[0].data.other_domains;
|
data: credData,
|
||||||
this.preBookedData.username = this.state.data[1].username;
|
error: "",
|
||||||
this.preBookedData.original_server = this.state.data[1].hostname;
|
});
|
||||||
console.log(this.preBookedData);
|
this.preBookedData.domain = this.state.data[0].data.main_domain;
|
||||||
|
this.preBookedData.additional_domains = this.state.data[0].data.other_domains;
|
||||||
|
this.preBookedData.username = this.state.data[1].username;
|
||||||
|
this.preBookedData.original_server = this.state.data[1].hostname;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
render() {
|
render() {
|
||||||
if (this.state.data) {
|
if (this.state.data) {
|
||||||
@ -69,7 +74,12 @@ export default class Book extends Component {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return <CredChecker credCallback={this.credCallback} />;
|
return (
|
||||||
|
<div>
|
||||||
|
<CredChecker credCallback={this.credCallback} />
|
||||||
|
{this.state.error ? <Msgbox error={[this.state.error]} /> : null}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,30 +2,38 @@ import React from "react";
|
|||||||
import { callAPI } from "../../../actions/API";
|
import { callAPI } from "../../../actions/API";
|
||||||
|
|
||||||
export const CredChecker = (props) => {
|
export const CredChecker = (props) => {
|
||||||
|
const sendit = () => {
|
||||||
const sendit = () => {
|
let values = {
|
||||||
let values = {
|
hostname: document.getElementById("Host").value,
|
||||||
hostname: document.getElementById("Host").value,
|
username: document.getElementById("User").value,
|
||||||
username: document.getElementById("User").value,
|
password: document.getElementById("Pass").value,
|
||||||
password: document.getElementById("Pass").value,
|
};
|
||||||
}
|
callAPI.post("/checkcpanel/", values).then((resp) => {
|
||||||
callAPI
|
props.credCallback([resp, values]);
|
||||||
.post('/checkcpanel/', values)
|
});
|
||||||
.then( (resp) => {
|
console.log();
|
||||||
props.credCallback([resp, values])
|
};
|
||||||
})
|
return (
|
||||||
console.log()
|
<div>
|
||||||
|
<div className="row">
|
||||||
}
|
<div className="col s3">
|
||||||
return (
|
<label htmlFor="Host">Hostname</label>
|
||||||
<div>
|
<input id="Host"></input>
|
||||||
<div className="row">
|
|
||||||
<div className="col s3"><label htmlFor="Host">Hostname</label><input id="Host" ></input></div>
|
|
||||||
<div className="col s3"><label htmlFor="User">Username</label><input id="User" ></input></div>
|
|
||||||
<div className="col s3"><label htmlFor="Pass">Password</label><input id="Pass" ></input></div>
|
|
||||||
</div>
|
|
||||||
<div className="row"><button className="" onClick={sendit}>Check Deets homie</button></div>
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
)
|
<div className="col s3">
|
||||||
}
|
<label htmlFor="User">Username</label>
|
||||||
|
<input id="User"></input>
|
||||||
|
</div>
|
||||||
|
<div className="col s3">
|
||||||
|
<label htmlFor="Pass">Password</label>
|
||||||
|
<input id="Pass"></input>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div className="row">
|
||||||
|
<button className="btn btn-secondary" onClick={sendit}>
|
||||||
|
Check Deets homie
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import classnames from "classnames";
|
|||||||
|
|
||||||
import EmailBooking from "./EmailBooking";
|
import EmailBooking from "./EmailBooking";
|
||||||
import { GenericForm } from "./GenericForm";
|
import { GenericForm } from "./GenericForm";
|
||||||
|
import AutoBook from "../../Pages/Autobook";
|
||||||
|
|
||||||
const FormPage = ({ timeslots, item }) => {
|
const FormPage = ({ timeslots, item }) => {
|
||||||
const [activeTab, setActiveTab] = useState("1");
|
const [activeTab, setActiveTab] = useState("1");
|
||||||
@ -33,7 +34,7 @@ const FormPage = ({ timeslots, item }) => {
|
|||||||
toggle("1");
|
toggle("1");
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Web hosting Migration
|
Auto cPanel Booking
|
||||||
</NavLink>
|
</NavLink>
|
||||||
</NavItem>
|
</NavItem>
|
||||||
<NavItem>
|
<NavItem>
|
||||||
@ -42,6 +43,16 @@ const FormPage = ({ timeslots, item }) => {
|
|||||||
onClick={() => {
|
onClick={() => {
|
||||||
toggle("2");
|
toggle("2");
|
||||||
}}
|
}}
|
||||||
|
>
|
||||||
|
Web hosting Migration
|
||||||
|
</NavLink>
|
||||||
|
</NavItem>
|
||||||
|
<NavItem>
|
||||||
|
<NavLink
|
||||||
|
className={classnames({ active: activeTab === "3" })}
|
||||||
|
onClick={() => {
|
||||||
|
toggle("3");
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
Email Migration
|
Email Migration
|
||||||
</NavLink>
|
</NavLink>
|
||||||
@ -52,11 +63,19 @@ const FormPage = ({ timeslots, item }) => {
|
|||||||
<Row>
|
<Row>
|
||||||
<Col>
|
<Col>
|
||||||
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
|
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
|
||||||
<GenericForm timeslots={timeslots} key={timeslots.id} />
|
<AutoBook />
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</TabPane>
|
</TabPane>
|
||||||
<TabPane tabId="2">
|
<TabPane tabId="2">
|
||||||
|
<Row>
|
||||||
|
<Col>
|
||||||
|
{/* <CPanelForm timeslots={timeslots} key={timeslots.id} /> */}
|
||||||
|
<GenericForm timeslots={timeslots} key={timeslots.id} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
</TabPane>
|
||||||
|
<TabPane tabId="3">
|
||||||
<Row>
|
<Row>
|
||||||
<Col sm="12">
|
<Col sm="12">
|
||||||
<EmailBooking />{" "}
|
<EmailBooking />{" "}
|
||||||
|
|||||||
@ -14,11 +14,7 @@ export const GenericForm = (props) => {
|
|||||||
const [set, setSet] = useState(false);
|
const [set, setSet] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// console.log(initial);
|
|
||||||
// console.log(initial.domain);
|
|
||||||
|
|
||||||
if (!set) {
|
if (!set) {
|
||||||
console.log(typeof initial.domain);
|
|
||||||
if (props.data) {
|
if (props.data) {
|
||||||
setInitial(props.data);
|
setInitial(props.data);
|
||||||
setSet(true);
|
setSet(true);
|
||||||
@ -46,11 +42,6 @@ export const GenericForm = (props) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const getInitial = () => {
|
|
||||||
// return initial;
|
|
||||||
};
|
|
||||||
|
|
||||||
console.log(initial);
|
|
||||||
if (set) {
|
if (set) {
|
||||||
return (
|
return (
|
||||||
<Formik
|
<Formik
|
||||||
@ -159,7 +150,7 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
"form-control input-field" +
|
||||||
(errors.booked_date && touched.booked_date
|
(errors.booked_date && touched.booked_date
|
||||||
? " is-invalid"
|
? " is-invalid"
|
||||||
: "")
|
: "")
|
||||||
@ -182,7 +173,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.domain && touched.domain ? " is-invalid" : "")
|
(errors.domain && touched.domain ? " is-invalid" : "")
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -203,7 +193,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.original_server && touched.original_server
|
(errors.original_server && touched.original_server
|
||||||
? " is-invalid"
|
? " is-invalid"
|
||||||
: "")
|
: "")
|
||||||
@ -226,7 +215,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.ticket_id && touched.ticket_id
|
(errors.ticket_id && touched.ticket_id
|
||||||
? " is-invalid"
|
? " is-invalid"
|
||||||
: "")
|
: "")
|
||||||
@ -279,7 +267,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.username && touched.username ? " is-invalid" : "")
|
(errors.username && touched.username ? " is-invalid" : "")
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
@ -301,7 +288,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.new_server && touched.new_server
|
(errors.new_server && touched.new_server
|
||||||
? " is-invalid"
|
? " is-invalid"
|
||||||
: "")
|
: "")
|
||||||
@ -351,7 +337,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.additional_domains && touched.additional_domains
|
(errors.additional_domains && touched.additional_domains
|
||||||
? " is-invalid"
|
? " is-invalid"
|
||||||
: "")
|
: "")
|
||||||
@ -375,7 +360,6 @@ export const GenericForm = (props) => {
|
|||||||
onChange={handleChange}
|
onChange={handleChange}
|
||||||
onBlur={handleBlur}
|
onBlur={handleBlur}
|
||||||
className={
|
className={
|
||||||
"form-control" +
|
|
||||||
(errors.agent_booked && touched.agent_booked
|
(errors.agent_booked && touched.agent_booked
|
||||||
? " is-invalid"
|
? " is-invalid"
|
||||||
: "")
|
: "")
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
export const GET_MIGRATIONS = "GET_MIGRATIONS";
|
|
||||||
export const DATA_LOADED = "DATA_LOADED";
|
|
||||||
export const API_ERRORED = "API_ERRORED";
|
|
||||||
@ -1,21 +0,0 @@
|
|||||||
import { GET_MIGRATIONS } from "../constants/action-types";
|
|
||||||
|
|
||||||
const forbiddenWords = ["spam", "money"];
|
|
||||||
|
|
||||||
export function forbiddenWordsMiddleware({ dispatch }) {
|
|
||||||
return function (next) {
|
|
||||||
return function (action) {
|
|
||||||
// do your stuff
|
|
||||||
if (action.type === GET_MIGRATIONS) {
|
|
||||||
const foundWord = forbiddenWords.filter((word) =>
|
|
||||||
action.payload.title.includes(word)
|
|
||||||
);
|
|
||||||
|
|
||||||
if (foundWord.length) {
|
|
||||||
return dispatch({ type: "FOUND_BAD_WORD" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return next(action);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
import { GET_MIGRATIONS, DATA_LOADED } from "../constants/action-types";
|
|
||||||
|
|
||||||
const initialState = {
|
|
||||||
migs: [],
|
|
||||||
timeslots: [],
|
|
||||||
error: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
function rootReducer(state = initialState, action) {
|
|
||||||
if (action.type === GET_MIGRATIONS) {
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
migs: state.migs.concat(action.payload),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action.type === DATA_LOADED) {
|
|
||||||
return Object.assign({}, state, {
|
|
||||||
timeslots: state.timeslots.concat(action.payload),
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
|
|
||||||
export default rootReducer;
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import { createStore, applyMiddleware, compose } from "redux";
|
|
||||||
import rootReducer from "../reducers";
|
|
||||||
import { forbiddenWordsMiddleware } from "../middleware";
|
|
||||||
import thunk from "redux-thunk";
|
|
||||||
|
|
||||||
const storeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
|
||||||
|
|
||||||
const store = createStore(
|
|
||||||
rootReducer,
|
|
||||||
storeEnhancers(applyMiddleware(forbiddenWordsMiddleware, thunk))
|
|
||||||
);
|
|
||||||
|
|
||||||
export default store;
|
|
||||||
Reference in New Issue
Block a user