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

refactor(metadata-view): Generalize metadataFieldsToShow for item fields #2331

Merged
merged 1 commit into from Sep 11, 2020

Conversation

manishPh
Copy link
Contributor

No description provided.

@manishPh manishPh requested review from a team as code owners September 10, 2020 21:52
@manishPh
Copy link
Contributor Author

This PR removes the metadataFieldsToShow prop from <ContentExplorer /> and replaces it with fieldsToShow prop. Users should be able to provide metadata fields + item fields using the same prop. Here is what is looks like to have item fields (in addition to name) and metadata fields in the same view:
image

Props used for this view:

const mdQuery = {
    from: 'enterprise_123.templateKey',
    fields: [
        "name",
        "size",
        "description",
        "created_by",
        "metadata.enterprise_123.templateKey.type",
        "metadata.enterprise_123.templateKey.vendor",
        "metadata.enterprise_123.templateKey.amount",
        "metadata.enterprise_123.templateKey.created",
        "metadata.enterprise_123.templateKey.category",
        "metadata.enterprise_123.templateKey.approved",
    ],
    ancestor_folder_id: '0',
};
const defaultView = 'metadata';
const fieldsToShow = [
    'size',
    {key: 'created_by.login', canEdit: true, displayName: 'Created By'},
    {key: 'metadata.enterprise_123.templateKey.type', canEdit: true, displayName: 'TYPe'},
    {key: 'metadata.enterprise_123.templateKey.vendor', canEdit: false, displayName: 'AABC'},
    {key: 'metadata.enterprise_123.templateKey.amount', canEdit: false},
    'metadata.enterprise_123.templateKey.category',
    'metadata.enterprise_123.templateKey.created',
    {key: 'metadata.enterprise_123.templateKey.approved', canEdit: true, displayName: 'APPROVED'},
];

<ContentExplorer
    ...
    metadataQuery={mdQuery}
    defaultView={defaultView}
    fieldsToShow={fieldsToShow}
/>

@manishPh manishPh merged commit 1803655 into box:master Sep 11, 2020
@manishPh manishPh deleted the refactor-metadata-view branch September 11, 2020 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants