From 2e5d72227afcae6882148a26a6e84ba27f2f3ced Mon Sep 17 00:00:00 2001 From: rmanaem Date: Thu, 5 Dec 2024 10:59:19 -0500 Subject: [PATCH 1/6] Revert "Updated the `ResultsTSV` e2e test" This reverts commit 34d48d958535b72cc73851934d6bbc174bdb5a52. --- cypress/e2e/ResultsTSV.cy.ts | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/cypress/e2e/ResultsTSV.cy.ts b/cypress/e2e/ResultsTSV.cy.ts index b3f29bbf..314fa89b 100644 --- a/cypress/e2e/ResultsTSV.cy.ts +++ b/cypress/e2e/ResultsTSV.cy.ts @@ -61,7 +61,7 @@ describe('Results TSV', () => { }); }); describe('Unprotected response', () => { - it.only('Checks whether the rows in the participant.tsv file generated according to session_type', () => { + it('Checks whether the rows in the participant.tsv file generated according to session_type', () => { cy.intercept('query?*', unprotectedResponse).as('call'); cy.intercept( { @@ -107,12 +107,12 @@ describe('Unprotected response', () => { expect(phenotypicSession.split('\t')[4]).to.equal('ses-nb01'); expect(phenotypicSession.split('\t')[5]).to.equal(''); expect(phenotypicSession.split('\t')[6]).to.equal('Phenotypic'); - expect(phenotypicSession.split('\t')[7]).to.equal('1'); - expect(phenotypicSession.split('\t')[8]).to.equal('0'); - expect(phenotypicSession.split('\t')[9]).to.equal('10.4'); - expect(phenotypicSession.split('\t')[10]).to.equal('female'); - expect(phenotypicSession.split('\t')[11]).to.equal('Major depressive disorder'); - expect(phenotypicSession.split('\t')[12]).to.equal('multisource interference task'); + expect(phenotypicSession.split('\t')[7]).to.equal('10.4'); + expect(phenotypicSession.split('\t')[8]).to.equal('female'); + expect(phenotypicSession.split('\t')[9]).to.equal('Major depressive disorder'); + expect(phenotypicSession.split('\t')[10]).to.equal('multisource interference task'); + expect(phenotypicSession.split('\t')[11]).to.equal('1'); + expect(phenotypicSession.split('\t')[12]).to.equal('0'); expect(phenotypicSession.split('\t')[13]).to.equal(''); expect(phenotypicSession.split('\t')[14]).to.equal(''); expect(phenotypicSession.split('\t')[15]).to.equal('Flow Weighted, T2 Weighted'); @@ -127,12 +127,12 @@ describe('Unprotected response', () => { expect(imagingSession.split('\t')[4]).to.equal('ses-nb01'); expect(imagingSession.split('\t')[5]).to.equal('/ds004116/sub-300101'); expect(imagingSession.split('\t')[6]).to.equal('Imaging'); - expect(imagingSession.split('\t')[7]).to.equal('0'); - expect(imagingSession.split('\t')[8]).to.equal('1'); + expect(imagingSession.split('\t')[7]).to.equal(''); + expect(imagingSession.split('\t')[8]).to.equal(''); expect(imagingSession.split('\t')[9]).to.equal(''); expect(imagingSession.split('\t')[10]).to.equal(''); - expect(imagingSession.split('\t')[11]).to.equal(''); - expect(imagingSession.split('\t')[12]).to.equal(''); + expect(imagingSession.split('\t')[11]).to.equal('0'); + expect(imagingSession.split('\t')[12]).to.equal('1'); expect(imagingSession.split('\t')[13]).to.equal('Flow Weighted, T2 Weighted'); expect(imagingSession.split('\t')[14]).to.equal('fmriprep 23.1.3, freesurfer 7.3.2'); expect(imagingSession.split('\t')[15]).to.equal('Flow Weighted, T2 Weighted'); From 7a40a68c4de026fc3ea9a4f059f4869e4a46ed7b Mon Sep 17 00:00:00 2001 From: rmanaem Date: Thu, 5 Dec 2024 10:59:50 -0500 Subject: [PATCH 2/6] Revert "Updated formatting of download result files" This reverts commit 74d7423576c021d28aeb7bf9852a34d3bc87be8f. --- src/components/ResultContainer.tsx | 220 +++++++++++++++++------------ 1 file changed, 131 insertions(+), 89 deletions(-) diff --git a/src/components/ResultContainer.tsx b/src/components/ResultContainer.tsx index a3bc0423..8bb8eff7 100644 --- a/src/components/ResultContainer.tsx +++ b/src/components/ResultContainer.tsx @@ -145,104 +145,146 @@ function ResultContainer({ const tsvRows = []; const datasets = response.responses.filter((res) => download.includes(res.dataset_uuid)); - const isHumanFile = buttonIdentifier === 'cohort-participant'; + if (buttonIdentifier === 'cohort-participant') { + const headers = [ + 'DatasetName', + 'PortalURI', + 'NumMatchingSubjects', + 'SubjectID', + 'SessionID', + 'SessionFilePath', + 'SessionType', + 'Age', + 'Sex', + 'Diagnosis', + 'Assessment', + 'NumMatchingPhenotypicSessions', + 'NumMatchingImagingSessions', + 'SessionImagingModalities', + 'SessionCompletedPipelines', + 'DatasetImagingModalities', + 'DatasetPipelines', + ].join('\t'); + tsvRows.push(headers); - const headers = [ - 'DatasetName', - 'PortalURI', - 'NumMatchingSubjects', - 'SubjectID', - 'SessionID', - 'ImagingSessionPath', - 'SessionType', - 'NumMatchingPhenotypicSessions', - 'NumMatchingImagingSessions', - 'Age', - 'Sex', - 'Diagnosis', - 'Assessment', - 'SessionImagingModalities', - 'SessionCompletedPipelines', - 'DatasetImagingModalities', - 'DatasetPipelines', - ].join('\t'); - tsvRows.push(headers); - - datasets.forEach((res) => { - if (res.records_protected) { - tsvRows.push( - [ - res.dataset_name.replace('\n', ' '), - res.dataset_portal_uri, - res.num_matching_subjects, - 'protected', // subject_id - 'protected', // session_id - 'protected', // session_file_path - 'protected', // session_type - 'protected', // num_matching_phenotypic_sessions - 'protected', // num_matching_imaging_sessions - 'protected', // age - 'protected', // sex - 'protected', // diagnosis - 'protected', // assessment - 'protected', // session_imaging_modality - 'protected', // session_completed_pipelines - isHumanFile - ? convertURIToLabel('modality', res.image_modals) - : res.image_modals?.join(', '), - isHumanFile - ? convertURIToLabel( + datasets.forEach((res) => { + if (res.records_protected) { + tsvRows.push( + [ + res.dataset_name.replace('\n', ' '), + res.dataset_portal_uri, + res.num_matching_subjects, + 'protected', // subject_id + 'protected', // session_id + 'protected', // session_file_path + 'protected', // session_type + 'protected', // age + 'protected', // sex + 'protected', // diagnosis + 'protected', // assessment + 'protected', // num_matching_phenotypic_sessions + 'protected', // num_matching_imaging_sessions + 'protected', // session_imaging_modality + 'protected', // session_completed_pipelines + convertURIToLabel('modality', res.image_modals), + convertURIToLabel( + 'pipeline', + parsePipelinesInfoToString(res.available_pipelines).split(', ') + ), + ].join('\t') + ); + } else { + // @ts-expect-error: typescript doesn't know that subject_data is an array when records_protected is false. + res.subject_data.forEach((subject) => { + tsvRows.push( + [ + res.dataset_name.replace('\n', ' '), + res.dataset_portal_uri, + res.num_matching_subjects, + subject.sub_id, + subject.session_id, + subject.session_file_path, + convertURIToLabel('sessionType', subject.session_type), + subject.age, + convertURIToLabel('sex', subject.sex), + convertURIToLabel('diagnosis', subject.diagnosis), + convertURIToLabel('assessment', subject.assessment), + subject.num_matching_phenotypic_sessions, + subject.num_matching_imaging_sessions, + convertURIToLabel('modality', subject.image_modal), + convertURIToLabel( + 'pipeline', + parsePipelinesInfoToString(subject.completed_pipelines).split(', ') + ), + convertURIToLabel('modality', res.image_modals), + convertURIToLabel( 'pipeline', parsePipelinesInfoToString(res.available_pipelines).split(', ') - ) - : parsePipelinesInfoToString(res.available_pipelines), - ].join('\t') - ); - } else { - // @ts-expect-error: typescript doesn't know that subject_data is an array when records_protected is false. - res.subject_data.forEach((subject) => { + ), + ].join('\t') + ); + }); + } + }); + } else { + const headers = [ + 'DatasetName', + 'PortalURI', + 'SubjectID', + 'SessionID', + 'SessionFilePath', + 'SessionType', + 'NumMatchingPhenotypicSessions', + 'NumMatchingImagingSessions', + 'SessionImagingModalities', + 'SessionCompletedPipelines', + 'DatasetImagingModalities', + 'DatasetPipelines', + ].join('\t'); + tsvRows.push(headers); + + datasets.forEach((res) => { + if (res.records_protected) { tsvRows.push( [ res.dataset_name.replace('\n', ' '), res.dataset_portal_uri, - res.num_matching_subjects, - subject.sub_id, - subject.session_id, - subject.session_file_path, - isHumanFile - ? convertURIToLabel('sessionType', subject.session_type) - : subject.session_type, - subject.num_matching_phenotypic_sessions, - subject.num_matching_imaging_sessions, - subject.age, - isHumanFile ? convertURIToLabel('sex', subject.sex) : subject.sex, - isHumanFile ? convertURIToLabel('diagnosis', subject.diagnosis) : subject.diagnosis, - isHumanFile - ? convertURIToLabel('assessment', subject.assessment) - : subject.assessment, - isHumanFile - ? convertURIToLabel('modality', subject.image_modal) - : subject.image_modal?.join(', '), - isHumanFile - ? convertURIToLabel( - 'pipeline', - parsePipelinesInfoToString(subject.completed_pipelines).split(', ') - ) - : parsePipelinesInfoToString(subject.completed_pipelines), - isHumanFile - ? convertURIToLabel('modality', res.image_modals) - : res.image_modals?.join(', '), - isHumanFile - ? convertURIToLabel( - 'pipeline', - parsePipelinesInfoToString(res.available_pipelines).split(', ') - ) - : parsePipelinesInfoToString(res.available_pipelines), + 'protected', // subject_id + 'protected', // session_id + 'protected', // session_file_path + 'protected', // session_type + 'protected', // num_matching_phenotypic_sessions + 'protected', // num_matching_imaging_sessions + 'protected', // session_imaging_modality + 'protected', // session_completed_pipelines + res.image_modals?.join(', '), + parsePipelinesInfoToString(res.available_pipelines), ].join('\t') ); - }); - } - }); + } else { + // @ts-expect-error: typescript doesn't know that subject_data is an array when records_protected is false. + res.subject_data.forEach((subject) => { + tsvRows.push( + [ + res.dataset_name.replace('\n', ' '), + res.dataset_portal_uri, + subject.sub_id, + subject.session_id, + subject.session_file_path, + subject.session_type, + subject.num_matching_phenotypic_sessions, + subject.num_matching_imaging_sessions, + subject.image_modal?.join(', '), + parsePipelinesInfoToString(subject.completed_pipelines), + res.image_modals?.join(', '), + parsePipelinesInfoToString(res.available_pipelines), + ].join('\t') + ); + }); + } + }); + } + return tsvRows.join('\n'); } From 9414b437747977c60c483164a8840f1bf0cad7af Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:01:04 -0500 Subject: [PATCH 3/6] Bump eslint-plugin-react-refresh from 0.4.14 to 0.4.16 (#394) Bumps [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) from 0.4.14 to 0.4.16. - [Release notes](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/releases) - [Changelog](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/CHANGELOG.md) - [Commits](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/compare/v0.4.14...v0.4.16) --- updated-dependencies: - dependency-name: eslint-plugin-react-refresh dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 10 +++++----- package.json | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package-lock.json b/package-lock.json index b9198ad7..f952cda6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,7 +48,7 @@ "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.2", "eslint-plugin-react-hooks": "^4.6.2", - "eslint-plugin-react-refresh": "^0.4.14", + "eslint-plugin-react-refresh": "^0.4.16", "husky": "^9.1.7", "lint-staged": "^15.2.10", "postcss": "^8.4.49", @@ -5264,12 +5264,12 @@ } }, "node_modules/eslint-plugin-react-refresh": { - "version": "0.4.14", - "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.14.tgz", - "integrity": "sha512-aXvzCTK7ZBv1e7fahFuR3Z/fyQQSIQ711yPgYRj+Oj64tyTgO4iQIDmYXDBqvSWQ/FA4OSCsXOStlF+noU0/NA==", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.16.tgz", + "integrity": "sha512-slterMlxAhov/DZO8NScf6mEeMBBXodFUolijDvrtTxyezyLoTQaa73FyYus/VbTdftd8wBgBxPMRk3poleXNQ==", "dev": true, "peerDependencies": { - "eslint": ">=7" + "eslint": ">=8.40" } }, "node_modules/eslint-plugin-react/node_modules/brace-expansion": { diff --git a/package.json b/package.json index 99075aa3..07657f27 100644 --- a/package.json +++ b/package.json @@ -54,7 +54,7 @@ "eslint-plugin-prettier": "^5.2.1", "eslint-plugin-react": "^7.37.2", "eslint-plugin-react-hooks": "^4.6.2", - "eslint-plugin-react-refresh": "^0.4.14", + "eslint-plugin-react-refresh": "^0.4.16", "husky": "^9.1.7", "lint-staged": "^15.2.10", "postcss": "^8.4.49", From 8b295871d76086a2a7569a150884ba2d37faf628 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Dec 2024 16:31:25 -0500 Subject: [PATCH 4/6] Bump @vitest/ui from 2.1.5 to 2.1.8 (#395) Bumps [@vitest/ui](https://github.com/vitest-dev/vitest/tree/HEAD/packages/ui) from 2.1.5 to 2.1.8. - [Release notes](https://github.com/vitest-dev/vitest/releases) - [Commits](https://github.com/vitest-dev/vitest/commits/v2.1.8/packages/ui) --- updated-dependencies: - dependency-name: "@vitest/ui" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 104 +++++++++++++++++++++++----------------------- package.json | 2 +- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/package-lock.json b/package-lock.json index f952cda6..71034e99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -36,7 +36,7 @@ "@typescript-eslint/eslint-plugin": "^8.16.0", "@typescript-eslint/parser": "^8.14.0", "@vitejs/plugin-react-swc": "^3.7.1", - "@vitest/ui": "^2.1.5", + "@vitest/ui": "^2.1.8", "autoprefixer": "^10.4.20", "cypress": "^13.16.0", "eslint": "^8.57.0", @@ -2620,13 +2620,13 @@ } }, "node_modules/@vitest/expect": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.5.tgz", - "integrity": "sha512-nZSBTW1XIdpZvEJyoP/Sy8fUg0b8od7ZpGDkTUcfJ7wz/VoZAFzFfLyxVxGFhUjJzhYqSbIpfMtl/+k/dpWa3Q==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz", + "integrity": "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==", "dev": true, "dependencies": { - "@vitest/spy": "2.1.5", - "@vitest/utils": "2.1.5", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", "chai": "^5.1.2", "tinyrainbow": "^1.2.0" }, @@ -2635,12 +2635,12 @@ } }, "node_modules/@vitest/mocker": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.5.tgz", - "integrity": "sha512-XYW6l3UuBmitWqSUXTNXcVBUCRytDogBsWuNXQijc00dtnU/9OqpXWp4OJroVrad/gLIomAq9aW8yWDBtMthhQ==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.8.tgz", + "integrity": "sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==", "dev": true, "dependencies": { - "@vitest/spy": "2.1.5", + "@vitest/spy": "2.1.8", "estree-walker": "^3.0.3", "magic-string": "^0.30.12" }, @@ -2661,9 +2661,9 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.5.tgz", - "integrity": "sha512-4ZOwtk2bqG5Y6xRGHcveZVr+6txkH7M2e+nPFd6guSoN638v/1XQ0K06eOpi0ptVU/2tW/pIU4IoPotY/GZ9fw==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.8.tgz", + "integrity": "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==", "dev": true, "dependencies": { "tinyrainbow": "^1.2.0" @@ -2673,12 +2673,12 @@ } }, "node_modules/@vitest/runner": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.5.tgz", - "integrity": "sha512-pKHKy3uaUdh7X6p1pxOkgkVAFW7r2I818vHDthYLvUyjRfkKOU6P45PztOch4DZarWQne+VOaIMwA/erSSpB9g==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.8.tgz", + "integrity": "sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==", "dev": true, "dependencies": { - "@vitest/utils": "2.1.5", + "@vitest/utils": "2.1.8", "pathe": "^1.1.2" }, "funding": { @@ -2686,12 +2686,12 @@ } }, "node_modules/@vitest/snapshot": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.5.tgz", - "integrity": "sha512-zmYw47mhfdfnYbuhkQvkkzYroXUumrwWDGlMjpdUr4jBd3HZiV2w7CQHj+z7AAS4VOtWxI4Zt4bWt4/sKcoIjg==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.8.tgz", + "integrity": "sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==", "dev": true, "dependencies": { - "@vitest/pretty-format": "2.1.5", + "@vitest/pretty-format": "2.1.8", "magic-string": "^0.30.12", "pathe": "^1.1.2" }, @@ -2700,9 +2700,9 @@ } }, "node_modules/@vitest/spy": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.5.tgz", - "integrity": "sha512-aWZF3P0r3w6DiYTVskOYuhBc7EMc3jvn1TkBg8ttylFFRqNN2XGD7V5a4aQdk6QiUzZQ4klNBSpCLJgWNdIiNw==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.8.tgz", + "integrity": "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==", "dev": true, "dependencies": { "tinyspy": "^3.0.2" @@ -2712,12 +2712,12 @@ } }, "node_modules/@vitest/ui": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.5.tgz", - "integrity": "sha512-ERgKkDMTfngrZip6VG5h8L9B5D0AH/4+bga4yR1UzGH7c2cxv3LWogw2Dvuwr9cP3/iKDHYys7kIFLDKpxORTg==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.8.tgz", + "integrity": "sha512-5zPJ1fs0ixSVSs5+5V2XJjXLmNzjugHRyV11RqxYVR+oMcogZ9qTuSfKW+OcTV0JeFNznI83BNylzH6SSNJ1+w==", "dev": true, "dependencies": { - "@vitest/utils": "2.1.5", + "@vitest/utils": "2.1.8", "fflate": "^0.8.2", "flatted": "^3.3.1", "pathe": "^1.1.2", @@ -2729,16 +2729,16 @@ "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "2.1.5" + "vitest": "2.1.8" } }, "node_modules/@vitest/utils": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.5.tgz", - "integrity": "sha512-yfj6Yrp0Vesw2cwJbP+cl04OC+IHFsuQsrsJBL9pyGeQXE56v1UAOQco+SR55Vf1nQzfV0QJg1Qum7AaWUwwYg==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.8.tgz", + "integrity": "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==", "dev": true, "dependencies": { - "@vitest/pretty-format": "2.1.5", + "@vitest/pretty-format": "2.1.8", "loupe": "^3.1.2", "tinyrainbow": "^1.2.0" }, @@ -7488,9 +7488,9 @@ } }, "node_modules/magic-string": { - "version": "0.30.13", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.13.tgz", - "integrity": "sha512-8rYBO+MsWkgjDSOvLomYnzhdwEG51olQ4zL5KXnNJWV5MNmrb4rTZdrtkhxjnD/QyZUqR/Z/XDsUs/4ej2nx0g==", + "version": "0.30.14", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.14.tgz", + "integrity": "sha512-5c99P1WKTed11ZC0HMJOj6CDIue6F8ySu+bJL+85q1zBEIY8IklrJ1eiKC2NDRh3Ct3FcvmJPyQHb9erXMTJNw==", "dev": true, "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.0" @@ -11190,9 +11190,9 @@ } }, "node_modules/vite-node": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.5.tgz", - "integrity": "sha512-rd0QIgx74q4S1Rd56XIiL2cYEdyWn13cunYBIuqh9mpmQr7gGS0IxXoP8R6OaZtNQQLyXSWbd4rXKYUbhFpK5w==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.8.tgz", + "integrity": "sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==", "dev": true, "dependencies": { "cac": "^6.7.14", @@ -11212,18 +11212,18 @@ } }, "node_modules/vitest": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.5.tgz", - "integrity": "sha512-P4ljsdpuzRTPI/kbND2sDZ4VmieerR2c9szEZpjc+98Z9ebvnXmM5+0tHEKqYZumXqlvnmfWsjeFOjXVriDG7A==", + "version": "2.1.8", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.8.tgz", + "integrity": "sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==", "dev": true, "dependencies": { - "@vitest/expect": "2.1.5", - "@vitest/mocker": "2.1.5", - "@vitest/pretty-format": "^2.1.5", - "@vitest/runner": "2.1.5", - "@vitest/snapshot": "2.1.5", - "@vitest/spy": "2.1.5", - "@vitest/utils": "2.1.5", + "@vitest/expect": "2.1.8", + "@vitest/mocker": "2.1.8", + "@vitest/pretty-format": "^2.1.8", + "@vitest/runner": "2.1.8", + "@vitest/snapshot": "2.1.8", + "@vitest/spy": "2.1.8", + "@vitest/utils": "2.1.8", "chai": "^5.1.2", "debug": "^4.3.7", "expect-type": "^1.1.0", @@ -11235,7 +11235,7 @@ "tinypool": "^1.0.1", "tinyrainbow": "^1.2.0", "vite": "^5.0.0", - "vite-node": "2.1.5", + "vite-node": "2.1.8", "why-is-node-running": "^2.3.0" }, "bin": { @@ -11250,8 +11250,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "2.1.5", - "@vitest/ui": "2.1.5", + "@vitest/browser": "2.1.8", + "@vitest/ui": "2.1.8", "happy-dom": "*", "jsdom": "*" }, diff --git a/package.json b/package.json index 07657f27..bc52dfb3 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,7 @@ "@typescript-eslint/eslint-plugin": "^8.16.0", "@typescript-eslint/parser": "^8.14.0", "@vitejs/plugin-react-swc": "^3.7.1", - "@vitest/ui": "^2.1.5", + "@vitest/ui": "^2.1.8", "autoprefixer": "^10.4.20", "cypress": "^13.16.0", "eslint": "^8.57.0", From f3c5210637ee938d791f613285737fc241d9d571 Mon Sep 17 00:00:00 2001 From: Arman Jahanpour <77515879+rmanaem@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:29:51 -0500 Subject: [PATCH 5/6] [FIX] Replaced the latest version tag with a baked-in version (#390) * Modified `build_docker_nightly` workflow * Set `GH_TOKEN` * A different approach * Use shortened sha * Updated `build_docker_on_release` workflow * Updated `deploy` workflow * Removed fetching version from GitHub * Fixed typo * Reverted changes made to `deploy` workflow * Added `bump_version` workflow * Updated `bump_version` workflow * Added the labeled type * Test different auto commands * comment out the label condition * Try canary command * Added github token * Let's try commands * let's try this solution * Removed couple steps * Set the version_schema * Remove prerelease_suffix * Removed default field * Trying the latest version * seems silly but worth a try * Installed auto as a dev dependency * Bumped version in `package` files * Let's try using npm * Added GH_TOKEN * Installed plugins * Grab the last line * Installed the npm plugin explicitly * Revert "Installed the npm plugin explicitly" This reverts commit 5def864b0b691023d39f586e09a12a5d7b6c3970. * Revert "Grab the last line" This reverts commit dfcfccb79c5f8ac36a826d673a63053bb6dc940b. * Revert "Installed plugins" This reverts commit ca0c485d13ce86333e919d11594b4c270f6beffa. * Revert "Added GH_TOKEN" This reverts commit f0845016a0393ea1bd75ac57b4b0b256b3ddda22. * Revert "Let's try using npm" This reverts commit 602c6a2338ad614c47782041a3f6c5cdfbf12bf2. * Revert "Bumped version in `package` files" This reverts commit 3a99f826ccfc85604d04958ac7b360a69b69ff81. * Revert "Installed auto as a dev dependency" This reverts commit 5b9b98d4cd6d6903427b8baa85d0f01d8502d92a. * Going back to version * Let's see the output * Read in a separate step * Let's try this * try again * Try verbose logs * Really? * ok does this work too? * Getting there * Forgot the GH_TOKEN again * Fixed the missing version * Let's run on pull_request * GH_TOKEN added * Almost there * Try a fix for committing to the same branch * figuring out the right syntax * an alternative appraoch * Let's see what's in there * Let's check this one out * This should do it * It's possible we didn't even needed the branch name * Try this syntax * Bumped version to v0.7.2 * Added a condition to check diff before commiting * Refactor * Added a condition to skip the workflow when increment is empty * Small refactor * Removed the explicit condition and used label condition * Bumped version to v0.7.2 * Updated `pull_request_template` * Reverted changes made to `build_docker_on_release` * Fixed typo --------- Co-authored-by: Neurobagel Bot --- .github/pull_request_template.md | 2 + .github/workflows/build_docker_nightly.yml | 13 ++++ .github/workflows/bump_version.yml | 90 ++++++++++++++++++++++ package.json | 2 +- src/components/Navbar.tsx | 20 +---- 5 files changed, 109 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/bump_version.yml diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index b28ca796..187d097a 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -25,6 +25,8 @@ Changes proposed in this pull request: - - +**NOTE: If this pull request is to be released, the release label must be applied once the review process is done to avoid the local and remote from going out of sync as a consequence of the `bump version` workflow run** + ## Checklist _This section is for the PR reviewer_ diff --git a/.github/workflows/build_docker_nightly.yml b/.github/workflows/build_docker_nightly.yml index 44fb74d2..3a9613e9 100644 --- a/.github/workflows/build_docker_nightly.yml +++ b/.github/workflows/build_docker_nightly.yml @@ -16,6 +16,19 @@ jobs: with: submodules: recursive + - name: Fetch latest commit SHA from main branch + id: fetch_sha + run: | + git fetch origin main + LATEST_SHA=$(git rev-parse --short=7 origin/main) + echo "LATEST_SHA=$LATEST_SHA" >> $GITHUB_ENV + + - name: Update package.json version + run: | + SHA=${{ env.LATEST_SHA }} + jq ".version = \"build:${SHA}\"" package.json > tmp.$$.json && mv tmp.$$.json package.json + cat package.json + - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/bump_version.yml b/.github/workflows/bump_version.yml new file mode 100644 index 00000000..39b23f12 --- /dev/null +++ b/.github/workflows/bump_version.yml @@ -0,0 +1,90 @@ +name: bump version + +on: + pull_request: + types: [labeled] + workflow_dispatch: + +permissions: + contents: write + pull-requests: write # Required to commit changes to PR branches + +jobs: + bump-version: + runs-on: ubuntu-latest + if: ${{ github.event.label.name == 'release' }} + steps: + - name: Generate a token + id: generate-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ vars.NB_BOT_ID }} + private-key: ${{ secrets.NB_BOT_KEY }} + + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ steps.generate-token.outputs.token }} + + - name: Download latest auto + run: | + auto_download_url="$(curl -fsSL https://api.github.com/repos/intuit/auto/releases/latest | jq -r '.assets[] | select(.name == "auto-linux.gz") | .browser_download_url')" + wget -O- "$auto_download_url" | gunzip > ~/auto + chmod a+x ~/auto + + - name: Get latest release version + id: latest-release + run: | + LATEST_TAG=$(curl -fsSL https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name) + echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV + + - name: Compute increment + id: compute-increment + run: | + # Run auto to determine version increment (patch, minor, major) + INCREMENT=$(~/auto version) + echo "Increment: $INCREMENT" + echo "INCREMENT=$INCREMENT" >> $GITHUB_ENV + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + + - name: Bump version + id: bump-version + run: | + # Extract the current version from the latest release + VERSION=${{ env.LATEST_TAG }} + VERSION=${VERSION#v} # Remove the "v" prefix if it exists + + IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION" + + # Increment based on the auto output + if [ "${{ env.INCREMENT }}" == "major" ]; then + ((MAJOR++)) + MINOR=0 + PATCH=0 + elif [ "${{ env.INCREMENT }}" == "minor" ]; then + ((MINOR++)) + PATCH=0 + elif [ "${{ env.INCREMENT }}" == "patch" ]; then + ((PATCH++)) + fi + + # Construct the new version + NEW_VERSION="v$MAJOR.$MINOR.$PATCH" + echo "New version: $NEW_VERSION" + echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV + + - name: Update package.json + run: | + jq ".version = \"$NEW_VERSION\"" package.json > package.json.tmp && mv package.json.tmp package.json + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} + + - name: Commit and Push Changes + run: | + git config --global user.name "Neurobagel Bot" + git config --global user.email "neurobagel-bot[bot]@users.noreply.github.com" + git diff --quiet package.json || (git add package.json && git commit -m "Bumped version to $NEW_VERSION" && git push origin HEAD:${{ github.head_ref }}) + env: + GH_TOKEN: ${{ steps.generate-token.outputs.token }} diff --git a/package.json b/package.json index bc52dfb3..52eacadf 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-query-tool", "private": true, - "version": "0.1.0", + "version": "v0.7.2", "type": "module", "scripts": { "dev": "vite", diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx index 69fdeda1..ef2c35df 100644 --- a/src/components/Navbar.tsx +++ b/src/components/Navbar.tsx @@ -1,5 +1,4 @@ -import { useState, useEffect } from 'react'; -import axios from 'axios'; +import { useState } from 'react'; import { Toolbar, Typography, @@ -17,28 +16,15 @@ import Login from '@mui/icons-material/Login'; import Avatar from '@mui/material/Avatar'; import { useAuth0 } from '@auth0/auth0-react'; import { enableAuth } from '../utils/constants'; +import packageJson from '../../package.json'; import logo from '../assets/logo.png'; function Navbar({ isLoggedIn, onLogin }: { isLoggedIn: boolean; onLogin: () => void }) { - const [latestReleaseTag, setLatestReleaseTag] = useState(''); const [anchorEl, setAnchorEl] = useState(null); const openAccountMenu = Boolean(anchorEl); const { user, logout } = useAuth0(); - useEffect(() => { - const GHApiURL = 'https://api.github.com/repos/neurobagel/query-tool/releases/latest'; - axios - .get(GHApiURL) - .then((response) => { - const { data } = response; - setLatestReleaseTag(data.tag_name); - }) - .catch(() => { - setLatestReleaseTag('beta'); - }); - }, []); - const handleClick = (event: React.MouseEvent) => { setAnchorEl(event.currentTarget); }; @@ -52,7 +38,7 @@ function Navbar({ isLoggedIn, onLogin }: { isLoggedIn: boolean; onLogin: () => v
Logo
- + Neurobagel Query From 74187a748aacaa9f7a75de9a4edf049f1d8f3759 Mon Sep 17 00:00:00 2001 From: Neurobagel Bot Date: Tue, 10 Dec 2024 09:30:12 +0000 Subject: [PATCH 6/6] Update CHANGELOG.md [skip ci] --- CHANGELOG.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42e44a72..7ebf9f3c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +# v0.7.2 (Tue Dec 10 2024) + +#### 🚀 Enhancements + +- Revert "Updated formatting of download result files" ([@rmanaem](https://github.com/rmanaem)) +- Revert "Updated the `ResultsTSV` e2e test" ([@rmanaem](https://github.com/rmanaem)) + +#### 🐛 Bug Fixes + +- [FIX] Replaced the latest version tag with a baked-in version [#390](https://github.com/neurobagel/query-tool/pull/390) ([@rmanaem](https://github.com/rmanaem) [@neurobagel-bot[bot]](https://github.com/neurobagel-bot[bot])) + +#### ⚠️ Pushed to `main` + +- Updated the `ResultsTSV` e2e test ([@rmanaem](https://github.com/rmanaem)) +- Updated formatting of download result files ([@rmanaem](https://github.com/rmanaem)) + +#### Authors: 2 + +- [@neurobagel-bot[bot]](https://github.com/neurobagel-bot[bot]) +- Arman Jahanpour ([@rmanaem](https://github.com/rmanaem)) + +--- + # v0.7.1 (Mon Dec 02 2024) #### 🏠 Internal