Skip to content

Commit

Permalink
Added consolidated loading, see #682:
Browse files Browse the repository at this point in the history
- New version of API in 'new-backend', v2. Same endpoints but different response: the new response consolidates previousl 3 separate requests and eliminates the need of them.
- Changes in client to accomodate the new API: index rewritten - both old and new loading possible. Which is choosen is controlled by the 'experimentalNewApi' flag in appConfig.json. I had the opportunity to also consolidate the error rendering in index, it's now more consistent. Finally, some changes in MapSwitcher - we get the list of user specific maps from our new consolidated response and there's no need to do separate fetch anymore.
- Added ESlint plugin to allow private fields/methods.
  • Loading branch information
jacobwod committed Feb 25, 2021
1 parent f2c3be2 commit 2f0a3cf
Show file tree
Hide file tree
Showing 8 changed files with 859 additions and 102 deletions.
2 changes: 1 addition & 1 deletion new-backend/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"env": {
"mocha": true
},
"plugins": ["prettier", "node"],
"plugins": ["prettier", "node", "@babel/plugin-proposal-private-methods"],
"parserOptions": {
"sourceType": "module"
},
Expand Down
21 changes: 21 additions & 0 deletions new-backend/server/api/controllers/configV2/controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import ConfigServiceV2 from "../../services/config.service.v2";
import ad from "../../services/activedirectory.service";
import handleStandardResponse from "../../utils/handleStandardResponse";

export class Controller {
/**
* @summary Get a specific map config using the supplied
* request parameter "map" as map's name.
*
* @param {*} req
* @param {*} res
* @memberof Controller
*/
byMap(req, res) {
ConfigServiceV2.getMapWithLayers(
req.params.map,
ad.getUserFromRequestHeader(req)
).then((data) => handleStandardResponse(res, data));
}
}
export default new Controller();
4 changes: 4 additions & 0 deletions new-backend/server/api/controllers/configV2/router.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as express from "express";
import controller from "./controller";

export default express.Router().get("/:map", controller.byMap); // Get specific map config
Loading

0 comments on commit 2f0a3cf

Please sign in to comment.