@truedat/dq 4.48.0 → 4.48.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.48.2] 2022-07-08
4
+
5
+ ### Changed
6
+
7
+ - [TD-4995] Support localization of template fields and fixed values
8
+
9
+ ## [4.48.1] 2022-07-07
10
+
11
+ ### Added
12
+
13
+ - [TD-4945] User with permission can save or published on edition
14
+
3
15
  ## [4.48.0] 2022-07-07
4
16
 
5
17
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.48.0",
3
+ "version": "4.48.3",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -88,8 +88,8 @@
88
88
  },
89
89
  "dependencies": {
90
90
  "@apollo/client": "^3.6.4",
91
- "@truedat/core": "4.48.0",
92
- "@truedat/df": "4.48.0",
91
+ "@truedat/core": "4.48.3",
92
+ "@truedat/df": "4.48.3",
93
93
  "axios": "^0.19.2",
94
94
  "graphql": "^15.5.3",
95
95
  "path-to-regexp": "^1.7.0",
@@ -110,5 +110,5 @@
110
110
  "react-dom": ">= 16.8.6 < 17",
111
111
  "semantic-ui-react": ">= 0.88.2 < 2.1"
112
112
  },
113
- "gitHead": "c4587d045fa6c9028082bdfbcfb35e4383f117ed"
113
+ "gitHead": "5b30312f30c532988985ab9271d1e39ad0ad5c43"
114
114
  }
@@ -31,9 +31,13 @@ exports[`<RemediationPlan /> matches the latest snapshot 1`] = `
31
31
  class="ui negative message"
32
32
  >
33
33
  <div
34
- class="header"
34
+ class="content"
35
35
  >
36
- Error: Invalid template
36
+ <div
37
+ class="header"
38
+ >
39
+ Error: Invalid template
40
+ </div>
37
41
  </div>
38
42
  </div>
39
43
  </div>
@@ -207,10 +207,9 @@ export const RuleImplementationForm = ({
207
207
  return _.prop("isValid")(_.nth(index)(steps))();
208
208
  };
209
209
 
210
- const doSubmit = () => {
210
+ const doSubmit = (params) => {
211
211
  if (_.every((s) => _.prop("isValid")(s)())(steps)) {
212
- const canPublish = !!actions?.publish;
213
- onSubmit(canPublish ? { status: "published" } : {});
212
+ onSubmit(params);
214
213
  }
215
214
  };
216
215
 
@@ -309,21 +308,40 @@ export const RuleImplementationForm = ({
309
308
  </Grid.Row>
310
309
  <Divider hidden />
311
310
  <Grid.Row stretched>
312
- <Button
313
- floated="right"
314
- disabled={isButtonDisabled(activeStep)}
315
- type="submit"
316
- primary
317
- loading={isSubmitting}
318
- onClick={() =>
319
- getNextStep(activeStep) ? setNextStep(activeStep) : doSubmit()
320
- }
321
- content={
322
- getNextStep(activeStep)
323
- ? formatMessage({ id: "actions.next" })
324
- : formatMessage({ id: "actions.save" })
325
- }
326
- />
311
+ {getNextStep(activeStep) == null ? (
312
+ <>
313
+ {!!actions?.publish ? (
314
+ <Button
315
+ floated="right"
316
+ disabled={isButtonDisabled(activeStep)}
317
+ type="submit"
318
+ primary
319
+ loading={isSubmitting}
320
+ onClick={() => doSubmit({ status: "published" })}
321
+ content={formatMessage({ id: "actions.publish" })}
322
+ />
323
+ ) : null}
324
+ <Button
325
+ floated="right"
326
+ disabled={isButtonDisabled(activeStep)}
327
+ type="submit"
328
+ primary
329
+ loading={isSubmitting}
330
+ onClick={() => doSubmit({})}
331
+ content={formatMessage({ id: "actions.save" })}
332
+ />
333
+ </>
334
+ ) : (
335
+ <Button
336
+ floated="right"
337
+ disabled={isButtonDisabled(activeStep)}
338
+ type="submit"
339
+ primary
340
+ loading={isSubmitting}
341
+ onClick={() => setNextStep(activeStep)}
342
+ content={formatMessage({ id: "actions.next" })}
343
+ />
344
+ )}
327
345
  <Button
328
346
  floated="right"
329
347
  secondary
@@ -1,92 +0,0 @@
1
- import _ from "lodash/fp";
2
- import React from "react";
3
- import PropTypes from "prop-types";
4
- import { Form } from "semantic-ui-react";
5
- import { useIntl } from "react-intl";
6
-
7
- const toOptions = (
8
- formatMessage,
9
- property,
10
- translateValues,
11
- sortBy
12
- ) => values =>
13
- _.flow(
14
- _.map(v => ({
15
- text: formatMessage({ id: `${property}.${v}`, defaultMessage: v }),
16
- value: v
17
- })),
18
- sortBy ? _.sortBy(sortBy) : _.identity,
19
- _.map(translateValues ? ({ text }) => ({ text, value: text }) : _.identity),
20
- _.map.convert({ cap: false })(({ text, value }, key) => ({
21
- key,
22
- text,
23
- value
24
- }))
25
- )(values);
26
-
27
- export const DropdownI18n = ({
28
- allowAdditions,
29
- basic,
30
- label,
31
- multiple,
32
- name,
33
- onAddItem,
34
- onChange,
35
- property,
36
- required,
37
- search,
38
- selection,
39
- sortBy,
40
- translateValues = false,
41
- value,
42
- values
43
- }) => {
44
- const { formatMessage } = useIntl();
45
- return (
46
- <Form.Dropdown
47
- allowAdditions={allowAdditions}
48
- basic={basic}
49
- label={
50
- label ? formatMessage({ id: label, defaultMessage: label }) : false
51
- }
52
- multiple={multiple}
53
- name={name}
54
- onAddItem={onAddItem}
55
- onChange={onChange}
56
- options={toOptions(
57
- formatMessage,
58
- property,
59
- translateValues,
60
- sortBy
61
- )(values)}
62
- placeholder={formatMessage({
63
- id: `${property}.placeholder`,
64
- defaultMessage: " "
65
- })}
66
- required={required}
67
- search={search}
68
- selection={selection}
69
- value={value}
70
- />
71
- );
72
- };
73
-
74
- DropdownI18n.propTypes = {
75
- allowAdditions: PropTypes.bool,
76
- basic: PropTypes.bool,
77
- label: PropTypes.oneOfType([PropTypes.string, PropTypes.bool]),
78
- multiple: PropTypes.bool,
79
- name: PropTypes.string,
80
- onAddItem: PropTypes.func,
81
- onChange: PropTypes.func,
82
- property: PropTypes.string,
83
- required: PropTypes.bool,
84
- search: PropTypes.bool,
85
- selection: PropTypes.bool,
86
- sortBy: PropTypes.oneOfType([PropTypes.string, PropTypes.func]),
87
- translateValues: PropTypes.bool,
88
- value: PropTypes.string,
89
- values: PropTypes.arrayOf(PropTypes.string)
90
- };
91
-
92
- export default DropdownI18n;
@@ -1,31 +0,0 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
3
- import { intl } from "@truedat/test/intl-stub";
4
- import { DropdownI18n } from "../DropdownI18n";
5
-
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
- describe("<DropdownI18n />", () => {
11
- const props = {
12
- allowAdditions: true,
13
- basic: true,
14
- label: "label",
15
- multiple: true,
16
- name: "name",
17
- onChange: jest.fn(),
18
- onAddItem: jest.fn(),
19
- options: ["foo", "bar", "baz"],
20
- property: "some.i18n.prop",
21
- required: true,
22
- search: true,
23
- selection: true,
24
- value: "foo"
25
- };
26
-
27
- it("matches the latest snapshot", () => {
28
- const wrapper = shallow(<DropdownI18n {...props} />);
29
- expect(wrapper).toMatchSnapshot();
30
- });
31
- });
@@ -1,21 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`<DropdownI18n /> matches the latest snapshot 1`] = `
4
- <FormDropdown
5
- allowAdditions={true}
6
- as={[Function]}
7
- basic={true}
8
- control={[Function]}
9
- label="label"
10
- multiple={true}
11
- name="name"
12
- onAddItem={[MockFunction]}
13
- onChange={[MockFunction]}
14
- options={Array []}
15
- placeholder=" "
16
- required={true}
17
- search={true}
18
- selection={true}
19
- value="foo"
20
- />
21
- `;