@orchestrator-ui/orchestrator-ui-components 8.7.0 → 8.7.1
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/.turbo/turbo-build.log +8 -8
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +11 -11
- package/CHANGELOG.md +7 -0
- package/dist/index.d.ts +379 -1244
- package/dist/index.js +936 -1013
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WfoPydanticForm/fields/WfoSummary.tsx +42 -7
- package/src/components/WfoSearchPage/WfoFilterGroup/WfoFilterGroup.tsx +1 -1
- package/src/configuration/version.ts +1 -1
- package/src/messages/en-GB.json +452 -578
- package/src/messages/getTranslationMessages.spec.ts +47 -30
- package/src/messages/nl-NL.json +450 -430
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import { capitalize } from 'lodash';
|
|
4
|
-
import
|
|
4
|
+
import {
|
|
5
|
+
type PydanticFormElement,
|
|
6
|
+
type PydanticFormLabelProviderResponse,
|
|
7
|
+
useGetConfig,
|
|
8
|
+
useLabelProvider,
|
|
9
|
+
} from 'pydantic-forms';
|
|
5
10
|
|
|
6
11
|
import { EuiFlexItem, EuiFormRow, EuiText } from '@elastic/eui';
|
|
7
12
|
|
|
@@ -14,24 +19,53 @@ import { getNestedSummaryLabel } from './wfoPydanticFormUtils';
|
|
|
14
19
|
export const WfoSummary: PydanticFormElement = ({ pydanticFormField }) => {
|
|
15
20
|
const { summaryFieldStyle } = useWithOrchestratorTheme(summaryFieldStyles);
|
|
16
21
|
const { formRowStyle } = useWithOrchestratorTheme(getCommonFormFieldStyles);
|
|
22
|
+
const config = useGetConfig();
|
|
23
|
+
const { data }: { data: PydanticFormLabelProviderResponse | undefined } = useLabelProvider(
|
|
24
|
+
config.labelProvider,
|
|
25
|
+
'temp',
|
|
26
|
+
'test',
|
|
27
|
+
);
|
|
28
|
+
const rawLabels = data?.labels || { summary: {} };
|
|
29
|
+
const labelTranslations: Record<string, string> = {
|
|
30
|
+
...(rawLabels as Record<string, string>),
|
|
31
|
+
...(rawLabels?.summary as Record<string, string>),
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const translateSummaryField = (value: string) => {
|
|
35
|
+
if (value in labelTranslations) {
|
|
36
|
+
return labelTranslations[value];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const match = value.match(/^(.+)_(\d+)$/);
|
|
40
|
+
if (!match) {
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
const [, base, suffix] = match;
|
|
44
|
+
|
|
45
|
+
if (base in labelTranslations) {
|
|
46
|
+
return `${labelTranslations[base]} ${suffix}`;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return snakeToHuman(capitalize(value));
|
|
50
|
+
};
|
|
17
51
|
|
|
18
52
|
const { id, title, description } = pydanticFormField;
|
|
19
53
|
const uniforms = pydanticFormField.schema.uniforms;
|
|
20
54
|
const summaryData = uniforms?.data as unknown as {
|
|
21
|
-
headers: string[]
|
|
55
|
+
headers: string[];
|
|
22
56
|
labels: string[];
|
|
23
57
|
columns: string[][];
|
|
24
58
|
};
|
|
25
59
|
|
|
26
|
-
const headers = summaryData?.headers
|
|
27
|
-
const labels = summaryData?.labels
|
|
60
|
+
const headers = summaryData?.headers;
|
|
61
|
+
const labels = summaryData?.labels;
|
|
28
62
|
const columns = summaryData?.columns || [];
|
|
29
63
|
|
|
30
64
|
const extraColumnsData = columns.filter((_, index) => index !== 0);
|
|
31
65
|
|
|
32
66
|
const rows = columns[0].map((row, index) => (
|
|
33
67
|
<tr key={index}>
|
|
34
|
-
{labels && <td className={`label`}>{getNestedSummaryLabel(labels, index)}</td>}
|
|
68
|
+
{labels && <td className={`label`}>{translateSummaryField(getNestedSummaryLabel(labels, index))}</td>}
|
|
35
69
|
<td className={`value`}>
|
|
36
70
|
{typeof row === 'string' && row.includes('<!doctype html>') ?
|
|
37
71
|
<div className="emailMessage" dangerouslySetInnerHTML={{ __html: row }}></div>
|
|
@@ -52,11 +86,12 @@ export const WfoSummary: PydanticFormElement = ({ pydanticFormField }) => {
|
|
|
52
86
|
: <tr>
|
|
53
87
|
{labels && <th />}
|
|
54
88
|
{headers.map((header, idx) => (
|
|
55
|
-
<th key={idx}>{header}</th>
|
|
89
|
+
<th key={idx}>{translateSummaryField(header)}</th>
|
|
56
90
|
))}
|
|
57
91
|
</tr>;
|
|
58
92
|
|
|
59
|
-
const formattedTitle =
|
|
93
|
+
const formattedTitle =
|
|
94
|
+
title === 'MigrationSummaryValue' ? translateSummaryField(id) : snakeToHuman(capitalize(title ?? ''));
|
|
60
95
|
|
|
61
96
|
return (
|
|
62
97
|
<EuiFlexItem data-testid={id} css={[summaryFieldStyle, formRowStyle]}>
|
|
@@ -113,7 +113,7 @@ export const FilterGroup: FC<FilterGroupProps> = ({
|
|
|
113
113
|
<EuiFlexGroup gutterSize="s" alignItems="center">
|
|
114
114
|
<EuiFlexItem grow={false}>
|
|
115
115
|
<EuiButton size="s" iconType="plusInCircle" onClick={addCondition}>
|
|
116
|
-
{t('
|
|
116
|
+
{t('addRule')}
|
|
117
117
|
</EuiButton>
|
|
118
118
|
</EuiFlexItem>
|
|
119
119
|
<EuiFlexItem grow={false}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '8.7.
|
|
1
|
+
export const ORCHESTRATOR_UI_LIBRARY_VERSION = '8.7.1';
|