Skip to content

Commit

Permalink
#1240 - fix for wizard going to summary page on edit. log details in …
Browse files Browse the repository at this point in the history
…proxy. added dev dependencies for health modules package for which start app was failing
  • Loading branch information
petmongrels committed Jun 10, 2024
1 parent 8042d82 commit deacab1
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
"pretty-quick": "^1.11.1",
"redux-saga-test-plan": "^3.7.0",
"source-map-explorer": "^2.0.1",
"@babel/helper-environment-visitor": "7.22.20"
"@babel/helper-environment-visitor": "7.22.20",
"@babel/helper-string-parser": "7.22.5",
"picocolors": "1.0.1"
}
}
1 change: 1 addition & 0 deletions src/dataEntryApp/sagas/subjectSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export function* setRegistrationOnLoadState(registrationForm, subject, identifie
const { formElementGroup, filteredFormElements, onSummaryPage, wizard, isFormEmpty } = commonFormUtil.onLoad(
registrationForm,
subject,
true,
true
);

Expand Down
33 changes: 16 additions & 17 deletions src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
// https://www.npmjs.com/package/http-proxy-middleware
const _ = require("lodash");
const moment = require("moment");
const { createProxyMiddleware } = require("http-proxy-middleware");
const filteredPathStarts = [
"/static",
"/manifest.",
"/favicon.ico",
"/__get-internal-source",
"/main."
];
const filteredPathStarts = ["/static", "/manifest.", "/favicon.ico", "/__get-internal-source", "/main."];
const filter = function(pathname, req) {
const doFilter = !(
pathname === "/" || _.some(filteredPathStarts, x => _.startsWith(pathname, x))
);
const doFilter = !(pathname === "/" || _.some(filteredPathStarts, x => _.startsWith(pathname, x)));
console.log("Send request to server", pathname, req.url, doFilter);
return doFilter;
};

module.exports = function(app) {
console.log("Setting up proxy");
app.use(
"/etl",
createProxyMiddleware(
Expand All @@ -30,11 +25,15 @@ module.exports = function(app) {
)
);

app.use(
"/",
createProxyMiddleware(filter, {
target: process.env.BACKEND_URL,
changeOrigin: true
})
);
const requestHandler = createProxyMiddleware(filter, {
target: process.env.BACKEND_URL,
changeOrigin: true,
onProxyReq: (proxyReq, req, res) => {
console.log("[", moment().format("h:mm:ss:SSS"), "] onProxyReq", proxyReq.host, proxyReq.path);
},
onProxyRes: (proxyRes, req, res) => {
console.log("[", moment().format("h:mm:ss:SSS"), "] onProxyRes", req.url, proxyRes.statusCode);
}
});
app.use("/", requestHandler);
};
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,11 @@
dependencies:
"@babel/types" "^7.11.0"

"@babel/[email protected]":
version "7.22.5"
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz#533f36457a25814cf1df6488523ad547d784a99f"
integrity sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==

"@babel/helper-validator-identifier@^7.10.4":
version "7.10.4"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
Expand Down Expand Up @@ -14118,6 +14123,11 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=

[email protected]:
version "1.0.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.0.1.tgz#a8ad579b571952f0e5d25892de5445bcfe25aaa1"
integrity sha512-anP1Z8qwhkbmu7MFP5iTt+wQKXgwzf7zTyGlcdzabySa9vd0Xt392U0rVmz9poOaBj0uHJKyyo9/upk0HrEQew==

picomatch@^2.0.4, picomatch@^2.0.5, picomatch@^2.2.1:
version "2.2.2"
resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.2.2.tgz#21f333e9b6b8eaff02468f5146ea406d345f4dad"
Expand Down

0 comments on commit deacab1

Please sign in to comment.