@genesislcap/pbc-reconciliation-ui 0.0.45 → 14.339.0
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/.env +3 -0
- package/dist/dts/components/configurations-panel/configuration-datasources/configuration-datasources.d.ts.map +1 -1
- package/dist/dts/components/configurations-panel/configuration-datasources/configuration-datasources.template.d.ts.map +1 -1
- package/dist/dts/components/configurations-panel/configurations-panel.d.ts +2 -2
- package/dist/dts/components/configurations-panel/configurations-panel.d.ts.map +1 -1
- package/dist/dts/components/configurations-panel/configurations-panel.template.d.ts.map +1 -1
- package/dist/dts/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.d.ts.map +1 -1
- package/dist/dts/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.template.d.ts.map +1 -1
- package/dist/dts/components/data-dictionaries/columns.d.ts +2 -2
- package/dist/dts/components/data-dictionaries/columns.d.ts.map +1 -1
- package/dist/dts/components/data-dictionaries/data-dictionaries-utils.d.ts.map +1 -1
- package/dist/dts/components/data-dictionaries/data-dictionaries.d.ts +3 -6
- package/dist/dts/components/data-dictionaries/data-dictionaries.d.ts.map +1 -1
- package/dist/dts/components/data-dictionaries/data-dictionaries.template.d.ts +1 -1
- package/dist/dts/components/data-dictionaries/data-dictionaries.template.d.ts.map +1 -1
- package/dist/dts/components/data-dictionaries/data-dictionaries.types.d.ts +6 -0
- package/dist/dts/components/data-dictionaries/data-dictionaries.types.d.ts.map +1 -0
- package/dist/dts/components/list/list.d.ts.map +1 -1
- package/dist/dts/components/list/list.template.d.ts.map +1 -1
- package/dist/dts/components/rapid-components.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/columns.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/input-parameter/input-parameter.d.ts +3 -14
- package/dist/dts/components/reconciliations-panel/input-parameter/input-parameter.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/input-parameter/input-parameter.template.d.ts +1 -1
- package/dist/dts/components/reconciliations-panel/input-parameter/input-parameter.template.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/input-parameter/input-parameter.types.d.ts +13 -0
- package/dist/dts/components/reconciliations-panel/input-parameter/input-parameter.types.d.ts.map +1 -0
- package/dist/dts/components/reconciliations-panel/reconciliation-no-rows-overlay.d.ts +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliation-no-rows-overlay.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliations-panel.d.ts +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliations-panel.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliations-panel.styles.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliations-panel.template.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliations-panel.utils.d.ts +1 -1
- package/dist/dts/components/reconciliations-panel/reconciliations-panel.utils.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/result-details/result-details.d.ts +4 -33
- package/dist/dts/components/reconciliations-panel/result-details/result-details.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/result-details/result-details.template.d.ts +1 -1
- package/dist/dts/components/reconciliations-panel/result-details/result-details.template.d.ts.map +1 -1
- package/dist/dts/components/reconciliations-panel/result-details/result-details.types.d.ts +30 -0
- package/dist/dts/components/reconciliations-panel/result-details/result-details.types.d.ts.map +1 -0
- package/dist/dts/components/zero-components.d.ts.map +1 -1
- package/dist/dts/config/config.d.ts.map +1 -1
- package/dist/dts/config/configure.d.ts.map +1 -1
- package/dist/dts/config/templates.d.ts +2 -2
- package/dist/dts/config/templates.d.ts.map +1 -1
- package/dist/dts/main/main.d.ts +2 -2
- package/dist/dts/main/main.d.ts.map +1 -1
- package/dist/dts/main/main.styles.d.ts.map +1 -1
- package/dist/dts/main/main.template.d.ts +1 -1
- package/dist/dts/main/main.template.d.ts.map +1 -1
- package/dist/dts/reconciliation.types.d.ts +13 -13
- package/dist/dts/reconciliation.types.d.ts.map +1 -1
- package/dist/dts/sandbox.d.ts +2 -2
- package/dist/dts/sandbox.d.ts.map +1 -1
- package/dist/dts/services/document.service.d.ts.map +1 -1
- package/dist/dts/services/reconciliation-configuration.service.d.ts.map +1 -1
- package/dist/dts/services/reconciliation.service.d.ts.map +1 -1
- package/dist/dts/utils/delete-row-action-cell-renderer.d.ts.map +1 -1
- package/dist/dts/utils/endpoint.d.ts.map +1 -1
- package/dist/dts/utils/eventDetail.d.ts.map +1 -1
- package/dist/dts/utils/format-date.d.ts.map +1 -1
- package/dist/dts/utils/humanize.d.ts.map +1 -1
- package/dist/dts/utils/isEmpty.d.ts.map +1 -1
- package/dist/dts/utils/notification.d.ts.map +1 -1
- package/dist/esm/components/configurations-panel/configuration-datasources/configuration-datasources.js +3 -3
- package/dist/esm/components/configurations-panel/configuration-datasources/configuration-datasources.js.map +1 -1
- package/dist/esm/components/configurations-panel/configuration-datasources/configuration-datasources.styles.js +4 -4
- package/dist/esm/components/configurations-panel/configuration-datasources/configuration-datasources.styles.js.map +1 -1
- package/dist/esm/components/configurations-panel/configuration-datasources/configuration-datasources.template.js +1 -1
- package/dist/esm/components/configurations-panel/configuration-datasources/configuration-datasources.template.js.map +1 -1
- package/dist/esm/components/configurations-panel/configurations-panel.js +15 -11
- package/dist/esm/components/configurations-panel/configurations-panel.js.map +1 -1
- package/dist/esm/components/configurations-panel/configurations-panel.styles.js +346 -346
- package/dist/esm/components/configurations-panel/configurations-panel.styles.js.map +1 -1
- package/dist/esm/components/configurations-panel/configurations-panel.template.js +276 -278
- package/dist/esm/components/configurations-panel/configurations-panel.template.js.map +1 -1
- package/dist/esm/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.js +3 -3
- package/dist/esm/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.js.map +1 -1
- package/dist/esm/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.styles.js +1 -1
- package/dist/esm/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.template.js +1 -1
- package/dist/esm/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.template.js.map +1 -1
- package/dist/esm/components/data-dictionaries/columns.js +4 -4
- package/dist/esm/components/data-dictionaries/data-dictionaries-utils.js.map +1 -1
- package/dist/esm/components/data-dictionaries/data-dictionaries.js +7 -11
- package/dist/esm/components/data-dictionaries/data-dictionaries.js.map +1 -1
- package/dist/esm/components/data-dictionaries/data-dictionaries.styles.js +1 -1
- package/dist/esm/components/data-dictionaries/data-dictionaries.template.js +3 -3
- package/dist/esm/components/data-dictionaries/data-dictionaries.template.js.map +1 -1
- package/dist/esm/components/data-dictionaries/data-dictionaries.types.js +7 -0
- package/dist/esm/components/data-dictionaries/data-dictionaries.types.js.map +1 -0
- package/dist/esm/components/list/list.js +1 -1
- package/dist/esm/components/list/list.js.map +1 -1
- package/dist/esm/components/list/list.template.js.map +1 -1
- package/dist/esm/components/rapid-components.js +1 -2
- package/dist/esm/components/rapid-components.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/columns.js +9 -15
- package/dist/esm/components/reconciliations-panel/columns.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.js +8 -21
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.styles.js +7 -7
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.template.js +9 -12
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.template.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.types.js +16 -0
- package/dist/esm/components/reconciliations-panel/input-parameter/input-parameter.types.js.map +1 -0
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.js +40 -32
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.styles.js +300 -301
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.styles.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.template.js +335 -331
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.template.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.utils.js +9 -9
- package/dist/esm/components/reconciliations-panel/reconciliations-panel.utils.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/result-details/result-details.js +24 -43
- package/dist/esm/components/reconciliations-panel/result-details/result-details.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/result-details/result-details.template.js +7 -7
- package/dist/esm/components/reconciliations-panel/result-details/result-details.template.js.map +1 -1
- package/dist/esm/components/reconciliations-panel/result-details/result-details.types.js +17 -0
- package/dist/esm/components/reconciliations-panel/result-details/result-details.types.js.map +1 -0
- package/dist/esm/components/zero-components.js +2 -3
- package/dist/esm/components/zero-components.js.map +1 -1
- package/dist/esm/config/config.js.map +1 -1
- package/dist/esm/config/configure.js +1 -1
- package/dist/esm/config/configure.js.map +1 -1
- package/dist/esm/config/templates.js +1 -1
- package/dist/esm/main/main.js +4 -4
- package/dist/esm/main/main.js.map +1 -1
- package/dist/esm/main/main.styles.js +1 -0
- package/dist/esm/main/main.styles.js.map +1 -1
- package/dist/esm/main/main.template.js +8 -7
- package/dist/esm/main/main.template.js.map +1 -1
- package/dist/esm/sandbox.js +15 -8
- package/dist/esm/sandbox.js.map +1 -1
- package/dist/esm/services/data-dictionary.service.js +6 -6
- package/dist/esm/services/data-dictionary.service.js.map +1 -1
- package/dist/esm/services/document.service.js +3 -4
- package/dist/esm/services/document.service.js.map +1 -1
- package/dist/esm/services/reconciliation-configuration.service.js +3 -1
- package/dist/esm/services/reconciliation-configuration.service.js.map +1 -1
- package/dist/esm/services/reconciliation.service.js +8 -5
- package/dist/esm/services/reconciliation.service.js.map +1 -1
- package/dist/esm/utils/delete-row-action-cell-renderer.js +1 -3
- package/dist/esm/utils/delete-row-action-cell-renderer.js.map +1 -1
- package/dist/esm/utils/endpoint.js.map +1 -1
- package/dist/esm/utils/humanize.js.map +1 -1
- package/dist/esm/utils/icons.js +1 -1
- package/dist/esm/utils/isEmpty.js.map +1 -1
- package/dist/esm/utils/notification.js +1 -1
- package/dist/esm/utils/notification.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/license.txt +46 -0
- package/package.json +31 -30
- package/src/components/configurations-panel/configuration-datasources/configuration-datasources.styles.ts +72 -0
- package/src/components/configurations-panel/configuration-datasources/configuration-datasources.template.ts +73 -0
- package/src/components/configurations-panel/configuration-datasources/configuration-datasources.ts +64 -0
- package/src/components/configurations-panel/configurations-panel.styles.ts +363 -0
- package/src/components/configurations-panel/configurations-panel.template.ts +356 -0
- package/src/components/configurations-panel/configurations-panel.ts +387 -0
- package/src/components/configurations-panel/recon-rules-columns.ts +117 -0
- package/src/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.styles.ts +73 -0
- package/src/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.template.ts +122 -0
- package/src/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.ts +202 -0
- package/src/components/data-dictionaries/columns.ts +42 -0
- package/src/components/data-dictionaries/data-dictionaries-utils.ts +40 -0
- package/src/components/data-dictionaries/data-dictionaries.styles.ts +92 -0
- package/src/components/data-dictionaries/data-dictionaries.template.ts +78 -0
- package/src/components/data-dictionaries/data-dictionaries.ts +236 -0
- package/src/components/data-dictionaries/data-dictionaries.types.ts +5 -0
- package/src/components/list/list.styles.ts +88 -0
- package/src/components/list/list.template.ts +36 -0
- package/src/components/list/list.ts +33 -0
- package/src/components/rapid-components.ts +69 -0
- package/src/components/reconciliations-panel/columns.ts +74 -0
- package/src/components/reconciliations-panel/input-parameter/input-parameter.styles.ts +104 -0
- package/src/components/reconciliations-panel/input-parameter/input-parameter.template.ts +93 -0
- package/src/components/reconciliations-panel/input-parameter/input-parameter.ts +131 -0
- package/src/components/reconciliations-panel/input-parameter/input-parameter.types.ts +14 -0
- package/src/components/reconciliations-panel/reconciliation-no-rows-overlay.ts +18 -0
- package/src/components/reconciliations-panel/reconciliations-panel.styles.ts +328 -0
- package/src/components/reconciliations-panel/reconciliations-panel.template.ts +432 -0
- package/src/components/reconciliations-panel/reconciliations-panel.ts +441 -0
- package/src/components/reconciliations-panel/reconciliations-panel.utils.ts +103 -0
- package/src/components/reconciliations-panel/result-details/result-details.styles.ts +108 -0
- package/src/components/reconciliations-panel/result-details/result-details.template.ts +88 -0
- package/src/components/reconciliations-panel/result-details/result-details.ts +200 -0
- package/src/components/reconciliations-panel/result-details/result-details.types.ts +30 -0
- package/src/components/zero-components.ts +61 -0
- package/src/config/config.ts +49 -0
- package/src/config/configure.ts +72 -0
- package/src/config/index.ts +2 -0
- package/src/config/templates.ts +80 -0
- package/src/globals.d.ts +7 -0
- package/src/index.federated.ts +1 -0
- package/src/index.ts +3 -0
- package/src/main/index.ts +3 -0
- package/src/main/main.styles.ts +33 -0
- package/src/main/main.template.ts +65 -0
- package/src/main/main.ts +153 -0
- package/src/reconciliation.types.ts +170 -0
- package/src/sandbox.ts +40 -0
- package/src/services/data-dictionary.service.ts +64 -0
- package/src/services/document.service.ts +72 -0
- package/src/services/reconciliation-configuration.service.ts +105 -0
- package/src/services/reconciliation.service.ts +120 -0
- package/src/styles/scrollbar.styles.ts +15 -0
- package/src/tags/index.ts +1 -0
- package/src/tags/tags.ts +143 -0
- package/src/typings.d.ts +1 -0
- package/src/utils/delete-row-action-cell-renderer.ts +71 -0
- package/src/utils/endpoint.ts +15 -0
- package/src/utils/eventDetail.ts +5 -0
- package/src/utils/format-date.ts +9 -0
- package/src/utils/humanize.ts +14 -0
- package/src/utils/icons.ts +24 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/isEmpty.ts +2 -0
- package/src/utils/logger.ts +3 -0
- package/src/utils/notification.ts +35 -0
- package/tsconfig.json +45 -0
- package/Dockerfile +0 -12
- package/docs/images/lsp_jetbrains_one.png +0 -0
- package/docs/images/lsp_jetbrains_two.png +0 -0
- package/docs/images/lsp_vscode_one.png +0 -0
- package/docs/images/lsp_vscode_two.png +0 -0
- package/playwright.config.ts +0 -1
- package/test/README.md +0 -3
- package/test/e2e/fixture.ts +0 -25
- package/test/e2e/flows/001-protected.e2e.ts +0 -6
- package/test/e2e/index.ts +0 -2
- package/test/e2e/pages/index.ts +0 -1
- package/test/e2e/pages/protected.ts +0 -16
- package/test/unit/mock/services/data-dictionary-service-mock.ts +0 -15
- package/test/unit/mock/services/reconciliation-configuration-service-mock.ts +0 -26
- package/test/unit/mock/services/reconciliation-service-mock.ts +0 -11
package/src/components/configurations-panel/reconciliation-rule-row/reconciliation-rule-row.ts
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { GenesisElement, customElement, observable } from '@genesislcap/web-core';
|
|
2
|
+
import {
|
|
3
|
+
DataDictionaryField,
|
|
4
|
+
FieldType,
|
|
5
|
+
ReconConfigurationRule,
|
|
6
|
+
ToleranceType,
|
|
7
|
+
RuleMode,
|
|
8
|
+
} from '../../../reconciliation.types';
|
|
9
|
+
import { showNotificationError } from '../../../utils/notification';
|
|
10
|
+
import { ReconciliationRuleRowStyles as styles } from './reconciliation-rule-row.styles';
|
|
11
|
+
import { ReconciliationRuleRowTemplate as template } from './reconciliation-rule-row.template';
|
|
12
|
+
|
|
13
|
+
@customElement({
|
|
14
|
+
name: 'reconciliation-rule-row',
|
|
15
|
+
template,
|
|
16
|
+
styles,
|
|
17
|
+
})
|
|
18
|
+
export class ReconciliationRuleRow extends GenesisElement {
|
|
19
|
+
@observable dataDictionaryFields: Array<DataDictionaryField> = [];
|
|
20
|
+
@observable filteredRuleFields: Array<DataDictionaryField> = [];
|
|
21
|
+
@observable toleranceTypes: Array<ToleranceType> = [];
|
|
22
|
+
@observable fieldName: string = null;
|
|
23
|
+
@observable fieldType: FieldType = null;
|
|
24
|
+
@observable toleranceType: ToleranceType = null;
|
|
25
|
+
@observable toleranceValue: string;
|
|
26
|
+
@observable isMatchKey: boolean = false;
|
|
27
|
+
@observable mode: RuleMode = RuleMode.ADD;
|
|
28
|
+
@observable reconRule: ReconConfigurationRule;
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
super.connectedCallback();
|
|
31
|
+
if (this.mode === RuleMode.EDIT) {
|
|
32
|
+
this.fieldName = this.reconRule.FIELD_NAME;
|
|
33
|
+
this.fieldType = this.reconRule.FIELD_TYPE;
|
|
34
|
+
this.toleranceType = this.reconRule.TOLERANCE_TYPE;
|
|
35
|
+
this.toleranceValue = this.reconRule.TOLERANCE_VALUE;
|
|
36
|
+
this.isMatchKey = this.reconRule.IS_MATCH_KEY;
|
|
37
|
+
}
|
|
38
|
+
this.toleranceTypes = this.getToleranceTypes(this.fieldType);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
dataDictionaryFieldChanged() {
|
|
42
|
+
this.fieldType = this.dataDictionaryFields.find(
|
|
43
|
+
(field) => field.FIELD_NAME === this.fieldName,
|
|
44
|
+
).FIELD_TYPE;
|
|
45
|
+
this.toleranceTypes = this.getToleranceTypes(this.fieldType);
|
|
46
|
+
this.toleranceType = this.toleranceTypes[0];
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getToleranceTypes(fieldType) {
|
|
50
|
+
let toleranceTypes = [];
|
|
51
|
+
switch (fieldType) {
|
|
52
|
+
case FieldType.DATE:
|
|
53
|
+
toleranceTypes = [ToleranceType.EQUALITY, ToleranceType.DAYS];
|
|
54
|
+
break;
|
|
55
|
+
case FieldType.DATETIME:
|
|
56
|
+
toleranceTypes = [ToleranceType.EQUALITY, ToleranceType.MINUTES];
|
|
57
|
+
break;
|
|
58
|
+
case FieldType.INT:
|
|
59
|
+
case FieldType.BIGDECIMAL:
|
|
60
|
+
case FieldType.DOUBLE:
|
|
61
|
+
case FieldType.LONG:
|
|
62
|
+
case FieldType.SHORT:
|
|
63
|
+
toleranceTypes = [ToleranceType.EQUALITY, ToleranceType.ABSOLUTE, ToleranceType.PERCENTAGE];
|
|
64
|
+
break;
|
|
65
|
+
default:
|
|
66
|
+
toleranceTypes = [ToleranceType.EQUALITY];
|
|
67
|
+
}
|
|
68
|
+
return toleranceTypes;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
formatToleranceValue(type, value) {
|
|
72
|
+
if (type === ToleranceType.ABSOLUTE) {
|
|
73
|
+
value = this.convertToAbsolute(value);
|
|
74
|
+
} else if (type === ToleranceType.PERCENTAGE) {
|
|
75
|
+
value = this.convertToPercentage(value);
|
|
76
|
+
} else if (type === ToleranceType.DAYS || this.toleranceType === ToleranceType.MINUTES) {
|
|
77
|
+
value = value.replace(/[^0-9]/g, '');
|
|
78
|
+
}
|
|
79
|
+
return value;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
toleranceValChanged(evt) {
|
|
83
|
+
evt.preventDefault();
|
|
84
|
+
evt.stopPropagation();
|
|
85
|
+
const { value } = evt.target;
|
|
86
|
+
this.toleranceValue = this.formatToleranceValue(this.toleranceType, value);
|
|
87
|
+
if (this.mode === RuleMode.EDIT) {
|
|
88
|
+
this.updateReconRule();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
tolTypeChanged() {
|
|
93
|
+
this.toleranceValue = null;
|
|
94
|
+
if (this.mode === RuleMode.EDIT) {
|
|
95
|
+
this.updateReconRule();
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
togglePrimaryKey() {
|
|
100
|
+
this.isMatchKey = !this.isMatchKey;
|
|
101
|
+
if (this.mode === RuleMode.EDIT) {
|
|
102
|
+
this.updateReconRule();
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
adjustDecimalPoints(value, parts) {
|
|
107
|
+
if (parts.length > 2) {
|
|
108
|
+
value = parts[0] + '.' + parts.slice(1).join('');
|
|
109
|
+
}
|
|
110
|
+
return value;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
convertToAbsolute(value) {
|
|
114
|
+
const parts = value.split('.');
|
|
115
|
+
value = this.adjustDecimalPoints(value, parts);
|
|
116
|
+
|
|
117
|
+
const digitsCount = value.replace(/\./g, '').length;
|
|
118
|
+
const numericValue = parseFloat(value);
|
|
119
|
+
if (isNaN(numericValue) || numericValue < 0) {
|
|
120
|
+
value = '0';
|
|
121
|
+
} else if (digitsCount > 8) {
|
|
122
|
+
if (parts.length > 1) {
|
|
123
|
+
const integerPart = parts[0];
|
|
124
|
+
const fractionalPart = parts[1];
|
|
125
|
+
if (integerPart.length >= 8) {
|
|
126
|
+
value = integerPart.slice(0, 8);
|
|
127
|
+
} else {
|
|
128
|
+
const remainingDigits = 8 - integerPart.length;
|
|
129
|
+
value = integerPart + '.' + fractionalPart.slice(0, remainingDigits);
|
|
130
|
+
}
|
|
131
|
+
} else {
|
|
132
|
+
value = value.slice(0, 8);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return value;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
convertToPercentage(value) {
|
|
139
|
+
const parts = value.split('.');
|
|
140
|
+
value = this.adjustDecimalPoints(value, parts);
|
|
141
|
+
|
|
142
|
+
if (parts.length === 2) {
|
|
143
|
+
parts[1] = parts[1].slice(0, 2);
|
|
144
|
+
value = parts[0] + '.' + parts[1];
|
|
145
|
+
}
|
|
146
|
+
let numericValue = parseFloat(value);
|
|
147
|
+
if (isNaN(numericValue) || numericValue < 0 || numericValue > 100) {
|
|
148
|
+
numericValue = null;
|
|
149
|
+
}
|
|
150
|
+
return numericValue !== null ? numericValue.toString() : '0';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
resetRule() {
|
|
154
|
+
this.fieldName = '';
|
|
155
|
+
this.fieldType = null;
|
|
156
|
+
this.toleranceTypes = [];
|
|
157
|
+
this.toleranceValue = null;
|
|
158
|
+
this.isMatchKey = false;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
validateTolerance() {
|
|
162
|
+
return (
|
|
163
|
+
this.toleranceType && this.toleranceType !== ToleranceType.EQUALITY && !this.toleranceValue
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
addRule() {
|
|
168
|
+
if (!this.fieldName || !this.fieldType || !this.toleranceType || this.validateTolerance()) {
|
|
169
|
+
showNotificationError([
|
|
170
|
+
{
|
|
171
|
+
CODE: 'Missing Fields',
|
|
172
|
+
TEXT: 'Please fill in all required fields for adding a rule.',
|
|
173
|
+
},
|
|
174
|
+
]);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const rule: ReconConfigurationRule = {
|
|
178
|
+
FIELD_NAME: this.fieldName,
|
|
179
|
+
FIELD_TYPE: this.fieldType,
|
|
180
|
+
TOLERANCE_TYPE: this.toleranceType,
|
|
181
|
+
TOLERANCE_VALUE: this.toleranceValue || null,
|
|
182
|
+
IS_MATCH_KEY: this.isMatchKey,
|
|
183
|
+
};
|
|
184
|
+
this.$emit('addRule', rule);
|
|
185
|
+
this.resetRule();
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
deleteRule() {
|
|
189
|
+
this.$emit('deleteRule');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
updateReconRule() {
|
|
193
|
+
const rule: ReconConfigurationRule = {
|
|
194
|
+
FIELD_NAME: this.fieldName,
|
|
195
|
+
FIELD_TYPE: this.fieldType,
|
|
196
|
+
TOLERANCE_TYPE: this.toleranceType,
|
|
197
|
+
TOLERANCE_VALUE: this.toleranceValue || null,
|
|
198
|
+
IS_MATCH_KEY: this.isMatchKey,
|
|
199
|
+
};
|
|
200
|
+
this.$emit('updateRule', rule);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { FieldType } from '../../reconciliation.types';
|
|
2
|
+
import { iconTag } from '../../tags';
|
|
3
|
+
import { DeleteRowActionCellRenderer } from '../../utils/delete-row-action-cell-renderer';
|
|
4
|
+
|
|
5
|
+
export const DATA_DICTIONARY_FIELDS_COLUMNS = (context) => [
|
|
6
|
+
{
|
|
7
|
+
field: 'FIELD_NAME',
|
|
8
|
+
headerName: 'Field',
|
|
9
|
+
editable: true,
|
|
10
|
+
flex: 2,
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
field: 'FIELD_TYPE',
|
|
14
|
+
headerName: 'Type',
|
|
15
|
+
editable: true,
|
|
16
|
+
flex: 2,
|
|
17
|
+
cellEditor: 'agSelectCellEditor',
|
|
18
|
+
cellEditorParams: {
|
|
19
|
+
values: Object.values(FieldType),
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
headerName: '',
|
|
24
|
+
flex: 1,
|
|
25
|
+
cellRenderer: DeleteRowActionCellRenderer,
|
|
26
|
+
cellRendererParams: (params) => {
|
|
27
|
+
const deleteButton = {
|
|
28
|
+
name: `<${iconTag} name="minus" size="lg"></${iconTag}>`,
|
|
29
|
+
callback: (detail) => {
|
|
30
|
+
context.removeRowEvent(params.data);
|
|
31
|
+
},
|
|
32
|
+
actionName: 'Delete',
|
|
33
|
+
};
|
|
34
|
+
const actions = [deleteButton];
|
|
35
|
+
const enabled = true;
|
|
36
|
+
return {
|
|
37
|
+
actions,
|
|
38
|
+
enabled,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
];
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { showNotificationDialog } from '@genesislcap/foundation-notifications';
|
|
2
|
+
|
|
3
|
+
export function createNotificationDialog(
|
|
4
|
+
context: any,
|
|
5
|
+
title: string,
|
|
6
|
+
body: string,
|
|
7
|
+
labelDismissing: string,
|
|
8
|
+
actionDismissing: any,
|
|
9
|
+
labelConfirming: string,
|
|
10
|
+
actionConfirming: any,
|
|
11
|
+
actionParams?: Array<any>,
|
|
12
|
+
) {
|
|
13
|
+
showNotificationDialog(
|
|
14
|
+
{
|
|
15
|
+
title,
|
|
16
|
+
body,
|
|
17
|
+
dialog: {
|
|
18
|
+
dismissingAction: {
|
|
19
|
+
label: labelDismissing,
|
|
20
|
+
// eslint-disable-next-line no-return-await
|
|
21
|
+
action: async () => await actionDismissing,
|
|
22
|
+
},
|
|
23
|
+
confirmingActions: [
|
|
24
|
+
{
|
|
25
|
+
label: labelConfirming,
|
|
26
|
+
action: async () => {
|
|
27
|
+
if (actionParams) {
|
|
28
|
+
await actionConfirming.apply(context, actionParams);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
await context[actionConfirming.name]();
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
'rapid',
|
|
39
|
+
);
|
|
40
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { css } from '@genesislcap/web-core';
|
|
2
|
+
import { buttonTag, selectTag, textFieldTag } from '../../tags';
|
|
3
|
+
|
|
4
|
+
const PERC_LIST = '20';
|
|
5
|
+
const PERC_FIELDS_AND_ACTIONS = '80';
|
|
6
|
+
|
|
7
|
+
const fields = css`
|
|
8
|
+
${textFieldTag},
|
|
9
|
+
${selectTag} {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
${textFieldTag}::part(root) {
|
|
16
|
+
height: calc(var(--design-unit) * 9px);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
${buttonTag}.add {
|
|
20
|
+
height: calc(var(--design-unit) * 9px);
|
|
21
|
+
display: flex;
|
|
22
|
+
margin: 0;
|
|
23
|
+
background-color: rgb(122 204 121 / 50%);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
${buttonTag}.add::part(control) {
|
|
27
|
+
padding: 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
label {
|
|
31
|
+
font-weight: bold;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.add-icon {
|
|
35
|
+
color: var(--success-color);
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
|
|
39
|
+
const dataDictionaryFieldsAndActions = css`
|
|
40
|
+
.data-dictionary-fields-and-actions {
|
|
41
|
+
display: flex;
|
|
42
|
+
flex-direction: column;
|
|
43
|
+
height: 100%;
|
|
44
|
+
flex: 1 1 ${PERC_FIELDS_AND_ACTIONS}%;
|
|
45
|
+
min-height: 0;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.data-dictionary-fields {
|
|
49
|
+
display: flex;
|
|
50
|
+
flex-direction: column;
|
|
51
|
+
height: 100%;
|
|
52
|
+
padding: calc(var(--design-unit) * 4px);
|
|
53
|
+
gap: calc(var(--design-unit) * 4px);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.data-dictionary-field,
|
|
57
|
+
.data-dictionary-grid {
|
|
58
|
+
display: flex;
|
|
59
|
+
flex-direction: column;
|
|
60
|
+
gap: calc(var(--design-unit) * 2px);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.data-dictionary-add-field {
|
|
64
|
+
display: flex;
|
|
65
|
+
flex-direction: row;
|
|
66
|
+
align-items: center;
|
|
67
|
+
gap: calc(var(--design-unit) * 2px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.data-dictionary-grid {
|
|
71
|
+
height: 100%;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.data-dictionary-actions {
|
|
75
|
+
display: flex;
|
|
76
|
+
flex-direction: row-reverse;
|
|
77
|
+
border-top: calc(var(--stroke-width) * 1px) solid var(--neutral-stroke-divider-rest);
|
|
78
|
+
padding: calc(var(--design-unit) * 4px);
|
|
79
|
+
gap: calc(var(--design-unit) * 2px);
|
|
80
|
+
}
|
|
81
|
+
`;
|
|
82
|
+
|
|
83
|
+
export const DataDictionariesStyles = css`
|
|
84
|
+
.data-dictionaries {
|
|
85
|
+
display: flex;
|
|
86
|
+
flex-direction: row;
|
|
87
|
+
height: 100%;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
${fields}
|
|
91
|
+
${dataDictionaryFieldsAndActions}
|
|
92
|
+
`;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { html, ref, sync, when } from '@genesislcap/web-core';
|
|
2
|
+
import { FieldType } from '../../reconciliation.types';
|
|
3
|
+
import { buttonTag, gridTag, iconTag, optionTag, selectTag, textFieldTag } from '../../tags';
|
|
4
|
+
import { eventDetail } from '../../utils/eventDetail';
|
|
5
|
+
import { humanize } from '../../utils/humanize';
|
|
6
|
+
import type { DataDictionaries } from './data-dictionaries';
|
|
7
|
+
import { DataDictionaryOperation } from './data-dictionaries.types';
|
|
8
|
+
|
|
9
|
+
export const DataDictionariesTemplate = html<DataDictionaries>`
|
|
10
|
+
<div class="data-dictionaries">
|
|
11
|
+
<item-list
|
|
12
|
+
:items=${(x) => x.dictionaries}
|
|
13
|
+
:idProperty=${(_) => 'DICTIONARY_ID'}
|
|
14
|
+
:nameProperty=${(_) => 'DICTIONARY_NAME'}
|
|
15
|
+
:title=${(_) => 'All Dictionaries'}
|
|
16
|
+
:addButtonLabel=${(_) => 'New Dictionary'}
|
|
17
|
+
:selectedItem=${(x) => x.dictionarySelected}
|
|
18
|
+
@addRecord=${(x) => x.createDataDictionary()}
|
|
19
|
+
@selectRecord=${(x, c) => x.editDataDictionary(eventDetail(c))}
|
|
20
|
+
@deleteRecord=${(x, c) => x.deleteDataDictionary(eventDetail(c))}
|
|
21
|
+
></item-list>
|
|
22
|
+
|
|
23
|
+
${when(
|
|
24
|
+
(x) => [DataDictionaryOperation.CREATE, DataDictionaryOperation.UPDATE].includes(x.operation),
|
|
25
|
+
html<DataDictionaries>`
|
|
26
|
+
<div class="data-dictionary-fields-and-actions">
|
|
27
|
+
<div class="data-dictionary-fields">
|
|
28
|
+
<div class="data-dictionary-field">
|
|
29
|
+
<label>Dictionary Name</label>
|
|
30
|
+
<${textFieldTag} :value=${sync((x) => x.dictionaryName)}></${textFieldTag}>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="data-dictionary-field">
|
|
34
|
+
<label>New Field</label>
|
|
35
|
+
<div class="data-dictionary-add-field">
|
|
36
|
+
<${textFieldTag} :value=${sync((x) => x.fieldName)}></${textFieldTag}>
|
|
37
|
+
|
|
38
|
+
<${selectTag} :value=${sync((x) => x.fieldType)}>
|
|
39
|
+
<options-datasource
|
|
40
|
+
value-field="value"
|
|
41
|
+
label-field="value"
|
|
42
|
+
option-element="${optionTag}"
|
|
43
|
+
:data=${(_) => Object.values(FieldType).map((value) => ({ value }))}
|
|
44
|
+
>
|
|
45
|
+
</options-datasource>
|
|
46
|
+
</${selectTag}>
|
|
47
|
+
|
|
48
|
+
<${buttonTag} class="add" @click=${(x) => x.addField()}>
|
|
49
|
+
<${iconTag} name="plus" size="lg"></${iconTag}>
|
|
50
|
+
</${buttonTag}>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
<div class="data-dictionary-grid">
|
|
55
|
+
<label>Existing Fields</label>
|
|
56
|
+
<${gridTag} ${ref('grid')} :gridOptions=${(x) => x.gridOptions}></${gridTag}>
|
|
57
|
+
</div>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div class="data-dictionary-actions">
|
|
61
|
+
<${buttonTag} appearance="primary" @click=${(x) => x.submit()}>
|
|
62
|
+
<${iconTag} name="pen-to-square" size="lg" variant="regular"></${iconTag}>
|
|
63
|
+
${(x) => humanize(x.operation)} Dictionary
|
|
64
|
+
</${buttonTag}>
|
|
65
|
+
<${buttonTag} @click=${(x) => x.clearFields()}>
|
|
66
|
+
<${iconTag} name="broom" size="lg"></${iconTag}>
|
|
67
|
+
Clear
|
|
68
|
+
</${buttonTag}>
|
|
69
|
+
<${buttonTag} @click=${(x) => x.close()}>
|
|
70
|
+
<${iconTag} name="xmark" size="lg"></${iconTag}>
|
|
71
|
+
Close
|
|
72
|
+
</${buttonTag}>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
`,
|
|
76
|
+
)}
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { GridPro } from '@genesislcap/rapid-grid-pro';
|
|
2
|
+
import { DOM, GenesisElement, customElement, observable } from '@genesislcap/web-core';
|
|
3
|
+
import { DataDictionary, FieldType } from '../../reconciliation.types';
|
|
4
|
+
import { DataDictionaryService } from '../../services/data-dictionary.service';
|
|
5
|
+
import { logger } from '../../utils';
|
|
6
|
+
import { isEmpty } from '../../utils/isEmpty';
|
|
7
|
+
import { showNotificationError } from '../../utils/notification';
|
|
8
|
+
import { DATA_DICTIONARY_FIELDS_COLUMNS } from './columns';
|
|
9
|
+
import { createNotificationDialog } from './data-dictionaries-utils';
|
|
10
|
+
import { DataDictionariesStyles } from './data-dictionaries.styles';
|
|
11
|
+
import { DataDictionariesTemplate } from './data-dictionaries.template';
|
|
12
|
+
import { DataDictionaryOperation } from './data-dictionaries.types';
|
|
13
|
+
|
|
14
|
+
export { DataDictionaryOperation };
|
|
15
|
+
|
|
16
|
+
@customElement({
|
|
17
|
+
name: 'data-dictionaries',
|
|
18
|
+
template: DataDictionariesTemplate,
|
|
19
|
+
styles: DataDictionariesStyles,
|
|
20
|
+
})
|
|
21
|
+
export class DataDictionaries extends GenesisElement {
|
|
22
|
+
@DataDictionaryService dataDictionaryService: DataDictionaryService;
|
|
23
|
+
|
|
24
|
+
@observable operation: DataDictionaryOperation = null;
|
|
25
|
+
@observable dictionaries: Array<DataDictionary> = [];
|
|
26
|
+
|
|
27
|
+
@observable dictionarySelected: DataDictionary = null;
|
|
28
|
+
|
|
29
|
+
@observable dictionaryName: string = null;
|
|
30
|
+
@observable fieldName: string = null;
|
|
31
|
+
@observable fieldType: string = null;
|
|
32
|
+
@observable gridOptions = {};
|
|
33
|
+
|
|
34
|
+
@observable fields = [];
|
|
35
|
+
|
|
36
|
+
grid: GridPro;
|
|
37
|
+
|
|
38
|
+
async connectedCallback() {
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
this.setGridOptions([]);
|
|
41
|
+
this.dictionaries = await this.dataDictionaryService.getDataDictionaries();
|
|
42
|
+
this.fieldType = FieldType.STRING;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// #region Create, Update and Delete
|
|
46
|
+
createDataDictionary() {
|
|
47
|
+
this.operation = DataDictionaryOperation.CREATE;
|
|
48
|
+
this.dictionarySelected = null;
|
|
49
|
+
this.dictionaryName = null;
|
|
50
|
+
this.fieldName = null;
|
|
51
|
+
this.setGridOptions([]);
|
|
52
|
+
DOM.queueUpdate(() => {
|
|
53
|
+
this.setGridRows([]);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
async editDataDictionary(dataDictionary: DataDictionary) {
|
|
58
|
+
this.dictionarySelected = dataDictionary;
|
|
59
|
+
this.dictionaryName = dataDictionary.DICTIONARY_NAME;
|
|
60
|
+
const data = await this.dataDictionaryService.getDataDictionaryFields(
|
|
61
|
+
this.dictionarySelected.DICTIONARY_ID,
|
|
62
|
+
);
|
|
63
|
+
this.setGridOptions(data);
|
|
64
|
+
DOM.queueUpdate(() => {
|
|
65
|
+
this.setGridRows(data);
|
|
66
|
+
});
|
|
67
|
+
this.operation = DataDictionaryOperation.UPDATE;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
setGridOptions(data) {
|
|
71
|
+
Object.assign(this.gridOptions, {
|
|
72
|
+
defaultColDef: {
|
|
73
|
+
cellStyle: {
|
|
74
|
+
display: 'flex',
|
|
75
|
+
alignItems: 'center',
|
|
76
|
+
},
|
|
77
|
+
flex: 2,
|
|
78
|
+
sortable: false,
|
|
79
|
+
suppressMenu: true,
|
|
80
|
+
resizable: false,
|
|
81
|
+
},
|
|
82
|
+
columnDefs: DATA_DICTIONARY_FIELDS_COLUMNS(this),
|
|
83
|
+
rowData: data,
|
|
84
|
+
headerHeight: 40,
|
|
85
|
+
rowHeight: 40,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
async deleteDataDictionary(index: number) {
|
|
90
|
+
this.operation = DataDictionaryOperation.DELETE;
|
|
91
|
+
const dataDictionary = this.dictionaries[index];
|
|
92
|
+
createNotificationDialog(
|
|
93
|
+
this,
|
|
94
|
+
`Confirm Delete`,
|
|
95
|
+
`Do you really want to delete this data dictionary [${dataDictionary.DICTIONARY_NAME}]?`,
|
|
96
|
+
'No',
|
|
97
|
+
this.clear,
|
|
98
|
+
'Yes',
|
|
99
|
+
this.executeDeleteDictionary,
|
|
100
|
+
[index],
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
clear() {
|
|
105
|
+
this.operation = null;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async executeDeleteDictionary(index) {
|
|
109
|
+
const response: Promise<boolean> = await this.dataDictionaryService.deleteDataDictionary(
|
|
110
|
+
this.dictionaries[index].DICTIONARY_ID,
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
if (response) {
|
|
114
|
+
this.dictionaries.splice(index, 1);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
logger.error('Error deleting data dictionary');
|
|
119
|
+
}
|
|
120
|
+
// #endregion
|
|
121
|
+
|
|
122
|
+
// #region Grid Events
|
|
123
|
+
|
|
124
|
+
addField() {
|
|
125
|
+
if (this.fields.some((field) => field.FIELD_NAME === this.fieldName)) {
|
|
126
|
+
createNotificationDialog(
|
|
127
|
+
this,
|
|
128
|
+
`${this.fieldName} already exists`,
|
|
129
|
+
'This field already exists. Do you want to overwrite it?',
|
|
130
|
+
'No',
|
|
131
|
+
null,
|
|
132
|
+
'Yes',
|
|
133
|
+
this.editRow,
|
|
134
|
+
);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const field = {
|
|
139
|
+
FIELD_NAME: this.fieldName,
|
|
140
|
+
FIELD_TYPE: this.fieldType,
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
this.setGridRows(this.fields.concat(field));
|
|
144
|
+
|
|
145
|
+
this.fieldName = null;
|
|
146
|
+
this.fieldType = FieldType.STRING;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
private editRow() {
|
|
150
|
+
this.fields.find((x) => x.FIELD_NAME === this.fieldName).FIELD_TYPE = this.fieldType;
|
|
151
|
+
this.grid?.gridApi?.refreshCells();
|
|
152
|
+
this.fieldName = null;
|
|
153
|
+
this.fieldType = FieldType.STRING;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
removeRowEvent(params) {
|
|
157
|
+
this.setGridRows(this.fields.filter((x) => x.FIELD_NAME !== params.FIELD_NAME));
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
setGridRows(rows) {
|
|
161
|
+
this.fields = rows;
|
|
162
|
+
this.grid?.gridApi?.setRowData(this.fields);
|
|
163
|
+
}
|
|
164
|
+
// #endregion
|
|
165
|
+
|
|
166
|
+
clearFields() {
|
|
167
|
+
this.setGridRows([]);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
close() {
|
|
171
|
+
this.dictionaryName = null;
|
|
172
|
+
this.fieldName = null;
|
|
173
|
+
this.operation = null;
|
|
174
|
+
this.dictionarySelected = null;
|
|
175
|
+
this.fieldType = FieldType.STRING;
|
|
176
|
+
this.setGridRows([]);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
async submit() {
|
|
180
|
+
if (isEmpty(this.dictionaryName)) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
if (this.fields.length <= 0) {
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
switch (this.operation) {
|
|
189
|
+
case DataDictionaryOperation.CREATE:
|
|
190
|
+
const dataDictionaryCreate = {
|
|
191
|
+
DICTIONARY_NAME: this.dictionaryName,
|
|
192
|
+
FIELDS: this.fields,
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
await this.dataDictionaryService
|
|
196
|
+
.createDataDictionary(dataDictionaryCreate)
|
|
197
|
+
.then(async (response) => this.validateResponse(response));
|
|
198
|
+
|
|
199
|
+
break;
|
|
200
|
+
case DataDictionaryOperation.UPDATE:
|
|
201
|
+
const dataDictionaryUpdate = {
|
|
202
|
+
DICTIONARY_ID: this.dictionarySelected.DICTIONARY_ID,
|
|
203
|
+
DICTIONARY_NAME: this.dictionaryName,
|
|
204
|
+
FIELDS: this.fields.map((field) => ({
|
|
205
|
+
...field,
|
|
206
|
+
DICTIONARY_ID: this.dictionarySelected.DICTIONARY_ID,
|
|
207
|
+
})),
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
await this.dataDictionaryService
|
|
211
|
+
.editDataDictionary(dataDictionaryUpdate)
|
|
212
|
+
.then(async (response) => this.validateResponse(response));
|
|
213
|
+
|
|
214
|
+
break;
|
|
215
|
+
default:
|
|
216
|
+
logger.error(`Unknown operation ${this.operation}`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
async validateResponse(response) {
|
|
221
|
+
if (response.MESSAGE_TYPE === 'EVENT_ACK') {
|
|
222
|
+
this.dictionaries = await this.dataDictionaryService.getDataDictionaries();
|
|
223
|
+
if (this.operation === DataDictionaryOperation.CREATE) {
|
|
224
|
+
this.dictionarySelected = this.dictionaries.find(
|
|
225
|
+
(dictionary) => dictionary.DICTIONARY_ID === response.GENERATED[0].DICTIONARY_ID,
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
this.operation = DataDictionaryOperation.UPDATE;
|
|
230
|
+
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
showNotificationError(response.ERROR);
|
|
235
|
+
}
|
|
236
|
+
}
|