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

[DUOS-1905][risk=no] Update Researcher Console to use Summary Endpoint #1708

Closed
wants to merge 12 commits into from

Conversation

connorlbark
Copy link
Contributor

@connorlbark connorlbark commented Jul 26, 2022

Addresses

https://broadworkbench.atlassian.net/browse/DUOS-1905

In dev, the summary endpoint does not return reference ids. We need them so that draft dar collections can be resumed. The backend change to add that is here: DataBiosphere/consent#1670


Have you read Terra's Contributing Guide lately? If not, do that first.

  • Label PR with a Jira ticket number and include a link to the ticket
  • Label PR with a security risk modifier [no, low, medium, high]
  • PR describes scope of changes
  • Get a minimum of one thumbs worth of review, preferably two if enough team members are available
  • Get PO sign-off for all non-trivial UI or workflow changes
  • Verify all tests go green
  • Test this change deployed correctly and works on dev environment after deployment

@connorlbark connorlbark marked this pull request as ready for review July 26, 2022 20:37
@connorlbark connorlbark requested a review from a team as a code owner July 26, 2022 20:37
@rushtong
Copy link
Contributor

rushtong commented Jul 27, 2022

Not sure where the bug originates, but if I set the page count to 100 on the researcher console, I get the following error:

TypeError: Cannot read properties of undefined (reading '0')
ResearcherActions
src/components/dar_collection_table/ResearcherActions.js:48
  45 | const { collection, showConfirmationModal } = props;
  46 | const collectionId = collection.darCollectionId;
  47 | 
> 48 | const uniqueId = (collectionId ? collectionId : collection.referenceIds[0]);
     | ^  49 | 
  50 | const history = useHistory();
  51 | 

@connorlbark
Copy link
Contributor Author

Not sure where the bug originates, but if I set the page count to 100 on the researcher console, I get the following error:

TypeError: Cannot read properties of undefined (reading '0')
ResearcherActions
src/components/dar_collection_table/ResearcherActions.js:48
  45 | const { collection, showConfirmationModal } = props;
  46 | const collectionId = collection.darCollectionId;
  47 | 
> 48 | const uniqueId = (collectionId ? collectionId : collection.referenceIds[0]);
     | ^  49 | 
  50 | const history = useHistory();
  51 | 

I'm not sure how to recreate this. I ran into the same bug when there was a bug with the consent backend; this happens in the case that there is a row which is both a draft DAR and the backend does not send a referenceId alongside it. When I create a new draft DAR locally, this doesn't happen to me. Would it be possible that there is a draft DAR in your database which does not have a referenceId? If so, that would cause this error, and I can add some guards to ensure legacy drafts don't break the UI.

@rushtong
Copy link
Contributor

Would it be possible that there is a draft DAR in your database which does not have a referenceId?

This scenario should be technically impossible since all dars, draft or not, are saved with a reference id. I'll spend some time digging further now that I have some more time.


useEffect(() => {
const isCancelable = isCollectionCancelable(dars);
const isRevisable = isCollectionRevisable(dars);
Copy link
Contributor

Choose a reason for hiding this comment

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

im seeing some things here that i would recommend changing after merging in 1904, but we can handle that then? These variables for cancelEnabled+ were only ever used once, so I moved them to where the render was called. We can address that post merge tho! :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good to me!

@@ -144,7 +114,7 @@ export default function ResearcherActions(props) {
};

const reviseButtonAttributes = {
keyProp: `revise-collection-${collectionId}`,
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you choose to change these from collectionId to uniqueId? Was the collectionId not unique?

Copy link
Contributor Author

@connorlbark connorlbark Jul 28, 2022

Choose a reason for hiding this comment

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

there isn't always a collection id. For example, if the dar collection is a draft, it doesn't have a collection id, so it would be just 'undefined' here. Thus, we need to use a referenceId in the draft case. There might be another solution here, though

Copy link
Contributor

@lu-c lu-c left a comment

Choose a reason for hiding this comment

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

Sorry meant to approve this earlier, i'm working with it already in a diff branch, so it's all good :P

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

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

Looks good to me. One possible improvement to consider. 👍🏽

Comment on lines +52 to +56
const cancelEnabled = collection.actions.includes('Cancel');
const reviseEnabled = collection.actions.includes('Revise');
const reviewEnabled = collection.actions.includes('Review');
const deleteEnabled = collection.actions.includes('Delete');
const resumeEnabled = collection.actions.includes('Resume');
Copy link
Contributor

Choose a reason for hiding this comment

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

Optional suggestion. It would be nice if these string constants were part of an object/enum somewhere useful for all action-related components. Not sure where that would be for now, so definitely not a blocker for this PR.

Base automatically changed from DUOS-1903 to develop August 15, 2022 11:58
@JVThomas
Copy link
Contributor

Closing, changes already incorporated in #1699

@JVThomas JVThomas closed this Aug 15, 2022
@rushtong rushtong deleted the DUOS-1905 branch December 9, 2022 19:24
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.

4 participants