@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "6.1.4",
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.1.4",
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": "c0ef00d553186b7601e136f3e38fa0d0d7287fd9"
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 (!_.isEmpty(propValue) && !_.equals(propValue)(jsonValue)) {
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>
@@ -6,6 +6,7 @@ exports[`<DomainSelector /> matches latest snapshot 1`] = `
6
6
  class="field fix-dropdown-selector"
7
7
  >
8
8
  <div
9
+ aria-disabled="false"
9
10
  aria-expanded="false"
10
11
  aria-multiselectable="false"
11
12
  class="ui floating dropdown"
@@ -6,6 +6,7 @@ exports[`<HierarchySelector /> matches latest snapshot 1`] = `
6
6
  class="field fix-dropdown-selector"
7
7
  >
8
8
  <div
9
+ aria-disabled="false"
9
10
  aria-expanded="false"
10
11
  aria-multiselectable="true"
11
12
  class="ui floating multiple dropdown"
@@ -474,6 +474,12 @@ exports[`<SideMenu /> matches the latest snapshot 1`] = `
474
474
  >
475
475
  Tasks
476
476
  </a>
477
+ <a
478
+ class="link item"
479
+ href="/search/elasticIndexes"
480
+ >
481
+ elasticIndexes
482
+ </a>
477
483
  </div>
478
484
  </div>
479
485
  <a
@@ -6,6 +6,7 @@ exports[`<TreeSelector /> matches latest snapshot 1`] = `
6
6
  class="field fix-dropdown-selector"
7
7
  >
8
8
  <div
9
+ aria-disabled="false"
9
10
  aria-expanded="false"
10
11
  aria-multiselectable="false"
11
12
  class="ui floating dropdown"
@@ -59,18 +59,31 @@ const LanguajeRow = ({
59
59
  </TableCell>
60
60
  {!anyDefault ? (
61
61
  <TableCell textAlign="center">
62
- <Input
63
- id={`radio-${lang}`}
64
- type="radio"
65
- name="is_default"
66
- checked={is_default}
67
- onChange={() => handleChange({ id, locale: { is_default: true } })}
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 && !["es", "en"].includes(lang) ? (
86
+ {!is_default ? (
74
87
  <ConfirmModal
75
88
  icon="trash"
76
89
  trigger={
@@ -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",
@@ -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,
@@ -79,7 +79,6 @@ export const SearchContextProvider = (props) => {
79
79
  ? _.without([value])(values)
80
80
  : _.union([value])(values);
81
81
 
82
- console.log("toggleHiddenFilterValue", values, newValue);
83
82
  setHiddenFilters({ ...hiddenFilters, [filter]: newValue });
84
83
  };
85
84
 
@@ -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);