-
Notifications
You must be signed in to change notification settings - Fork 16
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
Conversation
I took a quick peek at https://646f68aa9beb01b35c599acd-naljpjbrwa.chromatic.com/?path=/story/pages-file--default |
…into feature/249-boilerplate-file-page
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 |
get isTabularData(): boolean { | ||
return this.tabularData !== undefined | ||
} | ||
export interface File { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. Thanks!
There was a problem hiding this 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:
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
…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(), |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) | ||
}) | ||
} | ||
} |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…into feature/249-boilerplate-file-page
I just retested the branch and it looks good, merging. |
249 - File Page boilerplate
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:
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:
npm install
.cd packages/design-system && npm run build
.cd ../../
.npm run storybook
.Does this PR introduce a user interface change? If mockups are available, please link/include them here:
Mock
Is there a release notes update needed for this change?:
File Page added to the SPA beta
Additional documentation: