Compare commits
5 Commits
d005b72634
...
98b86363f5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98b86363f5 | ||
|
|
75559af7c8 | ||
|
|
21e23b98ad | ||
|
|
67eddc0394 | ||
|
|
960fc1707b |
12
Jenkinsfile
vendored
12
Jenkinsfile
vendored
|
|
@ -39,6 +39,12 @@ pipeline {
|
||||||
echo "Retry ${retryCount}/${MAX_RETRIES} failed"
|
echo "Retry ${retryCount}/${MAX_RETRIES} failed"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
sh 'npm install --legacy-peer-deps --force'
|
||||||
|
success = true
|
||||||
|
} catch (Exception e4) {
|
||||||
|
echo "npm install --legacy-peer-deps --force failed"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!success) {
|
if (!success) {
|
||||||
|
|
@ -56,8 +62,10 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('discord') {
|
stage('discord') {
|
||||||
when {
|
when {
|
||||||
branch 'main'
|
anyOf {
|
||||||
branch 'master'
|
branch 'main'
|
||||||
|
branch 'master'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
steps {
|
steps {
|
||||||
discordSend description: "Build: ${BUILD_NUMBER}", showChangeset: true, result: currentBuild.currentResult, title: currentBuild.fullProjectName, webhookURL: env.discordwebhook
|
discordSend description: "Build: ${BUILD_NUMBER}", showChangeset: true, result: currentBuild.currentResult, title: currentBuild.fullProjectName, webhookURL: env.discordwebhook
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@ import DEBUG from "./components/DEBUG/DEBUG";
|
||||||
import GenericForm from "./components/form/genericForm";
|
import GenericForm from "./components/form/genericForm";
|
||||||
import {getFormProperties} from "./components/form/formData";
|
import {getFormProperties} from "./components/form/formData";
|
||||||
import {FormProperties} from "./components/form/formInterfaces";
|
import {FormProperties} from "./components/form/formInterfaces";
|
||||||
|
import FormActiveRedirect from "./components/form/formActiveRedirect";
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -21,7 +22,7 @@ function App() {
|
||||||
<Route
|
<Route
|
||||||
key={property.path}
|
key={property.path}
|
||||||
path={property.path}
|
path={property.path}
|
||||||
element={<GenericForm {...property.formData} />}
|
element={<FormActiveRedirect {...property.formData} />}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<Route path="/verify-email" element={<VerifyMail/>}/>
|
<Route path="/verify-email" element={<VerifyMail/>}/>
|
||||||
|
|
|
||||||
|
|
@ -213,5 +213,6 @@ export const apply: FormData = {
|
||||||
other: Yup.string()
|
other: Yup.string()
|
||||||
.max(2000, 'Please provide at most 2000 characters')
|
.max(2000, 'Please provide at most 2000 characters')
|
||||||
}),
|
}),
|
||||||
title: "Staff Application"
|
title: "Staff Application",
|
||||||
|
backendFormName: "StaffApplication",
|
||||||
};
|
};
|
||||||
|
|
@ -48,5 +48,6 @@ export const contact: FormData = {
|
||||||
.max(2000, 'Question should not exceed 2000 characters')
|
.max(2000, 'Question should not exceed 2000 characters')
|
||||||
.required('Question is required')
|
.required('Question is required')
|
||||||
}),
|
}),
|
||||||
title: "Contact Form"
|
title: "Contact Form",
|
||||||
|
backendFormName: "ContactForm",
|
||||||
};
|
};
|
||||||
35
src/components/form/formActiveRedirect.tsx
Normal file
35
src/components/form/formActiveRedirect.tsx
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
import {FormData} from "./formInterfaces";
|
||||||
|
import {useEffect, useState} from "react";
|
||||||
|
import GenericForm from "./genericForm";
|
||||||
|
|
||||||
|
const FormActiveRedirect = (formData: FormData) => {
|
||||||
|
const [isLoading, setLoading] = useState(true);
|
||||||
|
const [isFormActive, setFormActive] = useState(false);
|
||||||
|
const handleCheckForm = async () => {
|
||||||
|
const result = await fetch(`${process.env.REACT_APP_BACKEND_BASE_URL}/api/checks/formActive`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ formName: formData.backendFormName })
|
||||||
|
});
|
||||||
|
const response = await result.json();
|
||||||
|
setFormActive(response.isActive);
|
||||||
|
setLoading(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
handleCheckForm();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return <div className={"container"}><h2>Checking if form is active</h2></div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isFormActive) {
|
||||||
|
return <div className={"container"}><h2>The {formData.title} is not currently active</h2></div>;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<GenericForm {...formData} />
|
||||||
|
);
|
||||||
|
}
|
||||||
|
export default FormActiveRedirect;
|
||||||
|
|
@ -22,6 +22,7 @@ export interface UserInput {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type FormData = {
|
export type FormData = {
|
||||||
|
backendFormName: string;
|
||||||
steps: Step[];
|
steps: Step[];
|
||||||
backend: string;
|
backend: string;
|
||||||
userInput: UserInput;
|
userInput: UserInput;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
import React, {useState} from "react";
|
import React, {useState} from "react";
|
||||||
import './GenericForm.css';
|
import './GenericForm.css';
|
||||||
import {useNavigate} from 'react-router-dom'
|
import {useNavigate} from 'react-router-dom'
|
||||||
import {ErrorMessage, Field, Form, FormikProvider, FormikValues, useFormik} from "formik";
|
import {ErrorMessage, Form, FormikProvider, FormikValues, useFormik} from "formik";
|
||||||
import {Step, UserInput, FormData} from './formInterfaces';
|
import {Step, UserInput, FormData} from './formInterfaces';
|
||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import formHTML from "./formHTML";
|
|
||||||
import FormHTML from "./formHTML";
|
import FormHTML from "./formHTML";
|
||||||
|
|
||||||
const GenericForm = (formData: FormData) => {
|
const GenericForm = (formData: FormData) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user