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

428 Show New Version Numbers in Publish Dataset Modal #473

Merged
merged 14 commits into from
Sep 6, 2024

Conversation

ekraffmiller
Copy link
Contributor

@ekraffmiller ekraffmiller commented Aug 27, 2024

What this PR does / why we need it:

For Drafts of previously released versions, the Modal will show the new version numbers for Minor and Major Version updates.

This PR also enables "Update Current Version" option, because it the js-dataverse use case has been updated to allow this option

Which issue(s) this PR closes:

Special notes for your reviewer:

Suggestions on how to test this:

Create a test user account in JSF

  1. Create a new account that is not a super user
  2. Login as dataverseAdmin
  3. From the Root Collection, choose Edit
  4. Give the newly created user "Data Curator" role in the root collection

Test Publishing from "Data Curator Role"

  1. From the Root Collection, Create a dataset and publish it using this account
  2. Edit the dataset and choose the publish action again
  3. In the publish popup, "Update Current Version" should not be visible. There should be two options: Minor (1.1) and Major (2.0)
  4. Choose the Minor Option. After the page is published, the new version should be 1.1
  5. Edit the Metadata again, and choose the Publish action.
  6. In the Publish Popup, there should be options: Minor (1.2) and Major (2.0)
  7. Choose the Major option. The new version of the Dataset should be 2.0

Test Update Current Version:
Only if you are logged in as a super user, there should be a third Publish Option, "Update Current Version". To test this:

  1. Login as dataverseAdmin
  2. Create a dataset, and publish it
  3. Edit the dataset metadata and choose the Publish Action
  4. Choose the "Update Current Version" option
  5. The new version of the Dataset should have the same version number (1.0)

Does this PR introduce a user interface change? If mockups are available, please link/include them here:

Is there a release notes update needed for this change?:

Additional documentation:

@coveralls
Copy link

coveralls commented Aug 27, 2024

Coverage Status

coverage: 97.429% (-0.01%) from 97.44%
when pulling 342d7ec on feat/428-publish-version-numbers
into dc857c3 on develop.

@ekraffmiller ekraffmiller marked this pull request as ready for review August 29, 2024 19:54
@ekraffmiller ekraffmiller added GREI Re-arch GREI re-architecture-related SPA: Dataset page (View) Size: 3 A percentage of a sprint. 2.1 hours. labels Aug 29, 2024
@g-saracca g-saracca self-assigned this Sep 2, 2024
if (releasedVersionExists && (!nextMajorVersion || !nextMinorVersion)) {
console.log('Error: nextMajorVersion or nextMinorVersion is missing')
return null
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we don't need this, if everything works well, this case should never happen.
and in any case we should not get to this point, if there is no released version and there is no major or minor version we should directly hide the button to publish dataset, but again I think we don't need that also.
What do you think?

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 agree, this case should never happen, but since the two version number params are optional, I thought I should have a check just for completeness. I was trying to make the params required only if releasedVersionExists==true, but I couldn't find a clean way to do that. But I don't mind removing it

if (releasedVersionExists && (!nextMajorVersion || !nextMinorVersion)) {
console.log('Error: nextMajorVersion or nextMinorVersion is missing')
return null
}
return (
<Modal show={show} onHide={handleClose} size="lg">
Copy link
Contributor

Choose a reason for hiding this comment

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

I think Modal could be size="xl" everything fits better.

@@ -0,0 +1,39 @@
import { useEffect, useState } from 'react'
import { DatasetRepository } from '../../../dataset/domain/repositories/DatasetRepository'
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't need this hook anymore right? If that is the case I think we can delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will remove it

handleClose={handleClose}
/>
)
cy.findByText('Update Current Version').should('exist')
cy.contains('Update Current Version').should('exist')
})
})
describe('PublishDatasetModal', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

In this file we have three describe('PublishDatasetModal', we should only have one same describe with different cases inside.

handleClose={handleClose}
/>
)
cy.findByText('Update Current Version').should('exist')
cy.contains('Update Current Version').should('exist')
Copy link
Contributor

Choose a reason for hiding this comment

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

you can change all the cy.contains for:
cy.findByLabelText(/Update Current Version/).should('exist')

I think is more suitable for finding an input by its label.

@g-saracca g-saracca assigned ekraffmiller and unassigned g-saracca Sep 2, 2024
@ekraffmiller
Copy link
Contributor Author

@g-saracca I made the requested changes, thanks! FileJSDataverseRepository.spec.ts is failing in Github, but I can't reproduce it locally, can you try it in your local environment?

@g-saracca
Copy link
Contributor

g-saracca commented Sep 3, 2024

@g-saracca I made the requested changes, thanks! FileJSDataverseRepository.spec.ts is failing in Github, but I can't reproduce it locally, can you try it in your local environment?

Hi @ekraffmiller , yes, that happen to me too. Try applying this change in the cypress config👇
https://github.com/IQSS/dataverse-frontend/pull/477/files#diff-3f62e885350a48939f240b9daf40f6b06d41da7751f2b613238fc7669ac0a1b2

@ekraffmiller
Copy link
Contributor Author

@g-saracca I made the requested changes, thanks! FileJSDataverseRepository.spec.ts is failing in Github, but I can't reproduce it locally, can you try it in your local environment?

Hi @ekraffmiller , yes, that happen to me too. Try applying this change in the cypress config👇 https://github.com/IQSS/dataverse-frontend/pull/477/files#diff-3f62e885350a48939f240b9daf40f6b06d41da7751f2b613238fc7669ac0a1b2

That worked, thanks! I just realized I missed some requested changes, will do that now 👍

@ekraffmiller ekraffmiller removed their assignment Sep 4, 2024
Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

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

@ekraffmiller Thanks for addressing all the changes!

I'm sorry I missed some observations in the first review.

  • I think we need to set margin-bottom: 0; to PublishDatasetHelpText component in .warningText class to avoid too much spacing.
  • Also the CC0 link should have a target="_blank" attribute so it opens the link in a new tab.
  • And could we enable the update current version checkbox now that is allowed by the use case? Or perhaps we should do it in a separate issue?

@ekraffmiller
Copy link
Contributor Author

thanks @g-saracca, requested changes made 👍

g-saracca
g-saracca previously approved these changes Sep 5, 2024
Copy link
Contributor

@g-saracca g-saracca left a comment

Choose a reason for hiding this comment

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

Thanks @ekraffmiller , approving!
Will be nice to add in the How To test this, a note that update current version is enabled now.

@ekraffmiller
Copy link
Contributor Author

Thanks @ekraffmiller , approving! Will be nice to add in the How To test this, a note that update current version is enabled now.

Thanks! I added testing instructions.

@ekraffmiller
Copy link
Contributor Author

I added an issue for the error that occurred in the UploadDatasetFiles unit test: #481

Copy link
Contributor

@ChengShi-1 ChengShi-1 left a comment

Choose a reason for hiding this comment

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

approve merging commit

@ChengShi-1 ChengShi-1 merged commit 1603ea2 into develop Sep 6, 2024
11 of 14 checks passed
@g-saracca g-saracca deleted the feat/428-publish-version-numbers branch September 9, 2024 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GREI Re-arch GREI re-architecture-related Size: 3 A percentage of a sprint. 2.1 hours. SPA: Dataset page (View)
Projects
Status: Done 🧹
Development

Successfully merging this pull request may close these issues.

Publish Dataset: Show new version numbers in Publish Popup
4 participants