Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1834091
Increase map render threshold (#32)
howardwkim Apr 29, 2025
cdd8941
Feature/dataset download improvements (#35)
howardwkim May 1, 2025
f096088
Merge release/1.21.4
May 6, 2025
00e66f9
Format Entire Codebase and Ignore in Git Blame (#40)
howardwkim May 6, 2025
2a80523
add howard (#44)
howardwkim May 7, 2025
b5fba71
add ignore revs
May 7, 2025
2809a54
Feature/chore cleanup logs (#45)
howardwkim May 7, 2025
95493c0
bump
May 7, 2025
43f69b7
Release/1.21.4 EBS: 06-04-21-340 redo (#38)
howardwkim May 6, 2025
0653e75
Merge branch 'main' into release/1.21.5
howardwkim May 7, 2025
d728aff
Merge branch 'release/1.21.5' into dev
May 7, 2025
9e7e881
Sentry (#52)
howardwkim May 15, 2025
df9013d
Merge remote-tracking branch 'origin/main' into dev
May 15, 2025
61f4d95
Merge remote-tracking branch 'origin/main' into dev
May 16, 2025
c1b75b8
fix missing chart video
May 19, 2025
a034793
set to true (#66)
howardwkim May 20, 2025
7c65896
Enable dataset recommendationss (#68)
howardwkim May 20, 2025
6281162
Feature/long text scrollable (#69)
howardwkim May 21, 2025
3571064
Fix alignment (#70)
howardwkim May 21, 2025
5c70782
Merge branch 'main' into dev
May 21, 2025
acce958
Feature/catalog card refactor (#74)
howardwkim May 27, 2025
f4073d4
Feature/programs c comp (#75)
howardwkim May 28, 2025
3fade8a
Merge branch 'main' into dev
May 28, 2025
78f6bb4
Feature/datetime validation bug (#80)
howardwkim May 30, 2025
8062f0f
Feature/multiple timezones (#82)
howardwkim Jun 3, 2025
ba13a7e
Feature/time validation changes (#84)
howardwkim Jun 3, 2025
edc7e75
Feature/date change UI improvements (#85)
howardwkim Jun 4, 2025
8d112cd
bump
Jun 5, 2025
ced5f03
Update .gitignore to include .sentryclirc file
Jun 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ node_modules

# testing
/coverage
*xlsx

# production
src/buildInfo.json
Expand All @@ -29,4 +30,5 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

notes
notes
.sentryclirc
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cmap_react",
"version": "1.21.8",
"version": "1.21.9",
"private": true,
"scripts": {
"start": "export REACT_APP_ENABLE_SENTRY=false && npm run pre-build && react-scripts --max_old_space_size=4096 start",
Expand Down
155 changes: 155 additions & 0 deletions src/Components/DataSubmission/ChangeTable.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
import React from 'react';
import {
Typography,
Paper,
Link,
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import { getChangeSummary } from './Helpers/changeLog';
import TimeChangesTable from './Helpers/WorkbookAudits/TimeChangesTable';
import { groupTimeChangesByConversionType } from './Helpers/formatDataSheet';

const useStyles = makeStyles((theme) => ({
changeSummaryHeader: {
fontSize: '1.1em',
fontWeight: 'bold',
textDecoration: 'underline',
textDecorationColor: theme.palette.secondary.main,
},
tableRoot: {
'& .MuiTableCell-stickyHeader': {
backgroundColor: 'rgb(5, 27, 54)',
},
},
changeTableContainer: {
maxHeight: 440,
},
submittedTypography: {
marginBottom: '12px',
},
needHelpLink: {
letterSpacing: 'normal',
color: theme.palette.primary.main,
cursor: 'pointer',
},
sectionHeader: {
fontSize: '1em',
fontWeight: 'bold',
marginTop: '16px',
marginBottom: '8px',
},
}));

const ChangeRow = (props) => {
const { data } = props;
const { sheet, row, col, original, current } = data;
return (
<TableRow>
<TableCell>{sheet}</TableCell>
<TableCell>{row}</TableCell>
<TableCell>{col}</TableCell>
<TableCell>{original}</TableCell>
<TableCell>{current}</TableCell>
</TableRow>
);
};

const ChangeTable = (props) => {
const cl = useStyles();
const { getChangeLog, handleDownloadWorkbook, dataChanges } = props;
const changeLog = getChangeLog();

const hasUserChanges =
changeLog && Array.isArray(changeLog) && changeLog.length > 0;
const hasAutoChanges =
dataChanges && Array.isArray(dataChanges) && dataChanges.length > 0;

if (!hasUserChanges && !hasAutoChanges) {
return (
<div>
<Typography className={cl.changeSummaryHeader}>
Change Summary
</Typography>
<Typography className={cl.submittedTypography}>
No changes to the uploaded submission file were made in the validation
process.
</Typography>
</div>
);
}

const userChangeSummary = hasUserChanges ? getChangeSummary(changeLog) : [];

// Process automatic changes using the shared utility
const processedAutoChanges = hasAutoChanges
? groupTimeChangesByConversionType(dataChanges)
: [];

return (
<div>
<Typography className={cl.changeSummaryHeader}>Change Summary</Typography>
<Typography className={cl.submittedTypography}>
The changes made to the uploaded file during the validation process are
listed below. You can download the edited workbook by clicking{' '}
<Link
style={{ display: 'inline-block' }}
className={cl.needHelpLink}
onClick={handleDownloadWorkbook}
component="span"
>
here
</Link>
.
</Typography>

{hasAutoChanges && (
<>
<Typography className={cl.sectionHeader}>
Automatic Time Format Changes
</Typography>
<TimeChangesTable
summary={`${dataChanges.length} rows had time format conversions applied during initial file processing.`}
note="Showing one example of each conversion type:"
changes={processedAutoChanges}
/>
</>
)}

{hasUserChanges && (
<>
<Typography className={cl.sectionHeader}>Manual Changes</Typography>
<TableContainer component={Paper} className={cl.changeTableContainer}>
<Table
aria-label="user changes table"
stickyHeader
className={cl.tableRoot}
>
<TableHead>
<TableRow>
<TableCell>Sheet</TableCell>
<TableCell>Row</TableCell>
<TableCell>Column</TableCell>
<TableCell>Original Value</TableCell>
<TableCell>Changed Value</TableCell>
</TableRow>
</TableHead>
<TableBody>
{userChangeSummary.map((change, i) => (
<ChangeRow data={change} key={`user_change_row_${i}`} />
))}
</TableBody>
</Table>
</TableContainer>
</>
)}
</div>
);
};

export default ChangeTable;
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
import React from 'react';
import {
Table,
TableBody,
TableCell,
TableContainer,
TableHead,
TableRow,
Typography,
Paper,
} from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import renderText from '../../../Home/News/renderText';

const useStyles = makeStyles((theme) => ({
container: {
marginTop: theme.spacing(2),
maxHeight: '400px',
backgroundColor: 'rgba(16, 43, 60, 0.6)',
backdropFilter: 'blur(20px)',
},
table: {
'& th': {
fontWeight: 'bold',
backgroundColor: 'rgba(30, 67, 113, 1)',
color: theme.palette.common.white,
},
'& td': {
borderBottomColor: 'rgba(255, 255, 255, 0.1)',
},
},
description: {
marginBottom: theme.spacing(1),
},
note: {
marginBottom: theme.spacing(2),
fontStyle: 'italic',
},
row: {
'&:nth-of-type(odd)': {
backgroundColor: 'rgba(30, 67, 113, 0.2)',
},
},
cellBefore: {
color: theme.palette.error.light,
fontFamily: 'monospace',
},
cellAfter: {
color: theme.palette.success.light,
fontFamily: 'monospace',
},
noChanges: {
marginTop: theme.spacing(2),
color: theme.palette.text.secondary,
fontStyle: 'italic',
},
}));
const descriptions = {
EXCEL_TO_UTC:
'Excel numeric date format does not include timezone information, assumed to be UTC',
STRING_NO_TZ_TO_UTC:
'String time without timezone information assumed to be UTC',
STRING_NON_UTC_TO_UTC:
'String time with non-UTC timezone was converted to UTC',
};

const TimeChangesTable = (props) => {
const { summary, note, changes } = props;
const classes = useStyles();

if (!changes || changes.length === 0) {
return (
<div>
<Typography className={classes.description}>
{renderText(summary)}
</Typography>
<Typography className={classes.noChanges}>
No actual changes were made to time values
</Typography>
</div>
);
}

return (
<div>
<Typography className={classes.description}>
{renderText(summary)}
</Typography>
{note && (
<Typography className={classes.note}>{renderText(note)}</Typography>
)}

<TableContainer component={Paper} className={classes.container}>
<Table stickyHeader className={classes.table} size="small">
<TableHead>
<TableRow>
<TableCell>Row</TableCell>
<TableCell>Original Value</TableCell>
<TableCell>Converted Value</TableCell>
<TableCell>Conversion Type</TableCell>
</TableRow>
</TableHead>
<TableBody>
{changes.map((row) => (
<TableRow key={row.row} className={classes.row}>
<TableCell>{row.row}</TableCell>
<TableCell className={classes.cellBefore}>
{row.prevValue}
</TableCell>
<TableCell className={classes.cellAfter}>
{row.newValue}
</TableCell>
<TableCell>{descriptions[row.conversionType]}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
</div>
);
};

export default TimeChangesTable;
2 changes: 2 additions & 0 deletions src/Components/DataSubmission/Helpers/WorkbookAudits/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import multiCruiseFormat from './multipleCruisesFormat';
import extraColumns from './extraColumns';
import checkDuplicateVarNames from './checkDuplicateVarNames';
import missingCruise from './missingCruise';
import timeColumnChanges from './timeColumnChanges';

import { formatEvent } from '../../../../Utility/debugTimer';

Expand All @@ -41,6 +42,7 @@ const audits = [
extraColumns,
checkDuplicateVarNames,
missingCruise,
timeColumnChanges,
];

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import auditFactory, {
requireDataAndVars,
makeIssueWithCustomComponent,
} from './auditFactory';
import severity from './severity';
import TimeChangesTable from './TimeChangesTable';
import { groupTimeChangesByConversionType } from '../formatDataSheet';

const AUDIT_NAME = 'Time Column Changes';
const DESCRIPTION = 'Report changes made to the time column';

// :: args -> [result]
const check = (standardAuditArgs) => {
const { dataChanges } = standardAuditArgs;
const results = [];

if (!dataChanges || dataChanges.length === 0) {
return results;
}

// Process the changes using the shared utility
const exampleChanges = groupTimeChangesByConversionType(dataChanges);

// Use the custom table component to display the changes
results.push(
makeIssueWithCustomComponent(
severity.confirmation,
'Time Column Changes',
TimeChangesTable,
{
summary: `${dataChanges.length} rows had time format conversions applied.`,
note: 'Showing one example of each conversion type:',
changes: exampleChanges,
},
),
);

return results;
};

const auditFn = requireDataAndVars(AUDIT_NAME, check);

const audit = auditFactory(AUDIT_NAME, DESCRIPTION, auditFn);

export default audit;
Loading