@truedat/se 7.5.9 → 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 +43 -64
- package/src/components/CardResult.js +3 -4
- package/src/components/DeleteIndexButton.js +0 -1
- package/src/components/ElasticIndexes.js +5 -4
- package/src/components/Search.js +0 -1
- package/src/components/SearchHome.js +4 -4
- package/src/components/SearchInput.js +0 -1
- package/src/components/SearchLoader.js +17 -37
- package/src/components/SearchPagination.js +0 -1
- package/src/components/SearchResults.js +4 -5
- package/src/components/SearchRoutes.js +21 -67
- package/src/components/SearchTabs.js +7 -8
- package/src/components/__tests__/CardResult.spec.js +7 -7
- package/src/components/__tests__/DeleteIndexButton.spec.js +22 -37
- package/src/components/__tests__/ElasticIndexes.spec.js +5 -26
- package/src/components/__tests__/Search.spec.js +0 -1
- package/src/components/__tests__/SearchInput.spec.js +7 -12
- package/src/components/__tests__/SearchLoader.spec.js +64 -72
- package/src/components/__tests__/SearchPagination.spec.js +0 -1
- package/src/components/__tests__/SearchResults.spec.js +0 -1
- package/src/components/__tests__/SearchRoutes.spec.js +107 -7
- package/src/components/__tests__/SearchTabs.spec.js +6 -5
- package/src/components/__tests__/SearchTabsHide.spec.js +9 -25
- package/src/components/__tests__/__snapshots__/CardResult.spec.js.snap +29 -22
- package/src/components/__tests__/__snapshots__/ElasticIndexes.spec.js.snap +1 -12
- package/src/components/__tests__/__snapshots__/Search.spec.js.snap +6 -5
- package/src/components/__tests__/__snapshots__/SearchInput.spec.js.snap +15 -14
- package/src/components/__tests__/__snapshots__/SearchLoader.spec.js.snap +7 -1
- package/src/components/__tests__/__snapshots__/SearchResults.spec.js.snap +3 -2
- package/src/components/__tests__/__snapshots__/SearchRoutes.spec.js.snap +94 -5
- package/src/components/__tests__/__snapshots__/SearchTabs.spec.js.snap +4 -0
- package/src/hooks/__tests__/{useElasticIndexes.spec.js → useElasticIndexes.spec.js.disabled} +1 -1
- package/src/selectors/__tests__/getSearchQuery.spec.js +7 -7
- package/src/selectors/__tests__/searchIndicesSelector.spec.js +2 -2
- package/src/selectors/__tests__/searchResultsSelector.spec.js +13 -10
- package/src/selectors/defaultIndices.js +2 -2
- package/src/selectors/searchResultsSelector.js +4 -4
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@truedat/se",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.10",
|
|
4
4
|
"description": "Truedat Web Search Engine",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"jsnext:main": "src/index.js",
|
|
7
6
|
"module": "src/index.js",
|
|
8
7
|
"files": [
|
|
9
|
-
"src"
|
|
8
|
+
"src",
|
|
9
|
+
"index.js"
|
|
10
10
|
],
|
|
11
11
|
"author": "Bluetab Solutions",
|
|
12
12
|
"license": "GPL-3.0",
|
|
@@ -15,64 +15,25 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"clean": "rimraf yarn-error.log",
|
|
18
|
-
"debug": "node --inspect-brk node_modules/.bin/jest --runInBand",
|
|
19
18
|
"test": "TZ=UTC jest --coverage",
|
|
20
|
-
"test:watch": "TZ=UTC jest --watch",
|
|
21
19
|
"eslint": "eslint src/**",
|
|
22
20
|
"eslint:fix": "eslint --fix src/**"
|
|
23
21
|
},
|
|
24
|
-
"devDependencies": {
|
|
25
|
-
"@babel/cli": "^7.19.3",
|
|
26
|
-
"@babel/core": "^7.20.5",
|
|
27
|
-
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
|
28
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.20.2",
|
|
29
|
-
"@babel/plugin-proposal-optional-chaining": "^7.18.9",
|
|
30
|
-
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
|
31
|
-
"@babel/plugin-transform-modules-commonjs": "^7.19.6",
|
|
32
|
-
"@babel/preset-env": "^7.20.2",
|
|
33
|
-
"@babel/preset-react": "^7.18.6",
|
|
34
|
-
"@testing-library/jest-dom": "^5.16.5",
|
|
35
|
-
"@testing-library/react": "^12.0.0",
|
|
36
|
-
"@testing-library/user-event": "^13.2.1",
|
|
37
|
-
"@truedat/test": "7.5.9",
|
|
38
|
-
"babel-jest": "^28.1.0",
|
|
39
|
-
"babel-plugin-dynamic-import-node": "^2.3.3",
|
|
40
|
-
"babel-plugin-lodash": "^3.3.4",
|
|
41
|
-
"babel-plugin-react-intl": "^5.1.18",
|
|
42
|
-
"babel-plugin-transform-semantic-ui-react-imports": "^1.4.1",
|
|
43
|
-
"enzyme": "^3.11.0",
|
|
44
|
-
"enzyme-to-json": "^3.6.2",
|
|
45
|
-
"identity-obj-proxy": "^3.0.0",
|
|
46
|
-
"jest": "^29.0.0",
|
|
47
|
-
"jest-environment-jsdom": "^29.0.0",
|
|
48
|
-
"react": "^16.14.0",
|
|
49
|
-
"react-dom": "^16.14.0",
|
|
50
|
-
"redux-saga-test-plan": "^4.0.4",
|
|
51
|
-
"rimraf": "^3.0.2",
|
|
52
|
-
"semantic-ui-react": "^2.1.4"
|
|
53
|
-
},
|
|
54
22
|
"jest": {
|
|
55
23
|
"maxWorkers": "50%",
|
|
56
24
|
"testTimeout": 10000,
|
|
57
25
|
"moduleDirectories": [
|
|
58
|
-
"<rootDir>/src"
|
|
59
|
-
"../../node_modules"
|
|
60
|
-
],
|
|
61
|
-
"setupFilesAfterEnv": [
|
|
62
|
-
"@truedat/test/setup"
|
|
26
|
+
"<rootDir>/src"
|
|
63
27
|
],
|
|
64
28
|
"moduleNameMapper": {
|
|
65
29
|
"\\.(css|less|png)$": "identity-obj-proxy",
|
|
66
30
|
"^@truedat/([^/]+)$": "<rootDir>/../$1/src/index",
|
|
67
31
|
"^@truedat/([^/]+)/(.*)$": "<rootDir>/../$1/src/$2"
|
|
68
32
|
},
|
|
69
|
-
"
|
|
70
|
-
"
|
|
33
|
+
"setupFilesAfterEnv": [
|
|
34
|
+
"@truedat/test/setup"
|
|
71
35
|
],
|
|
72
36
|
"testEnvironment": "jsdom",
|
|
73
|
-
"testPathIgnorePatterns": [
|
|
74
|
-
"<rootDir>/node_modules/"
|
|
75
|
-
],
|
|
76
37
|
"transform": {
|
|
77
38
|
"\\.js$": [
|
|
78
39
|
"babel-jest",
|
|
@@ -80,28 +41,46 @@
|
|
|
80
41
|
"rootMode": "upward"
|
|
81
42
|
}
|
|
82
43
|
]
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@testing-library/dom": "^10.4.0",
|
|
48
|
+
"@testing-library/jest-dom": "^6.6.3",
|
|
49
|
+
"@testing-library/react": "^16.2.0",
|
|
50
|
+
"@testing-library/user-event": "^14.6.1",
|
|
51
|
+
"@truedat/test": "7.5.10",
|
|
52
|
+
"identity-obj-proxy": "^3.0.0",
|
|
53
|
+
"jest": "^29.7.0",
|
|
54
|
+
"redux-saga-test-plan": "^4.0.6"
|
|
87
55
|
},
|
|
88
56
|
"dependencies": {
|
|
89
|
-
"@
|
|
90
|
-
"
|
|
57
|
+
"@apollo/client": "^3.13.5",
|
|
58
|
+
"@truedat/core": "7.5.10",
|
|
59
|
+
"axios": "^1.8.4",
|
|
60
|
+
"graphql": "^16.10.0",
|
|
61
|
+
"is-hotkey": "^0.2.0",
|
|
62
|
+
"is-url": "^1.2.4",
|
|
63
|
+
"lodash": "^4.17.21",
|
|
64
|
+
"moment": "^2.30.1",
|
|
65
|
+
"path-to-regexp": "^8.2.0",
|
|
91
66
|
"prop-types": "^15.8.1",
|
|
92
|
-
"
|
|
93
|
-
"react
|
|
94
|
-
"react-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
67
|
+
"query-string": "^7.1.2",
|
|
68
|
+
"react": "^19.0.0",
|
|
69
|
+
"react-csv": "^2.2.2",
|
|
70
|
+
"react-dom": "^19.0.0",
|
|
71
|
+
"react-dropzone": "^14.3.8",
|
|
72
|
+
"react-hook-form": "^7.54.2",
|
|
73
|
+
"react-intl": "^7.1.10",
|
|
74
|
+
"react-moment": "^1.1.3",
|
|
75
|
+
"react-redux": "^9.2.0",
|
|
76
|
+
"react-router": "^7.4.0",
|
|
77
|
+
"redux": "^5.0.1",
|
|
78
|
+
"redux-saga": "^1.3.0",
|
|
97
79
|
"redux-saga-routines": "^3.2.3",
|
|
98
|
-
"reselect": "^
|
|
99
|
-
"semantic-ui-react": "^
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
"react": ">= 16.8.6 < 17",
|
|
103
|
-
"react-dom": ">= 16.8.6 < 17",
|
|
104
|
-
"semantic-ui-react": ">= 2.0.3 < 2.2"
|
|
80
|
+
"reselect": "^5.1.1",
|
|
81
|
+
"semantic-ui-calendar-react": "^0.15.3",
|
|
82
|
+
"semantic-ui-react": "^3.0.0-beta.2",
|
|
83
|
+
"swr": "^2.3.3"
|
|
105
84
|
},
|
|
106
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "8a8c49e9d5d6bb4e5f2b503b063bfd6dd20a503d"
|
|
107
86
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { join, truncate } from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { FormattedMessage } from "react-intl";
|
|
5
4
|
import { Card } from "semantic-ui-react";
|
|
6
|
-
import { Link } from "react-router
|
|
5
|
+
import { Link } from "react-router";
|
|
7
6
|
|
|
8
7
|
export const CardResult = ({ index, description, header, to, path }) => {
|
|
9
8
|
const headerConcept = (
|
|
@@ -22,7 +21,7 @@ export const CardResult = ({ index, description, header, to, path }) => {
|
|
|
22
21
|
className: "search result",
|
|
23
22
|
header: headerConcept,
|
|
24
23
|
meta: join(" > ")(path),
|
|
25
|
-
description: truncate({ length: 300 })(description)
|
|
24
|
+
description: truncate({ length: 300 })(description),
|
|
26
25
|
};
|
|
27
26
|
|
|
28
27
|
return <Card {...cardProps} />;
|
|
@@ -33,7 +32,7 @@ CardResult.propTypes = {
|
|
|
33
32
|
index: PropTypes.string,
|
|
34
33
|
description: PropTypes.string,
|
|
35
34
|
path: PropTypes.array,
|
|
36
|
-
to: PropTypes.string
|
|
35
|
+
to: PropTypes.string,
|
|
37
36
|
};
|
|
38
37
|
|
|
39
38
|
export default CardResult;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import React from "react";
|
|
2
1
|
import { FormattedMessage, useIntl } from "react-intl";
|
|
3
2
|
import {
|
|
4
3
|
Header,
|
|
@@ -33,9 +32,11 @@ export default function ElasticIndexes() {
|
|
|
33
32
|
</Header.Content>
|
|
34
33
|
</Header>
|
|
35
34
|
<Dimmer.Dimmable dimmed={loading}>
|
|
36
|
-
|
|
37
|
-
<
|
|
38
|
-
|
|
35
|
+
{loading ? (
|
|
36
|
+
<Dimmer active inverted>
|
|
37
|
+
<Loader />
|
|
38
|
+
</Dimmer>
|
|
39
|
+
) : null}
|
|
39
40
|
{indexes ? (
|
|
40
41
|
<Table>
|
|
41
42
|
<Table.Header>
|
package/src/components/Search.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { useIntl } from "react-intl";
|
|
5
4
|
import { connect } from "react-redux";
|
|
6
|
-
import { Link
|
|
5
|
+
import { Link } from "react-router";
|
|
6
|
+
import { useNavigate } from "react-router";
|
|
7
7
|
import { Image, Search } from "semantic-ui-react";
|
|
8
8
|
import { SEARCH_RESULTS } from "@truedat/core/routes";
|
|
9
9
|
import searchImage from "assets/searching.png";
|
|
@@ -12,7 +12,7 @@ import { fetchSearch } from "../routines";
|
|
|
12
12
|
|
|
13
13
|
const SearchHome = ({ fetchSearch, loading, results, searchHomeAddon }) => {
|
|
14
14
|
const { formatMessage } = useIntl();
|
|
15
|
-
const
|
|
15
|
+
const navigate = useNavigate();
|
|
16
16
|
|
|
17
17
|
const onSearchChange = (e, data) => {
|
|
18
18
|
e.preventDefault();
|
|
@@ -21,7 +21,7 @@ const SearchHome = ({ fetchSearch, loading, results, searchHomeAddon }) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
const onKeyPress = ({ key }) => {
|
|
24
|
-
if (key == "Enter")
|
|
24
|
+
if (key == "Enter") navigate(SEARCH_RESULTS);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const props = {
|
|
@@ -1,44 +1,24 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import { compose } from "redux";
|
|
5
|
-
import { connect } from "react-redux";
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useLocation, useMatch } from "react-router";
|
|
3
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
6
4
|
import { Loading } from "@truedat/core/components";
|
|
7
5
|
import { clearSearch, fetchSearch, updateSearchPath } from "../routines";
|
|
8
6
|
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
searchLoading: PropTypes.bool,
|
|
15
|
-
};
|
|
7
|
+
export default function SearchLoader() {
|
|
8
|
+
const dispatch = useDispatch();
|
|
9
|
+
const searchLoading = useSelector((state) => state.searchLoading);
|
|
10
|
+
const location = useLocation();
|
|
11
|
+
const match = useMatch(location.pathname);
|
|
16
12
|
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
match: { path },
|
|
22
|
-
} = this.props;
|
|
23
|
-
updateSearchPath({ path });
|
|
24
|
-
fetchSearch({});
|
|
25
|
-
}
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
const path = match?.pathname || location.pathname;
|
|
15
|
+
dispatch(updateSearchPath({ path }));
|
|
16
|
+
dispatch(fetchSearch({}));
|
|
26
17
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}
|
|
18
|
+
return () => {
|
|
19
|
+
dispatch(clearSearch());
|
|
20
|
+
};
|
|
21
|
+
}, [dispatch, match, location.pathname]);
|
|
31
22
|
|
|
32
|
-
|
|
33
|
-
const { searchLoading } = this.props;
|
|
34
|
-
if (searchLoading) return <Loading />;
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
23
|
+
return searchLoading ? <Loading /> : null;
|
|
37
24
|
}
|
|
38
|
-
|
|
39
|
-
const mapStateToProps = ({ searchLoading }) => ({ searchLoading });
|
|
40
|
-
|
|
41
|
-
export default compose(
|
|
42
|
-
withRouter,
|
|
43
|
-
connect(mapStateToProps, { fetchSearch, clearSearch, updateSearchPath })
|
|
44
|
-
)(SearchLoader);
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { FormattedMessage } from "react-intl";
|
|
5
4
|
import { connect } from "react-redux";
|
|
6
|
-
import { Link } from "react-router
|
|
5
|
+
import { Link } from "react-router";
|
|
7
6
|
import { Message, Icon, Label } from "semantic-ui-react";
|
|
8
7
|
import { SEARCH } from "@truedat/core/routes";
|
|
9
8
|
import { searchResultsSelector } from "../selectors";
|
|
@@ -40,13 +39,13 @@ export const SearchResults = ({ loading, results, searchCount }) => {
|
|
|
40
39
|
SearchResults.propTypes = {
|
|
41
40
|
loading: PropTypes.bool,
|
|
42
41
|
results: PropTypes.array,
|
|
43
|
-
searchCount: PropTypes.number
|
|
42
|
+
searchCount: PropTypes.number,
|
|
44
43
|
};
|
|
45
44
|
|
|
46
|
-
const mapStateToProps = state => ({
|
|
45
|
+
const mapStateToProps = (state) => ({
|
|
47
46
|
results: searchResultsSelector(state),
|
|
48
47
|
loading: state.searchLoading,
|
|
49
|
-
searchCount: state.searchCount
|
|
48
|
+
searchCount: state.searchCount,
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
export default connect(mapStateToProps)(SearchResults);
|
|
@@ -1,77 +1,31 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
SEARCH,
|
|
5
|
-
SEARCH_CONCEPTS,
|
|
6
|
-
SEARCH_INGESTS,
|
|
7
|
-
SEARCH_RESULTS,
|
|
8
|
-
SEARCH_STRUCTURES,
|
|
9
|
-
ELASTICINDEXES,
|
|
10
|
-
} from "@truedat/core/routes";
|
|
11
|
-
import { Unauthorized } from "@truedat/core/components";
|
|
12
|
-
import { useAuthorized } from "@truedat/core/hooks";
|
|
1
|
+
import { Route, Routes } from "react-router";
|
|
2
|
+
import { ProtectedRoute, Loader } from "@truedat/core/router";
|
|
3
|
+
// import { path } from "@truedat/core/routesTree";
|
|
13
4
|
import SearchLoader from "./SearchLoader";
|
|
14
5
|
import SearchHome from "./SearchHome";
|
|
15
6
|
import Search from "./Search";
|
|
16
7
|
import ElasticIndexes from "./ElasticIndexes";
|
|
17
8
|
|
|
18
9
|
export const SearchRoutes = () => {
|
|
19
|
-
const authorized = useAuthorized();
|
|
20
10
|
return (
|
|
21
|
-
<
|
|
22
|
-
path={
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
exact
|
|
40
|
-
render={() => (
|
|
41
|
-
<>
|
|
42
|
-
<SearchLoader />
|
|
43
|
-
<Search />
|
|
44
|
-
</>
|
|
45
|
-
)}
|
|
46
|
-
/>
|
|
47
|
-
<Route
|
|
48
|
-
path={SEARCH_INGESTS}
|
|
49
|
-
exact
|
|
50
|
-
render={() => (
|
|
51
|
-
<>
|
|
52
|
-
<SearchLoader />
|
|
53
|
-
<Search />
|
|
54
|
-
</>
|
|
55
|
-
)}
|
|
56
|
-
/>
|
|
57
|
-
<Route
|
|
58
|
-
path={SEARCH_STRUCTURES}
|
|
59
|
-
exact
|
|
60
|
-
render={() => (
|
|
61
|
-
<>
|
|
62
|
-
<SearchLoader />
|
|
63
|
-
<Search />
|
|
64
|
-
</>
|
|
65
|
-
)}
|
|
66
|
-
/>
|
|
67
|
-
<Route
|
|
68
|
-
path={ELASTICINDEXES}
|
|
69
|
-
exact
|
|
70
|
-
render={() => (authorized ? <ElasticIndexes /> : <Unauthorized />)}
|
|
71
|
-
/>
|
|
72
|
-
</>
|
|
73
|
-
)}
|
|
74
|
-
/>
|
|
11
|
+
<Routes>
|
|
12
|
+
<Route path={"search"} element={<Loader loaders={<SearchLoader />} />}>
|
|
13
|
+
<Route index element={<SearchHome />} />
|
|
14
|
+
<Route path={"results"} element={<Search />} />
|
|
15
|
+
<Route path={"concepts"} element={<Search />} />
|
|
16
|
+
<Route path={"ingests"} element={<Search />} />
|
|
17
|
+
<Route path={"structures"} element={<Search />} />
|
|
18
|
+
<Route
|
|
19
|
+
path={"elasticIndexes"}
|
|
20
|
+
element={
|
|
21
|
+
<ProtectedRoute>
|
|
22
|
+
<ElasticIndexes />
|
|
23
|
+
</ProtectedRoute>
|
|
24
|
+
}
|
|
25
|
+
/>
|
|
26
|
+
</Route>
|
|
27
|
+
<Route path="*" element={null} />
|
|
28
|
+
</Routes>
|
|
75
29
|
);
|
|
76
30
|
};
|
|
77
31
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import _ from "lodash/fp";
|
|
2
|
-
import React from "react";
|
|
3
2
|
import PropTypes from "prop-types";
|
|
4
3
|
import { connect } from "react-redux";
|
|
5
4
|
import { FormattedMessage } from "react-intl";
|
|
6
|
-
import { Link } from "react-router
|
|
5
|
+
import { Link } from "react-router";
|
|
7
6
|
import { Menu } from "semantic-ui-react";
|
|
8
7
|
import { useActiveRoute } from "@truedat/core/hooks";
|
|
9
8
|
import { useAuthorized } from "@truedat/core/hooks";
|
|
@@ -11,7 +10,7 @@ import {
|
|
|
11
10
|
SEARCH_CONCEPTS,
|
|
12
11
|
SEARCH_INGESTS,
|
|
13
12
|
SEARCH_RESULTS,
|
|
14
|
-
SEARCH_STRUCTURES
|
|
13
|
+
SEARCH_STRUCTURES,
|
|
15
14
|
} from "@truedat/core/routes";
|
|
16
15
|
import { searchIndicesSelector } from "../selectors/searchIndicesSelector";
|
|
17
16
|
|
|
@@ -19,7 +18,7 @@ const relations = {
|
|
|
19
18
|
all: ["all"],
|
|
20
19
|
concepts: ["business_glossary_view"],
|
|
21
20
|
structures: ["data_dictionary"],
|
|
22
|
-
ingests: ["ingests"]
|
|
21
|
+
ingests: ["ingests"],
|
|
23
22
|
};
|
|
24
23
|
|
|
25
24
|
export const SearchTab = ({ route, name }) => {
|
|
@@ -40,7 +39,7 @@ export const SearchTab = ({ route, name }) => {
|
|
|
40
39
|
|
|
41
40
|
SearchTab.propTypes = {
|
|
42
41
|
route: PropTypes.string,
|
|
43
|
-
name: PropTypes.string
|
|
42
|
+
name: PropTypes.string,
|
|
44
43
|
};
|
|
45
44
|
|
|
46
45
|
export const SearchTabs = ({ indices }) => {
|
|
@@ -61,11 +60,11 @@ export const SearchTabs = ({ indices }) => {
|
|
|
61
60
|
};
|
|
62
61
|
|
|
63
62
|
SearchTabs.propTypes = {
|
|
64
|
-
indices: PropTypes.array
|
|
63
|
+
indices: PropTypes.array,
|
|
65
64
|
};
|
|
66
65
|
|
|
67
|
-
export const mapStateToProps = state => ({
|
|
68
|
-
indices: searchIndicesSelector(state)
|
|
66
|
+
export const mapStateToProps = (state) => ({
|
|
67
|
+
indices: searchIndicesSelector(state),
|
|
69
68
|
});
|
|
70
69
|
|
|
71
70
|
export default connect(mapStateToProps)(SearchTabs);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { shallowWithIntl } from "@truedat/test/intl-stub";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import { CardResult } from "../CardResult";
|
|
4
3
|
|
|
5
4
|
describe("<CardResult />", () => {
|
|
@@ -10,17 +9,18 @@ describe("<CardResult />", () => {
|
|
|
10
9
|
const to = "/foo";
|
|
11
10
|
const path = ["levelOne", "levelTwo", "levelThree"];
|
|
12
11
|
|
|
13
|
-
it("it matches the last snapshot", () => {
|
|
12
|
+
it("it matches the last snapshot", async () => {
|
|
14
13
|
const props = {
|
|
15
14
|
index,
|
|
16
15
|
description,
|
|
17
16
|
header,
|
|
18
17
|
resource_id,
|
|
19
18
|
to,
|
|
20
|
-
path
|
|
19
|
+
path,
|
|
21
20
|
};
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
expect(
|
|
21
|
+
const rendered = render(<CardResult {...props} />);
|
|
22
|
+
await waitForLoad(rendered);
|
|
23
|
+
expect(rendered.container).toMatchSnapshot();
|
|
24
|
+
expect(rendered.container.querySelector(".card")).toBeInTheDocument();
|
|
25
25
|
});
|
|
26
26
|
});
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
3
1
|
import userEvent from "@testing-library/user-event";
|
|
2
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
4
3
|
import { useElasticIndexDelete } from "@truedat/se/hooks/useElasticIndexes";
|
|
5
4
|
import DeleteIndexButton from "../DeleteIndexButton";
|
|
6
|
-
import en from "../../messages/en";
|
|
7
5
|
|
|
8
6
|
jest.mock("@truedat/se/hooks/useElasticIndexes", () => {
|
|
9
7
|
const originalModule = jest.requireActual(
|
|
@@ -20,53 +18,40 @@ jest.mock("@truedat/se/hooks/useElasticIndexes", () => {
|
|
|
20
18
|
};
|
|
21
19
|
});
|
|
22
20
|
|
|
23
|
-
const renderOpts = {
|
|
24
|
-
messages: {
|
|
25
|
-
en: {
|
|
26
|
-
...en,
|
|
27
|
-
"confirmation.yes": "yes",
|
|
28
|
-
"confirmation.no": "no",
|
|
29
|
-
"elastic_index.delete": "elastic_index.delete",
|
|
30
|
-
"elastic_index.delete.confirmation.header":
|
|
31
|
-
"elastic_index.delete.confirmation.header",
|
|
32
|
-
"elastic_index.delete.confirmation.content":
|
|
33
|
-
"elastic_index.delete.confirmation.content",
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
|
|
38
21
|
describe("<DeleteIndexButton />", () => {
|
|
39
22
|
const indexName = "test_index";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
);
|
|
45
|
-
expect(container).toMatchSnapshot();
|
|
23
|
+
|
|
24
|
+
it("matches the last snapshot", async () => {
|
|
25
|
+
const rendered = render(<DeleteIndexButton indexName={indexName} />);
|
|
26
|
+
await waitForLoad(rendered);
|
|
27
|
+
expect(rendered.container).toMatchSnapshot();
|
|
46
28
|
});
|
|
47
29
|
|
|
48
|
-
it("triggers useElasticIndexDelete hook on confirm", () => {
|
|
49
|
-
const {
|
|
50
|
-
|
|
51
|
-
|
|
30
|
+
it("triggers useElasticIndexDelete hook on confirm", async () => {
|
|
31
|
+
const user = userEvent.setup({ delay: null });
|
|
32
|
+
const rendered = render(<DeleteIndexButton indexName={indexName} />);
|
|
33
|
+
await waitForLoad(rendered);
|
|
34
|
+
|
|
35
|
+
await user.click(rendered.getByRole("button", { name: /delete/i }));
|
|
36
|
+
await user.click(
|
|
37
|
+
rendered.getByRole("button", { name: "modal-affirmative-action" })
|
|
52
38
|
);
|
|
53
|
-
userEvent.click(getByRole("button", { name: /delete/i }));
|
|
54
|
-
userEvent.click(getByRole("button", { name: "modal-affirmative-action" }));
|
|
55
39
|
|
|
56
40
|
expect(useElasticIndexDelete).toHaveBeenCalledWith(indexName);
|
|
57
41
|
const { trigger } = useElasticIndexDelete();
|
|
58
|
-
|
|
59
42
|
expect(trigger).toHaveBeenCalled();
|
|
60
43
|
});
|
|
61
44
|
|
|
62
|
-
it("do not triggers useElasticIndexDelete hook on cancel", () => {
|
|
45
|
+
it("do not triggers useElasticIndexDelete hook on cancel", async () => {
|
|
63
46
|
jest.clearAllMocks();
|
|
64
|
-
const {
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
const user = userEvent.setup({ delay: null });
|
|
48
|
+
const rendered = render(<DeleteIndexButton indexName={indexName} />);
|
|
49
|
+
await waitForLoad(rendered);
|
|
50
|
+
|
|
51
|
+
await user.click(rendered.getByRole("button", { name: /delete/i }));
|
|
52
|
+
await user.click(
|
|
53
|
+
rendered.getByRole("button", { name: "modal-negative-action" })
|
|
67
54
|
);
|
|
68
|
-
userEvent.click(getByRole("button", { name: /delete/i }));
|
|
69
|
-
userEvent.click(getByRole("button", { name: "modal-negative-action" }));
|
|
70
55
|
|
|
71
56
|
expect(useElasticIndexDelete).toHaveBeenCalledWith(indexName);
|
|
72
57
|
const { trigger } = useElasticIndexDelete();
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { render } from "@truedat/test/render";
|
|
1
|
+
import { render, waitForLoad } from "@truedat/test/render";
|
|
3
2
|
import ElasticIndexes from "../ElasticIndexes";
|
|
4
|
-
import en from "../../messages/en";
|
|
5
3
|
|
|
6
4
|
jest.mock("@truedat/se/hooks/useElasticIndexes", () => {
|
|
7
5
|
const originalModule = jest.requireActual(
|
|
@@ -19,29 +17,10 @@ jest.mock("@truedat/se/hooks/useElasticIndexes", () => {
|
|
|
19
17
|
};
|
|
20
18
|
});
|
|
21
19
|
|
|
22
|
-
const renderOpts = {
|
|
23
|
-
messages: {
|
|
24
|
-
en: {
|
|
25
|
-
...en,
|
|
26
|
-
"elastic_index.action": "elastic_index.action",
|
|
27
|
-
"elastic_index.documents": "elastic_index.documents",
|
|
28
|
-
"elastic_index.size": "elastic_index.size",
|
|
29
|
-
"elastic_index.alias": "elastic_index.alias",
|
|
30
|
-
"elastic_index.key": "elastic_index.key",
|
|
31
|
-
"elastic_index.delete": "elastic_index.delete",
|
|
32
|
-
"elastic_index.header": "elastic_index.header",
|
|
33
|
-
"elastic_index.subheader": "elastic_index.subheader",
|
|
34
|
-
"elastic_index.delete.confirmation.header":
|
|
35
|
-
"elastic_index.delete.confirmation.header",
|
|
36
|
-
"elastic_index.delete.confirmation.content":
|
|
37
|
-
"elastic_index.delete.confirmation.content",
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
};
|
|
41
|
-
|
|
42
20
|
describe("<ElasticIndexes />", () => {
|
|
43
|
-
it("matches the
|
|
44
|
-
const
|
|
45
|
-
|
|
21
|
+
it("matches the latest snapshot", async () => {
|
|
22
|
+
const rendered = render(<ElasticIndexes />);
|
|
23
|
+
await waitForLoad(rendered);
|
|
24
|
+
expect(rendered.container).toMatchSnapshot();
|
|
46
25
|
});
|
|
47
26
|
});
|