@opencloning/ui 1.4.4 → 1.4.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @opencloning/ui
|
|
2
2
|
|
|
3
|
+
## 1.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#627](https://github.com/manulera/OpenCloning_frontend/pull/627) [`74e5365`](https://github.com/manulera/OpenCloning_frontend/commit/74e53653a27c2dc64f19afd984981c0fb70fc747) Thanks [@manulera](https://github.com/manulera)! - Allow selecting sub-assemblies from a kit
|
|
8
|
+
|
|
9
|
+
- Updated dependencies []:
|
|
10
|
+
- @opencloning/store@1.4.5
|
|
11
|
+
- @opencloning/utils@1.4.5
|
|
12
|
+
|
|
3
13
|
## 1.4.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opencloning/ui",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"@emotion/styled": "^11.14.0",
|
|
26
26
|
"@mui/icons-material": "^5.15.17",
|
|
27
27
|
"@mui/material": "^5.15.17",
|
|
28
|
-
"@opencloning/store": "1.4.
|
|
29
|
-
"@opencloning/utils": "1.4.
|
|
28
|
+
"@opencloning/store": "1.4.5",
|
|
29
|
+
"@opencloning/utils": "1.4.5",
|
|
30
30
|
"@teselagen/bio-parsers": "^0.4.34",
|
|
31
31
|
"@teselagen/ove": "^0.8.34",
|
|
32
32
|
"@teselagen/range-utils": "^0.3.20",
|
|
@@ -21,6 +21,23 @@ const mockSyntaxes = [
|
|
|
21
21
|
name: 'Test Syntax 2',
|
|
22
22
|
description: 'Second test syntax',
|
|
23
23
|
},
|
|
24
|
+
{
|
|
25
|
+
path: 'test-syntax-3',
|
|
26
|
+
name: 'Test Syntax 3',
|
|
27
|
+
description: 'Third test syntax',
|
|
28
|
+
syntaxes: [
|
|
29
|
+
{
|
|
30
|
+
path: 'test-syntax-3-1.json',
|
|
31
|
+
name: 'Test Syntax 3-1',
|
|
32
|
+
description: 'Third test syntax 1',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
path: 'test-syntax-3-2.json',
|
|
36
|
+
name: 'Test Syntax 3-2',
|
|
37
|
+
description: 'Third test syntax 2',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
},
|
|
24
41
|
];
|
|
25
42
|
|
|
26
43
|
const mockSyntaxData = {
|
|
@@ -265,4 +282,38 @@ describe('<ExistingSyntaxDialog />', () => {
|
|
|
265
282
|
cy.get('@onSyntaxSelectSpy').should('not.have.been.called');
|
|
266
283
|
cy.get('@onCloseSpy').should('not.have.been.called');
|
|
267
284
|
});
|
|
285
|
+
|
|
286
|
+
it('works with multiple syntaxes', () => {
|
|
287
|
+
const onCloseSpy = cy.spy().as('onCloseSpy');
|
|
288
|
+
const onSyntaxSelectSpy = cy.spy().as('onSyntaxSelectSpy');
|
|
289
|
+
|
|
290
|
+
cy.intercept('GET', 'https://assets.opencloning.org/syntaxes/syntaxes/test-syntax-3/test-syntax-3-2.json', {
|
|
291
|
+
statusCode: 200,
|
|
292
|
+
body: mockSyntaxData,
|
|
293
|
+
}).as('getSyntaxData');
|
|
294
|
+
|
|
295
|
+
cy.intercept('GET', 'https://assets.opencloning.org/syntaxes/syntaxes/test-syntax-3/plasmids_test-syntax-3-2.json', {
|
|
296
|
+
statusCode: 200,
|
|
297
|
+
body: mockPlasmidsData,
|
|
298
|
+
}).as('getPlasmidsData');
|
|
299
|
+
|
|
300
|
+
cy.mount(
|
|
301
|
+
<ExistingSyntaxDialog
|
|
302
|
+
onClose={onCloseSpy}
|
|
303
|
+
onSyntaxSelect={onSyntaxSelectSpy}
|
|
304
|
+
/>,
|
|
305
|
+
);
|
|
306
|
+
|
|
307
|
+
cy.wait('@getSyntaxes');
|
|
308
|
+
cy.contains('Test Syntax 3').click();
|
|
309
|
+
cy.contains('Test Syntax 3-1').should('exist');
|
|
310
|
+
cy.contains('Test Syntax 3-2').should('exist');
|
|
311
|
+
cy.contains('Third test syntax 1').should('exist');
|
|
312
|
+
cy.contains('Third test syntax 2').should('exist');
|
|
313
|
+
cy.contains('Test Syntax 3-2').click();
|
|
314
|
+
cy.wait('@getSyntaxData');
|
|
315
|
+
cy.wait('@getPlasmidsData');
|
|
316
|
+
cy.get('@onSyntaxSelectSpy').should('have.been.calledWith', mockSyntaxData, mockPlasmidsData);
|
|
317
|
+
cy.get('@onCloseSpy').should('have.been.called');
|
|
318
|
+
});
|
|
268
319
|
});
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
|
-
import { Dialog, DialogTitle, DialogContent, List, ListItem, ListItemText, ListItemButton, Alert, Button, Box, ButtonGroup } from '@mui/material'
|
|
2
|
+
import { Dialog, DialogTitle, DialogContent, List, ListItem, ListItemText, ListItemButton, Alert, Button, Box, ButtonGroup, Accordion, AccordionSummary, AccordionDetails } from '@mui/material'
|
|
3
3
|
import getHttpClient from '@opencloning/utils/getHttpClient';
|
|
4
4
|
import RequestStatusWrapper from '../form/RequestStatusWrapper';
|
|
5
5
|
import { useConfig } from '../../providers';
|
|
6
6
|
import ServerStaticFileSelect from '../form/ServerStaticFileSelect';
|
|
7
7
|
import { readSubmittedTextFile } from '@opencloning/utils/readNwrite';
|
|
8
|
+
import { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';
|
|
8
9
|
|
|
9
10
|
const httpClient = getHttpClient();
|
|
10
11
|
const baseURL = 'https://assets.opencloning.org/syntaxes/syntaxes/';
|
|
@@ -28,6 +29,48 @@ function LocalSyntaxDialog({ onClose, onSyntaxSelect }) {
|
|
|
28
29
|
)
|
|
29
30
|
}
|
|
30
31
|
|
|
32
|
+
function SyntaxListItem({ syntax, onSyntaxClick }) {
|
|
33
|
+
if (syntax.syntaxes === undefined) {
|
|
34
|
+
const syntaxPath = syntax.path + '/syntax.json';
|
|
35
|
+
const plasmidsPath = syntax.path + '/plasmids.json';
|
|
36
|
+
return (
|
|
37
|
+
<ListItem>
|
|
38
|
+
<ListItemButton onClick={() => {onSyntaxClick(syntaxPath, plasmidsPath)}}>
|
|
39
|
+
<ListItemText primary={syntax.name} secondary={syntax.description} />
|
|
40
|
+
</ListItemButton>
|
|
41
|
+
</ListItem>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const onOptionClick = (index) => {
|
|
46
|
+
const syntaxPath = `${syntax.path}/${syntax.syntaxes[index].path}`;
|
|
47
|
+
const plasmidsPath = `${syntax.path}/plasmids_${syntax.syntaxes[index].path}`;
|
|
48
|
+
onSyntaxClick(syntaxPath, plasmidsPath);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<ListItem>
|
|
53
|
+
<Accordion>
|
|
54
|
+
<AccordionSummary sx={{ my: 0, py: 0 }} expandIcon={<ExpandMoreIcon />}>
|
|
55
|
+
<ListItemText sx={{ my: 0, py: 0 }} primary={syntax.name} secondary={syntax.description} />
|
|
56
|
+
</AccordionSummary>
|
|
57
|
+
<AccordionDetails>
|
|
58
|
+
<List sx={{ py: 0, my: 0 }}>
|
|
59
|
+
{syntax.syntaxes.map((syntax, index) => (
|
|
60
|
+
<ListItem key={syntax.path} sx={{ my: 0, py: 0 }}>
|
|
61
|
+
<ListItemButton sx={{ py: 0 }} onClick={() => onOptionClick(index)}>
|
|
62
|
+
<ListItemText primary={syntax.name} secondary={syntax.description} />
|
|
63
|
+
</ListItemButton>
|
|
64
|
+
</ListItem>
|
|
65
|
+
))}
|
|
66
|
+
</List>
|
|
67
|
+
</AccordionDetails>
|
|
68
|
+
</Accordion>
|
|
69
|
+
</ListItem>
|
|
70
|
+
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
31
74
|
function ExistingSyntaxDialog({ staticContentPath, onClose, onSyntaxSelect }) {
|
|
32
75
|
const [syntaxes, setSyntaxes] = React.useState([]);
|
|
33
76
|
const [connectAttempt, setConnectAttempt] = React.useState(0);
|
|
@@ -42,7 +85,7 @@ function ExistingSyntaxDialog({ staticContentPath, onClose, onSyntaxSelect }) {
|
|
|
42
85
|
try {
|
|
43
86
|
const { data } = await httpClient.get('index.json');
|
|
44
87
|
setRequestStatus({ status: 'success' });
|
|
45
|
-
setSyntaxes(data);
|
|
88
|
+
setSyntaxes(data.sort((a, b) => a.name.localeCompare(b.name)));
|
|
46
89
|
} catch {
|
|
47
90
|
setRequestStatus({ status: 'error', message: 'Could not load syntaxes' });
|
|
48
91
|
}
|
|
@@ -50,13 +93,13 @@ function ExistingSyntaxDialog({ staticContentPath, onClose, onSyntaxSelect }) {
|
|
|
50
93
|
fetchData();
|
|
51
94
|
}, [connectAttempt]);
|
|
52
95
|
|
|
53
|
-
const onSyntaxClick = React.useCallback(async (
|
|
96
|
+
const onSyntaxClick = React.useCallback(async (syntaxPath, plasmidsPath) => {
|
|
54
97
|
setLoadError(null);
|
|
55
98
|
let loadingErrorPart = 'syntax'
|
|
56
99
|
try {
|
|
57
|
-
const { data: syntaxData } = await httpClient.get(
|
|
100
|
+
const { data: syntaxData } = await httpClient.get(syntaxPath);
|
|
58
101
|
loadingErrorPart = 'plasmids'
|
|
59
|
-
const { data: plasmidsData } = await httpClient.get(
|
|
102
|
+
const { data: plasmidsData } = await httpClient.get(plasmidsPath);
|
|
60
103
|
onSyntaxSelect(syntaxData, plasmidsData);
|
|
61
104
|
onClose();
|
|
62
105
|
} catch {
|
|
@@ -94,11 +137,7 @@ function ExistingSyntaxDialog({ staticContentPath, onClose, onSyntaxSelect }) {
|
|
|
94
137
|
<RequestStatusWrapper requestStatus={requestStatus} retry={() => setConnectAttempt((prev) => prev + 1)}>
|
|
95
138
|
<List>
|
|
96
139
|
{syntaxes.map((syntax) => (
|
|
97
|
-
<
|
|
98
|
-
<ListItemButton onClick={() => {onSyntaxClick(syntax)}}>
|
|
99
|
-
<ListItemText primary={syntax.name} secondary={syntax.description} />
|
|
100
|
-
</ListItemButton>
|
|
101
|
-
</ListItem>
|
|
140
|
+
<SyntaxListItem key={syntax.path} syntax={syntax} onSyntaxClick={onSyntaxClick} />
|
|
102
141
|
))}
|
|
103
142
|
</List>
|
|
104
143
|
</RequestStatusWrapper>
|
package/src/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Version placeholder - replaced at publish time via prepack script
|
|
2
|
-
export const version = "1.4.
|
|
2
|
+
export const version = "1.4.5";
|