@opencloning/opencloningdb 1.8.1 → 1.8.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,29 @@
1
1
  # @opencloning/opencloningdb
2
2
 
3
+ ## 1.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#732](https://github.com/OpenCloning/OpenCloning_frontend/pull/732) [`cb5ddf4`](https://github.com/OpenCloning/OpenCloning_frontend/commit/cb5ddf4502a288357f8f853242fb35e5ad2a2207) Thanks [@manulera](https://github.com/manulera)! - Create lines from button in list, enables reference strain + transformation + mating
8
+
9
+ - [#732](https://github.com/OpenCloning/OpenCloning_frontend/pull/732) [`cb5ddf4`](https://github.com/OpenCloning/OpenCloning_frontend/commit/cb5ddf4502a288357f8f853242fb35e5ad2a2207) Thanks [@manulera](https://github.com/manulera)! - Auto-select new tag when creating it
10
+
11
+ - [#737](https://github.com/OpenCloning/OpenCloning_frontend/pull/737) [`b40f86f`](https://github.com/OpenCloning/OpenCloning_frontend/commit/b40f86fc3219d6016d8d5c8390b171affc8987f8) Thanks [@manulera](https://github.com/manulera)! - Add button for bulk-download to text files
12
+
13
+ - Updated dependencies [[`06bb1a5`](https://github.com/OpenCloning/OpenCloning_frontend/commit/06bb1a513519f598e9ec3b5eec73544e2ed3958e), [`bc045f9`](https://github.com/OpenCloning/OpenCloning_frontend/commit/bc045f9e74b4d5b84250dcb5a77b93de99e4d684)]:
14
+ - @opencloning/ui@1.9.2
15
+ - @opencloning/utils@1.9.2
16
+
17
+ ## 1.8.2
18
+
19
+ ### Patch Changes
20
+
21
+ - [#725](https://github.com/OpenCloning/OpenCloning_frontend/pull/725) [`093feb9`](https://github.com/OpenCloning/OpenCloning_frontend/commit/093feb9f9fc2aef437dc56cc70e64b26c656d6dd) Thanks [@manulera](https://github.com/manulera)! - Add support for bulk submission of cloning strategies
22
+
23
+ - [#724](https://github.com/OpenCloning/OpenCloning_frontend/pull/724) [`77771ac`](https://github.com/OpenCloning/OpenCloning_frontend/commit/77771ac74d72fbd43146490efeb60798773e4734) Thanks [@manulera](https://github.com/manulera)! - Bulk submit lines
24
+
25
+ - [#722](https://github.com/OpenCloning/OpenCloning_frontend/pull/722) [`871688a`](https://github.com/OpenCloning/OpenCloning_frontend/commit/871688a3576b4f2aa7ffbd8ca919b95daf01e9e4) Thanks [@manulera](https://github.com/manulera)! - Allow submitting template sequences in bulk
26
+
3
27
  ## 1.8.1
4
28
 
5
29
  ### Patch Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "name": "@opencloning/opencloningdb",
4
- "version": "1.8.1",
4
+ "version": "1.8.3",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -15,8 +15,8 @@
15
15
  "dependencies": {
16
16
  "@mui/icons-material": "^5.18.0",
17
17
  "@mui/material": "^5.18.0",
18
- "@opencloning/ui": "1.9.1",
19
- "@opencloning/utils": "1.9.1",
18
+ "@opencloning/ui": "1.9.2",
19
+ "@opencloning/utils": "1.9.2",
20
20
  "axios": "^1.16.0"
21
21
  },
22
22
  "peerDependencies": {
@@ -29,6 +29,7 @@ describe('<GetSequenceFileAndDatabaseIdComponent />', () => {
29
29
  cy.setupOpenCloningDBTestAuth();
30
30
 
31
31
  cy.interceptOpenCloningDBStub('get_sequences_search_by_name', { alias: 'getSequences' });
32
+ cy.interceptOpenCloningDBStub('get_sequences_search_by_name_uid_query', { alias: 'getSequencesByNameUidQuery' });
32
33
  cy.interceptOpenCloningDBStub('get_text_file_sequence', { alias: 'getSequenceFile' });
33
34
 
34
35
  cy.mount(
@@ -57,6 +58,7 @@ describe('<GetSequenceFileAndDatabaseIdComponent />', () => {
57
58
 
58
59
  cy.setupOpenCloningDBTestAuth();
59
60
  cy.interceptOpenCloningDBStub('get_sequences_search_by_name', { alias: 'getSequences' });
61
+ cy.interceptOpenCloningDBStub('get_sequences_search_by_name_uid_query', { alias: 'getSequencesByNameUidQuery' });
60
62
 
61
63
  cy.getStub('get_text_file_sequence').then((textFileSequenceStub) => {
62
64
  let callCount = 0;
@@ -1,15 +1,18 @@
1
1
  import React from 'react';
2
+ import endpoints from './endpoints';
2
3
  import SequenceSelect from './SequenceSelect';
3
4
  import { clickMultiSelectOption } from '../../../cypress/e2e/common_functions';
4
5
 
5
6
  const SEQUENCE_NAME = 'ase1_CDS_PCR';
7
+ const SEQUENCE_UID = 'example_sequencing-sample';
6
8
 
7
9
  describe('<SequenceSelect />', () => {
8
- it('searches for a sequence and shows results', () => {
10
+ it('searches for a sequence by name and shows results', () => {
9
11
  cy.setupOpenCloningDBTestAuth();
10
12
  const onChangeSpy = cy.spy().as('onChangeSpy');
11
13
 
12
14
  cy.interceptOpenCloningDBStub('get_sequences_search_by_name', { alias: 'getSequences' });
15
+ cy.interceptOpenCloningDBStub('get_sequences_search_by_name_uid_query', { alias: 'getSequencesByUid' });
13
16
 
14
17
  cy.mount(
15
18
  <SequenceSelect label="Sequence" onChange={onChangeSpy} multiple={false} />
@@ -29,4 +32,31 @@ describe('<SequenceSelect />', () => {
29
32
 
30
33
  cy.get('input').should('have.value', SEQUENCE_NAME);
31
34
  });
35
+ it('searches for a sequence by uid and shows results', () => {
36
+ cy.setupOpenCloningDBTestAuth();
37
+ const onChangeSpy = cy.spy().as('onChangeSpy');
38
+
39
+ cy.interceptOpenCloningDBStub('get_sequences_search_by_uid', { alias: 'getSequencesByUid' });
40
+ cy.interceptOpenCloningDBStub('get_sequences_search_by_uid_name_query', { alias: 'getSequencesByName' });
41
+
42
+
43
+ cy.mount(
44
+ <SequenceSelect label="Sequence" onChange={onChangeSpy} multiple={false} />
45
+ );
46
+ cy.get('input').click();
47
+ cy.contains('Type at least').should('exist');
48
+ cy.get('input').type(SEQUENCE_UID);
49
+ cy.get('.MuiAutocomplete-listbox li', { timeout: 10000 }).should('have.length.greaterThan', 0);
50
+
51
+ // We need to incercept, because it will submit the value of combined name + uid which is not in a stub
52
+ cy.intercept('GET', Cypress.getDbURL(endpoints.sequences, '*'), { statusCode: 200, body: { items: [] } }).as('getSequences2');
53
+ clickMultiSelectOption('Sequence', SEQUENCE_UID, 'div');
54
+
55
+ cy.getStub('get_sequences_search_by_uid').then((stub) => {
56
+ const stubSequence = stub.response.body.items.find((sequence) => sequence.sample_uids.includes(SEQUENCE_UID));
57
+ expect(stubSequence).to.exist;
58
+ cy.get('@onChangeSpy').should('have.been.calledWith', stubSequence);
59
+ cy.get('input').should('have.value', `${stubSequence.name} (${SEQUENCE_UID})`);
60
+ });
61
+ });
32
62
  });
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { QuerySelect, useDebouncedSearchQuery } from '@opencloning/ui';
3
- import { openCloningDBHttpClient } from './common';
3
+ import { formatSequenceName, openCloningDBHttpClient } from './common';
4
4
  import endpoints from './endpoints';
5
5
 
6
6
  const messages = {
@@ -8,19 +8,25 @@ const messages = {
8
8
  errorMessage: 'Could not retrieve sequences from OpenCloningDB',
9
9
  };
10
10
 
11
+
11
12
  const getGetQuery = (sequenceTypes) => {
12
- return (name) => ({
13
- queryKey: ['sequences', { sequence_types: sequenceTypes, name }],
13
+ return (query) => ({
14
+ queryKey: ['sequences', { sequence_types: sequenceTypes, query }],
14
15
  queryFn: async () => {
15
- const { data } = await openCloningDBHttpClient.get(endpoints.sequences, {
16
- params: { sequence_types: sequenceTypes, name },
17
- });
18
- return data.items;
16
+ const results = await Promise.all([
17
+ openCloningDBHttpClient.get(endpoints.sequences, {
18
+ params: { sequence_types: sequenceTypes, uid: query },
19
+ }),
20
+ openCloningDBHttpClient.get(endpoints.sequences, {
21
+ params: { sequence_types: sequenceTypes, name: query },
22
+ }),
23
+ ]);
24
+ return [...results[0].data.items, ...results[1].data.items];
19
25
  },
20
26
  })};
21
27
 
22
28
  function SequenceSelect({ value, onChange, label, multiple = true, sequenceTypes = undefined, ...rest }) {
23
- const { query, autocompleteProps, clearInput } = useDebouncedSearchQuery(getGetQuery(sequenceTypes));
29
+ const { query, autocompleteProps, clearInput } = useDebouncedSearchQuery(getGetQuery(sequenceTypes), {minChars: 1});
24
30
 
25
31
  return (
26
32
  <QuerySelect
@@ -29,7 +35,7 @@ function SequenceSelect({ value, onChange, label, multiple = true, sequenceTypes
29
35
  loadingMessage={messages.loadingMessage}
30
36
  errorMessage={messages.errorMessage}
31
37
  multiple={multiple}
32
- getOptionLabel={(seq) => seq.name ?? `Sequence ${seq.id}`}
38
+ getOptionLabel={formatSequenceName}
33
39
  getOptionKey={(seq) => seq.id}
34
40
  value={value}
35
41
  onChange={onChange}
package/src/common.js CHANGED
@@ -40,3 +40,12 @@ export const openCloningDBHttpClient = axios.create({
40
40
  });
41
41
 
42
42
  attachAuthInterceptors(openCloningDBHttpClient);
43
+
44
+ export function formatSequenceName({ id, name, sample_uids: sampleUids }) {
45
+ if (!name) return `Sequence ${id}`;
46
+ let out = name;
47
+ if (sampleUids && sampleUids.length > 0) {
48
+ out += ` (${sampleUids.join(', ')})`;
49
+ }
50
+ return out;
51
+ }
package/src/endpoints.js CHANGED
@@ -12,6 +12,8 @@ const endpoints = {
12
12
  sequenceSearch: '/sequences/search',
13
13
  sequencesValidateUpload: '/sequences/validate-upload',
14
14
  sequencesBulk: '/sequences/bulk',
15
+ sequencesCloningStrategyBulkValidate: '/sequences/cloning_strategy/bulk/validate',
16
+ sequencesCloningStrategyBulk: '/sequences/cloning_strategy/bulk',
15
17
  sequencingFileDownload: (id) => `/sequencing_files/${id}/download`,
16
18
  sequenceSequencingFileDelete: (sequenceId, fileId) => `/sequences/${sequenceId}/sequencing_files/${fileId}`,
17
19
  postSequence: '/sequences',
@@ -27,6 +29,8 @@ const endpoints = {
27
29
  lineTags: (id) => `/lines/${id}/tags`,
28
30
  inputEntityTags: (id) => `/input_entities/${id}/tags`,
29
31
  postLine: '/lines',
32
+ linesValidateUpload: '/lines/validate-upload',
33
+ linesBulk: '/lines/bulk',
30
34
  tags: '/tags',
31
35
  tagPost: '/tags',
32
36
  tagUnlinkLine: (lineId, tagId) => `/lines/${lineId}/tags/${tagId}`,
@@ -41,6 +45,9 @@ const endpoints = {
41
45
  postWorkspace: '/workspaces',
42
46
  workspace: (id) => `/workspaces/${id}`,
43
47
  templateSequences: '/template_sequences',
48
+ templateSequencesValidateUpload: '/template_sequences/validate-upload',
49
+ templateSequencesBulk: '/template_sequences/bulk',
50
+ export: '/export',
44
51
  };
45
52
 
46
53
  export default endpoints;
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
1
  export { default as OpenCloningDBInterface } from './OpenCloningDBInterface.js';
2
- export { openCloningDBHttpClient, setUnauthorizedHandler, setWorkspaceHeader, clearWorkspaceHeader, baseUrl } from './common.js';
2
+ export { openCloningDBHttpClient, setUnauthorizedHandler, setWorkspaceHeader, clearWorkspaceHeader, baseUrl, formatSequenceName } from './common.js';
3
3
  export { default as endpoints } from './endpoints.js';
4
4
  export { default as SequenceSelect } from './SequenceSelect.jsx';