generator-jhipster 8.10.0 → 8.11.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.
Files changed (130) hide show
  1. package/README.md +1 -1
  2. package/dist/cli/cli.mjs +0 -13
  3. package/dist/cli/environment-builder.mjs +3 -1
  4. package/dist/generators/angular/resources/package.json +18 -18
  5. package/dist/generators/angular/templates/README.md.jhi.client.angular.ejs +1 -1
  6. package/dist/generators/angular/templates/eslint.config.js.jhi.angular.ejs +4 -6
  7. package/dist/generators/angular/templates/src/main/webapp/app/admin/user-management/list/user-management.component.html.ejs +1 -1
  8. package/dist/generators/angular/templates/src/main/webapp/app/core/tracker/tracker.service.ts.ejs +1 -1
  9. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/list/_entityFile_.component.html.ejs +1 -1
  10. package/dist/generators/angular/templates/src/main/webapp/app/entities/_entityFolder_/update/_entityFile_-update.component.html.ejs +1 -1
  11. package/dist/generators/angular/templates/src/main/webapp/app/shared/sort/sort.service.ts.ejs +3 -3
  12. package/dist/generators/base/api.d.ts +3 -1
  13. package/dist/generators/base/shared-data.js +1 -0
  14. package/dist/generators/base/support/contents.d.ts +10 -1
  15. package/dist/generators/base/support/contents.js +9 -0
  16. package/dist/generators/base/support/index.d.ts +1 -0
  17. package/dist/generators/base/support/index.js +1 -0
  18. package/dist/generators/base/support/needles.js +2 -6
  19. package/dist/generators/base/support/os.d.ts +1 -0
  20. package/dist/generators/base/support/os.js +20 -0
  21. package/dist/generators/base/support/write-files.d.ts +18 -0
  22. package/dist/generators/base/support/write-files.js +0 -26
  23. package/dist/generators/base-core/generator.js +7 -4
  24. package/dist/generators/bootstrap/generator.js +31 -2
  25. package/dist/generators/bootstrap/support/auto-crlf-transform.js +2 -2
  26. package/dist/generators/bootstrap-application-base/generator.js +1 -3
  27. package/dist/generators/client/resources/package.json +4 -4
  28. package/dist/generators/common/resources/package.json +1 -1
  29. package/dist/generators/cypress/templates/src/test/javascript/cypress/e2e/account/logout.cy.ts.ejs +11 -3
  30. package/dist/generators/cypress/templates/src/test/javascript/cypress/support/oauth2.ts.ejs +4 -4
  31. package/dist/generators/generate-blueprint/resources/package.json +2 -2
  32. package/dist/generators/generator-constants.d.ts +1 -1
  33. package/dist/generators/generator-constants.js +1 -1
  34. package/dist/generators/gradle/templates/gradle/wrapper/gradle-wrapper.properties +1 -1
  35. package/dist/generators/init/resources/.node-version +1 -1
  36. package/dist/generators/java/generators/graalvm/internal/constants.d.ts +1 -1
  37. package/dist/generators/java/generators/graalvm/internal/constants.js +1 -1
  38. package/dist/generators/java/generators/node/generator.js +2 -1
  39. package/dist/generators/javascript/generators/eslint/templates/eslint.config.js.jhi.ejs +8 -0
  40. package/dist/generators/javascript/resources/package.json +3 -3
  41. package/dist/generators/languages/support/languages.js +1 -0
  42. package/dist/generators/languages/templates/entity/i18n/entity_he.json.ejs +78 -0
  43. package/dist/generators/languages/templates/src/main/resources/i18n/messages_he.properties.ejs +41 -0
  44. package/dist/generators/languages/templates/src/main/webapp/i18n/he/activate.json.ejs +27 -0
  45. package/dist/generators/languages/templates/src/main/webapp/i18n/he/configuration.json +11 -0
  46. package/dist/generators/languages/templates/src/main/webapp/i18n/he/error.json +15 -0
  47. package/dist/generators/languages/templates/src/main/webapp/i18n/he/gateway.json +16 -0
  48. package/dist/generators/languages/templates/src/main/webapp/i18n/he/global.json.ejs +172 -0
  49. package/dist/generators/languages/templates/src/main/webapp/i18n/he/health.json.ejs +75 -0
  50. package/dist/generators/languages/templates/src/main/webapp/i18n/he/home.json.ejs +20 -0
  51. package/dist/generators/languages/templates/src/main/webapp/i18n/he/login.json +20 -0
  52. package/dist/generators/languages/templates/src/main/webapp/i18n/he/logs.json +12 -0
  53. package/dist/generators/languages/templates/src/main/webapp/i18n/he/metrics.json +103 -0
  54. package/dist/generators/languages/templates/src/main/webapp/i18n/he/password.json +13 -0
  55. package/dist/generators/languages/templates/src/main/webapp/i18n/he/register.json +25 -0
  56. package/dist/generators/languages/templates/src/main/webapp/i18n/he/reset.json.ejs +45 -0
  57. package/dist/generators/languages/templates/src/main/webapp/i18n/he/sessions.json +16 -0
  58. package/dist/generators/languages/templates/src/main/webapp/i18n/he/settings.json +33 -0
  59. package/dist/generators/languages/templates/src/main/webapp/i18n/he/tracker.json +13 -0
  60. package/dist/generators/languages/templates/src/main/webapp/i18n/he/user-management.json +32 -0
  61. package/dist/generators/languages/templates/src/test/resources/i18n/messages_he.properties.ejs +4 -0
  62. package/dist/generators/react/resources/package.json +23 -23
  63. package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_-delete-dialog.tsx.ejs +2 -1
  64. package/dist/generators/react/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.reducer.ts.ejs +4 -4
  65. package/dist/generators/react/templates/src/main/webapp/app/modules/administration/administration.reducer.spec.ts.ejs +0 -6
  66. package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/application-profile.spec.ts.ejs +0 -6
  67. package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/locale.spec.ts.ejs +0 -47
  68. package/dist/generators/react/templates/src/main/webapp/app/shared/reducers/reducer.utils.ts.ejs +1 -1
  69. package/dist/generators/react/templates/src/main/webapp/app/shared/util/entity-utils.ts.ejs +1 -1
  70. package/dist/generators/server/resources/Dockerfile +11 -11
  71. package/dist/generators/server/resources/gradle/libs.versions.toml +6 -6
  72. package/dist/generators/server/resources/pom.xml +7 -7
  73. package/dist/generators/spring-boot/generator.js +2 -3
  74. package/dist/generators/spring-boot/resources/spring-boot-dependencies.pom +115 -105
  75. package/dist/generators/spring-boot/templates/src/main/java/_package_/config/SecurityJwtConfiguration.java.ejs +0 -1
  76. package/dist/generators/spring-boot/templates/src/main/java/_package_/security/DomainUserDetailsService.java.ejs +61 -5
  77. package/dist/generators/spring-boot/templates/src/main/java/_package_/security/SecurityUtils.java.ejs +29 -1
  78. package/dist/generators/spring-boot/templates/src/main/java/_package_/web/rest/AuthenticateController.java.ejs +11 -5
  79. package/dist/generators/spring-boot/templates/src/test/java/_package_/security/SecurityUtilsUnitTest_imperative.java.ejs +35 -11
  80. package/dist/generators/spring-boot/templates/src/test/java/_package_/security/SecurityUtilsUnitTest_reactive.java.ejs +35 -6
  81. package/dist/generators/spring-boot/templates/src/test/java/_package_/security/jwt/JwtAuthenticationTestUtils.java.ejs +3 -2
  82. package/dist/generators/spring-cache/resources/gradle/libs.versions.toml +1 -1
  83. package/dist/generators/vue/cleanup.js +7 -1
  84. package/dist/generators/vue/files-vue.js +3 -8
  85. package/dist/generators/vue/resources/package.json +20 -20
  86. package/dist/generators/vue/templates/src/main/webapp/app/account/account.service.ts.ejs +9 -9
  87. package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.component.spec.ts.ejs +21 -7
  88. package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.component.ts.ejs +23 -9
  89. package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.service.ts.ejs +1 -1
  90. package/dist/generators/vue/templates/src/main/webapp/app/account/activate/activate.vue.ejs +1 -1
  91. package/dist/generators/vue/templates/src/main/webapp/app/account/change-password/change-password.vue.ejs +1 -1
  92. package/dist/generators/vue/templates/src/main/webapp/app/account/login-form/login-form.component.spec.ts.ejs +22 -10
  93. package/dist/generators/vue/templates/src/main/webapp/app/account/login-form/login-form.component.ts.ejs +24 -5
  94. package/dist/generators/vue/templates/src/main/webapp/app/account/login-modal.ts.ejs +38 -0
  95. package/dist/generators/vue/templates/src/main/webapp/app/account/login.service.spec.ts.ejs +0 -4
  96. package/dist/generators/vue/templates/src/main/webapp/app/account/login.service.ts.ejs +3 -25
  97. package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.component.spec.ts.ejs +24 -8
  98. package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.component.ts.ejs +23 -9
  99. package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.service.ts.ejs +1 -1
  100. package/dist/generators/vue/templates/src/main/webapp/app/account/register/register.vue.ejs +1 -1
  101. package/dist/generators/vue/templates/src/main/webapp/app/account/reset-password/finish/reset-password-finish.component.spec.ts.ejs +20 -4
  102. package/dist/generators/vue/templates/src/main/webapp/app/account/reset-password/finish/reset-password-finish.component.ts.ejs +23 -13
  103. package/dist/generators/vue/templates/src/main/webapp/app/account/reset-password/finish/reset-password-finish.vue.ejs +1 -1
  104. package/dist/generators/vue/templates/src/main/webapp/app/account/settings/settings.vue.ejs +1 -1
  105. package/dist/generators/vue/templates/src/main/webapp/app/admin/configuration/configuration.service.ts.ejs +2 -2
  106. package/dist/generators/vue/templates/src/main/webapp/app/admin/gateway/gateway.service.ts.ejs +1 -1
  107. package/dist/generators/vue/templates/src/main/webapp/app/admin/health/health.service.ts.ejs +10 -10
  108. package/dist/generators/vue/templates/src/main/webapp/app/admin/logs/logs.service.ts.ejs +2 -2
  109. package/dist/generators/vue/templates/src/main/webapp/app/admin/metrics/metrics-modal.vue.ejs +2 -2
  110. package/dist/generators/vue/templates/src/main/webapp/app/admin/metrics/metrics.service.ts.ejs +2 -2
  111. package/dist/generators/vue/templates/src/main/webapp/app/admin/tracker/tracker.service.ts.ejs +5 -5
  112. package/dist/generators/vue/templates/src/main/webapp/app/admin/user-management/user-management.service.ts.ejs +6 -6
  113. package/dist/generators/vue/templates/src/main/webapp/app/app.component.ts.ejs +29 -7
  114. package/dist/generators/vue/templates/src/main/webapp/app/app.vue.ejs +19 -1
  115. package/dist/generators/vue/templates/src/main/webapp/app/core/error/error.component.spec.ts.ejs +66 -51
  116. package/dist/generators/vue/templates/src/main/webapp/app/core/error/error.component.ts.ejs +30 -8
  117. package/dist/generators/vue/templates/src/main/webapp/app/core/home/home.component.spec.ts.ejs +41 -11
  118. package/dist/generators/vue/templates/src/main/webapp/app/core/home/home.component.ts.ejs +10 -11
  119. package/dist/generators/vue/templates/src/main/webapp/app/core/home/home.vue.ejs +2 -2
  120. package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.spec.ts.ejs +43 -16
  121. package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.component.ts.ejs +14 -9
  122. package/dist/generators/vue/templates/src/main/webapp/app/core/jhi-navbar/jhi-navbar.vue.ejs +1 -1
  123. package/dist/generators/vue/templates/src/main/webapp/app/entities/_entityFolder_/_entityFile_.service.ts.ejs +7 -7
  124. package/dist/generators/vue/templates/src/main/webapp/app/entities/user/user.service.ts.ejs +1 -1
  125. package/dist/generators/vue/templates/src/main/webapp/app/locale/translation.service.ts.ejs +5 -5
  126. package/dist/generators/vue/templates/src/main/webapp/app/main.ts.ejs +18 -14
  127. package/dist/generators/vue/templates/src/main/webapp/app/shared/alert/alert.service.ts.ejs +4 -4
  128. package/dist/lib/testing/apply-patch-to-template.d.ts +13 -0
  129. package/dist/lib/testing/apply-patch-to-template.js +90 -0
  130. package/package.json +26 -26
@@ -1,30 +1,30 @@
1
1
  import axios, { type AxiosPromise } from 'axios';
2
2
 
3
3
  export default class HealthService {
4
- public separator: string;
4
+ separator: string;
5
5
 
6
6
  constructor() {
7
7
  this.separator = '.';
8
8
  }
9
9
 
10
- public checkHealth(): AxiosPromise<any> {
10
+ checkHealth(): AxiosPromise<any> {
11
11
  return axios.get('management/health');
12
12
  }
13
13
 
14
- public transformHealthData(data: any): any {
14
+ transformHealthData(data: any): any {
15
15
  const response = [];
16
16
  this.flattenHealthData(response, null, data.components);
17
17
  return response;
18
18
  }
19
19
 
20
- public getBaseName(name: string): string {
20
+ getBaseName(name: string): string {
21
21
  if (name) {
22
22
  const split = name.split('.');
23
23
  return split[0];
24
24
  }
25
25
  }
26
26
 
27
- public getSubSystemName(name: string): string {
27
+ getSubSystemName(name: string): string {
28
28
  if (name) {
29
29
  const split = name.split('.');
30
30
  split.splice(0, 1);
@@ -33,7 +33,7 @@ export default class HealthService {
33
33
  }
34
34
  }
35
35
 
36
- public addHealthObject(result: any, isLeaf: boolean, healthObject: any, name: string) {
36
+ addHealthObject(result: any, isLeaf: boolean, healthObject: any, name: string) {
37
37
  const healthData = {
38
38
  name,
39
39
  details: undefined,
@@ -69,7 +69,7 @@ export default class HealthService {
69
69
  return healthData;
70
70
  }
71
71
 
72
- public flattenHealthData(result: any, path: any, data: any): any {
72
+ flattenHealthData(result: any, path: any, data: any): any {
73
73
  for (const key in data) {
74
74
  if (Object.hasOwn(data, key)) {
75
75
  const value = data[key];
@@ -86,7 +86,7 @@ export default class HealthService {
86
86
  return result;
87
87
  }
88
88
 
89
- public getModuleName(path: any, name: string) {
89
+ getModuleName(path: any, name: string) {
90
90
  if (path && name) {
91
91
  return path + this.separator + name;
92
92
  } else if (path) {
@@ -97,7 +97,7 @@ export default class HealthService {
97
97
  return '';
98
98
  }
99
99
 
100
- public hasSubSystem(healthObject: any): any {
100
+ hasSubSystem(healthObject: any): any {
101
101
  let result = false;
102
102
 
103
103
  for (const key in healthObject) {
@@ -111,7 +111,7 @@ export default class HealthService {
111
111
  return result;
112
112
  }
113
113
 
114
- public isHealthObject(healthObject: any): any {
114
+ isHealthObject(healthObject: any): any {
115
115
  let result = false;
116
116
 
117
117
  for (const key in healthObject) {
@@ -1,11 +1,11 @@
1
1
  import axios, { type AxiosPromise } from 'axios';
2
2
 
3
3
  export default class LogsService {
4
- public changeLevel(name: string, configuredLevel: string): AxiosPromise<any> {
4
+ changeLevel(name: string, configuredLevel: string): AxiosPromise<any> {
5
5
  return axios.post(`management/loggers/${name}`, { configuredLevel });
6
6
  }
7
7
 
8
- public findAll(): AxiosPromise<any> {
8
+ findAll(): AxiosPromise<any> {
9
9
  return axios.get('management/loggers');
10
10
  }
11
11
  }
@@ -18,7 +18,7 @@
18
18
  <div class="mt-2">&nbsp;</div>
19
19
  Filter
20
20
  <input type="text" v-model="threadDumpFilter" class="form-control" />
21
- <div class="pad" v-for="(entry, key) of filteredThreadDump" :key="key">
21
+ <div class="pad" v-for="(entry, key1) of filteredThreadDump" :key="key1">
22
22
  <h6>
23
23
  <span class="badge" :class="getBadgeClass(entry.threadState)">{{ entry.threadState }}</span
24
24
  >&nbsp;{{ entry.threadName }} (ID {{ entry.threadId }})
@@ -29,7 +29,7 @@
29
29
  </h6>
30
30
  <div class="card" :hidden="!entry.show">
31
31
  <div class="card-body">
32
- <div v-for="(st, key) of entry.stackTrace" :key="key" class="break">
32
+ <div v-for="(st, key2) of entry.stackTrace" :key="key2" class="break">
33
33
  <samp
34
34
  >{{ st.className }}.{{ st.methodName }}(<code>{{ st.fileName }}:{{ st.lineNumber }}</code
35
35
  >)</samp
@@ -1,11 +1,11 @@
1
1
  import axios, { type AxiosPromise } from 'axios';
2
2
 
3
3
  export default class MetricsService {
4
- public getMetrics(): AxiosPromise<any> {
4
+ getMetrics(): AxiosPromise<any> {
5
5
  return axios.get('management/jhimetrics');
6
6
  }
7
7
 
8
- public retrieveThreadDump(): AxiosPromise<any> {
8
+ retrieveThreadDump(): AxiosPromise<any> {
9
9
  return axios.get('management/threaddump');
10
10
  }
11
11
  }
@@ -37,7 +37,7 @@ export const useTrackerService = ({ stomp, authenticated }: { stomp?: RxStomp; a
37
37
  };
38
38
 
39
39
  export default class TrackerService {
40
- public status = ref<'open' | 'connecting' | 'closing' | 'closed'>('closed');
40
+ status = ref<'open' | 'connecting' | 'closing' | 'closed'>('closed');
41
41
  private rxStomp: RxStomp;
42
42
 
43
43
  constructor({ stomp }: { stomp?: RxStomp }) {
@@ -74,12 +74,12 @@ export default class TrackerService {
74
74
  });
75
75
  }
76
76
 
77
- public connect(): void {
77
+ connect(): void {
78
78
  this.updateCredentials();
79
79
  this.rxStomp.activate();
80
80
  }
81
81
 
82
- public async disconnect(): Promise<void> {
82
+ async disconnect(): Promise<void> {
83
83
  await this.rxStomp.deactivate();
84
84
  }
85
85
  <%_ if (authenticationTypeJwt) { _%>
@@ -121,14 +121,14 @@ export default class TrackerService {
121
121
  });
122
122
  }
123
123
 
124
- public sendActivity(page: string): void {
124
+ sendActivity(page: string): void {
125
125
  this.rxStomp.publish({
126
126
  destination: DESTINATION_ACTIVITY,
127
127
  body: JSON.stringify({ page }),
128
128
  });
129
129
  }
130
130
 
131
- public subscribe(observer) {
131
+ subscribe(observer) {
132
132
  return this.rxStomp
133
133
  .watch(DESTINATION_TRACKER)
134
134
  .pipe(map(imessage => JSON.parse(imessage.body)))
@@ -7,27 +7,27 @@ import { type IUser } from '@/shared/model/user.model';
7
7
 
8
8
  export default class UserManagementService {
9
9
 
10
- public get(userId: string): Promise<any> {
10
+ get(userId: string): Promise<any> {
11
11
  return axios.get(`api/admin/users/${userId}`);
12
12
  }
13
13
 
14
- public create(user: IUser): Promise<any> {
14
+ create(user: IUser): Promise<any> {
15
15
  return axios.post('api/admin/users', user);
16
16
  }
17
17
 
18
- public update(user: IUser): Promise<any> {
18
+ update(user: IUser): Promise<any> {
19
19
  return axios.put('api/admin/users', user);
20
20
  }
21
21
 
22
- public remove(userId: <%- user.primaryKey.tsType %>): Promise<any> {
22
+ remove(userId: <%- user.primaryKey.tsType %>): Promise<any> {
23
23
  return axios.delete(`api/admin/users/${userId}`);
24
24
  }
25
25
 
26
- public retrieve(<%_ if (!databaseTypeCassandra) { _%>req?: any <%_ } _%>): Promise<any> {
26
+ retrieve(<%_ if (!databaseTypeCassandra) { _%>req?: any <%_ } _%>): Promise<any> {
27
27
  return axios.get(`api/admin/users<%_ if (!databaseTypeCassandra) { _%>?${buildPaginationQueryOpts(req)}<%_ } _%>`);
28
28
  }
29
29
 
30
- public retrieveAuthorities(): Promise<any> {
30
+ retrieveAuthorities(): Promise<any> {
31
31
  <%_ if (!databaseTypeCassandra) { _%>
32
32
  return axios.get('api/authorities').then(response => {
33
33
  response.data = response.data.map(authority => authority.name);
@@ -1,15 +1,33 @@
1
+ <%#
2
+ Copyright 2013-2025 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
+ -%>
1
19
  import { defineComponent, provide } from 'vue';
2
- <%_ if (enableTranslation) { _%>
3
20
  import { useI18n } from 'vue-i18n';
21
+ import { storeToRefs } from 'pinia';
22
+
23
+ <%_ if (!authenticationTypeOauth2) { _%>
24
+ import { useLoginModal } from '@/account/login-modal';
25
+ import LoginForm from '@/account/login-form/login-form.vue';
4
26
  <%_ } _%>
5
27
  import Ribbon from '@/core/ribbon/ribbon.vue';
6
28
  import JhiFooter from '@/core/jhi-footer/jhi-footer.vue';
7
29
  import JhiNavbar from '@/core/jhi-navbar/jhi-navbar.vue';
8
- <%_ if (!authenticationTypeOauth2) { _%>
9
- import LoginForm from '@/account/login-form/login-form.vue';
10
- <%_ } %>
11
30
  import { useAlertService } from '@/shared/alert/alert.service';
12
-
13
31
  import '@/shared/config/dayjs';
14
32
 
15
33
  export default defineComponent({
@@ -25,11 +43,15 @@ export default defineComponent({
25
43
  },
26
44
  setup() {
27
45
  provide('alertService', useAlertService());
46
+ <%_ if (!authenticationTypeOauth2) { _%>
47
+ const { loginModalOpen } = storeToRefs(useLoginModal());
48
+ <%_ } _%>
28
49
 
29
50
  return {
30
- <%_ if (enableTranslation) { _%>
31
- t$: useI18n().t,
51
+ <%_ if (!authenticationTypeOauth2) { _%>
52
+ loginModalOpen,
32
53
  <%_ } _%>
54
+ t$: useI18n().t,
33
55
  };
34
56
  },
35
57
  });
@@ -1,3 +1,21 @@
1
+ <%#
2
+ Copyright 2013-2025 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
+ -%>
1
19
  <template>
2
20
  <div id="app">
3
21
  <ribbon></ribbon>
@@ -9,7 +27,7 @@
9
27
  <router-view></router-view>
10
28
  </div>
11
29
  <%_ if (!authenticationTypeOauth2) { _%>
12
- <b-modal id="login-page" hide-footer lazy>
30
+ <b-modal id="login-page" v-model="loginModalOpen" hide-footer lazy>
13
31
  <template #modal-title>
14
32
  <span data-cy="loginTitle" id="login-title" v-text="t$('login.title')">Sign in</span>
15
33
  </template>
@@ -1,11 +1,32 @@
1
+ <%#
2
+ Copyright 2013-2025 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
+ -%>
1
19
  import { vitest } from 'vitest';
2
20
  import { type Ref, ref } from 'vue';
3
- import { shallowMount } from '@vue/test-utils';
21
+ import { shallowMount, type ComponentMountingOptions } from '@vue/test-utils';
4
22
  import { type RouteLocation } from 'vue-router';
23
+ import { createTestingPinia } from '@pinia/testing';
5
24
 
6
- import Error from './error.vue';
25
+ <%_ if (generateUserManagement) { _%>
26
+ import { useLoginModal } from '@/account/login-modal';
7
27
 
8
- import <% if (authenticationTypeOauth2) { %>type <% } %>LoginService from '@/account/login.service';
28
+ <%_ } _%>
29
+ import Error from './error.vue';
9
30
 
10
31
  type ErrorComponentType = InstanceType<typeof Error>;
11
32
 
@@ -19,22 +40,32 @@ const customErrorMsg = 'An error occurred.';
19
40
 
20
41
  describe('Error component', () => {
21
42
  let error: ErrorComponentType;
43
+ <%_ if (authenticationTypeOauth2) { _%>
22
44
  let loginService: LoginService;
45
+ <%_ } _%>
46
+ <%_ if (generateUserManagement) { _%>
47
+ let login: ReturnType<typeof useLoginModal>;
48
+ <%_ } _%>
23
49
  let authenticated: Ref<boolean>;
50
+ let mountOptions: ComponentMountingOptions<ErrorComponentType>;
24
51
 
25
52
  beforeEach(() => {
26
53
  route = {};
27
54
  authenticated = ref(false);
28
- <%_ if (authenticationTypeJwt) { _%>
29
- loginService = new LoginService({ emit: vitest.fn() });
30
- vitest.spyOn(loginService, 'openLogin');
31
- <%_ } else if (authenticationTypeSession) { _%>
32
- loginService = new LoginService({ emit: vitest.fn() });
33
- vitest.spyOn(loginService, 'openLogin');
34
- vitest.spyOn(loginService, 'logout');
35
- <%_ } else if (authenticationTypeOauth2) { _%>
55
+ <%_ if (authenticationTypeOauth2) { _%>
36
56
  loginService = { login: vitest.fn(), logout: vitest.fn() };
37
57
  <%_ } _%>
58
+ mountOptions = {
59
+ global: {
60
+ plugins: [createTestingPinia()],
61
+ provide: {
62
+ <%_ if (authenticationTypeOauth2) { _%>
63
+ loginService,
64
+ <%_ } _%>
65
+ authenticated,
66
+ },
67
+ },
68
+ };
38
69
  });
39
70
 
40
71
  it('should have retrieve custom error on routing', () => {
@@ -43,21 +74,17 @@ describe('Error component', () => {
43
74
  name: 'CustomMessage',
44
75
  meta: { errorMessage: customErrorMsg },
45
76
  };
46
- const wrapper = shallowMount(Error, {
47
- global: {
48
- provide: {
49
- loginService,
50
- authenticated,
51
- },
52
- },
53
- });
77
+ const wrapper = shallowMount(Error, mountOptions);
54
78
  error = wrapper.vm;
79
+ <%_ if (generateUserManagement) { _%>
80
+ login = useLoginModal();
81
+ <%_ } _%>
55
82
 
56
83
  expect(error.errorMessage).toBe(customErrorMsg);
57
84
  expect(error.error403).toBeFalsy();
58
85
  expect(error.error404).toBeFalsy();
59
- <%_ if (!authenticationTypeOauth2) { _%>
60
- expect(loginService.openLogin).toHaveBeenCalledTimes(0);
86
+ <%_ if (generateUserManagement) { _%>
87
+ expect(login.showLogin).not.toHaveBeenCalled();
61
88
  <%_ } else { _%>
62
89
  expect(loginService.login).toHaveBeenCalledTimes(0);
63
90
  <%_ } _%>
@@ -67,21 +94,17 @@ describe('Error component', () => {
67
94
  route = {
68
95
  meta: { error403: true },
69
96
  };
70
- const wrapper = shallowMount(Error, {
71
- global: {
72
- provide: {
73
- loginService,
74
- authenticated,
75
- },
76
- },
77
- });
97
+ const wrapper = shallowMount(Error, mountOptions);
78
98
  error = wrapper.vm;
99
+ <%_ if (generateUserManagement) { _%>
100
+ login = useLoginModal();
101
+ <%_ } _%>
79
102
 
80
103
  expect(error.errorMessage).toBeNull();
81
104
  expect(error.error403).toBeTruthy();
82
105
  expect(error.error404).toBeFalsy();
83
- <%_ if (!authenticationTypeOauth2) { _%>
84
- expect(loginService.openLogin).toHaveBeenCalled();
106
+ <%_ if (generateUserManagement) { _%>
107
+ expect(login.showLogin).toHaveBeenCalled();
85
108
  <%_ } else { _%>
86
109
  expect(loginService.login).toHaveBeenCalled();
87
110
  <%_ } _%>
@@ -91,42 +114,34 @@ describe('Error component', () => {
91
114
  route = {
92
115
  meta: { error404: true },
93
116
  };
94
- const wrapper = shallowMount(Error, {
95
- global: {
96
- provide: {
97
- loginService,
98
- authenticated,
99
- },
100
- },
101
- });
117
+ const wrapper = shallowMount(Error, mountOptions);
102
118
  error = wrapper.vm;
119
+ <%_ if (generateUserManagement) { _%>
120
+ login = useLoginModal();
121
+ <%_ } _%>
103
122
 
104
123
  expect(error.errorMessage).toBeNull();
105
124
  expect(error.error403).toBeFalsy();
106
125
  expect(error.error404).toBeTruthy();
107
- <%_ if (!authenticationTypeOauth2) { _%>
108
- expect(loginService.openLogin).toHaveBeenCalledTimes(0);
126
+ <%_ if (generateUserManagement) { _%>
127
+ expect(login.showLogin).not.toHaveBeenCalled();
109
128
  <%_ } else { _%>
110
129
  expect(loginService.login).toHaveBeenCalledTimes(0);
111
130
  <%_ } _%>
112
131
  });
113
132
 
114
133
  it('should have set default on no error', () => {
115
- const wrapper = shallowMount(Error, {
116
- global: {
117
- provide: {
118
- loginService,
119
- authenticated,
120
- },
121
- },
122
- });
134
+ const wrapper = shallowMount(Error, mountOptions);
123
135
  error = wrapper.vm;
136
+ <%_ if (generateUserManagement) { _%>
137
+ login = useLoginModal();
138
+ <%_ } _%>
124
139
 
125
140
  expect(error.errorMessage).toBeNull();
126
141
  expect(error.error403).toBeFalsy();
127
142
  expect(error.error404).toBeFalsy();
128
- <%_ if (!authenticationTypeOauth2) { _%>
129
- expect(loginService.openLogin).toHaveBeenCalledTimes(0);
143
+ <%_ if (generateUserManagement) { _%>
144
+ expect(login.showLogin).not.toHaveBeenCalled();
130
145
  <%_ } else { _%>
131
146
  expect(loginService.login).toHaveBeenCalledTimes(0);
132
147
  <%_ } _%>
@@ -1,15 +1,41 @@
1
- import { type ComputedRef, defineComponent, inject, type Ref, ref } from 'vue';
1
+ <%#
2
+ Copyright 2013-2025 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 { type ComputedRef, type Ref, defineComponent, inject, ref } from 'vue';
2
20
  <%_ if (enableTranslation) { _%>
3
21
  import { useI18n } from 'vue-i18n';
4
22
  <%_ } _%>
5
- import type LoginService from '@/account/login.service';
6
23
  import { useRoute } from 'vue-router';
24
+ <%_ if (authenticationTypeOauth2) { _%>
25
+ import type LoginService from '@/account/login.service';
26
+ <%_ } else { _%>
27
+ import { useLoginModal } from '@/account/login-modal';
28
+ <%_ } _%>
7
29
 
8
30
  export default defineComponent({
9
31
  compatConfig: { MODE: 3 },
10
32
  name: 'Error',
11
33
  setup() {
12
- const loginService = inject<LoginService>('loginService');
34
+ <%_ if (authenticationTypeOauth2) { _%>
35
+ const { login } = inject<LoginService>('loginService');
36
+ <%_ } else { _%>
37
+ const { showLogin } = useLoginModal();
38
+ <%_ } _%>
13
39
  const authenticated = inject<ComputedRef<boolean>>('authenticated');
14
40
  const errorMessage: Ref<string> = ref(null);
15
41
  const error403: Ref<boolean> = ref(false);
@@ -21,11 +47,7 @@ export default defineComponent({
21
47
  error403.value = route.meta.error403 ?? false;
22
48
  error404.value = route.meta.error404 ?? false;
23
49
  if (!authenticated.value && error403.value) {
24
- <%_ if (!authenticationTypeOauth2) { _%>
25
- loginService.openLogin();
26
- <%_ } else { %>
27
- loginService.login();
28
- <%_ } %>
50
+ <% if (authenticationTypeOauth2) { %>login<% } else { %>showLogin<% } %>();
29
51
  }
30
52
  }
31
53
 
@@ -1,6 +1,28 @@
1
- import { vitest } from 'vitest';
1
+ <%#
2
+ Copyright 2013-2025 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 { beforeEach, describe, expect, it } from 'vitest';
2
20
  import { ref } from 'vue';
3
21
  import { shallowMount } from '@vue/test-utils';
22
+ <%_ if (!authenticationTypeOauth2) { _%>
23
+ import { createTestingPinia } from '@pinia/testing';
24
+ import { useLoginModal } from '@/account/login-modal';
25
+ <%_ } _%>
4
26
  import Home from './home.vue';
5
27
 
6
28
  type HomeComponentType = InstanceType<typeof Home>;
@@ -9,30 +31,37 @@ describe('Home', () => {
9
31
  let home: HomeComponentType;
10
32
  let authenticated;
11
33
  let currentUsername;
12
- <%_ if (authenticationTypeJwt) { _%>
13
- const loginService = { openLogin: vitest.fn() };
14
- <%_ } else if (authenticationTypeSession) { _%>
15
- const loginService = { openLogin: vitest.fn(), logout: vitest.fn() };
16
- <%_ } else if (authenticationTypeOauth2) { _%>
17
- const loginService = { login: vitest.fn(), logout: vitest.fn() };
34
+ <%_ if (!authenticationTypeOauth2) { _%>
35
+ let login: ReturnType<typeof useLoginModal>;
18
36
  <%_ } _%>
19
37
 
38
+ <%_ if (authenticationTypeOauth2) { _%>
39
+ const loginService = { login: vitest.fn(), logout: vitest.fn() };
40
+ <%_ } _%>
20
41
  beforeEach(() => {
21
42
  authenticated = ref(false);
22
43
  currentUsername = ref('');
23
44
  const wrapper = shallowMount(Home, {
24
45
  global: {
46
+ <%_ if (!authenticationTypeOauth2) { _%>
47
+ plugins: [createTestingPinia()],
48
+ <%_ } _%>
25
49
  stubs: {
26
50
  'router-link': true,
27
51
  },
28
52
  provide: {
53
+ <%_ if (authenticationTypeOauth2) { _%>
29
54
  loginService,
55
+ <%_ } _%>
30
56
  authenticated,
31
57
  currentUsername,
32
58
  },
33
59
  },
34
60
  });
35
61
  home = wrapper.vm;
62
+ <%_ if (!authenticationTypeOauth2) { _%>
63
+ login = useLoginModal();
64
+ <%_ } _%>
36
65
  });
37
66
 
38
67
  it('should not have user data set', () => {
@@ -49,12 +78,13 @@ describe('Home', () => {
49
78
  });
50
79
 
51
80
  it('should use login service', () => {
52
- home.openLogin();
53
81
 
54
- <%_ if (!authenticationTypeOauth2) { _%>
55
- expect(loginService.openLogin).toHaveBeenCalled();
56
- <%_ } else { %>
82
+ <%_ if (authenticationTypeOauth2) { _%>
83
+ home.login();
57
84
  expect(loginService.login).toHaveBeenCalled();
85
+ <%_ } else { %>
86
+ home.showLogin();
87
+ expect(login.showLogin).toHaveBeenCalled();
58
88
  <%_ } %>
59
89
  });
60
90
  });
@@ -3,28 +3,27 @@ import { type ComputedRef, defineComponent, inject } from 'vue';
3
3
  import { useI18n } from 'vue-i18n';
4
4
  <%_ } _%>
5
5
 
6
+ <%_ if (authenticationTypeOauth2) { _%>
6
7
  import type LoginService from '@/account/login.service';
8
+ <%_ } else { _%>
9
+ import { useLoginModal } from '@/account/login-modal';
10
+ <%_ } _%>
7
11
 
8
12
  export default defineComponent({
9
13
  compatConfig: { MODE: 3 },
10
14
  setup() {
11
- const loginService = inject<LoginService>('loginService');
12
-
15
+ <%_ if (authenticationTypeOauth2) { _%>
16
+ const { login } = inject<LoginService>('loginService');
17
+ <%_ } else { _%>
18
+ const { showLogin } = useLoginModal();
19
+ <%_ } _%>
13
20
  const authenticated = inject<ComputedRef<boolean>>('authenticated');
14
21
  const username = inject<ComputedRef<string>>('currentUsername');
15
22
 
16
- const openLogin = () => {
17
- <%_ if (!authenticationTypeOauth2) { _%>
18
- loginService.openLogin();
19
- <%_ } else { %>
20
- loginService.login();
21
- <%_ } _%>
22
- };
23
-
24
23
  return {
25
24
  authenticated,
26
25
  username,
27
- openLogin,
26
+ <% if (authenticationTypeOauth2) { %>login<% } else { %>showLogin<% } %>,
28
27
  <%_ if (enableTranslation) { _%>
29
28
  t$: useI18n().t,
30
29
  <%_ } _%>