Skip to content

Commit 470d5bb

Browse files
authored
Revert "fix: added add metadata row feature in study annotations (#1197)"
This reverts commit d9bc608.
1 parent d9bc608 commit 470d5bb

26 files changed

+349
-459
lines changed

compose/neurosynth-frontend/cypress/fixtures/ImportSleuth/neurosynthResponses/annotationsSingleSleuthStudyResponse.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,10 @@
2525
"source_id": null,
2626
"source_updated_at": null,
2727
"note_keys": {
28-
"included": {
29-
"type": "boolean",
30-
"order": 0
31-
},
32-
"test1_new_txt": {
33-
"type": "boolean",
34-
"order": 1
35-
}
28+
"included": "boolean",
29+
"test1_new_txt": "boolean"
3630
},
3731
"metadata": null,
3832
"name": "Annotation for Untitled sleuth project",
3933
"description": ""
40-
}
34+
}

compose/neurosynth-frontend/cypress/fixtures/IngestionFixtures/annotationsFixture.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"source_id": null,
1111
"source_updated_at": null,
1212
"note_keys": {
13-
"included": {
14-
"type": "boolean",
15-
"order": 0
16-
}
13+
"included": "boolean"
1714
},
1815
"metadata": null,
1916
"name": "Annotation for studyset hQFjozWL9v8Q",

compose/neurosynth-frontend/cypress/fixtures/IngestionFixtures/annotationsPutFixture.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,7 @@
1010
"source_id": null,
1111
"source_updated_at": null,
1212
"note_keys": {
13-
"included": {
14-
"type": "boolean",
15-
"order": 0
16-
}
13+
"included": "boolean"
1714
},
1815
"metadata": null,
1916
"name": "Annotation for studyset hQFjozWL9v8Q",

compose/neurosynth-frontend/cypress/fixtures/annotation.json

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,8 @@
55
"metadata": null,
66
"name": "Annotation for studyset 73HRs8HaJbR8",
77
"note_keys": {
8-
"included": {
9-
"type": "boolean",
10-
"order": 0
11-
},
12-
"string_key": {
13-
"type": "string",
14-
"order": 1
15-
}
8+
"included": "boolean",
9+
"string_key": "string"
1610
},
1711
"notes": [
1812
{
@@ -50,4 +44,4 @@
5044
"user": "github|26612023",
5145
"username": "Nicholas Lee"
5246
}
53-
47+

compose/neurosynth-frontend/package-lock.json

Lines changed: 51 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compose/neurosynth-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@
102102
"prettier": "^3.3.3",
103103
"react-error-overlay": "^6.0.9",
104104
"ts-node": "^10.9.2",
105-
"typescript": "^5.9.3",
105+
"typescript": "^4.9.5",
106106
"typescript-eslint": "^8.13.0",
107107
"vite-tsconfig-paths": "^5.1.4",
108108
"vitest": "^3.0.7"

compose/neurosynth-frontend/src/components/HotTables/HotTables.types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { EPropertyType } from 'components/EditMetadata/EditMetadata.types';
33
export interface NoteKeyType {
44
key: string;
55
type: EPropertyType;
6-
order: number;
76
}
87

98
export type AnnotationNoteValue = string | number | boolean | null;

compose/neurosynth-frontend/src/components/HotTables/HotTables.utils.spec.ts

Lines changed: 0 additions & 45 deletions
This file was deleted.

compose/neurosynth-frontend/src/components/HotTables/HotTables.utils.tsx

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,19 @@ import { CellValue } from 'handsontable/common';
44

55
export const noteKeyObjToArr = (noteKeys?: object | null): NoteKeyType[] => {
66
if (!noteKeys) return [];
7-
const noteKeyTypes = noteKeys as { [key: string]: { type: EPropertyType; order?: number } };
8-
const arr = Object.entries(noteKeyTypes)
9-
.map(([key, descriptor]) => {
10-
if (!descriptor?.type) throw new Error('Invalid note_keys descriptor: missing type');
11-
return {
12-
// rely on new descriptor shape (type + order)
13-
type: descriptor.type,
14-
key,
15-
order: descriptor.order ?? 0,
16-
};
17-
})
18-
.sort((a, b) => a.order - b.order || a.key.localeCompare(b.key))
19-
.map((noteKey, index) => ({ ...noteKey, order: index }));
7+
const noteKeyTypes = noteKeys as { [key: string]: EPropertyType };
8+
const arr = Object.entries(noteKeyTypes).map(([key, type]) => ({
9+
key,
10+
type,
11+
}));
2012
return arr;
2113
};
2214

23-
export const noteKeyArrToObj = (
24-
noteKeyArr: NoteKeyType[]
25-
): { [key: string]: { type: EPropertyType; order: number } } => {
26-
const noteKeyObj = noteKeyArr.reduce((acc, curr, index) => {
27-
acc[curr.key] = {
28-
type: curr.type,
29-
order: curr.order ?? index,
30-
};
15+
export const noteKeyArrToObj = (noteKeyArr: NoteKeyType[]): { [key: string]: EPropertyType } => {
16+
const noteKeyObj: { [key: string]: EPropertyType } = noteKeyArr.reduce((acc, curr) => {
17+
acc[curr.key] = curr.type;
3118
return acc;
32-
}, {} as { [key: string]: { type: EPropertyType; order: number } });
19+
}, {} as { [key: string]: EPropertyType });
3320

3421
return noteKeyObj;
3522
};

compose/neurosynth-frontend/src/pages/Annotations/components/EditAnnotationsHotTable.helpers.tsx

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ export const annotationNotesToHotData = (
119119
};
120120
};
121121

122-
export const createColumnHeader = (colKey: string, colType: EPropertyType, allowRemoveColumn: boolean) => {
122+
export const createColumnHeader = (
123+
colKey: string,
124+
colType: EPropertyType,
125+
allowRemoveColumn: boolean
126+
) => {
123127
const allowRemove = allowRemoveColumn
124128
? `<div style="width: 50px; display: flex; align-items: center; justify-content: center">
125129
${renderToString(
@@ -137,7 +141,7 @@ export const createColumnHeader = (colKey: string, colType: EPropertyType, allow
137141

138142
return (
139143
`<div title="${colKey}" style="display: flex; align-items: center; justify-content: center;">` +
140-
`<div class="${styles[colType]} ${styles.truncate}" style="width: 100px">${colKey}</div>` +
144+
`<div class="${styles[colType]} ${styles.truncate}" style="width: 150px">${colKey}</div>` +
141145
allowRemove +
142146
`</div>`
143147
);
@@ -164,15 +168,17 @@ export const createColumns = (noteKeys: NoteKeyType[], disable?: boolean) =>
164168
x.type === EPropertyType.NUMBER
165169
? numericValidator
166170
: x.type === EPropertyType.BOOLEAN
167-
? booleanValidator
168-
: undefined,
171+
? booleanValidator
172+
: undefined,
169173
} as ColumnSettings;
170174
}),
171175
] as ColumnSettings[];
172176

173177
// we can assume that the hashmap maintains order and is sorted by key
174178
// this function gets all merge cells and only merge cells. If a cell does not need to be merged, a mergeCellObj is not creatd
175-
export const getMergeCells = (hotDataToStudyMapping: Map<number, { studyId: string; analysisId: string }>) => {
179+
export const getMergeCells = (
180+
hotDataToStudyMapping: Map<number, { studyId: string; analysisId: string }>
181+
) => {
176182
const mergeCells: MergeCellsSettings[] = [];
177183

178184
let studyId: string;

0 commit comments

Comments
 (0)