@truedat/core 5.2.4 → 5.3.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/CHANGELOG.md +6 -0
- package/package.json +2 -2
- package/src/api.js +2 -0
- package/src/components/AdminMenu.js +2 -0
- package/src/components/__tests__/__snapshots__/AdminMenu.spec.js.snap +13 -0
- package/src/messages/en.js +1 -0
- package/src/messages/es.js +1 -0
- package/src/routes.js +4 -0
- package/src/routines.js +3 -0
- package/src/sagas/index.js +11 -2
- package/src/sagas/reindexAll.js +42 -0
- package/src/services/operators.js +7 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
4
4
|
"description": "Truedat Web Core",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -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": "4893c314084a4ea7ca48a4e251d4e47565f3f030"
|
|
121
121
|
}
|
package/src/api.js
CHANGED
|
@@ -3,3 +3,5 @@ export const API_LOCALE_MESSAGES = "/api/locales/:lang/messages";
|
|
|
3
3
|
export const API_LOCALES = "/api/locales";
|
|
4
4
|
export const API_MESSAGE = "/api/messages/:id";
|
|
5
5
|
export const API_MESSAGES = "/api/messages";
|
|
6
|
+
export const API_REINDEX_GRANTS = "/api/grants/search/reindex_all";
|
|
7
|
+
export const API_REINDEX_STRUCTURES = "/api/data_structures/search/reindex_all";
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
RELATION_TAGS,
|
|
9
9
|
SOURCES,
|
|
10
10
|
SUBSCRIPTIONS,
|
|
11
|
+
TASKS,
|
|
11
12
|
TEMPLATES,
|
|
12
13
|
} from "../routes";
|
|
13
14
|
import Submenu from "./Submenu";
|
|
@@ -21,6 +22,7 @@ const items = [
|
|
|
21
22
|
{ name: "jobs", routes: [JOBS] },
|
|
22
23
|
{ name: "configurations", routes: [CONFIGURATIONS] },
|
|
23
24
|
{ name: "i18nMessages", routes: [I18N_MESSAGES] },
|
|
25
|
+
{ name: "tasks", routes: [TASKS] },
|
|
24
26
|
];
|
|
25
27
|
|
|
26
28
|
export const AdminMenu = () => {
|
|
@@ -134,6 +134,19 @@ exports[`<AdminMenu /> matches the latest snapshot 1`] = `
|
|
|
134
134
|
Translations
|
|
135
135
|
</span>
|
|
136
136
|
</a>
|
|
137
|
+
<a
|
|
138
|
+
aria-checked="false"
|
|
139
|
+
class="item"
|
|
140
|
+
href="/tasks"
|
|
141
|
+
name="tasks"
|
|
142
|
+
role="option"
|
|
143
|
+
>
|
|
144
|
+
<span
|
|
145
|
+
class="text"
|
|
146
|
+
>
|
|
147
|
+
Tasks
|
|
148
|
+
</span>
|
|
149
|
+
</a>
|
|
137
150
|
</div>
|
|
138
151
|
</div>
|
|
139
152
|
</div>
|
package/src/messages/en.js
CHANGED
|
@@ -137,6 +137,7 @@ export default {
|
|
|
137
137
|
"sidemenu.structures": "Structures",
|
|
138
138
|
"sidemenu.structures_upload_events": "My loads",
|
|
139
139
|
"sidemenu.subscriptions": "Subscriptions",
|
|
140
|
+
"sidemenu.tasks": "Tasks",
|
|
140
141
|
"sidemenu.taxonomy": "Taxonomy",
|
|
141
142
|
"sidemenu.templates": "Templates",
|
|
142
143
|
"sidemenu.users": "Users",
|
package/src/messages/es.js
CHANGED
|
@@ -140,6 +140,7 @@ export default {
|
|
|
140
140
|
"sidemenu.structures": "Estructuras",
|
|
141
141
|
"sidemenu.structures_upload_events": "Mis cargas",
|
|
142
142
|
"sidemenu.subscriptions": "Suscripciones",
|
|
143
|
+
"sidemenu.tasks": "Tareas",
|
|
143
144
|
"sidemenu.taxonomy": "Dominios",
|
|
144
145
|
"sidemenu.templates": "Plantillas",
|
|
145
146
|
"sidemenu.users": "Usuarios",
|
package/src/routes.js
CHANGED
|
@@ -207,6 +207,8 @@ export const SYSTEMS = "/systems";
|
|
|
207
207
|
export const SYSTEM_EDIT = "/systems/:id/edit";
|
|
208
208
|
export const SYSTEM_NEW = "/systems/new";
|
|
209
209
|
export const SYSTEM_STRUCTURES = "/systems/:id/structures";
|
|
210
|
+
export const TASKS = "/tasks";
|
|
211
|
+
export const TASK = "/tasks/:id";
|
|
210
212
|
export const TEMPLATE = "/templates/:templateId";
|
|
211
213
|
export const TEMPLATES = "/templates";
|
|
212
214
|
export const TEMPLATES_NEW = "/templates/new";
|
|
@@ -393,6 +395,8 @@ const routes = {
|
|
|
393
395
|
SYSTEM_EDIT,
|
|
394
396
|
SYSTEM_NEW,
|
|
395
397
|
SYSTEM_STRUCTURES,
|
|
398
|
+
TASKS,
|
|
399
|
+
TASK,
|
|
396
400
|
TEMPLATE,
|
|
397
401
|
TEMPLATES,
|
|
398
402
|
TEMPLATES_NEW,
|
package/src/routines.js
CHANGED
|
@@ -28,3 +28,6 @@ export const setDashboardDomains = createRoutine("SET_DASHBOARD_DOMAINS");
|
|
|
28
28
|
|
|
29
29
|
export const unauthorized = createRoutine("UNAUTHORIZED");
|
|
30
30
|
export const logError = createRoutine("LOG_ERROR");
|
|
31
|
+
|
|
32
|
+
export const reindexAllGrants = createRoutine("REINDEX_ALL_GRANTS");
|
|
33
|
+
export const reindexAllStructures = createRoutine("REINDEX_ALL_STRUCTURES");
|
package/src/sagas/index.js
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import { fetchCommentsRequestSaga } from "./fetchComments";
|
|
2
2
|
import { addCommentRequestSaga } from "./addComment";
|
|
3
|
+
import { reindexAllRequestSaga } from "./reindexAll";
|
|
3
4
|
|
|
4
|
-
export {
|
|
5
|
+
export {
|
|
6
|
+
fetchCommentsRequestSaga,
|
|
7
|
+
addCommentRequestSaga,
|
|
8
|
+
reindexAllRequestSaga,
|
|
9
|
+
};
|
|
5
10
|
|
|
6
|
-
export default [
|
|
11
|
+
export default [
|
|
12
|
+
fetchCommentsRequestSaga(),
|
|
13
|
+
addCommentRequestSaga(),
|
|
14
|
+
reindexAllRequestSaga(),
|
|
15
|
+
];
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { call, put, takeLatest } from "redux-saga/effects";
|
|
2
|
+
import { apiJson, JSON_OPTS } from "../services/api";
|
|
3
|
+
import { reindexAllGrants, reindexAllStructures } from "../routines";
|
|
4
|
+
import { API_REINDEX_GRANTS, API_REINDEX_STRUCTURES } from "../api";
|
|
5
|
+
|
|
6
|
+
export function* reindexAllGrantsSaga() {
|
|
7
|
+
try {
|
|
8
|
+
yield put(reindexAllGrants.request());
|
|
9
|
+
yield call(apiJson, API_REINDEX_GRANTS, JSON_OPTS);
|
|
10
|
+
yield put(reindexAllGrants.success());
|
|
11
|
+
} catch (error) {
|
|
12
|
+
if (error.response) {
|
|
13
|
+
const { status, data } = error.response;
|
|
14
|
+
yield put(reindexAllGrants.failure({ status, data }));
|
|
15
|
+
} else {
|
|
16
|
+
yield put(reindexAllGrants.failure(error.message));
|
|
17
|
+
}
|
|
18
|
+
} finally {
|
|
19
|
+
yield put(reindexAllGrants.fulfill());
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export function* reindexAllStructuresSaga() {
|
|
23
|
+
try {
|
|
24
|
+
yield put(reindexAllStructures.request());
|
|
25
|
+
yield call(apiJson, API_REINDEX_STRUCTURES, JSON_OPTS);
|
|
26
|
+
yield put(reindexAllStructures.success());
|
|
27
|
+
} catch (error) {
|
|
28
|
+
if (error.response) {
|
|
29
|
+
const { status, data } = error.response;
|
|
30
|
+
yield put(reindexAllStructures.failure({ status, data }));
|
|
31
|
+
} else {
|
|
32
|
+
yield put(reindexAllStructures.failure(error.message));
|
|
33
|
+
}
|
|
34
|
+
} finally {
|
|
35
|
+
yield put(reindexAllStructures.fulfill());
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function* reindexAllRequestSaga() {
|
|
40
|
+
yield takeLatest(reindexAllGrants.TRIGGER, reindexAllGrantsSaga);
|
|
41
|
+
yield takeLatest(reindexAllStructures.TRIGGER, reindexAllStructuresSaga);
|
|
42
|
+
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
2
|
|
|
3
|
+
const transformType = (type) =>
|
|
4
|
+
({
|
|
5
|
+
ref: "field",
|
|
6
|
+
reference_dataset_field: "reference_dataset_field",
|
|
7
|
+
}[type]);
|
|
8
|
+
|
|
3
9
|
export const toItem = ({
|
|
4
10
|
name,
|
|
5
11
|
group,
|
|
@@ -17,7 +23,7 @@ export const toItem = ({
|
|
|
17
23
|
? null
|
|
18
24
|
: _.map(_.pick(["name", "type"]))(args);
|
|
19
25
|
const value_type =
|
|
20
|
-
returnType === "boolean" ? (type
|
|
26
|
+
returnType === "boolean" ? transformType(type) || type : null;
|
|
21
27
|
return _.pickBy(_.identity)({
|
|
22
28
|
arity: returnType === "boolean" && arity > 1 ? arity : null,
|
|
23
29
|
category,
|