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

DT-944: Fix chairperson edit DAC feature #2702

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

rushtong
Copy link
Contributor

@rushtong rushtong commented Oct 30, 2024

Addresses

https://broadworkbench.atlassian.net/browse/DT-944

Summary

This PR makes a number of changes in function and style. The functional changes are intentional. As a business rule, we allow for Chairs to make changes to their own DACs in terms of both membership and other related details. There are also a number of minor style fixes.

Requires corresponding Consent PR: DataBiosphere/consent#2419

Testing Notes

  1. Update the env in your local config.json to be prod so that you're seeing what we would see in production.
  2. Ensure you're testing with a user that does not have Admin permissions. Admins can edit anything so you wouldn't see the current bug in that case.
  3. There are actually two versions of this page, one in prod, one in non-prod. To see the same page in non-prod, change your env config to dev or staging.

Prod: New screen

Screenshot 2024-10-30 at 11 41 45 AM

Prod: Old screen

Screenshot 2024-10-30 at 11 43 36 AM

Non-prod: New screen

Screenshot 2024-10-30 at 12 23 09 PM

Non-prod: Old screen

Screenshot 2024-10-30 at 12 23 44 PM


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

@rushtong rushtong marked this pull request as ready for review October 30, 2024 16:32
@rushtong rushtong requested a review from a team as a code owner October 30, 2024 16:32
@rushtong rushtong requested review from pshapiro4broad and cinyecai and removed request for a team October 30, 2024 16:32
const createdDaa = await DAA.createDaa(daaFileData, currentDac.dacId);
setCreatedDaa(createdDaa.data);
} else {
if (user.isAdmin) {
currentDac = await DAC.create(currentDac.name, currentDac.description, currentDac.email);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm having trouble following the different cases here. If there is a dacId, update the DAC, else if there is non broad DAA selected without a file throw an error, else if the user is an admin and there is DAA file data, create a DAC and a DAA for it, else if the user is an admin create a dac. This is pretty complex and not super clear, I think it could benefit from either comments or helper functions or something to make this flow easier to return to in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm trying to maintain the existing logic minus the chairperson restriction that existed before. I can take another stab at trying to refactor this, but my primary goal is bug fixing.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't want to prevent progress/bug fixing here if this is too big of a lift, but component tests for this sort of complex logic might be helpful to confirm it is working as expected.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea ... let me see what I can do here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@raejohanek - Another way to look at this is to hide the white space in the PR. That should make the actual changes much easier to see.

Screenshot 2024-10-31 at 1 03 06 PM

@@ -374,7 +371,6 @@ export default function EditDac(props) {
name="name"
className="form-control vote-input"
required={true}
disabled={props.location.state.userRole === CHAIRPERSON}
Copy link
Contributor

Choose a reason for hiding this comment

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

why were these disabled for chairpersons?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it was an historic decision that doesn't make sense to me. I opted to remove it. Chairs should be able to update the values of their DAC.

@@ -250,30 +248,37 @@ export default function ManageEditDac(props) {
return (
isLoading ?
<Spinner/> :
<div className='container container-wide'>
<div className='row no-margin'>
<div className="container container-wide">
Copy link
Contributor

Choose a reason for hiding this comment

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

usage of " and ' is pretty inconsistent. is " the standard?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, single quotes are the standard - not sure why the linter didn't pick this up

Copy link
Contributor

@rjohanek rjohanek left a comment

Choose a reason for hiding this comment

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

thanks for the responses to my comments

Copy link
Contributor

@snf2ye snf2ye left a comment

Choose a reason for hiding this comment

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

Not a blocking comment - LGTM

@rushtong
Copy link
Contributor Author

rushtong commented Nov 1, 2024

I created https://broadworkbench.atlassian.net/browse/DT-959 to address the lack of unit tests so we can get this bug fix into the next release.

@rushtong rushtong merged commit a7c5307 into develop Nov 1, 2024
9 checks passed
@rushtong rushtong deleted the gr-DT-944-chairperson-update-dac branch November 1, 2024 17:39
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.

3 participants