diff --git a/openbis_ng_ui/.prettierrc b/openbis_ng_ui/.prettierrc index b10e63c106124b2ee980fbee8fef8a829005b55b..1a0ad74dd79bab048b66211300da2a2d377a2bab 100644 --- a/openbis_ng_ui/.prettierrc +++ b/openbis_ng_ui/.prettierrc @@ -2,5 +2,7 @@ "semi": false, "endOfLine": "lf", "singleQuote": true, - "jsxSingleQuote": true + "jsxSingleQuote": true, + "trailingComma": "none", + "arrowParens": "avoid" } diff --git a/openbis_ng_ui/package.json b/openbis_ng_ui/package.json index b78cc068ae9f4bfcaf1afdbe79e6c453973377f2..ebcc32c5bed796086dba7a3fa4d1f34450a49ab3 100644 --- a/openbis_ng_ui/package.json +++ b/openbis_ng_ui/package.json @@ -5,62 +5,62 @@ "author": "Antti Luomi", "license": "Apache-2.0", "dependencies": { - "@material-ui/core": "^4.5.0", - "@material-ui/icons": "^4.4.3", + "@material-ui/core": "^4.9.11", + "@material-ui/icons": "^4.9.1", + "@material-ui/lab": "^4.0.0-alpha.50", "history": "^4.10.1", "install": "^0.13.0", - "npm": "^6.11.3", - "path-to-regexp": "^3.1.0", + "npm": "^6.14.4", + "path-to-regexp": "^6.1.0", "prop-types": "^15.7.2", - "re-resizable": "^6.1.0", - "react": "^16.10.1", + "re-resizable": "^6.3.2", + "react": "^16.13.1", "react-beautiful-dnd": "^11.0.5", - "react-dom": "^16.10.1", - "react-redux": "^7.1.1", - "react-router": "^5.1.2", - "redux": "^4.0.4", - "redux-saga": "^1.1.1", + "react-dom": "^16.13.1", + "react-redux": "^7.2.0", + "redux": "^4.0.5", + "redux-saga": "^1.1.3", "reselect": "^4.0.0", "typeface-roboto": "^0.0.75" }, "devDependencies": { - "@babel/core": "^7.6.2", - "@babel/plugin-proposal-class-properties": "^7.5.5", - "@babel/plugin-proposal-object-rest-spread": "^7.6.2", - "@babel/plugin-transform-modules-commonjs": "^7.6.0", - "@babel/plugin-transform-runtime": "^7.6.2", - "@babel/preset-env": "^7.6.2", - "@babel/preset-react": "^7.0.0", + "@babel/core": "^7.9.0", + "@babel/plugin-proposal-class-properties": "^7.8.3", + "@babel/plugin-proposal-object-rest-spread": "^7.9.5", + "@babel/plugin-transform-modules-commonjs": "^7.9.0", + "@babel/plugin-transform-runtime": "^7.9.0", + "@babel/preset-env": "^7.9.5", + "@babel/preset-react": "^7.9.4", "babel-plugin-transform-amd-to-commonjs": "^1.4.0", - "auto-bind": "^2.1.1", - "babel-eslint": "^10.0.3", - "babel-jest": "^24.9.0", - "babel-loader": "^8.0.6", - "css-loader": "^3.2.0", - "enzyme": "^3.10.0", - "enzyme-adapter-react-16": "^1.14.0", - "eslint": "^6.5.1", - "eslint-config-prettier": "^6.3.0", - "eslint-plugin-import": "^2.18.2", - "eslint-plugin-jest": "^22.17.0", - "eslint-plugin-node": "^10.0.0", - "eslint-plugin-prettier": "^3.1.1", + "auto-bind": "^4.0.0", + "babel-eslint": "^10.1.0", + "babel-jest": "^25.4.0", + "babel-loader": "^8.1.0", + "css-loader": "^3.5.3", + "enzyme": "^3.11.0", + "enzyme-adapter-react-16": "^1.15.2", + "eslint": "^6.8.0", + "eslint-config-prettier": "^6.11.0", + "eslint-plugin-import": "^2.20.2", + "eslint-plugin-jest": "^23.8.2", + "eslint-plugin-node": "^11.1.0", + "eslint-plugin-prettier": "^3.1.3", "eslint-plugin-promise": "^4.2.1", - "eslint-plugin-react": "^7.15.1", - "file-loader": "^4.2.0", - "html-webpack-plugin": "^3.2.0", - "jest": "^24.9.0", - "jest-junit": "^8.0.0", - "prettier": "^1.18.2", - "raw-loader": "^3.1.0", - "react-hot-loader": "^4.12.14", - "react-loader": "^2.4.5", + "eslint-plugin-react": "^7.19.0", + "file-loader": "^6.0.0", + "html-webpack-plugin": "^4.2.0", + "jest": "^25.4.0", + "jest-junit": "^10.0.0", + "prettier": "^2.0.5", + "raw-loader": "^4.0.1", + "react-hot-loader": "^4.12.20", + "react-loader": "^2.4.7", "source-map-loader": "^0.2.4", - "style-loader": "^1.0.0", - "url-loader": "^2.1.0", - "webpack": "^4.41.0", - "webpack-cli": "^3.3.9", - "webpack-dev-server": "^3.8.2" + "style-loader": "^1.2.0", + "url-loader": "^4.1.0", + "webpack": "^4.43.0", + "webpack-cli": "^3.3.11", + "webpack-dev-server": "^3.10.3" }, "scripts": { "dev": "webpack-dev-server --hot --config webpack.config.dev.js", diff --git a/openbis_ng_ui/src/js/common/consts/routes.js b/openbis_ng_ui/src/js/common/consts/routes.js index f3fd742fadba1c9e80a56531240daa983571068d..86893e07555a81f1da8964cb1a1f6f25b6d5ccd7 100644 --- a/openbis_ng_ui/src/js/common/consts/routes.js +++ b/openbis_ng_ui/src/js/common/consts/routes.js @@ -1,12 +1,11 @@ import _ from 'lodash' -import { matchPath } from 'react-router' -import pathToRegexp from 'path-to-regexp' +import { compile, match } from 'path-to-regexp' import pages from '@src/js/common/consts/pages.js' import objectTypes from '@src/js/common/consts/objectType.js' function doFormat(actualParams, pattern, requiredParams) { if (_.isMatch(actualParams, requiredParams)) { - let toPath = pathToRegexp.compile(pattern) + let toPath = compile(pattern, { encode: encodeURIComponent }) return { path: toPath(actualParams), match: Object.keys(requiredParams).length @@ -17,15 +16,12 @@ function doFormat(actualParams, pattern, requiredParams) { } function doParse(path, pattern, extraParams) { - let match = matchPath(path, { - path: pattern, - exact: true, - strict: false - }) - if (match) { + let toPathObject = match(pattern, { decode: decodeURIComponent }) + let pathObject = toPathObject(path) + if (pathObject) { return { - path: match.url, - ...match.params, + path: pathObject.path, + ...pathObject.params, ...extraParams } } else {