@truedat/cx 4.44.0 → 4.44.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/cx",
3
- "version": "4.44.0",
3
+ "version": "4.44.3",
4
4
  "description": "Truedat Web Connectors",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -31,7 +31,7 @@
31
31
  "@babel/plugin-transform-modules-commonjs": "^7.15.0",
32
32
  "@babel/preset-env": "^7.15.0",
33
33
  "@babel/preset-react": "^7.14.5",
34
- "@truedat/test": "4.44.0",
34
+ "@truedat/test": "4.44.3",
35
35
  "babel-jest": "^27.0.6",
36
36
  "babel-plugin-dynamic-import-node": "^2.3.3",
37
37
  "babel-plugin-lodash": "^3.3.4",
@@ -85,7 +85,7 @@
85
85
  ]
86
86
  },
87
87
  "dependencies": {
88
- "@truedat/core": "4.44.0",
88
+ "@truedat/core": "4.44.3",
89
89
  "lodash": "^4.17.21",
90
90
  "match-sorter": "^6.3.1",
91
91
  "path-to-regexp": "^1.7.0",
@@ -103,5 +103,5 @@
103
103
  "react-dom": ">= 16.8.6 < 17",
104
104
  "semantic-ui-react": ">= 0.88.2 < 2.1"
105
105
  },
106
- "gitHead": "55fd4a8be70ca0d1bd4f3cb7b5eaf073b0350029"
106
+ "gitHead": "d5e72d523389c6e66d6f7168d7e3546b5d2ffdda"
107
107
  }
@@ -1,13 +1,13 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState, useEffect } from "react";
2
+ import React, { useState, useEffect, Suspense } from "react";
3
3
  import PropTypes from "prop-types";
4
- import { useSelector, useDispatch } from "react-redux";
4
+ import { connect } from "react-redux";
5
5
  import { Button, Form, Label } from "semantic-ui-react";
6
6
  import { useIntl, FormattedMessage } from "react-intl";
7
7
  import { HistoryBackButton } from "@truedat/core/components";
8
8
  import {
9
9
  applyTemplate as applyTemplateGenerator,
10
- validateContent
10
+ validateContent,
11
11
  } from "@truedat/df/utils";
12
12
  import { selectTemplate } from "@truedat/df/routines";
13
13
 
@@ -24,16 +24,19 @@ const isNonEmptyString = _.flow(_.trim, _.negate(_.isEmpty));
24
24
  const isValid = _.conforms({
25
25
  external_id: isNonEmptyString,
26
26
  type: isNonEmptyString,
27
- contentErrors: isEmptyArray
27
+ contentErrors: isEmptyArray,
28
28
  });
29
29
 
30
- const ConfigurationForm = ({ configuration, handleSubmit }) => {
31
- const dispatch = useDispatch();
30
+ const ConfigurationForm = ({
31
+ configuration,
32
+ handleSubmit,
33
+ selectTemplate,
34
+ template,
35
+ templates,
36
+ templatesLoading,
37
+ }) => {
32
38
  const [formState, setFormState] = useState(configuration || {});
33
39
  const { formatMessage } = useIntl();
34
- const { template, templates, templatesLoading } = useSelector(
35
- _.pick(["template", "templatesLoading", "templates"])
36
- );
37
40
  const applyTemplate = applyTemplateGenerator(template);
38
41
  const { external_id, type, content } = formState;
39
42
 
@@ -44,11 +47,11 @@ const ConfigurationForm = ({ configuration, handleSubmit }) => {
44
47
  ...formState,
45
48
  type: _.prop("name")(template),
46
49
  content: newContent,
47
- contentErrors: validateContent(template)(content)
50
+ contentErrors: validateContent(template)(content),
48
51
  });
49
52
  }
50
53
  // eslint-disable-next-line react-hooks/exhaustive-deps
51
- }, [_.get("id")(template)]);
54
+ }, [template]);
52
55
 
53
56
  useEffect(() => {
54
57
  const configurationType = _.get("type")(configuration);
@@ -58,34 +61,34 @@ const ConfigurationForm = ({ configuration, handleSubmit }) => {
58
61
  _.get("id")
59
62
  )(templates);
60
63
  if (!_.isNil(currentTemplateId))
61
- dispatch(selectTemplate({ id: currentTemplateId }));
64
+ selectTemplate({ id: currentTemplateId });
62
65
  }
63
66
  // eslint-disable-next-line react-hooks/exhaustive-deps
64
67
  }, [configuration]);
65
68
 
66
- const typeOptions = templates.map(({ name, id }, i) => ({
67
- key: i,
69
+ const typeOptions = _.map(({ name, id }) => ({
70
+ key: id,
68
71
  value: id,
69
- text: name
70
- }));
72
+ text: name,
73
+ }))(templates);
71
74
 
72
75
  const handleExternalIdChange = (e, { value: external_id }) => {
73
76
  e && e.preventDefault();
74
77
  setFormState({ ...formState, external_id });
75
78
  };
76
- const handleContentChange = content => {
79
+ const handleContentChange = (content) => {
77
80
  const contentErrors = validateContent(template)(content);
78
81
  setFormState({ ...formState, content, contentErrors });
79
82
  };
80
83
 
81
84
  const handleTemplateSelected = (e, data) => {
82
85
  const { value } = data;
83
- dispatch(selectTemplate({ id: value }));
86
+ selectTemplate({ id: value });
84
87
  };
85
88
 
86
89
  const isInvalid = () => _.negate(isValid)(formState);
87
90
 
88
- const doHandleSubmit = e => {
91
+ const doHandleSubmit = (e) => {
89
92
  e.preventDefault();
90
93
  const newConfiguration = _.pick(["external_id", "type"])(formState);
91
94
  const appliedContent = _.flow(_.prop("content"), applyTemplate)(formState);
@@ -93,8 +96,8 @@ const ConfigurationForm = ({ configuration, handleSubmit }) => {
93
96
  handleSubmit({
94
97
  configuration: {
95
98
  ...newConfiguration,
96
- content: appliedContent
97
- }
99
+ content: appliedContent,
100
+ },
98
101
  });
99
102
  };
100
103
 
@@ -116,11 +119,11 @@ const ConfigurationForm = ({ configuration, handleSubmit }) => {
116
119
  />
117
120
  </Form.Field>
118
121
  <Form.Field required>
119
- <label>{formatMessage({ id: "type.selector.label" })}</label>
122
+ <label>
123
+ <FormattedMessage id="type.selector.label" />
124
+ </label>
120
125
  <Form.Dropdown
121
- placeholder={formatMessage({
122
- id: "type.selector.placeholder"
123
- })}
126
+ placeholder={formatMessage({ id: "type.selector.placeholder" })}
124
127
  name="type"
125
128
  search
126
129
  selection
@@ -136,12 +139,12 @@ const ConfigurationForm = ({ configuration, handleSubmit }) => {
136
139
  {type && !templatesLoading && (
137
140
  <Form.Field>
138
141
  <label className="label">
139
- {formatMessage({ id: "configuration.content.label" })}
142
+ <FormattedMessage id="configuration.content.label" />
140
143
  </label>
141
- <>
144
+ <Suspense fallback={null}>
142
145
  <TemplateLoader />
143
146
  <DynamicForm onChange={handleContentChange} content={content} />
144
- </>
147
+ </Suspense>
145
148
  </Form.Field>
146
149
  )}
147
150
  <div className="actions">
@@ -163,6 +166,17 @@ const ConfigurationForm = ({ configuration, handleSubmit }) => {
163
166
 
164
167
  ConfigurationForm.propTypes = {
165
168
  configuration: PropTypes.object,
166
- handleSubmit: PropTypes.func
169
+ handleSubmit: PropTypes.func,
170
+ selectTemplate: PropTypes.func,
171
+ template: PropTypes.object,
172
+ templates: PropTypes.array,
173
+ templatesLoading: PropTypes.bool,
167
174
  };
168
- export default ConfigurationForm;
175
+
176
+ export const mapStateToProps = ({ template, templates, templatesLoading }) => ({
177
+ template,
178
+ templates,
179
+ templatesLoading,
180
+ });
181
+
182
+ export default connect(mapStateToProps, { selectTemplate })(ConfigurationForm);
@@ -1,7 +1,6 @@
1
- import _ from "lodash/fp";
2
1
  import React from "react";
3
- import { useDispatch, useSelector } from "react-redux";
4
- import { bindActionCreators } from "redux";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
5
4
  import { Container, Header, Icon, Segment } from "semantic-ui-react";
6
5
  import { FormattedMessage, useIntl } from "react-intl";
7
6
  import { Loading } from "@truedat/core/components";
@@ -9,17 +8,12 @@ import { updateConfiguration } from "../routines";
9
8
  import ConfigurationBreadcrumbs from "./ConfigurationBreadcrumbs";
10
9
  import ConfigurationForm from "./ConfigurationForm";
11
10
 
12
- export default () => {
13
- const dispatch = useDispatch();
11
+ export const EditConfiguration = ({
12
+ configuration,
13
+ configurationLoading,
14
+ updateConfiguration,
15
+ }) => {
14
16
  const { formatMessage } = useIntl();
15
- const { update } = bindActionCreators(
16
- { update: updateConfiguration },
17
- dispatch
18
- );
19
-
20
- const { configuration, configurationLoading } = useSelector(
21
- _.pick(["configuration", "configurationLoading"])
22
- );
23
17
 
24
18
  return configurationLoading ? (
25
19
  <Loading />
@@ -37,9 +31,24 @@ export default () => {
37
31
  </Header>
38
32
  <ConfigurationForm
39
33
  configuration={configuration}
40
- handleSubmit={update}
34
+ onSubmit={updateConfiguration}
41
35
  />
42
36
  </Container>
43
37
  </>
44
38
  );
45
39
  };
40
+
41
+ EditConfiguration.propTypes = {
42
+ configuration: PropTypes.object,
43
+ configurationLoading: PropTypes.bool,
44
+ updateConfiguration: PropTypes.func,
45
+ };
46
+
47
+ export const mapStateToProps = ({ configurationLoading, configuration }) => ({
48
+ loading: configurationLoading,
49
+ configuration,
50
+ });
51
+
52
+ export default connect(mapStateToProps, { updateConfiguration })(
53
+ EditConfiguration
54
+ );
@@ -1,19 +1,14 @@
1
1
  import React from "react";
2
- import { useDispatch } from "react-redux";
3
- import { bindActionCreators } from "redux";
2
+ import PropTypes from "prop-types";
3
+ import { connect } from "react-redux";
4
4
  import { Container, Header, Icon, Segment } from "semantic-ui-react";
5
5
  import { FormattedMessage, useIntl } from "react-intl";
6
6
  import { createConfiguration } from "../routines";
7
7
  import ConfigurationBreadcrumbs from "./ConfigurationBreadcrumbs";
8
8
  import ConfigurationForm from "./ConfigurationForm";
9
9
 
10
- export default () => {
11
- const dispatch = useDispatch();
10
+ export const NewConfiguration = ({ createConfiguration }) => {
12
11
  const { formatMessage } = useIntl();
13
- const { create } = bindActionCreators(
14
- { create: createConfiguration },
15
- dispatch
16
- );
17
12
 
18
13
  return (
19
14
  <>
@@ -27,8 +22,14 @@ export default () => {
27
22
  <FormattedMessage id="configurations.actions.create" />
28
23
  </Header.Content>
29
24
  </Header>
30
- <ConfigurationForm handleSubmit={create} />
25
+ <ConfigurationForm onSubmit={createConfiguration} />
31
26
  </Container>
32
27
  </>
33
28
  );
34
29
  };
30
+
31
+ NewConfiguration.propTypes = {
32
+ createConfiguration: PropTypes.func,
33
+ };
34
+
35
+ export default connect(null, { createConfiguration })(NewConfiguration);
@@ -1,16 +1,9 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { intl } from "@truedat/test/intl-stub";
2
+ import { render } from "@truedat/test/render";
4
3
  import ConfigurationForm from "../ConfigurationForm";
5
4
 
6
- // workaround for enzyme issue with React.useContext
7
- // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
8
- jest.spyOn(React, "useContext").mockImplementation(() => intl);
9
-
10
- jest.mock("react-redux", () => ({
11
- ...jest.requireActual("react-redux"),
12
- useDispatch: jest.fn(),
13
- useSelector: jest.fn(() => ({
5
+ const renderOpts = {
6
+ state: {
14
7
  templates: [
15
8
  {
16
9
  content: [
@@ -22,37 +15,37 @@ jest.mock("react-redux", () => ({
22
15
  name: "new_field",
23
16
  type: "string",
24
17
  values: null,
25
- widget: "string"
26
- }
18
+ widget: "string",
19
+ },
27
20
  ],
28
21
  is_secret: false,
29
- name: ""
30
- }
22
+ name: "",
23
+ },
31
24
  ],
32
25
  id: 1,
33
26
  label: "test_config",
34
27
  name: "test_config",
35
- scope: "ca"
36
- }
28
+ scope: "ca",
29
+ },
37
30
  ],
38
31
  template: null,
39
- templatesLoading: false
40
- }))
41
- }));
32
+ templatesLoading: false,
33
+ },
34
+ };
42
35
 
43
36
  describe("<ConfigurationForm />", () => {
44
- const handleSubmit = jest.fn();
37
+ const onSubmit = jest.fn();
45
38
  const configuration = {
46
39
  external_id: "ext1",
47
40
  type: "test_config",
48
41
  content: {
49
- new_field: "value"
50
- }
42
+ new_field: "value",
43
+ },
51
44
  };
52
- const props = { handleSubmit, configuration };
45
+ const props = { onSubmit, configuration };
53
46
 
54
47
  it("matches the latest snapshot", () => {
55
- const wrapper = shallow(<ConfigurationForm {...props} />);
56
- expect(wrapper).toMatchSnapshot();
48
+ const { container } = render(<ConfigurationForm {...props} />, renderOpts);
49
+ expect(container).toMatchSnapshot();
57
50
  });
58
51
  });
@@ -1,24 +1,17 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { intl } from "@truedat/test/intl-stub";
2
+ import { render } from "@truedat/test/render";
4
3
  import EditConfiguration from "../EditConfiguration";
5
4
 
6
- // workaround for enzyme issue with React.useContext
7
- // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
8
- jest.spyOn(React, "useContext").mockImplementation(() => intl);
9
-
10
- jest.mock("react-redux", () => ({
11
- ...jest.requireActual("react-redux"),
12
- useDispatch: jest.fn(),
13
- useSelector: jest.fn(() => ({
5
+ const renderOpts = {
6
+ state: {
14
7
  configuration: { id: 1, type: "config", content: { field: "foo" } },
15
- configurationLoading: false
16
- }))
17
- }));
8
+ configurationLoading: false,
9
+ },
10
+ };
18
11
 
19
12
  describe("<EditConfiguration />", () => {
20
13
  it("matches the latest snapshot", () => {
21
- const wrapper = shallow(<EditConfiguration />);
22
- expect(wrapper).toMatchSnapshot();
14
+ const { container } = render(<EditConfiguration />, renderOpts);
15
+ expect(container).toMatchSnapshot();
23
16
  });
24
17
  });
@@ -1,23 +1,13 @@
1
1
  import React from "react";
2
- import { shallow } from "enzyme";
3
- import { intl } from "@truedat/test/intl-stub";
2
+ import { render } from "@truedat/test/render";
4
3
  import NewConfiguration from "../NewConfiguration";
5
4
 
6
- // workaround for enzyme issue with React.useContext
7
- // see https://github.com/airbnb/enzyme/issues/2176#issuecomment-532361526
8
- jest.spyOn(React, "useContext").mockImplementation(() => intl);
9
-
10
- jest.mock("react-redux", () => ({
11
- ...jest.requireActual("react-redux"),
12
- useDispatch: jest.fn()
13
- }));
14
-
15
5
  describe("<NewConfiguration />", () => {
16
6
  const createConfiguration = jest.fn();
17
7
  const props = { createConfiguration };
18
8
 
19
9
  it("matches the latest snapshot", () => {
20
- const wrapper = shallow(<NewConfiguration {...props} />);
21
- expect(wrapper).toMatchSnapshot();
10
+ const { container } = render(<NewConfiguration {...props} />);
11
+ expect(container).toMatchSnapshot();
22
12
  });
23
13
  });
@@ -1,84 +1,117 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<ConfigurationForm /> matches the latest snapshot 1`] = `
4
- <Form
5
- as="form"
6
- >
7
- <FormField
8
- required={true}
4
+ <div>
5
+ <form
6
+ class="ui form"
9
7
  >
10
- <label>
11
- configuration.props.external_id
12
- </label>
13
- <FormInput
14
- as={[Function]}
15
- control={[Function]}
16
- disabled={true}
17
- onChange={[Function]}
18
- value="ext1"
19
- />
20
- </FormField>
21
- <FormField
22
- required={true}
23
- >
24
- <label>
25
- type.selector.label
26
- </label>
27
- <FormDropdown
28
- as={[Function]}
29
- control={[Function]}
30
- disabled={true}
31
- loading={false}
32
- name="type"
33
- onChange={[Function]}
34
- options={
35
- Array [
36
- Object {
37
- "key": 0,
38
- "text": "test_config",
39
- "value": 1,
40
- },
41
- ]
42
- }
43
- placeholder="type.selector.placeholder"
44
- required={true}
45
- search={true}
46
- selection={true}
47
- />
48
- </FormField>
49
- <FormField>
50
- <label
51
- className="label"
8
+ <div
9
+ class="required field"
52
10
  >
53
- configuration.content.label
54
- </label>
55
- <lazy />
56
- <lazy
57
- content={
58
- Object {
59
- "new_field": "value",
60
- }
61
- }
62
- onChange={[Function]}
63
- />
64
- </FormField>
65
- <div
66
- className="actions"
67
- >
68
- <HistoryBackButton
69
- content="actions.cancel"
70
- />
71
- <Button
72
- as="button"
73
- content={
74
- <Memo(MemoizedFormattedMessage)
75
- id="actions.save"
76
- />
77
- }
78
- disabled={true}
79
- onClick={[Function]}
80
- primary={true}
81
- />
82
- </div>
83
- </Form>
11
+ <label>
12
+ Id Externo
13
+ </label>
14
+ <div
15
+ class="disabled field"
16
+ >
17
+ <div
18
+ class="ui disabled input"
19
+ >
20
+ <input
21
+ disabled=""
22
+ tabindex="-1"
23
+ type="text"
24
+ value="ext1"
25
+ />
26
+ </div>
27
+ </div>
28
+ </div>
29
+ <div
30
+ class="required field"
31
+ >
32
+ <label>
33
+ Type
34
+ </label>
35
+ <div
36
+ class="disabled required field"
37
+ >
38
+ <div
39
+ aria-busy="false"
40
+ aria-disabled="true"
41
+ aria-expanded="false"
42
+ class="ui disabled search selection dropdown"
43
+ name="type"
44
+ required=""
45
+ role="combobox"
46
+ >
47
+ <input
48
+ aria-autocomplete="list"
49
+ autocomplete="off"
50
+ class="search"
51
+ tabindex="-1"
52
+ type="text"
53
+ value=""
54
+ />
55
+ <div
56
+ aria-atomic="true"
57
+ aria-live="polite"
58
+ class="divider default text"
59
+ role="alert"
60
+ >
61
+ Source type (template)
62
+ </div>
63
+ <i
64
+ aria-hidden="true"
65
+ class="dropdown icon"
66
+ />
67
+ <div
68
+ class="menu transition"
69
+ role="listbox"
70
+ >
71
+ <div
72
+ aria-checked="false"
73
+ aria-selected="true"
74
+ class="selected item"
75
+ role="option"
76
+ style="pointer-events: all;"
77
+ >
78
+ <span
79
+ class="text"
80
+ >
81
+ test_config
82
+ </span>
83
+ </div>
84
+ </div>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ <div
89
+ class="field"
90
+ >
91
+ <label
92
+ class="label"
93
+ >
94
+ Content
95
+ </label>
96
+ </div>
97
+ <div
98
+ class="actions"
99
+ >
100
+ <a
101
+ class="ui secondary button"
102
+ href="/"
103
+ role="button"
104
+ >
105
+ Cancel
106
+ </a>
107
+ <button
108
+ class="ui primary disabled button"
109
+ disabled=""
110
+ tabindex="-1"
111
+ >
112
+ Save
113
+ </button>
114
+ </div>
115
+ </form>
116
+ </div>
84
117
  `;
@@ -1,39 +1,149 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<EditConfiguration /> matches the latest snapshot 1`] = `
4
- <Fragment>
5
- <ConfigurationBreadcrumbs
6
- text="configurations.actions.update"
7
- />
8
- <Container
9
- as={[Function]}
10
- text={true}
4
+ <div>
5
+ <div
6
+ class="ui breadcrumb"
11
7
  >
12
- <Header
13
- as="h2"
8
+ <a
9
+ class="section"
10
+ href="/configurations"
14
11
  >
15
- <Icon
16
- as="i"
17
- name="plug"
18
- />
19
- <HeaderContent>
20
- <MemoizedFormattedMessage
21
- id="configurations.actions.update"
22
- />
23
- </HeaderContent>
24
- </Header>
25
- <ConfigurationForm
26
- configuration={
27
- Object {
28
- "content": Object {
29
- "field": "foo",
30
- },
31
- "id": 1,
32
- "type": "config",
33
- }
34
- }
35
- handleSubmit={[Function]}
12
+ Configurations
13
+ </a>
14
+ <i
15
+ aria-hidden="true"
16
+ class="right angle icon divider"
36
17
  />
37
- </Container>
38
- </Fragment>
18
+ <div
19
+ class="active section"
20
+ >
21
+ Update Configuration
22
+ </div>
23
+ </div>
24
+ <div
25
+ class="ui segment ui text container"
26
+ >
27
+ <h2
28
+ class="ui header"
29
+ >
30
+ <i
31
+ aria-hidden="true"
32
+ class="plug icon"
33
+ />
34
+ <div
35
+ class="content"
36
+ >
37
+ Update Configuration
38
+ </div>
39
+ </h2>
40
+ <form
41
+ class="ui form"
42
+ >
43
+ <div
44
+ class="required field"
45
+ >
46
+ <label>
47
+ Id Externo
48
+ <div
49
+ class="ui left pointing label"
50
+ >
51
+ Empty required field
52
+ </div>
53
+ </label>
54
+ <div
55
+ class="disabled field"
56
+ >
57
+ <div
58
+ class="ui disabled input"
59
+ >
60
+ <input
61
+ disabled=""
62
+ tabindex="-1"
63
+ type="text"
64
+ value=""
65
+ />
66
+ </div>
67
+ </div>
68
+ </div>
69
+ <div
70
+ class="required field"
71
+ >
72
+ <label>
73
+ Type
74
+ </label>
75
+ <div
76
+ class="disabled required field"
77
+ >
78
+ <div
79
+ aria-disabled="true"
80
+ aria-expanded="false"
81
+ class="ui disabled search selection dropdown"
82
+ name="type"
83
+ required=""
84
+ role="combobox"
85
+ >
86
+ <input
87
+ aria-autocomplete="list"
88
+ autocomplete="off"
89
+ class="search"
90
+ tabindex="-1"
91
+ type="text"
92
+ value=""
93
+ />
94
+ <div
95
+ aria-atomic="true"
96
+ aria-live="polite"
97
+ class="divider default text"
98
+ role="alert"
99
+ >
100
+ Source type (template)
101
+ </div>
102
+ <i
103
+ aria-hidden="true"
104
+ class="dropdown icon"
105
+ />
106
+ <div
107
+ class="menu transition"
108
+ role="listbox"
109
+ >
110
+ <div
111
+ class="message"
112
+ >
113
+ No results found.
114
+ </div>
115
+ </div>
116
+ </div>
117
+ </div>
118
+ </div>
119
+ <div
120
+ class="field"
121
+ >
122
+ <label
123
+ class="label"
124
+ >
125
+ Content
126
+ </label>
127
+ </div>
128
+ <div
129
+ class="actions"
130
+ >
131
+ <a
132
+ class="ui secondary button"
133
+ href="/"
134
+ role="button"
135
+ >
136
+ Cancel
137
+ </a>
138
+ <button
139
+ class="ui primary disabled button"
140
+ disabled=""
141
+ tabindex="-1"
142
+ >
143
+ Save
144
+ </button>
145
+ </div>
146
+ </form>
147
+ </div>
148
+ </div>
39
149
  `;
@@ -1,30 +1,138 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`<NewConfiguration /> matches the latest snapshot 1`] = `
4
- <Fragment>
5
- <ConfigurationBreadcrumbs
6
- text="configurations.actions.create"
7
- />
8
- <Container
9
- as={[Function]}
10
- text={true}
4
+ <div>
5
+ <div
6
+ class="ui breadcrumb"
11
7
  >
12
- <Header
13
- as="h2"
8
+ <a
9
+ class="section"
10
+ href="/configurations"
14
11
  >
15
- <Icon
16
- as="i"
17
- name="plug"
18
- />
19
- <HeaderContent>
20
- <MemoizedFormattedMessage
21
- id="configurations.actions.create"
22
- />
23
- </HeaderContent>
24
- </Header>
25
- <ConfigurationForm
26
- handleSubmit={[Function]}
12
+ Configurations
13
+ </a>
14
+ <i
15
+ aria-hidden="true"
16
+ class="right angle icon divider"
27
17
  />
28
- </Container>
29
- </Fragment>
18
+ <div
19
+ class="active section"
20
+ >
21
+ Create
22
+ </div>
23
+ </div>
24
+ <div
25
+ class="ui segment ui text container"
26
+ >
27
+ <h2
28
+ class="ui header"
29
+ >
30
+ <i
31
+ aria-hidden="true"
32
+ class="plug icon"
33
+ />
34
+ <div
35
+ class="content"
36
+ >
37
+ Create
38
+ </div>
39
+ </h2>
40
+ <form
41
+ class="ui form"
42
+ >
43
+ <div
44
+ class="required field"
45
+ >
46
+ <label>
47
+ Id Externo
48
+ <div
49
+ class="ui left pointing label"
50
+ >
51
+ Empty required field
52
+ </div>
53
+ </label>
54
+ <div
55
+ class="field"
56
+ >
57
+ <div
58
+ class="ui input"
59
+ >
60
+ <input
61
+ type="text"
62
+ value=""
63
+ />
64
+ </div>
65
+ </div>
66
+ </div>
67
+ <div
68
+ class="required field"
69
+ >
70
+ <label>
71
+ Type
72
+ </label>
73
+ <div
74
+ class="required field"
75
+ >
76
+ <div
77
+ aria-disabled="false"
78
+ aria-expanded="false"
79
+ class="ui search selection dropdown"
80
+ name="type"
81
+ required=""
82
+ role="combobox"
83
+ >
84
+ <input
85
+ aria-autocomplete="list"
86
+ autocomplete="off"
87
+ class="search"
88
+ tabindex="0"
89
+ type="text"
90
+ value=""
91
+ />
92
+ <div
93
+ aria-atomic="true"
94
+ aria-live="polite"
95
+ class="divider default text"
96
+ role="alert"
97
+ >
98
+ Source type (template)
99
+ </div>
100
+ <i
101
+ aria-hidden="true"
102
+ class="dropdown icon"
103
+ />
104
+ <div
105
+ class="menu transition"
106
+ role="listbox"
107
+ >
108
+ <div
109
+ class="message"
110
+ >
111
+ No results found.
112
+ </div>
113
+ </div>
114
+ </div>
115
+ </div>
116
+ </div>
117
+ <div
118
+ class="actions"
119
+ >
120
+ <a
121
+ class="ui secondary button"
122
+ href="/"
123
+ role="button"
124
+ >
125
+ Cancel
126
+ </a>
127
+ <button
128
+ class="ui primary disabled button"
129
+ disabled=""
130
+ tabindex="-1"
131
+ >
132
+ Create
133
+ </button>
134
+ </div>
135
+ </form>
136
+ </div>
137
+ </div>
30
138
  `;
@@ -1,6 +1,5 @@
1
1
  import React, { Suspense } from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import en from "../../../messages/en";
4
3
  import Jobs from "../Jobs";
5
4
 
6
5
  const jobs = [
@@ -20,10 +19,7 @@ const jobs = [
20
19
  },
21
20
  ];
22
21
  const state = { jobs, jobCount: 42 };
23
- const renderOpts = {
24
- messages: { en },
25
- state,
26
- };
22
+ const renderOpts = { state };
27
23
 
28
24
  describe("<Jobs />", () => {
29
25
  it("matches the latest snapshot", () => {
@@ -2,7 +2,6 @@ import _ from "lodash/fp";
2
2
  import React from "react";
3
3
  import userEvent from "@testing-library/user-event";
4
4
  import { render } from "@truedat/test/render";
5
- import en from "../../../messages/en";
6
5
  import { initialState as jobQuery } from "../../reducers/jobQuery";
7
6
  import JobsTable from "../JobsTable";
8
7
 
@@ -23,10 +22,7 @@ const jobs = [
23
22
  },
24
23
  ];
25
24
  const state = { jobs, jobQuery };
26
- const renderOpts = {
27
- messages: { en },
28
- state,
29
- };
25
+ const renderOpts = { state };
30
26
 
31
27
  describe("<JobsTable />", () => {
32
28
  it("matches the latest snapshot", () => {
@@ -1,6 +1,5 @@
1
1
  import React, { Suspense } from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import en from "../../../messages/en";
4
3
  import { initialState as jobQuery } from "../../reducers/jobQuery";
5
4
  import JobsView from "../JobsView";
6
5
 
@@ -21,10 +20,7 @@ const jobs = [
21
20
  },
22
21
  ];
23
22
  const state = { jobs, jobQuery };
24
- const renderOpts = {
25
- messages: { en },
26
- state,
27
- };
23
+ const renderOpts = { state };
28
24
 
29
25
  describe("<JobsView />", () => {
30
26
  it("matches the latest snapshot", () => {
@@ -1,6 +1,5 @@
1
1
  import React, { Suspense } from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import en from "../../../messages/en";
4
3
  import SourceJobs from "../SourceJobs";
5
4
 
6
5
  const jobs = [
@@ -20,10 +19,7 @@ const jobs = [
20
19
  },
21
20
  ];
22
21
  const state = { jobs, jobCount: 42 };
23
- const renderOpts = {
24
- messages: { en },
25
- state,
26
- };
22
+ const renderOpts = { state };
27
23
 
28
24
  describe("<SourceJobs />", () => {
29
25
  it("matches the latest snapshot", () => {
@@ -38,15 +38,3 @@ export const SOURCE_QUERY = gql`
38
38
  ${SOURCE_CONFIG}
39
39
  ${SOURCE_TEMPLATE}
40
40
  `;
41
-
42
- export const TEMPLATES_QUERY = gql`
43
- query Templates($scope: String!) {
44
- templates(scope: $scope) {
45
- id
46
- name
47
- label
48
- scope
49
- content
50
- }
51
- }
52
- `;
@@ -4,10 +4,10 @@ import PropTypes from "prop-types";
4
4
  import { Button, Form, Label } from "semantic-ui-react";
5
5
  import { injectIntl, FormattedMessage } from "react-intl";
6
6
  import { useQuery } from "@apollo/client";
7
+ import { TEMPLATES_QUERY } from "@truedat/core/api/queries";
7
8
  import { HistoryBackButton, Loading } from "@truedat/core/components";
8
9
  import { accentInsensitivePathOrder } from "@truedat/core/services/sort";
9
10
  import { applyTemplate, validateContent } from "@truedat/df/utils";
10
- import { TEMPLATES_QUERY } from "../api/queries";
11
11
 
12
12
  const DynamicForm = React.lazy(() =>
13
13
  import("@truedat/df/components/DynamicForm")
@@ -1,7 +1,6 @@
1
1
  import React, { Suspense } from "react";
2
2
  import { waitFor } from "@testing-library/react";
3
3
  import { render } from "@truedat/test/render";
4
- import en from "../../../messages/en";
5
4
  import SourceDetail from "../SourceDetail";
6
5
 
7
6
  const jobs = [
@@ -27,7 +26,6 @@ const source = {
27
26
  id: 123,
28
27
  };
29
28
  const renderOpts = {
30
- messages: { en },
31
29
  routes: ["/sources/123/jobs"],
32
30
  state: { jobs, jobCount: 42 },
33
31
  };
@@ -4,7 +4,6 @@ import { SourceForm } from "../SourceForm";
4
4
 
5
5
  describe("<SourceForm />", () => {
6
6
  const applyTemplate = (x) => x;
7
- const selectTemplate = jest.fn();
8
7
  const templatesLoaded = true;
9
8
  const source = {
10
9
  external_id: "Micro1",
@@ -1,16 +1,12 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import en from "../../../messages/en";
4
3
  import SourceHeader from "../SourceHeader";
5
4
 
6
5
  const source = { externalId: "foo", id: 123 };
7
- const renderOpts = {
8
- messages: { en },
9
- };
10
6
 
11
7
  describe("<SourceHeader />", () => {
12
8
  it("matches the latest snapshot", () => {
13
- const { container } = render(<SourceHeader source={source} />, renderOpts);
9
+ const { container } = render(<SourceHeader source={source} />);
14
10
  expect(container).toMatchSnapshot();
15
11
  });
16
12
  });
@@ -1,6 +1,5 @@
1
1
  import React from "react";
2
2
  import { render } from "@truedat/test/render";
3
- import en from "../../../messages/en";
4
3
  import SourceTabs from "../SourceTabs";
5
4
 
6
5
  jest.mock("react-router-dom", () => ({
@@ -9,13 +8,10 @@ jest.mock("react-router-dom", () => ({
9
8
  }));
10
9
 
11
10
  const source = { externalId: "foo", id: 123 };
12
- const renderOpts = {
13
- messages: { en },
14
- };
15
11
 
16
12
  describe("<SourceTabs />", () => {
17
13
  it("matches the latest snapshot", () => {
18
- const { container } = render(<SourceTabs source={source} />, renderOpts);
14
+ const { container } = render(<SourceTabs source={source} />);
19
15
  expect(container).toMatchSnapshot();
20
16
  });
21
17
  });