do not update cell background if is label cell (#60308)

This commit is contained in:
Melissa Alvarez 2020-03-17 13:41:46 -04:00 committed by GitHub
parent 89f9260da2
commit f875b7165e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 7 deletions

View file

@ -15,6 +15,8 @@ interface ColumnData {
error_count?: number;
}
export const ACTUAL_CLASS_ID = 'actual_class';
export function getColumnData(confusionMatrixData: ConfusionMatrix[]) {
const colData: Partial<ColumnData[]> = [];
@ -67,7 +69,7 @@ export function getColumnData(confusionMatrixData: ConfusionMatrix[]) {
const columns: any = [
{
id: 'actual_class',
id: ACTUAL_CLASS_ID,
display: <span />,
},
];

View file

@ -39,7 +39,7 @@ import {
ANALYSIS_CONFIG_TYPE,
} from '../../../../common/analytics';
import { LoadingPanel } from '../loading_panel';
import { getColumnData } from './column_data';
import { getColumnData, ACTUAL_CLASS_ID } from './column_data';
const defaultPanelWidth = 500;
@ -205,11 +205,13 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery })
const cellValue = columnsData[rowIndex][columnId];
// eslint-disable-next-line react-hooks/rules-of-hooks
useEffect(() => {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
if (columnId !== ACTUAL_CLASS_ID) {
setCellProps({
style: {
backgroundColor: `rgba(0, 179, 164, ${cellValue})`,
},
});
}
}, [rowIndex, columnId, setCellProps]);
return (
<span>{typeof cellValue === 'number' ? `${Math.round(cellValue * 100)}%` : cellValue}</span>