@truedat/dd 4.32.1 → 4.33.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/package.json +6 -6
  3. package/src/api.js +4 -0
  4. package/src/components/DictionaryRoutes.js +21 -3
  5. package/src/components/StructureTypesLoader.js +4 -2
  6. package/src/components/{StructuresDownloadButton.js → StructuresDownloadOption.js} +23 -26
  7. package/src/components/StructuresEditableDownloadOption.js +57 -0
  8. package/src/components/StructuresOptions.js +41 -0
  9. package/src/components/StructuresUpdateOption.js +46 -0
  10. package/src/components/{StructuresUploadButton.js → StructuresUploadOption.js} +17 -22
  11. package/src/components/StructuresView.js +6 -10
  12. package/src/components/SystemCreateOption.js +23 -0
  13. package/src/components/__tests__/StructuresDownloadOption.spec.js +45 -0
  14. package/src/components/__tests__/StructuresEditableDownloadOption.spec.js +39 -0
  15. package/src/components/__tests__/StructuresUpdateOption.spec.js +36 -0
  16. package/src/components/__tests__/StructuresUploadOption.spec.js +41 -0
  17. package/src/components/__tests__/SystemCreateOption.spec.js +22 -0
  18. package/src/components/__tests__/__snapshots__/StructuresDownloadOption.spec.js.snap +24 -0
  19. package/src/components/__tests__/__snapshots__/StructuresEditableDownloadOption.spec.js.snap +24 -0
  20. package/src/components/__tests__/__snapshots__/StructuresUpdateOption.spec.js.snap +19 -0
  21. package/src/components/__tests__/__snapshots__/StructuresUploadOption.spec.js.snap +39 -0
  22. package/src/components/__tests__/__snapshots__/StructuresView.spec.js.snap +2 -6
  23. package/src/components/__tests__/__snapshots__/SystemCreateOption.spec.js.snap +21 -0
  24. package/src/components/index.js +0 -2
  25. package/src/messages/en.js +7 -2
  26. package/src/messages/es.js +8 -3
  27. package/src/reducers/__tests__/structuresEditableDownloading.spec.js +32 -0
  28. package/src/reducers/index.js +2 -0
  29. package/src/reducers/structuresEditableDownloading.js +14 -0
  30. package/src/routines.js +3 -0
  31. package/src/sagas/__tests__/downloadEditableStructures.spec.js +80 -0
  32. package/src/sagas/downloadEditableStructures.js +43 -0
  33. package/src/sagas/fetchStructureTypes.js +5 -3
  34. package/src/sagas/index.js +3 -0
  35. package/src/selectors/__tests__/__snapshots__/getGrantsColumns.spec.js.snap +2 -2
  36. package/src/selectors/__tests__/getTabVisibility.spec.js +3 -6
  37. package/src/selectors/getTabVisibility.js +3 -12
  38. package/src/components/SystemCreateButton.js +0 -27
  39. package/src/components/__tests__/StructuresDownloadButton.spec.js +0 -26
  40. package/src/components/__tests__/StructuresUpdateButton.spec.js +0 -27
  41. package/src/components/__tests__/StructuresUploadButton.spec.js +0 -28
  42. package/src/components/__tests__/SystemCreateButton.spec.js +0 -14
  43. package/src/components/__tests__/__snapshots__/StructuresDownloadButton.spec.js.snap +0 -33
  44. package/src/components/__tests__/__snapshots__/StructuresUpdateButton.spec.js.snap +0 -44
  45. package/src/components/__tests__/__snapshots__/StructuresUploadButton.spec.js.snap +0 -515
  46. package/src/components/__tests__/__snapshots__/SystemCreateButton.spec.js.snap +0 -32
@@ -1,27 +0,0 @@
1
- // only admin user
2
- import React from "react";
3
- import { shallow } from "enzyme";
4
- import { StructuresUpdateButton } from "../StructuresUpdateButton";
5
-
6
- jest.mock("@truedat/core/hooks", () => ({
7
- useAuthorized: jest.fn(() => true)
8
- }));
9
-
10
- describe("<StructuresUpdateButton />", () => {
11
- it("button will appear disabled if template is empty", () => {
12
- const props = {
13
- updateUrl: ""
14
- };
15
- const wrapper = shallow(<StructuresUpdateButton {...props} />);
16
- wrapper.find("Popup").props().content;
17
- expect(wrapper.find({ disabled: false }).length).toBe(1);
18
- });
19
-
20
- it("matches the latest snapshot", () => {
21
- const props = {
22
- updateUrl: "url"
23
- };
24
- const wrapper = shallow(<StructuresUpdateButton {...props} />);
25
- expect(wrapper).toMatchSnapshot();
26
- });
27
- });
@@ -1,28 +0,0 @@
1
- // only admin user
2
- import React from "react";
3
- import { intl } from "@truedat/test/intl-stub";
4
- import { mount } from "enzyme";
5
- import { StructuresUploadButton } from "../StructuresUploadButton";
6
-
7
- // workaround for enzyme issue with React.useContext
8
- // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
9
- jest.spyOn(React, "useContext").mockImplementation(() => intl);
10
-
11
- describe("<StructuresUploadButton />", () => {
12
- it("matches the latest snapshot", () => {
13
- const props = {
14
- uploadStructures: jest.fn(),
15
- };
16
- const wrapper = mount(<StructuresUploadButton {...props} />);
17
- expect(wrapper).toMatchSnapshot();
18
- });
19
-
20
- it("matches the latest snapshot with auto publish", () => {
21
- const props = {
22
- uploadStructures: jest.fn(),
23
- canAutoPublish: true,
24
- };
25
- const wrapper = mount(<StructuresUploadButton {...props} />);
26
- expect(wrapper).toMatchSnapshot();
27
- });
28
- });
@@ -1,14 +0,0 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
3
- import { SystemCreateButton } from "../SystemCreateButton";
4
-
5
- jest.mock("@truedat/core/hooks", () => ({
6
- useAuthorized: jest.fn(() => true)
7
- }));
8
-
9
- describe("<SystemCreateButton />", () => {
10
- it("matches the latest snapshot", () => {
11
- const wrapper = shallow(<SystemCreateButton />);
12
- expect(wrapper).toMatchSnapshot();
13
- });
14
- });
@@ -1,33 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<StructuresDownloadButton /> matches the latest snapshot 1`] = `
4
- <div>
5
- <Popup
6
- content="structures.actions.download.popup"
7
- disabled={false}
8
- eventsEnabled={true}
9
- on={
10
- Array [
11
- "click",
12
- "hover",
13
- ]
14
- }
15
- pinned={false}
16
- popperModifiers={Array []}
17
- position="top right"
18
- trigger={
19
- <span
20
- className="trigger-right"
21
- >
22
- <Button
23
- as="button"
24
- disabled={true}
25
- icon="download"
26
- onClick={[Function]}
27
- secondary={true}
28
- />
29
- </span>
30
- }
31
- />
32
- </div>
33
- `;
@@ -1,44 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<StructuresUpdateButton /> matches the latest snapshot 1`] = `
4
- <Popup
5
- content={
6
- <Memo(MemoizedFormattedMessage)
7
- id="structures.actions.bulk_update.popup"
8
- />
9
- }
10
- disabled={false}
11
- eventsEnabled={true}
12
- on={
13
- Array [
14
- "click",
15
- "hover",
16
- ]
17
- }
18
- pinned={false}
19
- popperModifiers={Array []}
20
- position="top right"
21
- trigger={
22
- <span
23
- className="button-update"
24
- >
25
- <Link
26
- className="ui secondary button "
27
- role="button"
28
- to={
29
- Object {
30
- "pathname": "/structures/bulk_update",
31
- "state": Object {
32
- "canAutoPublish": undefined,
33
- },
34
- }
35
- }
36
- >
37
- <Memo(MemoizedFormattedMessage)
38
- id="actions.update"
39
- />
40
- </Link>
41
- </span>
42
- }
43
- />
44
- `;
@@ -1,515 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<StructuresUploadButton /> matches the latest snapshot 1`] = `
4
- <StructuresUploadButton
5
- uploadStructures={[MockFunction]}
6
- >
7
- <UploadModal
8
- content={
9
- <Memo(MemoizedFormattedMessage)
10
- id="structures.actions.upload.confirmation.content"
11
- />
12
- }
13
- handleSubmit={[Function]}
14
- header={
15
- <Memo(MemoizedFormattedMessage)
16
- id="structures.actions.upload.confirmation.header"
17
- />
18
- }
19
- icon="upload"
20
- param="structures"
21
- trigger={
22
- <span
23
- className="trigger-right"
24
- >
25
- <Button
26
- as="button"
27
- data-tooltip="structures.actions.upload.tooltip"
28
- icon="upload"
29
- secondary={true}
30
- />
31
- </span>
32
- }
33
- >
34
- <Modal
35
- actions={
36
- Array [
37
- Object {
38
- "content": <Memo(MemoizedFormattedMessage)
39
- id="actions.cancel"
40
- />,
41
- "key": "no",
42
- "secondary": true,
43
- },
44
- Object {
45
- "content": <Memo(MemoizedFormattedMessage)
46
- id="uploadModal.accept"
47
- />,
48
- "disabled": true,
49
- "key": "yes",
50
- "onClick": [Function],
51
- "primary": true,
52
- },
53
- ]
54
- }
55
- centered={true}
56
- closeIcon={true}
57
- closeOnDimmerClick={true}
58
- closeOnDocumentClick={false}
59
- content={
60
- <ModalContent>
61
- <t
62
- disableClick={true}
63
- disablePreview={false}
64
- disabled={false}
65
- getDataTransferItems={[Function]}
66
- inputProps={Object {}}
67
- maxSize={Infinity}
68
- minSize={0}
69
- multiple={true}
70
- onDragEnter={[Function]}
71
- onDragLeave={[Function]}
72
- onDrop={[Function]}
73
- preventDropOnDocument={true}
74
- style={
75
- Object {
76
- "border": "1px dashed gray",
77
- "borderRadius": "5px",
78
- "marginBottom": "10px",
79
- "width": "100%",
80
- }
81
- }
82
- >
83
- <div
84
- style={
85
- Object {
86
- "height": "100%",
87
- "padding": "20px",
88
- "width": "100%",
89
- }
90
- }
91
- >
92
- <Container
93
- textAlign="center"
94
- >
95
- <Icon
96
- as="i"
97
- name="cloud upload"
98
- size="huge"
99
- />
100
- <p>
101
- <Memo(MemoizedFormattedMessage)
102
- id="uploadModal.actions.upload.confirmation.content"
103
- />
104
- </p>
105
- <Button
106
- as="button"
107
- content="Upload file"
108
- icon="upload"
109
- onClick={[Function]}
110
- secondary={true}
111
- />
112
- </Container>
113
- </div>
114
- </t>
115
- <h2>
116
- <Memo(MemoizedFormattedMessage)
117
- id="uploadModal.selected.files"
118
- />
119
- </h2>
120
- <ul />
121
- </ModalContent>
122
- }
123
- dimmer={true}
124
- eventPool="Modal"
125
- header={
126
- <CoolHeader
127
- header={
128
- <Memo(MemoizedFormattedMessage)
129
- id="structures.actions.upload.confirmation.header"
130
- />
131
- }
132
- />
133
- }
134
- icon="upload"
135
- size="small"
136
- trigger={
137
- <span
138
- className="trigger-right"
139
- >
140
- <Button
141
- as="button"
142
- data-tooltip="structures.actions.upload.tooltip"
143
- icon="upload"
144
- secondary={true}
145
- />
146
- </span>
147
- }
148
- >
149
- <Portal
150
- closeOnDocumentClick={false}
151
- closeOnEscape={true}
152
- eventPool="Modal"
153
- mountNode={<body />}
154
- onClose={[Function]}
155
- onMount={[Function]}
156
- onOpen={[Function]}
157
- onUnmount={[Function]}
158
- openOnTriggerClick={true}
159
- trigger={
160
- <span
161
- className="trigger-right"
162
- >
163
- <Button
164
- as="button"
165
- data-tooltip="structures.actions.upload.tooltip"
166
- icon="upload"
167
- secondary={true}
168
- />
169
- </span>
170
- }
171
- >
172
- <Ref
173
- innerRef={[Function]}
174
- >
175
- <RefFindNode
176
- innerRef={[Function]}
177
- >
178
- <span
179
- className="trigger-right"
180
- onBlur={[Function]}
181
- onClick={[Function]}
182
- onFocus={[Function]}
183
- onMouseEnter={[Function]}
184
- onMouseLeave={[Function]}
185
- >
186
- <Button
187
- as="button"
188
- data-tooltip="structures.actions.upload.tooltip"
189
- icon="upload"
190
- secondary={true}
191
- >
192
- <Ref
193
- innerRef={
194
- Object {
195
- "current": <button
196
- class="ui icon secondary button"
197
- data-tooltip="structures.actions.upload.tooltip"
198
- >
199
- <i
200
- aria-hidden="true"
201
- class="upload icon"
202
- />
203
- </button>,
204
- }
205
- }
206
- >
207
- <RefFindNode
208
- innerRef={
209
- Object {
210
- "current": <button
211
- class="ui icon secondary button"
212
- data-tooltip="structures.actions.upload.tooltip"
213
- >
214
- <i
215
- aria-hidden="true"
216
- class="upload icon"
217
- />
218
- </button>,
219
- }
220
- }
221
- >
222
- <button
223
- className="ui icon secondary button"
224
- data-tooltip="structures.actions.upload.tooltip"
225
- onClick={[Function]}
226
- >
227
- <Icon
228
- as="i"
229
- name="upload"
230
- >
231
- <i
232
- aria-hidden="true"
233
- className="upload icon"
234
- onClick={[Function]}
235
- />
236
- </Icon>
237
- </button>
238
- </RefFindNode>
239
- </Ref>
240
- </Button>
241
- </span>
242
- </RefFindNode>
243
- </Ref>
244
- </Portal>
245
- </Modal>
246
- </UploadModal>
247
- </StructuresUploadButton>
248
- `;
249
-
250
- exports[`<StructuresUploadButton /> matches the latest snapshot with auto publish 1`] = `
251
- <StructuresUploadButton
252
- canAutoPublish={true}
253
- uploadStructures={[MockFunction]}
254
- >
255
- <UploadModal
256
- content={
257
- <Memo(MemoizedFormattedMessage)
258
- id="structures.actions.upload.confirmation.content"
259
- />
260
- }
261
- extraAction={
262
- Object {
263
- "content": <Memo(MemoizedFormattedMessage)
264
- id="uploadModal.accept.publish"
265
- />,
266
- "key": "yesWithAutoPublish",
267
- "onClick": [Function],
268
- "primary": true,
269
- }
270
- }
271
- handleSubmit={[Function]}
272
- header={
273
- <Memo(MemoizedFormattedMessage)
274
- id="structures.actions.upload.confirmation.header"
275
- />
276
- }
277
- icon="upload"
278
- param="structures"
279
- trigger={
280
- <span
281
- className="trigger-right"
282
- >
283
- <Button
284
- as="button"
285
- data-tooltip="structures.actions.upload.tooltip"
286
- icon="upload"
287
- secondary={true}
288
- />
289
- </span>
290
- }
291
- >
292
- <Modal
293
- actions={
294
- Array [
295
- Object {
296
- "content": <Memo(MemoizedFormattedMessage)
297
- id="actions.cancel"
298
- />,
299
- "key": "no",
300
- "secondary": true,
301
- },
302
- Object {
303
- "content": <Memo(MemoizedFormattedMessage)
304
- id="uploadModal.accept"
305
- />,
306
- "disabled": true,
307
- "key": "yes",
308
- "onClick": [Function],
309
- "primary": true,
310
- },
311
- Object {
312
- "content": <Memo(MemoizedFormattedMessage)
313
- id="uploadModal.accept.publish"
314
- />,
315
- "disabled": true,
316
- "key": "yesWithAutoPublish",
317
- "onClick": [Function],
318
- "primary": true,
319
- },
320
- ]
321
- }
322
- centered={true}
323
- closeIcon={true}
324
- closeOnDimmerClick={true}
325
- closeOnDocumentClick={false}
326
- content={
327
- <ModalContent>
328
- <t
329
- disableClick={true}
330
- disablePreview={false}
331
- disabled={false}
332
- getDataTransferItems={[Function]}
333
- inputProps={Object {}}
334
- maxSize={Infinity}
335
- minSize={0}
336
- multiple={true}
337
- onDragEnter={[Function]}
338
- onDragLeave={[Function]}
339
- onDrop={[Function]}
340
- preventDropOnDocument={true}
341
- style={
342
- Object {
343
- "border": "1px dashed gray",
344
- "borderRadius": "5px",
345
- "marginBottom": "10px",
346
- "width": "100%",
347
- }
348
- }
349
- >
350
- <div
351
- style={
352
- Object {
353
- "height": "100%",
354
- "padding": "20px",
355
- "width": "100%",
356
- }
357
- }
358
- >
359
- <Container
360
- textAlign="center"
361
- >
362
- <Icon
363
- as="i"
364
- name="cloud upload"
365
- size="huge"
366
- />
367
- <p>
368
- <Memo(MemoizedFormattedMessage)
369
- id="uploadModal.actions.upload.confirmation.content"
370
- />
371
- </p>
372
- <Button
373
- as="button"
374
- content="Upload file"
375
- icon="upload"
376
- onClick={[Function]}
377
- secondary={true}
378
- />
379
- </Container>
380
- </div>
381
- </t>
382
- <h2>
383
- <Memo(MemoizedFormattedMessage)
384
- id="uploadModal.selected.files"
385
- />
386
- </h2>
387
- <ul />
388
- </ModalContent>
389
- }
390
- dimmer={true}
391
- eventPool="Modal"
392
- header={
393
- <CoolHeader
394
- header={
395
- <Memo(MemoizedFormattedMessage)
396
- id="structures.actions.upload.confirmation.header"
397
- />
398
- }
399
- />
400
- }
401
- icon="upload"
402
- size="small"
403
- trigger={
404
- <span
405
- className="trigger-right"
406
- >
407
- <Button
408
- as="button"
409
- data-tooltip="structures.actions.upload.tooltip"
410
- icon="upload"
411
- secondary={true}
412
- />
413
- </span>
414
- }
415
- >
416
- <Portal
417
- closeOnDocumentClick={false}
418
- closeOnEscape={true}
419
- eventPool="Modal"
420
- mountNode={<body />}
421
- onClose={[Function]}
422
- onMount={[Function]}
423
- onOpen={[Function]}
424
- onUnmount={[Function]}
425
- openOnTriggerClick={true}
426
- trigger={
427
- <span
428
- className="trigger-right"
429
- >
430
- <Button
431
- as="button"
432
- data-tooltip="structures.actions.upload.tooltip"
433
- icon="upload"
434
- secondary={true}
435
- />
436
- </span>
437
- }
438
- >
439
- <Ref
440
- innerRef={[Function]}
441
- >
442
- <RefFindNode
443
- innerRef={[Function]}
444
- >
445
- <span
446
- className="trigger-right"
447
- onBlur={[Function]}
448
- onClick={[Function]}
449
- onFocus={[Function]}
450
- onMouseEnter={[Function]}
451
- onMouseLeave={[Function]}
452
- >
453
- <Button
454
- as="button"
455
- data-tooltip="structures.actions.upload.tooltip"
456
- icon="upload"
457
- secondary={true}
458
- >
459
- <Ref
460
- innerRef={
461
- Object {
462
- "current": <button
463
- class="ui icon secondary button"
464
- data-tooltip="structures.actions.upload.tooltip"
465
- >
466
- <i
467
- aria-hidden="true"
468
- class="upload icon"
469
- />
470
- </button>,
471
- }
472
- }
473
- >
474
- <RefFindNode
475
- innerRef={
476
- Object {
477
- "current": <button
478
- class="ui icon secondary button"
479
- data-tooltip="structures.actions.upload.tooltip"
480
- >
481
- <i
482
- aria-hidden="true"
483
- class="upload icon"
484
- />
485
- </button>,
486
- }
487
- }
488
- >
489
- <button
490
- className="ui icon secondary button"
491
- data-tooltip="structures.actions.upload.tooltip"
492
- onClick={[Function]}
493
- >
494
- <Icon
495
- as="i"
496
- name="upload"
497
- >
498
- <i
499
- aria-hidden="true"
500
- className="upload icon"
501
- onClick={[Function]}
502
- />
503
- </Icon>
504
- </button>
505
- </RefFindNode>
506
- </Ref>
507
- </Button>
508
- </span>
509
- </RefFindNode>
510
- </Ref>
511
- </Portal>
512
- </Modal>
513
- </UploadModal>
514
- </StructuresUploadButton>
515
- `;
@@ -1,32 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<SystemCreateButton /> matches the latest snapshot 1`] = `
4
- <span
5
- className="button-update"
6
- >
7
- <Button
8
- as={
9
- Object {
10
- "$$typeof": Symbol(react.forward_ref),
11
- "displayName": "Link",
12
- "propTypes": Object {
13
- "innerRef": [Function],
14
- "onClick": [Function],
15
- "replace": [Function],
16
- "target": [Function],
17
- "to": [Function],
18
- },
19
- "render": [Function],
20
- }
21
- }
22
- content={
23
- <Memo(MemoizedFormattedMessage)
24
- defaultMessage="new_system"
25
- id="structures.actions.new_system"
26
- />
27
- }
28
- secondary={true}
29
- to="/systems/new"
30
- />
31
- </span>
32
- `;