@truedat/cx 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.
Files changed (110) hide show
  1. package/package.json +40 -70
  2. package/src/configurations/components/Configuration.js +3 -3
  3. package/src/configurations/components/ConfigurationActions.js +1 -2
  4. package/src/configurations/components/ConfigurationBreadcrumbs.js +2 -3
  5. package/src/configurations/components/ConfigurationCards.js +1 -2
  6. package/src/configurations/components/ConfigurationForm.js +6 -11
  7. package/src/configurations/components/ConfigurationLoader.js +1 -2
  8. package/src/configurations/components/ConfigurationRoutes.js +61 -72
  9. package/src/configurations/components/ConfigurationTokenLoader.js +0 -1
  10. package/src/configurations/components/Configurations.js +2 -2
  11. package/src/configurations/components/ConfigurationsLoader.js +0 -1
  12. package/src/configurations/components/DynamicConfigurationForm.js +5 -7
  13. package/src/configurations/components/EditConfiguration.js +0 -1
  14. package/src/configurations/components/NewConfiguration.js +0 -1
  15. package/src/configurations/components/__tests__/Configuration.spec.js +17 -10
  16. package/src/configurations/components/__tests__/ConfigurationCards.spec.js +22 -13
  17. package/src/configurations/components/__tests__/ConfigurationForm.spec.js +5 -5
  18. package/src/configurations/components/__tests__/ConfigurationLoader.spec.js +44 -36
  19. package/src/configurations/components/__tests__/ConfigurationTokenLoader.spec.js +46 -45
  20. package/src/configurations/components/__tests__/Configurations.spec.js +20 -22
  21. package/src/configurations/components/__tests__/ConfigurationsLoader.spec.js +32 -33
  22. package/src/configurations/components/__tests__/EditConfiguration.spec.js +5 -5
  23. package/src/configurations/components/__tests__/NewConfiguration.spec.js +0 -1
  24. package/src/configurations/components/__tests__/__snapshots__/Configuration.spec.js.snap +122 -57
  25. package/src/configurations/components/__tests__/__snapshots__/ConfigurationCards.spec.js.snap +160 -361
  26. package/src/configurations/components/__tests__/__snapshots__/ConfigurationForm.spec.js.snap +7 -6
  27. package/src/configurations/components/__tests__/__snapshots__/ConfigurationLoader.spec.js.snap +5 -31
  28. package/src/configurations/components/__tests__/__snapshots__/ConfigurationTokenLoader.spec.js.snap +5 -9
  29. package/src/configurations/components/__tests__/__snapshots__/Configurations.spec.js.snap +91 -72
  30. package/src/configurations/components/__tests__/__snapshots__/ConfigurationsLoader.spec.js.snap +5 -27
  31. package/src/configurations/components/__tests__/__snapshots__/EditConfiguration.spec.js.snap +12 -10
  32. package/src/configurations/components/__tests__/__snapshots__/NewConfiguration.spec.js.snap +11 -9
  33. package/src/configurations/components/index.js +1 -1
  34. package/src/configurations/reducers/configurationRedirect.js +1 -1
  35. package/src/configurations/reducers/configurations.js +1 -1
  36. package/src/configurations/reducers/index.js +1 -1
  37. package/src/configurations/reducers/systemConfigurations.js +1 -1
  38. package/src/configurations/sagas/signConfiguration.js +3 -1
  39. package/src/jobs/components/Job.js +0 -1
  40. package/src/jobs/components/JobBreadcrumbs.js +2 -3
  41. package/src/jobs/components/JobLoader.js +2 -2
  42. package/src/jobs/components/JobRoutes.js +28 -40
  43. package/src/jobs/components/JobRow.js +4 -4
  44. package/src/jobs/components/Jobs.js +5 -4
  45. package/src/jobs/components/JobsLabelResults.js +2 -3
  46. package/src/jobs/components/JobsSearch.js +0 -1
  47. package/src/jobs/components/JobsTable.js +3 -3
  48. package/src/jobs/components/JobsView.js +0 -1
  49. package/src/jobs/components/SourceJobs.js +0 -1
  50. package/src/jobs/components/__tests__/Job.spec.js +9 -11
  51. package/src/jobs/components/__tests__/JobBreadcrumbs.spec.js +5 -5
  52. package/src/jobs/components/__tests__/JobLoader.spec.js +12 -12
  53. package/src/jobs/components/__tests__/JobRow.spec.js +21 -20
  54. package/src/jobs/components/__tests__/Jobs.spec.js +1 -7
  55. package/src/jobs/components/__tests__/JobsLoader.spec.js +9 -9
  56. package/src/jobs/components/__tests__/JobsTable.spec.js +33 -28
  57. package/src/jobs/components/__tests__/JobsView.spec.js +1 -7
  58. package/src/jobs/components/__tests__/SourceJobs.spec.js +1 -7
  59. package/src/jobs/components/__tests__/__snapshots__/Job.spec.js.snap +143 -36
  60. package/src/jobs/components/__tests__/__snapshots__/JobBreadcrumbs.spec.js.snap +20 -30
  61. package/src/jobs/components/__tests__/__snapshots__/Jobs.spec.js.snap +10 -23
  62. package/src/jobs/components/__tests__/__snapshots__/JobsTable.spec.js.snap +7 -7
  63. package/src/jobs/components/__tests__/__snapshots__/JobsView.spec.js.snap +12 -24
  64. package/src/jobs/components/__tests__/__snapshots__/SourceJobs.spec.js.snap +8 -21
  65. package/src/jobs/reducers/jobActiveFilters.js +1 -1
  66. package/src/jobs/sagas/fetchJob.js +1 -1
  67. package/src/jobs/selectors/jobColumnsSelector.js +0 -1
  68. package/src/jobs/selectors/sourceJobColumnsSelector.js +0 -1
  69. package/src/sources/components/EditSource.js +0 -1
  70. package/src/sources/components/JobForm.js +1 -1
  71. package/src/sources/components/NewJob.js +0 -1
  72. package/src/sources/components/NewSource.js +0 -1
  73. package/src/sources/components/Source.js +0 -1
  74. package/src/sources/components/SourceActions.js +1 -2
  75. package/src/sources/components/SourceBreadcrumbs.js +1 -2
  76. package/src/sources/components/SourceConfiguration.js +3 -3
  77. package/src/sources/components/SourceDetail.js +46 -50
  78. package/src/sources/components/SourceForm.js +4 -7
  79. package/src/sources/components/SourceHeader.js +0 -1
  80. package/src/sources/components/SourceRoutes.js +30 -23
  81. package/src/sources/components/SourceSelector.js +0 -1
  82. package/src/sources/components/SourceTabs.js +14 -7
  83. package/src/sources/components/Sources.js +2 -2
  84. package/src/sources/components/SourcesTable.js +1 -2
  85. package/src/sources/components/__tests__/EditSource.spec.js +10 -12
  86. package/src/sources/components/__tests__/NewSource.spec.js +5 -10
  87. package/src/sources/components/__tests__/Source.spec.js +19 -27
  88. package/src/sources/components/__tests__/SourceActions.spec.js +1 -2
  89. package/src/sources/components/__tests__/SourceBreadcrumbs.spec.js +0 -1
  90. package/src/sources/components/__tests__/SourceDetail.spec.js +62 -38
  91. package/src/sources/components/__tests__/SourceForm.spec.js +109 -86
  92. package/src/sources/components/__tests__/SourceHeader.spec.js +1 -2
  93. package/src/sources/components/__tests__/SourceRoutes.spec.js +79 -7
  94. package/src/sources/components/__tests__/SourceSelector.spec.js +0 -1
  95. package/src/sources/components/__tests__/SourceTabs.spec.js +3 -4
  96. package/src/sources/components/__tests__/Sources.spec.js +24 -39
  97. package/src/sources/components/__tests__/SourcesTable.spec.js +48 -65
  98. package/src/sources/components/__tests__/__snapshots__/EditSource.spec.js.snap +134 -15
  99. package/src/sources/components/__tests__/__snapshots__/NewSource.spec.js.snap +36 -23
  100. package/src/sources/components/__tests__/__snapshots__/Source.spec.js.snap +28 -31
  101. package/src/sources/components/__tests__/__snapshots__/SourceActions.spec.js.snap +1 -1
  102. package/src/sources/components/__tests__/__snapshots__/SourceBreadcrumbs.spec.js.snap +2 -1
  103. package/src/sources/components/__tests__/__snapshots__/SourceDetail.spec.js.snap +13 -172
  104. package/src/sources/components/__tests__/__snapshots__/SourceForm.spec.js.snap +132 -106
  105. package/src/sources/components/__tests__/__snapshots__/SourceHeader.spec.js.snap +4 -4
  106. package/src/sources/components/__tests__/__snapshots__/SourceRoutes.spec.js.snap +47 -5
  107. package/src/sources/components/__tests__/__snapshots__/SourceTabs.spec.js.snap +5 -3
  108. package/src/sources/components/__tests__/__snapshots__/Sources.spec.js.snap +14 -11
  109. package/src/sources/components/__tests__/__snapshots__/SourcesTable.spec.js.snap +17 -12
  110. package/src/jobs/components/ConfigurationRoutes.js +0 -31
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@truedat/cx",
3
- "version": "7.5.9",
3
+ "version": "7.5.10",
4
4
  "description": "Truedat Web Connectors",
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,68 +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
- "jest-localstorage-mock": "^2.4.14",
49
- "react": "^16.14.0",
50
- "react-dom": "^16.14.0",
51
- "redux-saga-test-plan": "^4.0.4",
52
- "rimraf": "^3.0.2",
53
- "semantic-ui-react": "^2.1.4"
54
- },
55
22
  "jest": {
56
23
  "maxWorkers": "50%",
57
24
  "testTimeout": 10000,
58
25
  "moduleDirectories": [
59
- "<rootDir>/src",
60
- "../../node_modules"
26
+ "<rootDir>/src"
61
27
  ],
62
28
  "moduleNameMapper": {
63
29
  "\\.(css|less|png)$": "identity-obj-proxy",
64
30
  "^@truedat/([^/]+)$": "<rootDir>/../$1/src/index",
65
31
  "^@truedat/([^/]+)/(.*)$": "<rootDir>/../$1/src/$2"
66
32
  },
67
- "setupFiles": [
68
- "jest-localstorage-mock"
69
- ],
70
33
  "setupFilesAfterEnv": [
71
34
  "@truedat/test/setup"
72
35
  ],
73
- "snapshotSerializers": [
74
- "enzyme-to-json/serializer"
75
- ],
76
36
  "testEnvironment": "jsdom",
77
- "testPathIgnorePatterns": [
78
- "<rootDir>/node_modules/"
79
- ],
80
37
  "transform": {
81
38
  "\\.js$": [
82
39
  "babel-jest",
@@ -84,33 +41,46 @@
84
41
  "rootMode": "upward"
85
42
  }
86
43
  ]
87
- },
88
- "transformIgnorePatterns": [
89
- "/node_modules/(?!@truedat).*"
90
- ]
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"
91
55
  },
92
56
  "dependencies": {
93
- "@apollo/client": "^3.7.1",
94
- "@truedat/core": "7.5.9",
57
+ "@apollo/client": "^3.13.5",
58
+ "axios": "^1.8.4",
59
+ "graphql": "^16.10.0",
60
+ "is-hotkey": "^0.2.0",
61
+ "is-url": "^1.2.4",
95
62
  "lodash": "^4.17.21",
96
- "match-sorter": "^6.3.1",
97
- "moment": "^2.29.4",
98
- "path-to-regexp": "^1.7.0",
63
+ "match-sorter": "^8.0.0",
64
+ "moment": "^2.30.1",
65
+ "path-to-regexp": "^8.2.0",
99
66
  "prop-types": "^15.8.1",
100
- "react-intl": "^5.20.10",
101
- "react-moment": "^1.1.2",
102
- "react-redux": "^7.2.4",
103
- "react-router-dom": "^5.2.0",
104
- "redux": "^4.1.1",
105
- "redux-saga": "^1.2.1",
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",
106
79
  "redux-saga-routines": "^3.2.3",
107
- "reselect": "^4.1.7",
108
- "semantic-ui-react": "^2.1.4"
109
- },
110
- "peerDependencies": {
111
- "react": ">= 16.8.6 < 17",
112
- "react-dom": ">= 16.8.6 < 17",
113
- "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"
114
84
  },
115
- "gitHead": "03770e3241daa955de2e6e40fdaea91e3d147860"
85
+ "gitHead": "8a8c49e9d5d6bb4e5f2b503b063bfd6dd20a503d"
116
86
  }
@@ -1,13 +1,13 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
2
+ import { lazy } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { Header, Icon, Grid, Segment } from "semantic-ui-react";
5
5
  import { connect } from "react-redux";
6
6
  import ConfigurationActions from "./ConfigurationActions";
7
7
  import ConfigurationBreadcrumbs from "./ConfigurationBreadcrumbs";
8
8
 
9
- const DynamicFormViewer = React.lazy(() =>
10
- import("@truedat/df/components/DynamicFormViewer")
9
+ const DynamicFormViewer = lazy(
10
+ () => import("@truedat/df/components/DynamicFormViewer")
11
11
  );
12
12
 
13
13
  export const Configuration = ({ configuration, template }) =>
@@ -1,6 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
- import { Link } from "react-router-dom";
2
+ import { Link } from "react-router";
4
3
  import { connect } from "react-redux";
5
4
  import PropTypes from "prop-types";
6
5
  import { Button, Icon } from "semantic-ui-react";
@@ -1,7 +1,6 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { Breadcrumb } from "semantic-ui-react";
4
- import { Link } from "react-router-dom";
3
+ import { Link } from "react-router";
5
4
  import { FormattedMessage } from "react-intl";
6
5
  import { CONFIGURATIONS } from "@truedat/core/routes";
7
6
 
@@ -16,7 +15,7 @@ export const ConfigurationBreadcrumbs = ({ text }) => (
16
15
  );
17
16
 
18
17
  ConfigurationBreadcrumbs.propTypes = {
19
- text: PropTypes.string
18
+ text: PropTypes.string,
20
19
  };
21
20
 
22
21
  export default ConfigurationBreadcrumbs;
@@ -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 { Button, Card, Icon, Message } from "semantic-ui-react";
6
- import { Link } from "react-router-dom";
5
+ import { Link } from "react-router";
7
6
  import { FormattedMessage } from "react-intl";
8
7
  import { ConfirmModal } from "@truedat/core/components";
9
8
  import { linkTo } from "@truedat/core/routes";
@@ -1,5 +1,5 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState, useEffect, Suspense } from "react";
2
+ import { lazy, useState, useEffect, Suspense } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Button, Form, Label } from "semantic-ui-react";
@@ -11,12 +11,10 @@ import {
11
11
  } from "@truedat/df/utils";
12
12
  import { selectTemplate } from "@truedat/df/routines";
13
13
 
14
- const DynamicForm = React.lazy(() =>
15
- import("@truedat/df/components/DynamicForm")
16
- );
14
+ const DynamicForm = lazy(() => import("@truedat/df/components/DynamicForm"));
17
15
 
18
- const TemplateLoader = React.lazy(() =>
19
- import("@truedat/df/templates/components/TemplateLoader")
16
+ const TemplateLoader = lazy(
17
+ () => import("@truedat/df/templates/components/TemplateLoader")
20
18
  );
21
19
 
22
20
  const isEmptyArray = _.isEmpty;
@@ -138,16 +136,13 @@ const ConfigurationForm = ({
138
136
  disabled={!_.isEmpty(configuration)}
139
137
  />
140
138
  </Form.Field>
141
-
142
139
  {type && !templatesLoading && (
143
140
  <Form.Field>
144
141
  <label className="label">
145
142
  <FormattedMessage id="configuration.content.label" />
146
143
  </label>
147
- <Suspense fallback={null}>
148
- <TemplateLoader />
149
- <DynamicForm onChange={handleContentChange} content={content} />
150
- </Suspense>
144
+ <TemplateLoader />
145
+ <DynamicForm onChange={handleContentChange} content={content} />
151
146
  </Form.Field>
152
147
  )}
153
148
  <div className="actions">
@@ -1,6 +1,5 @@
1
- import React from "react";
2
1
  import { useEffect } from "react";
3
- import { useParams } from "react-router-dom";
2
+ import { useParams } from "react-router";
4
3
  import PropTypes from "prop-types";
5
4
  import { connect } from "react-redux";
6
5
  import { Loading } from "@truedat/core/components";
@@ -3,15 +3,14 @@ import React from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { Segment } from "semantic-ui-react";
6
- import { Route, Switch } from "react-router-dom";
7
- import { Unauthorized } from "@truedat/core/components";
8
- import { useAuthorized } from "@truedat/core/hooks";
6
+ import { Route, Routes } from "react-router";
9
7
  import {
10
8
  CONFIGURATION,
11
9
  CONFIGURATIONS,
12
10
  CONFIGURATION_CREATE,
13
- CONFIGURATION_EDIT
11
+ CONFIGURATION_EDIT,
14
12
  } from "@truedat/core/routes";
13
+ import { ProtectedRoute, Loader } from "@truedat/core/router";
15
14
  import NewConfiguration from "./NewConfiguration";
16
15
  import EditConfiguration from "./EditConfiguration";
17
16
  import Configurations from "./Configurations";
@@ -19,99 +18,89 @@ import ConfigurationsLoader from "./ConfigurationsLoader";
19
18
  import ConfigurationLoader from "./ConfigurationLoader";
20
19
  import Configuration from "./Configuration";
21
20
 
22
- const TemplateLoader = React.lazy(() =>
23
- import("@truedat/df/templates/components/TemplateLoader")
21
+ const TemplateLoader = React.lazy(
22
+ () => import("@truedat/df/templates/components/TemplateLoader")
24
23
  );
25
- const TemplatesLoader = React.lazy(() =>
26
- import("@truedat/df/templates/components/TemplatesLoader")
24
+ const TemplatesLoader = React.lazy(
25
+ () => import("@truedat/core/components/TemplatesLoader")
27
26
  );
28
27
 
29
28
  export const ConfigurationRoutes = ({
30
29
  configuration,
31
30
  configurationLoading,
32
- templatesLoading
31
+ templatesLoading,
33
32
  }) => {
34
- const authorized = useAuthorized();
35
33
  return (
36
- <>
37
- <ConfigurationsLoader />
34
+ <Routes>
38
35
  <Route
39
36
  path={CONFIGURATIONS}
40
- render={() =>
41
- authorized ? (
42
- <Switch>
43
- <Route
44
- exact
45
- path={CONFIGURATION_CREATE}
46
- render={() => (
47
- <>
48
- <TemplatesLoader scope="ca" />
49
- <TemplateLoader />
50
- <NewConfiguration />
51
- </>
52
- )}
53
- />
54
-
55
- <Route
56
- exact
57
- path={CONFIGURATION_EDIT}
58
- render={() => (
59
- <>
60
- <TemplatesLoader scope="ca" />
61
- <ConfigurationLoader />
62
- {!_.isEmpty(configuration) &&
63
- !configurationLoading &&
64
- !templatesLoading && <EditConfiguration />}
65
- </>
66
- )}
67
- />
68
- <Route
69
- exact
70
- path={CONFIGURATION}
71
- render={() => (
72
- <>
73
- <Segment>
74
- <ConfigurationLoader />
75
- <TemplatesLoader scope="ca" />
76
- {!templatesLoading && <Configuration />}
77
- </Segment>
78
- </>
79
- )}
80
- />
81
- <Route
82
- exact
83
- path={CONFIGURATIONS}
84
- render={() => (
85
- <>
86
- <ConfigurationsLoader />
87
- <Configurations />
88
- </>
89
- )}
90
- />
91
- </Switch>
92
- ) : (
93
- <Unauthorized />
94
- )
37
+ element={
38
+ <ProtectedRoute>
39
+ <Loader loaders={<ConfigurationsLoader />} />
40
+ </ProtectedRoute>
95
41
  }
96
- />
97
- </>
42
+ >
43
+ <Route index element={<Configurations />} />
44
+ <Route
45
+ path="new"
46
+ element={
47
+ <>
48
+ <TemplatesLoader scope="ca" />
49
+ <TemplateLoader />
50
+ <NewConfiguration />
51
+ </>
52
+ }
53
+ />
54
+ <Route
55
+ path=":external_id"
56
+ element={
57
+ <Loader
58
+ loaders={
59
+ <>
60
+ <ConfigurationLoader />
61
+ <TemplatesLoader scope="ca" />
62
+ </>
63
+ }
64
+ />
65
+ }
66
+ >
67
+ <Route
68
+ index
69
+ element={
70
+ <Segment>{!templatesLoading && <Configuration />}</Segment>
71
+ }
72
+ />
73
+ <Route
74
+ path="edit"
75
+ element={
76
+ !_.isEmpty(configuration) &&
77
+ !configurationLoading &&
78
+ !templatesLoading ? (
79
+ <EditConfiguration />
80
+ ) : null
81
+ }
82
+ />
83
+ </Route>
84
+ </Route>
85
+ <Route path="*" element={null} />
86
+ </Routes>
98
87
  );
99
88
  };
100
89
 
101
90
  ConfigurationRoutes.propTypes = {
102
91
  configuration: PropTypes.object,
103
92
  configurationLoading: PropTypes.bool,
104
- templatesLoading: PropTypes.bool
93
+ templatesLoading: PropTypes.bool,
105
94
  };
106
95
 
107
96
  const mapStateToProps = ({
108
97
  configuration,
109
98
  configurationLoading,
110
- templatesLoading
99
+ templatesLoading,
111
100
  }) => ({
112
101
  configuration,
113
102
  configurationLoading,
114
- templatesLoading
103
+ templatesLoading,
115
104
  });
116
105
 
117
106
  export default connect(mapStateToProps)(ConfigurationRoutes);
@@ -1,5 +1,4 @@
1
1
  import _ from "lodash/fp";
2
- import React from "react";
3
2
  import { useEffect } from "react";
4
3
  import PropTypes from "prop-types";
5
4
  import { connect } from "react-redux";
@@ -1,9 +1,9 @@
1
1
  import _ from "lodash/fp";
2
- import React, { useState } from "react";
2
+ import { useState } from "react";
3
3
  import PropTypes from "prop-types";
4
4
  import { connect } from "react-redux";
5
5
  import { FormattedMessage, useIntl } from "react-intl";
6
- import { Link } from "react-router-dom";
6
+ import { Link } from "react-router";
7
7
  import { Button, Grid, Header, Icon, Input, Segment } from "semantic-ui-react";
8
8
  import { CONFIGURATION_CREATE } from "@truedat/core/routes";
9
9
  import ConfigurationCards from "./ConfigurationCards";
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import { useEffect } from "react";
3
2
  import PropTypes from "prop-types";
4
3
  import { connect } from "react-redux";
@@ -1,12 +1,10 @@
1
1
  import PropTypes from "prop-types";
2
- import React from "react";
2
+ import { lazy } from "react";
3
3
 
4
- const DynamicForm = React.lazy(() =>
5
- import("@truedat/df/components/DynamicForm")
6
- );
4
+ const DynamicForm = lazy(() => import("@truedat/df/components/DynamicForm"));
7
5
 
8
- const TemplateLoader = React.lazy(() =>
9
- import("@truedat/df/templates/components/TemplateLoader")
6
+ const TemplateLoader = lazy(
7
+ () => import("@truedat/df/templates/components/TemplateLoader")
10
8
  );
11
9
 
12
10
  const DynamicConfigurationForm = ({ dfContent, handleContentChange }) => (
@@ -18,6 +16,6 @@ const DynamicConfigurationForm = ({ dfContent, handleContentChange }) => (
18
16
 
19
17
  DynamicConfigurationForm.propTypes = {
20
18
  dfContent: PropTypes.object,
21
- handleContentChange: PropTypes.func
19
+ handleContentChange: PropTypes.func,
22
20
  };
23
21
  export default DynamicConfigurationForm;
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { connect } from "react-redux";
4
3
  import { Container, Header, Icon, Segment } from "semantic-ui-react";
@@ -1,4 +1,3 @@
1
- import React from "react";
2
1
  import PropTypes from "prop-types";
3
2
  import { connect } from "react-redux";
4
3
  import { Container, Header, Icon, Segment } from "semantic-ui-react";
@@ -1,14 +1,14 @@
1
- import React from "react";
2
- import { shallow } from "enzyme";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import { Configuration } from "../Configuration";
4
3
 
5
4
  describe("<Configuration />", () => {
5
+ const configuration = {
6
+ external_id: "Micro1",
7
+ config: { a: { value: 1, origin: "user" } },
8
+ type: "micro",
9
+ };
6
10
  const props = {
7
- configuration: {
8
- external_id: "Micro1",
9
- config: { a: { value: 1, origin: "user" } },
10
- type: "micro",
11
- },
11
+ configuration,
12
12
  template: {
13
13
  content: [
14
14
  {
@@ -34,8 +34,15 @@ describe("<Configuration />", () => {
34
34
  match: { params: { external_id: "Micro" } },
35
35
  };
36
36
 
37
- it("matches the latest snapshot", () => {
38
- const wrapper = shallow(<Configuration {...props} />);
39
- expect(wrapper).toMatchSnapshot();
37
+ const renderOpts = {
38
+ state: {
39
+ configuration,
40
+ },
41
+ };
42
+
43
+ it("matches the latest snapshot", async () => {
44
+ const rendered = render(<Configuration {...props} />, renderOpts);
45
+ await waitForLoad(rendered);
46
+ expect(rendered.container).toMatchSnapshot();
40
47
  });
41
48
  });
@@ -1,37 +1,46 @@
1
- import React from "react";
2
- import { shallowWithIntl } from "@truedat/test/intl-stub";
3
- import { Card, Message } from "semantic-ui-react";
1
+ import { render } from "@truedat/test/render";
2
+ import en from "messages/en";
4
3
  import { ConfigurationCards } from "../ConfigurationCards";
5
4
 
5
+ const renderOpts = { messages: { en } };
6
+
6
7
  describe("<ConfigurationCards />", () => {
7
8
  const configurations = [
8
9
  {
9
10
  external_id: "con_url",
10
- type: "a"
11
+ type: "a",
11
12
  },
12
13
  { external_id: "id1", type: "app-admin" },
13
14
  { external_id: "id2", type: "app-admin" },
14
15
  { external_id: "id3", type: "app-admin" },
15
- { external_id: "id4", type: "a" }
16
+ { external_id: "id4", type: "a" },
16
17
  ];
17
18
 
18
19
  it("matches the latest snapshot", () => {
19
- const wrapper = shallowWithIntl(
20
- <ConfigurationCards configurations={configurations} />
20
+ const { container } = render(
21
+ <ConfigurationCards configurations={configurations} />,
22
+ renderOpts
21
23
  );
22
- expect(wrapper).toMatchSnapshot();
24
+ expect(container).toMatchSnapshot();
23
25
  });
24
26
 
25
27
  it("contains a message when no configurations are found", () => {
26
28
  const props = { configurations: [] };
27
- const wrapper = shallowWithIntl(<ConfigurationCards {...props} />);
28
- expect(wrapper.find(Card)).toHaveLength(0);
29
- expect(wrapper.find(Message)).toHaveLength(1);
29
+ const { container, queryByText } = render(
30
+ <ConfigurationCards {...props} />,
31
+ renderOpts
32
+ );
33
+
34
+ expect(container.querySelectorAll("div.ui.card")).toHaveLength(0);
35
+ expect(queryByText(/No configurations found/)).toBeInTheDocument();
30
36
  });
31
37
 
32
38
  it("contains a card for each configuration", () => {
33
39
  const props = { configurations };
34
- const wrapper = shallowWithIntl(<ConfigurationCards {...props} />);
35
- expect(wrapper.find(Card)).toHaveLength(5);
40
+ const { container, queryByText } = render(
41
+ <ConfigurationCards {...props} />,
42
+ renderOpts
43
+ );
44
+ expect(container.querySelectorAll("div.ui.card")).toHaveLength(5);
36
45
  });
37
46
  });
@@ -1,5 +1,4 @@
1
- import React from "react";
2
- import { render } from "@truedat/test/render";
1
+ import { render, waitForLoad } from "@truedat/test/render";
3
2
  import ConfigurationForm from "../ConfigurationForm";
4
3
 
5
4
  const renderOpts = {
@@ -44,8 +43,9 @@ describe("<ConfigurationForm />", () => {
44
43
  };
45
44
  const props = { onSubmit, configuration };
46
45
 
47
- it("matches the latest snapshot", () => {
48
- const { container } = render(<ConfigurationForm {...props} />, renderOpts);
49
- expect(container).toMatchSnapshot();
46
+ it("matches the latest snapshot", async () => {
47
+ const rendered = render(<ConfigurationForm {...props} />, renderOpts);
48
+ await waitForLoad(rendered);
49
+ expect(rendered.container).toMatchSnapshot();
50
50
  });
51
51
  });