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

ScanReport: Disable hiding relevant fields #40602

Open
wants to merge 2 commits into
base: add/protect/core
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J
id: FIELD_STATUS,
elements: STATUS_TYPES,
label: __( 'Status', 'jetpack-components' ),
enableHiding: false,
getValue( { item } ) {
if ( item.checked ) {
if ( item.threats.length > 0 ) {
Expand Down Expand Up @@ -152,18 +153,25 @@ export default function ScanReport( { dataSource, data, onChangeSelection } ): J
id: FIELD_TYPE,
label: __( 'Type', 'jetpack-components' ),
elements: TYPES,
enableHiding: false,
},
{
id: FIELD_NAME,
label: __( 'Name', 'jetpack-components' ),
enableHiding: false,
enableGlobalSearch: true,
getValue( { item }: { item: ScanReportExtension } ) {
if ( view.type === 'list' && item.type === 'files' ) {
return 'Files';
}

Comment on lines +164 to +167
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if ( view.type === 'list' && item.type === 'files' ) {
return 'Files';
}

Ideally, we shouldn't be worrying about something like this at the component level - we should expect that the necessary data is provided.

Luckily, since we control the files item, can we avoid needing this side effect in the first place by adding name: __( 'Files', 'jetpack-components' ) when providing the data to the component on the implementation side in Protect. 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

I've included adding the name property in this PR: #40616

return item.name ? item.name : '';
},
},
{
id: FIELD_VERSION,
label: __( 'Version', 'jetpack-components' ),
enableHiding: false,
enableSorting: false,
enableGlobalSearch: true,
getValue( { item }: { item: ScanReportExtension } ) {
Expand Down
Loading