@truedat/audit 4.36.7 → 4.37.1
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 +5 -5
- package/src/components/SubscriptionActions.js +61 -54
- package/src/components/SubscriptionForm.js +1 -1
- package/src/components/__tests__/SubscriptionActions.spec.js +26 -25
- package/src/components/__tests__/__snapshots__/Subscription.spec.js.snap +1 -1
- package/src/components/__tests__/__snapshots__/SubscriptionActions.spec.js.snap +26 -65
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/audit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.37.1",
|
|
4
4
|
"description": "Truedat Web Audit Module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"jsnext:main": "src/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"jest": "^27.0.6",
|
|
48
48
|
"react": "^16.14.0",
|
|
49
49
|
"react-dom": "^16.14.0",
|
|
50
|
-
"redux-saga-test-plan": "^4.0.
|
|
50
|
+
"redux-saga-test-plan": "^4.0.4",
|
|
51
51
|
"rimraf": "^3.0.2",
|
|
52
52
|
"semantic-ui-react": "^2.0.3"
|
|
53
53
|
},
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
]
|
|
85
85
|
},
|
|
86
86
|
"dependencies": {
|
|
87
|
-
"@truedat/auth": "4.
|
|
88
|
-
"@truedat/core": "4.
|
|
87
|
+
"@truedat/auth": "4.37.1",
|
|
88
|
+
"@truedat/core": "4.37.1",
|
|
89
89
|
"axios": "^0.19.2",
|
|
90
90
|
"path-to-regexp": "^1.7.0",
|
|
91
91
|
"prop-types": "^15.7.2",
|
|
@@ -105,5 +105,5 @@
|
|
|
105
105
|
"react-dom": ">= 16.8.6 < 17",
|
|
106
106
|
"semantic-ui-react": ">= 0.88.2 < 2.1"
|
|
107
107
|
},
|
|
108
|
-
"gitHead": "
|
|
108
|
+
"gitHead": "36ffd7e86efe27f38c3ae1bb616eb9eb4d444d12"
|
|
109
109
|
}
|
|
@@ -1,70 +1,77 @@
|
|
|
1
|
-
import _ from "lodash/fp";
|
|
2
1
|
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { Link } from "react-router-dom";
|
|
5
|
-
import {
|
|
4
|
+
import { connect } from "react-redux";
|
|
6
5
|
import { Button } from "semantic-ui-react";
|
|
7
|
-
import {
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
8
7
|
import { ConfirmModal, GroupActions } from "@truedat/core/components";
|
|
9
8
|
import { SUBSCRIPTIONS, linkTo } from "@truedat/core/routes";
|
|
10
9
|
import { deleteSubscription } from "@truedat/core/routines";
|
|
11
10
|
|
|
12
|
-
export const ModalDelete = ({
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
11
|
+
export const ModalDelete = ({ deleteSubscription, id }) => {
|
|
12
|
+
const { formatMessage } = useIntl();
|
|
13
|
+
return (
|
|
14
|
+
<ConfirmModal
|
|
15
|
+
icon="trash"
|
|
16
|
+
trigger={
|
|
17
|
+
<Button
|
|
18
|
+
icon="trash"
|
|
19
|
+
content={formatMessage({ id: "subscription.actions.remove" })}
|
|
20
|
+
/>
|
|
21
|
+
}
|
|
22
|
+
header={formatMessage({
|
|
23
|
+
id: "subscription.actions.delete.confirmation.header",
|
|
24
|
+
})}
|
|
25
|
+
size="small"
|
|
26
|
+
content={formatMessage({
|
|
27
|
+
id: "subscription.actions.delete.confirmation.content",
|
|
28
|
+
})}
|
|
29
|
+
onConfirm={() =>
|
|
30
30
|
deleteSubscription({ subscription: { id }, redirect: SUBSCRIPTIONS })
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
);
|
|
35
|
-
ModalDelete.propTypes = {
|
|
36
|
-
dispatch: PropTypes.func,
|
|
37
|
-
id: PropTypes.number
|
|
31
|
+
}
|
|
32
|
+
/>
|
|
33
|
+
);
|
|
38
34
|
};
|
|
39
35
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
ModalDelete.propTypes = {
|
|
37
|
+
deleteSubscription: PropTypes.func,
|
|
38
|
+
id: PropTypes.number,
|
|
39
|
+
};
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
41
|
+
export const SubscriptionActions = ({ deleteSubscription, subscription }) => {
|
|
42
|
+
const { formatMessage } = useIntl();
|
|
43
|
+
const id = subscription?.id;
|
|
44
|
+
const actions = id
|
|
45
|
+
? [
|
|
46
|
+
{
|
|
47
|
+
key: "edit",
|
|
48
|
+
icon: "edit",
|
|
49
|
+
text: formatMessage({ id: "subscription.actions.edit" }),
|
|
50
|
+
value: "edit",
|
|
51
|
+
as: Link,
|
|
52
|
+
to: linkTo.SUBSCRIPTION_EDIT({ id }),
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
key: "delete",
|
|
56
|
+
icon: "trash",
|
|
57
|
+
value: "delete",
|
|
58
|
+
as: ModalDelete,
|
|
59
|
+
deleteSubscription,
|
|
60
|
+
id,
|
|
61
|
+
},
|
|
62
|
+
]
|
|
63
|
+
: [];
|
|
66
64
|
|
|
67
65
|
return <GroupActions availableActions={actions} />;
|
|
68
66
|
};
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
SubscriptionActions.propTypes = {
|
|
69
|
+
subscription: PropTypes.object,
|
|
70
|
+
deleteSubscription: PropTypes.func,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const mapStateToProps = ({ subscription }) => ({ subscription });
|
|
74
|
+
|
|
75
|
+
export default connect(mapStateToProps, { deleteSubscription })(
|
|
76
|
+
SubscriptionActions
|
|
77
|
+
);
|
|
@@ -29,7 +29,7 @@ const StructureSelector = React.lazy(() =>
|
|
|
29
29
|
);
|
|
30
30
|
|
|
31
31
|
const SourceSelector = React.lazy(() =>
|
|
32
|
-
import("@truedat/cx/sources/components/
|
|
32
|
+
import("@truedat/cx/sources/components/SourceSelector")
|
|
33
33
|
);
|
|
34
34
|
|
|
35
35
|
const SUBSCRIBER_TYPES = ["role", "taxonomy_role", "email", "user"];
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { shallow } from "enzyme";
|
|
2
|
+
import { render } from "@truedat/test/render";
|
|
4
3
|
import { SubscriptionActions, ModalDelete } from "../SubscriptionActions";
|
|
5
4
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
subscriber: { type: "user" },
|
|
14
|
-
scope: {
|
|
15
|
-
events: ["event1"],
|
|
16
|
-
status: ["status1"]
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
})
|
|
20
|
-
)
|
|
21
|
-
}));
|
|
5
|
+
const messages = {
|
|
6
|
+
en: {
|
|
7
|
+
"subscription.actions.delete.confirmation.content": "content",
|
|
8
|
+
"subscription.actions.delete.confirmation.header": "header",
|
|
9
|
+
"subscription.actions.remove": "remove",
|
|
10
|
+
},
|
|
11
|
+
};
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
13
|
+
const subscription = {
|
|
14
|
+
id: 2,
|
|
15
|
+
subscriber: { type: "user" },
|
|
16
|
+
scope: {
|
|
17
|
+
events: ["event1"],
|
|
18
|
+
status: ["status1"],
|
|
19
|
+
},
|
|
20
|
+
};
|
|
26
21
|
|
|
27
22
|
describe("<SubscriptionActions />", () => {
|
|
23
|
+
const state = { subscription };
|
|
24
|
+
const renderOpts = { state, messages };
|
|
25
|
+
|
|
28
26
|
it("matches the latest snapshot", () => {
|
|
29
|
-
const
|
|
30
|
-
expect(
|
|
27
|
+
const { container } = render(<SubscriptionActions />, renderOpts);
|
|
28
|
+
expect(container).toMatchSnapshot();
|
|
31
29
|
});
|
|
32
30
|
});
|
|
33
31
|
|
|
34
32
|
describe("<ModalDelete />", () => {
|
|
33
|
+
const state = {};
|
|
34
|
+
const renderOpts = { state, messages };
|
|
35
|
+
|
|
35
36
|
it("matches the latest snapshot", () => {
|
|
36
|
-
const
|
|
37
|
-
expect(
|
|
37
|
+
const { container } = render(<ModalDelete />, renderOpts);
|
|
38
|
+
expect(container).toMatchSnapshot();
|
|
38
39
|
});
|
|
39
40
|
});
|
|
@@ -1,73 +1,34 @@
|
|
|
1
1
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
2
|
|
|
3
3
|
exports[`<ModalDelete /> matches the latest snapshot 1`] = `
|
|
4
|
-
<
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
<div>
|
|
5
|
+
<button
|
|
6
|
+
class="ui button"
|
|
7
|
+
>
|
|
8
|
+
<i
|
|
9
|
+
aria-hidden="true"
|
|
10
|
+
class="trash icon"
|
|
8
11
|
/>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<Memo(MemoizedFormattedMessage)
|
|
13
|
-
id="subscription.actions.delete.confirmation.header"
|
|
14
|
-
/>
|
|
15
|
-
}
|
|
16
|
-
icon="trash"
|
|
17
|
-
size="small"
|
|
18
|
-
trigger={
|
|
19
|
-
<Button
|
|
20
|
-
as="button"
|
|
21
|
-
content={
|
|
22
|
-
<Memo(MemoizedFormattedMessage)
|
|
23
|
-
id="subscription.actions.remove"
|
|
24
|
-
/>
|
|
25
|
-
}
|
|
26
|
-
icon="trash"
|
|
27
|
-
/>
|
|
28
|
-
}
|
|
29
|
-
/>
|
|
12
|
+
remove
|
|
13
|
+
</button>
|
|
14
|
+
</div>
|
|
30
15
|
`;
|
|
31
16
|
|
|
32
17
|
exports[`<SubscriptionActions /> matches the latest snapshot 1`] = `
|
|
33
|
-
<
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
"icon": "edit",
|
|
51
|
-
"key": "edit",
|
|
52
|
-
"selected": false,
|
|
53
|
-
"text": <Memo(MemoizedFormattedMessage)
|
|
54
|
-
id="subscription.actions.edit"
|
|
55
|
-
/>,
|
|
56
|
-
"to": "/subscriptions/2/edit",
|
|
57
|
-
"value": "edit",
|
|
58
|
-
},
|
|
59
|
-
Object {
|
|
60
|
-
"active": false,
|
|
61
|
-
"as": [Function],
|
|
62
|
-
"dispatch": undefined,
|
|
63
|
-
"icon": "trash",
|
|
64
|
-
"id": 2,
|
|
65
|
-
"key": "delete",
|
|
66
|
-
"selected": false,
|
|
67
|
-
"value": "delete",
|
|
68
|
-
},
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
direction="left"
|
|
72
|
-
/>
|
|
18
|
+
<div>
|
|
19
|
+
<div
|
|
20
|
+
aria-expanded="false"
|
|
21
|
+
class="ui floating dropdown button icon group-actions"
|
|
22
|
+
role="listbox"
|
|
23
|
+
tabindex="0"
|
|
24
|
+
>
|
|
25
|
+
<i
|
|
26
|
+
aria-hidden="true"
|
|
27
|
+
class="ellipsis vertical icon"
|
|
28
|
+
/>
|
|
29
|
+
<div
|
|
30
|
+
class="left menu transition"
|
|
31
|
+
/>
|
|
32
|
+
</div>
|
|
33
|
+
</div>
|
|
73
34
|
`;
|