Skip to content

Commit 4776d79

Browse files
author
lflangis
committed
fix(uploads): SJIP-1091 display raw input for unmatch list
1 parent c26dc49 commit 4776d79

File tree

4 files changed

+40
-25
lines changed

4 files changed

+40
-25
lines changed

packages/ui/Release.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### 10.14.1 2024-11-14
2+
- fix: SJIP-1091 display raw input for upload ids
3+
14
### 10.14.0 2024-11-14
25
- feat: SJIP-1090 Add text transform mode to uploads modal. Update antd to 4.24.16
36

packages/ui/package-lock.json

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

packages/ui/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ferlab/ui",
3-
"version": "10.14.0",
3+
"version": "10.14.1",
44
"description": "Core components for scientific research data portals",
55
"publishConfig": {
66
"access": "public"
@@ -117,7 +117,7 @@
117117
"md5": "^2.3.0",
118118
"npm": "^10.8.2",
119119
"query-string": "^7.0.1",
120-
"react-grid-layout": "^1.4.4",
120+
"react-grid-layout": "^1.5.0",
121121
"react-highlight-words": "^0.18.0",
122122
"react-icons": "^4.2.0",
123123
"react-sizeme": "^3.0.2",

packages/ui/src/components/UploadIds/UploadModal/index.tsx

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,28 +62,38 @@ const UploadModal = ({
6262
const [unmatch, setUnmatch] = useState<UnmatchTableItem[] | undefined>(undefined);
6363
const debouncedValue = useDebounce(value, 500);
6464

65-
const getRawValueList = () => {
66-
let result = value.split(/[\n,\r ]/).filter((val) => !!val);
65+
const getRawValueList = () => value.split(/[\n,\r ]/).filter((val) => !!val);
66+
const getValueList = () =>
67+
uniq(
68+
getRawValueList().map((val) => {
69+
if (textTransformMode === TextTransformMode.LOWER) {
70+
return val.toLowerCase();
71+
} else if (textTransformMode === TextTransformMode.UPPER) {
72+
return val.toUpperCase();
73+
}
74+
return val;
75+
}),
76+
);
6777

68-
if (textTransformMode === TextTransformMode.LOWER) {
69-
result = result.map((val) => val.toLowerCase());
70-
} else if (textTransformMode === TextTransformMode.UPPER) {
71-
result = result.map((val) => val.toUpperCase());
72-
}
73-
74-
return result;
75-
};
76-
const getValueList = () => uniq(getRawValueList());
77-
78-
const getUnmatchList = (results: MatchTableItem[]) =>
79-
difference(
78+
const getUnmatchList = (results: MatchTableItem[]) => {
79+
const rawList = getRawValueList();
80+
const unmatchs = difference(
8081
getValueList(),
8182
results.map((item) => item.submittedId),
8283
).map((id, index) => ({
8384
key: index,
8485
submittedId: id,
8586
}));
8687

88+
return unmatchs.map((unmatch) => {
89+
const submittedId = rawList.find((val) => val.toLowerCase() === unmatch.submittedId.toLowerCase());
90+
return {
91+
key: unmatch.key,
92+
submittedId: submittedId ?? unmatch.submittedId,
93+
};
94+
});
95+
};
96+
8797
const getMatchToCount = (match: MatchTableItem[]) =>
8898
without(
8999
uniqBy(match, ({ matchTo }) => matchTo).map(({ matchTo }) => matchTo),
@@ -103,6 +113,8 @@ const UploadModal = ({
103113
setIsLoading(true);
104114
const results = await fetchMatch(getValueList());
105115
setMatch(results);
116+
117+
// use raw list
106118
setUnmatch(getUnmatchList(results));
107119
setIsLoading(false);
108120
})();

0 commit comments

Comments
 (0)