Skip to content

Commit

Permalink
solve cypress test and address more comments
Browse files Browse the repository at this point in the history
Signed-off-by: Anan Zhuang <[email protected]>
  • Loading branch information
ananzh committed Apr 17, 2023
1 parent 80ef7cb commit 11f0e49
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
}

// Modifier for visTables__group when displayed in columns
.visTable__group--columns {
.visTable__groupInColumns {
flex-direction: row;
align-items: flex-start;
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ describe('TableVisApp', () => {
handlers={handlersMock}
/>
);
expect(container.outerHTML.includes('visTable visTable__group--columns')).toBe(true);
expect(container.outerHTML.includes('visTable visTable__groupInColumns')).toBe(true);
expect(getByTestId('TableVisComponentGroup')).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import { TableVisData } from '../table_vis_response_handler';
import { TableVisConfig } from '../types';
import { TableVisComponent } from './table_vis_component';
import { TableVisComponentGroup } from './table_vis_component_group';
import { getTableUIState } from '../utils/get_table_ui_state';
import { TableUiState } from '../utils/get_table_ui_state';
import { getTableUIState, TableUiState } from '../utils';

interface TableVisAppProps {
services: CoreStart;
Expand All @@ -38,7 +37,7 @@ export const TableVisApp = ({

const className = classNames('visTable', {
// eslint-disable-next-line @typescript-eslint/naming-convention
'visTable__group--columns': direction === 'column',
visTable__groupInColumns: direction === 'column',
});

const tableUiState: TableUiState = getTableUIState(handlers.uiState as PersistedState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const getTableVisCellValue = (
if (!row || !row.hasOwnProperty(columnId)) {
return null;
}
const rawContent = sortedRows[rowIndex][columnId];
const rawContent = row[columnId];
const colIndex = columns.findIndex((col) => col.id === columnId);
const htmlContent = columns[colIndex].formatter.convert(rawContent, 'html');
const formattedContent = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { getDataGridColumns } from './table_vis_grid_columns';
import { getTableVisCellValue } from './table_vis_cell';
import { usePagination } from '../utils';
import { TableVisControl } from './table_vis_control';
import { TableUiState } from '../utils/get_table_ui_state';
import { TableUiState } from '../utils';

interface TableVisComponentProps {
title?: string;
Expand Down Expand Up @@ -48,10 +48,10 @@ export const TableVisComponent = ({
}
}, [formattedColumns, rows, sort]);

const renderCellValue = useMemo(
() => getTableVisCellValue(sortedRows, formattedColumns) as EuiDataGridProps['renderCellValue'],
[sortedRows, formattedColumns]
);
const renderCellValue = useMemo(() => getTableVisCellValue(sortedRows, formattedColumns), [
sortedRows,
formattedColumns,
]);

const dataGridColumns = getDataGridColumns(table, event, colWidth);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { IInterpreterRenderHandlers } from 'src/plugins/expressions';
import { TableGroup } from '../table_vis_response_handler';
import { TableVisConfig } from '../types';
import { TableVisComponent } from './table_vis_component';
import { TableUiState } from '../utils/get_table_ui_state';
import { TableUiState } from '../utils';

interface TableVisGroupComponentProps {
tableGroups: TableGroup[];
Expand Down

0 comments on commit 11f0e49

Please sign in to comment.