generator-jhipster 7.7.0 → 7.8.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/README.md +1 -2
- package/generators/app/index.js +10 -0
- package/generators/ci-cd/index.js +1 -1
- package/generators/ci-cd/templates/github-actions.yml.ejs +4 -4
- package/generators/client/files-common.js +1 -2
- package/generators/client/files-react.js +25 -2
- package/generators/client/index.js +1 -1
- package/generators/client/needle-api/needle-client-react.js +11 -8
- package/generators/client/templates/angular/angular.json.ejs +1 -9
- package/generators/client/templates/angular/jest.conf.js.ejs +1 -1
- package/generators/client/templates/angular/package.json +17 -18
- package/generators/client/templates/angular/package.json.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/admin/user-management/list/user-management.component.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/core/util/data-util.service.ts.ejs +1 -1
- package/generators/client/templates/angular/src/main/webapp/app/core/util/parse-links.service.ts.ejs +1 -1
- package/generators/client/templates/angular/webpack/webpack.custom.js.ejs +12 -1
- package/generators/client/templates/common/package.json +7 -6
- package/generators/client/templates/common/webpack/webpack.microfrontend.js.jhi.ejs +2 -3
- package/generators/client/templates/react/.eslintrc.json.ejs +1 -1
- package/generators/client/templates/react/jest.conf.js.ejs +1 -1
- package/generators/client/templates/react/package.json +30 -31
- package/generators/client/templates/react/package.json.ejs +1 -0
- package/generators/client/templates/react/src/main/webapp/app/app.scss.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/config/store.ts.ejs +53 -6
- package/generators/client/templates/react/src/main/webapp/app/config/translation-middleware.ts.ejs +58 -0
- package/generators/client/templates/react/src/main/webapp/app/entities/menu.tsx.ejs +45 -0
- package/generators/client/templates/react/src/main/webapp/app/entities/reducers.ts.ejs +25 -0
- package/generators/client/templates/react/src/main/webapp/app/entities/routes.tsx.ejs +47 -0
- package/generators/client/templates/react/src/main/webapp/app/index.tsx.ejs +7 -7
- package/generators/client/templates/react/src/main/webapp/app/main.tsx.ejs +19 -0
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/logs/logs.tsx.ejs +1 -1
- package/generators/client/templates/react/src/main/webapp/app/modules/administration/user-management/user-management.tsx.ejs +2 -1
- package/generators/client/templates/react/src/main/webapp/app/modules/login/login-modal.tsx.ejs +5 -1
- package/generators/client/templates/react/src/main/webapp/app/routes.tsx.ejs +24 -7
- package/generators/client/templates/react/src/main/webapp/app/shared/error/error-loading.tsx.ejs +15 -0
- package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/entities.tsx.ejs +34 -6
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/index.ts.ejs +9 -2
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +9 -3
- package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.ts.ejs +21 -5
- package/generators/client/templates/react/src/main/webapp/app/typings.d.ts.ejs +15 -0
- package/generators/client/templates/react/src/main/webapp/microfrontends/entities-menu.tsx.ejs +3 -0
- package/generators/client/templates/react/src/main/webapp/microfrontends/entities-routes.tsx.ejs +3 -0
- package/generators/client/templates/react/tsconfig.json.ejs +3 -3
- package/generators/client/templates/react/tsconfig.test.json.ejs +9 -1
- package/generators/client/templates/react/webpack/webpack.common.js.ejs +6 -13
- package/generators/client/templates/react/webpack/webpack.dev.js.ejs +7 -8
- package/generators/client/templates/react/webpack/webpack.microfrontend.js.jhi.react.ejs +99 -0
- package/generators/client/templates/react/webpack/webpack.prod.js.ejs +31 -21
- package/generators/client/templates/vue/package.json +16 -17
- package/generators/client/templates/vue/package.json.ejs +1 -1
- package/generators/client/templates/vue/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +1 -0
- package/generators/client/templates/vue/src/main/webapp/app/shared/data/data-utils.service.ts.ejs +1 -1
- package/generators/client/templates/vue/src/test/javascript/jest.conf.js.ejs +2 -2
- package/generators/client/templates/vue/tsconfig.json.ejs +0 -3
- package/generators/client/templates/vue/webpack/webpack.common.js.ejs +6 -2
- package/generators/common/templates/package.json +2 -2
- package/generators/docker-compose/index.js +9 -5
- package/generators/entity/index.js +34 -19
- package/generators/entity-client/index.js +8 -0
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/list/entity-management.component.ts.ejs +1 -1
- package/generators/entity-client/templates/angular/src/main/webapp/app/entities/update/entity-management-update.component.ts.ejs +1 -1
- package/generators/entity-client/templates/common/src/test/javascript/cypress/integration/entity/entity.spec.ts.ejs +1 -0
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-delete-dialog.tsx.ejs +3 -3
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-detail.tsx.ejs +5 -4
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs +19 -18
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.reducer.ts.ejs +2 -2
- package/generators/entity-client/templates/react/src/main/webapp/app/entities/entity.tsx.ejs +21 -20
- package/generators/entity-i18n/templates/i18n/entity_fr.json.ejs +1 -1
- package/generators/entity-server/files.js +30 -10
- package/generators/entity-server/index.js +19 -1
- package/generators/entity-server/templates/couchbase/src/main/java/package/domain/Entity.java.jhi.spring_data_couchbase.ejs +1 -1
- package/generators/entity-server/templates/couchbase/src/main/java/package/repository/EntityRepository.java.ejs +31 -8
- package/generators/entity-server/templates/partials/update_template.ejs +77 -0
- package/generators/entity-server/templates/reactive/partials/save_template.ejs +1 -1
- package/generators/entity-server/templates/reactive/partials/update_template.ejs +41 -0
- package/generators/entity-server/templates/src/main/java/package/common/get_all_template.ejs +5 -5
- package/generators/entity-server/templates/src/main/java/package/common/get_template.ejs +1 -1
- package/generators/entity-server/templates/src/main/java/package/common/inject_template.ejs +13 -4
- package/generators/entity-server/templates/src/main/java/package/common/patch_template.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.ejs +2 -1
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.javax_lifecycle_events.ejs +31 -0
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_persistable.ejs +54 -0
- package/generators/entity-server/templates/src/main/java/package/domain/Entity.java.jhi.spring_data_reactive.ejs +1 -1
- package/generators/entity-server/templates/src/main/java/package/domain/EntityCallback.java.ejs +43 -0
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepository.java.ejs +6 -6
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryInternalImpl_reactive.java.ejs +13 -16
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepositoryWithBagRelationshipsImpl.java.ejs +4 -3
- package/generators/entity-server/templates/src/main/java/package/repository/EntityRepository_reactive.java.ejs +15 -23
- package/generators/entity-server/templates/src/main/java/package/repository/EntitySqlHelper_reactive.java.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/repository/rowmapper/EntityRowMapper.java.ejs +2 -2
- package/generators/entity-server/templates/src/main/java/package/repository/search/EntitySearchRepository.java.ejs +12 -25
- package/generators/entity-server/templates/src/main/java/package/service/EntityService.java.ejs +10 -2
- package/generators/entity-server/templates/src/main/java/package/service/impl/EntityServiceImpl.java.ejs +21 -5
- package/generators/entity-server/templates/src/main/java/package/service/mapper/EntityMapper.java.ejs +61 -90
- package/generators/entity-server/templates/src/main/java/package/web/rest/EntityResource.java.ejs +6 -4
- package/generators/entity-server/templates/src/test/java/package/web/rest/EntityResourceIT.java.ejs +28 -15
- package/generators/generator-base-private.js +1 -1
- package/generators/generator-base.js +29 -0
- package/generators/generator-constants.js +5 -5
- package/generators/generator-transforms.js +0 -1
- package/generators/gradle/constants.cjs +1 -1
- package/generators/maven/files.cjs +0 -1
- package/generators/maven/templates/.mvn/wrapper/maven-wrapper.jar +0 -0
- package/generators/maven/templates/.mvn/wrapper/maven-wrapper.properties +18 -2
- package/generators/maven/templates/mvnw +13 -7
- package/generators/maven/templates/mvnw.cmd +19 -13
- package/generators/maven/templates/pom.xml.jhi.ejs +1 -1
- package/generators/server/cleanup.js +19 -3
- package/generators/server/files.js +101 -17
- package/generators/server/index.js +11 -5
- package/generators/server/needle-api/needle-server-gradle.js +38 -0
- package/generators/server/templates/.mvn/jvm.config +1 -0
- package/generators/server/templates/.mvn/wrapper/maven-wrapper.jar +0 -0
- package/generators/server/templates/.mvn/wrapper/maven-wrapper.properties +18 -2
- package/generators/server/templates/build.gradle.ejs +7 -5
- package/generators/server/templates/couchbase/src/main/java/package/repository/JHipsterCouchbaseRepository.java.ejs +24 -1
- package/generators/server/templates/devcontainer/Dockerfile.ejs +25 -0
- package/generators/server/templates/devcontainer/devcontainer.json.ejs +64 -0
- package/generators/server/templates/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/generators/server/templates/gradle.properties.ejs +4 -4
- package/generators/server/templates/mvnw +13 -7
- package/generators/server/templates/mvnw.cmd +19 -13
- package/generators/server/templates/pom.xml.ejs +19 -17
- package/generators/server/templates/settings.gradle.ejs +6 -4
- package/generators/server/templates/src/main/docker/app.yml.ejs +2 -6
- package/generators/server/templates/src/main/docker/config/realm-config/jhipster-realm.json.ejs +2 -1
- package/generators/server/templates/src/main/docker/mysql.yml.ejs +1 -0
- package/generators/server/templates/src/main/java/package/config/AsyncConfiguration.java.ejs +6 -0
- package/generators/{client/templates/react/src/main/webapp/app/entities/index.tsx.ejs → server/templates/src/main/java/package/config/KafkaSseConsumer.java.ejs} +8 -14
- package/generators/server/templates/src/main/java/package/config/KafkaSseProducer.java.ejs +30 -0
- package/generators/server/templates/src/main/java/package/config/SecurityConfiguration.java.ejs +12 -10
- package/generators/server/templates/src/main/java/package/repository/EntityManager.java.ejs +3 -3
- package/generators/server/templates/src/main/java/package/security/jwt/JWTFilter.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/security/jwt/TokenProvider.java.ejs +1 -1
- package/generators/server/templates/src/main/java/package/web/rest/KafkaResource.java.ejs +60 -108
- package/generators/server/templates/src/main/java/package/web/rest/KafkaResource_reactive.java.ejs +74 -0
- package/generators/server/templates/src/main/resources/config/application.yml.ejs +26 -22
- package/generators/server/templates/src/test/java/package/CassandraKeyspaceIT.java.ejs +3 -4
- package/generators/server/templates/src/test/java/package/IntegrationTest.java.ejs +9 -3
- package/generators/server/templates/src/test/java/package/TechnicalStructureTest.java.ejs +0 -3
- package/generators/server/templates/src/test/java/package/config/CassandraTestContainer.java.ejs +122 -0
- package/generators/server/templates/src/test/java/package/config/EmbeddedCassandra.java.ejs +11 -0
- package/generators/server/templates/src/test/java/package/config/EmbeddedKafka.java.ejs +11 -0
- package/generators/server/templates/src/test/java/package/config/EmbeddedMongo.java.ejs +11 -0
- package/generators/server/templates/src/test/java/package/config/KafkaTestContainer.java.ejs +38 -0
- package/generators/server/templates/src/test/java/package/config/MongoDbTestContainer.java.ejs +67 -0
- package/generators/server/templates/src/test/java/package/config/TestContainersSpringContextCustomizerFactory.java.ejs +114 -0
- package/generators/server/templates/src/test/java/package/cucumber/CucumberIT.java.ejs +3 -10
- package/generators/server/templates/src/test/java/package/security/DomainUserDetailsServiceIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/security/jwt/JWTFilterTest.java.ejs +5 -5
- package/generators/server/templates/src/test/java/package/service/MailServiceIT.java.ejs +2 -4
- package/generators/server/templates/src/test/java/package/service/UserServiceIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT.java.ejs +3 -3
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT_oauth2.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/AccountResourceIT_skipUserManagement.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/KafkaResourceIT.java.ejs +52 -123
- package/generators/server/templates/src/test/java/package/web/rest/KafkaResourceIT_reactive.java.ejs +99 -0
- package/generators/server/templates/src/test/java/package/web/rest/PublicUserResourceIT.java.ejs +7 -10
- package/generators/server/templates/src/test/java/package/web/rest/UserJWTControllerIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/UserResourceIT.java.ejs +2 -5
- package/generators/server/templates/src/test/java/package/web/rest/errors/ExceptionTranslatorIT.java.ejs +1 -4
- package/generators/server/templates/src/test/java/package/web/rest/errors/ExceptionTranslatorIT_reactive.java.ejs +1 -4
- package/generators/server/templates/src/test/resources/META-INF/spring.factories.ejs +1 -1
- package/generators/server/templates/src/test/resources/config/application.yml.ejs +21 -20
- package/generators/server/templates/src/test/resources/testcontainers.properties.ejs +1 -0
- package/generators/workspaces/index.js +2 -1
- package/package.json +15 -15
- package/utils/entity.js +2 -0
- package/utils/field.js +8 -3
- package/utils/relationship.js +10 -1
- package/generators/entity-server/templates/src/main/java/package/repository/search/SortToSortBuilderListConverter.java.ejs +0 -25
- package/generators/maven/templates/.mvn/wrapper/MavenWrapperDownloader.java +0 -117
- package/generators/server/templates/.mvn/wrapper/MavenWrapperDownloader.java +0 -117
- package/generators/server/templates/src/main/java/package/config/KafkaProperties.java.ejs +0 -68
- package/generators/server/templates/src/test/java/package/AbstractCassandraTest.java.ejs +0 -125
- package/generators/server/templates/src/test/java/package/MongoDbTestContainerExtension.java.ejs +0 -37
- package/generators/server/templates/src/test/java/package/TestContainersSpringContextCustomizerFactory.java.ejs +0 -24
|
@@ -16,20 +16,34 @@
|
|
|
16
16
|
See the License for the specific language governing permissions and
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
|
-
import {
|
|
19
|
+
import {
|
|
20
|
+
AnyAction,
|
|
21
|
+
configureStore,
|
|
22
|
+
ThunkAction,
|
|
23
|
+
<%_ if (microfrontend || applicationTypeGateway) { _%>
|
|
24
|
+
Action,
|
|
25
|
+
Store,
|
|
26
|
+
Reducer,
|
|
27
|
+
ReducersMapObject,
|
|
28
|
+
combineReducers,
|
|
29
|
+
<%_ } _%>
|
|
30
|
+
} from '@reduxjs/toolkit';
|
|
20
31
|
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
|
32
|
+
import { loadingBarMiddleware } from 'react-redux-loading-bar';
|
|
21
33
|
|
|
22
|
-
import
|
|
34
|
+
import sharedReducers from 'app/shared/reducers';
|
|
23
35
|
import errorMiddleware from './error-middleware';
|
|
24
36
|
import notificationMiddleware from './notification-middleware';
|
|
25
37
|
import loggerMiddleware from './logger-middleware';
|
|
26
38
|
<%_ if (communicationSpringWebsocket) { _%>
|
|
27
39
|
import websocketMiddleware from './websocket-middleware';
|
|
28
40
|
<%_ } _%>
|
|
29
|
-
|
|
41
|
+
<%_ if (enableTranslation) { _%>
|
|
42
|
+
import translationMiddleware from './translation-middleware';
|
|
43
|
+
<%_ } _%>
|
|
30
44
|
|
|
31
45
|
const store = configureStore({
|
|
32
|
-
reducer,
|
|
46
|
+
reducer: sharedReducers,
|
|
33
47
|
middleware: getDefaultMiddleware =>
|
|
34
48
|
getDefaultMiddleware({
|
|
35
49
|
serializableCheck: {
|
|
@@ -40,14 +54,47 @@ const store = configureStore({
|
|
|
40
54
|
errorMiddleware,
|
|
41
55
|
notificationMiddleware,
|
|
42
56
|
loadingBarMiddleware(),
|
|
43
|
-
|
|
57
|
+
<%_ if (communicationSpringWebsocket) { _%>
|
|
44
58
|
websocketMiddleware,
|
|
45
|
-
|
|
59
|
+
<%_ } _%>
|
|
60
|
+
<%_ if (enableTranslation) { _%>
|
|
61
|
+
translationMiddleware,
|
|
62
|
+
<%_ } _%>
|
|
46
63
|
loggerMiddleware
|
|
47
64
|
),
|
|
48
65
|
});
|
|
66
|
+
<%_ if (microfrontend || applicationTypeGateway) { _%>
|
|
67
|
+
|
|
68
|
+
// Allow lazy loading of reducers https://github.com/reduxjs/redux/blob/master/docs/usage/CodeSplitting.md
|
|
69
|
+
interface InjectableStore<S = any, A extends Action = AnyAction> extends Store<S, A> {
|
|
70
|
+
asyncReducers: ReducersMapObject;
|
|
71
|
+
injectReducer(key: string, reducer: Reducer): void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function configureInjectableStore(storeToInject) {
|
|
75
|
+
const injectableStore = storeToInject as InjectableStore<any, any>;
|
|
76
|
+
injectableStore.asyncReducers = {};
|
|
77
|
+
|
|
78
|
+
injectableStore.injectReducer = (key, asyncReducer) => {
|
|
79
|
+
injectableStore.asyncReducers[key] = asyncReducer;
|
|
80
|
+
injectableStore.replaceReducer(
|
|
81
|
+
combineReducers({
|
|
82
|
+
...sharedReducers,
|
|
83
|
+
...injectableStore.asyncReducers,
|
|
84
|
+
})
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return injectableStore;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const injectableStore = configureInjectableStore(store);
|
|
92
|
+
|
|
93
|
+
const getStore = () => injectableStore;
|
|
94
|
+
<%_ } else { _%>
|
|
49
95
|
|
|
50
96
|
const getStore = () => store;
|
|
97
|
+
<%_ } _%>
|
|
51
98
|
|
|
52
99
|
export type IRootState = ReturnType<typeof store.getState>;
|
|
53
100
|
export type AppDispatch = typeof store.dispatch;
|
package/generators/client/templates/react/src/main/webapp/app/config/translation-middleware.ts.ejs
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2022 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import { createListenerMiddleware } from '@reduxjs/toolkit';
|
|
20
|
+
import { updateLocale, addTranslationSourcePrefix, loadLocale, loaded } from 'app/shared/reducers/locale';
|
|
21
|
+
import getStore from './store';
|
|
22
|
+
|
|
23
|
+
const listenerMiddleware = createListenerMiddleware();
|
|
24
|
+
|
|
25
|
+
listenerMiddleware.startListening({
|
|
26
|
+
actionCreator: updateLocale,
|
|
27
|
+
async effect(action) {
|
|
28
|
+
const store = getStore();
|
|
29
|
+
const { sourcePrefixes, loadedKeys } = store.getState().locale;
|
|
30
|
+
const keys = (
|
|
31
|
+
await Promise.all(
|
|
32
|
+
[''].concat(sourcePrefixes).map(async sourcePrefix => {
|
|
33
|
+
const key = `${sourcePrefix}${action.payload}`;
|
|
34
|
+
if (loadedKeys.includes(key)) return;
|
|
35
|
+
await loadLocale(action.payload, sourcePrefix);
|
|
36
|
+
return key;
|
|
37
|
+
})
|
|
38
|
+
)
|
|
39
|
+
).filter(Boolean);
|
|
40
|
+
store.dispatch(loaded(keys));
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
listenerMiddleware.startListening({
|
|
45
|
+
actionCreator: addTranslationSourcePrefix,
|
|
46
|
+
async effect(action) {
|
|
47
|
+
const store = getStore();
|
|
48
|
+
const { currentLocale, loadedKeys } = store.getState().locale;
|
|
49
|
+
const key = `${action.payload}${currentLocale}`;
|
|
50
|
+
|
|
51
|
+
if (!loadedKeys.includes(key)) {
|
|
52
|
+
await loadLocale(currentLocale, action.payload);
|
|
53
|
+
}
|
|
54
|
+
store.dispatch(loaded(key));
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export default listenerMiddleware.middleware;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2022 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import React<%_ if (applicationTypeMicroservice) { %>, { useEffect, useState } <% } %> from 'react';
|
|
20
|
+
import { Translate } from 'react-jhipster';
|
|
21
|
+
|
|
22
|
+
import MenuItem from 'app/shared/layout/menus/menu-item';
|
|
23
|
+
<%_ if (applicationTypeMicroservice) { _%>
|
|
24
|
+
import { addTranslationSourcePrefix } from 'app/shared/reducers/locale';
|
|
25
|
+
import { useAppDispatch, useAppSelector } from 'app/config/store';
|
|
26
|
+
<%_ } _%>
|
|
27
|
+
|
|
28
|
+
const EntitiesMenu = () => {
|
|
29
|
+
<%_ if (applicationTypeMicroservice) { _%>
|
|
30
|
+
const lastChange = useAppSelector(state => state.locale.lastChange);
|
|
31
|
+
const dispatch = useAppDispatch();
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
dispatch(addTranslationSourcePrefix('services/<%= lowercaseBaseName %>/'));
|
|
34
|
+
}, [lastChange]);
|
|
35
|
+
|
|
36
|
+
<%_ } _%>
|
|
37
|
+
return (
|
|
38
|
+
<>
|
|
39
|
+
{/* prettier-ignore */}
|
|
40
|
+
{/* jhipster-needle-add-entity-to-menu - JHipster will add entities to the menu here */}
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default EntitiesMenu as React.ComponentType<any>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2022 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
/* jhipster-needle-add-reducer-import - JHipster will add reducer here */
|
|
20
|
+
|
|
21
|
+
const entitiesReducers = {
|
|
22
|
+
/* jhipster-needle-add-reducer-combine - JHipster will add reducer here */
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default entitiesReducers;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2022 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import React from 'react';
|
|
20
|
+
import { Switch } from 'react-router-dom';
|
|
21
|
+
<%_ if (microfrontend || applicationTypeGateway) { _%>
|
|
22
|
+
import { ReducersMapObject, combineReducers } from '@reduxjs/toolkit';
|
|
23
|
+
|
|
24
|
+
import getStore from 'app/config/store';
|
|
25
|
+
<%_ } _%>
|
|
26
|
+
import ErrorBoundaryRoute from 'app/shared/error/error-boundary-route';
|
|
27
|
+
<%_ if (microfrontend || applicationTypeGateway) { _%>
|
|
28
|
+
|
|
29
|
+
import entitiesReducers from './reducers';
|
|
30
|
+
<%_ } _%>
|
|
31
|
+
|
|
32
|
+
/* jhipster-needle-add-route-import - JHipster will add routes here */
|
|
33
|
+
|
|
34
|
+
export default ({ match }) => {
|
|
35
|
+
<%_ if (microfrontend || applicationTypeGateway) { _%>
|
|
36
|
+
const store = getStore();
|
|
37
|
+
store.injectReducer('<%= lowercaseBaseName %>', combineReducers(entitiesReducers as ReducersMapObject));
|
|
38
|
+
<%_ } _%>
|
|
39
|
+
return (
|
|
40
|
+
<div>
|
|
41
|
+
<Switch>
|
|
42
|
+
{/* prettier-ignore */}
|
|
43
|
+
{/* jhipster-needle-add-route-path - JHipster will add routes here */}
|
|
44
|
+
</Switch>
|
|
45
|
+
</div>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -21,15 +21,15 @@ import ReactDOM from 'react-dom';
|
|
|
21
21
|
import { Provider } from 'react-redux';
|
|
22
22
|
import { bindActionCreators } from 'redux';
|
|
23
23
|
|
|
24
|
-
import getStore from '
|
|
24
|
+
import getStore from 'app/config/store';
|
|
25
25
|
<%_ if (enableTranslation) { _%>
|
|
26
|
-
import { registerLocale } from '
|
|
26
|
+
import { registerLocale } from 'app/config/translation';
|
|
27
27
|
<%_ } _%>
|
|
28
|
-
import setupAxiosInterceptors from '
|
|
29
|
-
import { clearAuthentication } from '
|
|
30
|
-
import ErrorBoundary from '
|
|
31
|
-
import AppComponent from '
|
|
32
|
-
import { loadIcons } from '
|
|
28
|
+
import setupAxiosInterceptors from 'app/config/axios-interceptor';
|
|
29
|
+
import { clearAuthentication } from 'app/shared/reducers/authentication';
|
|
30
|
+
import ErrorBoundary from 'app/shared/error/error-boundary';
|
|
31
|
+
import AppComponent from 'app/app';
|
|
32
|
+
import { loadIcons } from 'app/config/icon-loader';
|
|
33
33
|
|
|
34
34
|
const store = getStore();
|
|
35
35
|
<%_ if (enableTranslation) { _%>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%#
|
|
2
|
+
Copyright 2013-2021 the original author or authors from the JHipster project.
|
|
3
|
+
|
|
4
|
+
This file is part of the JHipster project, see https://www.jhipster.tech/
|
|
5
|
+
for more information.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
https://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
-%>
|
|
19
|
+
import('./index');
|
|
@@ -40,7 +40,7 @@ export const LogsPage = () => {
|
|
|
40
40
|
|
|
41
41
|
const filterFn = l => l.name.toUpperCase().includes(filter.toUpperCase());
|
|
42
42
|
|
|
43
|
-
const loggers = logs ? Object.entries(logs.loggers).map(e => ({ name: e[0], level: e[1].effectiveLevel })) : [];
|
|
43
|
+
const loggers = logs ? Object.entries(logs.loggers).map((e: any) => ({ name: e[0], level: e[1].effectiveLevel })) : [];
|
|
44
44
|
|
|
45
45
|
return (
|
|
46
46
|
<div>
|
|
@@ -89,13 +89,14 @@ export const UserManagement = (props: RouteComponentProps<any>) => {
|
|
|
89
89
|
getUsersFromProps();
|
|
90
90
|
};
|
|
91
91
|
|
|
92
|
-
const toggleActive = user => () =>
|
|
92
|
+
const toggleActive = user => () => {
|
|
93
93
|
dispatch(
|
|
94
94
|
updateUser({
|
|
95
95
|
...user,
|
|
96
96
|
activated: !user.activated,
|
|
97
97
|
})
|
|
98
98
|
);
|
|
99
|
+
};
|
|
99
100
|
|
|
100
101
|
const { match } = props;
|
|
101
102
|
const account = useAppSelector(state => state.authentication.account);
|
package/generators/client/templates/react/src/main/webapp/app/modules/login/login-modal.tsx.ejs
CHANGED
|
@@ -42,9 +42,13 @@ const LoginModal = (props: ILoginModalProps) => {
|
|
|
42
42
|
|
|
43
43
|
const { loginError, handleClose } = props;
|
|
44
44
|
|
|
45
|
+
const handleLoginSubmit = e => {
|
|
46
|
+
handleSubmit(login)(e);
|
|
47
|
+
};
|
|
48
|
+
|
|
45
49
|
return (
|
|
46
50
|
<Modal isOpen={props.showModal} toggle={handleClose} backdrop="static" id="login-page" autoFocus={false}>
|
|
47
|
-
<Form onSubmit={
|
|
51
|
+
<Form onSubmit={handleLoginSubmit}>
|
|
48
52
|
<ModalHeader id="login-title" data-cy="loginTitle" toggle={handleClose}><Translate contentKey="login.title">Sign in</Translate></ModalHeader>
|
|
49
53
|
<ModalBody>
|
|
50
54
|
<Row>
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
See the License for the specific language governing permissions and
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
|
-
import React from 'react';
|
|
20
|
-
import { Switch <% if (communicationSpringWebsocket) { %>, useLocation <% } %>} from 'react-router-dom';
|
|
19
|
+
import React<% if (applicationTypeGateway && microfrontend) { %>, { Suspense }<% } %> from 'react';
|
|
20
|
+
import { Switch <% if (communicationSpringWebsocket) { %>, useLocation <% } %><% if (applicationTypeGateway && microfrontend) { %>, Route <% } %>} from 'react-router-dom';
|
|
21
21
|
import Loadable from 'react-loadable';
|
|
22
22
|
|
|
23
23
|
<%_ if (!authenticationTypeOauth2) { _%>
|
|
@@ -34,7 +34,7 @@ import PasswordResetFinish from 'app/modules/account/password-reset/finish/passw
|
|
|
34
34
|
<%_ } _%>
|
|
35
35
|
import Logout from 'app/modules/login/logout';
|
|
36
36
|
import Home from 'app/modules/home/home';
|
|
37
|
-
import
|
|
37
|
+
import EntitiesRoutes from 'app/entities/routes';
|
|
38
38
|
import PrivateRoute from 'app/shared/auth/private-route';
|
|
39
39
|
import ErrorBoundaryRoute from 'app/shared/error/error-boundary-route';
|
|
40
40
|
import PageNotFound from 'app/shared/error/page-not-found';
|
|
@@ -43,17 +43,25 @@ import { AUTHORITIES } from 'app/config/constants';
|
|
|
43
43
|
import { sendActivity } from 'app/config/websocket-middleware';
|
|
44
44
|
<%_ } _%>
|
|
45
45
|
|
|
46
|
+
const loading = <div>loading ...</div>;
|
|
46
47
|
<%_ if (!skipUserManagement) { _%>
|
|
47
|
-
|
|
48
|
+
|
|
49
|
+
const Account = Loadable({
|
|
48
50
|
loader: () => import(/* webpackChunkName: "account" */ 'app/modules/account'),
|
|
49
|
-
loading: () =>
|
|
51
|
+
loading: () => loading,
|
|
50
52
|
});
|
|
51
53
|
<%_ } _%>
|
|
52
54
|
|
|
53
55
|
const Admin = Loadable({
|
|
54
56
|
loader: () => import(/* webpackChunkName: "administration" */ 'app/modules/administration'),
|
|
55
|
-
loading: () =>
|
|
57
|
+
loading: () => loading,
|
|
56
58
|
});
|
|
59
|
+
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
60
|
+
|
|
61
|
+
<%_ for (const remote of microfrontends) { _%>
|
|
62
|
+
const <%= remote.capitalizedBaseName %>Routes = React.lazy(() => import('@<%= remote.lowercaseBaseName %>/entities-routes').catch(() => import('app/shared/error/error-loading')));
|
|
63
|
+
<%_ } _%>
|
|
64
|
+
<%_ } _%>
|
|
57
65
|
|
|
58
66
|
const Routes = () => {
|
|
59
67
|
<%_ if (communicationSpringWebsocket) { _%>
|
|
@@ -83,7 +91,16 @@ const Routes = () => {
|
|
|
83
91
|
<%_ if (authenticationTypeOauth2) { _%>
|
|
84
92
|
<ErrorBoundaryRoute path="/oauth2/authorization/oidc" component={LoginRedirect} />
|
|
85
93
|
<%_ } _%>
|
|
86
|
-
|
|
94
|
+
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
95
|
+
<%_ for (const remote of microfrontends) { _%>
|
|
96
|
+
<Route path="/<%= remote.lowercaseBaseName %>/">
|
|
97
|
+
<Suspense fallback={loading}>
|
|
98
|
+
<PrivateRoute component={<%= remote.capitalizedBaseName %>Routes} hasAnyAuthorities={[AUTHORITIES.USER]} />
|
|
99
|
+
</Suspense>
|
|
100
|
+
</Route>
|
|
101
|
+
<%_ } _%>
|
|
102
|
+
<%_ } _%>
|
|
103
|
+
<PrivateRoute path="/<%= microfrontend && applicationTypeMicroservice ? lowercaseBaseName + '/' : '' %>" component={EntitiesRoutes} hasAnyAuthorities={[AUTHORITIES.USER]}/>
|
|
87
104
|
<ErrorBoundaryRoute component={PageNotFound} />
|
|
88
105
|
</Switch>
|
|
89
106
|
</div>
|
package/generators/client/templates/react/src/main/webapp/app/shared/error/error-loading.tsx.ejs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Translate } from 'react-jhipster';
|
|
3
|
+
import { Alert } from 'reactstrap';
|
|
4
|
+
|
|
5
|
+
class ErrorLoading extends React.Component {
|
|
6
|
+
render() {
|
|
7
|
+
return (
|
|
8
|
+
<div>
|
|
9
|
+
<Alert color="danger">Error loading component</Alert>
|
|
10
|
+
</div>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default ErrorLoading as React.ComponentType<any>;
|
package/generators/client/templates/react/src/main/webapp/app/shared/layout/menus/entities.tsx.ejs
CHANGED
|
@@ -16,14 +16,42 @@
|
|
|
16
16
|
See the License for the specific language governing permissions and
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
|
-
import React from 'react';
|
|
20
|
-
import
|
|
21
|
-
import { Translate, translate } from 'react-jhipster';
|
|
19
|
+
import React<% if (microfrontend) { %>, { Suspense }<% } %> from 'react';
|
|
20
|
+
import { translate } from 'react-jhipster';
|
|
22
21
|
import { NavDropdown } from './menu-components';
|
|
22
|
+
<%_ if (microfrontend) { _%>
|
|
23
|
+
|
|
24
|
+
const EntitiesMenuItems = React.lazy(() => import('app/entities/menu').catch(() => import('app/shared/error/error-loading')));
|
|
25
|
+
<%_ if (applicationTypeGateway) { _%>
|
|
26
|
+
<%_ for (const remote of microfrontends) { _%>
|
|
27
|
+
const <%= remote.capitalizedBaseName %>EntitiesMenuItems = React.lazy(() => import('@<%= remote.lowercaseBaseName %>/entities-menu').catch(() => import('app/shared/error/error-loading')));
|
|
28
|
+
<%_ } _%>
|
|
29
|
+
<%_ } _%>
|
|
30
|
+
<%_ } else { _%>
|
|
31
|
+
import EntitiesMenuItems from 'app/entities/menu';
|
|
32
|
+
<%_ } _%>
|
|
23
33
|
|
|
24
34
|
export const EntitiesMenu = props => (
|
|
25
|
-
<NavDropdown
|
|
26
|
-
|
|
27
|
-
{
|
|
35
|
+
<NavDropdown
|
|
36
|
+
icon="th-list"
|
|
37
|
+
name={translate('global.menu.entities.main')}
|
|
38
|
+
id="entity-menu"
|
|
39
|
+
data-cy="entity"
|
|
40
|
+
style={{ maxHeight: '80vh', overflow: 'auto' }}
|
|
41
|
+
>
|
|
42
|
+
<%_ if (microfrontend) { _%>
|
|
43
|
+
<Suspense fallback={<div>loading...</div>}>
|
|
44
|
+
<EntitiesMenuItems />
|
|
45
|
+
</Suspense>
|
|
46
|
+
<%_ if (applicationTypeGateway) { _%>
|
|
47
|
+
<%_ for (const remote of microfrontends) { _%>
|
|
48
|
+
<Suspense fallback={<div>loading...</div>}>
|
|
49
|
+
<<%= remote.capitalizedBaseName %>EntitiesMenuItems />
|
|
50
|
+
</Suspense>
|
|
51
|
+
<%_ } _%>
|
|
52
|
+
<%_ } _%>
|
|
53
|
+
<%_ } else { _%>
|
|
54
|
+
<EntitiesMenuItems />
|
|
55
|
+
<%_ } _%>
|
|
28
56
|
</NavDropdown>
|
|
29
57
|
);
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
See the License for the specific language governing permissions and
|
|
17
17
|
limitations under the License.
|
|
18
18
|
-%>
|
|
19
|
+
import { ReducersMapObject, combineReducers } from '@reduxjs/toolkit';
|
|
19
20
|
import { loadingBarReducer as loadingBar } from 'react-redux-loading-bar';
|
|
20
21
|
|
|
21
22
|
<%_ if (enableTranslation) { _%>
|
|
@@ -40,9 +41,12 @@ import passwordReset from 'app/modules/account/password-reset/password-reset.red
|
|
|
40
41
|
import sessions from 'app/modules/account/sessions/sessions.reducer';
|
|
41
42
|
<%_ } _%>
|
|
42
43
|
<%_ } _%>
|
|
44
|
+
<%_ if (applicationTypeMonolith) { _%>
|
|
45
|
+
import entitiesReducers from 'app/entities/reducers';
|
|
46
|
+
<%_ } _%>
|
|
43
47
|
/* jhipster-needle-add-reducer-import - JHipster will add reducer here */
|
|
44
48
|
|
|
45
|
-
const rootReducer = {
|
|
49
|
+
const rootReducer: ReducersMapObject = {
|
|
46
50
|
authentication,
|
|
47
51
|
<%_ if (enableTranslation) { _%>
|
|
48
52
|
locale,
|
|
@@ -62,8 +66,11 @@ const rootReducer = {
|
|
|
62
66
|
sessions,
|
|
63
67
|
<%_ } _%>
|
|
64
68
|
<%_ } _%>
|
|
69
|
+
loadingBar,
|
|
65
70
|
/* jhipster-needle-add-reducer-combine - JHipster will add reducer here */
|
|
66
|
-
|
|
71
|
+
<%_ if (applicationTypeMonolith) { _%>
|
|
72
|
+
...entitiesReducers,
|
|
73
|
+
<%_ } _%>
|
|
67
74
|
};
|
|
68
75
|
|
|
69
76
|
export default rootReducer;
|
package/generators/client/templates/react/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs
CHANGED
|
@@ -25,7 +25,15 @@ describe('Locale reducer tests', () => {
|
|
|
25
25
|
it('should correctly detect update in current locale state', () => {
|
|
26
26
|
TranslatorContext.setLocale('en');
|
|
27
27
|
expect(TranslatorContext.context.locale).toEqual('en');
|
|
28
|
-
const localeState = locale(
|
|
28
|
+
const localeState = locale(
|
|
29
|
+
{
|
|
30
|
+
currentLocale: 'en',
|
|
31
|
+
sourcePrefixes: [],
|
|
32
|
+
lastChange: new Date().getTime(),
|
|
33
|
+
loadedKeys: [],
|
|
34
|
+
},
|
|
35
|
+
updateLocale('es')
|
|
36
|
+
);
|
|
29
37
|
expect(localeState).toMatchObject({
|
|
30
38
|
currentLocale: 'es'
|
|
31
39
|
});
|
|
@@ -48,8 +56,6 @@ describe('Locale reducer tests', () => {
|
|
|
48
56
|
|
|
49
57
|
await store.dispatch(setLocale(defaultLocale));
|
|
50
58
|
expect(store.getActions()).toEqual(expectedActions);
|
|
51
|
-
expect(TranslatorContext.context.translations).toBeDefined();
|
|
52
|
-
expect(Object.keys(TranslatorContext.context.translations)).toContainEqual(defaultLocale);
|
|
53
59
|
});
|
|
54
60
|
});
|
|
55
61
|
});
|
|
@@ -24,16 +24,22 @@ import { AppThunk } from 'app/config/store';
|
|
|
24
24
|
import { TranslatorContext } from 'react-jhipster';
|
|
25
25
|
|
|
26
26
|
const initialState = {
|
|
27
|
-
currentLocale: ''
|
|
27
|
+
currentLocale: '',
|
|
28
|
+
sourcePrefixes: [],
|
|
29
|
+
lastChange: TranslatorContext.context.lastChange,
|
|
30
|
+
loadedKeys: [],
|
|
28
31
|
};
|
|
29
32
|
|
|
30
33
|
export type LocaleState = Readonly<typeof initialState>;
|
|
31
34
|
|
|
32
|
-
export const
|
|
33
|
-
if (!Object.keys(TranslatorContext.context.translations).includes(locale)) {
|
|
34
|
-
const response = await axios.get(
|
|
35
|
+
export const loadLocale = async (locale: string, prefix: string) => {
|
|
36
|
+
if (prefix || !Object.keys(TranslatorContext.context.translations).includes(locale)) {
|
|
37
|
+
const response = await axios.get(`${prefix}i18n/${locale}.json?_=${I18N_HASH}`, { baseURL: '' });
|
|
35
38
|
TranslatorContext.registerTranslations(locale, response.data);
|
|
36
39
|
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const setLocale: (locale: string) => AppThunk = locale => dispatch => {
|
|
37
43
|
dispatch(updateLocale(locale));
|
|
38
44
|
};
|
|
39
45
|
|
|
@@ -49,10 +55,20 @@ export const LocaleSlice = createSlice({
|
|
|
49
55
|
}
|
|
50
56
|
state.currentLocale = currentLocale;
|
|
51
57
|
},
|
|
58
|
+
loaded(state, action) {
|
|
59
|
+
state.lastChange = TranslatorContext.context.lastChange;
|
|
60
|
+
state.loadedKeys = state.loadedKeys.concat(action.payload);
|
|
61
|
+
},
|
|
62
|
+
addTranslationSourcePrefix(state, action) {
|
|
63
|
+
const sourcePrefix = action.payload;
|
|
64
|
+
if (!state.sourcePrefixes.includes(sourcePrefix)) {
|
|
65
|
+
state.sourcePrefixes = state.sourcePrefixes.concat(sourcePrefix);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
52
68
|
},
|
|
53
69
|
});
|
|
54
70
|
|
|
55
|
-
export const { updateLocale } = LocaleSlice.actions;
|
|
71
|
+
export const { updateLocale, addTranslationSourcePrefix, loaded } = LocaleSlice.actions;
|
|
56
72
|
|
|
57
73
|
// Reducer
|
|
58
74
|
export default LocaleSlice.reducer;
|
|
@@ -27,3 +27,18 @@ declare module '*.json' {
|
|
|
27
27
|
const value: any;
|
|
28
28
|
export default value;
|
|
29
29
|
}
|
|
30
|
+
|
|
31
|
+
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
32
|
+
<%_ for (const remote of microfrontends) { _%>
|
|
33
|
+
|
|
34
|
+
declare module '@<%= remote.lowercaseBaseName %>/entities-routes' {
|
|
35
|
+
const _default: React.ComponentType<any>;
|
|
36
|
+
export default _default;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
declare module '@<%= remote.lowercaseBaseName %>/entities-menu' {
|
|
40
|
+
const _default: React.ComponentType<any>;
|
|
41
|
+
export default _default;
|
|
42
|
+
}
|
|
43
|
+
<%_ } _%>
|
|
44
|
+
<%_ } _%>
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"compilerOptions": {
|
|
21
21
|
"jsx": "react",
|
|
22
22
|
"target": "es6",
|
|
23
|
-
"module": "
|
|
23
|
+
"module": "es2020",
|
|
24
24
|
"moduleResolution": "node",
|
|
25
25
|
"sourceMap": true,
|
|
26
26
|
"emitDecoratorMetadata": true,
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"noImplicitAny": false,
|
|
30
30
|
"suppressImplicitAnyIndexErrors": true,
|
|
31
31
|
"outDir": "<%= DIST_DIR %>app",
|
|
32
|
-
"lib": ["dom", "es2015", "es2016", "es2017"],
|
|
32
|
+
"lib": ["dom", "es2015", "es2016", "es2017", "es2019", "es2020"],
|
|
33
33
|
"types": ["jest", "webpack-env"],
|
|
34
34
|
"allowJs": true,
|
|
35
35
|
"checkJs": false,
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"esModuleInterop": true,
|
|
42
42
|
"allowSyntheticDefaultImports": true
|
|
43
43
|
},
|
|
44
|
-
"include": ["<%= MAIN_SRC_DIR %>app"
|
|
44
|
+
"include": ["<%= MAIN_SRC_DIR %>app"],
|
|
45
45
|
"exclude": [
|
|
46
46
|
"node_modules"
|
|
47
47
|
]
|