@truedat/dd 4.48.12 → 4.49.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 +6 -0
- package/package.json +5 -5
- package/src/api/fragments.js +2 -2
- package/src/api/mutations.js +33 -11
- package/src/api/queries.js +37 -10
- package/src/api.js +0 -4
- package/src/components/DictionaryRoutes.js +4 -4
- package/src/components/StructureSummary.js +12 -22
- package/src/components/StructureTag.js +83 -54
- package/src/components/StructureTagForm.js +149 -89
- package/src/components/StructureTags.js +57 -27
- package/src/components/Tag.js +62 -0
- package/src/components/TagCards.js +85 -0
- package/src/components/TagCrumbs.js +25 -0
- package/src/components/TagForm.js +102 -0
- package/src/components/TagStructureButton.js +58 -0
- package/src/components/Tags.js +33 -0
- package/src/components/TagsRoutes.js +39 -0
- package/src/components/__tests__/StructureSummary.spec.js +0 -7
- package/src/components/__tests__/StructureTag.spec.js +79 -5
- package/src/components/__tests__/StructureTagForm.spec.js +99 -50
- package/src/components/__tests__/Tag.spec.js +11 -0
- package/src/components/__tests__/{StructureTagsCards.spec.js → TagCards.spec.js} +10 -10
- package/src/components/__tests__/TagCrumbs.spec.js +10 -0
- package/src/components/__tests__/TagForm.spec.js +72 -0
- package/src/components/__tests__/Tags.spec.js +10 -0
- package/src/components/__tests__/__snapshots__/StructureSummary.spec.js.snap +18 -42
- package/src/components/__tests__/__snapshots__/StructureTag.spec.js.snap +10 -30
- package/src/components/__tests__/__snapshots__/StructureTagForm.spec.js.snap +255 -51
- package/src/components/__tests__/__snapshots__/Tag.spec.js.snap +36 -0
- package/src/components/__tests__/__snapshots__/{StructureTagsCards.spec.js.snap → TagCards.spec.js.snap} +1 -1
- package/src/components/__tests__/__snapshots__/TagCrumbs.spec.js.snap +102 -0
- package/src/components/__tests__/__snapshots__/TagForm.spec.js.snap +70 -0
- package/src/components/__tests__/__snapshots__/{StructureTags.spec.js.snap → Tags.spec.js.snap} +1 -1
- package/src/messages/en.js +25 -30
- package/src/messages/es.js +25 -30
- package/src/reducers/__tests__/{editableStructureTags.spec.js → availableTags.spec.js} +7 -11
- package/src/reducers/__tests__/structureTagSaving.spec.js +36 -0
- package/src/reducers/__tests__/tagSaving.spec.js +32 -0
- package/src/reducers/{editableStructureTags.js → availableTags.js} +2 -2
- package/src/reducers/index.js +6 -12
- package/src/reducers/structureRedirect.js +7 -7
- package/src/reducers/structureTagSaving.js +12 -10
- package/src/reducers/tagSaving.js +18 -0
- package/src/routines.js +5 -6
- package/src/sagas/__tests__/createTag.spec.js +81 -0
- package/src/sagas/__tests__/deleteStructureTag.spec.js +11 -12
- package/src/sagas/__tests__/deleteTag.spec.js +76 -0
- package/src/sagas/__tests__/tagStructure.spec.js +86 -0
- package/src/sagas/__tests__/updateTag.spec.js +81 -0
- package/src/sagas/createTag.js +29 -0
- package/src/sagas/deleteStructureTag.js +12 -9
- package/src/sagas/deleteTag.js +34 -0
- package/src/sagas/index.js +15 -18
- package/src/sagas/tagStructure.js +37 -0
- package/src/sagas/updateTag.js +23 -0
- package/src/components/LinkStructureTagForm.js +0 -163
- package/src/components/LinkedStructureTag.js +0 -124
- package/src/components/StructureLinkTagButton.js +0 -47
- package/src/components/StructureTagsCards.js +0 -92
- package/src/components/StructureTagsCrumbs.js +0 -44
- package/src/components/StructureTagsRoutes.js +0 -45
- package/src/components/TagsHeader.js +0 -32
- package/src/components/__tests__/LinkStructureTagForm.spec.js +0 -184
- package/src/components/__tests__/LinkedStructureTag.spec.js +0 -133
- package/src/components/__tests__/StructureTags.spec.js +0 -14
- package/src/components/__tests__/StructureTagsCrumbs.spec.js +0 -13
- package/src/components/__tests__/__snapshots__/LinkStructureTagForm.spec.js.snap +0 -456
- package/src/components/__tests__/__snapshots__/LinkedStructureTag.spec.js.snap +0 -16
- package/src/components/__tests__/__snapshots__/StructureTagsCrumbs.spec.js.snap +0 -36
- package/src/reducers/__tests__/deletingStructureTags.spec.js +0 -30
- package/src/reducers/__tests__/linkedStructureTags.spec.js +0 -69
- package/src/reducers/__tests__/linkedStructureTagsLoading.spec.js +0 -32
- package/src/reducers/__tests__/linkingStructureTags.spec.js +0 -30
- package/src/reducers/__tests__/structureTagsSaving.spec.js +0 -40
- package/src/reducers/deletingStructureTags.js +0 -16
- package/src/reducers/linkedStructureTags.js +0 -28
- package/src/reducers/linkedStructureTagsLoading.js +0 -16
- package/src/reducers/linkingStructureTags.js +0 -16
- package/src/sagas/__tests__/createStructureTag.spec.js +0 -85
- package/src/sagas/__tests__/deleteLinkStructureTag.spec.js +0 -96
- package/src/sagas/__tests__/fetchLinksStructureTags.spec.js +0 -105
- package/src/sagas/__tests__/linkStructureTag.spec.js +0 -102
- package/src/sagas/__tests__/updateStructureTag.spec.js +0 -84
- package/src/sagas/createStructureTag.js +0 -29
- package/src/sagas/deleteLinkStructureTag.js +0 -29
- package/src/sagas/fetchLinksStructureTags.js +0 -31
- package/src/sagas/linkStructureTag.js +0 -30
- package/src/sagas/updateStructureTag.js +0 -23
package/src/messages/en.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"alert.createReferenceDataset.success.header": "Dataset created",
|
|
3
|
-
"alert.
|
|
3
|
+
"alert.createTag.failed.header": "Error creating structure tag",
|
|
4
4
|
"alert.deleteReferenceDataset.success.header": "Dataset deleted",
|
|
5
5
|
"alert.export.csv": "Export to CSV",
|
|
6
|
-
"alert.
|
|
6
|
+
"alert.tagStructure.failed.header": "Error linking tag to structure",
|
|
7
7
|
"alert.saveUserSearchFilters.failed.header": "Error saving filter",
|
|
8
8
|
"alert.show.more": "Show more",
|
|
9
9
|
"alert.updateReferenceDataset.success.header": "Dataset updated",
|
|
10
|
-
"alert.
|
|
10
|
+
"alert.updateTag.failed.header": "Error editing structure tag",
|
|
11
11
|
"alert.updateSystem.failed.header": "Error updating system",
|
|
12
|
-
"
|
|
12
|
+
"createTag.error.name.has already been taken":
|
|
13
13
|
"A Structure Tag with this name already exists",
|
|
14
14
|
"execution.pending.content":
|
|
15
15
|
"This execution has not started yet, please check again later.",
|
|
@@ -148,8 +148,6 @@ export default {
|
|
|
148
148
|
"lineage.group.placeholder": "Select Top Level Structure",
|
|
149
149
|
"lineage.resources.placeholder": "Select Child Structures",
|
|
150
150
|
"lineage.subgroup.placeholder": "Select Child Structure",
|
|
151
|
-
"linkStructureTag.error.description.max.length.1000":
|
|
152
|
-
"Desctiption maximum length is set to 1000 characters",
|
|
153
151
|
"metadataView.fields": "Available metadata fields",
|
|
154
152
|
"metadataView.fields.placeholder":
|
|
155
153
|
"By default all available metadata will be visible",
|
|
@@ -303,14 +301,6 @@ export default {
|
|
|
303
301
|
"structure.system.description": "Description",
|
|
304
302
|
"structure.system.external_id": "External ID",
|
|
305
303
|
"structure.system.name": "Name",
|
|
306
|
-
"structure.tag.add": "Add",
|
|
307
|
-
"structure.tag.delete": "Delete",
|
|
308
|
-
"structure.tag.dropdown.label": "Select tag",
|
|
309
|
-
"structure.tag.dropdown.placeholder": "Tag name",
|
|
310
|
-
"structure.tag.edit": "Edit",
|
|
311
|
-
"structure.tag.textArea.label": "Tag comments",
|
|
312
|
-
"structure.tag.textArea.placeholder": "Introduce a comment",
|
|
313
|
-
"structure.tag.tooltip.commentTitle": "Comment",
|
|
314
304
|
"structure.type": "Type",
|
|
315
305
|
"structure.type.Attribute": "Attribute",
|
|
316
306
|
"structure.type.File.icon": "file",
|
|
@@ -359,21 +349,11 @@ export default {
|
|
|
359
349
|
"structureDomain.actions.update": "Update",
|
|
360
350
|
"structureDomain.actions.update.inherit": "Apply on children",
|
|
361
351
|
"structureSelector.union.criteria": "Union criteria",
|
|
362
|
-
"
|
|
363
|
-
"
|
|
364
|
-
"
|
|
365
|
-
"
|
|
366
|
-
"
|
|
367
|
-
"This tag has {count} linked structures. Are you sure that you want to delete this Struture Tag?",
|
|
368
|
-
"structureTags.actions.delete.confirmation.header": "Delete Structure Tag",
|
|
369
|
-
"structureTags.actions.delete.noStructures.confirmation.content":
|
|
370
|
-
"Are you sure that you want to delete this Struture Tag?",
|
|
371
|
-
"structureTags.actions.edit": "Edit Structure Tag",
|
|
372
|
-
"structureTags.actions.update": "Edit Structure Tag",
|
|
373
|
-
"structureTags.crumbs.root": "Structure Tags",
|
|
374
|
-
"structureTags.empty": "There are no Structure Tags yet",
|
|
375
|
-
"structureTags.header": "Structure tags management",
|
|
376
|
-
"structureTags.subheader": "Tags for Data Catalog",
|
|
352
|
+
"structureTag.comment": "Comments",
|
|
353
|
+
"structureTag.comment.placeholder": "Introduce any comments",
|
|
354
|
+
"structureTag.inherit": "Inherited by children",
|
|
355
|
+
"structureTag.tag": "Tag",
|
|
356
|
+
"structureTag.tag.placeholder": "Tag name",
|
|
377
357
|
"structureType.actions.addMetadataView": "Add Metadata View",
|
|
378
358
|
"structureType.filters": "Filters",
|
|
379
359
|
"structureType.filters.placeholder": "Select filterable fields",
|
|
@@ -553,7 +533,22 @@ export default {
|
|
|
553
533
|
"tabs.dd.rules": "Quality rules",
|
|
554
534
|
"tabs.dd.versions": "Versions",
|
|
555
535
|
"tabs.se.structures": "Structures",
|
|
556
|
-
"
|
|
536
|
+
"tagForm.props.domains": "Domains",
|
|
537
|
+
"tagForm.props.name": "Name",
|
|
538
|
+
"tagForm.props.description": "Description",
|
|
539
|
+
"tags.actions.create": "Create Structure Tag",
|
|
540
|
+
"tags.actions.delete.confirmation.content":
|
|
541
|
+
"This tag has {count} linked structures. Are you sure that you want to delete this Struture Tag?",
|
|
542
|
+
"tags.actions.delete.confirmation.header": "Delete Structure Tag",
|
|
543
|
+
"tags.actions.delete.noStructures.confirmation.content":
|
|
544
|
+
"Are you sure that you want to delete this Struture Tag?",
|
|
545
|
+
"tags.actions.edit": "Edit Structure Tag",
|
|
546
|
+
"tags.actions.update": "Edit Structure Tag",
|
|
547
|
+
"tags.crumbs.root": "Structure Tags",
|
|
548
|
+
"tags.empty": "There are no Structure Tags yet",
|
|
549
|
+
"tags.header": "Structure tags management",
|
|
550
|
+
"tags.subheader": "Tags for Data Catalog",
|
|
551
|
+
"updateTag.error.name.has already been taken":
|
|
557
552
|
"A Structure Tag with this name already exists",
|
|
558
553
|
"updateStructureType.success.header": "Structure type updated",
|
|
559
554
|
"updateSystem.error.df_content.invalid content": "Invalid template content",
|
package/src/messages/es.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
"alert.createReferenceDataset.success.header": "Dataset creado correctamente",
|
|
3
|
-
"alert.
|
|
3
|
+
"alert.createTag.failed.header": "Error al crear Etiqueta",
|
|
4
4
|
"alert.deleteReferenceDataset.success.header":
|
|
5
5
|
"Dataset eliminado correctamente",
|
|
6
6
|
"alert.export.csv": "Exportar a CSV",
|
|
7
|
-
"alert.
|
|
7
|
+
"alert.tagStructure.failed.header":
|
|
8
8
|
"Error asociando etiqueta a estructura",
|
|
9
9
|
"alert.saveUserSearchFilters.failed.header": "Error guardando filtro",
|
|
10
10
|
"alert.show.more": "Mostrar más",
|
|
11
11
|
"alert.updateReferenceDataset.success.header":
|
|
12
12
|
"Dataset actualizado correctamente",
|
|
13
|
-
"alert.
|
|
13
|
+
"alert.updateTag.failed.header": "Error al editar Etiqueta",
|
|
14
14
|
"alert.updateSystem.failed.header": "Error actualizando sistema",
|
|
15
|
-
"
|
|
15
|
+
"createTag.error.name.has already been taken":
|
|
16
16
|
"Ya existe una Etiqueta de Estructura con ese nombre",
|
|
17
17
|
"execution.pending.content":
|
|
18
18
|
"Ejecución no iniciada aún, por favor comprueba de nuevo más tarde",
|
|
@@ -155,8 +155,6 @@ export default {
|
|
|
155
155
|
"lineage.group.placeholder": "Seleccionar Estructura Padre",
|
|
156
156
|
"lineage.resources.placeholder": "Seleccionar Estructuras Hijos",
|
|
157
157
|
"lineage.subgroup.placeholder": "Seleccionar Estructura Hijo",
|
|
158
|
-
"linkStructureTag.error.description.max.length.1000":
|
|
159
|
-
"El tamaño límite de la descripción es de 1000 caracteres",
|
|
160
158
|
"metadataView.fields": "Campos",
|
|
161
159
|
"metadataView.fields.placeholder":
|
|
162
160
|
"Por defecto, se incluirán todos los campos de metadata",
|
|
@@ -312,14 +310,6 @@ export default {
|
|
|
312
310
|
"structure.system.description": "Descripción",
|
|
313
311
|
"structure.system.external_id": "ID Externo",
|
|
314
312
|
"structure.system.name": "Nombre",
|
|
315
|
-
"structure.tag.add": "Añadir",
|
|
316
|
-
"structure.tag.delete": "Borrar",
|
|
317
|
-
"structure.tag.dropdown.label": "Seleccionar etiqueta",
|
|
318
|
-
"structure.tag.dropdown.placeholder": "Clave de etiqueta",
|
|
319
|
-
"structure.tag.edit": "Editar",
|
|
320
|
-
"structure.tag.textArea.label": "Comentarios de etiqueta",
|
|
321
|
-
"structure.tag.textArea.placeholder": "Introducir un comentario",
|
|
322
|
-
"structure.tag.tooltip.commentTitle": "Comentario",
|
|
323
313
|
"structure.type": "Tipo",
|
|
324
314
|
"structure.type.Attribute": "Atributo",
|
|
325
315
|
"structure.type.File.icon": "file",
|
|
@@ -368,21 +358,11 @@ export default {
|
|
|
368
358
|
"structureDomain.actions.update": "Actualizar",
|
|
369
359
|
"structureDomain.actions.update.inherit": "Aplicar en hijos",
|
|
370
360
|
"structureSelector.union.criteria": "Criterio de unión",
|
|
371
|
-
"
|
|
372
|
-
"
|
|
373
|
-
"
|
|
374
|
-
"
|
|
375
|
-
"
|
|
376
|
-
"Esta etiqueta tiene {count} estructuras asociadas. ¿Desea eliminar la Etiqueta de Estructura {name}?",
|
|
377
|
-
"structureTags.actions.delete.confirmation.header": "Borrar Etiqueta",
|
|
378
|
-
"structureTags.actions.delete.noStructures.confirmation.content":
|
|
379
|
-
"¿Desea eliminar la Etiqueta de Estructura {name}?",
|
|
380
|
-
"structureTags.actions.edit": "Editar Etiqueta",
|
|
381
|
-
"structureTags.actions.update": "Editar Etiqueta de Estructura",
|
|
382
|
-
"structureTags.crumbs.root": "Etiquetas de Estructuras",
|
|
383
|
-
"structureTags.empty": "Aún no hay ninguna Etiqueta de Estructura",
|
|
384
|
-
"structureTags.header": "Gestión de Etiquetas de Estructuras",
|
|
385
|
-
"structureTags.subheader": "Etiquetas para el Catálogo de Datos",
|
|
361
|
+
"structureTag.comment": "Comentario",
|
|
362
|
+
"structureTag.comment.placeholder": "Introducir un comentario",
|
|
363
|
+
"structureTag.inherit": "Heredar en cascada",
|
|
364
|
+
"structureTag.tag": "Etiqueta",
|
|
365
|
+
"structureTag.tag.placeholder": "Clave de etiqueta",
|
|
386
366
|
"structureType.actions.addMetadataView": "Añadir vista de metadata",
|
|
387
367
|
"structureType.filters": "Filtros",
|
|
388
368
|
"structureType.filters.placeholder": "Seleccionar campos filtrables",
|
|
@@ -570,7 +550,22 @@ export default {
|
|
|
570
550
|
"tabs.dd.rules": "Reglas de calidad",
|
|
571
551
|
"tabs.dd.versions": "Versiones",
|
|
572
552
|
"tabs.se.structures": "Estructuras",
|
|
573
|
-
"
|
|
553
|
+
"tagForm.props.domains": "Dominios",
|
|
554
|
+
"tagForm.props.name": "Nombre",
|
|
555
|
+
"tagForm.props.description": "Descripción",
|
|
556
|
+
"tags.actions.create": "Crear Etiqueta de Estructura",
|
|
557
|
+
"tags.actions.delete.confirmation.content":
|
|
558
|
+
"Esta etiqueta tiene {count} estructuras asociadas. ¿Desea eliminar la Etiqueta de Estructura {name}?",
|
|
559
|
+
"tags.actions.delete.confirmation.header": "Borrar Etiqueta",
|
|
560
|
+
"tags.actions.delete.noStructures.confirmation.content":
|
|
561
|
+
"¿Desea eliminar la Etiqueta de Estructura {name}?",
|
|
562
|
+
"tags.actions.edit": "Editar Etiqueta",
|
|
563
|
+
"tags.actions.update": "Editar Etiqueta de Estructura",
|
|
564
|
+
"tags.crumbs.root": "Etiquetas de Estructuras",
|
|
565
|
+
"tags.empty": "Aún no hay ninguna Etiqueta de Estructura",
|
|
566
|
+
"tags.header": "Gestión de Etiquetas de Estructuras",
|
|
567
|
+
"tags.subheader": "Etiquetas para el Catálogo de Datos",
|
|
568
|
+
"updateTag.error.name.has already been taken":
|
|
574
569
|
"Ya existe una Etiqueta de Estructura con ese nombre",
|
|
575
570
|
"updateStructureType.success.header": "Tipo actualizado correctamente",
|
|
576
571
|
"updateSystem.error.df_content.invalid content":
|
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
import { clearStructure, fetchStructure } from "../../routines";
|
|
2
|
-
import {
|
|
2
|
+
import { availableTags, initialState } from "../availableTags";
|
|
3
3
|
|
|
4
4
|
const fooState = [{ foo: "bar" }];
|
|
5
5
|
|
|
6
|
-
describe("reducers:
|
|
6
|
+
describe("reducers: availableTags", () => {
|
|
7
7
|
it("should provide the initial state", () => {
|
|
8
|
-
expect(
|
|
8
|
+
expect(availableTags(undefined, {})).toBe(initialState);
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
it("should handle the clearStructure.TRIGGER action", () => {
|
|
12
|
-
expect(
|
|
13
|
-
initialState
|
|
14
|
-
);
|
|
12
|
+
expect(availableTags(fooState, clearStructure())).toBe(initialState);
|
|
15
13
|
});
|
|
16
14
|
|
|
17
15
|
it("should handle the fetchStructure.TRIGGER action", () => {
|
|
18
|
-
expect(
|
|
19
|
-
initialState
|
|
20
|
-
);
|
|
16
|
+
expect(availableTags(fooState, fetchStructure())).toBe(initialState);
|
|
21
17
|
});
|
|
22
18
|
|
|
23
19
|
it("should handle the fetchStructure.SUCCESS action", () => {
|
|
@@ -29,11 +25,11 @@ describe("reducers: editableStructureTags", () => {
|
|
|
29
25
|
const payload = { _actions: { manage_tags: { data } } };
|
|
30
26
|
|
|
31
27
|
expect(
|
|
32
|
-
|
|
28
|
+
availableTags(fooState, fetchStructure.success(payload))
|
|
33
29
|
).toMatchObject(data);
|
|
34
30
|
});
|
|
35
31
|
|
|
36
32
|
it("should ignore unknown actions", () => {
|
|
37
|
-
expect(
|
|
33
|
+
expect(availableTags(fooState, { type: "FOO" })).toBe(fooState);
|
|
38
34
|
});
|
|
39
35
|
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { deleteStructureTag, tagStructure } from "../../routines";
|
|
2
|
+
import { structureTagSaving } from "..";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
const id = "123";
|
|
6
|
+
|
|
7
|
+
describe("reducers: structureTagSaving", () => {
|
|
8
|
+
it("should provide the initial state", () => {
|
|
9
|
+
expect(structureTagSaving(undefined, {})).toBeNull();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("should be true after receiving the deleteStructureTag.TRIGGER action", () => {
|
|
13
|
+
expect(structureTagSaving(fooState, deleteStructureTag(id))).toBe(id);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("should be false after receiving the deleteStructureTag.FULFILL action", () => {
|
|
17
|
+
expect(
|
|
18
|
+
structureTagSaving(fooState, deleteStructureTag.fulfill())
|
|
19
|
+
).toBeNull();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("should be id or dataStructureId after receiving the tagStructure.TRIGGER action", () => {
|
|
23
|
+
expect(structureTagSaving(fooState, tagStructure({ id }))).toBe(id);
|
|
24
|
+
expect(
|
|
25
|
+
structureTagSaving(fooState, tagStructure({ dataStructureId: id }))
|
|
26
|
+
).toBe(id);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should be null after receiving the tagStructure.FULFILL action", () => {
|
|
30
|
+
expect(structureTagSaving(fooState, tagStructure.fulfill())).toBeNull();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it("should ignore unhandled actions", () => {
|
|
34
|
+
expect(structureTagSaving(fooState, { type: "FOO" })).toBe(fooState);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createTag, updateTag } from "../../routines";
|
|
2
|
+
import { tagSaving } from "..";
|
|
3
|
+
|
|
4
|
+
const fooState = { foo: "bar" };
|
|
5
|
+
|
|
6
|
+
describe("reducers: tagSaving", () => {
|
|
7
|
+
const initialState = false;
|
|
8
|
+
|
|
9
|
+
it("should provide the initial state", () => {
|
|
10
|
+
expect(tagSaving(undefined, {})).toBe(initialState);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("should handle the createTag.TRIGGER action", () => {
|
|
14
|
+
expect(tagSaving(fooState, { type: createTag.TRIGGER })).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should handle the createTag.FULFILL action", () => {
|
|
18
|
+
expect(tagSaving(fooState, { type: createTag.FULFILL })).toBe(false);
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("should handle the updateTag.TRIGGER action", () => {
|
|
22
|
+
expect(tagSaving(fooState, { type: updateTag.TRIGGER })).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should handle the updateTag.FULFILL action", () => {
|
|
26
|
+
expect(tagSaving(fooState, { type: updateTag.FULFILL })).toBe(false);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("should ignore unknown actions", () => {
|
|
30
|
+
expect(tagSaving(fooState, { type: "FOO" })).toBe(fooState);
|
|
31
|
+
});
|
|
32
|
+
});
|
|
@@ -3,7 +3,7 @@ import { clearStructure, fetchStructure } from "../routines";
|
|
|
3
3
|
|
|
4
4
|
export const initialState = [];
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const availableTags = (state = initialState, { type, payload }) => {
|
|
7
7
|
switch (type) {
|
|
8
8
|
case clearStructure.TRIGGER:
|
|
9
9
|
return initialState;
|
|
@@ -16,4 +16,4 @@ const editableStructureTags = (state = initialState, { type, payload }) => {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
-
export {
|
|
19
|
+
export { availableTags };
|
package/src/reducers/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { childrenRelations, parentRelations } from "./structureRelations";
|
|
|
3
3
|
import { creatingGrantRequestApproval } from "./creatingGrantRequestApproval";
|
|
4
4
|
import { csvGraphDownloading } from "./csvGraphDownloading";
|
|
5
5
|
import { ddMessage } from "./ddMessage";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { structureTagSaving } from "./structureTagSaving";
|
|
7
|
+
import { availableTags } from "./availableTags";
|
|
8
8
|
import { grantActiveFilters } from "./grantActiveFilters";
|
|
9
9
|
import { grantCount } from "./grantCount";
|
|
10
10
|
import { grantDateFilter } from "./grantDateFilter";
|
|
@@ -26,9 +26,6 @@ import { graphRedirect } from "./graphRedirect";
|
|
|
26
26
|
import { lineageEvents } from "./lineageEvents";
|
|
27
27
|
import { lineageEventsLoading } from "./lineageEventsLoading";
|
|
28
28
|
import { lineageQuery } from "./lineageQuery";
|
|
29
|
-
import { linkedStructureTags } from "./linkedStructureTags";
|
|
30
|
-
import { linkedStructureTagsLoading } from "./linkedStructureTagsLoading";
|
|
31
|
-
import { linkingStructureTags } from "./linkingStructureTags";
|
|
32
29
|
import { nodes } from "./nodes";
|
|
33
30
|
import { nodesLoading } from "./nodesLoading";
|
|
34
31
|
import { previousGrantQuery } from "./previousGrantQuery";
|
|
@@ -67,7 +64,6 @@ import { structureRedirect } from "./structureRedirect";
|
|
|
67
64
|
import { structureSelectedFilter } from "./structureSelectedFilter";
|
|
68
65
|
import { structureSiblings } from "./structureSiblings";
|
|
69
66
|
import { structureSystem } from "./structureSystem";
|
|
70
|
-
import { structureTagSaving } from "./structureTagSaving";
|
|
71
67
|
import { structureType } from "./structureType";
|
|
72
68
|
import { structureTypeLoading } from "./structureTypeLoading";
|
|
73
69
|
import { structureTypes } from "./structureTypes";
|
|
@@ -90,6 +86,7 @@ import { systemStructures } from "./systemStructures";
|
|
|
90
86
|
import { systemStructuresLoading } from "./systemStructuresLoading";
|
|
91
87
|
import { systems } from "./systems";
|
|
92
88
|
import { systemsLoading } from "./systemsLoading";
|
|
89
|
+
import { tagSaving } from "./tagSaving";
|
|
93
90
|
import { unitDomains } from "./unitDomains";
|
|
94
91
|
import { uploadingStructuresFile } from "./uploadingStructuresFile";
|
|
95
92
|
import { userPermissions } from "./userPermissions";
|
|
@@ -101,8 +98,8 @@ export {
|
|
|
101
98
|
creatingGrantRequestApproval,
|
|
102
99
|
csvGraphDownloading,
|
|
103
100
|
ddMessage,
|
|
104
|
-
|
|
105
|
-
|
|
101
|
+
structureTagSaving,
|
|
102
|
+
availableTags,
|
|
106
103
|
grantActiveFilters,
|
|
107
104
|
grantCount,
|
|
108
105
|
grantDateFilter,
|
|
@@ -124,9 +121,6 @@ export {
|
|
|
124
121
|
lineageEvents,
|
|
125
122
|
lineageEventsLoading,
|
|
126
123
|
lineageQuery,
|
|
127
|
-
linkedStructureTags,
|
|
128
|
-
linkedStructureTagsLoading,
|
|
129
|
-
linkingStructureTags,
|
|
130
124
|
nodes,
|
|
131
125
|
nodesLoading,
|
|
132
126
|
parentRelations,
|
|
@@ -166,7 +160,6 @@ export {
|
|
|
166
160
|
structureSelectedFilter,
|
|
167
161
|
structureSiblings,
|
|
168
162
|
structureSystem,
|
|
169
|
-
structureTagSaving,
|
|
170
163
|
structureType,
|
|
171
164
|
structureTypeLoading,
|
|
172
165
|
structureTypes,
|
|
@@ -190,6 +183,7 @@ export {
|
|
|
190
183
|
systemStructuresLoading,
|
|
191
184
|
systems,
|
|
192
185
|
systemsLoading,
|
|
186
|
+
tagSaving,
|
|
193
187
|
unitDomains,
|
|
194
188
|
uploadingStructuresFile,
|
|
195
189
|
userPermissions,
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
GRANT_REQUEST_APPROVALS,
|
|
5
5
|
REFERENCE_DATASETS,
|
|
6
6
|
STRUCTURES,
|
|
7
|
-
STRUCTURE_TAGS,
|
|
8
7
|
STRUCTURE_TYPES,
|
|
8
|
+
STRUCTURE_TAGS,
|
|
9
9
|
linkTo,
|
|
10
10
|
} from "@truedat/core/routes";
|
|
11
11
|
import {
|
|
@@ -14,17 +14,17 @@ import {
|
|
|
14
14
|
createGrantRequestApproval,
|
|
15
15
|
createProfileGroup,
|
|
16
16
|
createReferenceDataset,
|
|
17
|
-
createStructureTag,
|
|
18
17
|
createSystem,
|
|
18
|
+
createTag,
|
|
19
19
|
deleteReferenceDataset,
|
|
20
20
|
deleteStructure,
|
|
21
|
-
|
|
21
|
+
deleteTag,
|
|
22
22
|
doStructureNoteAction,
|
|
23
23
|
updateReferenceDataset,
|
|
24
24
|
updateStructure,
|
|
25
|
-
updateStructureTag,
|
|
26
25
|
updateStructureType,
|
|
27
26
|
updateSystem,
|
|
27
|
+
updateTag,
|
|
28
28
|
uploadStructures,
|
|
29
29
|
} from "../routines";
|
|
30
30
|
|
|
@@ -58,17 +58,17 @@ export const structureRedirect = (
|
|
|
58
58
|
? linkTo.STRUCTURE_NOTES({ id: meta?.data_structure_id })
|
|
59
59
|
: state;
|
|
60
60
|
}
|
|
61
|
-
case
|
|
61
|
+
case createTag.SUCCESS: {
|
|
62
62
|
return STRUCTURE_TAGS;
|
|
63
63
|
}
|
|
64
64
|
case deleteStructure.SUCCESS: {
|
|
65
65
|
const { id } = payload;
|
|
66
66
|
return linkTo.STRUCTURE({ id: id });
|
|
67
67
|
}
|
|
68
|
-
case
|
|
68
|
+
case deleteTag.SUCCESS: {
|
|
69
69
|
return STRUCTURE_TAGS;
|
|
70
70
|
}
|
|
71
|
-
case
|
|
71
|
+
case updateTag.SUCCESS: {
|
|
72
72
|
return STRUCTURE_TAGS;
|
|
73
73
|
}
|
|
74
74
|
case updateStructureType.SUCCESS: {
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { deleteStructureTag, tagStructure } from "../routines";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const initialState = null;
|
|
4
|
+
|
|
5
|
+
const structureTagSaving = (state = initialState, { type, payload }) => {
|
|
4
6
|
switch (type) {
|
|
5
|
-
case
|
|
6
|
-
return
|
|
7
|
-
case
|
|
8
|
-
return
|
|
9
|
-
case
|
|
10
|
-
return
|
|
11
|
-
case
|
|
12
|
-
return
|
|
7
|
+
case deleteStructureTag.TRIGGER:
|
|
8
|
+
return payload;
|
|
9
|
+
case deleteStructureTag.FULFILL:
|
|
10
|
+
return initialState;
|
|
11
|
+
case tagStructure.TRIGGER:
|
|
12
|
+
return payload.id || payload.dataStructureId;
|
|
13
|
+
case tagStructure.FULFILL:
|
|
14
|
+
return initialState;
|
|
13
15
|
default:
|
|
14
16
|
return state;
|
|
15
17
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { updateTag, createTag } from "../routines";
|
|
2
|
+
|
|
3
|
+
const tagSaving = (state = false, { type }) => {
|
|
4
|
+
switch (type) {
|
|
5
|
+
case updateTag.TRIGGER:
|
|
6
|
+
return true;
|
|
7
|
+
case updateTag.FULFILL:
|
|
8
|
+
return false;
|
|
9
|
+
case createTag.TRIGGER:
|
|
10
|
+
return true;
|
|
11
|
+
case createTag.FULFILL:
|
|
12
|
+
return false;
|
|
13
|
+
default:
|
|
14
|
+
return state;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export { tagSaving };
|
package/src/routines.js
CHANGED
|
@@ -42,13 +42,13 @@ export const createGraph = createRoutine("CREATE_GRAPH");
|
|
|
42
42
|
export const createProfileGroup = createRoutine("CREATE_PROFILE_GROUP");
|
|
43
43
|
export const createReferenceDataset = createRoutine("CREATE_REFERENCE_DATASET");
|
|
44
44
|
export const createStructureGraph = createRoutine("CREATE_STRUCTURE_GRAPH");
|
|
45
|
-
export const createStructureTag = createRoutine("CREATE_STRUCTURE_TAG");
|
|
46
45
|
export const createStructureType = createRoutine("CREATE_STRUCTURE_TYPE");
|
|
47
46
|
export const createSystem = createRoutine("CREATE_SYSTEM");
|
|
47
|
+
export const createTag = createRoutine("CREATE_TAG");
|
|
48
48
|
export const deleteReferenceDataset = createRoutine("DELETE_REFERENCE_DATASET");
|
|
49
|
-
export const deleteLinkStructureTag = createRoutine("DELETE_LINK_STRUCTURE_TAG");
|
|
50
|
-
export const deleteStructure = createRoutine("DELETE_STRUCTURE");
|
|
51
49
|
export const deleteStructureTag = createRoutine("DELETE_STRUCTURE_TAG");
|
|
50
|
+
export const deleteStructure = createRoutine("DELETE_STRUCTURE");
|
|
51
|
+
export const deleteTag = createRoutine("DELETE_TAG");
|
|
52
52
|
export const deleteUserSearchFilter = createRoutine("DELETE_USER_SEARCH_FILTER");
|
|
53
53
|
export const doStructureNoteAction = createRoutine("DO_STRUCTURE_NOTE_ACTION");
|
|
54
54
|
export const downloadCsvGraph = createRoutine("DOWNLOAD_CSV_GRAPH");
|
|
@@ -66,7 +66,6 @@ export const fetchGrantRequests = createRoutine("FETCH_GRANT_REQUESTS");
|
|
|
66
66
|
export const fetchGrants = createRoutine("FETCH_GRANTS");
|
|
67
67
|
export const fetchGraph = createRoutine("FETCH_GRAPH");
|
|
68
68
|
export const fetchLineageEvents = createRoutine("FETCH_LINEAGE_EVENTS");
|
|
69
|
-
export const fetchLinksStructureTags = createRoutine("FETCH_LINKS_STRUCTURE_TAGS");
|
|
70
69
|
export const fetchNodes = createRoutine("FETCH_NODES");
|
|
71
70
|
export const fetchProfileExecution = createRoutine("FETCH_EXECUTION_PROFILE");
|
|
72
71
|
export const fetchProfileGroup = createRoutine("FETCH_PROFILE_GROUP");
|
|
@@ -86,7 +85,7 @@ export const fetchUserSearchFilters = createRoutine("FETCH_USER_SEARCH_FILTERS")
|
|
|
86
85
|
export const filterStructures = createRoutine("FILTER_STRUCTURES");
|
|
87
86
|
export const hoverNode = createRoutine("HOVER_NODE");
|
|
88
87
|
export const initSvg = createRoutine("INIT_SVG");
|
|
89
|
-
export const
|
|
88
|
+
export const tagStructure = createRoutine("TAG_STRUCTURE");
|
|
90
89
|
export const loadLineageEvents = createRoutine("LOAD_LINEAGE_EVENTS");
|
|
91
90
|
export const openGrantFilter = createRoutine("OPEN_GRANT_FILTER");
|
|
92
91
|
export const openStructureFilter = createRoutine("OPEN_STRUCTURE_FILTER");
|
|
@@ -121,8 +120,8 @@ export const updateGrantRequestFilter = createRoutine("UPDATE_GRANT_REQUEST_FILT
|
|
|
121
120
|
export const updateGrantRequestTemplateContent = createRoutine("UPDATE_GRANT_REQUEST_TEMPLATE_CONTENT");
|
|
122
121
|
export const updateReferenceDataset = createRoutine("UPDATE_REFERENCE_DATASET");
|
|
123
122
|
export const updateStructure = createRoutine("UPDATE_STRUCTURE");
|
|
124
|
-
export const updateStructureTag = createRoutine("UPDATE_STRUCTURE_TAG");
|
|
125
123
|
export const updateStructureType = createRoutine("UPDATE_STRUCTURE_TYPE");
|
|
126
124
|
export const updateSystem = createRoutine("UPDATE_SYSTEM");
|
|
127
125
|
export const uploadStructures = createRoutine("UPLOAD_STRUCTURES");
|
|
128
126
|
export const uploadStructuresDomains = createRoutine("UPLOAD_STRUCTURES_DOMAINS");
|
|
127
|
+
export const updateTag = createRoutine("UPDATE_TAG");
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { testSaga } from "redux-saga-test-plan";
|
|
2
|
+
import { createTagRequestSaga, createTagSaga, onSuccess } from "../createTag";
|
|
3
|
+
import { CREATE_TAG } from "../../api/mutations";
|
|
4
|
+
import { createTag } from "../../routines";
|
|
5
|
+
|
|
6
|
+
describe("sagas: createTagRequestSaga", () => {
|
|
7
|
+
it("should invoke createTagSaga on createTag.TRIGGER", () => {
|
|
8
|
+
expect(() => {
|
|
9
|
+
testSaga(createTagRequestSaga)
|
|
10
|
+
.next()
|
|
11
|
+
.takeLatest(createTag.TRIGGER, createTagSaga)
|
|
12
|
+
.finish()
|
|
13
|
+
.isDone();
|
|
14
|
+
}).not.toThrow();
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("should throw exception if an unhandled action is received", () => {
|
|
18
|
+
expect(() => {
|
|
19
|
+
testSaga(createTagRequestSaga)
|
|
20
|
+
.next()
|
|
21
|
+
.takeLatest("FOO", createTagRequestSaga);
|
|
22
|
+
}).toThrow();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe("sagas: createTagSaga", () => {
|
|
27
|
+
const client = { mutate: jest.fn() };
|
|
28
|
+
const tag = {
|
|
29
|
+
name: "tag1",
|
|
30
|
+
domainIds: ["1", "2"],
|
|
31
|
+
};
|
|
32
|
+
const payload = tag;
|
|
33
|
+
const data = { foo: "bar" };
|
|
34
|
+
|
|
35
|
+
it("should put a success action when a response is returned", () => {
|
|
36
|
+
expect(() => {
|
|
37
|
+
testSaga(createTagSaga, { payload })
|
|
38
|
+
.next()
|
|
39
|
+
.getContext("client")
|
|
40
|
+
.next(client)
|
|
41
|
+
.put(createTag.request(payload))
|
|
42
|
+
.next()
|
|
43
|
+
.call(client.mutate, {
|
|
44
|
+
mutation: CREATE_TAG,
|
|
45
|
+
update: onSuccess,
|
|
46
|
+
variables: { tag },
|
|
47
|
+
})
|
|
48
|
+
.next({ data })
|
|
49
|
+
.put(createTag.success(data))
|
|
50
|
+
.next()
|
|
51
|
+
.put(createTag.fulfill())
|
|
52
|
+
.next()
|
|
53
|
+
.isDone();
|
|
54
|
+
}).not.toThrow();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("should put a failure action when the call returns an error", () => {
|
|
58
|
+
const message = "Request failed";
|
|
59
|
+
const error = { message };
|
|
60
|
+
|
|
61
|
+
expect(() => {
|
|
62
|
+
testSaga(createTagSaga, { payload })
|
|
63
|
+
.next()
|
|
64
|
+
.getContext("client")
|
|
65
|
+
.next(client)
|
|
66
|
+
.put(createTag.request(payload))
|
|
67
|
+
.next()
|
|
68
|
+
.call(client.mutate, {
|
|
69
|
+
mutation: CREATE_TAG,
|
|
70
|
+
update: onSuccess,
|
|
71
|
+
variables: { tag },
|
|
72
|
+
})
|
|
73
|
+
.throw(error)
|
|
74
|
+
.put(createTag.failure(message))
|
|
75
|
+
.next()
|
|
76
|
+
.put(createTag.fulfill())
|
|
77
|
+
.next()
|
|
78
|
+
.isDone();
|
|
79
|
+
}).not.toThrow();
|
|
80
|
+
});
|
|
81
|
+
});
|