@opencloning/opencloning-elabftw 1.7.3 → 1.8.1

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,65 @@
1
1
  # @opencloning/opencloning-elabftw
2
2
 
3
+ ## 1.8.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`8e841bd`](https://github.com/OpenCloning/OpenCloning_frontend/commit/8e841bdee4797df61bcf8d1972e3c3581d24fbfb)]:
8
+ - @opencloning/ui@1.8.1
9
+ - @opencloning/utils@1.8.1
10
+
11
+ ## 1.8.0
12
+
13
+ ### Patch Changes
14
+
15
+ - [#694](https://github.com/OpenCloning/OpenCloning_frontend/pull/694) [`2ff9010`](https://github.com/OpenCloning/OpenCloning_frontend/commit/2ff90103c1d9e8e984533e51ecf4dc7978756a57) Thanks [@manulera](https://github.com/manulera)! - Drop close button on load history component
16
+
17
+ - Updated dependencies [[`2ff9010`](https://github.com/OpenCloning/OpenCloning_frontend/commit/2ff90103c1d9e8e984533e51ecf4dc7978756a57), [`2ff9010`](https://github.com/OpenCloning/OpenCloning_frontend/commit/2ff90103c1d9e8e984533e51ecf4dc7978756a57)]:
18
+ - @opencloning/ui@1.8.0
19
+ - @opencloning/utils@1.8.0
20
+
21
+ ## 1.7.8
22
+
23
+ ### Patch Changes
24
+
25
+ - [#693](https://github.com/manulera/OpenCloning_frontend/pull/693) [`e830407`](https://github.com/manulera/OpenCloning_frontend/commit/e830407749f4c016c0e7f7ce715f20fb36addebd) Thanks [@manulera](https://github.com/manulera)! - Use template as categoryKey when creating resource, for newer eLabFTW versions, see [this discussion](https://github.com/elabftw/elabftw/discussions/6764).
26
+
27
+ - Updated dependencies []:
28
+ - @opencloning/ui@1.7.8
29
+ - @opencloning/utils@1.7.8
30
+
31
+ ## 1.7.7
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies [[`c5d9309`](https://github.com/manulera/OpenCloning_frontend/commit/c5d93099583fdfafafd40e9924d2216b596e0cec)]:
36
+ - @opencloning/utils@1.7.7
37
+ - @opencloning/ui@1.7.7
38
+
39
+ ## 1.7.6
40
+
41
+ ### Patch Changes
42
+
43
+ - Updated dependencies [[`c81b179`](https://github.com/manulera/OpenCloning_frontend/commit/c81b179b4fece50271ea214cab1f8a356e36811f), [`c81b179`](https://github.com/manulera/OpenCloning_frontend/commit/c81b179b4fece50271ea214cab1f8a356e36811f)]:
44
+ - @opencloning/ui@1.7.6
45
+ - @opencloning/utils@1.7.6
46
+
47
+ ## 1.7.5
48
+
49
+ ### Patch Changes
50
+
51
+ - Updated dependencies [[`034c738`](https://github.com/manulera/OpenCloning_frontend/commit/034c73840dc183b6b3584365c1db899d2f0c548b)]:
52
+ - @opencloning/ui@1.7.5
53
+ - @opencloning/utils@1.7.5
54
+
55
+ ## 1.7.4
56
+
57
+ ### Patch Changes
58
+
59
+ - Updated dependencies [[`04703a9`](https://github.com/manulera/OpenCloning_frontend/commit/04703a9269a5d4cc4bdde478c1ec61e5c73b0d2a)]:
60
+ - @opencloning/utils@1.7.4
61
+ - @opencloning/ui@1.7.4
62
+
3
63
  ## 1.7.3
4
64
 
5
65
  ### Patch Changes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "license": "MIT",
3
3
  "name": "@opencloning/opencloning-elabftw",
4
- "version": "1.7.3",
4
+ "version": "1.8.1",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
7
7
  "exports": {
@@ -9,15 +9,15 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/manulera/OpenCloning_frontend.git",
12
+ "url": "https://github.com/OpenCloning/OpenCloning_frontend.git",
13
13
  "directory": "packages/opencloning-elabftw"
14
14
  },
15
15
  "dependencies": {
16
- "@mui/icons-material": "^5.15.17",
17
- "@mui/material": "^5.15.17",
18
- "@opencloning/ui": "1.7.3",
19
- "@opencloning/utils": "1.7.3",
20
- "axios": "^1.12.2"
16
+ "@mui/icons-material": "^5.18.0",
17
+ "@mui/material": "^5.18.0",
18
+ "@opencloning/ui": "1.8.1",
19
+ "@opencloning/utils": "1.8.1",
20
+ "axios": "^1.16.0"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": "^18.3.1",
@@ -11,7 +11,6 @@ const TEST_FILE_CONTENT = JSON.stringify({ test: 'content' });
11
11
 
12
12
  describe('<LoadHistoryComponent />', () => {
13
13
  it('loads history file successfully when one file exists', () => {
14
- const handleCloseSpy = cy.spy().as('handleCloseSpy');
15
14
  const loadDatabaseFileSpy = cy.spy().as('loadDatabaseFileSpy');
16
15
 
17
16
  // Stub API calls
@@ -42,7 +41,6 @@ describe('<LoadHistoryComponent />', () => {
42
41
 
43
42
  cy.mount(
44
43
  <LoadHistoryComponent
45
- handleClose={handleCloseSpy}
46
44
  databaseId={DATABASE_ID}
47
45
  loadDatabaseFile={loadDatabaseFileSpy}
48
46
  />,
@@ -74,7 +72,6 @@ describe('<LoadHistoryComponent />', () => {
74
72
  });
75
73
 
76
74
  it('shows error when multiple history files found', () => {
77
- const handleCloseSpy = cy.spy().as('handleCloseSpy');
78
75
  const loadDatabaseFileSpy = cy.spy().as('loadDatabaseFileSpy');
79
76
 
80
77
  cy.stub(eLabFTWHttpClient, 'get').callsFake(async (url) => {
@@ -101,7 +98,6 @@ describe('<LoadHistoryComponent />', () => {
101
98
 
102
99
  cy.mount(
103
100
  <LoadHistoryComponent
104
- handleClose={handleCloseSpy}
105
101
  databaseId={DATABASE_ID}
106
102
  loadDatabaseFile={loadDatabaseFileSpy}
107
103
  />,
@@ -113,7 +109,6 @@ describe('<LoadHistoryComponent />', () => {
113
109
  });
114
110
 
115
111
  it('shows error when no history files found', () => {
116
- const handleCloseSpy = cy.spy().as('handleCloseSpy');
117
112
  const loadDatabaseFileSpy = cy.spy().as('loadDatabaseFileSpy');
118
113
 
119
114
  cy.stub(eLabFTWHttpClient, 'get').callsFake(async (url) => {
@@ -135,7 +130,6 @@ describe('<LoadHistoryComponent />', () => {
135
130
 
136
131
  cy.mount(
137
132
  <LoadHistoryComponent
138
- handleClose={handleCloseSpy}
139
133
  databaseId={DATABASE_ID}
140
134
  loadDatabaseFile={loadDatabaseFileSpy}
141
135
  />,
@@ -147,7 +141,6 @@ describe('<LoadHistoryComponent />', () => {
147
141
  });
148
142
 
149
143
  it('handles API error and allows retry', () => {
150
- const handleCloseSpy = cy.spy().as('handleCloseSpy');
151
144
  const loadDatabaseFileSpy = cy.spy().as('loadDatabaseFileSpy');
152
145
 
153
146
  let callNumber = 0;
@@ -181,7 +174,6 @@ describe('<LoadHistoryComponent />', () => {
181
174
 
182
175
  cy.mount(
183
176
  <LoadHistoryComponent
184
- handleClose={handleCloseSpy}
185
177
  databaseId={DATABASE_ID}
186
178
  loadDatabaseFile={loadDatabaseFileSpy}
187
179
  />,
@@ -208,28 +200,4 @@ describe('<LoadHistoryComponent />', () => {
208
200
  });
209
201
  });
210
202
 
211
- it('close button works', () => {
212
- const handleCloseSpy = cy.spy().as('handleCloseSpy');
213
- const loadDatabaseFileSpy = cy.spy().as('loadDatabaseFileSpy');
214
-
215
- cy.stub(eLabFTWHttpClient, 'get')
216
- .withArgs(`/api/v2/items/${DATABASE_ID}`, { headers: { Authorization: 'test-read-key' } })
217
- .resolves({
218
- data: {
219
- uploads: [],
220
- },
221
- });
222
-
223
- cy.mount(
224
- <LoadHistoryComponent
225
- handleClose={handleCloseSpy}
226
- databaseId={DATABASE_ID}
227
- loadDatabaseFile={loadDatabaseFileSpy}
228
- />,
229
- );
230
-
231
- cy.get('button').contains('Close').click();
232
- cy.get('@handleCloseSpy').should('have.been.called');
233
- cy.get('@loadDatabaseFileSpy').should('not.have.been.called');
234
- });
235
203
  });
@@ -1,10 +1,10 @@
1
- import { Button, CircularProgress } from '@mui/material';
1
+ import { CircularProgress } from '@mui/material';
2
2
  import React from 'react';
3
3
  import { eLabFTWHttpClient, readHeaders } from './common';
4
4
  import RetryAlert from '@opencloning/ui/components/form/RetryAlert';
5
5
  import { getFileFromELabFTW } from './utils';
6
6
 
7
- function LoadHistoryComponent({ handleClose, databaseId, loadDatabaseFile }) {
7
+ function LoadHistoryComponent({ databaseId, loadDatabaseFile }) {
8
8
  const url = `/api/v2/items/${databaseId}`;
9
9
  const [error, setError] = React.useState(null);
10
10
  const [loading, setLoading] = React.useState(false);
@@ -42,8 +42,6 @@ function LoadHistoryComponent({ handleClose, databaseId, loadDatabaseFile }) {
42
42
  <div>
43
43
  {loading && <CircularProgress />}
44
44
  {error && <RetryAlert onRetry={() => setRetry((prev) => prev + 1)}>{error}</RetryAlert>}
45
- <Button onClick={handleClose}>Close</Button>
46
-
47
45
  </div>
48
46
  );
49
47
  }
@@ -24,7 +24,13 @@ const linkToParent = async (childId, parentId) => {
24
24
 
25
25
  const createResource = async (categoryId) => {
26
26
  const eLabFTWVersion = await getELabFTWVersion();
27
- const categoryKey = eLabFTWVersion && eLabFTWVersion >= 50300 ? 'category' : 'category_id';
27
+ let categoryKey
28
+ // 0 is for development (nightly image)
29
+ if (eLabFTWVersion >= 50300 || eLabFTWVersion === 0) {
30
+ categoryKey = 'template';
31
+ } else {
32
+ categoryKey = 'category_id';
33
+ }
28
34
  const createdItemResponse = await eLabFTWHttpClient.post(
29
35
  '/api/v2/items',
30
36
  {