From ca78e8f05a234348d5d08afdc5cbc4d1554887e9 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 11:52:03 -0500 Subject: [PATCH 01/40] KPMP-4827: Switched to use page state for package information --- package-lock.json | 125 +++++++++--------- .../PackageDashboard/PackageDashboardPage.js | 6 +- .../PackageDashboard/PackageTable.js | 19 ++- 3 files changed, 79 insertions(+), 71 deletions(-) diff --git a/package-lock.json b/package-lock.json index 875b7ea..0c27224 100644 --- a/package-lock.json +++ b/package-lock.json @@ -69,11 +69,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.5.tgz", - "integrity": "sha512-Xmwn266vad+6DAqEB2A6V/CcZVp62BbwVmcOJc2RPuwih1kw02TjQvWVWlcKGbBPd+8/0V5DEkOcizRGYsspYQ==", + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dependencies": { - "@babel/highlight": "^7.22.5" + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" }, "engines": { "node": ">=6.9.0" @@ -158,11 +159,11 @@ } }, "node_modules/@babel/generator": { - "version": "7.22.9", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.22.9.tgz", - "integrity": "sha512-KtLMbmicyuK2Ak/FTCJVbDnkN1SlT8/kceFTiuDiiRUUSMnHMidxSCdG4ndkTOHHpoomWe/4xkvHkEOncwjYIw==", + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dependencies": { - "@babel/types": "^7.22.5", + "@babel/types": "^7.23.6", "@jridgewell/gen-mapping": "^0.3.2", "@jridgewell/trace-mapping": "^0.3.17", "jsesc": "^2.5.1" @@ -289,20 +290,20 @@ } }, "node_modules/@babel/helper-environment-visitor": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.5.tgz", - "integrity": "sha512-XGmhECfVA/5sAt+H+xpSg0mfrHq6FzNr9Oxh7PSEBBRUb/mL7Kz3NICXb194rCqAEdxkhPT1a88teizAFyvk8Q==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-function-name": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.22.5.tgz", - "integrity": "sha512-wtHSq6jMRE3uF2otvfuD3DIvVhOsSNshQl0Qrd7qC9oQJzHvOL4qQXlQn2916+CXGywIjpGuIkoyZRRxHPiNQQ==", + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dependencies": { - "@babel/template": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" }, "engines": { "node": ">=6.9.0" @@ -444,17 +445,17 @@ } }, "node_modules/@babel/helper-string-parser": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", - "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/helper-validator-identifier": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.5.tgz", - "integrity": "sha512-aJXu+6lErq8ltp+JhkJUfk1MTGyuA4v7f3pA+BJ5HLfNC6nAQ0Cpi9uOquUj8Hehg0aUiHzWQbOVJGao6ztBAQ==", + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "engines": { "node": ">=6.9.0" } @@ -494,12 +495,12 @@ } }, "node_modules/@babel/highlight": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.5.tgz", - "integrity": "sha512-BSKlD1hgnedS5XRnGOljZawtag7H1yPfQp0tdNJCHoH6AZ+Pcm9VvkrK59/Yy593Ypg0zMxH2BxD1VPYUQ7UIw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dependencies": { - "@babel/helper-validator-identifier": "^7.22.5", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "engines": { @@ -507,9 +508,9 @@ } }, "node_modules/@babel/parser": { - "version": "7.22.7", - "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.22.7.tgz", - "integrity": "sha512-7NF8pOkHP5o2vpmGgNGcfAeCvOYhGLyA3Z4eBQkT1RJlWu47n63bCs93QfJ2hIAFCil7L5P2IWhs1oToVgrL0Q==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.9.tgz", + "integrity": "sha512-9tcKgqKbs3xGJ+NtKF2ndOBBLVwPjl1SHxPQkd36r3Dlirw3xWUeGaTbqr7uGZcTaxkVNwc+03SVP7aCdWrTlA==", "bin": { "parser": "bin/babel-parser.js" }, @@ -1984,32 +1985,32 @@ "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==" }, "node_modules/@babel/template": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", - "integrity": "sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.23.9.tgz", + "integrity": "sha512-+xrD2BWLpvHKNmX2QbpdpsBaWnRxahMwJjO+KZk2JOElj5nSmKezyS1B4u+QbHMTX69t4ukm6hh9lsYQ7GHCKA==", "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/parser": "^7.22.5", - "@babel/types": "^7.22.5" + "@babel/code-frame": "^7.23.5", + "@babel/parser": "^7.23.9", + "@babel/types": "^7.23.9" }, "engines": { "node": ">=6.9.0" } }, "node_modules/@babel/traverse": { - "version": "7.22.8", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.22.8.tgz", - "integrity": "sha512-y6LPR+wpM2I3qJrsheCTwhIinzkETbplIgPBbwvqPKc+uljeA5gP+3nP8irdYt1mjQaDnlIcG+dw8OjAco4GXw==", - "dependencies": { - "@babel/code-frame": "^7.22.5", - "@babel/generator": "^7.22.7", - "@babel/helper-environment-visitor": "^7.22.5", - "@babel/helper-function-name": "^7.22.5", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.9.tgz", + "integrity": "sha512-I/4UJ9vs90OkBtY6iiiTORVMyIhJ4kAVmsKo9KFc8UOxMeUfi2hvtIBsET5u9GizXE6/GFSuKCTNfgCswuEjRg==", + "dependencies": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", "@babel/helper-hoist-variables": "^7.22.5", "@babel/helper-split-export-declaration": "^7.22.6", - "@babel/parser": "^7.22.7", - "@babel/types": "^7.22.5", - "debug": "^4.1.0", + "@babel/parser": "^7.23.9", + "@babel/types": "^7.23.9", + "debug": "^4.3.1", "globals": "^11.1.0" }, "engines": { @@ -2017,12 +2018,12 @@ } }, "node_modules/@babel/types": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.22.5.tgz", - "integrity": "sha512-zo3MIHGOkPOfoRXitsgHLjEXmlDaD/5KU1Uzuc9GNiZPhSqVxVRtxuPaSBZDsYZ9qV88AjtMtWW7ww98loJ9KA==", + "version": "7.23.9", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.9.tgz", + "integrity": "sha512-dQjSq/7HaSjRM43FFGnv5keM2HsxpmyV1PfaSVm0nzzjwwTmjOe6J4bC8e3+pTEIgHaHj+1ZlLThRJ2auc/w1Q==", "dependencies": { - "@babel/helper-string-parser": "^7.22.5", - "@babel/helper-validator-identifier": "^7.22.5", + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", "to-fast-properties": "^2.0.0" }, "engines": { @@ -7820,9 +7821,9 @@ "integrity": "sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==" }, "node_modules/follow-redirects": { - "version": "1.15.2", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.2.tgz", - "integrity": "sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==", + "version": "1.15.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.5.tgz", + "integrity": "sha512-vSFWUON1B+yAw1VN4xMfxgn5fTUiaOzAJCKBwIIgT/+7CuGy9+r+5gITvP62j3RmaD5Ph65UaERdOSRGUzZtgw==", "funding": [ { "type": "individual", @@ -11921,9 +11922,9 @@ } }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", @@ -12716,9 +12717,9 @@ } }, "node_modules/postcss": { - "version": "8.4.26", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.26.tgz", - "integrity": "sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==", + "version": "8.4.33", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz", + "integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==", "funding": [ { "type": "opencollective", @@ -12734,7 +12735,7 @@ } ], "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, diff --git a/src/components/PackageDashboard/PackageDashboardPage.js b/src/components/PackageDashboard/PackageDashboardPage.js index 45d23c5..58f1acb 100644 --- a/src/components/PackageDashboard/PackageDashboardPage.js +++ b/src/components/PackageDashboard/PackageDashboardPage.js @@ -5,10 +5,6 @@ import PackageTable from './PackageTable'; class PackageDashboardPage extends Component { - componentDidMount() { - this.props.getPackages(); - } - render() { return ( @@ -22,7 +18,7 @@ class PackageDashboardPage extends Component { diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 330ee02..c3770c7 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -50,10 +50,20 @@ class PackageTable extends Component { this.state = { sorted: [], filtered: [], - columns: this.getColumns() + columns: this.getColumns(), + packages: [] }; }; + async componentDidMount() { + await this.getPackages(); + } + + async getPackages() { + let packages = await this.props.getPackages(); + this.setState({packages: packages}); + } + getColumns() { return [ @@ -208,7 +218,7 @@ class PackageTable extends Component {
Date: Mon, 29 Jan 2024 12:05:15 -0500 Subject: [PATCH 02/40] KPMP-4827: Check that data is loaded --- .../PackageDashboard/PackageTable.js | 66 +++++++++++-------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index c3770c7..ccb25f6 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -213,36 +213,46 @@ class PackageTable extends Component { }); } + render() { + let message = null; + if (this.state.packages.length === 0) { + message = "Loading packages..."; + } return ( -
- - - - - - - - +
{ message !== null ? +

{message}

+ : +
+ + + + + + + + +
+ }
); } From df19267d81bf7caa02278448c5a3eb1b2507f1f8 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 12:10:41 -0500 Subject: [PATCH 03/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index ccb25f6..7a04ae9 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -217,12 +217,9 @@ class PackageTable extends Component { render() { let message = null; if (this.state.packages.length === 0) { - message = "Loading packages..."; - } - return ( -
{ message !== null ? -

{message}

- : + return

Loading packages...

+ } else { + return (
-
- } -
- ); +
+ ); + } } } From 74e3d9fc3724e7d0f114b94539c332d758c31627 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 12:12:23 -0500 Subject: [PATCH 04/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 7a04ae9..0e10384 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -216,7 +216,7 @@ class PackageTable extends Component { render() { let message = null; - if (this.state.packages.length === 0) { + if (this.state.packages && this.state.packages.length === 0) { return

Loading packages...

} else { return ( From 4b21b5a2121d14606514e09d90945b381404cc29 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 12:15:32 -0500 Subject: [PATCH 05/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 0e10384..1cce4df 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -51,7 +51,8 @@ class PackageTable extends Component { sorted: [], filtered: [], columns: this.getColumns(), - packages: [] + packages: [], + isLoaded: false }; }; @@ -61,7 +62,7 @@ class PackageTable extends Component { async getPackages() { let packages = await this.props.getPackages(); - this.setState({packages: packages}); + this.setState({packages: packages, isLoaded: true}); } @@ -200,6 +201,7 @@ class PackageTable extends Component { } prepareData = (packages) => { + console.log(packages) return packages.map((pkg) => { return { [PACKAGE_ID_LABEL]: pkg[PACKAGE_INFO_PROPERTY][PACKAGE_ID], @@ -215,8 +217,7 @@ class PackageTable extends Component { render() { - let message = null; - if (this.state.packages && this.state.packages.length === 0) { + if (!this.state.isLoaded) { return

Loading packages...

} else { return ( From 80fdefb65c41043633da05784fc4d9d2c2584dbb Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 12:17:33 -0500 Subject: [PATCH 06/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 1cce4df..6c6d7f0 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -61,7 +61,9 @@ class PackageTable extends Component { } async getPackages() { + console.log("Getting packages") let packages = await this.props.getPackages(); + console.log(packages); this.setState({packages: packages, isLoaded: true}); } From bb49fed3585694b61556584c3db0a2c26167e01a Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:33:21 -0500 Subject: [PATCH 07/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 12 ++++ .../PackageDashboard/PackageDashboardPage.js | 1 - .../PackageDashboard/PackageTable.js | 71 +++++++++---------- 3 files changed, 46 insertions(+), 38 deletions(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index eff7751..02f4dbf 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -4,6 +4,18 @@ import { sendMessageToBackend } from '../Error/errorActions'; const api = Api.getInstance(); +export const getPackagesStateless = () => { + return (dispatch) => { + api.get('/api/v1/packages?shouldExclude=false') + .then(res=> { + return res.data + }) + .catch(err => { + dispatch(sendMessageToBackend(err)); + }); + } +} + export const getPackages = () => { return (dispatch) => { api.get('/api/v1/packages?shouldExclude=false') diff --git a/src/components/PackageDashboard/PackageDashboardPage.js b/src/components/PackageDashboard/PackageDashboardPage.js index 58f1acb..5d9b40a 100644 --- a/src/components/PackageDashboard/PackageDashboardPage.js +++ b/src/components/PackageDashboard/PackageDashboardPage.js @@ -18,7 +18,6 @@ class PackageDashboardPage extends Component { diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 6c6d7f0..f123064 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -8,6 +8,7 @@ import { getStateDisplayText } from './stateDisplayHelper'; import { faDownload } from '@fortawesome/free-solid-svg-icons'; import { CSVLink } from 'react-csv'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { getPackagesStateless } from '../../actions/Packages/packageActions'; const PACKAGE_ID_LABEL = 'Package ID'; const PACKAGE_TYPE_LABEL = 'Package Type'; @@ -58,16 +59,14 @@ class PackageTable extends Component { async componentDidMount() { await this.getPackages(); + console.log(this.state.packages) } async getPackages() { - console.log("Getting packages") - let packages = await this.props.getPackages(); - console.log(packages); + let packages = await getPackagesStateless(); this.setState({packages: packages, isLoaded: true}); } - getColumns() { return [ { @@ -203,7 +202,6 @@ class PackageTable extends Component { } prepareData = (packages) => { - console.log(packages) return packages.map((pkg) => { return { [PACKAGE_ID_LABEL]: pkg[PACKAGE_INFO_PROPERTY][PACKAGE_ID], @@ -217,40 +215,41 @@ class PackageTable extends Component { }); } - render() { if (!this.state.isLoaded) { - return

Loading packages...

+ return ( +

Loading packages...

+ ) } else { return (
- - - - - - - - + + + + + + + +
); } @@ -258,9 +257,7 @@ class PackageTable extends Component { } PackageTable.propTypes = { - getPackages: PropTypes.func, - movePackageFile: PropTypes.func, - stateDisplayMap: PropTypes.arrayOf(PropTypes.object) + stateDisplayMap: PropTypes.arrayOf(PropTypes.object) }; export default PackageTable; From acdcf33c5f75ed53326bb6f8a70d3baff7de0a58 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:35:21 -0500 Subject: [PATCH 08/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index f123064..8693f37 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -59,11 +59,12 @@ class PackageTable extends Component { async componentDidMount() { await this.getPackages(); - console.log(this.state.packages) } async getPackages() { let packages = await getPackagesStateless(); + + console.log("packages received") this.setState({packages: packages, isLoaded: true}); } @@ -216,6 +217,7 @@ class PackageTable extends Component { } render() { + console.log(this.state.isLoaded) if (!this.state.isLoaded) { return (

Loading packages...

From 0789b9c3b6035a4abf04566591e0807eea9622e3 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:38:20 -0500 Subject: [PATCH 09/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 8693f37..184597a 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -51,7 +51,7 @@ class PackageTable extends Component { this.state = { sorted: [], filtered: [], - columns: this.getColumns(), + columns: [], packages: [], isLoaded: false }; @@ -202,8 +202,9 @@ class PackageTable extends Component { }); } - prepareData = (packages) => { - return packages.map((pkg) => { + prepareData = () => { + console.log(this.state.packages) + return this.state.packages.map((pkg) => { return { [PACKAGE_ID_LABEL]: pkg[PACKAGE_INFO_PROPERTY][PACKAGE_ID], [SUBJECT_ID_LABEL]: pkg[PACKAGE_INFO_PROPERTY][SUBJECT_ID], @@ -223,11 +224,12 @@ class PackageTable extends Component {

Loading packages...

) } else { + this.setState({columns: this.getColumns()}); return (
Date: Mon, 29 Jan 2024 14:39:53 -0500 Subject: [PATCH 10/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index 02f4dbf..959ac4d 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -5,15 +5,11 @@ import { sendMessageToBackend } from '../Error/errorActions'; const api = Api.getInstance(); export const getPackagesStateless = () => { - return (dispatch) => { + api.get('/api/v1/packages?shouldExclude=false') .then(res=> { return res.data - }) - .catch(err => { - dispatch(sendMessageToBackend(err)); }); - } } export const getPackages = () => { From 1d3ac2297dde73f7c7abaa9c788fa585827b4a28 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:41:34 -0500 Subject: [PATCH 11/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index 959ac4d..b4d58b5 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -9,9 +9,16 @@ export const getPackagesStateless = () => { api.get('/api/v1/packages?shouldExclude=false') .then(res=> { return res.data + }) + .catch(error => { + logError(error); }); } +export const logError = (error) => { + dispatch(sendMessageToBackend(error)); +} + export const getPackages = () => { return (dispatch) => { api.get('/api/v1/packages?shouldExclude=false') From 3a2cf58383e04a133bb39cc8cac2741a4df9e640 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:42:52 -0500 Subject: [PATCH 12/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index b4d58b5..ea593bf 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -16,8 +16,11 @@ export const getPackagesStateless = () => { } export const logError = (error) => { - dispatch(sendMessageToBackend(error)); + return(dispatch) => { + dispatch(sendMessageToBackend(error)); + } } + export const getPackages = () => { return (dispatch) => { From 0a303f3e1a4cfda35e8b41b3a1093906035233dd Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:43:45 -0500 Subject: [PATCH 13/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index ea593bf..88a7ebb 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -6,20 +6,20 @@ const api = Api.getInstance(); export const getPackagesStateless = () => { - api.get('/api/v1/packages?shouldExclude=false') + api.get('/api/v1/packages?shouldExclude=false') .then(res=> { return res.data }) .catch(error => { - logError(error); + // logError(error); }); } -export const logError = (error) => { - return(dispatch) => { - dispatch(sendMessageToBackend(error)); - } -} +// export const logError = (error) => { +// return(dispatch) => { +// dispatch(sendMessageToBackend(error)); +// } +// } export const getPackages = () => { From 1453da6ce8bef1f729ee5c814f2d796584232e89 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:45:34 -0500 Subject: [PATCH 14/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index 88a7ebb..6792b55 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -8,9 +8,11 @@ export const getPackagesStateless = () => { api.get('/api/v1/packages?shouldExclude=false') .then(res=> { + console.log(res.data) return res.data }) .catch(error => { + console.log(error) // logError(error); }); } From b41463a6378f1ba3313481c9440a0478a968c6ed Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:48:43 -0500 Subject: [PATCH 15/40] KPMP-4827: Check that data is loaded --- src/helpers/Api.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers/Api.js b/src/helpers/Api.js index b16405b..41d247c 100644 --- a/src/helpers/Api.js +++ b/src/helpers/Api.js @@ -5,7 +5,7 @@ export default class Api { constructor() { this.axios = axios.create({ - timeout: 15000, + timeout: 61000, }); } From 81b6f3900f46d1f1db60d79d57049d7a836bb8ad Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 14:54:49 -0500 Subject: [PATCH 16/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 2 +- src/components/PackageDashboard/PackageTable.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index 6792b55..404f707 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -6,7 +6,7 @@ const api = Api.getInstance(); export const getPackagesStateless = () => { - api.get('/api/v1/packages?shouldExclude=false') + return api.get('/api/v1/packages?shouldExclude=false') .then(res=> { console.log(res.data) return res.data diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 184597a..406249d 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -64,7 +64,7 @@ class PackageTable extends Component { async getPackages() { let packages = await getPackagesStateless(); - console.log("packages received") + console.log(packages) this.setState({packages: packages, isLoaded: true}); } From bc830150e7e63c45c6f8eddacacdd5f7adbd005e Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:00:36 -0500 Subject: [PATCH 17/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 406249d..c128ae4 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -55,10 +55,13 @@ class PackageTable extends Component { packages: [], isLoaded: false }; + this.pollIfMounted = this.pollIfMounted.bind(this); }; async componentDidMount() { - await this.getPackages(); + if (!this.state.isLoaded) { + await this.getPackages(); + } } async getPackages() { @@ -68,6 +71,8 @@ class PackageTable extends Component { this.setState({packages: packages, isLoaded: true}); } + + getColumns() { return [ { From 3a57203c4e777a302a14f801652c6e72c7d652c3 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:01:48 -0500 Subject: [PATCH 18/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index c128ae4..7deb117 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -55,7 +55,6 @@ class PackageTable extends Component { packages: [], isLoaded: false }; - this.pollIfMounted = this.pollIfMounted.bind(this); }; async componentDidMount() { From 727374904ad2d781ecc8aa13a50a20a4ab56f53e Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:05:58 -0500 Subject: [PATCH 19/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 7deb117..8b05542 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -53,7 +53,8 @@ class PackageTable extends Component { filtered: [], columns: [], packages: [], - isLoaded: false + isLoaded: false, + preparedData: [] }; }; @@ -65,9 +66,10 @@ class PackageTable extends Component { async getPackages() { let packages = await getPackagesStateless(); + let preparedData = this.prepareData(packages); console.log(packages) - this.setState({packages: packages, isLoaded: true}); + this.setState({packages: packages, preparedData: preparedData, isLoaded: true}); } @@ -206,9 +208,8 @@ class PackageTable extends Component { }); } - prepareData = () => { - console.log(this.state.packages) - return this.state.packages.map((pkg) => { + prepareData = (packages) => { + return packages.map((pkg) => { return { [PACKAGE_ID_LABEL]: pkg[PACKAGE_INFO_PROPERTY][PACKAGE_ID], [SUBJECT_ID_LABEL]: pkg[PACKAGE_INFO_PROPERTY][SUBJECT_ID], @@ -222,7 +223,6 @@ class PackageTable extends Component { } render() { - console.log(this.state.isLoaded) if (!this.state.isLoaded) { return (

Loading packages...

@@ -233,7 +233,7 @@ class PackageTable extends Component {
Date: Mon, 29 Jan 2024 15:11:36 -0500 Subject: [PATCH 20/40] KPMP-4827: Check that data is loaded --- src/actions/Packages/packageActions.js | 1 - src/components/PackageDashboard/PackageTable.js | 10 +++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index 404f707..7b06ea6 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -8,7 +8,6 @@ export const getPackagesStateless = () => { return api.get('/api/v1/packages?shouldExclude=false') .then(res=> { - console.log(res.data) return res.data }) .catch(error => { diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 8b05542..2ef342e 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -53,8 +53,7 @@ class PackageTable extends Component { filtered: [], columns: [], packages: [], - isLoaded: false, - preparedData: [] + isLoaded: false }; }; @@ -66,10 +65,7 @@ class PackageTable extends Component { async getPackages() { let packages = await getPackagesStateless(); - let preparedData = this.prepareData(packages); - - console.log(packages) - this.setState({packages: packages, preparedData: preparedData, isLoaded: true}); + this.setState({packages: packages, isLoaded: true}); } @@ -233,7 +229,7 @@ class PackageTable extends Component {
Date: Mon, 29 Jan 2024 15:13:21 -0500 Subject: [PATCH 21/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 2ef342e..aedb7ea 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -228,14 +228,14 @@ class PackageTable extends Component { return (
- - + */} Date: Mon, 29 Jan 2024 15:14:23 -0500 Subject: [PATCH 22/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index aedb7ea..a26a273 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -58,12 +58,15 @@ class PackageTable extends Component { }; async componentDidMount() { + if (!this.state.isLoaded) { + console.log("Here") await this.getPackages(); } } async getPackages() { + console.log("getting packages ") let packages = await getPackagesStateless(); this.setState({packages: packages, isLoaded: true}); } From 3e1dff00685dbd6535cdb0991067cc3678ef333d Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:16:03 -0500 Subject: [PATCH 23/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index a26a273..2018d8c 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -61,18 +61,11 @@ class PackageTable extends Component { if (!this.state.isLoaded) { console.log("Here") - await this.getPackages(); + let packages = await getPackagesStateless(); + this.setState({packages: packages, isLoaded: true}); } } - async getPackages() { - console.log("getting packages ") - let packages = await getPackagesStateless(); - this.setState({packages: packages, isLoaded: true}); - } - - - getColumns() { return [ { From 8136a16c04d707261ab0763aae5ff57277d86491 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:17:40 -0500 Subject: [PATCH 24/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageTable.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 2018d8c..33ab4c2 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -215,12 +215,11 @@ class PackageTable extends Component { } render() { - if (!this.state.isLoaded) { + if (this.state.packages.length === 0) { return (

Loading packages...

) } else { - this.setState({columns: this.getColumns()}); return (
@@ -241,7 +240,7 @@ class PackageTable extends Component { filtered={this.state.filtered} onSortedChange={this.onSortedChange} onFilteredChange={this.onFilteredChange} - columns={this.state.columns} + columns={this.getColumns()} defaultPageSize={12} defaultFilterMethod={this.defaultFilterMethod} filterable From eaf8c27347ae53857a4b30de2f5c42b12af45c84 Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:21:05 -0500 Subject: [PATCH 25/40] KPMP-4827: Check that data is loaded --- src/components/PackageDashboard/PackageDashboardPage.js | 4 ++++ .../PackageDashboard/PackageDashboardPageContainer.js | 4 ---- src/components/PackageDashboard/PackageTable.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/components/PackageDashboard/PackageDashboardPage.js b/src/components/PackageDashboard/PackageDashboardPage.js index 5d9b40a..56d8868 100644 --- a/src/components/PackageDashboard/PackageDashboardPage.js +++ b/src/components/PackageDashboard/PackageDashboardPage.js @@ -5,6 +5,10 @@ import PackageTable from './PackageTable'; class PackageDashboardPage extends Component { + componentDidMount() { + this.props.getStateDisplay(); + } + render() { return ( diff --git a/src/components/PackageDashboard/PackageDashboardPageContainer.js b/src/components/PackageDashboard/PackageDashboardPageContainer.js index dcfbc8f..d299335 100644 --- a/src/components/PackageDashboard/PackageDashboardPageContainer.js +++ b/src/components/PackageDashboard/PackageDashboardPageContainer.js @@ -8,10 +8,6 @@ const mapStateToProps = (state, props) => ({ }); const mapDispatchToProps = (dispatch, props) => ({ - getPackages() { - dispatch(getPackages()); - dispatch(getStateDisplayMap()); - }, movePackageFiles(packageId) { dispatch(movePackageFiles(packageId)); } diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 33ab4c2..271ded8 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -223,14 +223,14 @@ class PackageTable extends Component { return (
- {/* - */} + Date: Mon, 29 Jan 2024 15:21:46 -0500 Subject: [PATCH 26/40] KPMP-4827: Check that data is loaded --- .../PackageDashboard/PackageDashboardPageContainer.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/PackageDashboard/PackageDashboardPageContainer.js b/src/components/PackageDashboard/PackageDashboardPageContainer.js index d299335..f08849e 100644 --- a/src/components/PackageDashboard/PackageDashboardPageContainer.js +++ b/src/components/PackageDashboard/PackageDashboardPageContainer.js @@ -8,6 +8,9 @@ const mapStateToProps = (state, props) => ({ }); const mapDispatchToProps = (dispatch, props) => ({ + getStateDisplay() { + dispatch(getStateDisplayMap()); + }, movePackageFiles(packageId) { dispatch(movePackageFiles(packageId)); } From d3b01f92ead0f60b200fbae6478e32dc010d67db Mon Sep 17 00:00:00 2001 From: Becky Reamy Date: Mon, 29 Jan 2024 15:40:19 -0500 Subject: [PATCH 27/40] KPMP-4827: minor cleanup --- src/actions/Packages/packageActions.js | 30 ++----------------- .../Validation/validationActions.test.js | 26 ---------------- src/actions/actionNames.js | 1 - .../PackageDashboardPageContainer.js | 2 +- .../PackageDashboard/PackageTable.js | 1 - .../PackageDashboard/packageReducer.js | 4 --- .../PackageDashboard/packageReducer.test.js | 7 ----- 7 files changed, 3 insertions(+), 68 deletions(-) delete mode 100644 src/actions/Validation/validationActions.test.js diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index 7b06ea6..ed4471f 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -12,28 +12,9 @@ export const getPackagesStateless = () => { }) .catch(error => { console.log(error) - // logError(error); + alert("We hit an error getting packages...talk to a dev.") }); -} - -// export const logError = (error) => { -// return(dispatch) => { -// dispatch(sendMessageToBackend(error)); -// } -// } - - -export const getPackages = () => { - return (dispatch) => { - api.get('/api/v1/packages?shouldExclude=false') - .then(res => { - dispatch(setPackages(res.data)); - }) - .catch(err => { - dispatch(sendMessageToBackend(err)); - }); - }; -} +} export const movePackageFiles = (packageId) => { return (dispatch) => { @@ -47,13 +28,6 @@ export const movePackageFiles = (packageId) => { } } -export const setPackages = (packages) => { - return { - type: actionNames.SET_PACKAGES, - payload: packages - } -} - export const setStateDisplayMap = (stateDisplayMap) => { return { type: actionNames.SET_STATE_DISPLAY_MAP, diff --git a/src/actions/Validation/validationActions.test.js b/src/actions/Validation/validationActions.test.js deleted file mode 100644 index 49d96c6..0000000 --- a/src/actions/Validation/validationActions.test.js +++ /dev/null @@ -1,26 +0,0 @@ -import actionNames from '../actionNames'; -import { setValidationResult, clearValidationResult } from './validationActions'; - -describe('setValidationResult', () => { - it('should return the result in the correct structure', () => { - let expectedResult = { - type: actionNames.SET_VALIDATION_RESULT, - payload: { 'key': 'value' } - }; - - let result = setValidationResult({ 'key': 'value' }); - - expect(result).toEqual(expectedResult); - }); -}); -describe('clearValidationResult', () => { - it('should return the result in the correct structure', () => { - let expectedResult = { - type: actionNames.CLEAR_VALIDATION_RESULT - }; - - let result = clearValidationResult(); - - expect(result).toEqual(expectedResult); - }); -}); \ No newline at end of file diff --git a/src/actions/actionNames.js b/src/actions/actionNames.js index 8d81c17..6fe3432 100644 --- a/src/actions/actionNames.js +++ b/src/actions/actionNames.js @@ -2,7 +2,6 @@ const actionNames = { CLEAR_VALIDATION_RESULT: 'CLEAR_VALIDATION_RESULT', GET_PACKAGES: 'GET_PACKAGES', RESET_STATE: 'RESET_STATE', - SET_PACKAGES: 'SET_PACKAGES', SET_STATE_DISPLAY_MAP: 'SET_STATE_DISPLAY_MAP', SET_VALIDATION_RESULT: 'SET_VALIDATION_RESULT' }; diff --git a/src/components/PackageDashboard/PackageDashboardPageContainer.js b/src/components/PackageDashboard/PackageDashboardPageContainer.js index f08849e..0aa5d89 100644 --- a/src/components/PackageDashboard/PackageDashboardPageContainer.js +++ b/src/components/PackageDashboard/PackageDashboardPageContainer.js @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import { getPackages, movePackageFiles, getStateDisplayMap } from "../../actions/Packages/packageActions"; +import { movePackageFiles, getStateDisplayMap } from "../../actions/Packages/packageActions"; import PackageDashboardPage from './PackageDashboardPage'; const mapStateToProps = (state, props) => ({ diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 271ded8..0edf3ae 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -60,7 +60,6 @@ class PackageTable extends Component { async componentDidMount() { if (!this.state.isLoaded) { - console.log("Here") let packages = await getPackagesStateless(); this.setState({packages: packages, isLoaded: true}); } diff --git a/src/components/PackageDashboard/packageReducer.js b/src/components/PackageDashboard/packageReducer.js index 1a2dbfe..46edcb4 100644 --- a/src/components/PackageDashboard/packageReducer.js +++ b/src/components/PackageDashboard/packageReducer.js @@ -4,10 +4,6 @@ export const packages = (state = [], action) => { let newState = []; switch (action.type) { - case actionNames.SET_PACKAGES: - newState = action.payload; - return newState; - default: return state; } diff --git a/src/components/PackageDashboard/packageReducer.test.js b/src/components/PackageDashboard/packageReducer.test.js index 010f884..9b16a53 100644 --- a/src/components/PackageDashboard/packageReducer.test.js +++ b/src/components/PackageDashboard/packageReducer.test.js @@ -10,11 +10,4 @@ describe('packages', () => { expect(packages([], action)).toEqual([]); }); - it('should return the new state if known action', () => { - let action = { - type: actionNames.SET_PACKAGES, - payload: 'new stuff' - }; - expect(packages([], action)).toEqual('new stuff'); - }); }); \ No newline at end of file From f36aeca9605b81338e5758eec87c44b4d7e4b719 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Tue, 13 Feb 2024 14:52:25 -0500 Subject: [PATCH 28/40] KPMP-4691: update alert message --- src/actions/Packages/packageActions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/actions/Packages/packageActions.js b/src/actions/Packages/packageActions.js index ed4471f..8661067 100644 --- a/src/actions/Packages/packageActions.js +++ b/src/actions/Packages/packageActions.js @@ -20,7 +20,7 @@ export const movePackageFiles = (packageId) => { return (dispatch) => { api.post('/api/v1/packages/' + packageId + '/files/move') .then(res => { - alert(res.data); + alert("Package marked as ready to move."); }) .catch(err => { alert("There was a problem moving the files."); From 5caf06bbcf5933582b8970e19dfc007410763dbd Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Wed, 17 Apr 2024 13:58:37 -0400 Subject: [PATCH 29/40] add .env for globus endpoint --- .env.example | 1 + .gitignore | 1 + src/components/PackageDashboard/PackageTable.js | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..fef439a --- /dev/null +++ b/.env.example @@ -0,0 +1 @@ +GLOBUS_INBOX=PROD_INBOX \ No newline at end of file diff --git a/.gitignore b/.gitignore index 427044f..3d9804f 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ node_modules node_modules/* .project *.css +.env \ No newline at end of file diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 0edf3ae..b85afc9 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -115,7 +115,7 @@ class PackageTable extends Component { Cell: (info) => { let row = info.original; // eslint-disable-next-line - let href = 'https://app.globus.org/file-manager?origin_id=d4560298-72ed-11ec-bdef-55fe55c2cfea&origin_path=/PROD_INBOX/' + row[PACKAGE_INFO_PROPERTY][PACKAGE_ID]; + let href = 'https://app.globus.org/file-manager?origin_id=d4560298-72ed-11ec-bdef-55fe55c2cfea&origin_path=/' + process.env.GLOBUS_INBOX + row[PACKAGE_INFO_PROPERTY][PACKAGE_ID]; // eslint-disable-next-line if(row[PACKAGE_INFO_PROPERTY][LARGE_FILE_UPLOAD]) { return ( From 25aea663a0a9e79c5de4b3e450ae5a3edbca7503 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Wed, 17 Apr 2024 13:59:51 -0400 Subject: [PATCH 30/40] remove env var --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index fef439a..e0fac20 100644 --- a/.env.example +++ b/.env.example @@ -1 +1 @@ -GLOBUS_INBOX=PROD_INBOX \ No newline at end of file +GLOBUS_INBOX= \ No newline at end of file From 611491ba0b3375689e6244d65e62660e227643f1 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Wed, 17 Apr 2024 15:10:27 -0400 Subject: [PATCH 31/40] use react app refix --- .env.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env.example b/.env.example index e0fac20..68d9cf0 100644 --- a/.env.example +++ b/.env.example @@ -1 +1 @@ -GLOBUS_INBOX= \ No newline at end of file +REACT_APP_GLOBUS_INBOX= \ No newline at end of file From 36f4c7b5fc26f8d92555661fb23867da48b35e2e Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Wed, 17 Apr 2024 15:13:19 -0400 Subject: [PATCH 32/40] change variable --- src/components/PackageDashboard/PackageTable.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index b85afc9..aa661a6 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -115,7 +115,7 @@ class PackageTable extends Component { Cell: (info) => { let row = info.original; // eslint-disable-next-line - let href = 'https://app.globus.org/file-manager?origin_id=d4560298-72ed-11ec-bdef-55fe55c2cfea&origin_path=/' + process.env.GLOBUS_INBOX + row[PACKAGE_INFO_PROPERTY][PACKAGE_ID]; + let href = 'https://app.globus.org/file-manager?origin_id=d4560298-72ed-11ec-bdef-55fe55c2cfea&origin_path=/' + process.env.REACT_APP_GLOBUS_INBOX + row[PACKAGE_INFO_PROPERTY][PACKAGE_ID]; // eslint-disable-next-line if(row[PACKAGE_INFO_PROPERTY][LARGE_FILE_UPLOAD]) { return ( From 48ab263a74b66763aa388eea50469d30532fafaa Mon Sep 17 00:00:00 2001 From: Haneen Tout <55216015+HaneenT@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:21:22 -0400 Subject: [PATCH 33/40] Update PackageTable.js --- src/components/PackageDashboard/PackageTable.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index aa661a6..0bad748 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -58,7 +58,6 @@ class PackageTable extends Component { }; async componentDidMount() { - if (!this.state.isLoaded) { let packages = await getPackagesStateless(); this.setState({packages: packages, isLoaded: true}); From 27ff22c5e39812eb79337abf35d1c74a096018d6 Mon Sep 17 00:00:00 2001 From: rlreamy <34109594+rlreamy@users.noreply.github.com> Date: Fri, 19 Apr 2024 09:23:20 -0400 Subject: [PATCH 34/40] Delete .travis.yml --- .travis.yml | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 950ab33..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -before_install: -- export TZ=America/Detroit - -language: node_js - -node_js: - - 11 - -script: - - CI=true npm test - - npm run build - -notifications: - email: - - rlreamy@umich.edu - - zwright@umich.edu - - rossmith@umich.edu From 7d5f3987716d2529c3f950c2f5490f0b0cef5de6 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Mon, 22 Apr 2024 15:52:58 -0400 Subject: [PATCH 35/40] KPMP-5342: remove Move Files button & Package State col --- src/components/PackageDashboard/PackageTable.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 0bad748..0eea587 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -102,12 +102,6 @@ class PackageTable extends Component { } }, { - Header: PACKAGE_STATE_LABEL, - id: PACKAGE_STATE_ID, - accessor: (row) => { - return getStateDisplayText(row.state, this.props.stateDisplayMap); - } - }, { Header: GLOBUS_LINK_LABEL, accessor: 'link', filterable: false, @@ -134,13 +128,7 @@ class PackageTable extends Component { let row = info.original; // eslint-disable-next-line if(row[PACKAGE_INFO_PROPERTY][LARGE_FILE_UPLOAD] && row.state[PACKAGE_STATE_ID] === 'METADATA_RECEIVED') { - if(row[GLOBUS_MOVE_STATUS] === null || row[GLOBUS_MOVE_STATUS] === ""){ - return ( - // eslint-disable-next-line - - ); - } - else if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "processing" || row[GLOBUS_MOVE_STATUS].toLowerCase() === "waiting") { + if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "processing" || row[GLOBUS_MOVE_STATUS].toLowerCase() === "waiting") { return (

awaiting move

); @@ -206,8 +194,7 @@ class PackageTable extends Component { [PACKAGE_TYPE_LABEL]: pkg[PACKAGE_INFO_PROPERTY][PACKAGE_TYPE_ID], [SUBMITTER_LABEL]: pkg[PACKAGE_INFO_PROPERTY].submitter && pkg[PACKAGE_INFO_PROPERTY].submitter[SUBMITTER_ID] ? pkg[PACKAGE_INFO_PROPERTY].submitter[SUBMITTER_ID] : pkg[PACKAGE_INFO_PROPERTY].submitter[SUBMITTER_FIRST_NAME] + ' ' + pkg[PACKAGE_INFO_PROPERTY].submitter[SUBMITTER_LAST_NAME], [TIS_NAME_LABEL]: pkg[PACKAGE_INFO_PROPERTY][TIS_NAME_ID], - [DATE_SUBMITTED_LABEL]: new Moment(pkg[PACKAGE_INFO_PROPERTY][DATE_SUBMITTED_ID]).local().format(DATE_FORMAT), - [PACKAGE_STATE_LABEL]: getStateDisplayText(pkg.state, this.props.stateDisplayMap) + [DATE_SUBMITTED_LABEL]: new Moment(pkg[PACKAGE_INFO_PROPERTY][DATE_SUBMITTED_ID]).local().format(DATE_FORMAT) } }); } From deeb18672463d39f8ea428ea84acc6a1d19eecf6 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Tue, 23 Apr 2024 09:24:10 -0400 Subject: [PATCH 36/40] add else block --- src/components/PackageDashboard/PackageTable.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 0eea587..7c85006 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -141,6 +141,9 @@ class PackageTable extends Component { else if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "success") { return ''; } + else { + return ''; + } } else { // eslint-disable-next-line return ''; From c74ce307ddb56f2ed9da247d685ad0721aedee6a Mon Sep 17 00:00:00 2001 From: HaneenT Date: Tue, 23 Apr 2024 11:02:23 -0400 Subject: [PATCH 37/40] KPMP-5342: added text for successful moves in the Move column --- src/components/PackageDashboard/PackageTable.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index 7c85006..a69e1fe 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -128,7 +128,12 @@ class PackageTable extends Component { let row = info.original; // eslint-disable-next-line if(row[PACKAGE_INFO_PROPERTY][LARGE_FILE_UPLOAD] && row.state[PACKAGE_STATE_ID] === 'METADATA_RECEIVED') { - if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "processing" || row[GLOBUS_MOVE_STATUS].toLowerCase() === "waiting") { + if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "processing") { + return ( +

moving...

+ ); + } + else if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "waiting") { return (

awaiting move

); @@ -139,7 +144,9 @@ class PackageTable extends Component { ); } else if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "success") { - return ''; + return ( +

ready for review

+ ); } else { return ''; From a02a51db5ab54325bef6802730b1cefb44293ff6 Mon Sep 17 00:00:00 2001 From: HaneenT Date: Tue, 23 Apr 2024 11:13:17 -0400 Subject: [PATCH 38/40] KPMP-5342: added case for non-METADATA_RECEIVED state --- src/components/PackageDashboard/PackageTable.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index a69e1fe..bda905c 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -151,7 +151,13 @@ class PackageTable extends Component { else { return ''; } - } else { + } + else if (row[GLOBUS_MOVE_STATUS].toLowerCase() === "success") { + return ( +

ready for review

+ ); + } + else { // eslint-disable-next-line return ''; } From 277f9f140ea4219623cb645bcf1d99a80bf54ef9 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Fri, 26 Apr 2024 13:30:45 -0400 Subject: [PATCH 39/40] added a workflow --- .github/workflows/node.js.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/node.js.yml diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml new file mode 100644 index 0000000..7176dbd --- /dev/null +++ b/.github/workflows/node.js.yml @@ -0,0 +1,32 @@ +# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Node.js CI + +on: + push: + branches: [ develop ] + pull_request: + branches: [ develop ] + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v2 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm install + - run: npm ci + - run: npm run build --if-present + - run: npm test \ No newline at end of file From d69703058acf7a4a792f8f5ad9507eb12017e1b5 Mon Sep 17 00:00:00 2001 From: Nathan Creger Date: Fri, 26 Apr 2024 13:36:21 -0400 Subject: [PATCH 40/40] remove unused code --- src/components/PackageDashboard/PackageTable.js | 4 +--- src/components/PackageDashboard/packageReducer.js | 3 --- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/components/PackageDashboard/PackageTable.js b/src/components/PackageDashboard/PackageTable.js index bda905c..7d9decf 100644 --- a/src/components/PackageDashboard/PackageTable.js +++ b/src/components/PackageDashboard/PackageTable.js @@ -3,8 +3,7 @@ import ReactTable from 'react-table'; import ReactGA from 'react-ga'; import PropTypes from 'prop-types'; import Moment from 'moment'; -import { Row, Col, Button } from 'reactstrap'; -import { getStateDisplayText } from './stateDisplayHelper'; +import { Row, Col } from 'reactstrap'; import { faDownload } from '@fortawesome/free-solid-svg-icons'; import { CSVLink } from 'react-csv'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; @@ -15,7 +14,6 @@ const PACKAGE_TYPE_LABEL = 'Package Type'; const SUBMITTER_LABEL = 'Submitter'; const TIS_NAME_LABEL = 'TIS Name'; const DATE_SUBMITTED_LABEL = 'Date Submitted'; -const PACKAGE_STATE_LABEL = 'Package State'; const SUBJECT_ID_LABEL = 'Subject Id'; const GLOBUS_LINK_LABEL = 'Globus Link'; const MOVE_PACKAGE_FILES_LABEL = 'Move Files to DLU'; diff --git a/src/components/PackageDashboard/packageReducer.js b/src/components/PackageDashboard/packageReducer.js index 46edcb4..7828962 100644 --- a/src/components/PackageDashboard/packageReducer.js +++ b/src/components/PackageDashboard/packageReducer.js @@ -1,7 +1,4 @@ -import actionNames from '../../actions/actionNames'; - export const packages = (state = [], action) => { - let newState = []; switch (action.type) { default: