Skip to content

Commit

Permalink
fix(RHICOMPL-880): Set fitContent for columns to not trigger tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
bastilian committed Oct 7, 2020
1 parent 4566598 commit 1be8c02
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
12 changes: 8 additions & 4 deletions packages/inventory-compliance/src/SystemRulesTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import propTypes from 'prop-types';
import { Pagination, PaginationVariant, ToolbarItem } from '@patternfly/react-core';
import { CheckCircleIcon, ExclamationCircleIcon, AnsibeTowerIcon } from '@patternfly/react-icons';
import { Table, TableHeader, TableBody, sortable } from '@patternfly/react-table';
import { Table, TableHeader, TableBody, sortable, fitContent } from '@patternfly/react-table';
import { TableToolbar, PrimaryToolbar } from '@redhat-cloud-services/frontend-components';

import './compliance.scss';
Expand All @@ -17,12 +17,16 @@ import ComplianceRemediationButton from './ComplianceRemediationButton';
export const columns = [
{ title: 'Rule', transforms: [ sortable ] },
{ title: 'Policy', transforms: [ sortable ] },
{ title: 'Severity', transforms: [ sortable ] },
{ title: 'Passed', transforms: [ sortable ] },
{ title: 'Severity', transforms: [ sortable, fitContent ] },
{ title: 'Passed', transforms: [ sortable, fitContent ] },
{ title: <React.Fragment><AnsibeTowerIcon /> Ansible</React.Fragment>,
original: 'Ansible', transforms: [ sortable ] }
original: 'Ansible', props: { tooltip: 'Ansible' }, transforms: [ sortable, fitContent ] }
];

export const selectColumns = (columnTitles) => (
columns.filter((column) => columnTitles.includes(column.original || column.title))
);

class SystemRulesTable extends React.Component {
config = buildFilterConfig({
selectedFilter: this.props.selectedFilter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,21 @@ exports[`SystemRulesTable component should render 1`] = `
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -224,6 +229,7 @@ exports[`SystemRulesTable component should render 1`] = `
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -1058,16 +1064,21 @@ exports[`SystemRulesTable component should render a loading table 1`] = `
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -1078,6 +1089,7 @@ exports[`SystemRulesTable component should render a loading table 1`] = `
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -1328,16 +1340,21 @@ exports[`SystemRulesTable component should render filtered and search mixed resu
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -1348,6 +1365,7 @@ exports[`SystemRulesTable component should render filtered and search mixed resu
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -1683,16 +1701,21 @@ exports[`SystemRulesTable component should render search results by rule name 1`
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -1703,6 +1726,7 @@ exports[`SystemRulesTable component should render search results by rule name 1`
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -2088,16 +2112,21 @@ exports[`SystemRulesTable component should render search results on any page, re
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -2108,6 +2137,7 @@ exports[`SystemRulesTable component should render search results on any page, re
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -2484,16 +2514,21 @@ exports[`SystemRulesTable component should render sorted rows 1`] = `
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -2504,6 +2539,7 @@ exports[`SystemRulesTable component should render sorted rows 1`] = `
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -3522,16 +3558,21 @@ exports[`SystemRulesTable component should render sorted rows 2`] = `
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -3542,6 +3583,7 @@ exports[`SystemRulesTable component should render sorted rows 2`] = `
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down Expand Up @@ -4496,16 +4538,21 @@ exports[`SystemRulesTable component should render without remediations if prop p
"title": "Severity",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"title": "Passed",
"transforms": Array [
[Function],
[Function],
],
},
Object {
"original": "Ansible",
"props": Object {
"tooltip": "Ansible",
},
"title": <React.Fragment>
<AnsibeTowerIcon
color="currentColor"
Expand All @@ -4516,6 +4563,7 @@ exports[`SystemRulesTable component should render without remediations if prop p
</React.Fragment>,
"transforms": Array [
[Function],
[Function],
],
},
]
Expand Down
2 changes: 1 addition & 1 deletion packages/inventory-compliance/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export { default as default } from './Compliance';
export { default as SystemRulesTable } from './SystemRulesTable';
export { default as SystemRulesTable, selectColumns as selectRulesTableColumns } from './SystemRulesTable';
export { default as ComplianceRemediationButton } from './ComplianceRemediationButton';
export { default as ComplianceEmptyState } from './ComplianceEmptyState';
export { ChipBuilder, FilterBuilder, FilterConfigBuilder } from './Utilities';

0 comments on commit 1be8c02

Please sign in to comment.