elixir-cloud-aai / cloud-components

Reusable components for the ELIXIR Cloud
https://cloud-components.2.rahtiapp.fi/
Apache License 2.0
8 stars 14 forks source link

feat:RO-Crate Dataset-entity #370

Closed sivangbagri closed 3 weeks ago

sivangbagri commented 1 month ago

Description

Dedicated PR for RO-Crate Dataset entity

Checklist

Comments

Summary by Sourcery

Add a new RO-Crate Dataset entity component to the ecc-client-elixir-ro-crate package, featuring a tabbed interface for managing dataset metadata, related entities, and structure. Include demo HTML files to demonstrate component usage.

New Features:

Enhancements:

Documentation:

sourcery-ai[bot] commented 1 month ago

Reviewer's Guide by Sourcery

This PR implements a new RO-Crate Dataset entity component using LitElement. The component provides a tabbed interface for managing dataset metadata, including basic information, related entities, and structure. It features dynamic form handling with field validation and conditional rendering based on user input.

Class diagram for ECCClientRoCrateAbout component

classDiagram
    class ECCClientRoCrateAbout {
        - activeTab: number
        - AboutFields: Field[]
        + render() void
        + _switchTab(index: number) void
        + _handleDataset(e: CustomEvent) void
    }
    class Field {
        + key: string
        + label: string
        + type: string
        + fieldOptions: object
        + arrayOptions: object
        + groupOptions: object
        + children: Field[]
    }
    ECCClientRoCrateAbout --> Field
    note for ECCClientRoCrateAbout "This class represents a LitElement component for managing RO-Crate Dataset metadata with a tabbed interface."

File-Level Changes

Change Details Files
Implementation of the main Dataset entity component with tabbed interface
  • Created a LitElement-based component with three tabs: About, Related People, and Structure
  • Implemented tab switching functionality
  • Added state management for active tab tracking
packages/ecc-client-elixir-ro-crate/src/components/about/about.ts
Form field definitions and dynamic form handling
  • Defined required dataset fields including @id, @type, name, description, and datePublished
  • Implemented dynamic license field handling with conditional form fields based on license type
  • Added validation and tooltip support for form fields
  • Created field definitions for related people and organizations (author, publisher, funder)
  • Implemented structure fields for managing dataset parts
packages/ecc-client-elixir-ro-crate/src/components/about/about.ts
Component demo and integration setup
  • Created demo pages for testing the component
  • Set up component registration for web components
  • Added TypeScript declarations for HTML element interface
packages/ecc-client-elixir-ro-crate/demo/about/index.html
packages/ecc-client-elixir-ro-crate/demo/index.html
packages/ecc-client-elixir-ro-crate/src/components/about/index.ts

Tips and commands #### Interacting with Sourcery - **Trigger a new review:** Comment `@sourcery-ai review` on the pull request. - **Continue discussions:** Reply directly to Sourcery's review comments. - **Generate a GitHub issue from a review comment:** Ask Sourcery to create an issue from a review comment by replying to it. - **Generate a pull request title:** Write `@sourcery-ai` anywhere in the pull request title to generate a title at any time. - **Generate a pull request summary:** Write `@sourcery-ai summary` anywhere in the pull request body to generate a PR summary at any time. You can also use this command to specify where the summary should be inserted. #### Customizing Your Experience Access your [dashboard](https://app.sourcery.ai) to: - Enable or disable review features such as the Sourcery-generated pull request summary, the reviewer's guide, and others. - Change the review language. - Add, remove or edit custom review instructions. - Adjust other review settings. #### Getting Help - [Contact our support team](mailto:support@sourcery.ai) for questions or feedback. - Visit our [documentation](https://docs.sourcery.ai) for detailed guides and information. - Keep in touch with the Sourcery team by following us on [X/Twitter](https://x.com/SourceryAI), [LinkedIn](https://www.linkedin.com/company/sourcery-ai/) or [GitHub](https://github.com/sourcery-ai).
vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
elixir-cloud-components ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 1, 2024 2:46pm
changeset-bot[bot] commented 1 month ago

⚠️ No Changeset found

Latest commit: 948a721bbb82c964af788f726a017c607a1bd376

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

SalihuDickson commented 1 month ago

Great work @sivangbagri, just a few things:

  1. Is this tool geared toward a specific type of RO-Crates like Workflow Run RO-Crates? or is it more generic with more options for users that want to create something more specifc.

  2. The fields for the entities on the "Related People, Orgs & Works" tab don't correspond to the required fields for those entities, can you please cite the resource you used to get those fields, incase I am missing something.

  3. I think the layout needs to be changed, I think the tabs should correspond to the entity names or at least entities that can be grouped together. For example, the about tab should be the Dataset Entity tab, we can also have one for the metadata (that can be added in a separate PR).

  4. The type field for the Dataset Entity should not be modifiable, you can actually get rid of that field and set that field programmatically, as the value MUST be "Dataset".

sivangbagri commented 1 month ago

Hii @salihu Thanks for your review. 1) Currently I am keeping it as simple RO-Crate dataset with basic elements but obviously it can be improved in future to meet any particular requirement. 2) Thats a todo thing actually, they are not the final fields. Will work on that separately. 3) Yeah I will improve that . 👍🏻 4) Yeah we can do that as root entity must be dataset only, I kept it for consistency and user awareness.

SalihuDickson commented 1 month ago
  1. Okay, that makes sense. I do think it will be a good idea to add options in the future.
  2. If you haven't already then you might want to create an issue for that.
sivangbagri commented 4 weeks ago

@SalihuDickson Kindly checkout the new PR

SalihuDickson commented 4 weeks ago

I'll review the other PR ASAP, however this one is just about ready to merge, if you can just take out the type field, and change the tab name to Dataset Entity.

SalihuDickson commented 4 weeks ago

Also please resolve conflicts with main.

SalihuDickson commented 3 weeks ago

Hey, Shivang. This looks good so far. I made some changes to the logic handling the conditional license fields. The former logic was pretty convoluted and would break under certain conditions.

then about the type field. Perhaps removing it completely could cause some confusion and make the user believe there's no type property. I am going to write an issue requesting support for readonly fields in the form component, we can then use that to signify that there is a type field present but it is uneditable.