Skip to content

Commit

Permalink
Merge branch 'main' of github.com:theopensystemslab/planx-new into je…
Browse files Browse the repository at this point in the history
…ss/validate-files-against-schema
  • Loading branch information
jessicamcinchak committed Jul 7, 2024
2 parents f0a1e4f + fcf0f18 commit 29e1704
Show file tree
Hide file tree
Showing 24 changed files with 273 additions and 209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pizza-teardown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
action: destroy
api_key: ${{ secrets.VULTR_API_KEY }}
domain: ${{ env.DOMAIN }}
os_type: ubuntu
os_type: alpine
plan: vc2-1c-1gb
pull_request_id: ${{ env.PULLREQUEST_ID }}
region: lhr
Expand Down
24 changes: 18 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ jobs:
action: create
api_key: ${{ secrets.VULTR_API_KEY }}
domain: ${{ env.DOMAIN }}
os_type: ubuntu
os_type: alpine
plan: vc2-1c-1gb
pull_request_id: ${{ env.PULLREQUEST_ID }}
region: lhr
Expand All @@ -324,13 +324,19 @@ jobs:
password: ${{ steps.create.outputs.default_password }}
command_timeout: 20m
script: |
apt-get update -y
apk update
apk add docker
addgroup root docker
rc-update add docker default
service docker start
apk add docker-cli-compose
apk add git
git clone "${{ secrets.AUTHENTICATED_REPO_URL }}"
cd planx-new
git fetch origin "pull/${{ env.PULLREQUEST_ID }}/head" && git checkout FETCH_HEAD
apt-get install awscli -y
apk add aws-cli
export AWS_ACCESS_KEY_ID=${{ secrets.PIZZA_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.PIZZA_AWS_SECRET_ACCESS_KEY }}
export AWS_REGION=eu-west-2
Expand All @@ -352,15 +358,21 @@ jobs:
username: root
password: ${{ secrets.SSH_PASSWORD }}
command_timeout: 10m
# TODO: some of below script might be superfluous for server update (rather than create)
script: |
apt-get update -y
apk update
apk add docker
addgroup root docker
rc-update add docker default
service docker start
apk add docker-cli-compose
git clone "${{ secrets.AUTHENTICATED_REPO_URL }}"
cd planx-new
git add . && git stash
git fetch origin "pull/${{ env.PULLREQUEST_ID }}/head" && git checkout FETCH_HEAD
apt-get install awscli -y
apk add aws-cli
export AWS_ACCESS_KEY_ID=${{ secrets.PIZZA_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.PIZZA_AWS_SECRET_ACCESS_KEY }}
export AWS_REGION=eu-west-2
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ api.planx.uk/tmp/
# Ignore certificate files
**/*.chain
**/*.cert
**/*.crt
**/*.key
**/*.pfx
**/*.pkcs12
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const ListProvider: React.FC<ListProviderProps> = (props) => {
if (formik.values.userData.length < schema.min) {
return setMinError(true);
}

formik.handleSubmit();
};

Expand Down
32 changes: 7 additions & 25 deletions editor.planx.uk/src/@planx/components/List/Public/Fields.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import MenuItem from "@mui/material/MenuItem";
import RadioGroup from "@mui/material/RadioGroup";
import { visuallyHidden } from "@mui/utils";
import { getIn } from "formik";
import { get } from "lodash";
import React from "react";
import SelectInput from "ui/editor/SelectInput";
import InputLabel from "ui/public/InputLabel";
Expand All @@ -23,21 +24,14 @@ import type {
TextField,
} from "../model";
import { useListContext } from "./Context";
import { get } from "lodash";

type Props<T> = T & { id: string };

export const TextFieldInput: React.FC<Props<TextField>> = ({
id,
data,
}) => {
export const TextFieldInput: React.FC<Props<TextField>> = ({ id, data }) => {
const { formik, activeIndex } = useListContext();

return (
<InputLabel
label={data.title}
htmlFor={id}
>
<InputLabel label={data.title} htmlFor={id}>
<Input
type={((type) => {
if (type === "email") return "email";
Expand All @@ -48,10 +42,7 @@ export const TextFieldInput: React.FC<Props<TextField>> = ({
bordered
value={formik.values.userData[activeIndex][data.fn]}
onChange={formik.handleChange}
errorMessage={get(
formik.errors,
["userData", activeIndex, data.fn],
)}
errorMessage={get(formik.errors, ["userData", activeIndex, data.fn])}
id={id}
rows={
data.type && ["long", "extraLong"].includes(data.type) ? 5 : undefined
Expand Down Expand Up @@ -80,10 +71,7 @@ export const NumberFieldInput: React.FC<Props<NumberField>> = ({
const { formik, activeIndex } = useListContext();

return (
<InputLabel
label={data.title}
htmlFor={id}
>
<InputLabel label={data.title} htmlFor={id}>
<Box sx={{ display: "flex", alignItems: "baseline" }}>
<Input
required
Expand All @@ -92,10 +80,7 @@ export const NumberFieldInput: React.FC<Props<NumberField>> = ({
type="number"
value={formik.values.userData[activeIndex][data.fn]}
onChange={formik.handleChange}
errorMessage={get(
formik.errors,
["userData", activeIndex, data.fn],
)}
errorMessage={get(formik.errors, ["userData", activeIndex, data.fn])}
inputProps={{
"aria-describedby": [
data.description ? DESCRIPTION_TEXT : "",
Expand Down Expand Up @@ -161,10 +146,7 @@ export const SelectFieldInput: React.FC<Props<QuestionField>> = (props) => {
const { id, data } = props;

return (
<InputLabel
label={data.title}
id={`select-label-${id}`}
>
<InputLabel label={data.title} id={`select-label-${id}`}>
<ErrorWrapper
id={`${id}-error`}
error={get(formik.errors, ["userData", activeIndex, data.fn])}
Expand Down
Loading

0 comments on commit 29e1704

Please sign in to comment.