Skip to content

Commit 3b2cc16

Browse files
authored
include plasmid name in Assembler (#530)
1 parent 157b29e commit 3b2cc16

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/assembler/Assembler.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ function AssemblerLink({ overhang }) {
3232
)
3333
}
3434

35+
function formatItemName(item) {
36+
if (item.plasmid_name && item.id !== item.plasmid_name) {
37+
return `${item.id} (${item.plasmid_name})`
38+
}
39+
return item.id
40+
}
41+
3542
function AssemblerComponent({ data, categories }) {
3643

3744
const [assembly, setAssembly] = React.useState([{ category: '', id: [] }])
@@ -152,6 +159,7 @@ function AssemblerComponent({ data, categories }) {
152159
onChange={(e, value) => setId(value, index)}
153160
label="ID"
154161
options={data.filter((d) => allowedCategories.includes(d.category)).map((item) => item.id)}
162+
getOptionLabel={(id) => formatItemName(data.find((d) => d.id === id))}
155163
renderInput={(params) => <TextField {...params} label="ID" />}
156164
/>
157165
</FormControl>
@@ -204,7 +212,7 @@ function AssemblerComponent({ data, categories }) {
204212
</TableCell>
205213
{parts.map((part, colIndex) => (
206214
<TableCell key={colIndex}>
207-
{part}
215+
{formatItemName(data.find((d) => d.id === part))}
208216
</TableCell>
209217
))}
210218

0 commit comments

Comments
 (0)