@truedat/audit 7.5.7 → 7.5.10
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 +45 -71
- package/src/components/ContentFilters.js +3 -1
- package/src/components/NotificationEvent.js +2 -2
- package/src/components/NotificationsMenu.js +2 -10
- package/src/components/ShareLinkForm.js +33 -32
- package/src/components/ShareLinkPopup.js +1 -1
- package/src/components/Subscription.js +0 -1
- package/src/components/SubscriptionActions.js +1 -2
- package/src/components/SubscriptionCrumbs.js +2 -3
- package/src/components/SubscriptionEdit.js +0 -1
- package/src/components/SubscriptionForm.js +305 -310
- package/src/components/SubscriptionLoader.js +2 -2
- package/src/components/SubscriptionNew.js +0 -1
- package/src/components/SubscriptionRoutes.js +58 -56
- package/src/components/SubscriptionWatchForm.js +0 -1
- package/src/components/Subscriptions.js +4 -7
- package/src/components/SubscriptionsLoader.js +1 -1
- package/src/components/__tests__/NotificationEvent.spec.js +1 -4
- package/src/components/__tests__/NotificationsMenu.spec.js +0 -1
- package/src/components/__tests__/ShareLinkForm.spec.js +23 -17
- package/src/components/__tests__/ShareLinkPopup.spec.js +0 -1
- package/src/components/__tests__/Subscription.spec.js +0 -1
- package/src/components/__tests__/SubscriptionActions.spec.js +0 -1
- package/src/components/__tests__/SubscriptionCrumbs.spec.js +5 -5
- package/src/components/__tests__/SubscriptionEdit.spec.js +9 -8
- package/src/components/__tests__/SubscriptionForm.spec.js +141 -125
- package/src/components/__tests__/SubscriptionLoader.spec.js +0 -1
- package/src/components/__tests__/SubscriptionNew.spec.js +5 -5
- package/src/components/__tests__/SubscriptionRoutes.spec.js +44 -6
- package/src/components/__tests__/SubscriptionWatchForm.spec.js +37 -34
- package/src/components/__tests__/Subscriptions.spec.js +0 -1
- package/src/components/__tests__/SubscriptionsLoader.spec.js +0 -1
- package/src/components/__tests__/__snapshots__/NotificationEvent.spec.js.snap +6 -6
- package/src/components/__tests__/__snapshots__/NotificationsMenu.spec.js.snap +7 -7
- package/src/components/__tests__/__snapshots__/ShareLinkForm.spec.js.snap +6 -6
- package/src/components/__tests__/__snapshots__/Subscription.spec.js.snap +4 -5
- package/src/components/__tests__/__snapshots__/SubscriptionActions.spec.js.snap +0 -1
- package/src/components/__tests__/__snapshots__/SubscriptionCrumbs.spec.js.snap +20 -30
- package/src/components/__tests__/__snapshots__/SubscriptionEdit.spec.js.snap +75 -25
- package/src/components/__tests__/__snapshots__/SubscriptionForm.spec.js.snap +23 -23
- package/src/components/__tests__/__snapshots__/SubscriptionNew.spec.js.snap +64 -25
- package/src/components/__tests__/__snapshots__/SubscriptionRoutes.spec.js.snap +710 -23
- package/src/components/__tests__/__snapshots__/SubscriptionWatchForm.spec.js.snap +83 -80
- package/src/components/__tests__/__snapshots__/Subscriptions.spec.js.snap +28 -37
- package/src/index.js +1 -2
- package/src/reducers/__tests__/auditMessage.spec.js +3 -3
- package/src/reducers/__tests__/auditRedirect.spec.js +2 -2
- package/src/reducers/__tests__/events.spec.js +1 -1
- package/src/reducers/__tests__/searchSubscription.spec.js +5 -5
- package/src/reducers/__tests__/subscription.spec.js +1 -1
- package/src/reducers/__tests__/subscriptionUpdating.spec.js +6 -6
- package/src/reducers/__tests__/subscriptions.spec.js +1 -1
- package/src/reducers/auditMessage.js +1 -1
- package/src/reducers/events.js +1 -1
- package/src/sagas/__tests__/deleteSubscription.spec.js +7 -7
- package/src/sagas/__tests__/fetchSubscription.spec.js +2 -2
- package/src/sagas/__tests__/readNotification.spec.js +2 -2
- package/src/sagas/__tests__/updateSubscription.spec.js +8 -8
- package/src/sagas/createSubscription.js +3 -3
- package/src/sagas/deleteSubscription.js +1 -1
- package/src/sagas/readNotification.js +1 -1
- package/src/sagas/updateSubscription.js +4 -4
- package/src/selectors/__tests__/getRecipients.spec.js +0 -32
- package/src/selectors/getRecipients.js +0 -34
- package/src/selectors/index.js +0 -1
|
@@ -5,7 +5,7 @@ import { deleteSubscription } from "@truedat/core/routines";
|
|
|
5
5
|
import { apiJsonDelete, JSON_OPTS } from "@truedat/core/services/api";
|
|
6
6
|
import {
|
|
7
7
|
deleteSubscriptionRequestSaga,
|
|
8
|
-
deleteSubscriptionSaga
|
|
8
|
+
deleteSubscriptionSaga,
|
|
9
9
|
} from "../deleteSubscription";
|
|
10
10
|
import { API_SUBSCRIPTION } from "../../api";
|
|
11
11
|
|
|
@@ -33,23 +33,23 @@ describe("sagas: deleteSubscriptionSaga", () => {
|
|
|
33
33
|
|
|
34
34
|
describe("sagas: deleteSubscriptionSaga", () => {
|
|
35
35
|
const subscription = {
|
|
36
|
-
id: 2,
|
|
36
|
+
id: "2",
|
|
37
37
|
periodicity: "daily",
|
|
38
38
|
scope: {
|
|
39
39
|
status: ["warn"],
|
|
40
40
|
events: ["rule_result_created"],
|
|
41
41
|
resource_id: 2,
|
|
42
|
-
resource_type: "rule"
|
|
42
|
+
resource_type: "rule",
|
|
43
43
|
},
|
|
44
44
|
subscriber: {
|
|
45
45
|
id: 3,
|
|
46
46
|
identifier: "2",
|
|
47
|
-
type: "user"
|
|
48
|
-
}
|
|
47
|
+
type: "user",
|
|
48
|
+
},
|
|
49
49
|
};
|
|
50
50
|
const payload = { subscription };
|
|
51
51
|
|
|
52
|
-
const url = toApiPath({ id: subscription.id });
|
|
52
|
+
const url = toApiPath({ id: `${subscription.id}` });
|
|
53
53
|
|
|
54
54
|
it("should put a success action when a response is returned", () => {
|
|
55
55
|
expect(() => {
|
|
@@ -60,7 +60,7 @@ describe("sagas: deleteSubscriptionSaga", () => {
|
|
|
60
60
|
.call(apiJsonDelete, url, JSON_OPTS)
|
|
61
61
|
.next({ data: payload })
|
|
62
62
|
.put({
|
|
63
|
-
...deleteSubscription.success({ ...payload })
|
|
63
|
+
...deleteSubscription.success({ ...payload }),
|
|
64
64
|
})
|
|
65
65
|
.next()
|
|
66
66
|
.put(deleteSubscription.fulfill())
|
|
@@ -32,8 +32,8 @@ describe("sagas: fetchSubscriptionRequestSaga", () => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
describe("sagas: fetchSubscriptionSaga", () => {
|
|
35
|
-
const payload = { id: 1 };
|
|
36
|
-
const url = toApiPath({ id: 1 });
|
|
35
|
+
const payload = { id: "1" };
|
|
36
|
+
const url = toApiPath({ id: "1" });
|
|
37
37
|
|
|
38
38
|
const data = { id: 1, periodicity: "daily", scope: {} };
|
|
39
39
|
|
|
@@ -30,9 +30,9 @@ describe("sagas: readNotificationRequestSaga", () => {
|
|
|
30
30
|
});
|
|
31
31
|
|
|
32
32
|
describe("sagas: readNotificationSaga", () => {
|
|
33
|
-
const notificationId = 87;
|
|
33
|
+
const notificationId = "87";
|
|
34
34
|
const toApiPath = compile(API_NOTIFICATIONS_READ);
|
|
35
|
-
const url = toApiPath({ id: notificationId });
|
|
35
|
+
const url = toApiPath({ id: `${notificationId}` });
|
|
36
36
|
|
|
37
37
|
it("should put a success action when a response is returned", () => {
|
|
38
38
|
expect(() => {
|
|
@@ -5,7 +5,7 @@ import { updateSubscription } from "@truedat/core/routines";
|
|
|
5
5
|
import { apiJsonPut, JSON_OPTS } from "@truedat/core/services/api";
|
|
6
6
|
import {
|
|
7
7
|
updateSubscriptionRequestSaga,
|
|
8
|
-
updateSubscriptionSaga
|
|
8
|
+
updateSubscriptionSaga,
|
|
9
9
|
} from "../updateSubscription";
|
|
10
10
|
import { API_SUBSCRIPTION } from "../../api";
|
|
11
11
|
|
|
@@ -33,24 +33,24 @@ describe("sagas: updateSubscriptionSaga", () => {
|
|
|
33
33
|
|
|
34
34
|
describe("sagas: updateSubscriptionSaga", () => {
|
|
35
35
|
const subscription = {
|
|
36
|
-
id: 1,
|
|
36
|
+
id: "1",
|
|
37
37
|
periodicity: "daily",
|
|
38
38
|
scope: {
|
|
39
39
|
resource_id: 2,
|
|
40
40
|
resource_type: "resource",
|
|
41
|
-
status: ["warn"]
|
|
42
|
-
}
|
|
41
|
+
status: ["warn"],
|
|
42
|
+
},
|
|
43
43
|
};
|
|
44
44
|
const requestData = {
|
|
45
45
|
subscription: {
|
|
46
46
|
periodicity: _.prop("periodicity")(subscription),
|
|
47
47
|
scope: _.get("scope")(subscription),
|
|
48
|
-
subscriber: _.get("subscriber")(subscription)
|
|
49
|
-
}
|
|
48
|
+
subscriber: _.get("subscriber")(subscription),
|
|
49
|
+
},
|
|
50
50
|
};
|
|
51
51
|
|
|
52
52
|
const payload = { subscription };
|
|
53
|
-
const url = toApiPath({ id: subscription.id });
|
|
53
|
+
const url = toApiPath({ id: `${subscription.id}` });
|
|
54
54
|
|
|
55
55
|
it("should put a success action when a response is returned", () => {
|
|
56
56
|
expect(() => {
|
|
@@ -61,7 +61,7 @@ describe("sagas: updateSubscriptionSaga", () => {
|
|
|
61
61
|
.call(apiJsonPut, url, requestData, JSON_OPTS)
|
|
62
62
|
.next({ data: payload })
|
|
63
63
|
.put({
|
|
64
|
-
...updateSubscription.success({ data: payload, ...payload })
|
|
64
|
+
...updateSubscription.success({ data: payload, ...payload }),
|
|
65
65
|
})
|
|
66
66
|
.next()
|
|
67
67
|
.put(updateSubscription.fulfill())
|
|
@@ -10,7 +10,7 @@ export function* createSubscriptionSaga({ payload }) {
|
|
|
10
10
|
const scope = _.prop("scope")(subscription);
|
|
11
11
|
const periodicity = _.prop("periodicity")(subscription);
|
|
12
12
|
const defaultSubscriber = {
|
|
13
|
-
type: "user"
|
|
13
|
+
type: "user",
|
|
14
14
|
};
|
|
15
15
|
const subscriber = _.getOr(defaultSubscriber, "subscriber")(subscription);
|
|
16
16
|
const url = API_SUBSCRIPTIONS;
|
|
@@ -19,8 +19,8 @@ export function* createSubscriptionSaga({ payload }) {
|
|
|
19
19
|
subscription: {
|
|
20
20
|
subscriber,
|
|
21
21
|
periodicity,
|
|
22
|
-
scope
|
|
23
|
-
}
|
|
22
|
+
scope,
|
|
23
|
+
},
|
|
24
24
|
};
|
|
25
25
|
const { data } = yield call(apiJsonPost, url, requestData, JSON_OPTS);
|
|
26
26
|
yield put(createSubscription.success({ data, ...payload }));
|
|
@@ -10,7 +10,7 @@ const toApiPath = compile(API_SUBSCRIPTION);
|
|
|
10
10
|
export function* deleteSubscriptionSaga({ payload }) {
|
|
11
11
|
try {
|
|
12
12
|
const { subscription } = payload;
|
|
13
|
-
const url = toApiPath({ id: subscription.id });
|
|
13
|
+
const url = toApiPath({ id: `${subscription.id}` });
|
|
14
14
|
yield put(deleteSubscription.request());
|
|
15
15
|
yield call(apiJsonDelete, url, JSON_OPTS);
|
|
16
16
|
yield put(deleteSubscription.success({ ...payload }));
|
|
@@ -10,7 +10,7 @@ const toApiPath = compile(API_NOTIFICATIONS_READ);
|
|
|
10
10
|
export function* readNotificationSaga({ payload }) {
|
|
11
11
|
try {
|
|
12
12
|
const notificationId = payload;
|
|
13
|
-
const url = toApiPath({ id: notificationId });
|
|
13
|
+
const url = toApiPath({ id: `${notificationId}` });
|
|
14
14
|
yield put(readNotification.request(notificationId));
|
|
15
15
|
const body = {};
|
|
16
16
|
yield call(apiJsonPost, url, body, JSON_OPTS);
|
|
@@ -10,18 +10,18 @@ const toApiPath = compile(API_SUBSCRIPTION);
|
|
|
10
10
|
export function* updateSubscriptionSaga({ payload }) {
|
|
11
11
|
try {
|
|
12
12
|
const { subscription } = payload;
|
|
13
|
-
const url = toApiPath(subscription);
|
|
13
|
+
const url = toApiPath({ id: `${subscription.id}` });
|
|
14
14
|
yield put({ ...updateSubscription.request() });
|
|
15
15
|
const requestData = {
|
|
16
16
|
subscription: {
|
|
17
17
|
periodicity: _.prop("periodicity")(subscription),
|
|
18
18
|
scope: _.get("scope")(subscription),
|
|
19
|
-
subscriber: _.get("subscriber")(subscription)
|
|
20
|
-
}
|
|
19
|
+
subscriber: _.get("subscriber")(subscription),
|
|
20
|
+
},
|
|
21
21
|
};
|
|
22
22
|
const { data } = yield call(apiJsonPut, url, requestData, JSON_OPTS);
|
|
23
23
|
yield put({
|
|
24
|
-
...updateSubscription.success({ data, ...payload })
|
|
24
|
+
...updateSubscription.success({ data, ...payload }),
|
|
25
25
|
});
|
|
26
26
|
} catch (error) {
|
|
27
27
|
if (error.response) {
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { getRecipients } from "../getRecipients";
|
|
2
|
-
|
|
3
|
-
const users = [
|
|
4
|
-
{ id: 1, user_name: "foo", full_name: "bar", email: "foo@bar.net" }
|
|
5
|
-
];
|
|
6
|
-
const groupsSearch = [{ id: 2, name: "baz", users }];
|
|
7
|
-
|
|
8
|
-
describe("selectors: getRecipients", () => {
|
|
9
|
-
const state = { usersSearch: users, groupsSearch };
|
|
10
|
-
it("should return the values of the currently selected concept filters", () => {
|
|
11
|
-
const options = [
|
|
12
|
-
{
|
|
13
|
-
id: 1,
|
|
14
|
-
full_name: "bar",
|
|
15
|
-
value: "user_1",
|
|
16
|
-
text: "bar",
|
|
17
|
-
icon: "user",
|
|
18
|
-
role: "user"
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
id: 2,
|
|
22
|
-
name: "baz",
|
|
23
|
-
value: "group_2",
|
|
24
|
-
text: "baz",
|
|
25
|
-
icon: "group",
|
|
26
|
-
role: "group",
|
|
27
|
-
users
|
|
28
|
-
}
|
|
29
|
-
];
|
|
30
|
-
expect(getRecipients(state)).toEqual(options);
|
|
31
|
-
});
|
|
32
|
-
});
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
|
-
import { createSelector } from "reselect";
|
|
3
|
-
|
|
4
|
-
const getGroups = _.propOr([], "groupsSearch");
|
|
5
|
-
const getUsers = _.propOr([], "usersSearch");
|
|
6
|
-
|
|
7
|
-
const usersAsOptions = users =>
|
|
8
|
-
_.flow(
|
|
9
|
-
_.map(_.pick(["id", "full_name"])),
|
|
10
|
-
_.map(u => ({
|
|
11
|
-
...u,
|
|
12
|
-
role: "user",
|
|
13
|
-
text: _.prop("full_name")(u),
|
|
14
|
-
value: `user_${_.prop("id")(u)}`,
|
|
15
|
-
icon: "user"
|
|
16
|
-
}))
|
|
17
|
-
)(users);
|
|
18
|
-
|
|
19
|
-
const groupsAsOptions = groups =>
|
|
20
|
-
_.flow(
|
|
21
|
-
_.map(_.pick(["id", "name", "users"])),
|
|
22
|
-
_.map(g => ({
|
|
23
|
-
...g,
|
|
24
|
-
role: "group",
|
|
25
|
-
text: _.prop("name")(g),
|
|
26
|
-
value: `group_${_.prop("id")(g)}`,
|
|
27
|
-
icon: "group"
|
|
28
|
-
}))
|
|
29
|
-
)(groups);
|
|
30
|
-
|
|
31
|
-
export const getRecipients = createSelector(
|
|
32
|
-
[getUsers, getGroups],
|
|
33
|
-
(users, groups) => [...usersAsOptions(users), ...groupsAsOptions(groups)]
|
|
34
|
-
);
|
package/src/selectors/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getRecipients } from "./getRecipients";
|