@truedat/ie 7.5.9 → 7.5.11

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 (106) hide show
  1. package/package.json +42 -67
  2. package/src/ingests/components/EventRow.js +1 -2
  3. package/src/ingests/components/Events.js +3 -4
  4. package/src/ingests/components/FieldGroupTable.js +1 -2
  5. package/src/ingests/components/Ingest.js +1 -2
  6. package/src/ingests/components/IngestActions.js +1 -2
  7. package/src/ingests/components/IngestArchive.js +2 -3
  8. package/src/ingests/components/IngestArchiveLoader.js +16 -38
  9. package/src/ingests/components/IngestArchiveRow.js +5 -6
  10. package/src/ingests/components/IngestCompleteness.js +0 -1
  11. package/src/ingests/components/IngestCrumbs.js +2 -4
  12. package/src/ingests/components/IngestDetails.js +3 -3
  13. package/src/ingests/components/IngestDuplicate.js +5 -8
  14. package/src/ingests/components/IngestEdit.js +5 -8
  15. package/src/ingests/components/IngestExecutions.js +7 -7
  16. package/src/ingests/components/IngestExecutionsLoader.js +2 -2
  17. package/src/ingests/components/IngestFilters.js +5 -6
  18. package/src/ingests/components/IngestForm.js +4 -5
  19. package/src/ingests/components/IngestHeader.js +0 -1
  20. package/src/ingests/components/IngestLoader.js +16 -58
  21. package/src/ingests/components/IngestRoutes.js +272 -231
  22. package/src/ingests/components/IngestRow.js +4 -5
  23. package/src/ingests/components/IngestSelectedFilters.js +10 -10
  24. package/src/ingests/components/IngestSummary.js +0 -2
  25. package/src/ingests/components/IngestTabs.js +13 -13
  26. package/src/ingests/components/Ingests.js +0 -1
  27. package/src/ingests/components/IngestsActions.js +1 -2
  28. package/src/ingests/components/IngestsLabelResults.js +1 -2
  29. package/src/ingests/components/IngestsLoader.js +1 -1
  30. package/src/ingests/components/IngestsSearch.js +0 -1
  31. package/src/ingests/components/IngestsSelector.js +0 -1
  32. package/src/ingests/components/IngestsTable.js +85 -94
  33. package/src/ingests/components/IngestsTabs.js +2 -3
  34. package/src/ingests/components/__tests__/Events.spec.js +10 -10
  35. package/src/ingests/components/__tests__/Ingest.spec.js +16 -5
  36. package/src/ingests/components/__tests__/IngestActions.spec.js +7 -7
  37. package/src/ingests/components/__tests__/IngestArchive.spec.js +7 -7
  38. package/src/ingests/components/__tests__/IngestArchiveLoader.spec.js +70 -69
  39. package/src/ingests/components/__tests__/IngestArchiveRow.spec.js +10 -12
  40. package/src/ingests/components/__tests__/IngestCompleteness.spec.js +0 -1
  41. package/src/ingests/components/__tests__/IngestDetails.spec.js +10 -10
  42. package/src/ingests/components/__tests__/IngestExecutions.spec.js +7 -7
  43. package/src/ingests/components/__tests__/IngestExecutionsLoader.spec.js +38 -47
  44. package/src/ingests/components/__tests__/IngestFilters.spec.js +0 -1
  45. package/src/ingests/components/__tests__/IngestForm.spec.js +18 -40
  46. package/src/ingests/components/__tests__/IngestHeader.spec.js +9 -9
  47. package/src/ingests/components/__tests__/IngestLabelResults.spec.js +0 -1
  48. package/src/ingests/components/__tests__/IngestLoader.spec.js +70 -41
  49. package/src/ingests/components/__tests__/IngestRoutes.spec.js +176 -0
  50. package/src/ingests/components/__tests__/IngestSelectedFilters.spec.js +33 -5
  51. package/src/ingests/components/__tests__/Ingests.spec.js +32 -6
  52. package/src/ingests/components/__tests__/IngestsActions.spec.js +5 -5
  53. package/src/ingests/components/__tests__/IngestsLoader.spec.js +65 -36
  54. package/src/ingests/components/__tests__/IngestsTable.spec.js +16 -7
  55. package/src/ingests/components/__tests__/__snapshots__/Events.spec.js.snap +83 -43
  56. package/src/ingests/components/__tests__/__snapshots__/Ingest.spec.js.snap +27 -14
  57. package/src/ingests/components/__tests__/__snapshots__/IngestActions.spec.js.snap +19 -20
  58. package/src/ingests/components/__tests__/__snapshots__/IngestArchive.spec.js.snap +79 -65
  59. package/src/ingests/components/__tests__/__snapshots__/IngestArchiveLoader.spec.js.snap +1 -1
  60. package/src/ingests/components/__tests__/__snapshots__/IngestArchiveRow.spec.js.snap +30 -30
  61. package/src/ingests/components/__tests__/__snapshots__/IngestDetails.spec.js.snap +30 -13
  62. package/src/ingests/components/__tests__/__snapshots__/IngestExecutions.spec.js.snap +121 -101
  63. package/src/ingests/components/__tests__/__snapshots__/IngestExecutionsLoader.spec.js.snap +1 -1
  64. package/src/ingests/components/__tests__/__snapshots__/IngestFilters.spec.js.snap +1 -1
  65. package/src/ingests/components/__tests__/__snapshots__/IngestForm.spec.js.snap +28 -27
  66. package/src/ingests/components/__tests__/__snapshots__/IngestHeader.spec.js.snap +21 -19
  67. package/src/ingests/components/__tests__/__snapshots__/IngestLabelResults.spec.js.snap +1 -1
  68. package/src/ingests/components/__tests__/__snapshots__/IngestLoader.spec.js.snap +1 -15
  69. package/src/ingests/components/__tests__/__snapshots__/IngestRoutes.spec.js.snap +243 -0
  70. package/src/ingests/components/__tests__/__snapshots__/IngestSelectedFilters.spec.js.snap +22 -16
  71. package/src/ingests/components/__tests__/__snapshots__/Ingests.spec.js.snap +50 -33
  72. package/src/ingests/components/__tests__/__snapshots__/IngestsActions.spec.js.snap +17 -50
  73. package/src/ingests/components/__tests__/__snapshots__/IngestsLoader.spec.js.snap +1 -21
  74. package/src/ingests/components/__tests__/__snapshots__/IngestsTable.spec.js.snap +15 -24
  75. package/src/ingests/components/index.js +1 -1
  76. package/src/ingests/constants/mappings.js +6 -6
  77. package/src/ingests/relations/components/IngestLinkActions.js +0 -1
  78. package/src/ingests/relations/components/IngestLinksActions.js +1 -2
  79. package/src/ingests/relations/components/IngestRelationsRoutes.js +67 -69
  80. package/src/ingests/relations/components/IngestToDataStructureRelations.js +2 -2
  81. package/src/ingests/relations/components/IngestToIngestForm.js +4 -4
  82. package/src/ingests/relations/components/IngestToIngestRelations.js +4 -4
  83. package/src/ingests/relations/components/IngestToStructureForm.js +6 -6
  84. package/src/ingests/relations/components/__tests__/IngestRelationsRoutes.spec.js +80 -4
  85. package/src/ingests/relations/components/__tests__/IngestToIngestForm.spec.js +24 -25
  86. package/src/ingests/relations/components/__tests__/IngestToStructureForm.spec.js +42 -23
  87. package/src/ingests/relations/components/__tests__/__snapshots__/IngestRelationsRoutes.spec.js.snap +49 -23
  88. package/src/ingests/relations/components/__tests__/__snapshots__/IngestToIngestForm.spec.js.snap +85 -27
  89. package/src/ingests/relations/components/__tests__/__snapshots__/IngestToStructureForm.spec.js.snap +30 -35
  90. package/src/ingests/relations/selectors/__tests__/getIngestLinks.spec.js +20 -20
  91. package/src/ingests/relations/selectors/__tests__/getRelations.spec.js +17 -17
  92. package/src/ingests/relations/selectors/getIngestLinks.js +1 -2
  93. package/src/ingests/relations/selectors/getRelations.js +6 -6
  94. package/src/ingests/sagas/fetchIngest.js +1 -1
  95. package/src/ingests/sagas/fetchIngestArchive.js +1 -1
  96. package/src/ingests/sagas/fetchIngestExecutions.js +1 -1
  97. package/src/ingests/selectors/getIngestColumns.js +12 -13
  98. package/src/ingests/selectors/getIngestTemplate.js +1 -1
  99. package/src/ingests/selectors/getParsedEvents.js +15 -15
  100. package/src/ingests/selectors/getTemplateFields.js +3 -3
  101. package/src/ingests/selectors/getTemplateGroups.js +1 -1
  102. package/src/ingests/utils/filterOptions.js +3 -2
  103. package/src/ingests/components/__tests__/IngestDuplicate.spec.js +0 -67
  104. package/src/ingests/components/__tests__/IngestEdit.spec.js +0 -79
  105. package/src/ingests/components/__tests__/__snapshots__/IngestDuplicate.spec.js.snap +0 -85
  106. package/src/ingests/components/__tests__/__snapshots__/IngestEdit.spec.js.snap +0 -80
@@ -1,7 +1,7 @@
1
1
  import { createSelector } from "reselect";
2
2
  import { getIngest } from "./getIngest";
3
3
 
4
- export const getIngestTemplate = createSelector([getIngest], ingest => {
4
+ export const getIngestTemplate = createSelector([getIngest], (ingest) => {
5
5
  const { template } = ingest;
6
6
  return template ? template.content : {};
7
7
  });
@@ -4,21 +4,21 @@ import { getEvents } from "./getEvents";
4
4
 
5
5
  const getTemplate = ({ ingest }) => _.prop("template")(ingest);
6
6
 
7
- const toStr = field =>
7
+ const toStr = (field) =>
8
8
  _.isObject(field)
9
9
  ? JSON.stringify(field)
10
10
  : _.isBoolean(field)
11
- ? _.toString(field)
12
- : field;
11
+ ? _.toString(field)
12
+ : field;
13
13
 
14
- const getDeleteIngestDraftEvent = e => {
14
+ const getDeleteIngestDraftEvent = (e) => {
15
15
  const msg_key = "deleted_version";
16
16
  const { version } = e.payload;
17
17
  const msg_params = [toStr(version)];
18
18
  return { ...e, payload: [{ msg_key, msg_params }] };
19
19
  };
20
20
 
21
- const getNewIngestDraftEvent = e => {
21
+ const getNewIngestDraftEvent = (e) => {
22
22
  const msg_key = "created_version";
23
23
  const { version } = e.payload;
24
24
  const msg_params = [toStr(version)];
@@ -35,13 +35,13 @@ const getIngestFieldChanges = (
35
35
  _.toPairs,
36
36
  _.map(([k, v]) => ({
37
37
  msg_key: fromValueType(msg_key, k, v, fieldsWithoutValue),
38
- msg_params: [getFieldLabel(k, templateFields), toStr(v)]
38
+ msg_params: [getFieldLabel(k, templateFields), toStr(v)],
39
39
  }))
40
40
  )(fields);
41
41
 
42
42
  const getFieldLabel = (field, fields) =>
43
43
  _.flow(
44
- _.find(f => _.prop("name")(f) == field),
44
+ _.find((f) => _.prop("name")(f) == field),
45
45
  _.defaultTo({}),
46
46
  _.prop("label")
47
47
  )(fields) || field;
@@ -70,14 +70,14 @@ const getUpdateIngestDraftEvent = (e, templateFields, fieldsWithoutValue) => {
70
70
  // eslint-disable-next-line fp/no-mutation
71
71
  field_config = _.concat({
72
72
  msg_key: "changed_field_without_target",
73
- msg_params: ["description"]
73
+ msg_params: ["description"],
74
74
  })(field_config);
75
75
 
76
76
  if (name)
77
77
  // eslint-disable-next-line fp/no-mutation
78
78
  field_config = _.concat({
79
79
  msg_key: "changed_field",
80
- msg_params: ["name", e.payload["name"]]
80
+ msg_params: ["name", e.payload["name"]],
81
81
  })(field_config);
82
82
 
83
83
  const { removed, added, changed } = content;
@@ -103,7 +103,7 @@ const getUpdateIngestDraftEvent = (e, templateFields, fieldsWithoutValue) => {
103
103
  removed,
104
104
  templateFields,
105
105
  fieldsWithoutValue
106
- )
106
+ ),
107
107
  ]),
108
108
  _.flatten
109
109
  )([]);
@@ -112,14 +112,14 @@ const getUpdateIngestDraftEvent = (e, templateFields, fieldsWithoutValue) => {
112
112
  return { ...e, payload: field_config };
113
113
  };
114
114
 
115
- const getIngestFieldEvent = e => {
115
+ const getIngestFieldEvent = (e) => {
116
116
  const msg_key = "ingest_field";
117
117
  const { system, group, structure, field } = e.payload.field;
118
118
  const msg_params = [system, group, structure, field];
119
119
  return { ...e, payload: [{ msg_key, msg_params }] };
120
120
  };
121
121
 
122
- const getEmptyPayloadEvent = e => ({ ...e, payload: [] });
122
+ const getEmptyPayloadEvent = (e) => ({ ...e, payload: [] });
123
123
 
124
124
  const getParsedEvents = createSelector(
125
125
  [getEvents, getTemplate],
@@ -131,18 +131,18 @@ const getParsedEvents = createSelector(
131
131
  )(template);
132
132
 
133
133
  const fieldsWithoutValue = _.flow(
134
- _.filter(f =>
134
+ _.filter((f) =>
135
135
  _.includes(_.prop("type")(f))([
136
136
  "enriched_text",
137
137
  "url",
138
138
  "table",
139
139
  "system",
140
- "image"
140
+ "image",
141
141
  ])
142
142
  ),
143
143
  _.map(_.prop("name"))
144
144
  )(templateFields);
145
- return _.map(e => {
145
+ return _.map((e) => {
146
146
  const { event } = e;
147
147
  if (event === "create_ingest_draft") {
148
148
  return getNewIngestDraftEvent(e);
@@ -4,11 +4,11 @@ import { getIngestTemplate } from "./getIngestTemplate";
4
4
 
5
5
  export const getTemplateFields = createSelector(
6
6
  [getIngestTemplate],
7
- template => {
7
+ (template) => {
8
8
  if (_.isArray(template)) {
9
- const fields = _.map(f => [
9
+ const fields = _.map((f) => [
10
10
  _.propOr("", "name", f),
11
- _.propOr("", "default", f)
11
+ _.propOr("", "default", f),
12
12
  ])(template);
13
13
  return _.fromPairs(fields);
14
14
  } else {
@@ -4,7 +4,7 @@ import { getIngestTemplate } from "./getIngestTemplate";
4
4
 
5
5
  export const getTemplateGroups = createSelector(
6
6
  [getIngestTemplate],
7
- template => {
7
+ (template) => {
8
8
  if (_.isArray(template)) {
9
9
  return _.toPairs(_.groupBy("group")(template));
10
10
  } else {
@@ -1,3 +1,4 @@
1
- export const translations = formatMessage => ({
2
- status: v => formatMessage({ id: `ingests.status.${v}`, defaultMessage: v })
1
+ export const translations = (formatMessage) => ({
2
+ status: (v) =>
3
+ formatMessage({ id: `ingests.status.${v}`, defaultMessage: v }),
3
4
  });
@@ -1,67 +0,0 @@
1
- import React from "react";
2
- import { shallowWithIntl } from "@truedat/test/intl-stub";
3
- import { IngestDuplicate } from "../IngestDuplicate";
4
-
5
- describe("<IngestDuplicate />", () => {
6
- const action = {};
7
- const applyTemplate = x => x;
8
- const domains = [
9
- { id: 1, name: "Domain1" },
10
- { id: 2, name: "Domain 2" }
11
- ];
12
- const ingestAction = jest.fn();
13
- const ingestActionLoading = "some action";
14
- const template = { id: 1, name: "template1" };
15
- const templateLoading = false;
16
- const ingest = {
17
- content: {},
18
- description: {},
19
- domain: {}
20
- };
21
- const selectDomain = jest.fn();
22
- const selectTemplate = jest.fn();
23
- const history = { goBack: jest.fn() };
24
-
25
- const props = {
26
- action,
27
- domains,
28
- ingestAction,
29
- ingestActionLoading,
30
- templateLoading,
31
- template,
32
- ingest,
33
- selectDomain,
34
- selectTemplate,
35
- history,
36
- applyTemplate
37
- };
38
- it("matches the latest snapshot", () => {
39
- const wrapper = shallowWithIntl(<IngestDuplicate {...props} />);
40
- expect(wrapper).toMatchSnapshot();
41
- });
42
-
43
- it("dispatch ingestAction when button submit is clicked", () => {
44
- const e = { preventDefault: jest.fn() };
45
- const wrapper = shallowWithIntl(<IngestDuplicate {...props} />);
46
- wrapper
47
- .find("Button")
48
- .first()
49
- .simulate("click", e);
50
- expect(ingestAction.mock.calls.length).toBe(1);
51
- });
52
-
53
- it("dispatches selectTemplate when component mounts", () => {
54
- shallowWithIntl(<IngestDuplicate {...props} />);
55
- expect(selectTemplate).toHaveBeenCalled();
56
- });
57
-
58
- it("sets name in state when name field changes", () => {
59
- const wrapper = shallowWithIntl(<IngestDuplicate {...props} />);
60
- const name = "name";
61
- const value = "newName";
62
- const e = { preventDefault: jest.fn() };
63
- wrapper.find({ name }).simulate("change", e, { name, value });
64
- expect(e.preventDefault.mock.calls.length).toBe(1);
65
- expect(wrapper.state(name)).toBe(value);
66
- });
67
- });
@@ -1,79 +0,0 @@
1
- import React from "react";
2
- import { shallowWithIntl } from "@truedat/test/intl-stub";
3
- import { IngestEdit } from "../IngestEdit";
4
-
5
- describe("<IngestEdit />", () => {
6
- const action = {};
7
- const applyTemplate = (x) => x;
8
- const ingestAction = jest.fn();
9
- const ingestActionLoading = "some action";
10
- const template = { id: 1, name: "template1" };
11
- const templateLoading = false;
12
- const ingest = {
13
- dynamic_content: {},
14
- description: {},
15
- domain: {},
16
- };
17
- const selectDomain = jest.fn();
18
- const selectTemplate = jest.fn();
19
- const history = { goBack: jest.fn() };
20
-
21
- const initProps = {
22
- action,
23
- ingestAction,
24
- ingestActionLoading,
25
- templateLoading,
26
- template,
27
- ingest,
28
- selectDomain,
29
- selectTemplate,
30
- history,
31
- applyTemplate,
32
- };
33
- it("matches the latest snapshot", () => {
34
- const wrapper = shallowWithIntl(<IngestEdit {...initProps} />);
35
- expect(wrapper).toMatchSnapshot();
36
- });
37
-
38
- it("dispatch ingestAction when button submit is clicked", () => {
39
- const e = { preventDefault: jest.fn() };
40
- const wrapper = shallowWithIntl(<IngestEdit {...initProps} />);
41
- wrapper.find("Button").first().simulate("click", e);
42
- expect(ingestAction.mock.calls.length).toBe(1);
43
- });
44
-
45
- it("dispatches selectTemplate when component mounts", () => {
46
- shallowWithIntl(<IngestEdit {...initProps} />);
47
- expect(selectTemplate).toHaveBeenCalled();
48
- });
49
-
50
- it("sets name in state when name field changes", () => {
51
- const wrapper = shallowWithIntl(<IngestEdit {...initProps} />);
52
- const name = "name";
53
- const value = "newName";
54
- const e = { preventDefault: jest.fn() };
55
- wrapper.find({ name }).simulate("change", e, { name, value });
56
- expect(wrapper.state(name)).toBe(value);
57
- });
58
-
59
- it("calls clearTemplate when it unmounts", () => {
60
- const clearTemplate = jest.fn();
61
- const props = {
62
- ...initProps,
63
- clearTemplate,
64
- };
65
- jest.spyOn(IngestEdit.prototype, "componentWillUnmount");
66
- const wrapper = shallowWithIntl(<IngestEdit {...props} />);
67
- expect(clearTemplate.mock.calls.length).toBe(0);
68
- wrapper.unmount();
69
- expect(IngestEdit.prototype.componentWillUnmount.mock.calls.length).toBe(1);
70
- expect(clearTemplate.mock.calls.length).toBe(1);
71
- });
72
-
73
- it("calls ingestAction when on submit", () => {
74
- const wrapper = shallowWithIntl(<IngestEdit {...initProps} />);
75
- const e = { preventDefault: jest.fn() };
76
- wrapper.find("Button").simulate("change", e);
77
- expect(ingestAction.mock.calls.length).toBe(1);
78
- });
79
- });
@@ -1,85 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<IngestDuplicate /> matches the latest snapshot 1`] = `
4
- <Container
5
- as={[Function]}
6
- text={true}
7
- >
8
- <Header
9
- as="h2"
10
- >
11
- <Icon
12
- as="i"
13
- name="share square"
14
- />
15
- <HeaderContent>
16
- <MemoizedFormattedMessage
17
- id="ingests.header.duplicate"
18
- />
19
- </HeaderContent>
20
- </Header>
21
- <lazy />
22
- <Form
23
- as="form"
24
- >
25
- <FormField
26
- required={true}
27
- >
28
- <label>
29
- ingests.props.name
30
- <Label
31
- pointing="left"
32
- >
33
- <MemoizedFormattedMessage
34
- id="template.form.validation.empty_required"
35
- />
36
- </Label>
37
- </label>
38
- <FormInput
39
- as={[Function]}
40
- control={[Function]}
41
- name="name"
42
- onChange={[Function]}
43
- value=""
44
- />
45
- </FormField>
46
- <FormField
47
- required={true}
48
- >
49
- <label>
50
- ingests.props.description
51
- <Label
52
- pointing="left"
53
- >
54
- <MemoizedFormattedMessage
55
- id="template.form.validation.empty_required"
56
- />
57
- </Label>
58
- </label>
59
- <injectIntl(RichTextEditor)
60
- name="description"
61
- onChange={[Function]}
62
- value={{}}
63
- />
64
- </FormField>
65
- <lazy
66
- content={{}}
67
- onChange={[Function]}
68
- />
69
- <Button
70
- as="button"
71
- content={
72
- <Memo(MemoizedFormattedMessage)
73
- id="ingests.actions.duplicate"
74
- />
75
- }
76
- disabled={true}
77
- onClick={[Function]}
78
- primary={true}
79
- />
80
- <HistoryBackButton
81
- content="actions.cancel"
82
- />
83
- </Form>
84
- </Container>
85
- `;
@@ -1,80 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<IngestEdit /> matches the latest snapshot 1`] = `
4
- <Container
5
- as={[Function]}
6
- text={true}
7
- >
8
- <Header
9
- as="h2"
10
- >
11
- <Icon
12
- as="i"
13
- name="share square"
14
- />
15
- <HeaderContent>
16
- <MemoizedFormattedMessage
17
- id="ingests.header.edit"
18
- />
19
- </HeaderContent>
20
- </Header>
21
- <lazy />
22
- <Form
23
- as="form"
24
- >
25
- <FormField
26
- required={true}
27
- >
28
- <label>
29
- ingests.props.name
30
- <Label
31
- pointing="left"
32
- >
33
- <MemoizedFormattedMessage
34
- id="template.form.validation.empty_required"
35
- />
36
- </Label>
37
- </label>
38
- <FormInput
39
- as={[Function]}
40
- control={[Function]}
41
- name="name"
42
- onChange={[Function]}
43
- />
44
- </FormField>
45
- <FormField
46
- required={true}
47
- >
48
- <label>
49
- ingests.props.description
50
- <Label
51
- pointing="left"
52
- >
53
- <MemoizedFormattedMessage
54
- id="template.form.validation.empty_required"
55
- />
56
- </Label>
57
- </label>
58
- <injectIntl(RichTextEditor)
59
- name="description"
60
- onChange={[Function]}
61
- value={{}}
62
- />
63
- </FormField>
64
- <lazy
65
- content={{}}
66
- onChange={[Function]}
67
- />
68
- <Button
69
- as="button"
70
- content="actions.save"
71
- disabled={true}
72
- onClick={[Function]}
73
- primary={true}
74
- />
75
- <HistoryBackButton
76
- content="actions.cancel"
77
- />
78
- </Form>
79
- </Container>
80
- `;