Skip to content

Commit

Permalink
vitest issues are persisting.
Browse files Browse the repository at this point in the history
  • Loading branch information
siddheshraze committed Sep 3, 2024
1 parent a3254ff commit c2ea0cf
Show file tree
Hide file tree
Showing 3 changed files with 186 additions and 52 deletions.
101 changes: 49 additions & 52 deletions frontend/components/datagrids/measurementscommons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -672,56 +672,6 @@ export default function MeasurementsCommons(props: Readonly<MeasurementsCommonsP
});
};

const modifiedColumns = gridColumns.map(column => {
if (column.field !== 'measurementDate') {
return column;
}
Object.keys(validationErrors).forEach(validationError => {
console.log('validationerror: ', validationError);
});
return column;
// return {
// ...column,
// renderCell: (params: GridCellParams) => {
// const cellValue = params.value !== undefined ? params.value?.toString() : '';
// console.log('cellValue', cellValue);
// const cellError = cellHasError(column.field, params.id) ? getCellErrorMessages(column.field, params.id) : '';
// console.log('cellERror', cellError);
// return (
// <Box
// sx={{
// display: 'flex',
// flex: 1,
// flexDirection: 'column',
// marginY: 1.5
// }}
// >
// {cellError ? (
// <>
// <Typography sx={{ whiteSpace: 'normal', lineHeight: 'normal' }}>{cellValue}</Typography>
// <Typography
// color={'danger'}
// variant={'solid'}
// sx={{
// color: 'error.main',
// fontSize: '0.75rem',
// mt: 1,
// whiteSpace: 'normal',
// lineHeight: 'normal'
// }}
// >
// {cellError}
// </Typography>
// </>
// ) : (
// <Typography sx={{ whiteSpace: 'normal', lineHeight: 'normal' }}>{cellValue}</Typography>
// )}
// </Box>
// );
// }
// };
});

// custom column formatting:
const validationStatusColumn: GridColDef = {
field: 'isValidated',
Expand Down Expand Up @@ -782,12 +732,59 @@ export default function MeasurementsCommons(props: Readonly<MeasurementsCommonsP
}
};
const columns = useMemo(() => {
const commonColumns = modifiedColumns;
console.log('test: ');
const commonColumns = gridColumns.map(column => {
Object.keys(validationErrors).forEach(validationError => {
console.log('validationerror: ', validationError);
});
return column;
// return {
// ...column,
// renderCell: (params: GridCellParams) => {
// const cellValue = params.value !== undefined ? params.value?.toString() : '';
// console.log('cellValue', cellValue);
// const cellError = cellHasError(column.field, params.id) ? getCellErrorMessages(column.field, params.id) : '';
// console.log('cellERror', cellError);
// return (
// <Box
// sx={{
// display: 'flex',
// flex: 1,
// flexDirection: 'column',
// marginY: 1.5
// }}
// >
// {cellError ? (
// <>
// <Typography sx={{ whiteSpace: 'normal', lineHeight: 'normal' }}>{cellValue}</Typography>
// <Typography
// color={'danger'}
// variant={'solid'}
// sx={{
// color: 'error.main',
// fontSize: '0.75rem',
// mt: 1,
// whiteSpace: 'normal',
// lineHeight: 'normal'
// }}
// >
// {cellError}
// </Typography>
// </>
// ) : (
// <Typography sx={{ whiteSpace: 'normal', lineHeight: 'normal' }}>{cellValue}</Typography>
// )}
// </Box>
// );
// }
// };
});
console.log('common columns', commonColumns);
if (locked) {
return [validationStatusColumn, measurementDateColumn, ...commonColumns];
}
return [validationStatusColumn, measurementDateColumn, ...commonColumns, getGridActionsColumn()];
}, [modifiedColumns, locked]);
}, [gridColumns, locked]);

const filteredColumns = useMemo(() => filterColumns(rows, columns), [rows, columns]);

Expand Down
136 changes: 136 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
"@next/bundle-analyzer": "^14.2.6",
"@playwright/test": "^1.46.1",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@types/codemirror": "^5.60.15",
"@types/crypto-js": "^4.2.2",
"@types/file-saver": "^2.0.7",
Expand Down

0 comments on commit c2ea0cf

Please sign in to comment.