@reltio/components 1.4.2210 → 1.4.2212
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/AttributesErrorsPanel/AttributesErrorsPanel.d.ts +2 -1
- package/AttributesErrorsPanel/AttributesErrorsPanel.js +5 -5
- package/AttributesErrorsPanel/components/Error/AttributeErrorItem.d.ts +8 -0
- package/AttributesErrorsPanel/components/Error/{Error.js → AttributeErrorItem.js} +4 -4
- package/AttributesErrorsPanel/components/Error/{Error.test.js → AttributeErrorItem.test.js} +3 -3
- package/AttributesErrorsPanel/components/Error/index.d.ts +1 -1
- package/AttributesErrorsPanel/components/Error/index.js +1 -1
- package/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.d.ts +2 -1
- package/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.js +3 -2
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.d.ts +2 -1
- package/cjs/AttributesErrorsPanel/AttributesErrorsPanel.js +4 -4
- package/cjs/AttributesErrorsPanel/components/Error/AttributeErrorItem.d.ts +8 -0
- package/cjs/AttributesErrorsPanel/components/Error/{Error.js → AttributeErrorItem.js} +5 -5
- package/cjs/AttributesErrorsPanel/components/Error/{Error.test.js → AttributeErrorItem.test.js} +3 -3
- package/cjs/AttributesErrorsPanel/components/Error/index.d.ts +1 -1
- package/cjs/AttributesErrorsPanel/components/Error/index.js +3 -3
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.d.ts +2 -1
- package/cjs/AttributesErrorsPanel/components/ErrorsPanel/ErrorsPanel.js +3 -2
- package/cjs/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +1 -1
- package/cjs/features/workflow/helpers/attributes.js +2 -6
- package/cjs/features/workflow/helpers/attributes.test.js +22 -18
- package/cjs/features/workflow/helpers/merge.test.js +26 -20
- package/cjs/features/workflow/helpers/metadata.test-data.d.ts +1 -1
- package/cjs/features/workflow/helpers/metadata.test-data.js +149 -3
- package/cjs/features/workflow/helpers/validation.js +0 -1
- package/cjs/features/workflow/helpers/validation.test-data.d.ts +14 -0
- package/cjs/features/workflow/helpers/validation.test-data.js +508 -0
- package/cjs/features/workflow/helpers/validation.test.d.ts +1 -0
- package/cjs/features/workflow/helpers/validation.test.js +257 -0
- package/cjs/features/workflow/hooks/useDCRValidation.js +1 -1
- package/features/workflow/ReviewDCRDialog/DCRErrorsPanel/DCRErrorsPanel.js +1 -1
- package/features/workflow/helpers/attributes.js +2 -6
- package/features/workflow/helpers/attributes.test.js +5 -1
- package/features/workflow/helpers/merge.test.js +7 -1
- package/features/workflow/helpers/metadata.test-data.d.ts +1 -1
- package/features/workflow/helpers/metadata.test-data.js +147 -2
- package/features/workflow/helpers/validation.js +0 -1
- package/features/workflow/helpers/validation.test-data.d.ts +14 -0
- package/features/workflow/helpers/validation.test-data.js +498 -0
- package/features/workflow/helpers/validation.test.d.ts +1 -0
- package/features/workflow/helpers/validation.test.js +255 -0
- package/features/workflow/hooks/useDCRValidation.js +1 -1
- package/package.json +2 -2
- package/AttributesErrorsPanel/components/Error/Error.d.ts +0 -7
- package/cjs/AttributesErrorsPanel/components/Error/Error.d.ts +0 -7
- /package/AttributesErrorsPanel/components/Error/{Error.test.d.ts → AttributeErrorItem.test.d.ts} +0 -0
- /package/cjs/AttributesErrorsPanel/components/Error/{Error.test.d.ts → AttributeErrorItem.test.d.ts} +0 -0
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
3
|
type Props = {
|
|
4
4
|
attributesWithErrors?: AttributeError[];
|
|
5
|
+
alwaysShowLink?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare const AttributesErrorsPanel: ({ attributesWithErrors }: Props) => React.JSX.Element;
|
|
7
|
+
export declare const AttributesErrorsPanel: ({ attributesWithErrors, alwaysShowLink }: Props) => React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -6,14 +6,14 @@ import WarningIcon from '@mui/icons-material/Error';
|
|
|
6
6
|
import { splitErrorsBySeverity } from '@reltio/mdm-sdk';
|
|
7
7
|
import { useCachedErrors } from './useCachedErrors';
|
|
8
8
|
import { ErrorsPanel } from './components/ErrorsPanel';
|
|
9
|
-
import {
|
|
9
|
+
import { AttributeErrorItem } from './components/Error';
|
|
10
10
|
import { useStyles } from './styles';
|
|
11
11
|
export var AttributesErrorsPanel = function (_a) {
|
|
12
|
-
var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b;
|
|
12
|
+
var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b, _c = _a.alwaysShowLink, alwaysShowLink = _c === void 0 ? false : _c;
|
|
13
13
|
var styles = useStyles();
|
|
14
14
|
var cachedErrors = useCachedErrors(attributesWithErrors);
|
|
15
|
-
var
|
|
16
|
-
var
|
|
15
|
+
var _d = useMemo(function () { return splitErrorsBySeverity(cachedErrors); }, [cachedErrors]), errors = _d[0], warnings = _d[1];
|
|
16
|
+
var _e = useState(null), expandedPanelId = _e[0], setExpandedPanelId = _e[1];
|
|
17
17
|
var panels = useMemo(function () {
|
|
18
18
|
return [
|
|
19
19
|
{
|
|
@@ -49,5 +49,5 @@ export var AttributesErrorsPanel = function (_a) {
|
|
|
49
49
|
var handleChange = useCallback(function (panelId) { return function (event, isExpanded) {
|
|
50
50
|
setExpandedPanelId(isExpanded ? panelId : null);
|
|
51
51
|
}; }, []);
|
|
52
|
-
return panels.length > 0 ? (React.createElement(ErrorsPanel, { panels: panels, expandedPanelId: expandedPanelId, onToggle: handleChange, ErrorComponent:
|
|
52
|
+
return panels.length > 0 ? (React.createElement(ErrorsPanel, { panels: panels, expandedPanelId: expandedPanelId, onToggle: handleChange, ErrorComponent: AttributeErrorItem, alwaysShowLink: alwaysShowLink })) : null;
|
|
53
53
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
|
+
type Props = {
|
|
4
|
+
error: AttributeError;
|
|
5
|
+
alwaysShowLink?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const AttributeErrorItem: React.MemoExoticComponent<({ error, alwaysShowLink }: Props) => React.JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -9,8 +9,8 @@ import { useMdmIsEditableMode, useMdmMetadata } from '../../../contexts/MdmModul
|
|
|
9
9
|
import { getDisplayedAttributeTypesPath, getDisplayedErrorMessage, getDisplayedErrorPath } from './helpers';
|
|
10
10
|
import { ReadOnlyError } from '../../../icons';
|
|
11
11
|
import { useStyles } from './styles';
|
|
12
|
-
export var
|
|
13
|
-
var error = _a.error;
|
|
12
|
+
export var AttributeErrorItem = memo(function (_a) {
|
|
13
|
+
var error = _a.error, _b = _a.alwaysShowLink, alwaysShowLink = _b === void 0 ? false : _b;
|
|
14
14
|
var styles = useStyles();
|
|
15
15
|
var metadata = useMdmMetadata();
|
|
16
16
|
var isEditableMode = useMdmIsEditableMode();
|
|
@@ -18,7 +18,7 @@ export var Error = memo(function (_a) {
|
|
|
18
18
|
var displayedErrorPath = getDisplayedErrorPath(error);
|
|
19
19
|
var displayedAttributeTypesPath = getDisplayedAttributeTypesPath(error);
|
|
20
20
|
var highlightError = useContext(ScrollToElementContext).highlightError;
|
|
21
|
-
var showLink = (error.uri || (error.parentUri && error.attributeTypeUri)) && (isEditableMode ||
|
|
21
|
+
var showLink = (error.uri || (error.parentUri && error.attributeTypeUri)) && (isEditableMode || alwaysShowLink);
|
|
22
22
|
return (React.createElement("div", { className: styles.errorListItem },
|
|
23
23
|
React.createElement("div", { className: styles.listItemMarker }, error.type === ErrorType.rdmIssueInReference ? (React.createElement(Tooltip, { title: i18n.text('This error is visible only in view mode') },
|
|
24
24
|
React.createElement("span", null,
|
|
@@ -30,4 +30,4 @@ export var Error = memo(function (_a) {
|
|
|
30
30
|
showLink && (React.createElement(SmallIconButtonWithTooltip, { icon: HyperlinkIcon, size: "XXS", onClick: function () { return highlightError(error); }, tooltipTitle: i18n.text('Go to error'), className: styles.goToIcon }))),
|
|
31
31
|
displayedErrorPath && React.createElement("span", { className: styles.parents }, displayedErrorPath))));
|
|
32
32
|
});
|
|
33
|
-
|
|
33
|
+
AttributeErrorItem.displayName = 'AttributeErrorItem';
|
|
@@ -48,12 +48,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
48
48
|
import React from 'react';
|
|
49
49
|
import { render, screen } from '@testing-library/react';
|
|
50
50
|
import { AttributeValuePathItemType, ErrorSeverity, ErrorSource, ErrorType, Mode } from '@reltio/mdm-sdk';
|
|
51
|
-
import {
|
|
51
|
+
import { AttributeErrorItem } from './AttributeErrorItem';
|
|
52
52
|
import { MdmModuleProvider } from '../../../contexts/MdmModuleContext';
|
|
53
53
|
import userEvent from '@testing-library/user-event';
|
|
54
54
|
import { store as initStore } from '../../store.test-data';
|
|
55
55
|
import { ScrollToElementContext } from '../../../contexts/ScrollToElementContext';
|
|
56
|
-
describe('
|
|
56
|
+
describe('AttributeErrorItem tests', function () {
|
|
57
57
|
var attributeType = initStore.metadata.entityTypes[0].attributes[0];
|
|
58
58
|
var setUp = function (props, store) {
|
|
59
59
|
if (store === void 0) { store = initStore; }
|
|
@@ -64,7 +64,7 @@ describe('Error tests', function () {
|
|
|
64
64
|
React.createElement(ScrollToElementContext.Provider, { value: { highlightError: highlightError, element: null, type: null, scrollIntoRef: null } }, children)));
|
|
65
65
|
};
|
|
66
66
|
var user = userEvent.setup();
|
|
67
|
-
return __assign({ user: user, highlightError: highlightError }, render(React.createElement(
|
|
67
|
+
return __assign({ user: user, highlightError: highlightError }, render(React.createElement(AttributeErrorItem, __assign({}, props)), { wrapper: Providers }));
|
|
68
68
|
};
|
|
69
69
|
it('should render error message for validation service errors', function () {
|
|
70
70
|
var error = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AttributeErrorItem } from './AttributeErrorItem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AttributeErrorItem } from './AttributeErrorItem';
|
|
@@ -12,6 +12,7 @@ type Props = {
|
|
|
12
12
|
expandedPanelId: string;
|
|
13
13
|
onToggle: (id: string) => (e: any, isExpanded: boolean) => void;
|
|
14
14
|
ErrorComponent: ElementType;
|
|
15
|
+
alwaysShowLink?: boolean;
|
|
15
16
|
};
|
|
16
|
-
export declare const ErrorsPanel: React.MemoExoticComponent<({ panels, expandedPanelId, onToggle, ErrorComponent }: Props) => React.JSX.Element>;
|
|
17
|
+
export declare const ErrorsPanel: React.MemoExoticComponent<({ panels, expandedPanelId, onToggle, ErrorComponent, alwaysShowLink }: Props) => React.JSX.Element>;
|
|
17
18
|
export {};
|
|
@@ -7,7 +7,7 @@ import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
|
|
7
7
|
import Typography from '@mui/material/Typography';
|
|
8
8
|
import { useStyles } from './styles';
|
|
9
9
|
export var ErrorsPanel = memo(function (_a) {
|
|
10
|
-
var panels = _a.panels, expandedPanelId = _a.expandedPanelId, onToggle = _a.onToggle, ErrorComponent = _a.ErrorComponent;
|
|
10
|
+
var panels = _a.panels, expandedPanelId = _a.expandedPanelId, onToggle = _a.onToggle, ErrorComponent = _a.ErrorComponent, _b = _a.alwaysShowLink, alwaysShowLink = _b === void 0 ? false : _b;
|
|
11
11
|
var styles = useStyles();
|
|
12
12
|
return panels.length > 0 ? (React.createElement("div", null, panels.map(function (_a) {
|
|
13
13
|
var id = _a.id, icon = _a.icon, title = _a.title, items = _a.items, accordionClassName = _a.accordionClassName, accordionDetailsClassName = _a.accordionDetailsClassName;
|
|
@@ -19,7 +19,8 @@ export var ErrorsPanel = memo(function (_a) {
|
|
|
19
19
|
}, expandIcon: React.createElement(ExpandMoreIcon, null) },
|
|
20
20
|
icon,
|
|
21
21
|
React.createElement(Typography, { className: styles.accordionSummaryHeading }, title)),
|
|
22
|
-
React.createElement(AccordionDetails, { className: classnames(styles.accordionDetails, accordionDetailsClassName) }, items.map(function (error, i) { return (React.createElement(ErrorComponent, { key: i, error: error })
|
|
22
|
+
React.createElement(AccordionDetails, { className: classnames(styles.accordionDetails, accordionDetailsClassName) }, items.map(function (error, i) { return (React.createElement(ErrorComponent, { key: i, error: error, alwaysShowLink: alwaysShowLink }) //NOSONAR
|
|
23
|
+
); }))));
|
|
23
24
|
}))) : null;
|
|
24
25
|
});
|
|
25
26
|
ErrorsPanel.displayName = 'ErrorsPanel';
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
3
|
type Props = {
|
|
4
4
|
attributesWithErrors?: AttributeError[];
|
|
5
|
+
alwaysShowLink?: boolean;
|
|
5
6
|
};
|
|
6
|
-
export declare const AttributesErrorsPanel: ({ attributesWithErrors }: Props) => React.JSX.Element;
|
|
7
|
+
export declare const AttributesErrorsPanel: ({ attributesWithErrors, alwaysShowLink }: Props) => React.JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -38,11 +38,11 @@ var ErrorsPanel_1 = require("./components/ErrorsPanel");
|
|
|
38
38
|
var Error_2 = require("./components/Error");
|
|
39
39
|
var styles_1 = require("./styles");
|
|
40
40
|
var AttributesErrorsPanel = function (_a) {
|
|
41
|
-
var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b;
|
|
41
|
+
var _b = _a.attributesWithErrors, attributesWithErrors = _b === void 0 ? [] : _b, _c = _a.alwaysShowLink, alwaysShowLink = _c === void 0 ? false : _c;
|
|
42
42
|
var styles = (0, styles_1.useStyles)();
|
|
43
43
|
var cachedErrors = (0, useCachedErrors_1.useCachedErrors)(attributesWithErrors);
|
|
44
|
-
var
|
|
45
|
-
var
|
|
44
|
+
var _d = (0, react_1.useMemo)(function () { return (0, mdm_sdk_1.splitErrorsBySeverity)(cachedErrors); }, [cachedErrors]), errors = _d[0], warnings = _d[1];
|
|
45
|
+
var _e = (0, react_1.useState)(null), expandedPanelId = _e[0], setExpandedPanelId = _e[1];
|
|
46
46
|
var panels = (0, react_1.useMemo)(function () {
|
|
47
47
|
return [
|
|
48
48
|
{
|
|
@@ -78,6 +78,6 @@ var AttributesErrorsPanel = function (_a) {
|
|
|
78
78
|
var handleChange = (0, react_1.useCallback)(function (panelId) { return function (event, isExpanded) {
|
|
79
79
|
setExpandedPanelId(isExpanded ? panelId : null);
|
|
80
80
|
}; }, []);
|
|
81
|
-
return panels.length > 0 ? (react_1.default.createElement(ErrorsPanel_1.ErrorsPanel, { panels: panels, expandedPanelId: expandedPanelId, onToggle: handleChange, ErrorComponent: Error_2.
|
|
81
|
+
return panels.length > 0 ? (react_1.default.createElement(ErrorsPanel_1.ErrorsPanel, { panels: panels, expandedPanelId: expandedPanelId, onToggle: handleChange, ErrorComponent: Error_2.AttributeErrorItem, alwaysShowLink: alwaysShowLink })) : null;
|
|
82
82
|
};
|
|
83
83
|
exports.AttributesErrorsPanel = AttributesErrorsPanel;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AttributeError } from '@reltio/mdm-sdk';
|
|
3
|
+
type Props = {
|
|
4
|
+
error: AttributeError;
|
|
5
|
+
alwaysShowLink?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const AttributeErrorItem: React.MemoExoticComponent<({ error, alwaysShowLink }: Props) => React.JSX.Element>;
|
|
8
|
+
export {};
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.
|
|
29
|
+
exports.AttributeErrorItem = void 0;
|
|
30
30
|
var react_1 = __importStar(require("react"));
|
|
31
31
|
var ui_i18n_1 = __importDefault(require("ui-i18n"));
|
|
32
32
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
@@ -38,8 +38,8 @@ var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
|
38
38
|
var helpers_1 = require("./helpers");
|
|
39
39
|
var icons_1 = require("../../../icons");
|
|
40
40
|
var styles_1 = require("./styles");
|
|
41
|
-
exports.
|
|
42
|
-
var error = _a.error;
|
|
41
|
+
exports.AttributeErrorItem = (0, react_1.memo)(function (_a) {
|
|
42
|
+
var error = _a.error, _b = _a.alwaysShowLink, alwaysShowLink = _b === void 0 ? false : _b;
|
|
43
43
|
var styles = (0, styles_1.useStyles)();
|
|
44
44
|
var metadata = (0, MdmModuleContext_1.useMdmMetadata)();
|
|
45
45
|
var isEditableMode = (0, MdmModuleContext_1.useMdmIsEditableMode)();
|
|
@@ -47,7 +47,7 @@ exports.Error = (0, react_1.memo)(function (_a) {
|
|
|
47
47
|
var displayedErrorPath = (0, helpers_1.getDisplayedErrorPath)(error);
|
|
48
48
|
var displayedAttributeTypesPath = (0, helpers_1.getDisplayedAttributeTypesPath)(error);
|
|
49
49
|
var highlightError = (0, react_1.useContext)(ScrollToElementContext_1.ScrollToElementContext).highlightError;
|
|
50
|
-
var showLink = (error.uri || (error.parentUri && error.attributeTypeUri)) && (isEditableMode ||
|
|
50
|
+
var showLink = (error.uri || (error.parentUri && error.attributeTypeUri)) && (isEditableMode || alwaysShowLink);
|
|
51
51
|
return (react_1.default.createElement("div", { className: styles.errorListItem },
|
|
52
52
|
react_1.default.createElement("div", { className: styles.listItemMarker }, error.type === mdm_sdk_1.ErrorType.rdmIssueInReference ? (react_1.default.createElement(Tooltip_1.default, { title: ui_i18n_1.default.text('This error is visible only in view mode') },
|
|
53
53
|
react_1.default.createElement("span", null,
|
|
@@ -59,4 +59,4 @@ exports.Error = (0, react_1.memo)(function (_a) {
|
|
|
59
59
|
showLink && (react_1.default.createElement(SmallIconButton_1.SmallIconButtonWithTooltip, { icon: Hyperlink_1.default, size: "XXS", onClick: function () { return highlightError(error); }, tooltipTitle: ui_i18n_1.default.text('Go to error'), className: styles.goToIcon }))),
|
|
60
60
|
displayedErrorPath && react_1.default.createElement("span", { className: styles.parents }, displayedErrorPath))));
|
|
61
61
|
});
|
|
62
|
-
exports.
|
|
62
|
+
exports.AttributeErrorItem.displayName = 'AttributeErrorItem';
|
package/cjs/AttributesErrorsPanel/components/Error/{Error.test.js → AttributeErrorItem.test.js}
RENAMED
|
@@ -53,12 +53,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
var react_1 = __importDefault(require("react"));
|
|
54
54
|
var react_2 = require("@testing-library/react");
|
|
55
55
|
var mdm_sdk_1 = require("@reltio/mdm-sdk");
|
|
56
|
-
var
|
|
56
|
+
var AttributeErrorItem_1 = require("./AttributeErrorItem");
|
|
57
57
|
var MdmModuleContext_1 = require("../../../contexts/MdmModuleContext");
|
|
58
58
|
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
59
59
|
var store_test_data_1 = require("../../store.test-data");
|
|
60
60
|
var ScrollToElementContext_1 = require("../../../contexts/ScrollToElementContext");
|
|
61
|
-
describe('
|
|
61
|
+
describe('AttributeErrorItem tests', function () {
|
|
62
62
|
var attributeType = store_test_data_1.store.metadata.entityTypes[0].attributes[0];
|
|
63
63
|
var setUp = function (props, store) {
|
|
64
64
|
if (store === void 0) { store = store_test_data_1.store; }
|
|
@@ -69,7 +69,7 @@ describe('Error tests', function () {
|
|
|
69
69
|
react_1.default.createElement(ScrollToElementContext_1.ScrollToElementContext.Provider, { value: { highlightError: highlightError, element: null, type: null, scrollIntoRef: null } }, children)));
|
|
70
70
|
};
|
|
71
71
|
var user = user_event_1.default.setup();
|
|
72
|
-
return __assign({ user: user, highlightError: highlightError }, (0, react_2.render)(react_1.default.createElement(
|
|
72
|
+
return __assign({ user: user, highlightError: highlightError }, (0, react_2.render)(react_1.default.createElement(AttributeErrorItem_1.AttributeErrorItem, __assign({}, props)), { wrapper: Providers }));
|
|
73
73
|
};
|
|
74
74
|
it('should render error message for validation service errors', function () {
|
|
75
75
|
var error = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { AttributeErrorItem } from './AttributeErrorItem';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
var
|
|
5
|
-
Object.defineProperty(exports, "
|
|
3
|
+
exports.AttributeErrorItem = void 0;
|
|
4
|
+
var AttributeErrorItem_1 = require("./AttributeErrorItem");
|
|
5
|
+
Object.defineProperty(exports, "AttributeErrorItem", { enumerable: true, get: function () { return AttributeErrorItem_1.AttributeErrorItem; } });
|
|
@@ -12,6 +12,7 @@ type Props = {
|
|
|
12
12
|
expandedPanelId: string;
|
|
13
13
|
onToggle: (id: string) => (e: any, isExpanded: boolean) => void;
|
|
14
14
|
ErrorComponent: ElementType;
|
|
15
|
+
alwaysShowLink?: boolean;
|
|
15
16
|
};
|
|
16
|
-
export declare const ErrorsPanel: React.MemoExoticComponent<({ panels, expandedPanelId, onToggle, ErrorComponent }: Props) => React.JSX.Element>;
|
|
17
|
+
export declare const ErrorsPanel: React.MemoExoticComponent<({ panels, expandedPanelId, onToggle, ErrorComponent, alwaysShowLink }: Props) => React.JSX.Element>;
|
|
17
18
|
export {};
|
|
@@ -36,7 +36,7 @@ var ExpandMore_1 = __importDefault(require("@mui/icons-material/ExpandMore"));
|
|
|
36
36
|
var Typography_1 = __importDefault(require("@mui/material/Typography"));
|
|
37
37
|
var styles_1 = require("./styles");
|
|
38
38
|
exports.ErrorsPanel = (0, react_1.memo)(function (_a) {
|
|
39
|
-
var panels = _a.panels, expandedPanelId = _a.expandedPanelId, onToggle = _a.onToggle, ErrorComponent = _a.ErrorComponent;
|
|
39
|
+
var panels = _a.panels, expandedPanelId = _a.expandedPanelId, onToggle = _a.onToggle, ErrorComponent = _a.ErrorComponent, _b = _a.alwaysShowLink, alwaysShowLink = _b === void 0 ? false : _b;
|
|
40
40
|
var styles = (0, styles_1.useStyles)();
|
|
41
41
|
return panels.length > 0 ? (react_1.default.createElement("div", null, panels.map(function (_a) {
|
|
42
42
|
var id = _a.id, icon = _a.icon, title = _a.title, items = _a.items, accordionClassName = _a.accordionClassName, accordionDetailsClassName = _a.accordionDetailsClassName;
|
|
@@ -48,7 +48,8 @@ exports.ErrorsPanel = (0, react_1.memo)(function (_a) {
|
|
|
48
48
|
}, expandIcon: react_1.default.createElement(ExpandMore_1.default, null) },
|
|
49
49
|
icon,
|
|
50
50
|
react_1.default.createElement(Typography_1.default, { className: styles.accordionSummaryHeading }, title)),
|
|
51
|
-
react_1.default.createElement(AccordionDetails_1.default, { className: (0, classnames_1.default)(styles.accordionDetails, accordionDetailsClassName) }, items.map(function (error, i) { return (react_1.default.createElement(ErrorComponent, { key: i, error: error })
|
|
51
|
+
react_1.default.createElement(AccordionDetails_1.default, { className: (0, classnames_1.default)(styles.accordionDetails, accordionDetailsClassName) }, items.map(function (error, i) { return (react_1.default.createElement(ErrorComponent, { key: i, error: error, alwaysShowLink: alwaysShowLink }) //NOSONAR
|
|
52
|
+
); }))));
|
|
52
53
|
}))) : null;
|
|
53
54
|
});
|
|
54
55
|
exports.ErrorsPanel.displayName = 'ErrorsPanel';
|
|
@@ -39,6 +39,6 @@ var DCRErrorsPanel = function () {
|
|
|
39
39
|
return null;
|
|
40
40
|
}
|
|
41
41
|
return (react_1.default.createElement("div", { className: DCRErrorsPanel_module_css_1.default.DCRErrorsPanel },
|
|
42
|
-
react_1.default.createElement(AttributesErrorsPanel_1.AttributesErrorsPanel, { attributesWithErrors: validationErrors })));
|
|
42
|
+
react_1.default.createElement(AttributesErrorsPanel_1.AttributesErrorsPanel, { attributesWithErrors: validationErrors, alwaysShowLink: true })));
|
|
43
43
|
};
|
|
44
44
|
exports.DCRErrorsPanel = DCRErrorsPanel;
|
|
@@ -66,12 +66,8 @@ var dcrAttributesFactory = function (metadata, attributeType, attributeValue, le
|
|
|
66
66
|
};
|
|
67
67
|
var extractLineIds = function (attributeValue) {
|
|
68
68
|
var _a, _b;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
'lineIds' in attributeValue.value.newValue &&
|
|
72
|
-
Array.isArray(attributeValue.value.newValue.lineIds)
|
|
73
|
-
? (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds
|
|
74
|
-
: attributeValue.lineIds;
|
|
69
|
+
var lineIds = (_b = (_a = attributeValue === null || attributeValue === void 0 ? void 0 : attributeValue.value) === null || _a === void 0 ? void 0 : _a.newValue) === null || _b === void 0 ? void 0 : _b.lineIds;
|
|
70
|
+
return Array.isArray(lineIds) ? lineIds : attributeValue.lineIds;
|
|
75
71
|
};
|
|
76
72
|
var getNestedAttributeChange = function (metadata, attributeType, attributeValue, level) {
|
|
77
73
|
var attributeTypeList = (0, mdm_sdk_1.getAttributeTypeSubAttributes)({}, attributeType);
|
|
@@ -16,6 +16,7 @@ var metadata_test_data_1 = require("./metadata.test-data");
|
|
|
16
16
|
var attributes_1 = require("./attributes");
|
|
17
17
|
describe('attributes helpers tests', function () {
|
|
18
18
|
it('getEntityChanges behaviour', function () {
|
|
19
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
19
20
|
var objectInfo = {
|
|
20
21
|
isExist: true,
|
|
21
22
|
label: '12345 - Address Line 1 City',
|
|
@@ -88,9 +89,9 @@ describe('attributes helpers tests', function () {
|
|
|
88
89
|
}
|
|
89
90
|
]
|
|
90
91
|
};
|
|
91
|
-
expect((0, attributes_1.getEntityChanges)(
|
|
92
|
+
expect((0, attributes_1.getEntityChanges)(metadata, objectInfo, changes)).toEqual([
|
|
92
93
|
{
|
|
93
|
-
attributeType:
|
|
94
|
+
attributeType: metadata.entityTypes[0].attributes[1],
|
|
94
95
|
label: 'Country Code',
|
|
95
96
|
level: 0,
|
|
96
97
|
newValue: __assign(__assign({}, changes.CountryCode[0].value.newValue), { lineIds: ['3AqlrpfGa/value/oldValue'] }),
|
|
@@ -98,7 +99,7 @@ describe('attributes helpers tests', function () {
|
|
|
98
99
|
isReferenceSubAttribute: false
|
|
99
100
|
},
|
|
100
101
|
{
|
|
101
|
-
attributeType:
|
|
102
|
+
attributeType: metadata.entityTypes[0].attributes[1],
|
|
102
103
|
label: 'Country Code',
|
|
103
104
|
level: 0,
|
|
104
105
|
newValue: changes.CountryCode[1].value.newValue,
|
|
@@ -106,13 +107,13 @@ describe('attributes helpers tests', function () {
|
|
|
106
107
|
isReferenceSubAttribute: false
|
|
107
108
|
},
|
|
108
109
|
{
|
|
109
|
-
attributeType:
|
|
110
|
+
attributeType: metadata.entityTypes[0].attributes[3],
|
|
110
111
|
attributeValue: changes.Identifiers[0],
|
|
111
112
|
label: 'Customer Identity',
|
|
112
113
|
level: 0
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
|
-
attributeType:
|
|
116
|
+
attributeType: metadata.entityTypes[0].attributes[3].attributes[0],
|
|
116
117
|
label: 'Identity Type',
|
|
117
118
|
level: 1,
|
|
118
119
|
newValue: changes.Identifiers[0].value.Type[0].value.newValue,
|
|
@@ -141,12 +142,13 @@ describe('attributes helpers tests', function () {
|
|
|
141
142
|
]
|
|
142
143
|
};
|
|
143
144
|
it('should not show operation for relation title', function () {
|
|
144
|
-
|
|
145
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
146
|
+
expect((0, attributes_1.getRelationChanges)(metadata, relationInfo, changes, mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE, ['lineIds'])).toEqual([
|
|
145
147
|
{
|
|
146
148
|
attributeType: null,
|
|
147
|
-
relationType:
|
|
149
|
+
relationType: metadata.relationTypes[1],
|
|
148
150
|
attributeValue: __assign(__assign({}, relationInfo), changes),
|
|
149
|
-
label:
|
|
151
|
+
label: metadata.relationTypes[1].label,
|
|
150
152
|
level: 1,
|
|
151
153
|
lineIds: ['lineIds']
|
|
152
154
|
},
|
|
@@ -159,8 +161,8 @@ describe('attributes helpers tests', function () {
|
|
|
159
161
|
isReferenceSubAttribute: false
|
|
160
162
|
},
|
|
161
163
|
{
|
|
162
|
-
attributeType:
|
|
163
|
-
label:
|
|
164
|
+
attributeType: metadata.relationTypes[1].attributes[0],
|
|
165
|
+
label: metadata.relationTypes[1].attributes[0].label,
|
|
164
166
|
level: 2,
|
|
165
167
|
newValue: '123',
|
|
166
168
|
operation: mdm_sdk_1.DCROperationTypes.ADDED,
|
|
@@ -169,12 +171,13 @@ describe('attributes helpers tests', function () {
|
|
|
169
171
|
]);
|
|
170
172
|
});
|
|
171
173
|
it('should show operation for relation title if it is new', function () {
|
|
172
|
-
|
|
174
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
175
|
+
expect((0, attributes_1.getRelationChanges)(metadata, relationInfo, changes, mdm_sdk_1.DCRTypes.CREATE_RELATIONSHIP, ['lineIds'])).toEqual([
|
|
173
176
|
{
|
|
174
177
|
attributeType: null,
|
|
175
|
-
relationType:
|
|
178
|
+
relationType: metadata.relationTypes[1],
|
|
176
179
|
attributeValue: __assign(__assign({}, relationInfo), changes),
|
|
177
|
-
label:
|
|
180
|
+
label: metadata.relationTypes[1].label,
|
|
178
181
|
level: 1,
|
|
179
182
|
operation: mdm_sdk_1.DCROperationTypes.ADDED,
|
|
180
183
|
lineIds: ['lineIds']
|
|
@@ -188,8 +191,8 @@ describe('attributes helpers tests', function () {
|
|
|
188
191
|
isReferenceSubAttribute: false
|
|
189
192
|
},
|
|
190
193
|
{
|
|
191
|
-
attributeType:
|
|
192
|
-
label:
|
|
194
|
+
attributeType: metadata.relationTypes[1].attributes[0],
|
|
195
|
+
label: metadata.relationTypes[1].attributes[0].label,
|
|
193
196
|
isReferenceSubAttribute: false,
|
|
194
197
|
level: 2,
|
|
195
198
|
newValue: '123',
|
|
@@ -198,12 +201,13 @@ describe('attributes helpers tests', function () {
|
|
|
198
201
|
]);
|
|
199
202
|
});
|
|
200
203
|
it('should show operation for relation title if it was deleted and changes are empty', function () {
|
|
201
|
-
|
|
204
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
205
|
+
expect((0, attributes_1.getRelationChanges)(metadata, relationInfo, {}, mdm_sdk_1.DCRTypes.DELETE_RELATIONSHIP, ['lineIds'])).toEqual([
|
|
202
206
|
{
|
|
203
207
|
attributeType: null,
|
|
204
|
-
relationType:
|
|
208
|
+
relationType: metadata.relationTypes[1],
|
|
205
209
|
attributeValue: relationInfo,
|
|
206
|
-
label:
|
|
210
|
+
label: metadata.relationTypes[1].label,
|
|
207
211
|
level: 1,
|
|
208
212
|
operation: mdm_sdk_1.DCROperationTypes.DELETED,
|
|
209
213
|
lineIds: ['lineIds']
|
|
@@ -25,6 +25,7 @@ describe('mergeChanges tests', function () {
|
|
|
25
25
|
};
|
|
26
26
|
it('should create path to change', function () {
|
|
27
27
|
var _a;
|
|
28
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
28
29
|
var changes = (_a = {},
|
|
29
30
|
_a[entityUri] = [
|
|
30
31
|
{
|
|
@@ -38,10 +39,10 @@ describe('mergeChanges tests', function () {
|
|
|
38
39
|
}
|
|
39
40
|
],
|
|
40
41
|
_a);
|
|
41
|
-
expect((0, merge_1.mergeChanges)(
|
|
42
|
+
expect((0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])).toEqual([
|
|
42
43
|
[
|
|
43
44
|
{
|
|
44
|
-
attributeType:
|
|
45
|
+
attributeType: metadata.entityTypes[0].attributes[3],
|
|
45
46
|
attributeValue: {
|
|
46
47
|
id: '45uypcuAz',
|
|
47
48
|
value: {
|
|
@@ -57,7 +58,7 @@ describe('mergeChanges tests', function () {
|
|
|
57
58
|
level: 0
|
|
58
59
|
},
|
|
59
60
|
{
|
|
60
|
-
attributeType:
|
|
61
|
+
attributeType: metadata.entityTypes[0].attributes[3].attributes[0],
|
|
61
62
|
label: 'Identity Type',
|
|
62
63
|
level: 1,
|
|
63
64
|
newValue: changes[entityUri][0].newValue,
|
|
@@ -70,6 +71,7 @@ describe('mergeChanges tests', function () {
|
|
|
70
71
|
});
|
|
71
72
|
it('should merge changes with the same paths', function () {
|
|
72
73
|
var _a;
|
|
74
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
73
75
|
var changes = (_a = {},
|
|
74
76
|
_a[entityUri] = [
|
|
75
77
|
{
|
|
@@ -98,7 +100,7 @@ describe('mergeChanges tests', function () {
|
|
|
98
100
|
{
|
|
99
101
|
level: 0,
|
|
100
102
|
label: 'Address',
|
|
101
|
-
attributeType:
|
|
103
|
+
attributeType: metadata.entityTypes[0].attributes[4],
|
|
102
104
|
attributeValue: {
|
|
103
105
|
id: '138xt4Lu',
|
|
104
106
|
refObjectURI: 'relations/138xt4Lu',
|
|
@@ -117,18 +119,18 @@ describe('mergeChanges tests', function () {
|
|
|
117
119
|
{
|
|
118
120
|
level: 1,
|
|
119
121
|
label: 'Additional Attributes',
|
|
120
|
-
attributeType:
|
|
122
|
+
attributeType: metadata.relationTypes[0].attributes[0],
|
|
121
123
|
attributeValue: { value: changes[entityUri][0] }
|
|
122
124
|
},
|
|
123
125
|
{
|
|
124
|
-
attributeType:
|
|
126
|
+
attributeType: metadata.relationTypes[0].attributes[0].attributes[0],
|
|
125
127
|
newValue: { value: 'testType1' },
|
|
126
128
|
operation: 'added',
|
|
127
129
|
label: 'Attribute Type',
|
|
128
130
|
level: 2
|
|
129
131
|
},
|
|
130
132
|
{
|
|
131
|
-
attributeType:
|
|
133
|
+
attributeType: metadata.relationTypes[0].attributes[0].attributes[1],
|
|
132
134
|
newValue: { value: 'testValue1' },
|
|
133
135
|
operation: 'added',
|
|
134
136
|
label: 'Attribute Value',
|
|
@@ -137,28 +139,29 @@ describe('mergeChanges tests', function () {
|
|
|
137
139
|
{
|
|
138
140
|
level: 1,
|
|
139
141
|
label: 'Additional Attributes',
|
|
140
|
-
attributeType:
|
|
142
|
+
attributeType: metadata.relationTypes[0].attributes[0],
|
|
141
143
|
attributeValue: { value: changes[entityUri][1] }
|
|
142
144
|
},
|
|
143
145
|
{
|
|
144
|
-
attributeType:
|
|
146
|
+
attributeType: metadata.relationTypes[0].attributes[0].attributes[0],
|
|
145
147
|
newValue: { value: 'testType2' },
|
|
146
148
|
operation: 'added',
|
|
147
149
|
label: 'Attribute Type',
|
|
148
150
|
level: 2
|
|
149
151
|
},
|
|
150
152
|
{
|
|
151
|
-
attributeType:
|
|
153
|
+
attributeType: metadata.relationTypes[0].attributes[0].attributes[1],
|
|
152
154
|
newValue: { value: 'testValue2' },
|
|
153
155
|
operation: 'added',
|
|
154
156
|
label: 'Attribute Value',
|
|
155
157
|
level: 2
|
|
156
158
|
}
|
|
157
159
|
];
|
|
158
|
-
expect((0, merge_1.mergeChanges)(
|
|
160
|
+
expect((0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])).toMatchObject([mergedChanges, []]);
|
|
159
161
|
});
|
|
160
162
|
it('should not merge changes with the same paths, but different types', function () {
|
|
161
163
|
var _a;
|
|
164
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
162
165
|
var changes = (_a = {},
|
|
163
166
|
_a[entityUri] = [
|
|
164
167
|
{
|
|
@@ -193,7 +196,7 @@ describe('mergeChanges tests', function () {
|
|
|
193
196
|
{
|
|
194
197
|
level: 0,
|
|
195
198
|
label: 'Customer Identity',
|
|
196
|
-
attributeType:
|
|
199
|
+
attributeType: metadata.entityTypes[0].attributes[3],
|
|
197
200
|
attributeValue: {
|
|
198
201
|
id: '2BNyTheu',
|
|
199
202
|
value: {
|
|
@@ -211,7 +214,7 @@ describe('mergeChanges tests', function () {
|
|
|
211
214
|
}
|
|
212
215
|
},
|
|
213
216
|
{
|
|
214
|
-
attributeType:
|
|
217
|
+
attributeType: metadata.entityTypes[0].attributes[3].attributes[0],
|
|
215
218
|
newValue: {
|
|
216
219
|
value: 'ValueNew'
|
|
217
220
|
},
|
|
@@ -224,7 +227,7 @@ describe('mergeChanges tests', function () {
|
|
|
224
227
|
isReferenceSubAttribute: false
|
|
225
228
|
},
|
|
226
229
|
{
|
|
227
|
-
attributeType:
|
|
230
|
+
attributeType: metadata.entityTypes[0].attributes[3].attributes[0],
|
|
228
231
|
newValue: {
|
|
229
232
|
value: 'ValueOld'
|
|
230
233
|
},
|
|
@@ -234,10 +237,11 @@ describe('mergeChanges tests', function () {
|
|
|
234
237
|
isReferenceSubAttribute: false
|
|
235
238
|
}
|
|
236
239
|
];
|
|
237
|
-
expect((0, merge_1.mergeChanges)(
|
|
240
|
+
expect((0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])).toMatchObject([mergedChanges, []]);
|
|
238
241
|
});
|
|
239
242
|
it('should merge special attributes', function () {
|
|
240
243
|
var _a;
|
|
244
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
241
245
|
var changes = (_a = {},
|
|
242
246
|
_a[entityUri] = [
|
|
243
247
|
{
|
|
@@ -271,10 +275,11 @@ describe('mergeChanges tests', function () {
|
|
|
271
275
|
operation: mdm_sdk_1.DCROperationTypes.EDITED
|
|
272
276
|
}
|
|
273
277
|
];
|
|
274
|
-
expect((0, merge_1.mergeChanges)(
|
|
278
|
+
expect((0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])).toMatchObject([mergedChanges, []]);
|
|
275
279
|
});
|
|
276
280
|
it('should merge relations', function () {
|
|
277
281
|
var _a;
|
|
282
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
278
283
|
var changes = {
|
|
279
284
|
'relations/1EvCRmwC': [
|
|
280
285
|
{
|
|
@@ -310,14 +315,14 @@ describe('mergeChanges tests', function () {
|
|
|
310
315
|
var mergedRelations = [
|
|
311
316
|
{
|
|
312
317
|
attributeType: null,
|
|
313
|
-
relationType:
|
|
318
|
+
relationType: metadata.relationTypes[1],
|
|
314
319
|
attributeValue: __assign(__assign({}, relationsInfo[0]), (_a = {}, _a[mdm_sdk_1.EntityAttrTypes.startDate.name] = [
|
|
315
320
|
{
|
|
316
321
|
newValue: { value: 1643742000000 },
|
|
317
322
|
type: mdm_sdk_1.DCRTypes.INSERT_ATTRIBUTE
|
|
318
323
|
}
|
|
319
324
|
], _a)),
|
|
320
|
-
label:
|
|
325
|
+
label: metadata.relationTypes[1].label,
|
|
321
326
|
lineIds: ['relations/1EvCRmwC/BpiR2Vqh/newValue'],
|
|
322
327
|
level: 1
|
|
323
328
|
},
|
|
@@ -332,11 +337,12 @@ describe('mergeChanges tests', function () {
|
|
|
332
337
|
operation: mdm_sdk_1.DCROperationTypes.ADDED
|
|
333
338
|
}
|
|
334
339
|
];
|
|
335
|
-
expect((0, merge_1.mergeChanges)(
|
|
340
|
+
expect((0, merge_1.mergeChanges)(metadata, changes, objectInfo, relationsInfo)).toMatchObject([[], mergedRelations]);
|
|
336
341
|
});
|
|
337
342
|
it('should merge lineIds when multiple changes have the same attributePath', function () {
|
|
338
343
|
var _a;
|
|
339
344
|
var _b, _c;
|
|
345
|
+
var metadata = (0, metadata_test_data_1.getMetadata)();
|
|
340
346
|
var changes = (_a = {},
|
|
341
347
|
_a[entityUri] = [
|
|
342
348
|
{
|
|
@@ -381,7 +387,7 @@ describe('mergeChanges tests', function () {
|
|
|
381
387
|
}
|
|
382
388
|
],
|
|
383
389
|
_a);
|
|
384
|
-
var mergedChanges = (0, merge_1.mergeChanges)(
|
|
390
|
+
var mergedChanges = (0, merge_1.mergeChanges)(metadata, changes, objectInfo, [])[0];
|
|
385
391
|
expect((_c = (_b = mergedChanges[0]) === null || _b === void 0 ? void 0 : _b.newValue) === null || _c === void 0 ? void 0 : _c.lineIds).toEqual(['line-2', 'line-4']);
|
|
386
392
|
});
|
|
387
393
|
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { Metadata } from '@reltio/mdm-sdk';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const getMetadata: () => Metadata;
|