Skip to content

Commit

Permalink
Merge pull request #3159 from dlabrecq/data-table-column
Browse files Browse the repository at this point in the history
Adjust last column padding
  • Loading branch information
dlabrecq authored May 9, 2023
2 parents d8c510b + 4cf2a05 commit 0d0b04b
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 8 deletions.
4 changes: 3 additions & 1 deletion src/routes/settings/tagDetails/tagTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import React from 'react';
import type { WrappedComponentProps } from 'react-intl';
import { injectIntl } from 'react-intl';
import { DataTable } from 'routes/views/details/components/dataTable';
import { styles } from 'routes/views/details/components/dataTable/dataTable.styles';
import type { ComputedReportItem } from 'utils/computedReport/getComputedReportItems';
import { getUnsortedComputedReportItems } from 'utils/computedReport/getComputedReportItems';
import type { RouterComponentProps } from 'utils/router';
Expand Down Expand Up @@ -85,6 +86,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
orderBy: 'source_type',
name: intl.formatMessage(messages.sourceType),
...(computedItems.length && { isSortable: true }),
style: styles.lastItemColumn,
},
];

Expand All @@ -104,7 +106,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
</Label>
),
},
{ value: 'source type' },
{ value: 'source type', style: styles.lastItem },
],
item,
selected: isAllSelected || (selectedItems && selectedItems.find(val => val.id === item.id) !== undefined),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class OptimizationsTableBase extends React.Component<OptimizationsTableProps, Op
{
name: intl.formatMessage(messages.optimizationsNames, { value: 'last_reported' }),
orderBy: 'last_reported',
style: styles.lastReportedColumn,
style: styles.lastItemColumn,
...(hasData && { isSortable: true }),
},
];
Expand All @@ -126,7 +126,7 @@ class OptimizationsTableBase extends React.Component<OptimizationsTableProps, Op
{ value: workload },
{ value: workloadType },
{ value: cluster, hidden: groupBy === 'cluster' },
{ value: lastReported, style: styles.lastReported },
{ value: lastReported, style: styles.lastItem },
],
optimization: {
container: item.container,
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/awsDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/azureDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ export const styles = {
color: global_disabled_color_100.value,
fontSize: global_FontSize_xs.value,
},
lastReported: {
lastItem: {
textAlign: 'right',
paddingRight: '40px',
paddingRight: '3.8rem',
},
lastReportedColumn: {
lastItemColumn: {
textAlign: 'right',
display: 'flex',
justifyContent: 'flex-end',
Expand Down
5 changes: 3 additions & 2 deletions src/routes/views/details/components/dataTable/dataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { styles } from './dataTable.styles';

interface DataTableOwnProps {
columns?: any[];
isActionsCell?: boolean;
isLoading?: boolean;
isOptimizations?: boolean;
onSelected(items: ComputedReportItem[], isSelected: boolean);
Expand Down Expand Up @@ -129,7 +130,7 @@ class DataTable extends React.Component<DataTableProps, any> {
};

public render() {
const { columns, intl, isLoading, isOptimizations, rows } = this.props;
const { columns, intl, isActionsCell = false, isLoading, isOptimizations, rows } = this.props;

return (
<>
Expand Down Expand Up @@ -193,7 +194,7 @@ class DataTable extends React.Component<DataTableProps, any> {
dataLabel={columns[cellIndex].name}
key={`cell-${rowIndex}-${cellIndex}`}
modifier="nowrap"
isActionCell={!isOptimizations && cellIndex === row.cells.length - 1}
isActionCell={isActionsCell && cellIndex === row.cells.length - 1}
style={item.style}
>
{item.value}
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/gcpDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/ibmDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/ociDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/ocpDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down
1 change: 1 addition & 0 deletions src/routes/views/details/rhelDetails/detailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ class DetailsTableBase extends React.Component<DetailsTableProps, DetailsTableSt
return (
<DataTable
columns={columns}
isActionsCell
isLoading={isLoading}
onSelected={onSelected}
onSort={onSort}
Expand Down

0 comments on commit 0d0b04b

Please sign in to comment.