Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit e8e1081

Browse files
committedMar 4, 2025·
feat(ui): upload dataset from csv
1 parent 4bab296 commit e8e1081

11 files changed

+1052
-107
lines changed
 

‎weave-js/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"@testing-library/jest-dom": "6.4.5",
6464
"@testing-library/react": "11.2.3",
6565
"@testing-library/user-event": "14.4.3",
66+
"@types/papaparse": "^5.3.15",
6667
"@types/query-string": "^6.3.0",
6768
"@types/react-hook-mousetrap": "^2.0.2",
6869
"@types/react-syntax-highlighter": "^15.5.7",
@@ -97,6 +98,7 @@
9798
"numeral": "^2.0.6",
9899
"onchange": "^7.1.0",
99100
"pako": "^2.1.0",
101+
"papaparse": "^5.5.2",
100102
"pca-js": "^1.0.2",
101103
"plotly.js": "^2.23.2",
102104
"plotly.js-dist-min": "^2.6.3",

‎weave-js/src/components/PagePanelComponents/Home/Browse3/datasets/AddToDatasetDrawer.tsx

-4
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,9 @@ export const AddToDatasetDrawerInner: React.FC<AddToDatasetDrawerProps> = ({
8585
const objCreate = useObjCreate();
8686
const tableCreate = useTableCreate();
8787

88-
// Access edit context methods through the drawer context's editorContext property
8988
const {getRowsNoMeta, convertEditsToTableUpdateSpec, resetEditState} =
9089
editorContext;
9190

92-
// Fetch datasets on component mount
9391
const objectVersions = useRootObjectVersions(
9492
entity,
9593
project,
@@ -100,7 +98,6 @@ export const AddToDatasetDrawerInner: React.FC<AddToDatasetDrawerProps> = ({
10098
true
10199
);
102100

103-
// Update datasets when data is loaded
104101
useEffect(() => {
105102
if (objectVersions.result) {
106103
dispatch({
@@ -110,7 +107,6 @@ export const AddToDatasetDrawerInner: React.FC<AddToDatasetDrawerProps> = ({
110107
}
111108
}, [objectVersions.result, dispatch]);
112109

113-
// Extract source schema from selected calls
114110
useEffect(() => {
115111
if (selectedCalls.length > 0) {
116112
const extractedSchema = extractSourceSchema(selectedCalls);

‎weave-js/src/components/PagePanelComponents/Home/Browse3/datasets/CellRenderers.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ interface CellViewingRendererProps {
4444
isNew?: boolean;
4545
isEditing?: boolean;
4646
serverValue?: any;
47+
disableNewRowHighlight?: boolean;
4748
}
4849

4950
export const CellViewingRenderer: React.FC<
@@ -58,6 +59,7 @@ export const CellViewingRenderer: React.FC<
5859
id,
5960
field,
6061
serverValue,
62+
disableNewRowHighlight = false,
6163
}) => {
6264
const [isHovered, setIsHovered] = useState(false);
6365
const {setEditedRows, setAddedRows} = useDatasetEditContext();
@@ -94,7 +96,7 @@ export const CellViewingRenderer: React.FC<
9496
if (isEdited) {
9597
return CELL_COLORS.EDITED;
9698
}
97-
if (isNew) {
99+
if (isNew && !disableNewRowHighlight) {
98100
return CELL_COLORS.NEW;
99101
}
100102
return CELL_COLORS.TRANSPARENT;
@@ -597,6 +599,7 @@ export interface ControlCellProps {
597599
isDeleted: boolean;
598600
isNew: boolean;
599601
hideRemoveForAddedRows?: boolean;
602+
disableNewRowHighlight?: boolean;
600603
}
601604

602605
export const ControlCell: React.FC<ControlCellProps> = ({
@@ -607,6 +610,7 @@ export const ControlCell: React.FC<ControlCellProps> = ({
607610
isDeleted,
608611
isNew,
609612
hideRemoveForAddedRows,
613+
disableNewRowHighlight = false,
610614
}) => {
611615
const rowId = params.id as string;
612616
const rowIndex = params.row.___weave?.index;
@@ -621,7 +625,9 @@ export const ControlCell: React.FC<ControlCellProps> = ({
621625
justifyContent: 'center',
622626
height: '100%',
623627
width: '100%',
624-
backgroundColor: CELL_COLORS.NEW,
628+
backgroundColor: disableNewRowHighlight
629+
? CELL_COLORS.TRANSPARENT
630+
: CELL_COLORS.NEW,
625631
}}
626632
/>
627633
);
@@ -637,7 +643,7 @@ export const ControlCell: React.FC<ControlCellProps> = ({
637643
width: '100%',
638644
backgroundColor: isDeleted
639645
? CELL_COLORS.DELETED
640-
: isNew
646+
: isNew && !disableNewRowHighlight
641647
? CELL_COLORS.NEW
642648
: CELL_COLORS.TRANSPARENT,
643649
opacity: isDeleted ? DELETED_CELL_STYLES.opacity : 1,

0 commit comments

Comments
 (0)
Please sign in to comment.