@truedat/core 4.54.11 → 4.56.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.56.0] 2022-11-17
4
+
5
+ ### Added
6
+
7
+ - [TD-5258] Order grants Submenu
8
+
3
9
  ## [4.54.11] 2022-11-14
4
10
 
5
11
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.54.11",
3
+ "version": "4.56.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.4",
36
36
  "@testing-library/react": "^12.0.0",
37
37
  "@testing-library/user-event": "^13.2.1",
38
- "@truedat/test": "4.54.11",
38
+ "@truedat/test": "4.56.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",
@@ -112,5 +112,5 @@
112
112
  "react-dom": ">= 16.8.6 < 17",
113
113
  "semantic-ui-react": ">= 0.88.2 < 2.1"
114
114
  },
115
- "gitHead": "72603ee10a5ad665f0c742e33a6014de94c4ba53"
115
+ "gitHead": "17277e6b9438363c6baa26f8975a2ab585a61f76"
116
116
  }
@@ -21,6 +21,12 @@ export const DOMAIN_QUERY = gql`
21
21
  }
22
22
  `;
23
23
 
24
+ export const CURRENT_ROLES = gql`
25
+ query CurrentRoles($domainId: ID, $permission: String) {
26
+ currentRoles(domainId: $domainId, permission: $permission)
27
+ }
28
+ `;
29
+
24
30
  export const TEMPLATES_QUERY = gql`
25
31
  query Templates($scope: String, $domainIds: [ID]) {
26
32
  templates(scope: $scope, domainIds: $domainIds) {
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import PropTypes from "prop-types";
3
+ import { Breadcrumb } from "semantic-ui-react";
4
+ import { useHistory } from "react-router-dom";
5
+ import { FormattedMessage } from "react-intl";
6
+
7
+ export const GenericCrumbs = ({ header, title }) => {
8
+ const history = useHistory();
9
+ const goBack = () => history.goBack();
10
+ return (
11
+ <Breadcrumb>
12
+ <Breadcrumb.Section onClick={goBack} active={false}>
13
+ <FormattedMessage id={header} />
14
+ </Breadcrumb.Section>
15
+ <Breadcrumb.Divider icon="right angle" />
16
+ {title && (
17
+ <Breadcrumb.Section active>
18
+ <FormattedMessage id={title} defaultMessage={title} />
19
+ </Breadcrumb.Section>
20
+ )}
21
+ </Breadcrumb>
22
+ );
23
+ };
24
+
25
+ GenericCrumbs.propTypes = {
26
+ header: PropTypes.string,
27
+ title: PropTypes.string,
28
+ };
29
+
30
+ export default GenericCrumbs;
@@ -4,19 +4,33 @@ import {
4
4
  GRANT_REQUEST_APPROVALS,
5
5
  MY_GRANTS,
6
6
  GRANTS,
7
- MY_GRANT_REQUESTS
7
+ GRANT_APPROVAL_RULES,
8
+ MY_GRANT_REQUESTS,
8
9
  } from "../routes";
9
10
  import Submenu from "./Submenu";
10
11
 
11
12
  const items = [
12
- { name: "my_grants", routes: [MY_GRANTS] },
13
- { name: "grants", routes: [GRANTS] },
14
- { name: "grant_request_approvals", routes: [GRANT_REQUEST_APPROVALS] },
15
- { name: "my_grant_requests", routes: [MY_GRANT_REQUESTS] }
13
+ { name: "my_grants", routes: [MY_GRANTS], groups: ["grants"] },
14
+ { name: "grants", routes: [GRANTS], groups: ["grants"] },
15
+ {
16
+ name: "my_grant_requests",
17
+ routes: [MY_GRANT_REQUESTS],
18
+ groups: ["grants"],
19
+ },
20
+ {
21
+ name: "grant_request_approvals",
22
+ routes: [GRANT_REQUEST_APPROVALS],
23
+ groups: ["grants_management"],
24
+ },
25
+ {
26
+ name: "grant_approval_rules",
27
+ routes: [GRANT_APPROVAL_RULES],
28
+ groups: ["grants_management"],
29
+ },
16
30
  ];
17
31
 
18
32
  export const GrantMenu = () => {
19
- const authorized = useAuthorized("data_dictionary");
33
+ const authorized = useAuthorized(["grants", "grants_management"]);
20
34
  return authorized ? <Submenu items={items} icon="key" name="grants" /> : null;
21
35
  };
22
36
 
@@ -0,0 +1,19 @@
1
+ import React from "react";
2
+ import { render } from "@truedat/test/render";
3
+ import { GenericCrumbs } from "../GenericCrumbs";
4
+
5
+ describe("<GenericCrumbs />", () => {
6
+ it("matches the latest snapshot", () => {
7
+ const renderOpts = {
8
+ messages: {
9
+ en: {
10
+ bar: "bar header",
11
+ foo: "foo title",
12
+ },
13
+ },
14
+ };
15
+ const props = { title: "foo", header: "bar" };
16
+ const wrapper = render(<GenericCrumbs {...props} />, renderOpts);
17
+ expect(wrapper).toMatchSnapshot();
18
+ });
19
+ });
@@ -0,0 +1,100 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`<GenericCrumbs /> matches the latest snapshot 1`] = `
4
+ Object {
5
+ "asFragment": [Function],
6
+ "baseElement": <body>
7
+ <div>
8
+ <div
9
+ class="ui breadcrumb"
10
+ >
11
+ <a
12
+ class="section"
13
+ >
14
+ bar header
15
+ </a>
16
+ <i
17
+ aria-hidden="true"
18
+ class="right angle icon divider"
19
+ />
20
+ <div
21
+ class="active section"
22
+ >
23
+ foo title
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </body>,
28
+ "container": <div>
29
+ <div
30
+ class="ui breadcrumb"
31
+ >
32
+ <a
33
+ class="section"
34
+ >
35
+ bar header
36
+ </a>
37
+ <i
38
+ aria-hidden="true"
39
+ class="right angle icon divider"
40
+ />
41
+ <div
42
+ class="active section"
43
+ >
44
+ foo title
45
+ </div>
46
+ </div>
47
+ </div>,
48
+ "debug": [Function],
49
+ "findAllByAltText": [Function],
50
+ "findAllByDisplayValue": [Function],
51
+ "findAllByLabelText": [Function],
52
+ "findAllByPlaceholderText": [Function],
53
+ "findAllByRole": [Function],
54
+ "findAllByTestId": [Function],
55
+ "findAllByText": [Function],
56
+ "findAllByTitle": [Function],
57
+ "findByAltText": [Function],
58
+ "findByDisplayValue": [Function],
59
+ "findByLabelText": [Function],
60
+ "findByPlaceholderText": [Function],
61
+ "findByRole": [Function],
62
+ "findByTestId": [Function],
63
+ "findByText": [Function],
64
+ "findByTitle": [Function],
65
+ "getAllByAltText": [Function],
66
+ "getAllByDisplayValue": [Function],
67
+ "getAllByLabelText": [Function],
68
+ "getAllByPlaceholderText": [Function],
69
+ "getAllByRole": [Function],
70
+ "getAllByTestId": [Function],
71
+ "getAllByText": [Function],
72
+ "getAllByTitle": [Function],
73
+ "getByAltText": [Function],
74
+ "getByDisplayValue": [Function],
75
+ "getByLabelText": [Function],
76
+ "getByPlaceholderText": [Function],
77
+ "getByRole": [Function],
78
+ "getByTestId": [Function],
79
+ "getByText": [Function],
80
+ "getByTitle": [Function],
81
+ "queryAllByAltText": [Function],
82
+ "queryAllByDisplayValue": [Function],
83
+ "queryAllByLabelText": [Function],
84
+ "queryAllByPlaceholderText": [Function],
85
+ "queryAllByRole": [Function],
86
+ "queryAllByTestId": [Function],
87
+ "queryAllByText": [Function],
88
+ "queryAllByTitle": [Function],
89
+ "queryByAltText": [Function],
90
+ "queryByDisplayValue": [Function],
91
+ "queryByLabelText": [Function],
92
+ "queryByPlaceholderText": [Function],
93
+ "queryByRole": [Function],
94
+ "queryByTestId": [Function],
95
+ "queryByText": [Function],
96
+ "queryByTitle": [Function],
97
+ "rerender": [Function],
98
+ "unmount": [Function],
99
+ }
100
+ `;
@@ -6,27 +6,48 @@ exports[`<GrantMenu /> matches the latest snapshot 1`] = `
6
6
  items={
7
7
  Array [
8
8
  Object {
9
+ "groups": Array [
10
+ "grants",
11
+ ],
9
12
  "name": "my_grants",
10
13
  "routes": Array [
11
- "/my_grants",
14
+ "/myGrants",
12
15
  ],
13
16
  },
14
17
  Object {
18
+ "groups": Array [
19
+ "grants",
20
+ ],
15
21
  "name": "grants",
16
22
  "routes": Array [
17
23
  "/grants",
18
24
  ],
19
25
  },
20
26
  Object {
27
+ "groups": Array [
28
+ "grants",
29
+ ],
30
+ "name": "my_grant_requests",
31
+ "routes": Array [
32
+ "/myGrantRequests",
33
+ ],
34
+ },
35
+ Object {
36
+ "groups": Array [
37
+ "grants_management",
38
+ ],
21
39
  "name": "grant_request_approvals",
22
40
  "routes": Array [
23
- "/grant_request_approvals",
41
+ "/grantRequestApprovals",
24
42
  ],
25
43
  },
26
44
  Object {
27
- "name": "my_grant_requests",
45
+ "groups": Array [
46
+ "grants_management",
47
+ ],
48
+ "name": "grant_approval_rules",
28
49
  "routes": Array [
29
- "/my_grant_requests",
50
+ "/grantApprovalRules",
30
51
  ],
31
52
  },
32
53
  ]
@@ -14,7 +14,7 @@ exports[`<LineageMenu /> matches the latest snapshot 1`] = `
14
14
  Object {
15
15
  "name": "lineage_events",
16
16
  "routes": Array [
17
- "/lineage_events",
17
+ "/lineageEvents",
18
18
  ],
19
19
  },
20
20
  ]
@@ -99,6 +99,7 @@ export default {
99
99
  "sidemenu.lineage_events": "My graphs",
100
100
  "sidemenu.lineage": "Lineage Analysis",
101
101
  "sidemenu.members": "Members",
102
+ "sidemenu.grant_approval_rules": "Approval Rules",
102
103
  "sidemenu.my_grant_requests": "My Grant Requests",
103
104
  "sidemenu.my_grants": "My Grants",
104
105
  "sidemenu.pending_structure_notes": "Pending notes",
@@ -102,6 +102,7 @@ export default {
102
102
  "sidemenu.lineage_events": "Mis grafos",
103
103
  "sidemenu.lineage": "Linaje",
104
104
  "sidemenu.members": "Miembros",
105
+ "sidemenu.grant_approval_rules": "Reglas de Aprobación",
105
106
  "sidemenu.my_grant_requests": "Mis Peticiones de Accesos",
106
107
  "sidemenu.my_grants": "Mis accesos",
107
108
  "sidemenu.pending_structure_notes": "Notas pendientes",
package/src/routes.js CHANGED
@@ -45,11 +45,15 @@ export const DOMAIN_NEW = "/domains/:id/new";
45
45
  export const DOMAIN_STRUCTURES = "/domains/:id/structures";
46
46
  export const EXECUTION_GROUP = "/executionGroups/:id";
47
47
  export const EXECUTION_GROUPS = "/executionGroups";
48
+ export const GRANT_APPROVAL_RULE = "/grantApproveRules/:id";
49
+ export const GRANT_APPROVAL_RULE_NEW = "/grantApproveRules/new";
50
+ export const GRANT_APPROVAL_RULE_EDIT = "/grantApproveRules/:id/edit";
51
+ export const GRANT_APPROVAL_RULES = "/grantApprovalRules";
48
52
  export const GRANTS = "/grants";
49
- export const GRANTS_REQUESTS_CHECKOUT = "/grants_requests/checkout";
50
- export const GRANT_REQUEST = "/grant_requests/:id";
51
- export const GRANT_REQUESTS = "/grant_requests";
52
- export const GRANT_REQUEST_APPROVALS = "/grant_request_approvals";
53
+ export const GRANTS_REQUESTS_CHECKOUT = "/grantsRequests/checkout";
54
+ export const GRANT_REQUEST = "/grantRequests/:id";
55
+ export const GRANT_REQUESTS = "/grantRequests";
56
+ export const GRANT_REQUEST_APPROVALS = "/grantRequestApprovals";
53
57
  export const GRAPH = "/graphs/:id";
54
58
  export const GRAPHS = "/graphs";
55
59
  export const GROUP = "/groups/:id";
@@ -108,10 +112,10 @@ export const INGEST_RELATIONS_STRUCTURES_NEW =
108
112
  "/ingests/:id/relations/structures/new";
109
113
  export const JOB = "/jobs/:id";
110
114
  export const JOBS = "/jobs";
111
- export const LINEAGE_EVENTS = "/lineage_events";
115
+ export const LINEAGE_EVENTS = "/lineageEvents";
112
116
  export const LOGIN = "/login";
113
- export const MY_GRANTS = "/my_grants";
114
- export const MY_GRANT_REQUESTS = "/my_grant_requests";
117
+ export const MY_GRANTS = "/myGrants";
118
+ export const MY_GRANT_REQUESTS = "/myGrantRequests";
115
119
  export const PASSWORD = "/password";
116
120
  export const PENDING_STRUCTURE_NOTES = "/structureNotes";
117
121
  export const PROFILE_EXECUTION =
@@ -234,6 +238,10 @@ const routes = {
234
238
  DOMAIN_STRUCTURES,
235
239
  EXECUTION_GROUP,
236
240
  EXECUTION_GROUPS,
241
+ GRANT_APPROVAL_RULE,
242
+ GRANT_APPROVAL_RULE_NEW,
243
+ GRANT_APPROVAL_RULE_EDIT,
244
+ GRANT_APPROVAL_RULES,
237
245
  GRANTS,
238
246
  GRANTS_REQUESTS_CHECKOUT,
239
247
  GRANT_REQUEST,