Skip to content

Commit 45654ac

Browse files
authored
Merge pull request #110 from defineEditor/dev
Version 0.6.5
2 parents bf51020 + 53c4e27 commit 45654ac

File tree

28 files changed

+1307
-232
lines changed

28 files changed

+1307
-232
lines changed

.github/workflows/build-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151

5252
- name: Package macOS build (${{ matrix.arch }})
5353
run: |
54-
npx electron-builder build --mac --${{ matrix.arch }} --publish never
54+
npx electron-builder build --mac --${{ matrix.arch }} --publish never -c.mac.identity=null
5555
env:
5656
npm_config_arch: ${{ matrix.arch }}
5757

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@
225225
]
226226
},
227227
"type": "distribution",
228+
"identity": null,
228229
"hardenedRuntime": true,
229230
"entitlements": "assets/entitlements.mac.plist",
230231
"entitlementsInherit": "assets/entitlements.mac.plist",

release/app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vde-dataset-viewer",
3-
"version": "0.6.4",
3+
"version": "0.6.5",
44
"description": "VDE Dataset Viewer",
55
"license": "MIT",
66
"author": {

src/interfaces/main.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,8 @@ export interface CompareSettings {
7272
maxColumnDiffCount: number;
7373
ignorePattern: string;
7474
ignoreColumnCase: boolean;
75+
ignoreWhiteSpaces: boolean;
76+
ignoreValueCase: boolean;
7577
reorderCompareColumns: boolean;
7678
}
7779

@@ -135,6 +137,7 @@ export interface DatasetDiff {
135137
metadata: MetadataDiff;
136138
data: DataDiff;
137139
summary: DiffSummary;
140+
settings: CompareSettings;
138141
pageMaps: {
139142
base: number[];
140143
comp: number[];
@@ -356,3 +359,11 @@ export interface NewWindowProps {
356359
path2: string;
357360
};
358361
}
362+
363+
export type DeepPartial<T> = {
364+
[P in keyof T]?: T[P] extends Array<infer U>
365+
? Array<DeepPartial<U>>
366+
: T[P] extends object
367+
? DeepPartial<T[P]>
368+
: T[P];
369+
};

src/interfaces/store.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ export interface IUiModalVariableInfo extends IUiModalBase {
104104
export interface IUiModalFilter extends IUiModalBase {
105105
type: typeof modals.FILTER;
106106
filterType: 'dataset' | 'report' | 'compare';
107+
data: {
108+
defaultFilter?: BasicFilter;
109+
};
107110
}
108111

109112
export type IUiModal =
@@ -197,6 +200,7 @@ export interface IUiCompare {
197200
startCompare: boolean;
198201
fileBase: string | null;
199202
fileComp: string | null;
203+
customSettings: Partial<CompareSettings>;
200204
view: 'horizontal' | 'vertical';
201205
resultTab: 'summary' | 'metadata' | 'data';
202206
showAllDifferences: boolean;

src/main/managers/fileManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,13 @@ class FileManager {
5050
) {
5151
return (
5252
file.filePath === pathToFile &&
53-
fileId.startsWith(fileIdPrefix || '')
53+
(!fileIdPrefix || fileId.startsWith(fileIdPrefix))
5454
);
5555
}
5656
if (file instanceof DatasetXpt) {
5757
return (
5858
file.pathToFile === pathToFile &&
59-
fileId.startsWith(fileIdPrefix || '')
59+
(!fileIdPrefix || fileId.startsWith(fileIdPrefix))
6060
);
6161
}
6262
return false;

src/main/workers/compareWorker.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ const compareMetadata = (
324324
return metadataDiff;
325325
};
326326

327-
const compareData = (
327+
export const compareData = (
328328
base: ItemDataArray[],
329329
compare: ItemDataArray[],
330330
baseMeta: DatasetMetadata,
@@ -340,6 +340,8 @@ const compareData = (
340340
maxDiffCount,
341341
maxColumnDiffCount,
342342
ignoreColumnCase,
343+
ignoreWhiteSpaces,
344+
ignoreValueCase,
343345
ignorePattern,
344346
} = options;
345347

@@ -414,9 +416,22 @@ const compareData = (
414416
const isNumeric = ['integer', 'float', 'double', 'decimal'].includes(
415417
type,
416418
);
419+
// TODO - I think we don't need to check typeof here, as it is either null or number
417420
if (isNumeric && typeof val1 === 'number' && typeof val2 === 'number') {
418421
return Math.abs(val1 - val2) <= tolerance;
419422
}
423+
if (typeof val1 === 'string' && typeof val2 === 'string') {
424+
if (ignoreValueCase && ignoreWhiteSpaces) {
425+
return val1.trim().toLowerCase() === val2.trim().toLowerCase();
426+
}
427+
if (ignoreValueCase) {
428+
return val1.toLowerCase() === val2.toLowerCase();
429+
}
430+
if (ignoreWhiteSpaces) {
431+
return val1.trim() === val2.trim();
432+
}
433+
return val1 === val2;
434+
}
420435
return val1 === val2;
421436
};
422437

@@ -493,6 +508,22 @@ const compareData = (
493508
hasDiff = true;
494509
dataDiff.modifiedRows.push(diff);
495510
}
511+
} else if (i >= base.length) {
512+
// Added row
513+
hasDiff = true;
514+
const diff: DataDiffRow = {
515+
rowBase: null,
516+
rowCompare: i + rowShiftCompare,
517+
};
518+
dataDiff.addedRows.push(diff);
519+
} else if (i >= compare.length) {
520+
// Deleted row
521+
hasDiff = true;
522+
const diff: DataDiffRow = {
523+
rowBase: i + rowShiftBase,
524+
rowCompare: null,
525+
};
526+
dataDiff.deletedRows.push(diff);
496527
}
497528
if (hasDiff) {
498529
diffCount++;
@@ -857,6 +888,7 @@ process.parentPort.once(
857888
sendMessage(100, summary.totalDiffs, {
858889
metadata: metadataDiff,
859890
data: dataDiff,
891+
settings: options,
860892
summary,
861893
pageMaps,
862894
});

src/renderer/components/Compare/Data.tsx

Lines changed: 63 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ const Data: React.FC = () => {
120120
datasetDiff !== null &&
121121
datasetDiff.data.modifiedRows.length === 0 &&
122122
datasetDiff.data.addedRows.length === 0 &&
123-
datasetDiff.data.deletedRows.length === 0;
124-
123+
datasetDiff.data.deletedRows.length === 0 &&
124+
datasetDiff.summary.baseRows === datasetDiff.summary.compareRows;
125125
const totalRowsChecked = datasetDiff?.summary.totalRowsChecked || 0;
126126

127127
const [data, setData] = useState<{
@@ -366,6 +366,66 @@ const Data: React.FC = () => {
366366
}
367367
});
368368

369+
datasetDiff?.data.addedRows.forEach((addedRow) => {
370+
const { rowCompare, rowBase } = addedRow;
371+
if (rowBase !== null) {
372+
baseMap.set(`${rowBase}`, {
373+
text: 'Row missing in compare',
374+
color: '',
375+
});
376+
const baseDiffsRow = {};
377+
baseDiffsRow['whole::row'] = {
378+
baseVal: `Missing in compare`,
379+
compVal: '',
380+
diff: '',
381+
};
382+
baseDiffsMap.set(rowBase, baseDiffsRow);
383+
}
384+
if (rowCompare !== null) {
385+
compMap.set(`${rowCompare}`, {
386+
text: 'Row missing in base',
387+
color: '',
388+
});
389+
const baseDiffsRow = {};
390+
baseDiffsRow['whole::row'] = {
391+
baseVal: '',
392+
compVal: `Missing in base`,
393+
diff: '',
394+
};
395+
baseDiffsMap.set(rowCompare, baseDiffsRow);
396+
}
397+
});
398+
399+
datasetDiff?.data.deletedRows.forEach((deletedRow) => {
400+
const { rowCompare, rowBase } = deletedRow;
401+
if (rowBase !== null) {
402+
baseMap.set(`${rowBase}`, {
403+
text: 'Row missing in compare',
404+
color: '',
405+
});
406+
const baseDiffsRow = {};
407+
baseDiffsRow['whole::row'] = {
408+
baseVal: `Missing in compare`,
409+
compVal: '',
410+
diff: '',
411+
};
412+
baseDiffsMap.set(rowBase, baseDiffsRow);
413+
}
414+
if (rowCompare !== null) {
415+
compMap.set(`${rowCompare}`, {
416+
text: 'Row missing in base',
417+
color: '',
418+
});
419+
const baseDiffsRow = {};
420+
baseDiffsRow['whole::row'] = {
421+
baseVal: '',
422+
compVal: `Missing in base`,
423+
diff: '',
424+
};
425+
baseDiffsMap.set(rowCompare, baseDiffsRow);
426+
}
427+
});
428+
369429
return {
370430
baseAnnotations: baseMap,
371431
compAnnotations: compMap,
@@ -524,12 +584,7 @@ const Data: React.FC = () => {
524584
);
525585
}
526586

527-
if (
528-
datasetDiff !== null &&
529-
datasetDiff.data.modifiedRows.length === 0 &&
530-
datasetDiff.data.addedRows.length === 0 &&
531-
datasetDiff.data.deletedRows.length === 0
532-
) {
587+
if (noDataDifferences) {
533588
return (
534589
<Box sx={styles.loading}>
535590
<Typography>No differences found</Typography>

src/renderer/components/Compare/DiffNavigation.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,25 @@ const IssueNavigation: React.FC<{
8888
.slice(0, 8)
8989
.map((colId) => (
9090
<React.Fragment key={colId}>
91-
<Button
92-
variant="text"
93-
onClick={() =>
94-
onSetGoTo({
95-
row: Number(key) + 1,
96-
column: colId,
97-
cellSelection: true,
98-
})
99-
}
100-
>
101-
{colId}
102-
</Button>
91+
{colId === 'whole::row' ? (
92+
<Typography variant="body2">
93+
{value[colId].baseVal ||
94+
value[colId].compVal}
95+
</Typography>
96+
) : (
97+
<Button
98+
variant="text"
99+
onClick={() =>
100+
onSetGoTo({
101+
row: Number(key) + 1,
102+
column: colId,
103+
cellSelection: true,
104+
})
105+
}
106+
>
107+
{colId}
108+
</Button>
109+
)}
103110
</React.Fragment>
104111
))}
105112
{Object.keys(value).length > 8 && (

0 commit comments

Comments
 (0)