@truedat/dq 4.47.9 → 4.48.2

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,24 @@
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
+
15
+ ## [4.48.0] 2022-07-07
16
+
17
+ ### Added
18
+
19
+ - [TD-4925] Add info messages on implementation updates
20
+ (like 'implementation unchanged')
21
+
3
22
  ## [4.47.9] 2022-07-05
4
23
 
5
24
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "4.47.9",
3
+ "version": "4.48.2",
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.47.9",
92
- "@truedat/df": "4.47.9",
91
+ "@truedat/core": "4.48.2",
92
+ "@truedat/df": "4.48.2",
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": "21954b7a0ea8240d2a9e8dc5014372eceed3b047"
113
+ "gitHead": "93133e957332713e64c97eecdf45cc283c29bd32"
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
@@ -551,6 +551,7 @@ export default {
551
551
  "ruleImplementations.summary.headers.populations": "Populations",
552
552
  "ruleImplementations.summary.headers.segments": "Segments",
553
553
  "ruleImplementations.summary.headers.validations": "Validation",
554
+ "ruleImplementations.update.success.header.implementation_unchanged": "The implementation has not changed",
554
555
  "ruleImplementations.upload.success.errors":
555
556
  "Error in {implementation_key} attribute: {key} message: {message} ",
556
557
  "ruleImplementations.upload.success.header":
@@ -570,6 +570,7 @@ export default {
570
570
  "ruleImplementations.summary.headers.populations": "Poblaciones",
571
571
  "ruleImplementations.summary.headers.segments": "Segmentos",
572
572
  "ruleImplementations.summary.headers.validations": "Validaciones",
573
+ "ruleImplementations.update.success.header.implementation_unchanged": "La implementación no ha cambiado",
573
574
  "ruleImplementations.upload.success.errors":
574
575
  "Error en {name} atributo: {key} mensaje: {message} ",
575
576
  "ruleImplementations.upload.success.header":
@@ -5,6 +5,7 @@ import {
5
5
  uploadImplementations,
6
6
  uploadResults,
7
7
  fetchRemediation,
8
+ updateRuleImplementation,
8
9
  } from "../routines";
9
10
 
10
11
  const initialState = {};
@@ -133,6 +134,15 @@ const dqMessage = (state = initialState, { type, payload }) => {
133
134
  }
134
135
  case fetchRemediation.FAILURE:
135
136
  return { error: false };
137
+ case updateRuleImplementation.SUCCESS:
138
+ if (_.has("message")(payload)) {
139
+ return {
140
+ error: false,
141
+ header: `ruleImplementations.update.success.header.${payload.message}`,
142
+ icon: "attention",
143
+ color: "blue",
144
+ };
145
+ }
136
146
  default:
137
147
  return state;
138
148
  }
@@ -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
- `;