Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Production deploy #3064

Merged
merged 3 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions api.planx.uk/modules/send/uniform/uniform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ async function attachArchive(
const response = await axios.request(attachArchiveConfig);
// successful upload returns 204 No Content without body
const isSuccess = response.status === 204;

// Temp additional logging to debug failures
console.log("*** Uniform attachArchive response ***");
console.log({ status: response.status });
console.log(JSON.stringify(response.data, null, 2));
console.log("******");

return isSuccess;
}

Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Send/Public.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const SendComponent: React.FC<Props> = ({
const fullProps = { destinations: destinations, ...props };
if (
window.location.pathname.endsWith("/draft") ||
window.location.pathname.endsWith("/amber")
window.location.pathname.endsWith("/preview")
) {
return <SkipSendWarning {...fullProps} />;
} else {
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/components/Header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ describe("Header Component - Editor Route", () => {
});
});

for (const route of ["/published", "/amber", "/draft", "/pay", "/invite"]) {
for (const route of ["/published", "/preview", "/draft", "/pay", "/invite"]) {
describe(`Header Component - ${route} Routes`, () => {
beforeAll(() => {
jest.spyOn(ReactNavi, "useCurrentRoute").mockImplementation(
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/lib/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ export const client = new ApolloClient({

/**
* Client used to make requests in all public interface
* e.g. /published, /amber, /draft, /pay
* e.g. /published, /preview, /draft, /pay
*/
export const publicClient = new ApolloClient({
link: from([retryLink, errorLink, publicHttpLink]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ const AlteredNodesSummaryContent = (props: {
<Box pt={2}>
<Typography variant="body2">
{`Preview these content changes in-service before publishing `}
<Link href={url.replace("/published", "/amber")} target="_blank">
<Link href={url.replace("/published", "/preview")} target="_blank">
{`here (opens in a new tab).`}
</Link>
</Typography>
Expand Down Expand Up @@ -426,7 +426,7 @@ const PreviewBrowser: React.FC<{
<input
type="text"
disabled
value={props.url.replace("/published", "/amber")}
value={props.url.replace("/published", "/preview")}
/>

<Tooltip arrow title="Refresh preview">
Expand Down Expand Up @@ -480,7 +480,7 @@ const PreviewBrowser: React.FC<{

<Tooltip arrow title="Open preview of changes to publish">
<Link
href={props.url.replace("/published", "/amber")}
href={props.url.replace("/published", "/preview")}
target="_blank"
rel="noopener noreferrer"
color="inherit"
Expand Down
15 changes: 1 addition & 14 deletions editor.planx.uk/src/routes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,26 +66,13 @@ export default isPreviewOnlyDomain
"/:team/:flow/published": lazy(() => import("./published")), // XXX: keeps old URL working, but only for the team listed in the domain.
"/:flow": lazy(() => import("./published")),
"/:flow/pay": mountPayRoutes(),
"/:team/:flow/preview": map(async (req) =>
redirect(
`/${req.params.team}/${req.params.flow}/published${req?.search}`,
),
),
// XXX: We're not sure where to redirect `/` to so for now we'll just return the default 404
// "/": redirect("somewhere?"),
})
: mount({
"/:team/:flow/published": lazy(() => import("./published")), // loads current published flow if exists, or throws Not Found if unpublished
"/:team/:flow/amber": lazy(() => import("./preview")), // loads current draft flow and latest published external portals, or throws Not Found if any external portal is unpublished
"/:team/:flow/preview": lazy(() => import("./preview")), // loads current draft flow and latest published external portals, or throws Not Found if any external portal is unpublished
"/:team/:flow/draft": lazy(() => import("./draft")), // loads current draft flow and draft external portals
"/:team/:flow/pay": mountPayRoutes(),
"/:team/:flow/preview": map(async (req) =>
redirect(
`/${req.params.team}/${req.params.flow}/published${req?.search}`,
),
),
"/:team/:flow/unpublished": map(async (req) =>
redirect(`/${req.params.team}/${req.params.flow}/amber`),
),
"*": editorRoutes,
});
6 changes: 3 additions & 3 deletions editor.planx.uk/src/routes/views/preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,21 @@ import { getTeamFromDomain } from "routes/utils";
import { fetchSettingsForPublishedView } from "./published";

/**
* View wrapper for /amber (in future /preview)
* View wrapper for /preview
* Does not display Save & Return layout as progress is not persisted on this route
*/
export const previewView = async (req: NaviRequest) => {
const flowSlug = req.params.flow.split(",")[0];
const teamSlug =
req.params.team || (await getTeamFromDomain(window.location.hostname));

// /amber uses the same theme & global settings as /published
// /preview uses the same theme & global settings as /published
const data = await fetchSettingsForPublishedView(flowSlug, teamSlug);
const flow = data.flows[0];
if (!flow)
throw new NotFoundError(`Flow ${flowSlug} not found for ${teamSlug}`);

// /amber fetches draft data of this flow and the latest published version of each external portal
// /preview fetches draft data of this flow and the latest published version of each external portal
const flowData = await fetchFlattenedFlowData(flow.id);

const state = useStore.getState();
Expand Down
Loading