@truedat/dq 8.1.0 → 8.1.3

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@truedat/dq",
3
- "version": "8.1.0",
3
+ "version": "8.1.3",
4
4
  "description": "Truedat Web Data Quality Module",
5
5
  "sideEffects": false,
6
6
  "module": "src/index.js",
@@ -53,7 +53,7 @@
53
53
  "@testing-library/jest-dom": "^6.6.3",
54
54
  "@testing-library/react": "^16.3.0",
55
55
  "@testing-library/user-event": "^14.6.1",
56
- "@truedat/test": "8.1.0",
56
+ "@truedat/test": "8.1.3",
57
57
  "identity-obj-proxy": "^3.0.0",
58
58
  "jest": "^29.7.0",
59
59
  "redux-saga-test-plan": "^4.0.6"
@@ -86,5 +86,5 @@
86
86
  "semantic-ui-react": "^3.0.0-beta.2",
87
87
  "swr": "^2.3.3"
88
88
  },
89
- "gitHead": "c954898f854501a4e91a10be48ea563e55967284"
89
+ "gitHead": "0eaf0c4b1342771cddb87d09ed78a9e4c65a5ca2"
90
90
  }
@@ -1,7 +1,14 @@
1
- import { lazy } from "react";
1
+ import { useActiveRoute } from "@truedat/core/hooks";
2
+ import { useParams } from "react-router";
3
+ import { useSelector } from "react-redux";
2
4
  import PropTypes from "prop-types";
3
5
  import { Segment } from "semantic-ui-react";
4
6
  import { SearchContextProvider } from "@truedat/core/search/SearchContext";
7
+ import { getRiSubscopes } from "@truedat/core/selectors";
8
+ import {
9
+ IMPLEMENTATIONS,
10
+ IMPLEMENTATIONS_BY_SUBSCOPE
11
+ } from "@truedat/core/routes";
5
12
  import {
6
13
  useRuleImplementationFilters,
7
14
  useRuleImplementationSearch,
@@ -12,6 +19,27 @@ import ImplementationFiltersLoader from "./ImplementationFiltersLoader";
12
19
  import ImplementationSearchResults from "./ImplementationSearchResults";
13
20
 
14
21
  export const Implementations = ({ defaultFilters }) => {
22
+ const { subscope } = useParams();
23
+ const isImplementations=useActiveRoute(IMPLEMENTATIONS)
24
+ const isImplementationsBySubscope=useActiveRoute(IMPLEMENTATIONS_BY_SUBSCOPE)
25
+ const riSubscopes = useSelector(getRiSubscopes);
26
+
27
+ let filtersWithSubscope = { ...defaultFilters };
28
+
29
+ if (isImplementations && riSubscopes && riSubscopes.length > 0){
30
+ const mustNotFilters = {};
31
+ mustNotFilters[`mustnot.template.subscope`] = riSubscopes;
32
+
33
+ filtersWithSubscope = {
34
+ ...defaultFilters,
35
+ ...mustNotFilters
36
+ };
37
+ }
38
+ else if (isImplementationsBySubscope){
39
+ filtersWithSubscope = { ...defaultFilters, "template.subscope": [subscope] };
40
+ }
41
+
42
+
15
43
  const searchProps = {
16
44
  initialSortColumn: "implementation_key.raw",
17
45
  initialSortDirection: "ascending",
@@ -20,17 +48,17 @@ export const Implementations = ({ defaultFilters }) => {
20
48
  pageSize: 20,
21
49
  userFiltersType: "user_search_filters",
22
50
  userFilterScope: "rule_implementation",
23
- defaultFilters,
51
+ defaultFilters: filtersWithSubscope,
24
52
  };
25
53
 
26
54
  return (
27
55
  <>
28
56
  <SearchContextProvider {...searchProps}>
29
- <ImplementationFiltersLoader defaultFilters={defaultFilters} />
57
+ <ImplementationFiltersLoader defaultFilters={filtersWithSubscope} />
30
58
  <Segment>
31
59
  <ImplementationsHeader />
32
60
  <Segment attached="bottom">
33
- <ImplementationSearchResults defaultFilters={defaultFilters} />
61
+ <ImplementationSearchResults defaultFilters={filtersWithSubscope} />
34
62
  </Segment>
35
63
  </Segment>
36
64
  </SearchContextProvider>
@@ -42,4 +70,4 @@ Implementations.propTypes = {
42
70
  defaultFilters: PropTypes.object,
43
71
  };
44
72
 
45
- export default Implementations;
73
+ export default Implementations;
@@ -1,25 +1,62 @@
1
1
  import { Header, Icon } from "semantic-ui-react";
2
2
  import { FormattedMessage, useIntl } from "react-intl";
3
3
  import { useActiveRoute } from "@truedat/core/hooks";
4
+ import { useLocation } from "react-router";
4
5
  import {
5
6
  IMPLEMENTATIONS_PENDING,
6
7
  IMPLEMENTATIONS_DEPRECATED,
8
+ IMPLEMENTATIONS_BY_SUBSCOPE,
7
9
  } from "@truedat/core/routes";
10
+ import { useMemo } from "react";
8
11
 
9
12
  export const ImplementationSearchResultsHeader = () => {
10
13
  const { formatMessage } = useIntl();
14
+ const location = useLocation();
11
15
  const pending = useActiveRoute(IMPLEMENTATIONS_PENDING);
12
16
  const deprecated = useActiveRoute(IMPLEMENTATIONS_DEPRECATED);
13
- const header = pending
14
- ? "implementations.header.manage"
15
- : deprecated
16
- ? "implementations.header.deprecated"
17
- : "implementations.header";
18
- const subheader = pending
19
- ? "implementations.subheader.manage"
20
- : deprecated
21
- ? "implementations.subheader.deprecated"
22
- : "implementations.subheader";
17
+
18
+ const { header, subheader } = useMemo(() => {
19
+ // Check if current URL is a subscope URL
20
+ const pathParts = location.pathname.split('/');
21
+ const isSubscopeUrl = pathParts.includes('subscope') && pathParts.length > 2;
22
+
23
+ if (isSubscopeUrl) {
24
+ const subscopeIndex = pathParts.indexOf('subscope');
25
+ const subscopeName = pathParts[subscopeIndex + 1];
26
+
27
+ if (subscopeName) {
28
+ const decodedName = decodeURIComponent(subscopeName);
29
+ const normalizedSubscopeName = decodedName
30
+ .replace(/\s+/g, '_')
31
+ .replace(/[^\w_]/g, '');
32
+
33
+ return {
34
+ header: `implementations.${normalizedSubscopeName}.main.header`,
35
+ subheader: `implementations.${normalizedSubscopeName}.main.subheader`
36
+ };
37
+ }
38
+ }
39
+
40
+ if (pending) {
41
+ return {
42
+ header: "implementations.header.manage",
43
+ subheader: "implementations.subheader.manage"
44
+ };
45
+ }
46
+
47
+ if (deprecated) {
48
+ return {
49
+ header: "implementations.header.deprecated",
50
+ subheader: "implementations.subheader.deprecated"
51
+ };
52
+ }
53
+
54
+ return {
55
+ header: "implementations.header",
56
+ subheader: "implementations.subheader"
57
+ };
58
+ }, [location.pathname, pending, deprecated]);
59
+
23
60
  return (
24
61
  <Header as="h2">
25
62
  <Icon
@@ -30,13 +67,19 @@ export const ImplementationSearchResultsHeader = () => {
30
67
  })}
31
68
  />
32
69
  <Header.Content>
33
- <FormattedMessage id={header} />
70
+ <FormattedMessage
71
+ id={header}
72
+ defaultMessage={header}
73
+ />
34
74
  <Header.Subheader>
35
- <FormattedMessage id={subheader} />
75
+ <FormattedMessage
76
+ id={subheader}
77
+ defaultMessage={subheader}
78
+ />
36
79
  </Header.Subheader>
37
80
  </Header.Content>
38
81
  </Header>
39
82
  );
40
83
  };
41
84
 
42
- export default ImplementationSearchResultsHeader;
85
+ export default ImplementationSearchResultsHeader;
@@ -26,6 +26,7 @@ import {
26
26
  IMPLEMENTATION_STRUCTURES,
27
27
  IMPLEMENTATION,
28
28
  IMPLEMENTATIONS,
29
+ IMPLEMENTATIONS_BY_SUBSCOPE,
29
30
  IMPLEMENTATIONS_DEPRECATED,
30
31
  IMPLEMENTATIONS_PENDING,
31
32
  } from "@truedat/core/routes";
@@ -125,6 +126,13 @@ export const ImplementationsRoutes = ({
125
126
  />
126
127
  }
127
128
  />
129
+ <Route
130
+ // IMPLEMENTATIONS_BY_SUBSCOPE = "/implementations/subscope/:subscope";
131
+ path="/subscope/:subscope"
132
+ element={
133
+ <Implementations defaultFilters={{ status: ["published"] }} />
134
+ }
135
+ />
128
136
  <Route
129
137
  // IMPLEMENTATIONS_DEPRECATED = "/implementations/deprecated";
130
138
  path="deprecated"
@@ -25,14 +25,12 @@ export const RuleImplementationsDownloadXlsx = () => {
25
25
  <Dropdown.Item
26
26
  icon="download"
27
27
  content={
28
- <>
29
- <span>
28
+ <span>
30
29
  {formatMessage({
31
30
  id: "implementations.actions.downloadXlsx.tooltip",
32
31
  })}
33
32
  </span>
34
- </>
35
- }
33
+ }
36
34
  onClick={() =>
37
35
  triggerDownload({
38
36
  ...searchParams,
@@ -54,7 +54,9 @@ exports[`<ImplementationSearchResults /> matches the latest snapshot 1`] = `
54
54
  aria-hidden="true"
55
55
  class="download icon"
56
56
  />
57
- <span>
57
+ <span
58
+ class="text"
59
+ >
58
60
  implementations.actions.downloadXlsx.tooltip
59
61
  </span>
60
62
  </div>
@@ -205,7 +207,9 @@ exports[`<ImplementationSearchResults /> renders executions on when executionEna
205
207
  aria-hidden="true"
206
208
  class="download icon"
207
209
  />
208
- <span>
210
+ <span
211
+ class="text"
212
+ >
209
213
  implementations.actions.downloadXlsx.tooltip
210
214
  </span>
211
215
  </div>
@@ -56,7 +56,9 @@ exports[`<Implementations /> matches the latest snapshot 1`] = `
56
56
  aria-hidden="true"
57
57
  class="download icon"
58
58
  />
59
- <span>
59
+ <span
60
+ class="text"
61
+ >
60
62
  implementations.actions.downloadXlsx.tooltip
61
63
  </span>
62
64
  </div>
@@ -66,7 +66,9 @@ exports[`<RuleImplementationsActions /> matches the latest snapshot 1`] = `
66
66
  aria-hidden="true"
67
67
  class="download icon"
68
68
  />
69
- <span>
69
+ <span
70
+ class="text"
71
+ >
70
72
  implementations.actions.downloadXlsx.tooltip
71
73
  </span>
72
74
  </div>
@@ -25,7 +25,9 @@ exports[`<RuleImplementationsOptions /> matches the latest snapshot 1`] = `
25
25
  aria-hidden="true"
26
26
  class="download icon"
27
27
  />
28
- <span>
28
+ <span
29
+ class="text"
30
+ >
29
31
  implementations.actions.downloadXlsx.tooltip
30
32
  </span>
31
33
  </div>