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

249 - File Page boilerplate #260

Merged
merged 20 commits into from
Jan 19, 2024
Merged

Conversation

MellyGray
Copy link
Contributor

@MellyGray MellyGray commented Dec 13, 2023

What this PR does / why we need it:

This PR adds the boilerplate of the File Page. A basic page to display the files details. The boilerplate includes these features:

Features:

  1. File page with the File title and a reference to it's dataset
  2. The files in the Dataset page files table should have a link to it's file page
  3. Loading page
  4. Page not found if the file is not found

Which issue(s) this PR closes:

Special notes for your reviewer:

This is just the most basic version of the page. We'll add more components to the page in other issues.

I had to refactor the Dataset mode so the DatasetVersion property could be extracted and added to the File model since all of the dataset version data will be needed to implemented the File page

Suggestions on how to test this:

  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 File Page in the Storybook

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

Mock

Captura de pantalla 2023-12-05 a las 12 01 26
image
image

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

File Page added to the SPA beta

Additional documentation:

@MellyGray MellyGray added Size: 3 A percentage of a sprint. 2.1 hours. UI Tasks related to the user interface (UI) or frontend development labels Dec 13, 2023
@MellyGray MellyGray linked an issue Dec 13, 2023 that may be closed by this pull request
@MellyGray MellyGray marked this pull request as ready for review December 13, 2023 17:15
@coveralls
Copy link

coveralls commented Dec 13, 2023

Coverage Status

coverage: 97.805% (-0.1%) from 97.922%
when pulling 1f28e78 on feature/249-boilerplate-file-page
into baa7faf on develop.

@pdurbin
Copy link
Member

pdurbin commented Dec 13, 2023

@MellyGray MellyGray self-assigned this Dec 15, 2023
@MellyGray
Copy link
Contributor Author

MellyGray commented Dec 15, 2023

I'm putting this back to 'in progress' because I need to refactor the Dataset model to extract some properties and include them in the DatasetVersion to then add this dataset version to the new File model. We'll need some dataset version information to display it on the file page. This refactor will impact all the upcoming file page issues, so I think it's better to do the refactor in this branch, which will serve as the parent for the rest of the file components branches

@MellyGray MellyGray marked this pull request as draft December 15, 2023 13:53
@M27Mangan M27Mangan self-requested a review December 15, 2023 20:51
@MellyGray MellyGray added Size: 10 A percentage of a sprint. 7 hours. and removed Size: 3 A percentage of a sprint. 2.1 hours. labels Dec 19, 2023
@GPortas GPortas self-assigned this Dec 22, 2023
get isTabularData(): boolean {
return this.tabularData !== undefined
}
export interface File {
Copy link
Contributor

Choose a reason for hiding this comment

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

It is a bit confusing that the class with the largest number of properties is the "preview", while "File" is only an interface with two properties.

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 see your point, but the File model is not finished yet, and when the File Page is finished the File model will contain all the FilePreview properties plus the file versions, plus the file metrics, etc. So at the end the File model will be larger than the File Preview, even though right now it's smaller because we only have the boilerplate properties.

Also, the way I see it is that in the Files Table of the Dataset View we're displaying the file information preview, while in the File View we're seeing the actual file.

Does it make sense to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. Thanks!

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.

Overall it looks good

I left a comment about a naming issue.

On the other hand, storybook looks good for Default and Loading states:

file_default

file_loading

But for File Not Found, I see a reference to "Demo Dataverse" which is not correct. I assume it was introduced by mistake due to a string copied from the demo installation.

file_notfound

@GPortas GPortas added pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows labels Jan 3, 2024
@GPortas GPortas removed their assignment Jan 4, 2024
@MellyGray
Copy link
Contributor Author

But for File Not Found, I see a reference to "Demo Dataverse" which is not correct. I assume it was introduced by mistake due to a string copied from the demo installation.

I removed the last sentence of the alert to match the message in beta:

image

image

@MellyGray MellyGray assigned GPortas and unassigned MellyGray Jan 8, 2024
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 Jan 8, 2024
…the-file-page

262 - File labels section of the File page
@@ -27,15 +27,14 @@ export const WithPublishPermissions: Story = {
<DatasetActionButtons
dataset={DatasetMother.create({
permissions: DatasetPermissionsMother.createWithAllAllowed(),
version: DatasetVersionMother.createDraftAsLatestVersion(),
version: DatasetVersionMother.createDraftAsLatestVersionWithSomeVersionHasBeenReleased(),

Choose a reason for hiding this comment

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

Can you walk me through what this method does? I would like to try for a shorter name that is still as descriptive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This method creates a mock of the dataset version, the name tries to describe that this dataset version is a draft and it's the latest version available of the dataset + some version of the dataset has been released

This means that the dataset is published and the retrieved version is a draft which is also the latest version available

ingest: FileIngestMother.createIngestProblem(reportMessage)
})
}
}

Choose a reason for hiding this comment

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

Similarly to your previous comments on "CreateDatasetMaster", components using "Mother" as an identifier should be renamed in the interest of adopting inclusive and non-gendered language. Please consider an alternative such as

FilePreviewBase: This name indicates that the file serves as a base or a template for creating FilePreview objects, adhering to the principles of object-oriented programming.

FilePreviewTemplate: This alternative emphasizes that the file acts as a template or a blueprint for FilePreview instances.

FilePreviewFactory: In the context of design patterns, "Factory" suggests that this file is responsible for creating instances of FilePreview, fitting well with the file's content.

FilePreviewGenerator: This name implies that the file's purpose is to generate FilePreview objects, which is descriptive of its functionality.

FilePreviewCreator: Similar to "Generator," "Creator" indicates that the file is involved in the creation process of FilePreview objects.

FilePreviewBuilder: This name suggests that the file's role is to build or construct FilePreview instances, aligning with the builder pattern in software design.

FilePreviewSource: This general term indicates that the file is the source for FilePreview objects.

The same should be done for DatasetMother, but I can open another issue for that.

Copy link
Contributor Author

@MellyGray MellyGray Jan 15, 2024

Choose a reason for hiding this comment

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

The 'Mother' portion of the name simply refers to the Object Mother pattern. It's not precisely a Factory or a Builder class, which is why it carries its unique pattern designation.

I understand your concerns regarding the gender implications of the name. However, including other names would alter its meaning.

We could include an explanation about this pattern and its naming in the documentation.

Copy link
Member

Choose a reason for hiding this comment

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

I also asked about "mother" and I do think it would be nice to link to that Martin Fowler article from a comment or other docs. Good idea.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@M27Mangan correct me if I'm wrong but I think you were working on this issue:

Should we add the Martin Fowler article to that guide or should I add it to the README?

The problem with linking the article from a comment is that there are several files where the Mother suffix is used so I'm not sure where to place it

Copy link
Member

Choose a reason for hiding this comment

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

Maybe just the README for now? Or in a list of TODOs (to document) in this issue?

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 updated the issue description to add the list of TODO's
image

@MellyGray MellyGray mentioned this pull request Jan 17, 2024
1 task
@GPortas GPortas self-assigned this Jan 19, 2024
@GPortas
Copy link
Contributor

GPortas commented Jan 19, 2024

I just retested the branch and it looks good, merging.

@GPortas GPortas merged commit 4dba60a into develop Jan 19, 2024
11 of 14 checks passed
@GPortas GPortas deleted the feature/249-boilerplate-file-page branch January 19, 2024 09:21
jayanthkomarraju pushed a commit to jayanthkomarraju/dataverse-frontend that referenced this pull request May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pm.GREI-d-2.7.1 NIH, yr2, aim7, task1: R&D UI modules for creating datasets and supporting publishing workflows pm.GREI-d-2.7.2 NIH, yr2, aim7, task2: Implement UI modules for creating datasets and publishing workflows Size: 10 A percentage of a sprint. 7 hours. UI Tasks related to the user interface (UI) or frontend development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set up the boilerplate for the File Page
6 participants