Skip to content

Commit 63a219d

Browse files
authored
[Angular] Replace SharedModule import with only components (#31702)
1 parent 55218d9 commit 63a219d

File tree

20 files changed

+135
-124
lines changed

20 files changed

+135
-124
lines changed

generators/angular/__snapshots__/generator.spec.ts.snap

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -539,9 +539,6 @@ exports[`generator - angular gateway-jwt-skipUserManagement(true)-withAdminUi(fa
539539
"clientRoot/src/app/shared/pagination/item-count.ts": {
540540
"stateCleared": "modified",
541541
},
542-
"clientRoot/src/app/shared/shared.module.ts": {
543-
"stateCleared": "modified",
544-
},
545542
"clientRoot/src/app/shared/sort/index.ts": {
546543
"stateCleared": "modified",
547544
},
@@ -1498,9 +1495,6 @@ exports[`generator - angular gateway-oauth2-withAdminUi(true)-skipJhipsterDepend
14981495
"clientRoot/src/app/shared/pagination/item-count.ts": {
14991496
"stateCleared": "modified",
15001497
},
1501-
"clientRoot/src/app/shared/shared.module.ts": {
1502-
"stateCleared": "modified",
1503-
},
15041498
"clientRoot/src/app/shared/sort/index.ts": {
15051499
"stateCleared": "modified",
15061500
},
@@ -2209,9 +2203,6 @@ exports[`generator - angular microservice-jwt-skipUserManagement(false)-withAdmi
22092203
"clientRoot/src/app/shared/pagination/item-count.ts": {
22102204
"stateCleared": "modified",
22112205
},
2212-
"clientRoot/src/app/shared/shared.module.ts": {
2213-
"stateCleared": "modified",
2214-
},
22152206
"clientRoot/src/app/shared/sort/index.ts": {
22162207
"stateCleared": "modified",
22172208
},
@@ -2953,9 +2944,6 @@ exports[`generator - angular microservice-oauth2-withAdminUi(true)-skipJhipsterD
29532944
"src/main/webapp/app/shared/pagination/item-count.ts": {
29542945
"stateCleared": "modified",
29552946
},
2956-
"src/main/webapp/app/shared/shared.module.ts": {
2957-
"stateCleared": "modified",
2958-
},
29592947
"src/main/webapp/app/shared/sort/index.ts": {
29602948
"stateCleared": "modified",
29612949
},
@@ -4115,9 +4103,6 @@ exports[`generator - angular monolith-jwt-skipUserManagement(false)-withAdminUi(
41154103
"src/main/webapp/app/shared/pagination/item-count.ts": {
41164104
"stateCleared": "modified",
41174105
},
4118-
"src/main/webapp/app/shared/shared.module.ts": {
4119-
"stateCleared": "modified",
4120-
},
41214106
"src/main/webapp/app/shared/sort/index.ts": {
41224107
"stateCleared": "modified",
41234108
},
@@ -4826,9 +4811,6 @@ exports[`generator - angular monolith-oauth2-withAdminUi(false)-skipJhipsterDepe
48264811
"src/main/webapp/app/shared/pagination/item-count.ts": {
48274812
"stateCleared": "modified",
48284813
},
4829-
"src/main/webapp/app/shared/shared.module.ts": {
4830-
"stateCleared": "modified",
4831-
},
48324814
"src/main/webapp/app/shared/sort/index.ts": {
48334815
"stateCleared": "modified",
48344816
},
@@ -5539,9 +5521,6 @@ exports[`generator - angular monolith-session-skipUserManagement(true)-withAdmin
55395521
"src/main/webapp/app/shared/pagination/item-count.ts": {
55405522
"stateCleared": "modified",
55415523
},
5542-
"src/main/webapp/app/shared/shared.module.ts": {
5543-
"stateCleared": "modified",
5544-
},
55455524
"src/main/webapp/app/shared/sort/index.ts": {
55465525
"stateCleared": "modified",
55475526
},

generators/angular/cleanup.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,5 +411,6 @@ export default asWritingTask<AngularEntity, AngularApplication<AngularEntity>>(f
411411
this.removeFile(`${application.clientSrcDir}app/shared/filter/filter.component.ts.ejs`);
412412
this.removeFile(`${application.clientSrcDir}app/shared/pagination/item-count.component.spec.ts.ejs`);
413413
this.removeFile(`${application.clientSrcDir}app/shared/pagination/item-count.component.ts.ejs`);
414+
this.removeFile(`${application.clientSrcDir}app/shared/shared.module.ts.ejs`);
414415
}
415416
});

generators/angular/files-angular.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ export const files = asWriteFilesSection({
344344
{
345345
...clientApplicationTemplatesBlock(),
346346
templates: [
347-
'shared/shared.module.ts',
348347
'shared/date/index.ts',
349348
'shared/date/duration.pipe.ts',
350349
'shared/date/format-medium-date.pipe.ts',

generators/angular/templates/src/main/webapp/app/account/password-reset/init/password-reset-init.ts.ejs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,17 @@
1919
import { AfterViewInit, Component, ElementRef, inject, signal, viewChild } from '@angular/core';
2020
import { FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms';
2121

22-
import SharedModule from 'app/shared/shared.module';
22+
<%_ if (enableTranslation) { _%>
23+
import { TranslateDirective } from 'app/shared/language';
24+
import { TranslateModule } from '@ngx-translate/core';
25+
<%_ } _%>
26+
import { AlertError } from 'app/shared/alert/alert-error';
2327

2428
import { PasswordResetInitService } from './password-reset-init.service';
2529

2630
@Component({
2731
selector: '<%= jhiPrefixDashed %>-password-reset-init',
28-
imports: [SharedModule, ReactiveFormsModule],
32+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>AlertError, ReactiveFormsModule],
2933
templateUrl: './password-reset-init.html',
3034
})
3135
export default class PasswordResetInit implements AfterViewInit {

generators/angular/templates/src/main/webapp/app/account/sessions/sessions.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,18 @@
1919
import { Component, inject, OnInit } from '@angular/core';
2020
import { DatePipe } from '@angular/common';
2121

22-
import SharedModule from 'app/shared/shared.module';
22+
<%_ if (enableTranslation) { _%>
23+
import { TranslateDirective } from 'app/shared/language';
24+
import { TranslateModule } from '@ngx-translate/core';
25+
<%_ } _%>
2326
import { AccountService } from 'app/core/auth/account.service';
2427
import { Session } from './session.model';
2528
import { SessionsService } from './sessions.service';
2629
import { Account } from 'app/core/auth/account.model';
2730

2831
@Component({
2932
selector: '<%= jhiPrefixDashed %>-sessions',
30-
imports: [SharedModule, DatePipe],
33+
imports: [DatePipe<% if (enableTranslation) { %>, TranslateDirective, TranslateModule<% } %>],
3134
templateUrl: './sessions.html',
3235
})
3336
export default class Sessions implements OnInit {

generators/angular/templates/src/main/webapp/app/account/settings/settings.ts.ejs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ import { Component, inject, OnInit, signal } from '@angular/core';
2020
import { FormGroup, FormControl, Validators, ReactiveFormsModule } from '@angular/forms';
2121
<%_ if (enableTranslation) { _%>
2222
import { TranslateService } from '@ngx-translate/core';
23+
import { TranslateDirective } from 'app/shared/language';
24+
import { TranslateModule } from '@ngx-translate/core';
25+
import { FindLanguageFromKeyPipe } from 'app/shared/language';
2326
<%_ } _%>
2427
import { of } from 'rxjs';
2528
import { catchError } from 'rxjs/operators';
2629

27-
import SharedModule from 'app/shared/shared.module';
30+
import { AlertError } from 'app/shared/alert/alert-error';
2831
import { AccountService } from 'app/core/auth/account.service';
2932
import { Account } from 'app/core/auth/account.model';
3033
<%_ if (enableTranslation) { _%>
@@ -35,7 +38,7 @@ const initialAccount: Account = {} as Account;
3538

3639
@Component({
3740
selector: '<%= jhiPrefixDashed %>-settings',
38-
imports: [SharedModule, ReactiveFormsModule],
41+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, FindLanguageFromKeyPipe, <%_ } _%>AlertError, ReactiveFormsModule],
3942
templateUrl: './settings.html',
4043
})
4144
export default class Settings implements OnInit {

generators/angular/templates/src/main/webapp/app/admin/gateway/gateway.ts.ejs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,19 @@
1919
import { Component, inject, OnInit } from '@angular/core';
2020
import { KeyValuePipe } from '@angular/common';
2121

22-
import SharedModule from 'app/shared/shared.module';
22+
<%_ if (enableTranslation) { _%>
23+
import { TranslateDirective } from 'app/shared/language';
24+
import { TranslateModule } from '@ngx-translate/core';
25+
<%_ } _%>
26+
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
2327
import { GatewayRoutesService } from './gateway-routes.service';
2428
import { GatewayRoute } from './gateway-route.model';
2529

2630
@Component({
2731
selector: '<%= jhiPrefixDashed %>-gateway',
2832
templateUrl: './gateway.html',
2933
providers: [GatewayRoutesService],
30-
imports: [SharedModule, KeyValuePipe],
34+
imports: [KeyValuePipe, FontAwesomeModule<% if (enableTranslation) { %>, TranslateDirective, TranslateModule<% } %>],
3135
})
3236
export default class Gateway implements OnInit {
3337
gatewayRoutes: GatewayRoute[] = [];

generators/angular/templates/src/main/webapp/app/admin/health/health.ts.ejs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,19 @@ import { HttpErrorResponse } from '@angular/common/http';
2121
import { KeyValuePipe } from '@angular/common';
2222
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
2323

24-
import SharedModule from 'app/shared/shared.module';
24+
<%_ if (enableTranslation) { _%>
25+
import { TranslateDirective } from 'app/shared/language';
26+
import { TranslateModule } from '@ngx-translate/core';
27+
<%_ } _%>
28+
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
2529
import { HealthService } from './health.service';
2630
import { HealthModel, HealthDetails, HealthStatus } from './health.model';
2731
import HealthModal from './modal/health-modal';
2832

2933
@Component({
3034
selector: '<%= jhiPrefixDashed %>-health',
3135
templateUrl: './health.html',
32-
imports: [SharedModule, KeyValuePipe],
36+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>FontAwesomeModule, KeyValuePipe],
3337
})
3438
export default class Health implements OnInit {
3539
health?: HealthModel;

generators/angular/templates/src/main/webapp/app/admin/logs/logs.ts.ejs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
import { Component, computed, inject, OnInit, signal } from '@angular/core';
2020
import { finalize<%_ if (applicationTypeGateway && gatewayServicesApiAvailable) { _%>, map<%_ } _%> } from 'rxjs/operators';
2121

22-
import SharedModule from 'app/shared/shared.module';
22+
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
23+
<%_ if (enableTranslation) { _%>
24+
import { TranslateDirective } from 'app/shared/language';
25+
import { TranslateModule } from '@ngx-translate/core';
26+
<%_ } _%>
2327
import { FormsModule } from '@angular/forms';
2428
import { SlicePipe } from '@angular/common';
2529
import { SortDirective, SortByDirective, sortStateSignal, SortService } from 'app/shared/sort';
@@ -35,7 +39,7 @@ import { GatewayRoutesService } from '../gateway/gateway-routes.service';
3539
<%_ if (applicationTypeGateway && gatewayServicesApiAvailable) { _%>
3640
providers: [GatewayRoutesService],
3741
<%_ } _%>
38-
imports: [SharedModule, FormsModule, SortDirective, SortByDirective, SlicePipe],
42+
imports: [<%_ if (enableTranslation) { _%>TranslateDirective, TranslateModule, <%_ } _%>FontAwesomeModule, FormsModule, SortDirective, SortByDirective, SlicePipe],
3943
})
4044
export default class Logs implements OnInit {
4145
loggers = signal<Log[] | undefined>(undefined);

generators/angular/templates/src/main/webapp/app/admin/tracker/tracker.ts.ejs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ import { Subscription } from 'rxjs';
2222

2323
import { TrackerService } from 'app/core/tracker/tracker.service';
2424
import { TrackerActivity } from 'app/core/tracker/tracker-activity.model';
25-
import SharedModule from 'app/shared/shared.module';
25+
<%_ if (enableTranslation) { _%>
26+
import { TranslateDirective } from 'app/shared/language';
27+
import { TranslateModule } from '@ngx-translate/core';
28+
<%_ } _%>
2629

2730
@Component({
2831
selector: '<%= jhiPrefixDashed %>-tracker',
29-
imports: [SharedModule, DatePipe],
32+
imports: [DatePipe<%_ if (enableTranslation) { _%>
33+
, TranslateDirective, TranslateModule<%_ } _%>],
3034
templateUrl: './tracker.html',
3135
})
3236
export default class Tracker implements OnInit, OnDestroy {

0 commit comments

Comments
 (0)