generator-jhipster 8.0.0-rc.1 → 8.0.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 +10 -1
- package/dist/cli/environment-builder.mjs +3 -3
- package/dist/cli/jhipster-command.mjs +7 -3
- package/dist/cli/program.mjs +1 -1
- package/dist/generators/angular/generator.mjs +8 -7
- package/dist/generators/angular/resources/package.json +10 -9
- package/dist/generators/angular/templates/package.json.ejs +4 -8
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +6 -10
- package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/service/_entityFile_.service.ts.ejs +1 -1
- package/dist/generators/angular/templates/src/main/webapp/app/layouts/navbar/navbar.component.scss.ejs +1 -1
- package/dist/generators/angular/templates/webpack/webpack.microfrontend.js.ejs +48 -126
- package/dist/generators/app/support/config.mjs +3 -3
- package/dist/generators/base/generator.mjs +0 -3
- package/dist/generators/base/support/config.mjs +6 -6
- package/dist/generators/base/support/jhipster7-context.mjs +3 -3
- package/dist/generators/base-application/generator.mjs +2 -2
- package/dist/generators/base-application/support/enum.mjs +1 -1
- package/dist/generators/base-application/support/prepare-entity.mjs +14 -10
- package/dist/generators/base-application/support/prepare-field.mjs +11 -7
- package/dist/generators/base-application/support/prepare-relationship.mjs +12 -14
- package/dist/generators/base-workspaces/internal/docker-prompts.mjs +13 -12
- package/dist/generators/bootstrap/generator.mjs +64 -43
- package/dist/generators/bootstrap/support/auto-crlf-transform.mjs +34 -21
- package/dist/generators/bootstrap/support/eslint-transform.mjs +2 -5
- package/dist/generators/bootstrap/support/java-unused-imports-transform.mjs +2 -2
- package/dist/generators/bootstrap/support/multi-step-transform/index.mjs +17 -28
- package/dist/generators/bootstrap/support/multi-step-transform/template-file-fs.mjs +12 -6
- package/dist/generators/bootstrap/support/multi-step-transform/template-file.mjs +1 -0
- package/dist/generators/bootstrap/support/prettier-support.mjs +2 -2
- package/dist/generators/bootstrap-application/generator.mjs +10 -3
- package/dist/generators/bootstrap-application-base/generator.mjs +9 -6
- package/dist/generators/bootstrap-application-server/generator.mjs +2 -2
- package/dist/generators/client/resources/package.json +3 -3
- package/dist/generators/client/templates/src/main/webapp/content/css/loading.css.ejs +1 -1
- package/dist/generators/client/templates/webpack/webpack.microfrontend.js.jhi.ejs +14 -1
- package/dist/generators/common/files.mjs +1 -1
- package/dist/generators/common/generator.mjs +29 -7
- package/dist/generators/common/resources/package.json +3 -3
- package/dist/generators/common/templates/.lintstagedrc.cjs.ejs +21 -0
- package/dist/generators/common/templates/.prettierrc.ejs +1 -1
- package/dist/generators/common/templates/README.md.jhi.ejs +2 -0
- package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/settings-page.cy.ts.ejs +3 -0
- package/dist/generators/entity/prompts.mjs +123 -306
- package/dist/generators/generator-constants.mjs +5 -5
- package/dist/generators/heroku/generator.mjs +318 -595
- package/dist/generators/heroku/templates/Procfile.ejs +1 -1
- package/dist/generators/heroku/templates/application-heroku.yml.ejs +0 -12
- package/dist/generators/info/generator.mjs +6 -4
- package/dist/generators/init/generator.mjs +2 -2
- package/dist/generators/java/entity-files.mjs +1 -1
- package/dist/generators/java/generator.mjs +12 -13
- package/dist/generators/java/support/package-info-transform.mjs +20 -6
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.ejs +24 -28
- package/dist/generators/java/templates/src/main/java/_package_/_entityPackage_/domain/enumeration/_enumName_.java.ejs +3 -3
- package/dist/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_Test.java.ejs +86 -8
- package/dist/generators/java/templates/src/test/java/_package_/_entityPackage_/domain/_persistClass_TestSamples.java.ejs +85 -0
- package/dist/generators/jdl/generator.mjs +14 -5
- package/dist/generators/kubernetes/templates/ingress.yml.ejs +0 -1
- package/dist/generators/languages/command.mjs +5 -0
- package/dist/generators/languages/generator.mjs +20 -13
- package/dist/generators/languages/translation-data.mjs +8 -13
- package/dist/generators/liquibase/generator.mjs +7 -3
- package/dist/generators/project-name/generator.mjs +1 -1
- package/dist/generators/react/generator.mjs +18 -10
- package/dist/generators/react/resources/package.json +19 -18
- package/dist/generators/react/templates/package.json.ejs +4 -5
- package/dist/generators/react/templates/src/main/webapp/app/config/icon-loader.ts.ejs +35 -33
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-update.tsx.ejs +7 -2
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/modules/home/home.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/routes.tsx.ejs +9 -2
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header-components.tsx.ejs +1 -1
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/header/header.scss.ejs +5 -4
- package/dist/generators/react/templates/src/main/webapp/app/shared/layout/menus/entities.tsx.ejs +10 -1
- package/dist/generators/react/templates/tsconfig.test.json.ejs +1 -1
- package/dist/generators/react/templates/webpack/webpack.microfrontend.js.jhi.react.ejs +13 -58
- package/dist/generators/server/generator.mjs +13 -4
- package/dist/generators/server/resources/Dockerfile +7 -7
- package/dist/generators/server/resources/gradle/libs.versions.toml +1 -1
- package/dist/generators/server/resources/pom.xml +11 -11
- package/dist/generators/server/support/config.mjs +4 -4
- package/dist/generators/server/support/prepare-entity.mjs +5 -5
- package/dist/generators/server/support/prepare-field.mjs +20 -0
- package/dist/generators/server/support/relationship.mjs +2 -1
- package/dist/generators/server/support/templates/field-values.mjs +5 -2
- package/dist/generators/server/templates/README.md.jhi.spring-boot.ejs +0 -1
- package/dist/generators/server/templates/package.json.ejs +0 -5
- package/dist/generators/server/templates/pom.xml.ejs +1 -8
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/_partials_entity_/get_all_template.ejs +3 -3
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/service/dto/_dtoClass_.java.ejs +2 -2
- package/dist/generators/server/templates/src/main/java/_package_/_entityPackage_/web/rest/_entityClass_Resource.java.ejs +11 -11
- package/dist/generators/server/templates/src/main/java/_package_/config/JacksonConfiguration.java.ejs +2 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_imperative.java.ejs +1 -1
- package/dist/generators/server/templates/src/main/java/_package_/config/SecurityConfiguration_reactive.java.ejs +2 -0
- package/dist/generators/server/templates/src/main/java/_package_/service/MailService.java.ejs +10 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/PublicUserResource.java.ejs +3 -4
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/UserResource.java.ejs +0 -2
- package/dist/generators/server/templates/src/main/java/_package_/web/rest/errors/ExceptionTranslator.java.ejs +4 -7
- package/dist/generators/server/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs +3 -3
- package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs +4 -4
- package/dist/generators/spring-data-elasticsearch/templates/src/main/java/_package_/_entityPackage_/repository/search/_entityClass_SearchRepository.java.ejs +0 -2
- package/dist/generators/spring-data-neo4j/templates/src/main/java/_package_/_entityPackage_/domain/_persistClass_.java.jhi.spring_data_neo4j.ejs +3 -37
- package/dist/generators/vue/generator.mjs +25 -16
- package/dist/generators/vue/resources/package.json +17 -16
- package/dist/generators/vue/templates/package.json.ejs +3 -5
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +10 -3
- package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +3 -4
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs +1 -1
- package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.vue.ejs +12 -0
- package/dist/generators/vue/templates/src/main/webapp/app/router/index.ts.ejs +8 -1
- package/dist/generators/vue/templates/webpack/webpack.microfrontend.js.jhi.vue.ejs +19 -34
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-option-converter.js +2 -2
- package/dist/jdl/converters/jdl-to-json/jdl-to-json-relationship-converter.js +1 -1
- package/dist/jdl/converters/jdl-to-json/jdl-without-application-to-json-converter.js +1 -1
- package/dist/jdl/converters/parsed-jdl-to-jdl-object/application-converter.js +1 -17
- package/dist/jdl/exporters/applications/jhipster-application-formatter.js +17 -1
- package/dist/jdl/exporters/config.js +11 -0
- package/dist/jdl/exporters/export-utils.js +2 -13
- package/dist/jdl/index.js +1 -0
- package/dist/jdl/jdl-importer.js +6 -2
- package/dist/jdl/models/jdl-application-configuration-factory.js +34 -2
- package/dist/jdl/models/jdl-application-configuration.js +6 -3
- package/dist/jdl/models/jdl-application-factory.js +2 -2
- package/dist/jdl/models/jdl-application.js +12 -3
- package/dist/jdl/parsing/jdl-ast-builder-visitor.js +63 -7
- package/dist/jdl/parsing/jdl-parser.js +52 -6
- package/dist/jdl/parsing/lexer/application-tokens.js +1 -1
- package/dist/jdl/validators/entity-validator.js +4 -2
- package/dist/jdl/validators/enum-validator.js +4 -2
- package/dist/jdl/validators/jdl-with-application-validator.js +18 -8
- package/dist/jdl/validators/jdl-without-application-validator.js +30 -29
- package/dist/jdl/validators/validator.js +1 -1
- package/dist/types/generators/base/support/config.d.mts +3 -3
- package/dist/types/generators/base-application/support/prepare-entity.d.mts +6 -1
- package/dist/types/generators/bootstrap/support/auto-crlf-transform.d.mts +3 -2
- package/dist/types/generators/bootstrap/support/multi-step-transform/index.d.mts +3 -20
- package/dist/types/generators/bootstrap/support/multi-step-transform/template-file-fs.d.mts +15 -9
- package/dist/types/generators/bootstrap/support/multi-step-transform/template-file.d.mts +1 -0
- package/dist/types/generators/generator-constants.d.mts +3 -3
- package/dist/types/generators/java/support/package-info-transform.d.mts +1 -4
- package/dist/types/generators/server/support/templates/field-values.d.mts +1 -1
- package/dist/types/jdl/exporters/config.d.ts +1 -0
- package/dist/types/jdl/index.d.ts +1 -0
- package/dist/types/jdl/jdl-importer.d.ts +1 -0
- package/dist/types/jdl/models/jdl-application-configuration-factory.d.ts +1 -0
- package/dist/types/jdl/models/jdl-application-configuration-option.d.ts +2 -2
- package/dist/types/jdl/models/jdl-application-configuration.d.ts +8 -6
- package/dist/types/jdl/models/jdl-application-factory.d.ts +1 -1
- package/dist/types/jdl/models/jdl-application.d.ts +8 -4
- package/dist/types/jdl/models/jdl-object.d.ts +1 -1
- package/dist/types/jdl/models/list-jdl-application-configuration-option.d.ts +1 -1
- package/dist/types/jdl/parsing/jdl-ast-builder-visitor.d.ts +10 -0
- package/dist/types/jdl/parsing/jdl-parser.d.ts +3 -0
- package/dist/types/jdl/parsing/lexer/application-tokens.d.ts +1 -0
- package/dist/types/jdl/validators/entity-validator.d.ts +2 -2
- package/dist/types/jdl/validators/enum-validator.d.ts +2 -2
- package/dist/types/jdl/validators/validator.d.ts +4 -1
- package/package.json +31 -31
|
@@ -75,7 +75,6 @@ import java.util.*;
|
|
|
75
75
|
<%_ } _%>
|
|
76
76
|
<%_ if (searchEngineElasticsearch && !reactive) { _%>
|
|
77
77
|
import java.util.stream.StreamSupport;
|
|
78
|
-
import static org.springframework.data.elasticsearch.client.elc.QueryBuilders.*;
|
|
79
78
|
<%_ } _%>
|
|
80
79
|
|
|
81
80
|
@RestController
|
|
@@ -111,7 +110,7 @@ public class PublicUserResource {
|
|
|
111
110
|
}
|
|
112
111
|
|
|
113
112
|
/**
|
|
114
|
-
* {@code GET /users} : get all users with only
|
|
113
|
+
* {@code GET /users} : get all users with only public information - calling this method is allowed for anyone.
|
|
115
114
|
<%_ if (databaseTypeSql || databaseTypeMongodb || databaseTypeNeo4j || databaseTypeCouchbase) { _%>
|
|
116
115
|
*
|
|
117
116
|
<%_ if (reactive) { _%>
|
|
@@ -176,12 +175,12 @@ public class PublicUserResource {
|
|
|
176
175
|
<%_ if (searchEngineAny) { _%>
|
|
177
176
|
|
|
178
177
|
/**
|
|
179
|
-
* {@code SEARCH /_search
|
|
178
|
+
* {@code SEARCH /users/_search/:query} : search for the User corresponding to the query.
|
|
180
179
|
*
|
|
181
180
|
* @param query the query to search.
|
|
182
181
|
* @return the result of the search.
|
|
183
182
|
*/
|
|
184
|
-
@GetMapping("/_search/
|
|
183
|
+
@GetMapping("/users/_search/{query}")
|
|
185
184
|
public <% if(reactive) { %>Mono<<% } %>List<<%= user.dtoClass %>><% if(reactive) { %>><% } %> search(@PathVariable String query) {
|
|
186
185
|
<%_ if (searchEngineElasticsearch) { _%>
|
|
187
186
|
<%_ if (reactive) { _%>
|
package/dist/generators/server/templates/src/main/java/_package_/web/rest/UserResource.java.ejs
CHANGED
|
@@ -83,8 +83,6 @@ import java.util.*;
|
|
|
83
83
|
<%_ if (searchEngineElasticsearch && !reactive) { _%>
|
|
84
84
|
import java.util.stream.Collectors;
|
|
85
85
|
import java.util.stream.StreamSupport;
|
|
86
|
-
|
|
87
|
-
import static org.springframework.data.elasticsearch.client.elc.QueryBuilders.*;
|
|
88
86
|
<%_ } _%>
|
|
89
87
|
|
|
90
88
|
/**
|
|
@@ -149,13 +149,10 @@ _%>
|
|
|
149
149
|
|
|
150
150
|
private ProblemDetailWithCause getProblemDetailWithCause(Throwable ex) {
|
|
151
151
|
<%_ if (!skipUserManagement) { _%>
|
|
152
|
-
if(ex instanceof <%= packageName %>.service.
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return ProblemDetailWithCauseBuilder.instance()
|
|
157
|
-
.withStatus(201).build();
|
|
158
|
-
}
|
|
152
|
+
if(ex instanceof <%= packageName %>.service.UsernameAlreadyUsedException )
|
|
153
|
+
return (ProblemDetailWithCause) new LoginAlreadyUsedException().getBody();
|
|
154
|
+
if(ex instanceof <%= packageName %>.service.EmailAlreadyUsedException )
|
|
155
|
+
return (ProblemDetailWithCause) new EmailAlreadyUsedException().getBody();
|
|
159
156
|
if(ex instanceof <%= packageName %>.service.InvalidPasswordException )
|
|
160
157
|
return (ProblemDetailWithCause) new InvalidPasswordException().getBody();
|
|
161
158
|
|
|
@@ -433,15 +433,15 @@ if (field.fieldTypeString || field.blobContentTypeText) {
|
|
|
433
433
|
private static final String ENTITY_API_URL = "/api/<%= entityApiUrl %>";
|
|
434
434
|
private static final String ENTITY_API_URL_ID = ENTITY_API_URL + "/{<%= primaryKey.name %>}";
|
|
435
435
|
<%_ if (searchEngineAny) { _%>
|
|
436
|
-
private static final String ENTITY_SEARCH_API_URL = "/api
|
|
436
|
+
private static final String ENTITY_SEARCH_API_URL = "/api/<%= entityApiUrl %>/_search";
|
|
437
437
|
<%_ } _%>
|
|
438
438
|
<%_ if (!embedded && (primaryKey.hasLong || primaryKey.hasInteger)) { _%>
|
|
439
439
|
|
|
440
440
|
private static Random random = new Random();
|
|
441
441
|
<%_ if (primaryKey.hasLong) { _%>
|
|
442
|
-
private static AtomicLong
|
|
442
|
+
private static AtomicLong longCount = new AtomicLong(random.nextInt() + ( 2 * Integer.MAX_VALUE ));
|
|
443
443
|
<%_ } else if (primaryKey.hasInteger) { _%>
|
|
444
|
-
private static AtomicInteger
|
|
444
|
+
private static AtomicInteger intCount = new AtomicInteger(random.nextInt() + ( 2 * Short.MAX_VALUE ));
|
|
445
445
|
<%_ } _%>
|
|
446
446
|
<%_ } _%>
|
|
447
447
|
|
package/dist/generators/server/templates/src/test/java/_package_/web/rest/AccountResourceIT.java.ejs
CHANGED
|
@@ -529,14 +529,14 @@ class AccountResourceIT {
|
|
|
529
529
|
.contentType(MediaType.APPLICATION_JSON)
|
|
530
530
|
.bodyValue(TestUtil.convertObjectToJsonBytes(secondUser))
|
|
531
531
|
.exchange()
|
|
532
|
-
.expectStatus().
|
|
532
|
+
.expectStatus().isBadRequest();
|
|
533
533
|
<%_ } else { _%>
|
|
534
534
|
restAccountMockMvc.perform(
|
|
535
535
|
post("/api/register")
|
|
536
536
|
.contentType(MediaType.APPLICATION_JSON)
|
|
537
537
|
.content(TestUtil.convertObjectToJsonBytes(secondUser))<% if (authenticationUsesCsrf) { %>
|
|
538
538
|
.with(csrf())<% } %>)
|
|
539
|
-
.andExpect(status().
|
|
539
|
+
.andExpect(status().is4xxClientError());
|
|
540
540
|
<%_ } _%>
|
|
541
541
|
}
|
|
542
542
|
|
|
@@ -655,14 +655,14 @@ class AccountResourceIT {
|
|
|
655
655
|
.contentType(MediaType.APPLICATION_JSON)
|
|
656
656
|
.bodyValue(TestUtil.convertObjectToJsonBytes(secondUser))
|
|
657
657
|
.exchange()
|
|
658
|
-
.expectStatus().
|
|
658
|
+
.expectStatus().is4xxClientError();
|
|
659
659
|
<%_ } else { _%>
|
|
660
660
|
restAccountMockMvc.perform(
|
|
661
661
|
post("/api/register")
|
|
662
662
|
.contentType(MediaType.APPLICATION_JSON)
|
|
663
663
|
.content(TestUtil.convertObjectToJsonBytes(secondUser))<% if (authenticationUsesCsrf) { %>
|
|
664
664
|
.with(csrf())<% } %>)
|
|
665
|
-
.andExpect(status().
|
|
665
|
+
.andExpect(status().is4xxClientError());
|
|
666
666
|
<%_ } _%>
|
|
667
667
|
}
|
|
668
668
|
|
|
@@ -23,8 +23,6 @@ import <%= entityAbsolutePackage %>.repository.<%= persistClass %>Repository;
|
|
|
23
23
|
|
|
24
24
|
<%_ if (!paginationNo) { _%>
|
|
25
25
|
<%_ if (!reactive) { _%>
|
|
26
|
-
import java.util.List;
|
|
27
|
-
|
|
28
26
|
import org.springframework.data.domain.Page;
|
|
29
27
|
import org.springframework.data.domain.PageImpl;
|
|
30
28
|
import org.springframework.data.elasticsearch.core.SearchHits;
|
|
@@ -53,45 +53,11 @@ import org.springframework.data.neo4j.core.schema.Relationship;
|
|
|
53
53
|
<%_ } -%>
|
|
54
54
|
|
|
55
55
|
<%_ for (const relationship of relationships) { -%>
|
|
56
|
-
<%_ const relationshipForwardReference = "HAS_" + this._.toUpper(this._.snakeCase(relationship.relationshipName)); %>
|
|
57
|
-
<%_ const relationshipBackReference = "HAS_" + this._.toUpper(this._.snakeCase(relationship.otherEntityRelationshipName)); %>
|
|
58
56
|
<&_ if (fragment.relationship<%- relationship.relationshipNameCapitalized %>AnnotationSection) { -&>
|
|
59
|
-
<%_ if (relationship.
|
|
60
|
-
@Relationship(value = "<%=
|
|
57
|
+
<%_ if (relationship.relationshipLeftSide) { _%>
|
|
58
|
+
@Relationship(value = "HAS_<%= this._.toUpper(this._.snakeCase(relationship.relationshipName)) %>", direction = Relationship.Direction.OUTGOING)
|
|
61
59
|
<%_ } else { _%>
|
|
62
|
-
@Relationship("<%=
|
|
60
|
+
@Relationship(value = "IS_<%= this._.toUpper(this._.snakeCase(relationship.relationshipName)) %>_<%= this._.toUpper(this._.snakeCase(relationship.otherRelationship.relationshipName)) %>", direction = Relationship.Direction.INCOMING)
|
|
63
61
|
<%_ } _%>
|
|
64
62
|
<&_ } -&>
|
|
65
63
|
<%_ } -%>
|
|
66
|
-
|
|
67
|
-
<%_ for (const relationship of relationships) { _%>
|
|
68
|
-
<&_ if (fragment.relationship<%- relationship.relationshipNameCapitalized %>CustomAddSection) { -&>
|
|
69
|
-
public <%= persistClass %> add<%= relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistClass %> <%= relationship.otherEntityName %>) {
|
|
70
|
-
this.<%= relationship.relationshipFieldNamePlural %>.add(<%= relationship.otherEntityName %>);
|
|
71
|
-
<%_ if (!relationship.otherEntity.embedded || embedded && relationship.ownerSide) { _%>
|
|
72
|
-
<%_ if (relationship.otherRelationship) { _%>
|
|
73
|
-
<%_ if (relationship.otherRelationship.relationshipNamePlural && !relationship.otherEntityUser && relationship.otherRelationship.collection) { _%>
|
|
74
|
-
<%= relationship.otherEntityName %>.get<%= relationship.otherRelationship.relationshipNameCapitalizedPlural %>().add(this);
|
|
75
|
-
<%_ } _%>
|
|
76
|
-
<%_ } _%>
|
|
77
|
-
<%_ } _%>
|
|
78
|
-
return this;
|
|
79
|
-
}
|
|
80
|
-
<&_ } -&>
|
|
81
|
-
<%_ } -%>
|
|
82
|
-
|
|
83
|
-
<%_ for (const relationship of relationships) { _%>
|
|
84
|
-
<&_ if (fragment.relationship<%- relationship.relationshipNameCapitalized %>CustomRemoveSection) { -&>
|
|
85
|
-
public <%= persistClass %> remove<%= relationship.relationshipNameCapitalized %>(<%= relationship.otherEntity.persistClass %> <%= relationship.otherEntityName %>) {
|
|
86
|
-
this.<%= relationship.relationshipFieldNamePlural %>.remove(<%= relationship.otherEntityName %>);
|
|
87
|
-
<%_ if (!relationship.otherEntity.embedded || (embedded && relationship.ownerSide)) { _%>
|
|
88
|
-
<%_ if (relationship.otherRelationship) { _%>
|
|
89
|
-
<%_ if (!relationship.otherEntityUser && relationship.otherRelationship.collection) { _%>
|
|
90
|
-
<%= relationship.otherEntityName %>.get<%= relationship.otherRelationship.relationshipNameCapitalizedPlural %>().remove(this);
|
|
91
|
-
<%_ } _%>
|
|
92
|
-
<%_ } _%>
|
|
93
|
-
<%_ } _%>
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
<&_ } -&>
|
|
97
|
-
<%_ } _%>
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { relative } from 'path';
|
|
20
20
|
import chalk from 'chalk';
|
|
21
21
|
import * as _ from 'lodash-es';
|
|
22
|
-
import {
|
|
22
|
+
import { isFileStateModified } from 'mem-fs-editor/state';
|
|
23
23
|
import BaseApplicationGenerator from '../base-application/index.mjs';
|
|
24
24
|
import { fieldTypes, clientFrameworkTypes } from '../../jdl/jhipster/index.mjs';
|
|
25
25
|
import { GENERATOR_VUE, GENERATOR_CLIENT, GENERATOR_LANGUAGES } from '../generator-list.mjs';
|
|
@@ -86,6 +86,30 @@ export default class VueGenerator extends BaseApplicationGenerator {
|
|
|
86
86
|
get [BaseApplicationGenerator.PREPARING_EACH_ENTITY]() {
|
|
87
87
|
return this.delegateTasksToBlueprint(() => this.preparingEachEntity);
|
|
88
88
|
}
|
|
89
|
+
get default() {
|
|
90
|
+
return this.asDefaultTaskGroup({
|
|
91
|
+
async queueTranslateTransform({ control, application }) {
|
|
92
|
+
const { enableTranslation, clientSrcDir } = application;
|
|
93
|
+
const { getWebappTranslation } = control;
|
|
94
|
+
this.queueTransformStream({
|
|
95
|
+
name: 'translating vue application',
|
|
96
|
+
filter: file => isFileStateModified(file) && file.path.startsWith(this.destinationPath()) && isTranslatedVueFile(file),
|
|
97
|
+
refresh: false,
|
|
98
|
+
}, translateVueFilesTransform.call(this, { enableTranslation, getWebappTranslation }));
|
|
99
|
+
if (enableTranslation) {
|
|
100
|
+
const { transform, isTranslationFile } = convertTranslationsSupport({ clientSrcDir });
|
|
101
|
+
this.queueTransformStream({
|
|
102
|
+
name: 'converting vue translations',
|
|
103
|
+
filter: file => isFileStateModified(file) && file.path.startsWith(this.destinationPath()) && isTranslationFile(file),
|
|
104
|
+
refresh: false,
|
|
105
|
+
}, transform);
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
get [BaseApplicationGenerator.DEFAULT]() {
|
|
111
|
+
return this.asDefaultTaskGroup(this.delegateTasksToBlueprint(() => this.default));
|
|
112
|
+
}
|
|
89
113
|
get writing() {
|
|
90
114
|
return this.asWritingTaskGroup({
|
|
91
115
|
cleanupOldFilesTask,
|
|
@@ -100,21 +124,6 @@ export default class VueGenerator extends BaseApplicationGenerator {
|
|
|
100
124
|
cleanupEntitiesFiles,
|
|
101
125
|
writeEntitiesFiles,
|
|
102
126
|
writeEntityFiles,
|
|
103
|
-
async queueTranslateTransform({ control, application }) {
|
|
104
|
-
const { enableTranslation, clientSrcDir } = application;
|
|
105
|
-
const { getWebappTranslation } = control;
|
|
106
|
-
this.queueTransformStream(translateVueFilesTransform.call(this, { enableTranslation, getWebappTranslation }), {
|
|
107
|
-
name: 'translating webapp',
|
|
108
|
-
streamOptions: { filter: file => isFilePending(file) && isTranslatedVueFile(file) },
|
|
109
|
-
});
|
|
110
|
-
if (enableTranslation) {
|
|
111
|
-
const { transform, isTranslationFile } = convertTranslationsSupport({ clientSrcDir });
|
|
112
|
-
this.queueTransformStream(transform, {
|
|
113
|
-
name: 'converting translations',
|
|
114
|
-
streamOptions: { filter: file => isFilePending(file) && isTranslationFile(file) },
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
127
|
});
|
|
119
128
|
}
|
|
120
129
|
get [BaseApplicationGenerator.WRITING_ENTITIES]() {
|
|
@@ -6,23 +6,24 @@
|
|
|
6
6
|
"@vuelidate/core": "2.0.3",
|
|
7
7
|
"@vuelidate/validators": "2.0.4",
|
|
8
8
|
"@vueuse/core": "10.5.0",
|
|
9
|
-
"axios": "1.
|
|
9
|
+
"axios": "1.6.0",
|
|
10
10
|
"bootstrap": "4.6.2",
|
|
11
11
|
"bootstrap-vue": "2.23.1",
|
|
12
12
|
"bootswatch": "5.3.2",
|
|
13
13
|
"deepmerge": "4.3.1",
|
|
14
14
|
"js-cookie": "3.0.5",
|
|
15
|
-
"pinia": "2.1.
|
|
16
|
-
"vue": "3.3.
|
|
17
|
-
"vue-i18n": "9.
|
|
15
|
+
"pinia": "2.1.7",
|
|
16
|
+
"vue": "3.3.7",
|
|
17
|
+
"vue-i18n": "9.6.2",
|
|
18
18
|
"vue-router": "4.2.5"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
+
"@module-federation/utilities": "3.0.3-0",
|
|
21
22
|
"@pinia/testing": "0.1.3",
|
|
22
23
|
"@rushstack/eslint-patch": "1.5.1",
|
|
23
24
|
"@tsconfig/node18": "18.2.2",
|
|
24
|
-
"@types/node": "18.18.
|
|
25
|
-
"@types/sinon": "10.0.
|
|
25
|
+
"@types/node": "18.18.8",
|
|
26
|
+
"@types/sinon": "10.0.20",
|
|
26
27
|
"@vitejs/plugin-vue": "4.4.0",
|
|
27
28
|
"@vue/eslint-config-prettier": "8.0.0",
|
|
28
29
|
"@vue/eslint-config-typescript": "10.0.0",
|
|
@@ -34,12 +35,12 @@
|
|
|
34
35
|
"copy-webpack-plugin": "11.0.0",
|
|
35
36
|
"css-loader": "6.8.1",
|
|
36
37
|
"css-minimizer-webpack-plugin": "5.0.1",
|
|
37
|
-
"eslint": "8.
|
|
38
|
+
"eslint": "8.52.0",
|
|
38
39
|
"eslint-plugin-prettier": "5.0.1",
|
|
39
40
|
"eslint-plugin-vue": "8.7.1",
|
|
40
41
|
"flush-promises": "1.0.2",
|
|
41
42
|
"folder-hash": "4.0.4",
|
|
42
|
-
"happy-dom": "12.
|
|
43
|
+
"happy-dom": "12.10.3",
|
|
43
44
|
"html-webpack-plugin": "5.5.3",
|
|
44
45
|
"merge-jsons-webpack-plugin": "2.0.1",
|
|
45
46
|
"mini-css-extract-plugin": "2.7.6",
|
|
@@ -49,23 +50,23 @@
|
|
|
49
50
|
"postcss-url": "10.1.3",
|
|
50
51
|
"rimraf": "5.0.5",
|
|
51
52
|
"rollup-plugin-copy": "3.5.0",
|
|
52
|
-
"sass": "1.69.
|
|
53
|
+
"sass": "1.69.5",
|
|
53
54
|
"sass-loader": "13.3.2",
|
|
54
|
-
"sinon": "
|
|
55
|
+
"sinon": "17.0.1",
|
|
55
56
|
"terser-webpack-plugin": "5.3.9",
|
|
56
57
|
"ts-loader": "9.5.0",
|
|
57
58
|
"typescript": "5.2.2",
|
|
58
|
-
"vite": "4.
|
|
59
|
+
"vite": "4.5.0",
|
|
59
60
|
"vitest": "0.34.6",
|
|
60
|
-
"vitest-sonar-reporter": "0.
|
|
61
|
-
"vue-loader": "17.3.
|
|
61
|
+
"vitest-sonar-reporter": "0.5.0",
|
|
62
|
+
"vue-loader": "17.3.1",
|
|
62
63
|
"vue-style-loader": "4.1.3",
|
|
63
|
-
"vue-tsc": "1.8.
|
|
64
|
-
"webpack": "5.
|
|
64
|
+
"vue-tsc": "1.8.22",
|
|
65
|
+
"webpack": "5.89.0",
|
|
65
66
|
"webpack-bundle-analyzer": "4.9.1",
|
|
66
67
|
"webpack-cli": "5.1.4",
|
|
67
68
|
"webpack-dev-server": "4.15.1",
|
|
68
|
-
"webpack-merge": "5.
|
|
69
|
+
"webpack-merge": "5.10.0",
|
|
69
70
|
"workbox-webpack-plugin": "7.0.0"
|
|
70
71
|
}
|
|
71
72
|
}
|
|
@@ -55,6 +55,9 @@
|
|
|
55
55
|
"vue-router": "<%= nodeDependencies['vue-router'] %>"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
|
+
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
59
|
+
"@module-federation/utilities": "<%= nodeDependencies['@module-federation/utilities'] %>",
|
|
60
|
+
<%_ } _%>
|
|
58
61
|
<%_ if (microfrontend) { _%>
|
|
59
62
|
"@originjs/vite-plugin-federation": "1.2.3",
|
|
60
63
|
"browser-sync-webpack-plugin": "<%= nodeDependencies['browser-sync-webpack-plugin'] %>",
|
|
@@ -99,11 +102,6 @@
|
|
|
99
102
|
"numeral": "<%= nodeDependencies['numeral'] %>",
|
|
100
103
|
"postcss-import": "<%= nodeDependencies['postcss-import'] %>",
|
|
101
104
|
"postcss-url": "<%= nodeDependencies['postcss-url'] %>",
|
|
102
|
-
"prettier": "<%= nodeDependencies['prettier'] %>",
|
|
103
|
-
<%_ if (!skipServer) { _%>
|
|
104
|
-
"prettier-plugin-java": "<%= nodeDependencies['prettier-plugin-java'] %>",
|
|
105
|
-
<%_ } _%>
|
|
106
|
-
"prettier-plugin-packagejson": "<%= nodeDependencies['prettier-plugin-packagejson'] %>",
|
|
107
105
|
<%_ if (cypressTests) { _%>
|
|
108
106
|
"cypress": "<%= nodeDependencies['cypress'] %>",
|
|
109
107
|
<%_ } _%>
|
|
@@ -11,6 +11,9 @@ import EntitiesMenu from '@/entities/entities-menu.vue';
|
|
|
11
11
|
|
|
12
12
|
import { useStore } from '@/store';
|
|
13
13
|
import { useRouter } from 'vue-router';
|
|
14
|
+
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
15
|
+
import { importRemote } from '@module-federation/utilities';
|
|
16
|
+
<%_ } _%>
|
|
14
17
|
|
|
15
18
|
export default defineComponent({
|
|
16
19
|
compatConfig: { MODE: 3 },
|
|
@@ -18,9 +21,13 @@ export default defineComponent({
|
|
|
18
21
|
components: {
|
|
19
22
|
'entities-menu': EntitiesMenu,
|
|
20
23
|
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
21
|
-
<%_ for (const
|
|
22
|
-
'<%=
|
|
23
|
-
return
|
|
24
|
+
<%_ for (const remote of microfrontends) { _%>
|
|
25
|
+
'<%= remote.lowercaseBaseName %>-menu': defineAsyncComponent(() => {
|
|
26
|
+
return importRemote<any>({
|
|
27
|
+
url: `./<%= remote.endpointPrefix %>`,
|
|
28
|
+
scope: '<%= remote.lowercaseBaseName %>',
|
|
29
|
+
module: './entities-menu',
|
|
30
|
+
}).catch(() => import('@/core/error/error-loading.vue'));
|
|
24
31
|
}),
|
|
25
32
|
<%_ } _%>
|
|
26
33
|
<%_ } _%>
|
package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs
CHANGED
|
@@ -177,7 +177,7 @@
|
|
|
177
177
|
Navbar
|
|
178
178
|
========================================================================== */
|
|
179
179
|
.navbar-version {
|
|
180
|
-
font-size:
|
|
180
|
+
font-size: 0.65em;
|
|
181
181
|
<%_ if (clientThemeNone) { _%>
|
|
182
182
|
color: #ccc;
|
|
183
183
|
<%_ } _%>
|
|
@@ -243,7 +243,6 @@
|
|
|
243
243
|
|
|
244
244
|
.navbar-title {
|
|
245
245
|
display: inline-block;
|
|
246
|
-
vertical-align: middle;
|
|
247
246
|
<%_ if (clientThemeNone && !clientThemeDark) { _%>
|
|
248
247
|
color: white;
|
|
249
248
|
<%_ } _%>
|
|
@@ -253,14 +252,14 @@
|
|
|
253
252
|
Logo styles
|
|
254
253
|
========================================================================== */
|
|
255
254
|
.navbar-brand.logo {
|
|
256
|
-
padding:
|
|
255
|
+
padding: 0 7px;
|
|
257
256
|
}
|
|
258
257
|
|
|
259
258
|
.logo .logo-img {
|
|
260
259
|
height: 45px;
|
|
261
260
|
display: inline-block;
|
|
262
261
|
vertical-align: middle;
|
|
263
|
-
width:
|
|
262
|
+
width: 45px;
|
|
264
263
|
}
|
|
265
264
|
|
|
266
265
|
.logo-img {
|
|
@@ -6,7 +6,7 @@ import { type I<%= entityAngularName %> } from '@/shared/model/<%= entityModelFi
|
|
|
6
6
|
|
|
7
7
|
const baseApiUrl = '<%= entityApi %>api/<%= entityApiUrl %>';
|
|
8
8
|
<%_ if (searchEngineAny) { _%>
|
|
9
|
-
const baseSearchApiUrl = '<%= entityApi %>api
|
|
9
|
+
const baseSearchApiUrl = '<%= entityApi %>api/<%= entityApiUrl %>/_search?query=';
|
|
10
10
|
<%_ } _%>
|
|
11
11
|
|
|
12
12
|
export default class <%= entityAngularName %>Service {
|
|
@@ -127,18 +127,30 @@
|
|
|
127
127
|
<%_ } _%>
|
|
128
128
|
<td class="text-right">
|
|
129
129
|
<div class="btn-group">
|
|
130
|
+
<%_ if (authenticationTypeSession) { _%>
|
|
131
|
+
<router-link :to="{name: '<%= entityAngularName %>View', params: {<%= entityInstance %>Id: <%= entityInstance %>.id}}" class="btn btn-info btn-sm details" data-cy="entityDetailsButton">
|
|
132
|
+
<%_ } else { _%>
|
|
130
133
|
<router-link :to="{name: '<%= entityAngularName %>View', params: {<%= entityInstance %>Id: <%= entityInstance %>.id}}" custom v-slot="{ navigate }">
|
|
131
134
|
<button @click="navigate" class="btn btn-info btn-sm details" data-cy="entityDetailsButton">
|
|
135
|
+
<%_ } _%>
|
|
132
136
|
<font-awesome-icon icon="eye"></font-awesome-icon>
|
|
133
137
|
<span class="d-none d-md-inline" v-text="t$('entity.action.view')">View</span>
|
|
138
|
+
<%_ if (!authenticationTypeSession) { _%>
|
|
134
139
|
</button>
|
|
140
|
+
<%_ } _%>
|
|
135
141
|
</router-link>
|
|
136
142
|
<%_ if (!readOnly) { _%>
|
|
143
|
+
<%_ if (authenticationTypeSession) { _%>
|
|
144
|
+
<router-link :to="{name: '<%= entityAngularName %>Edit', params: {<%= entityInstance %>Id: <%= entityInstance %>.id}}" class="btn btn-primary btn-sm edit" data-cy="entityEditButton">
|
|
145
|
+
<%_ } else { _%>
|
|
137
146
|
<router-link :to="{name: '<%= entityAngularName %>Edit', params: {<%= entityInstance %>Id: <%= entityInstance %>.id}}" custom v-slot="{ navigate }">
|
|
138
147
|
<button @click="navigate" class="btn btn-primary btn-sm edit" data-cy="entityEditButton">
|
|
148
|
+
<%_ } _%>
|
|
139
149
|
<font-awesome-icon icon="pencil-alt"></font-awesome-icon>
|
|
140
150
|
<span class="d-none d-md-inline" v-text="t$('entity.action.edit')">Edit</span>
|
|
151
|
+
<%_ if (!authenticationTypeSession) { _%>
|
|
141
152
|
</button>
|
|
153
|
+
<%_ } _%>
|
|
142
154
|
</router-link>
|
|
143
155
|
<b-button v-on:click="prepareRemove(<%= entityInstance %>)"
|
|
144
156
|
variant="danger"
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { createRouter as createVueRouter, createWebHistory<% if (applicationTypeGateway && microfrontend) { %>, type RouteRecordRaw<% } %> } from 'vue-router';
|
|
2
|
+
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
3
|
+
import { importRemote } from '@module-federation/utilities';
|
|
4
|
+
<%_ } _%>
|
|
2
5
|
|
|
3
6
|
const Home = () => import('@/core/home/home.vue');
|
|
4
7
|
const Error = () => import('@/core/error/error.vue');
|
|
@@ -43,7 +46,11 @@ const router = createRouter();
|
|
|
43
46
|
<%_ if (applicationTypeGateway && microfrontend) { _%>
|
|
44
47
|
export const lazyRoutes = Promise.all([
|
|
45
48
|
<%_ for (const remote of microfrontends) { _%>
|
|
46
|
-
|
|
49
|
+
importRemote<any>({
|
|
50
|
+
url: `./<%= remote.endpointPrefix %>`,
|
|
51
|
+
scope: '<%= remote.lowercaseBaseName %>',
|
|
52
|
+
module: './entities-router',
|
|
53
|
+
})
|
|
47
54
|
.then(<%= remote.lowercaseBaseName %>Router => {
|
|
48
55
|
router.addRoute(<%= remote.lowercaseBaseName %>Router.default as RouteRecordRaw);
|
|
49
56
|
return <%= remote.lowercaseBaseName %>Router.default;
|
|
@@ -21,14 +21,19 @@
|
|
|
21
21
|
const { DefinePlugin } = require('webpack');
|
|
22
22
|
<%_ } _%>
|
|
23
23
|
<&_ } -&>
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
24
|
+
|
|
25
|
+
<&_ if (fragment.configSection) { -&>
|
|
26
|
+
<%_ if (applicationTypeGateway && clientFrameworkVue) { _%>
|
|
27
|
+
resolve: {
|
|
28
|
+
fallback: {
|
|
29
|
+
// Workaround https://github.com/module-federation/universe/issues/1575
|
|
30
|
+
path: false,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
31
33
|
<%_ } _%>
|
|
34
|
+
<&_ } -&>
|
|
35
|
+
|
|
36
|
+
<&_ if (fragment.moduleFederationSection) { -&>
|
|
32
37
|
<%_ if (applicationTypeMicroservice) { _%>
|
|
33
38
|
exposes: {
|
|
34
39
|
'./entities-router': './<%= this.relativeDir(clientRootDir, clientSrcDir) %>app/router/entities',
|
|
@@ -36,35 +41,15 @@ const { DefinePlugin } = require('webpack');
|
|
|
36
41
|
},
|
|
37
42
|
<%_ } _%>
|
|
38
43
|
shared: {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
'vue-i18n': { singleton: true, shareScope: 'default' },
|
|
46
|
-
'vue-router': { singleton: true, shareScope: 'default' },
|
|
47
|
-
pinia: { singleton: true, shareScope: 'default' },
|
|
48
|
-
'@/shared/security/authority': {
|
|
49
|
-
singleton: true,
|
|
50
|
-
shareScope: 'default',
|
|
51
|
-
import: '@/shared/security/authority',
|
|
52
|
-
requiredVersion: appVersion,
|
|
53
|
-
},
|
|
54
|
-
'@/shared/alert/alert.service': {
|
|
55
|
-
singleton: true,
|
|
56
|
-
shareScope: 'default',
|
|
57
|
-
import: '@/shared/alert/alert.service',
|
|
58
|
-
requiredVersion: appVersion,
|
|
59
|
-
},
|
|
60
|
-
'@/locale/translation.service': {
|
|
61
|
-
singleton: true,
|
|
62
|
-
shareScope: 'default',
|
|
63
|
-
import: '@/locale/translation.service',
|
|
64
|
-
requiredVersion: appVersion,
|
|
65
|
-
},
|
|
44
|
+
...shareDependencies(),
|
|
45
|
+
...shareMappings(
|
|
46
|
+
'@/shared/security/authority',
|
|
47
|
+
'@/shared/alert/alert.service',
|
|
48
|
+
'@/locale/translation.service',
|
|
49
|
+
),
|
|
66
50
|
},
|
|
67
51
|
<&_ } -&>
|
|
52
|
+
|
|
68
53
|
<&_ if (fragment.pluginsSection) { -&>
|
|
69
54
|
<%_ if (applicationTypeMicroservice) { _%>
|
|
70
55
|
new DefinePlugin({
|
|
@@ -91,7 +91,7 @@ function getJSONOptionKeyAndValue(jdlOption) {
|
|
|
91
91
|
case FILTER:
|
|
92
92
|
return { key: 'jpaMetamodelFiltering', value: true };
|
|
93
93
|
default:
|
|
94
|
-
return { key: jdlOption.name, value: jdlOption.
|
|
94
|
+
return { key: jdlOption.name, value: jdlOption.getType() === 'UNARY' ? true : jdlOption.value };
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
function preventEntitiesFromBeingSearched(entityNames) {
|
|
@@ -101,7 +101,7 @@ function preventEntitiesFromBeingSearched(entityNames) {
|
|
|
101
101
|
}
|
|
102
102
|
function setOptionToEntityName(option, entityName) {
|
|
103
103
|
const { optionName, optionValue } = option;
|
|
104
|
-
const optionContentForEntity = convertedOptionContent.get(entityName)
|
|
104
|
+
const optionContentForEntity = convertedOptionContent.get(entityName) ?? {};
|
|
105
105
|
optionContentForEntity[optionName] = optionValue;
|
|
106
106
|
convertedOptionContent.set(entityName, optionContentForEntity);
|
|
107
107
|
}
|
|
@@ -53,7 +53,7 @@ function getRelatedRelationships(relationships, entityNames) {
|
|
|
53
53
|
relationshipsRelatedToEntity.from.push(jdlRelationship);
|
|
54
54
|
}
|
|
55
55
|
if (jdlRelationship.to === entityName &&
|
|
56
|
-
(jdlRelationship.injectedFieldInTo || Object.keys(jdlRelationship.options.
|
|
56
|
+
(jdlRelationship.injectedFieldInTo || Object.keys(jdlRelationship.options.source).length !== 0)) {
|
|
57
57
|
relationshipsRelatedToEntity.to.push(jdlRelationship);
|
|
58
58
|
}
|
|
59
59
|
});
|
|
@@ -36,7 +36,7 @@ export default {
|
|
|
36
36
|
*/
|
|
37
37
|
export function convert(args = {}) {
|
|
38
38
|
if (!args.jdlObject || !args.applicationName || !args.databaseType) {
|
|
39
|
-
throw new Error("The JDL object, the application's name and its the database type are mandatory.");
|
|
39
|
+
throw new Error("The JDL object, the application's name, and its the database type are mandatory.");
|
|
40
40
|
}
|
|
41
41
|
init(args);
|
|
42
42
|
setBasicEntityInformation();
|
|
@@ -31,8 +31,7 @@ export function convertApplications(parsedApplications) {
|
|
|
31
31
|
throw new Error('Applications have to be passed so as to be converted.');
|
|
32
32
|
}
|
|
33
33
|
return parsedApplications.map(parsedApplication => {
|
|
34
|
-
const
|
|
35
|
-
const jdlApplication = createJDLApplication(formattedApplicationConfiguration);
|
|
34
|
+
const jdlApplication = createJDLApplication(parsedApplication.config, parsedApplication.namespaceConfigs);
|
|
36
35
|
jdlApplication.addEntityNames(parsedApplication.entities);
|
|
37
36
|
const entityOptions = getEntityOptionsInApplication(parsedApplication);
|
|
38
37
|
checkEntityNamesInOptions(jdlApplication.getConfigurationOptionValue(BASE_NAME), entityOptions, parsedApplication.entities);
|
|
@@ -40,21 +39,6 @@ export function convertApplications(parsedApplications) {
|
|
|
40
39
|
return jdlApplication;
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
|
-
function formatApplicationConfigurationOptions(applicationConfiguration) {
|
|
44
|
-
const formattedOptions = {};
|
|
45
|
-
if (Array.isArray(applicationConfiguration.blueprints)) {
|
|
46
|
-
formattedOptions.blueprints = applicationConfiguration.blueprints.map(blueprintName => {
|
|
47
|
-
if (!/^generator-jhipster-/.test(blueprintName)) {
|
|
48
|
-
return `generator-jhipster-${blueprintName}`;
|
|
49
|
-
}
|
|
50
|
-
return blueprintName;
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
return {
|
|
54
|
-
...applicationConfiguration,
|
|
55
|
-
...formattedOptions,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
42
|
function getEntityOptionsInApplication(parsedApplication) {
|
|
59
43
|
return convertOptions(parsedApplication.options, parsedApplication.useOptions);
|
|
60
44
|
}
|
|
@@ -51,7 +51,10 @@ function setUpApplicationStructure(application) {
|
|
|
51
51
|
[GENERATOR_NAME]: {},
|
|
52
52
|
};
|
|
53
53
|
applicationToExport[GENERATOR_NAME] = getApplicationConfig(application);
|
|
54
|
-
|
|
54
|
+
if (application.namespaceConfigs.length > 0) {
|
|
55
|
+
applicationToExport.namespaceConfigs = getApplicationNamespaceConfig(application);
|
|
56
|
+
}
|
|
57
|
+
applicationToExport[GENERATOR_NAME].entities = application.getEntityNames();
|
|
55
58
|
if (application.hasConfigurationOption('creationTimestamp')) {
|
|
56
59
|
applicationToExport[GENERATOR_NAME].creationTimestamp = parseInt(application.getConfigurationOptionValue('creationTimestamp'), 10);
|
|
57
60
|
}
|
|
@@ -65,6 +68,19 @@ function getApplicationConfig(application) {
|
|
|
65
68
|
});
|
|
66
69
|
return result;
|
|
67
70
|
}
|
|
71
|
+
function getApplicationNamespaceConfig(application) {
|
|
72
|
+
if (application.namespaceConfigs.length === 0) {
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
const result = {};
|
|
76
|
+
application.forEachNamespaceConfiguration(configurationOption => {
|
|
77
|
+
result[configurationOption.namespace] = result[configurationOption.namespace] ?? {};
|
|
78
|
+
configurationOption.forEachOption(option => {
|
|
79
|
+
result[configurationOption.namespace][option.name] = option.getValue();
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
return result;
|
|
83
|
+
}
|
|
68
84
|
function cleanUpOptions(application) {
|
|
69
85
|
if (!application[GENERATOR_NAME].frontEndBuilder) {
|
|
70
86
|
delete application[GENERATOR_NAME].frontEndBuilder;
|