@opencloning/ui 1.4.1 → 1.4.3

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,25 @@
1
1
  # @opencloning/ui
2
2
 
3
+ ## 1.4.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#622](https://github.com/manulera/OpenCloning_frontend/pull/622) [`03cec1c`](https://github.com/manulera/OpenCloning_frontend/commit/03cec1c53e6e8365bb8bf9617ed3128b65ab18cc) Thanks [@manulera](https://github.com/manulera)! - Fix loading external assemblies in syntax builder by extracting config out of ExistingSyntaxDialog component
8
+
9
+ - Updated dependencies []:
10
+ - @opencloning/store@1.4.3
11
+ - @opencloning/utils@1.4.3
12
+
13
+ ## 1.4.2
14
+
15
+ ### Patch Changes
16
+
17
+ - [#620](https://github.com/manulera/OpenCloning_frontend/pull/620) [`1c2dbef`](https://github.com/manulera/OpenCloning_frontend/commit/1c2dbef236d54b4980599cd6acc4fdabced13f1d) Thanks [@manulera](https://github.com/manulera)! - Fix assembler using BsaI by default always
18
+
19
+ - Updated dependencies []:
20
+ - @opencloning/store@1.4.2
21
+ - @opencloning/utils@1.4.2
22
+
3
23
  ## 1.4.1
4
24
 
5
25
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencloning/ui",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
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.1",
29
- "@opencloning/utils": "1.4.1",
28
+ "@opencloning/store": "1.4.3",
29
+ "@opencloning/utils": "1.4.3",
30
30
  "@teselagen/bio-parsers": "^0.4.34",
31
31
  "@teselagen/ove": "^0.8.34",
32
32
  "@teselagen/range-utils": "^0.3.20",
@@ -96,6 +96,7 @@ describe('<AssemblerComponent />', () => {
96
96
  <AssemblerComponent
97
97
  plasmids={mockPlasmids}
98
98
  categories={mockCategories}
99
+ assemblyEnzyme="assembly_enzyme"
99
100
  />
100
101
  </ConfigProvider>,
101
102
  );
@@ -209,9 +210,15 @@ describe('<AssemblerComponent />', () => {
209
210
  body: dummyResponse,
210
211
  }).as('fetchSourceSuccess');
211
212
  // Mock assembly request
212
- cy.intercept('POST', 'http://localhost:8000/restriction_and_ligation*', {
213
- statusCode: 200,
214
- body: dummyResponse,
213
+ cy.intercept('POST', 'http://localhost:8000/restriction_and_ligation*', (req) => {
214
+ // Check that the value of the enzyme was set in the request body
215
+ expect(req.body).to.have.property('source');
216
+ expect(req.body.source).to.have.property('restriction_enzymes');
217
+ expect(req.body.source.restriction_enzymes).to.include('assembly_enzyme');
218
+ req.reply({
219
+ statusCode: 200,
220
+ body: dummyResponse,
221
+ });
215
222
  }).as('assemblySuccess');
216
223
 
217
224
  // Click submit button
@@ -17,6 +17,7 @@ import useBackendRoute from '../../hooks/useBackendRoute';
17
17
  import useHttpClient from '../../hooks/useHttpClient';
18
18
  import useAlerts from '../../hooks/useAlerts';
19
19
  import UploadPlasmidsButton from './UploadPlasmidsButton';
20
+ import { useConfig } from '../../providers';
20
21
 
21
22
 
22
23
  const { setState: setCloningState, setCurrentTab: setCurrentTabAction } = cloningActions;
@@ -122,7 +123,7 @@ function AssemblerBox({ item, index, setCategory, setId, categories, plasmids, a
122
123
  )
123
124
  }
124
125
 
125
- export function AssemblerComponent({ plasmids, categories }) {
126
+ export function AssemblerComponent({ plasmids, categories, assemblyEnzyme }) {
126
127
 
127
128
  const [requestedAssemblies, setRequestedAssemblies] = React.useState([])
128
129
  const [errorMessage, setErrorMessage] = React.useState('')
@@ -146,7 +147,7 @@ export function AssemblerComponent({ plasmids, categories }) {
146
147
  const resp = await requestSources(selectedPlasmids)
147
148
  errorMessage = 'Error assembling sequences'
148
149
  setLoadingMessage('Assembling...')
149
- const assemblies = await requestAssemblies(resp)
150
+ const assemblies = await requestAssemblies(resp, assemblyEnzyme)
150
151
  setRequestedAssemblies(assemblies)
151
152
  } catch (e) {
152
153
  if (e.assembly) {
@@ -240,6 +241,7 @@ function categoriesFromSyntaxAndPlasmids(syntax, plasmids) {
240
241
  function LoadSyntaxButton({ setSyntax, addPlasmids }) {
241
242
  const [existingSyntaxDialogOpen, setExistingSyntaxDialogOpen] = React.useState(false)
242
243
  const httpClient = useHttpClient();
244
+ const { staticContentPath } = useConfig();
243
245
  const backendRoute = useBackendRoute();
244
246
  const { addAlert } = useAlerts();
245
247
  const onSyntaxSelect = React.useCallback(async (syntax, plasmids) => {
@@ -257,7 +259,7 @@ function LoadSyntaxButton({ setSyntax, addPlasmids }) {
257
259
  }, [setSyntax, addPlasmids, httpClient, backendRoute, addAlert])
258
260
  return <>
259
261
  <Button color="success" onClick={() => setExistingSyntaxDialogOpen(true)}>Load Syntax</Button>
260
- {existingSyntaxDialogOpen && <ExistingSyntaxDialog onClose={() => setExistingSyntaxDialogOpen(false)} onSyntaxSelect={onSyntaxSelect}/>}
262
+ {existingSyntaxDialogOpen && <ExistingSyntaxDialog staticContentPath={staticContentPath} onClose={() => setExistingSyntaxDialogOpen(false)} onSyntaxSelect={onSyntaxSelect}/>}
261
263
  </>
262
264
  }
263
265
 
@@ -292,7 +294,7 @@ function Assembler() {
292
294
  {syntax && <UploadPlasmidsButton addPlasmids={addPlasmids} syntax={syntax} />}
293
295
  {syntax && <Button color="error" onClick={clearPlasmids}>Remove uploaded plasmids</Button>}
294
296
  </ButtonGroup>
295
- {syntax && <AssemblerComponent plasmids={plasmids} syntax={syntax} categories={categories} />}
297
+ {syntax && <AssemblerComponent plasmids={plasmids} syntax={syntax} categories={categories} assemblyEnzyme={syntax.assemblyEnzyme} />}
296
298
  </>
297
299
  )
298
300
  }
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- import { ConfigProvider } from '@opencloning/ui/providers/ConfigProvider';
3
2
  import ExistingSyntaxDialog from './ExistingSyntaxDialog';
4
3
 
5
4
  // Test config
@@ -50,12 +49,10 @@ describe('<ExistingSyntaxDialog />', () => {
50
49
  const onSyntaxSelectSpy = cy.spy().as('onSyntaxSelectSpy');
51
50
 
52
51
  cy.mount(
53
- <ConfigProvider config={testConfig}>
54
- <ExistingSyntaxDialog
55
- onClose={onCloseSpy}
56
- onSyntaxSelect={onSyntaxSelectSpy}
57
- />
58
- </ConfigProvider>,
52
+ <ExistingSyntaxDialog
53
+ onClose={onCloseSpy}
54
+ onSyntaxSelect={onSyntaxSelectSpy}
55
+ />,
59
56
  );
60
57
 
61
58
  cy.wait('@getSyntaxes');
@@ -82,12 +79,10 @@ describe('<ExistingSyntaxDialog />', () => {
82
79
  }).as('getPlasmidsData');
83
80
 
84
81
  cy.mount(
85
- <ConfigProvider config={testConfig}>
86
- <ExistingSyntaxDialog
87
- onClose={onCloseSpy}
88
- onSyntaxSelect={onSyntaxSelectSpy}
89
- />
90
- </ConfigProvider>,
82
+ <ExistingSyntaxDialog
83
+ onClose={onCloseSpy}
84
+ onSyntaxSelect={onSyntaxSelectSpy}
85
+ />,
91
86
  );
92
87
 
93
88
  cy.wait('@getSyntaxes');
@@ -111,12 +106,10 @@ describe('<ExistingSyntaxDialog />', () => {
111
106
  }).as('getSyntaxDataError');
112
107
 
113
108
  cy.mount(
114
- <ConfigProvider config={testConfig}>
115
- <ExistingSyntaxDialog
116
- onClose={onCloseSpy}
117
- onSyntaxSelect={onSyntaxSelectSpy}
118
- />
119
- </ConfigProvider>,
109
+ <ExistingSyntaxDialog
110
+ onClose={onCloseSpy}
111
+ onSyntaxSelect={onSyntaxSelectSpy}
112
+ />,
120
113
  );
121
114
 
122
115
  cy.wait('@getSyntaxes');
@@ -146,12 +139,10 @@ describe('<ExistingSyntaxDialog />', () => {
146
139
  }).as('getPlasmidsDataError');
147
140
 
148
141
  cy.mount(
149
- <ConfigProvider config={testConfig}>
150
- <ExistingSyntaxDialog
151
- onClose={onCloseSpy}
152
- onSyntaxSelect={onSyntaxSelectSpy}
153
- />
154
- </ConfigProvider>,
142
+ <ExistingSyntaxDialog
143
+ onClose={onCloseSpy}
144
+ onSyntaxSelect={onSyntaxSelectSpy}
145
+ />,
155
146
  );
156
147
 
157
148
  cy.wait('@getSyntaxes');
@@ -187,12 +178,10 @@ describe('<ExistingSyntaxDialog />', () => {
187
178
  }).as('getPlasmidsData2');
188
179
 
189
180
  cy.mount(
190
- <ConfigProvider config={testConfig}>
191
- <ExistingSyntaxDialog
192
- onClose={onCloseSpy}
193
- onSyntaxSelect={onSyntaxSelectSpy}
194
- />
195
- </ConfigProvider>,
181
+ <ExistingSyntaxDialog
182
+ onClose={onCloseSpy}
183
+ onSyntaxSelect={onSyntaxSelectSpy}
184
+ />,
196
185
  );
197
186
 
198
187
  cy.wait('@getSyntaxes');
@@ -232,12 +221,10 @@ describe('<ExistingSyntaxDialog />', () => {
232
221
  }
233
222
 
234
223
  cy.mount(
235
- <ConfigProvider config={testConfig}>
236
- <ExistingSyntaxDialog
237
- onClose={onCloseSpy}
238
- onSyntaxSelect={onSyntaxSelectSpy}
239
- />
240
- </ConfigProvider>,
224
+ <ExistingSyntaxDialog
225
+ onClose={onCloseSpy}
226
+ onSyntaxSelect={onSyntaxSelectSpy}
227
+ />,
241
228
  );
242
229
 
243
230
  cy.wait('@getSyntaxes');
@@ -262,12 +249,10 @@ describe('<ExistingSyntaxDialog />', () => {
262
249
  }
263
250
 
264
251
  cy.mount(
265
- <ConfigProvider config={testConfig}>
266
- <ExistingSyntaxDialog
267
- onClose={onCloseSpy}
268
- onSyntaxSelect={onSyntaxSelectSpy}
269
- />
270
- </ConfigProvider>,
252
+ <ExistingSyntaxDialog
253
+ onClose={onCloseSpy}
254
+ onSyntaxSelect={onSyntaxSelectSpy}
255
+ />,
271
256
  );
272
257
 
273
258
  cy.wait('@getSyntaxes');
@@ -28,13 +28,12 @@ function LocalSyntaxDialog({ onClose, onSyntaxSelect }) {
28
28
  )
29
29
  }
30
30
 
31
- function ExistingSyntaxDialog({ onClose, onSyntaxSelect }) {
31
+ function ExistingSyntaxDialog({ staticContentPath, onClose, onSyntaxSelect }) {
32
32
  const [syntaxes, setSyntaxes] = React.useState([]);
33
33
  const [connectAttempt, setConnectAttempt] = React.useState(0);
34
34
  const [requestStatus, setRequestStatus] = React.useState({ status: 'loading' });
35
35
  const [loadError, setLoadError] = React.useState(null);
36
36
  const fileInputRef = React.useRef(null);
37
- const { staticContentPath } = useConfig();
38
37
  const [localDialogOpen, setLocalDialogOpen] = React.useState(false);
39
38
 
40
39
  React.useEffect(() => {
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.1";
2
+ export const version = "1.4.3";