@truedat/core 4.50.2 → 4.51.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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.51.0] 2022-09-13
4
+
5
+ ### Added
6
+
7
+ - [TD-3415] Routes, i18n and navigation item for execution groups
8
+
9
+ ## [4.50.3] 2022-08-29
10
+
11
+ ### Changed
12
+
13
+ - [TD-5091] Dynamic `domain` fields are now integer ids instead of embedded
14
+ documents
15
+
3
16
  ## [4.49.4] 2022-07-29
4
17
 
5
18
  ### Fixed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/core",
3
- "version": "4.50.2",
3
+ "version": "4.51.0",
4
4
  "description": "Truedat Web Core",
5
5
  "sideEffects": false,
6
6
  "jsnext:main": "src/index.js",
@@ -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": "5785ca8828b3c25947e8d2587c909f729fbee317"
115
+ "gitHead": "a3d9290433e773d9c605d9a0d9fa51908c5becad"
116
116
  }
@@ -4,6 +4,7 @@ export const DOMAINS_QUERY = gql`
4
4
  query DomainsQuery($action: String!, $domainActions: [String!]) {
5
5
  domains(action: $action) {
6
6
  id
7
+ externalId
7
8
  name
8
9
  parentId
9
10
  actions(actions: $domainActions)
@@ -26,10 +26,12 @@ export const FilterItem = ({
26
26
  active,
27
27
  filter,
28
28
  toggleFilterValue,
29
- option: { text, value }
29
+ option: { text, value },
30
30
  }) => (
31
31
  <Dropdown.Item
32
- onClick={e => preventDefault(e, () => toggleFilterValue({ filter, value }))}
32
+ onClick={(e) =>
33
+ preventDefault(e, () => toggleFilterValue({ filter, value }))
34
+ }
33
35
  active={active}
34
36
  >
35
37
  <Icon name={active ? "check square outline" : "square outline"} />
@@ -41,7 +43,7 @@ FilterItem.propTypes = {
41
43
  active: PropTypes.bool,
42
44
  filter: PropTypes.string,
43
45
  toggleFilterValue: PropTypes.func,
44
- option: PropTypes.object
46
+ option: PropTypes.object,
45
47
  };
46
48
 
47
49
  export default FilterItem;
@@ -4,10 +4,11 @@ import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { useAuthorized } from "../hooks";
6
6
  import {
7
- RULES,
8
- QUALITY_DASHBOARD,
7
+ EXECUTION_GROUPS,
9
8
  IMPLEMENTATIONS,
10
9
  IMPLEMENTATIONS_PENDING,
10
+ QUALITY_DASHBOARD,
11
+ RULES,
11
12
  } from "../routes";
12
13
  import { getQualityDashboardConfig } from "../selectors";
13
14
  import Submenu from "./Submenu";
@@ -20,6 +21,7 @@ export const ITEMS = [
20
21
  routes: [IMPLEMENTATIONS_PENDING],
21
22
  groups: ["quality_implementation_workflow_management"],
22
23
  },
24
+ { name: "executions", routes: [EXECUTION_GROUPS], groups: ["quality"] },
23
25
  {
24
26
  name: "quality_dashboard",
25
27
  routes: [QUALITY_DASHBOARD],
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useEffect } from "react";
2
+ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { FormattedMessage } from "react-intl";
5
5
  import FilterDropdown from "./FilterDropdown";
@@ -49,8 +49,10 @@ const labelValues = _.cond([
49
49
  ]);
50
50
 
51
51
  export const TreeSelector = ({
52
+ check = false,
52
53
  error,
53
54
  label,
55
+ labels = false,
54
56
  multiple = false,
55
57
  name,
56
58
  onBlur,
@@ -113,13 +115,15 @@ export const TreeSelector = ({
113
115
  ({ id, level }) => level === 0 || _.includes(id)(displayed)
114
116
  );
115
117
 
116
- const trigger = (
118
+ const trigger = labels ? (
117
119
  <SelectedLabels
118
120
  placeholder={placeholder}
119
121
  options={options}
120
122
  onClick={handleClick}
121
123
  value={labelValues(value)}
122
124
  />
125
+ ) : (
126
+ <label>{placeholder}</label>
123
127
  );
124
128
 
125
129
  const items = _.flow(
@@ -128,7 +132,7 @@ export const TreeSelector = ({
128
132
  _.map((option) => (
129
133
  <DropdownMenuItem
130
134
  key={option?.id}
131
- check={false}
135
+ check={check}
132
136
  onOpen={handleOpen}
133
137
  onClick={handleClick}
134
138
  open={_.contains(option.id)(open)}
@@ -175,8 +179,10 @@ export const TreeSelector = ({
175
179
  };
176
180
 
177
181
  TreeSelector.propTypes = {
182
+ check: PropTypes.bool,
178
183
  error: PropTypes.bool,
179
184
  label: PropTypes.string,
185
+ labels: PropTypes.bool,
180
186
  multiple: PropTypes.bool,
181
187
  name: PropTypes.string,
182
188
  onBlur: PropTypes.func,
@@ -12,10 +12,34 @@ const domainsMock = {
12
12
  result: {
13
13
  data: {
14
14
  domains: [
15
- { __typename: "Domain", id: "1", name: "foo", parentId: null },
16
- { __typename: "Domain", id: "2", name: "bar", parentId: "1" },
17
- { __typename: "Domain", id: "3", name: "baz", parentId: "2" },
18
- { __typename: "Domain", id: "4", name: "xyzzy", parentId: "99" },
15
+ {
16
+ __typename: "Domain",
17
+ id: "1",
18
+ name: "foo",
19
+ externalId: "A",
20
+ parentId: null,
21
+ },
22
+ {
23
+ __typename: "Domain",
24
+ id: "2",
25
+ name: "bar",
26
+ externalId: "B",
27
+ parentId: "1",
28
+ },
29
+ {
30
+ __typename: "Domain",
31
+ id: "3",
32
+ name: "baz",
33
+ externalId: "C",
34
+ parentId: "2",
35
+ },
36
+ {
37
+ __typename: "Domain",
38
+ id: "4",
39
+ name: "xyzzy",
40
+ externalId: "D",
41
+ parentId: "99",
42
+ },
19
43
  ],
20
44
  },
21
45
  },
@@ -70,6 +70,19 @@ exports[`<QualityMenu /> matches the latest snapshot 1`] = `
70
70
  Drafts
71
71
  </span>
72
72
  </a>
73
+ <a
74
+ aria-checked="true"
75
+ class="active item"
76
+ href="/executionGroups"
77
+ name="executions"
78
+ role="option"
79
+ >
80
+ <span
81
+ class="text"
82
+ >
83
+ My Executions
84
+ </span>
85
+ </a>
73
86
  </div>
74
87
  </div>
75
88
  </div>
@@ -82,6 +82,7 @@ export default {
82
82
  "sidemenu.concepts": "Concepts",
83
83
  "sidemenu.configurations": "Configuration",
84
84
  "sidemenu.dashboard": "Dashboard",
85
+ "sidemenu.executions": "My Executions",
85
86
  "sidemenu.glossary": "Glossary",
86
87
  "sidemenu.grant_request_approvals": "Approve Grant Requests",
87
88
  "sidemenu.grant_requests": "Grant Requests",
@@ -85,6 +85,7 @@ export default {
85
85
  "sidemenu.concepts": "Conceptos",
86
86
  "sidemenu.configurations": "Configuración",
87
87
  "sidemenu.dashboard": "Dashboard",
88
+ "sidemenu.executions": "Mis ejecuciones",
88
89
  "sidemenu.glossary": "Glosario",
89
90
  "sidemenu.grant_request_approvals": "Aprobar Peticiones de Accesos",
90
91
  "sidemenu.grant_requests": "Peticiones de Accesos",
package/src/routes.js CHANGED
@@ -43,6 +43,7 @@ export const DOMAIN_MEMBERS_NEW = "/domains/:id/members/new";
43
43
  export const DOMAIN_NEW = "/domains/:id/new";
44
44
  export const DOMAIN_STRUCTURES = "/domains/:id/structures";
45
45
  export const EXECUTION_GROUP = "/executionGroups/:id";
46
+ export const EXECUTION_GROUPS = "/executionGroups";
46
47
  export const GRANTS = "/grants";
47
48
  export const GRANTS_REQUESTS_CHECKOUT = "/grants_requests/checkout";
48
49
  export const GRANT_REQUEST = "/grant_requests/:id";
@@ -227,6 +228,7 @@ const routes = {
227
228
  DOMAIN_NEW,
228
229
  DOMAIN_STRUCTURES,
229
230
  EXECUTION_GROUP,
231
+ EXECUTION_GROUPS,
230
232
  GRANTS,
231
233
  GRANTS_REQUESTS_CHECKOUT,
232
234
  GRANT_REQUEST,
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import { mergeFilters, getSearchPayload } from "../filters";
2
+ import { isEmbedded, mergeFilters, getSearchPayload } from "../filters";
3
3
 
4
4
  describe("services: filters", () => {
5
5
  describe("mergeFilters", () => {
@@ -72,4 +72,12 @@ describe("services: filters", () => {
72
72
  });
73
73
  });
74
74
  });
75
+
76
+ describe("isEmbedded", () => {
77
+ test("returns true iff item has name and id prop", () => {
78
+ expect(isEmbedded({ id: 123, name: "foo" })).toBe(true);
79
+ expect(isEmbedded(123)).toBe(false);
80
+ expect(isEmbedded("123")).toBe(false);
81
+ });
82
+ });
75
83
  });
@@ -28,10 +28,14 @@ export const getSearchPayload = (searchQuery, props) => {
28
28
  ]);
29
29
  };
30
30
 
31
+ export const isEmbedded = _.overEvery(_.has("id"), _.has("name"));
32
+
31
33
  export const formatFilterValues = (selectedFilter) => (values) =>
32
34
  selectedFilter === "taxonomy"
33
35
  ? getDomainSelectorOptions({ domains: values })
36
+ : _.any(isEmbedded)(values)
37
+ ? _.map(({ id, name }) => ({ value: id, text: name }))(values)
34
38
  : values;
35
39
 
36
40
  export const toFilterValues = (filterValues) =>
37
- _.map((v) => (_.isObject(v) ? v.id : v))(filterValues);
41
+ _.map((v) => (_.isObject(v) ? v.id || v.value : v))(filterValues);