Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BIOMAGE-1273] Refactor ProjectDetails component #458

Merged
merged 27 commits into from
Aug 30, 2021

Conversation

StefanBabukov
Copy link
Member

@StefanBabukov StefanBabukov commented Aug 23, 2021

Background

Link to issue

https://biomage.atlassian.net/secure/RapidBoard.jspa?rapidView=1&projectKey=BIOMAGE&modal=detail&selectedIssue=BIOMAGE-1273

Link to staging deployment URL

https://ui-stefan-ui458.scp-staging.biomage.net/

Links to any Pull Requests related to this

Anything else the reviewers should know about the changes here

Changes

Code changes

Definition of DONE

Your changes will be ready for merging after each of the steps below have been completed:

Testing

  • Unit tests written
  • Tested locally with Inframock (with latest production data downloaded with biomage experiment pull)
  • Deployed to staging

To set up easy local testing with inframock, follow the instructions here: https://github.com/biomage-ltd/inframock
To deploy to the staging environment, follow the instructions here: https://github.com/biomage-ltd/biomage-utils

Documentation updates

Is all relevant documentation updated to reflect the proposed changes in this PR?

  • Relevant Github READMEs updated
  • Relevant wiki pages created/updated

Approvers

  • Approved by a member of the core engineering team
  • (UX changes) Approved by vickymorrison (this is her username, tag her if you need approval)

Just before merging:

Optional

  • Photo of a cute animal attached to this PR

@StefanBabukov StefanBabukov marked this pull request as ready for review August 24, 2021 09:06
@codecov
Copy link

codecov bot commented Aug 24, 2021

Codecov Report

Merging #458 (f8c855e) into master (b5c5098) will increase coverage by 0.98%.
The diff coverage is 64.60%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #458      +/-   ##
==========================================
+ Coverage   60.56%   61.54%   +0.98%     
==========================================
  Files         137      142       +5     
  Lines        4488     4525      +37     
  Branches      880      875       -5     
==========================================
+ Hits         2718     2785      +67     
+ Misses       1748     1719      -29     
+ Partials       22       21       -1     
Impacted Files Coverage Δ
src/components/data-management/MetadataPopover.jsx 95.00% <ø> (+75.00%) ⬆️
...mponents/data-management/ProjectsListContainer.jsx 58.82% <ø> (+1.32%) ⬆️
src/pages/data-management/index.jsx 0.00% <ø> (ø)
.../components/data-management/UploadDetailsModal.jsx 56.25% <38.46%> (+1.86%) ⬆️
src/components/data-management/DownloadData.jsx 44.61% <44.61%> (ø)
src/components/data-management/MetadataColumn.jsx 50.00% <50.00%> (ø)
src/components/data-management/ProjectDetails.jsx 59.05% <60.00%> (+5.04%) ⬆️
...c/components/data-management/SamplesTableCells.jsx 74.07% <74.07%> (ø)
src/components/data-management/SamplesTable.jsx 82.05% <82.05%> (ø)
src/components/data-management/ProjectMenu.jsx 90.00% <90.00%> (ø)
... and 7 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b5c5098...f8c855e. Read the comment docs.

@@ -1,3 +1,4 @@
/* eslint-disable import/no-unresolved */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are you adding this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because we can import stuff without a relative path but like 'utils/something.js' eslint still marks it as unresolved though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because we added baseUrl in jsconfig.json : https://nextjs.org/docs/advanced-features/module-path-aliases, but it's not yet widely used it seems

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is it about? If it is not used, should we remove it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using it in some places i find it convenient to import things without gettting lost in the path

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that this had been added, is there a ticket for making the existing relative paths absolute?

Also we should disable this eslint policy in the whole project if it is necessary to add it in every single file we use this.

disabled={
projects.ids.length === 0
|| activeProject?.samples?.length === 0
|| isAddingMetadata
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isAddingMetadata doesn't read very well, or at least it is not obvious to me what it is about. Can you explain?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it when the user is in the middle of adding metadata - disable the Add metadata button so they can't click it again while creating metadata

import pipelineStatus from '../../utils/pipelineStatusValues';
import downloadData from '../../utils/data-management/downloadExperimentData';
import downloadTypes from '../../utils/data-management/downloadTypes';
import { exportQCParameters, filterQCParameters } from '../../utils/exportQCParameters';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would move this exportQCParameters file to the data management folder in utils

cosa65
cosa65 previously requested changes Aug 27, 2021
src/components/data-management/DownloadData.jsx Outdated Show resolved Hide resolved
src/components/data-management/ProjectMenu.jsx Outdated Show resolved Hide resolved

if (status === UploadStatus.UPLOADED) {
return (
<div
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like we could perhaps separate each of these into other files, one for each type of table cell (for each status)?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would make this file significantly shorter

Copy link
Member Author

@StefanBabukov StefanBabukov Aug 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't this make it a bigger mess - like 4 other components which are used in only one place? We already have a lot of stuff in components/data-management, plus managing the passing of props and etc. that file is not that big in my opinion, what do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking that moving these 4 new files into a new folder would deal with that problem but it is not that important, you so leaving as it is is fine too.

src/components/data-management/UploadDetailsModal.jsx Outdated Show resolved Hide resolved
@@ -1,3 +1,4 @@
/* eslint-disable import/no-unresolved */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know that this had been added, is there a ticket for making the existing relative paths absolute?

Also we should disable this eslint policy in the whole project if it is necessary to add it in every single file we use this.

@StefanBabukov
Copy link
Member Author

StefanBabukov commented Aug 27, 2021

"I didn't know that this had been added, is there a ticket for making the existing relative paths absolute?"

No there isn't. I don't think we should change every path to absolute - we already have them defined correctly so what's the point? I was thinking to use this in further imports you make so its easier

src/components/data-management/DownloadData.jsx Outdated Show resolved Hide resolved
src/components/data-management/DownloadData.jsx Outdated Show resolved Hide resolved
src/components/data-management/DownloadData.jsx Outdated Show resolved Hide resolved
src/components/data-management/DownloadData.jsx Outdated Show resolved Hide resolved
src/components/data-management/SamplesTable.jsx Outdated Show resolved Hide resolved
src/components/data-management/SamplesTable.jsx Outdated Show resolved Hide resolved
import { exportQCParameters, filterQCParameters } from '../../utils/data-management/exportQCParameters';
import { loadBackendStatus } from '../../redux/actions/backendStatus/index';

const DownloadData = (props) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any unit tests for this component

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can add them as part of your next PR

@cosa65
Copy link
Member

cosa65 commented Aug 30, 2021

we already have them defined correctly so what's the point? I was thinking to use this in further imports you make so its easier

Whenever we move a file we need to adapt all of the relative imports defined in it, which means extra work whenever we reorganize directories

@StefanBabukov StefanBabukov dismissed cosa65’s stale review August 30, 2021 12:03

already approved by Marcell today

@StefanBabukov StefanBabukov merged commit 796e4a9 into master Aug 30, 2021
@StefanBabukov StefanBabukov deleted the rework-project-details branch August 30, 2021 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants