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/formatted-operations
  • Loading branch information
jessicamcinchak committed Apr 17, 2024
2 parents 0a4338f + 8186afc commit 2dd3841
Show file tree
Hide file tree
Showing 27 changed files with 468 additions and 98 deletions.
11 changes: 11 additions & 0 deletions api.planx.uk/modules/admin/session/digitalPlanningData.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,15 @@ describe("Digital Planning Application payload admin endpoint", () => {
expect(res.body).toEqual(expectedPlanningPermissionPayload),
);
});

it("returns an invalid JSON payload if the skipValidation query param is set", async () => {
await supertest(app)
.get(endpoint`123`.concat("?skipValidation=true"))
.set(authHeader({ role: "platformAdmin" }))
.expect(200)
.expect("content-type", "application/json; charset=utf-8")
.then((res) =>
expect(res.body).toEqual(expectedPlanningPermissionPayload),
);
});
});
13 changes: 13 additions & 0 deletions api.planx.uk/modules/admin/session/digitalPlanningData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { $api } from "../../../client";
* - admin
* parameters:
* - $ref: '#/components/parameters/sessionId'
* - in: query
* name: skipValidation
* type: boolean
* required: false
* description: If invalid JSON data should still be returned, instead of logging validation errors
* security:
* - bearerAuth: []
*/
Expand All @@ -20,9 +25,17 @@ export const getDigitalPlanningApplicationPayload = async (
next: NextFunction,
) => {
try {
let skipValidation = false;
if (req.query?.skipValidation) {
skipValidation =
(req.query.skipValidation as string).toLowerCase() === "true";
}

const data = await $api.export.digitalPlanningDataPayload(
req.params.sessionId,
skipValidation,
);

res.set("content-type", "application/json");
return res.send(data);
} catch (error) {
Expand Down
2 changes: 1 addition & 1 deletion api.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@airbrake/node": "^2.1.8",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"@types/isomorphic-fetch": "^0.0.36",
"adm-zip": "^0.5.10",
"aws-sdk": "^2.1467.0",
Expand Down
8 changes: 4 additions & 4 deletions api.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/api-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"@cucumber/cucumber": "^9.3.0",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"dotenv-expand": "^10.0.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/api-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e/tests/ui-driven/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"postinstall": "./install-dependencies.sh"
},
"dependencies": {
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"axios": "^1.6.8",
"dotenv": "^16.3.1",
"eslint": "^8.56.0",
Expand Down
8 changes: 4 additions & 4 deletions e2e/tests/ui-driven/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions e2e/tests/ui-driven/src/pay.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,6 @@ test.describe("Gov Pay integration @regression", async () => {
// retry the payment
await page.getByText("Retry payment").click();
await page.getByText("Continue with your payment").click();
// Re-enter card details
await fillGovUkCardDetails({
page,
cardNumber: cards.successful_card_number,
});
await submitCardDetails(page);

const { paymentId } = await waitForPaymentResponse(page, context);
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"@mui/material": "^5.15.2",
"@mui/utils": "^5.15.2",
"@opensystemslab/map": "^0.8.1",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#7ff62e4",
"@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#15bde6b",
"@tiptap/core": "^2.0.3",
"@tiptap/extension-bold": "^2.0.3",
"@tiptap/extension-bubble-menu": "^2.1.13",
Expand Down
10 changes: 5 additions & 5 deletions editor.planx.uk/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

104 changes: 54 additions & 50 deletions editor.planx.uk/src/@planx/components/shared/Preview/SummaryList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,67 @@ const FIND_PROPERTY_DT = "Property address";
const DRAW_BOUNDARY_DT = "Location plan";

export const SummaryListTable = styled("dl", {
shouldForwardProp: (prop) => prop !== "showChangeButton",
})<{ showChangeButton?: boolean }>(({ theme, showChangeButton }) => ({
display: "grid",
gridTemplateColumns: showChangeButton ? "1fr 2fr 100px" : "1fr 2fr",
gridRowGap: "10px",
marginTop: theme.spacing(2),
marginBottom: theme.spacing(4),
"& > *": {
borderBottom: `1px solid ${theme.palette.border.main}`,
paddingBottom: theme.spacing(2),
paddingTop: theme.spacing(2),
verticalAlign: "top",
margin: 0,
},
"& ul": {
listStylePosition: "inside",
padding: 0,
margin: 0,
},
"& dt": {
// left column
fontWeight: FONT_WEIGHT_SEMI_BOLD,
},
"& dd:nth-of-type(n)": {
// middle column
paddingLeft: "10px",
},
"& dd:nth-of-type(2n)": {
// right column
textAlign: showChangeButton ? "right" : "left",
},
[theme.breakpoints.down("sm")]: {
display: "flex",
flexDirection: "column",
shouldForwardProp: (prop) =>
!["showChangeButton", "dense"].includes(prop as string),
})<{ showChangeButton?: boolean; dense?: boolean }>(
({ theme, showChangeButton, dense }) => ({
display: "grid",
gridTemplateColumns: showChangeButton ? "1fr 2fr 100px" : "1fr 2fr",
gridRowGap: "10px",
marginTop: dense ? theme.spacing(1) : theme.spacing(2),
marginBottom: dense ? theme.spacing(2) : theme.spacing(4),
fontSize: dense ? theme.typography.body2.fontSize : "inherit",
"& > *": {
borderBottom: `1px solid ${theme.palette.border.main}`,
paddingBottom: dense ? theme.spacing(1) : theme.spacing(2),
paddingTop: dense ? theme.spacing(1) : theme.spacing(2),
verticalAlign: "top",
margin: 0,
},
"& ul": {
listStylePosition: "inside",
padding: 0,
margin: 0,
},
"& dt": {
// top row
paddingLeft: theme.spacing(1),
paddingTop: theme.spacing(2),
marginTop: theme.spacing(1),
borderTop: `1px solid ${theme.palette.border.main}`,
borderBottom: "none",
// left column
fontWeight: FONT_WEIGHT_SEMI_BOLD,
},
"& dd:nth-of-type(n)": {
// middle row
textAlign: "left",
paddingTop: 0,
paddingBottom: 0,
margin: 0,
borderBottom: "none",
// middle column
paddingLeft: "10px",
},
"& dd:nth-of-type(2n)": {
// bottom row
textAlign: "left",
// right column
textAlign: showChangeButton ? "right" : "left",
},
[theme.breakpoints.down("sm")]: {
display: "flex",
flexDirection: "column",
"& dt": {
// top row
paddingLeft: theme.spacing(1),
paddingTop: dense ? theme.spacing(1) : theme.spacing(2),
marginTop: theme.spacing(1),
borderTop: `1px solid ${theme.palette.border.main}`,
borderBottom: "none",
fontWeight: FONT_WEIGHT_SEMI_BOLD,
},
"& dd:nth-of-type(n)": {
// middle row
textAlign: "left",
paddingTop: 0,
paddingBottom: 0,
margin: 0,
borderBottom: "none",
},
"& dd:nth-of-type(2n)": {
// bottom row
textAlign: "left",
},
},
},
}));
}),
);

const presentationalComponents: {
[key in TYPES]: React.FC<ComponentProps> | undefined;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ export const PrivateFileUpload: React.FC<PrivateFileUploadProps> = ({

return (
<>
{hasEmptySlots && (
<Dropzone
slots={slots}
setSlots={setSlots}
setFileUploadStatus={setFileUploadStatus}
maxFiles={maxFiles}
/>
)}
{slots.map((slot) => {
return (
<UploadedFileCard
Expand All @@ -38,14 +46,6 @@ export const PrivateFileUpload: React.FC<PrivateFileUploadProps> = ({
);
})}
<FileStatus status={fileUploadStatus} />
{hasEmptySlots && (
<Dropzone
slots={slots}
setSlots={setSlots}
setFileUploadStatus={setFileUploadStatus}
maxFiles={maxFiles}
/>
)}
</>
);
};
13 changes: 9 additions & 4 deletions editor.planx.uk/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -554,11 +554,16 @@ const EditorToolbar: React.FC<{
</MenuItem>
)}

{/* Only show global settings link from top-level admin view */}
{/* Only show global settings & admin panel links from top-level view */}
{isGlobalSettingsVisible && (
<MenuItem onClick={() => navigate("/global-settings")}>
Global Settings
</MenuItem>
<>
<MenuItem onClick={() => navigate("/global-settings")}>
Global Settings
</MenuItem>
<MenuItem onClick={() => navigate("/admin-panel")}>
Admin Panel
</MenuItem>
</>
)}

<MenuItem onClick={() => navigate("/logout")}>Log out</MenuItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const Root = styled(Box)(({ theme }) => ({
backgroundColor: "#f2f2f2",
zIndex: 0,
},
zIndex: theme.zIndex.appBar,
}));

const Settings: React.FC<SettingsProps> = ({ currentTab, tabs }) => {
Expand Down
9 changes: 8 additions & 1 deletion editor.planx.uk/src/pages/FlowEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ const FlowEditor: React.FC<any> = ({ flow, breadcrumbs }) => {

return (
<Box id="editor-container">
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
<Box
sx={{
display: "flex",
flexDirection: "column",
width: "100%",
overflowX: "auto",
}}
>
<LastEdited />
<Box id="editor" ref={scrollContainerRef} sx={{ position: "relative" }}>
<Flow flow={flow} breadcrumbs={breadcrumbs} />
Expand Down
Loading

0 comments on commit 2dd3841

Please sign in to comment.