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

Add ability to group metadata #871

Merged
merged 12 commits into from
Aug 24, 2020
Merged

Conversation

marthacryan
Copy link
Member

@marthacryan marthacryan commented Aug 17, 2020

Fixes #789. Using an optional "category" field in the "uihints" of a schema, adds a header when a new category encountered.
image

First pass relies on order of schema properties to determine where to add the headers - planning to incorporate some sorting to make that less reliant on JSON ordering.

Developer's Certificate of Origin 1.1

   By making a contribution to this project, I certify that:

   (a) The contribution was created in whole or in part by me and I
       have the right to submit it under the Apache License 2.0; or

   (b) The contribution is based upon previous work that, to the best
       of my knowledge, is covered under an appropriate open source
       license and I have the right under that license to submit that
       work with modifications, whether created in whole or in part
       by me, under the same open source license (unless I am
       permitted to submit under a different license), as indicated
       in the file; or

   (c) The contribution was provided directly to me by some other
       person who certified (a), (b) or (c) and I have not modified
       it.

   (d) I understand and agree that this project and the contribution
       are public and that a record of the contribution (including all
       personal information I submit with it, including my sign-off) is
       maintained indefinitely and may be redistributed consistent with
       this project or the open source license(s) involved.

@marthacryan marthacryan changed the title Add ability to group metadata [WIP] Add ability to group metadata Aug 17, 2020
@marthacryan marthacryan added component:metadata-editor Metadata Editor Extension kind:enhancement New feature or request status:Work in Progress Development in progress. A PR tagged with this label is not review ready unless stated otherwise. labels Aug 17, 2020
@marthacryan marthacryan changed the title [WIP] Add ability to group metadata Add ability to group metadata Aug 19, 2020
@marthacryan marthacryan removed the status:Work in Progress Development in progress. A PR tagged with this label is not review ready unless stated otherwise. label Aug 19, 2020
Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Ran it locally and it works, included some review comments below, but I have a small issue with the implementation, it feels more like a "hack" to support the previous implementation (not that it's not a decent working solution). You create an array of categories then create a list of fields that is created by adding fields matching each category one by one. The idea I had in mind during the previous call was a bit different, rather than having two lists it would be one dict. the dict would use each category as a key with each value being the list of fields. This would then combine the two for loops in your code to just one loop. (This is just my opinion, the implementation here is ok and I would be ok with merging it as is, pending my comments below)

// Find categories of all schema properties
for (const schemaProperty in this.schema) {
if (!this.schema[schemaProperty].uihints) {
this.schema[schemaProperty].uihints = {};
Copy link
Member

Choose a reason for hiding this comment

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

I believe we do something similar to this in renderField might be worth updating that to remove any redundant code.

packages/metadata-common/src/MetadataEditor.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@vabarbosa vabarbosa left a comment

Choose a reason for hiding this comment

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

thanks for the quick updates

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Some followup review based on your latest updates. I'll also test it locally but I expect it'll work the same as before

packages/metadata-common/src/MetadataEditor.tsx Outdated Show resolved Hide resolved
packages/metadata-common/src/MetadataEditor.tsx Outdated Show resolved Hide resolved
packages/metadata-common/src/MetadataEditor.tsx Outdated Show resolved Hide resolved
packages/metadata-common/src/MetadataEditor.tsx Outdated Show resolved Hide resolved
ajbozarth and others added 2 commits August 20, 2020 22:24
The latest release of JupyterLab updated to the latest release
of blueprintjs core, which included an async bugfix for
`InputGroup` which broke how our async update interacts with fields.
Causing any already rendered `InputGroup` to not update it value
on an async call to `uodate()` such as the one we do after calling
the metadata api.

I solved this by making the rendering of the display_name field
conditional on the existance of an inital value, just like we
already do with the other fields.

Fixes elyra-ai#883
@akchinSTC akchinSTC added this to the 1.1.0 milestone Aug 21, 2020
@marthacryan
Copy link
Member Author

Just pulled in changes from #885 to make sure they're compatible with these changes.

Copy link
Member

@ajbozarth ajbozarth left a comment

Choose a reason for hiding this comment

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

Tested locally and LGTM

@lresende lresende merged this pull request into elyra-ai:master Aug 24, 2020
lresende pushed a commit that referenced this pull request Aug 24, 2020
Co-authored-by: Alex Bozarth <ajbozart@us.ibm.com>
@marthacryan marthacryan deleted the group-metadata branch April 23, 2021 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:metadata-editor Metadata Editor Extension kind:enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ability to "group" fields in the metadata editor
5 participants