@truedat/ie 4.51.2 → 4.51.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/ie",
3
- "version": "4.51.2",
3
+ "version": "4.51.4",
4
4
  "description": "Truedat Web Ingests",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -34,7 +34,7 @@
34
34
  "@testing-library/jest-dom": "^5.16.4",
35
35
  "@testing-library/react": "^12.0.0",
36
36
  "@testing-library/user-event": "^13.2.1",
37
- "@truedat/test": "4.47.9",
37
+ "@truedat/test": "4.51.4",
38
38
  "babel-jest": "^28.1.0",
39
39
  "babel-plugin-dynamic-import-node": "^2.3.3",
40
40
  "babel-plugin-lodash": "^3.3.4",
@@ -87,8 +87,8 @@
87
87
  ]
88
88
  },
89
89
  "dependencies": {
90
- "@truedat/core": "4.51.2",
91
- "@truedat/df": "4.51.2",
90
+ "@truedat/core": "4.51.4",
91
+ "@truedat/df": "4.51.4",
92
92
  "file-saver": "^2.0.5",
93
93
  "moment": "^2.24.0",
94
94
  "path-to-regexp": "^1.7.0",
@@ -107,5 +107,5 @@
107
107
  "react-dom": ">= 16.8.6 < 17",
108
108
  "semantic-ui-react": ">= 0.88.2 < 2.1"
109
109
  },
110
- "gitHead": "9bdc76f3ee59a6e28fb2312e26d0cba2807f069b"
110
+ "gitHead": "d3e3af905c2330f5e4aaeeefc3549acaa19575f7"
111
111
  }
@@ -13,13 +13,13 @@ import {
13
13
  import { compose } from "redux";
14
14
  import { connect } from "react-redux";
15
15
  import { injectIntl, FormattedMessage } from "react-intl";
16
- import { HistoryBackButton, RichTextEditor } from "@truedat/core/components";
16
+ import {
17
+ DomainSelector,
18
+ HistoryBackButton,
19
+ RichTextEditor,
20
+ } from "@truedat/core/components";
17
21
  import { ingestAction } from "../routines";
18
22
 
19
- const DomainDropdownSelector = React.lazy(() =>
20
- import("@truedat/bg/taxonomy/components/DomainDropdownSelector")
21
- );
22
-
23
23
  const SelectableDynamicForm = React.lazy(() =>
24
24
  import("@truedat/df/components/SelectableDynamicForm")
25
25
  );
@@ -32,6 +32,7 @@ const initialState = {
32
32
  name: "",
33
33
  description: {},
34
34
  content: {},
35
+ domainsLoading: true,
35
36
  };
36
37
 
37
38
  const isNonEmptyString = _.flow(_.trim, _.negate(_.isEmpty));
@@ -53,7 +54,7 @@ export class IngestForm extends React.Component {
53
54
  state = initialState;
54
55
 
55
56
  handleDomainSelected = (_e, { value }) => {
56
- const domain_id = value;
57
+ const domain_id = value ? _.toInteger(value) : null;
57
58
 
58
59
  this.setState({ domain_id });
59
60
  };
@@ -71,6 +72,7 @@ export class IngestForm extends React.Component {
71
72
  };
72
73
 
73
74
  handleContentChange = ({ content }) => this.setState({ content });
75
+ handleDomainsLoaded = () => this.setState({ domainsLoading: false });
74
76
 
75
77
  isInvalid = () => _.negate(isValid)(this.state);
76
78
 
@@ -98,7 +100,8 @@ export class IngestForm extends React.Component {
98
100
  intl: { formatMessage },
99
101
  } = this.props;
100
102
 
101
- const { name, description, content, type, domain_id } = this.state;
103
+ const { name, description, content, type, domain_id, domainsLoading } =
104
+ this.state;
102
105
 
103
106
  const loading =
104
107
  action && action.href && ingestActionLoading === action.href;
@@ -111,10 +114,15 @@ export class IngestForm extends React.Component {
111
114
  <FormattedMessage id="ingests.actions.create" />
112
115
  </Header.Content>
113
116
  </Header>
114
- <Form loading={loading}>
115
- <DomainDropdownSelector
117
+ <Form loading={loading || domainsLoading}>
118
+ <DomainSelector
119
+ action="createIngest"
120
+ label={formatMessage({ id: "domain.selector.label" })}
121
+ labels
122
+ required
116
123
  onChange={this.handleDomainSelected}
117
- invalid={!_.isFinite(domain_id)}
124
+ onLoad={this.handleDomainsLoaded}
125
+ value={domain_id}
118
126
  />
119
127
  <Form.Field required>
120
128
  <label>
@@ -42,9 +42,6 @@ import IngestsLoader from "./IngestsLoader";
42
42
  const EventsLoader = React.lazy(() =>
43
43
  import("@truedat/audit/components/EventsLoader")
44
44
  );
45
- const DomainsLoader = React.lazy(() =>
46
- import("@truedat/bg/taxonomy/components/DomainsLoader")
47
- );
48
45
  const RelationTagsLoader = React.lazy(() =>
49
46
  import("@truedat/lm/components/RelationTagsLoader")
50
47
  );
@@ -90,7 +87,6 @@ const IngestRoutes = ({ ingestLoaded, ingest_id, templatesLoaded }) => {
90
87
  path={INGESTS_NEW}
91
88
  render={() => (
92
89
  <>
93
- <DomainsLoader actions="create_ingest" />
94
90
  <IngestCrumbs ingestAction="ingests.actions.create" />
95
91
  <IngestsLoader />
96
92
  <IngestForm />
@@ -1,15 +1,24 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
3
  import { waitFor } from "@testing-library/react";
4
- import { multipleTemplatesMock, singleTemplateMock } from "@truedat/test/mocks";
4
+ import userEvent from "@testing-library/user-event";
5
+ import {
6
+ multipleTemplatesMock,
7
+ singleTemplateMock,
8
+ domainsMock,
9
+ } from "@truedat/test/mocks";
5
10
  import IngestForm from "../IngestForm";
6
11
 
7
- const variables = { scope: "ie", domainIds: [1] };
12
+ const templateVariables = { scope: "ie", domainIds: [1] };
13
+ const domainVariables = { action: "createIngest" };
8
14
 
9
15
  describe("<IngestForm />", () => {
10
16
  describe("with multiple templates", () => {
11
17
  const renderOpts = {
12
- mocks: [multipleTemplatesMock(variables)],
18
+ mocks: [
19
+ multipleTemplatesMock(templateVariables),
20
+ domainsMock(domainVariables),
21
+ ],
13
22
  state: {
14
23
  ingestActions: { create: {} },
15
24
  ingestActionLoading: "",
@@ -30,8 +39,8 @@ describe("<IngestForm />", () => {
30
39
  expect(container).toMatchSnapshot();
31
40
  });
32
41
 
33
- it("contains a template selector", async () => {
34
- const { queryByText } = render(<IngestForm />, renderOpts);
42
+ it("contains a template selector if domain is selected", async () => {
43
+ const { queryByText, findByText } = render(<IngestForm />, renderOpts);
35
44
  await waitFor(
36
45
  () => expect(queryByText(/lazy/i)).not.toBeInTheDocument(),
37
46
  { timeout: 10000 }
@@ -39,13 +48,17 @@ describe("<IngestForm />", () => {
39
48
  await waitFor(() =>
40
49
  expect(queryByText(/loading/i)).not.toBeInTheDocument()
41
50
  );
42
- expect(queryByText("template1")).toBeInTheDocument();
51
+ userEvent.click(await findByText("fooDomain"));
52
+ await waitFor(() => expect(queryByText("template1")).toBeInTheDocument());
43
53
  });
44
54
  });
45
55
 
46
56
  describe("with a single template", () => {
47
57
  const renderOpts = {
48
- mocks: [singleTemplateMock(variables)],
58
+ mocks: [
59
+ singleTemplateMock(templateVariables),
60
+ domainsMock(domainVariables),
61
+ ],
49
62
  state: {
50
63
  ingestActions: { create: {} },
51
64
  ingestActionLoading: "",
@@ -28,55 +28,80 @@ exports[`<IngestForm /> with a single template matches the latest snapshot 1`] =
28
28
  Domain
29
29
  </label>
30
30
  <div
31
- class="field"
31
+ aria-expanded="false"
32
+ aria-multiselectable="false"
33
+ class="ui floating dropdown"
34
+ required=""
35
+ role="listbox"
36
+ tabindex="0"
32
37
  >
38
+ <label>
39
+ Select a domain...
40
+ </label>
41
+ <i
42
+ aria-hidden="true"
43
+ class="dropdown icon"
44
+ />
33
45
  <div
34
- aria-expanded="false"
35
- class="ui fluid search selection dropdown"
36
- name="domain"
37
- role="combobox"
46
+ class="menu transition"
38
47
  >
39
- <input
40
- aria-autocomplete="list"
41
- autocomplete="off"
42
- class="search"
43
- tabindex="0"
44
- type="text"
45
- value=""
46
- />
47
48
  <div
48
- aria-atomic="true"
49
- aria-live="polite"
50
- class="divider text"
51
- role="alert"
49
+ class="ui left icon input search"
52
50
  >
53
- domain1
51
+ <input
52
+ type="text"
53
+ />
54
+ <i
55
+ aria-hidden="true"
56
+ class="search icon"
57
+ />
54
58
  </div>
55
- <i
56
- aria-hidden="true"
57
- class="dropdown icon"
58
- />
59
59
  <div
60
- aria-multiselectable="false"
61
- class="menu transition"
62
- role="listbox"
60
+ class="scrolling menu transition"
63
61
  >
64
62
  <div
65
- aria-checked="true"
66
- aria-selected="true"
67
- class="active selected item"
63
+ aria-selected="false"
64
+ class="item"
65
+ role="option"
66
+ >
67
+ <div
68
+ style="margin-left: 0px;"
69
+ >
70
+ <i
71
+ aria-hidden="true"
72
+ class="plus icon"
73
+ />
74
+ barDomain
75
+ </div>
76
+ </div>
77
+ <div
78
+ aria-selected="false"
79
+ class="item"
68
80
  role="option"
69
- style="pointer-events: all;"
70
81
  >
71
82
  <div
72
- class="text"
73
83
  style="margin-left: 0px;"
74
84
  >
75
85
  <i
76
86
  aria-hidden="true"
77
87
  class="icon"
78
88
  />
79
- domain1
89
+ bazDomain
90
+ </div>
91
+ </div>
92
+ <div
93
+ aria-selected="false"
94
+ class="item"
95
+ role="option"
96
+ >
97
+ <div
98
+ style="margin-left: 0px;"
99
+ >
100
+ <i
101
+ aria-hidden="true"
102
+ class="icon"
103
+ />
104
+ fooDomain
80
105
  </div>
81
106
  </div>
82
107
  </div>
@@ -198,23 +223,23 @@ exports[`<IngestForm /> with a single template matches the latest snapshot 1`] =
198
223
  autocorrect="on"
199
224
  contenteditable="true"
200
225
  data-gramm="false"
201
- data-key="9"
226
+ data-key="8"
202
227
  data-slate-editor="true"
203
228
  role="textbox"
204
229
  spellcheck="true"
205
230
  style="outline: none; white-space: pre-wrap; word-wrap: break-word;"
206
231
  >
207
232
  <div
208
- data-key="10"
233
+ data-key="9"
209
234
  data-slate-object="block"
210
235
  style="position: relative;"
211
236
  >
212
237
  <span
213
- data-key="13"
238
+ data-key="11"
214
239
  data-slate-object="text"
215
240
  >
216
241
  <span
217
- data-offset-key="13:0"
242
+ data-offset-key="11:0"
218
243
  data-slate-leaf="true"
219
244
  >
220
245
  <span>
@@ -238,35 +263,6 @@ exports[`<IngestForm /> with a single template matches the latest snapshot 1`] =
238
263
  </div>
239
264
  </div>
240
265
  </div>
241
- <div
242
- class="ui segment"
243
- >
244
- <h4
245
- class="ui header"
246
- >
247
- g1
248
- </h4>
249
- <div
250
- class="field"
251
- >
252
- <label>
253
- field1
254
- </label>
255
- <div
256
- class="field"
257
- >
258
- <div
259
- class="ui input"
260
- >
261
- <input
262
- name="field1"
263
- type="text"
264
- value=""
265
- />
266
- </div>
267
- </div>
268
- </div>
269
- </div>
270
266
  <div
271
267
  class="actions"
272
268
  >
@@ -319,55 +315,80 @@ exports[`<IngestForm /> with multiple templates matches the latest snapshot 1`]
319
315
  Domain
320
316
  </label>
321
317
  <div
322
- class="field"
318
+ aria-expanded="false"
319
+ aria-multiselectable="false"
320
+ class="ui floating dropdown"
321
+ required=""
322
+ role="listbox"
323
+ tabindex="0"
323
324
  >
325
+ <label>
326
+ Select a domain...
327
+ </label>
328
+ <i
329
+ aria-hidden="true"
330
+ class="dropdown icon"
331
+ />
324
332
  <div
325
- aria-expanded="false"
326
- class="ui fluid search selection dropdown"
327
- name="domain"
328
- role="combobox"
333
+ class="menu transition"
329
334
  >
330
- <input
331
- aria-autocomplete="list"
332
- autocomplete="off"
333
- class="search"
334
- tabindex="0"
335
- type="text"
336
- value=""
337
- />
338
335
  <div
339
- aria-atomic="true"
340
- aria-live="polite"
341
- class="divider text"
342
- role="alert"
336
+ class="ui left icon input search"
343
337
  >
344
- domain1
338
+ <input
339
+ type="text"
340
+ />
341
+ <i
342
+ aria-hidden="true"
343
+ class="search icon"
344
+ />
345
345
  </div>
346
- <i
347
- aria-hidden="true"
348
- class="dropdown icon"
349
- />
350
346
  <div
351
- aria-multiselectable="false"
352
- class="menu transition"
353
- role="listbox"
347
+ class="scrolling menu transition"
354
348
  >
355
349
  <div
356
- aria-checked="true"
357
- aria-selected="true"
358
- class="active selected item"
350
+ aria-selected="false"
351
+ class="item"
352
+ role="option"
353
+ >
354
+ <div
355
+ style="margin-left: 0px;"
356
+ >
357
+ <i
358
+ aria-hidden="true"
359
+ class="plus icon"
360
+ />
361
+ barDomain
362
+ </div>
363
+ </div>
364
+ <div
365
+ aria-selected="false"
366
+ class="item"
367
+ role="option"
368
+ >
369
+ <div
370
+ style="margin-left: 0px;"
371
+ >
372
+ <i
373
+ aria-hidden="true"
374
+ class="icon"
375
+ />
376
+ bazDomain
377
+ </div>
378
+ </div>
379
+ <div
380
+ aria-selected="false"
381
+ class="item"
359
382
  role="option"
360
- style="pointer-events: all;"
361
383
  >
362
384
  <div
363
- class="text"
364
385
  style="margin-left: 0px;"
365
386
  >
366
387
  <i
367
388
  aria-hidden="true"
368
389
  class="icon"
369
390
  />
370
- domain1
391
+ fooDomain
371
392
  </div>
372
393
  </div>
373
394
  </div>
@@ -529,81 +550,6 @@ exports[`<IngestForm /> with multiple templates matches the latest snapshot 1`]
529
550
  </div>
530
551
  </div>
531
552
  </div>
532
- <div
533
- class="required field"
534
- >
535
- <label>
536
- Template
537
- <div
538
- class="ui left pointing label"
539
- >
540
- Empty required field
541
- </div>
542
- </label>
543
- <div
544
- class="field"
545
- >
546
- <div
547
- aria-busy="false"
548
- aria-expanded="false"
549
- class="ui search selection dropdown"
550
- name="template"
551
- role="combobox"
552
- >
553
- <input
554
- aria-autocomplete="list"
555
- autocomplete="off"
556
- class="search"
557
- tabindex="0"
558
- type="text"
559
- value=""
560
- />
561
- <div
562
- aria-atomic="true"
563
- aria-live="polite"
564
- class="divider default text"
565
- role="alert"
566
- >
567
- Select a template...
568
- </div>
569
- <i
570
- aria-hidden="true"
571
- class="dropdown icon"
572
- />
573
- <div
574
- class="menu transition"
575
- role="listbox"
576
- >
577
- <div
578
- aria-checked="false"
579
- aria-selected="true"
580
- class="selected item"
581
- role="option"
582
- style="pointer-events: all;"
583
- >
584
- <span
585
- class="text"
586
- >
587
- template1
588
- </span>
589
- </div>
590
- <div
591
- aria-checked="false"
592
- aria-selected="false"
593
- class="item"
594
- role="option"
595
- style="pointer-events: all;"
596
- >
597
- <span
598
- class="text"
599
- >
600
- template2
601
- </span>
602
- </div>
603
- </div>
604
- </div>
605
- </div>
606
- </div>
607
553
  <div
608
554
  class="actions"
609
555
  >