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

129 - Dataset Action Buttons UI #181

Merged
merged 38 commits into from
Oct 16, 2023

Conversation

MellyGray
Copy link
Contributor

@MellyGray MellyGray commented Sep 26, 2023

What this PR does / why we need it:

This PR adds the Dataset Action Buttons UI to the Dataset Page View Mode

Which issue(s) this PR closes:

Special notes for your reviewer:

Some dataset properties are not connected to js-dataverse yet, so take that into account that if you test the e2e. For example the LinkDatasetButton is always going to appear in the e2e page, but if you look at the unit tests the LinkDatasetButton will only appear if the Dataset is released.

Changes in this PR

  1. Dataset Action Buttons added to the UI
  2. New properties added to the Dataset model
  3. DatasetProvider added to get the dataset from any component in the Dataset Page
  4. Files components refactored to read the new Dataset properties

Suggestions on how to test this:

To test the changes introduced by this PR, follow these steps:

  1. Install the necessary dependencies using npm install.
  2. Build the design system with cd packages/design-system && npm run build.
  3. Navigate back to the root directory with cd ../../.
  4. Start Storybook with npm run storybook.
  5. Visit the Dataset Action Buttons section in the Storybook

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

image

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

Dataset Action Buttons added to the Dataset Page

Additional documentation:

…into feature/129-dataset-page-action-buttons
…into feature/129-dataset-page-action-buttons
…into feature/129-dataset-page-action-buttons
@MellyGray MellyGray linked an issue Sep 26, 2023 that may be closed by this pull request
@MellyGray MellyGray changed the title Feature/129 dataset page action buttons 129 - Dataset Action Buttons UI Sep 26, 2023
@MellyGray MellyGray marked this pull request as ready for review September 26, 2023 13:42
@MellyGray MellyGray added the Size: 10 A percentage of a sprint. 7 hours. label Sep 26, 2023
@coveralls
Copy link

coveralls commented Sep 26, 2023

Coverage Status

coverage: 98.394% (+0.5%) from 97.897% when pulling 3bad83e on feature/129-dataset-page-action-buttons into 6d8ecd8 on develop.

@GPortas GPortas self-assigned this Sep 27, 2023
Copy link
Contributor

@GPortas GPortas 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!

It seems that the top of the citation block is not aligned with the top of the buttons. Can we fix this?

allignmentbuttons

@@ -234,13 +262,40 @@ export class Dataset {
public readonly labels: DatasetLabel[],
public readonly summaryFields: DatasetMetadataBlock[],
public readonly license: DatasetLicense,
public readonly metadataBlocks: DatasetMetadataBlocks
public readonly metadataBlocks: DatasetMetadataBlocks,
public readonly permissions: DatasetPermissions,
Copy link
Contributor

Choose a reason for hiding this comment

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

So to create an instance of a dataset model, you will also need to obtain the permissions that the current user has on the particular dataset. I'm not sure if coupling these permissions within the dataset model can be problematic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly like that, in order to create the Dataset you'll need the user permissions.

I understand your concern and these are the reasons to have them together:

  1. The dataset permissions are always used with the dataset model. So I think these permissions belong to the Dataset model, for keeping the cohesion
  2. If we have another page where we want to use the dataset permissions without the model. We can do it, getDatasetPermissions and you return the DatasetPermissions interface. But this is not going to happen in the Dataset Page, in the dataset page we always want the dataset and the dataset permissions, so it makes sense to have them together.
  3. I separated the File Permissions from the File model and it's being a nightmare, you need to remember to call these permissions when you get the files, initialise the React context, wait for them to be fetched, the tests are much more complex. Too much complexity for the aim of keeping the separation of concerns, when in reality I never use the file permissions without the files itself. I want to refactor that but I was also waiting for some feedback on this other approach.

I think the Dataset model is in reality the DatasetPage model, so its aim is to represent a DatasetPage, and the dataset page doesn't make sense without the permissions.

Very interesting conversation, please let me know if you can think of some problems of this approach

@GPortas GPortas assigned MellyGray and unassigned GPortas Oct 6, 2023
@MellyGray
Copy link
Contributor Author

@GPortas I applied the requested changes

  1. Show action buttons on the Default page of the storybook. Only the Access Dataset one because it's more realistic
  2. Align the top of the buttons with the citation block
  3. Fix the publication disabled on the Draft with all Dataset Permissions story

@MellyGray MellyGray assigned GPortas and unassigned MellyGray Oct 6, 2023
Copy link
Contributor

@GPortas GPortas left a comment

Choose a reason for hiding this comment

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

LGTM!

@GPortas GPortas removed their assignment Oct 9, 2023
@kcondon kcondon self-assigned this Oct 16, 2023
@kcondon kcondon merged commit 403f161 into develop Oct 16, 2023
5 of 6 checks passed
@kcondon kcondon deleted the feature/129-dataset-page-action-buttons branch October 16, 2023 14:05
jayanthkomarraju pushed a commit to jayanthkomarraju/dataverse-frontend that referenced this pull request May 31, 2024
…-buttons

129 - Dataset Action Buttons UI
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Size: 10 A percentage of a sprint. 7 hours.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spike - Frontend] UI of the Dataset page action buttons
4 participants