@truedat/core 6.1.4 → 6.2.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/package.json +3 -3
- package/src/components/AdminMenu.js +2 -0
- package/src/components/RichTextEditor.js +4 -1
- package/src/components/TreeSelector.js +6 -0
- package/src/components/__tests__/__snapshots__/AdminMenu.spec.js.snap +13 -0
- package/src/components/__tests__/__snapshots__/DomainSelector.spec.js.snap +1 -0
- package/src/components/__tests__/__snapshots__/HierarchySelector.spec.js.snap +1 -0
- package/src/components/__tests__/__snapshots__/SideMenu.spec.js.snap +6 -0
- package/src/components/__tests__/__snapshots__/TreeSelector.spec.js.snap +1 -0
- package/src/i18n/components/Languages.js +20 -7
- package/src/messages/en.js +1 -0
- package/src/messages/es.js +1 -0
- package/src/routes.js +2 -0
- package/src/search/SearchContext.js +0 -1
- package/src/services/i18nContent.js +58 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.2.0",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"@testing-library/jest-dom": "^5.16.5",
|
|
36
36
|
"@testing-library/react": "^12.0.0",
|
|
37
37
|
"@testing-library/user-event": "^13.2.1",
|
|
38
|
-
"@truedat/test": "6.
|
|
38
|
+
"@truedat/test": "6.2.0",
|
|
39
39
|
"babel-jest": "^28.1.0",
|
|
40
40
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
41
41
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"react-dom": ">= 16.8.6 < 17",
|
|
118
118
|
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "5c10ee429997ab081477edf0679547eb4bc11f9b"
|
|
121
121
|
}
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
SUBSCRIPTIONS,
|
|
11
11
|
TASKS,
|
|
12
12
|
TEMPLATES,
|
|
13
|
+
ELASTICINDEXES,
|
|
13
14
|
} from "../routes";
|
|
14
15
|
import Submenu from "./Submenu";
|
|
15
16
|
|
|
@@ -23,6 +24,7 @@ const items = [
|
|
|
23
24
|
{ name: "configurations", routes: [CONFIGURATIONS] },
|
|
24
25
|
{ name: "i18nMessages", routes: [I18N_MESSAGES] },
|
|
25
26
|
{ name: "tasks", routes: [TASKS] },
|
|
27
|
+
{ name: "elasticIndexes", routes: [ELASTICINDEXES] },
|
|
26
28
|
];
|
|
27
29
|
|
|
28
30
|
export const AdminMenu = () => {
|
|
@@ -145,7 +145,10 @@ export const RichTextEditor = ({
|
|
|
145
145
|
const [editor, setEditor] = useState();
|
|
146
146
|
|
|
147
147
|
useEffect(() => {
|
|
148
|
-
if (
|
|
148
|
+
if (
|
|
149
|
+
(!_.isEmpty(propValue) && !_.equals(propValue)(jsonValue)) ||
|
|
150
|
+
(readOnly && !_.equals(value)(Value.fromJSON(propValue)))
|
|
151
|
+
) {
|
|
149
152
|
setValue(Value.fromJSON(propValue));
|
|
150
153
|
}
|
|
151
154
|
}, [propValue]);
|
|
@@ -86,6 +86,11 @@ export const TreeSelector = ({
|
|
|
86
86
|
const [open, setOpen] = useState([]);
|
|
87
87
|
const [displayed, setDisplayed] = useState([]);
|
|
88
88
|
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
if (initialValue !== value)
|
|
91
|
+
setValue(_.defaultTo(multiple ? [] : null)(initialValue));
|
|
92
|
+
}, [initialValue]);
|
|
93
|
+
|
|
89
94
|
useEffect(() => {
|
|
90
95
|
const ids = childIds(open)(options);
|
|
91
96
|
setDisplayed((displayed) => _.union(displayed)(ids));
|
|
@@ -179,6 +184,7 @@ export const TreeSelector = ({
|
|
|
179
184
|
trigger={trigger}
|
|
180
185
|
upward={false}
|
|
181
186
|
value={value}
|
|
187
|
+
disabled={disabled}
|
|
182
188
|
>
|
|
183
189
|
<Dropdown.Menu>
|
|
184
190
|
<Input
|
|
@@ -147,6 +147,19 @@ exports[`<AdminMenu /> matches the latest snapshot 1`] = `
|
|
|
147
147
|
Tasks
|
|
148
148
|
</span>
|
|
149
149
|
</a>
|
|
150
|
+
<a
|
|
151
|
+
aria-checked="false"
|
|
152
|
+
class="item"
|
|
153
|
+
href="/search/elasticIndexes"
|
|
154
|
+
name="elasticIndexes"
|
|
155
|
+
role="option"
|
|
156
|
+
>
|
|
157
|
+
<span
|
|
158
|
+
class="text"
|
|
159
|
+
>
|
|
160
|
+
elasticIndexes
|
|
161
|
+
</span>
|
|
162
|
+
</a>
|
|
150
163
|
</div>
|
|
151
164
|
</div>
|
|
152
165
|
</div>
|
|
@@ -59,18 +59,31 @@ const LanguajeRow = ({
|
|
|
59
59
|
</TableCell>
|
|
60
60
|
{!anyDefault ? (
|
|
61
61
|
<TableCell textAlign="center">
|
|
62
|
-
<
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
<ConfirmModal
|
|
63
|
+
trigger={
|
|
64
|
+
<Input
|
|
65
|
+
id={`radio-${lang}`}
|
|
66
|
+
type="radio"
|
|
67
|
+
name="is_default"
|
|
68
|
+
checked={is_default}
|
|
69
|
+
/>
|
|
70
|
+
}
|
|
71
|
+
header={formatMessage({
|
|
72
|
+
id: "i18n.messages.locale.setDefault.confirmation.header",
|
|
73
|
+
})}
|
|
74
|
+
content={formatMessage(
|
|
75
|
+
{
|
|
76
|
+
id: "i18n.messages.locale.setDefault.confirmation.content",
|
|
77
|
+
},
|
|
78
|
+
{ lang: local_name }
|
|
79
|
+
)}
|
|
80
|
+
onConfirm={() => handleChange({ id, locale: { is_default: true } })}
|
|
68
81
|
/>
|
|
69
82
|
</TableCell>
|
|
70
83
|
) : null}
|
|
71
84
|
|
|
72
85
|
<TableCell>
|
|
73
|
-
{!is_default
|
|
86
|
+
{!is_default ? (
|
|
74
87
|
<ConfirmModal
|
|
75
88
|
icon="trash"
|
|
76
89
|
trigger={
|
package/src/messages/en.js
CHANGED
|
@@ -112,6 +112,7 @@ export default {
|
|
|
112
112
|
"sidemenu.concepts": "Glossary",
|
|
113
113
|
"sidemenu.configurations": "Configuration",
|
|
114
114
|
"sidemenu.dashboard": "Dashboard",
|
|
115
|
+
"sidemenu.elasticIndex": "Elastic Index",
|
|
115
116
|
"sidemenu.executions": "My Executions",
|
|
116
117
|
"sidemenu.glossary": "Glossary",
|
|
117
118
|
"sidemenu.grant_request_approvals": "Approve Grant Requests",
|
package/src/messages/es.js
CHANGED
|
@@ -116,6 +116,7 @@ export default {
|
|
|
116
116
|
"sidemenu.concepts": "Glosario",
|
|
117
117
|
"sidemenu.configurations": "Configuración",
|
|
118
118
|
"sidemenu.dashboard": "Dashboard",
|
|
119
|
+
"sidemenu.elasticIndex": "Elastic Index",
|
|
119
120
|
"sidemenu.executions": "Mis ejecuciones",
|
|
120
121
|
"sidemenu.glossary": "Glosario",
|
|
121
122
|
"sidemenu.grant_request_approvals": "Aprobar Peticiones de Accesos",
|
package/src/routes.js
CHANGED
|
@@ -53,6 +53,7 @@ export const DOMAIN_MEMBERS = "/domains/:id/members";
|
|
|
53
53
|
export const DOMAIN_MEMBERS_NEW = "/domains/:id/members/new";
|
|
54
54
|
export const DOMAIN_NEW = "/domains/:id/new";
|
|
55
55
|
export const DOMAIN_STRUCTURES = "/domains/:id/structures";
|
|
56
|
+
export const ELASTICINDEXES = "/search/elasticIndexes";
|
|
56
57
|
export const EXECUTION_GROUP = "/executionGroups/:id";
|
|
57
58
|
export const EXECUTION_GROUPS = "/executionGroups";
|
|
58
59
|
export const FUNCTIONS = "/functions";
|
|
@@ -290,6 +291,7 @@ const routes = {
|
|
|
290
291
|
DOMAIN_MEMBERS_NEW,
|
|
291
292
|
DOMAIN_NEW,
|
|
292
293
|
DOMAIN_STRUCTURES,
|
|
294
|
+
ELASTICINDEXES,
|
|
293
295
|
EXECUTION_GROUP,
|
|
294
296
|
EXECUTION_GROUPS,
|
|
295
297
|
GRANT,
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import _ from "lodash/fp";
|
|
2
|
+
|
|
3
|
+
const translatableFieldTypes = ["enriched_text", "string"];
|
|
4
|
+
|
|
5
|
+
export const splitTranslatableFields = (template) =>
|
|
6
|
+
_.flow(
|
|
7
|
+
_.get("content"),
|
|
8
|
+
_.flatMap((group) =>
|
|
9
|
+
_.reduce(
|
|
10
|
+
(acc, { name, widget }) => {
|
|
11
|
+
const translatableKey = _.includes(widget)(translatableFieldTypes)
|
|
12
|
+
? "translatable"
|
|
13
|
+
: "noTranslatable";
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
...acc,
|
|
17
|
+
[translatableKey]: {
|
|
18
|
+
...acc[translatableKey],
|
|
19
|
+
[name]: _.cond([
|
|
20
|
+
[(w) => w == "enriched_text", _.constant({})],
|
|
21
|
+
[(w) => w == "string", _.constant("")],
|
|
22
|
+
[_.stubTrue, _.constant(null)],
|
|
23
|
+
])(widget),
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
{ translatable: {}, noTranslatable: {} }
|
|
28
|
+
)(group.fields)
|
|
29
|
+
),
|
|
30
|
+
_.reduce(
|
|
31
|
+
(acc, { translatable, noTranslatable }) => {
|
|
32
|
+
return {
|
|
33
|
+
translatable: { ...acc.translatable, ...translatable },
|
|
34
|
+
noTranslatable: { ...acc.noTranslatable, ...noTranslatable },
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
{ translatable: {}, noTranslatable: {} }
|
|
38
|
+
)
|
|
39
|
+
)(template);
|
|
40
|
+
|
|
41
|
+
export const formatLocales = (locales) =>
|
|
42
|
+
_.flow(_.orderBy(["lang"], ["asc"]), (localeList) => ({
|
|
43
|
+
default: _.filter({
|
|
44
|
+
is_enabled: true,
|
|
45
|
+
is_required: true,
|
|
46
|
+
is_default: true,
|
|
47
|
+
})(localeList),
|
|
48
|
+
required: _.filter({
|
|
49
|
+
is_enabled: true,
|
|
50
|
+
is_required: true,
|
|
51
|
+
is_default: false,
|
|
52
|
+
})(localeList),
|
|
53
|
+
enabled: _.filter({
|
|
54
|
+
is_enabled: true,
|
|
55
|
+
is_required: false,
|
|
56
|
+
is_default: false,
|
|
57
|
+
})(localeList),
|
|
58
|
+
}))(locales);
|