@truedat/audit 4.47.3 → 4.47.6
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 +4 -0
- package/package.json +5 -5
- package/src/components/NotificationEvent.js +14 -6
- package/src/components/SubscriptionForm.js +24 -17
- package/src/components/__tests__/NotificationEvent.spec.js +3 -1
- package/src/messages/en.js +18 -0
- package/src/messages/es.js +18 -0
- package/src/subscriptionConstants.js +15 -1
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/audit",
|
|
3
|
-
"version": "4.47.
|
|
3
|
+
"version": "4.47.6",
|
|
4
4
|
"description": "Truedat Web Audit Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@testing-library/jest-dom": "^5.16.4",
|
|
35
35
|
"@testing-library/react": "^12.0.0",
|
|
36
36
|
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "4.47.
|
|
37
|
+
"@truedat/test": "4.47.6",
|
|
38
38
|
"babel-jest": "^28.1.0",
|
|
39
39
|
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
40
|
"babel-plugin-lodash": "^3.3.4",
|
|
@@ -85,8 +85,8 @@
|
|
|
85
85
|
]
|
|
86
86
|
},
|
|
87
87
|
"dependencies": {
|
|
88
|
-
"@truedat/auth": "4.47.
|
|
89
|
-
"@truedat/core": "4.47.
|
|
88
|
+
"@truedat/auth": "4.47.6",
|
|
89
|
+
"@truedat/core": "4.47.6",
|
|
90
90
|
"axios": "^0.19.2",
|
|
91
91
|
"path-to-regexp": "^1.7.0",
|
|
92
92
|
"prop-types": "^15.8.1",
|
|
@@ -107,5 +107,5 @@
|
|
|
107
107
|
"react-dom": ">= 16.8.6 < 17",
|
|
108
108
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "07210600d97244d32085d7166595ee030e6bb578"
|
|
111
111
|
}
|
|
@@ -26,6 +26,7 @@ const TEMPLATES = {
|
|
|
26
26
|
job_status_succeeded: "job_status",
|
|
27
27
|
job_status_warning: "job_status",
|
|
28
28
|
job_status_info: "job_status",
|
|
29
|
+
implementation_status_updated: "implementation_status",
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
export const NotificationEvent = ({
|
|
@@ -34,9 +35,7 @@ export const NotificationEvent = ({
|
|
|
34
35
|
readMark,
|
|
35
36
|
readNotification,
|
|
36
37
|
}) => {
|
|
37
|
-
const template = TEMPLATES[event.event] || "default";
|
|
38
38
|
const { locale } = useIntl();
|
|
39
|
-
|
|
40
39
|
const ref = useRef();
|
|
41
40
|
const [isRead, setIsRead] = useState(readMark);
|
|
42
41
|
const [isVisibleUnreadLabel, setUnreadLabelVisibility] = useState(!readMark);
|
|
@@ -51,6 +50,8 @@ export const NotificationEvent = ({
|
|
|
51
50
|
}
|
|
52
51
|
}, [isVisible]);
|
|
53
52
|
|
|
53
|
+
const template = TEMPLATES[event.event] || "default";
|
|
54
|
+
const statusesEvents = ["implementation_status"];
|
|
54
55
|
return (
|
|
55
56
|
<div className="notification-item unread" ref={ref}>
|
|
56
57
|
<h4>
|
|
@@ -63,10 +64,17 @@ export const NotificationEvent = ({
|
|
|
63
64
|
</h4>
|
|
64
65
|
<p>{event.name}</p>
|
|
65
66
|
<Label>
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
{statusesEvents.includes(template) ? (
|
|
68
|
+
<FormattedMessage
|
|
69
|
+
id={`subscriptions.events.${template}.${event.payload.status}`}
|
|
70
|
+
defaultMessage={event.payload.status}
|
|
71
|
+
/>
|
|
72
|
+
) : (
|
|
73
|
+
<FormattedMessage
|
|
74
|
+
id={`subscriptions.events.${event.event}`}
|
|
75
|
+
defaultMessage={event.event}
|
|
76
|
+
/>
|
|
77
|
+
)}
|
|
70
78
|
</Label>
|
|
71
79
|
<Moment locale={locale} fromNow>
|
|
72
80
|
{date}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React, { Suspense, useState } from "react";
|
|
2
|
+
import React, { Suspense, useState, useEffect } from "react";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import { useForm, useWatch, Controller } from "react-hook-form";
|
|
@@ -122,18 +122,23 @@ export const SubscriptionForm = ({
|
|
|
122
122
|
});
|
|
123
123
|
|
|
124
124
|
const isEditForm = !!subscription?.id;
|
|
125
|
-
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
125
|
+
|
|
126
|
+
const [eventsForType, setEventsForType] = useState([]);
|
|
127
|
+
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
const exclusiveEvents = [
|
|
130
|
+
"rule_result_created",
|
|
131
|
+
"implementation_status_updated",
|
|
132
|
+
];
|
|
133
|
+
const eventsbytype = _.getOr([], resourceType)(EVENTS_BY_TYPE);
|
|
134
|
+
setEventsForType(
|
|
135
|
+
!_.isEmpty(_.intersection(exclusiveEvents)(events))
|
|
136
|
+
? events
|
|
137
|
+
: !_.isEmpty(events)
|
|
138
|
+
? _.difference(eventsbytype)(exclusiveEvents)
|
|
139
|
+
: eventsbytype
|
|
140
|
+
);
|
|
141
|
+
}, [resourceType, events]);
|
|
137
142
|
|
|
138
143
|
const statuses = _.flow(
|
|
139
144
|
_.pick(events),
|
|
@@ -469,10 +474,12 @@ export const SubscriptionForm = ({
|
|
|
469
474
|
value: name,
|
|
470
475
|
text: (
|
|
471
476
|
<label>
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
477
|
+
{color ? (
|
|
478
|
+
<Icon
|
|
479
|
+
name={name == "error" ? "warning circle" : "circle"}
|
|
480
|
+
color={color}
|
|
481
|
+
/>
|
|
482
|
+
) : null}
|
|
476
483
|
{formatMessage({ id: `subscriptions.status.${name}` })}
|
|
477
484
|
</label>
|
|
478
485
|
),
|
|
@@ -3,7 +3,9 @@ import { render } from "@truedat/test/render";
|
|
|
3
3
|
import NotificationEvent from "../NotificationEvent";
|
|
4
4
|
|
|
5
5
|
jest.mock("@truedat/core/hooks", () => ({ useOnScreen: jest.fn() }));
|
|
6
|
-
|
|
6
|
+
jest
|
|
7
|
+
.spyOn(global.Date, "now")
|
|
8
|
+
.mockImplementation(() => new Date("2022-01-01T11:01:58.135Z").valueOf());
|
|
7
9
|
describe("<NotificationEvent />", () => {
|
|
8
10
|
it("matches the latest snapshot", () => {
|
|
9
11
|
const event = {
|
package/src/messages/en.js
CHANGED
|
@@ -10,6 +10,8 @@ export default {
|
|
|
10
10
|
"👓 Alert: Data quality results detected",
|
|
11
11
|
"notifications.events.comments": "🖋 Alert: New comments added",
|
|
12
12
|
"notifications.events.job_status": "⚡ Alert: Job status updated",
|
|
13
|
+
"notifications.events.implementation_status":
|
|
14
|
+
"⚡ Implementation status updated",
|
|
13
15
|
"notifications.events.default": "⚡ Alert: New notifications",
|
|
14
16
|
"notifications.new": "New",
|
|
15
17
|
|
|
@@ -86,6 +88,15 @@ export default {
|
|
|
86
88
|
"subscriptions.events.grant_created": "Access has been granted",
|
|
87
89
|
"subscriptions.events.grant_deleted": "Access has been revoked",
|
|
88
90
|
"subscriptions.events.implementation_created": "Implementation created",
|
|
91
|
+
"subscriptions.events.implementation_status_updated":
|
|
92
|
+
"Implementation status updated",
|
|
93
|
+
"subscriptions.events.implementation_status.draft": "Draft",
|
|
94
|
+
"subscriptions.events.implementation_status.pending_approval":
|
|
95
|
+
"Pending approval",
|
|
96
|
+
"subscriptions.events.implementation_status.rejected": "Rejected",
|
|
97
|
+
"subscriptions.events.implementation_status.published": "Published",
|
|
98
|
+
"subscriptions.events.implementation_status.versioned": "Versioned",
|
|
99
|
+
"subscriptions.events.implementation_status.deprecated": "Deleted",
|
|
89
100
|
"subscriptions.events.relation_created": "Relation created",
|
|
90
101
|
"subscriptions.events.relation_deleted": "Relation deleted",
|
|
91
102
|
"subscriptions.events.relation_deprecated": "Relation deprecated",
|
|
@@ -114,6 +125,13 @@ export default {
|
|
|
114
125
|
"subscriptions.events.job_status_warning": "Warned job",
|
|
115
126
|
"subscriptions.events.job_status_info": "Informed job",
|
|
116
127
|
|
|
128
|
+
"subscriptions.status.draft": "Draft",
|
|
129
|
+
"subscriptions.status.pending_approval": "Pending approval",
|
|
130
|
+
"subscriptions.status.rejected": "Rejected",
|
|
131
|
+
"subscriptions.status.published": "Published",
|
|
132
|
+
"subscriptions.status.versioned": "Versioned",
|
|
133
|
+
"subscriptions.status.deprecated": "Deleted",
|
|
134
|
+
|
|
117
135
|
"subscriptions.actions.create": "New Subscription",
|
|
118
136
|
"subscriptions.actions.edit": "Edit Subscription",
|
|
119
137
|
"subscriptions.selectFilters": "Filters to subscription",
|
package/src/messages/es.js
CHANGED
|
@@ -10,6 +10,8 @@ export default {
|
|
|
10
10
|
"👓 Alerta: Resultados en la ejecución de calidad",
|
|
11
11
|
"notifications.events.comments": "🖋 Alerta: Comentarios añadidos",
|
|
12
12
|
"notifications.events.job_status": "⚡ Alerta: Estado de job modificado",
|
|
13
|
+
"notifications.events.implementation_status":
|
|
14
|
+
"⚡ Estado de implementación modificado",
|
|
13
15
|
"notifications.events.default": "⚡ Alerta: Nuevas notificaciones",
|
|
14
16
|
"notifications.new": "Nueva",
|
|
15
17
|
|
|
@@ -55,6 +57,13 @@ export default {
|
|
|
55
57
|
"subscriptions.status.job_status_warning": "Avisos en jobs",
|
|
56
58
|
"subscriptions.status.job_status_info": "Jobs con información",
|
|
57
59
|
|
|
60
|
+
"subscriptions.status.draft": "Borrador",
|
|
61
|
+
"subscriptions.status.pending_approval": "Pendiente de aprobación",
|
|
62
|
+
"subscriptions.status.rejected": "Rechazada",
|
|
63
|
+
"subscriptions.status.published": "Publicada",
|
|
64
|
+
"subscriptions.status.versioned": "Versionada",
|
|
65
|
+
"subscriptions.status.deprecated": "Eliminada",
|
|
66
|
+
|
|
58
67
|
"subscriptions.resource": "Recurso",
|
|
59
68
|
"subscriptions.resource.type.data_structure": "Estructura",
|
|
60
69
|
"subscriptions.resource.type.domain": "Dominio",
|
|
@@ -89,6 +98,15 @@ export default {
|
|
|
89
98
|
"subscriptions.events.grant_deleted":
|
|
90
99
|
"Se ha eliminado el acceso a estructuras",
|
|
91
100
|
"subscriptions.events.implementation_created": "Implementación creada",
|
|
101
|
+
"subscriptions.events.implementation_status_updated":
|
|
102
|
+
"Estado de implementación actualizada",
|
|
103
|
+
"subscriptions.events.implementation_status.draft": "Borrador",
|
|
104
|
+
"subscriptions.events.implementation_status.pending_approval":
|
|
105
|
+
"Pendiente de aprobación",
|
|
106
|
+
"subscriptions.events.implementation_status.rejected": "Rechazada",
|
|
107
|
+
"subscriptions.events.implementation_status.published": "Publicada",
|
|
108
|
+
"subscriptions.events.implementation_status.versioned": "Versionada",
|
|
109
|
+
"subscriptions.events.implementation_status.deprecated": "Eliminada",
|
|
92
110
|
"subscriptions.events.relation_created": "Relación creada",
|
|
93
111
|
"subscriptions.events.relation_deleted": "Relación borrada",
|
|
94
112
|
"subscriptions.events.relation_deprecated": "Relación archivada",
|
|
@@ -49,12 +49,17 @@ export const STRUCTURE_EVENTS = [
|
|
|
49
49
|
|
|
50
50
|
export const RULE_EVENTS = ["rule_created", "rule_result_created"];
|
|
51
51
|
|
|
52
|
+
export const IMPLEMENTATION_EVENTS = [
|
|
53
|
+
"implementation_created",
|
|
54
|
+
"implementation_status_updated",
|
|
55
|
+
];
|
|
56
|
+
|
|
52
57
|
export const SOURCE_EVENTS = ["status_changed"];
|
|
53
58
|
|
|
54
59
|
export const DOMAIN_EVENTS = [
|
|
55
60
|
...CONCEPT_EVENTS,
|
|
56
61
|
...RULE_EVENTS,
|
|
57
|
-
|
|
62
|
+
...IMPLEMENTATION_EVENTS,
|
|
58
63
|
...STRUCTURE_EVENTS,
|
|
59
64
|
"grant_created",
|
|
60
65
|
"grant_deleted",
|
|
@@ -67,6 +72,7 @@ export const EVENTS_BY_TYPE = {
|
|
|
67
72
|
domains: DOMAIN_EVENTS,
|
|
68
73
|
domain: DOMAIN_EVENTS,
|
|
69
74
|
rule: RULE_EVENTS,
|
|
75
|
+
implementation: IMPLEMENTATION_EVENTS,
|
|
70
76
|
source: SOURCE_EVENTS,
|
|
71
77
|
};
|
|
72
78
|
|
|
@@ -85,6 +91,14 @@ export const STATUSES_BY_EVENT = {
|
|
|
85
91
|
{ name: "job_status_warning", color: "orange" },
|
|
86
92
|
{ name: "job_status_info", color: "grey" },
|
|
87
93
|
],
|
|
94
|
+
implementation_status_updated: [
|
|
95
|
+
{ name: "draft" },
|
|
96
|
+
{ name: "pending_approval" },
|
|
97
|
+
{ name: "rejected" },
|
|
98
|
+
{ name: "published" },
|
|
99
|
+
{ name: "versioned" },
|
|
100
|
+
{ name: "deprecated" },
|
|
101
|
+
],
|
|
88
102
|
};
|
|
89
103
|
|
|
90
104
|
export const isSubset = (first, second) =>
|