From 0e5fe99c9a26d4df25d16b323d7c986c9685817e Mon Sep 17 00:00:00 2001 From: John Rassa Date: Fri, 14 Jul 2023 11:56:05 -0400 Subject: [PATCH] cleanup ngx-bootstrap forRoot() imports --- src/app/app.component.spec.ts | 9 ++++++++- src/app/app.module.ts | 12 ++++++++++++ src/app/common/modal.module.ts | 2 +- src/app/common/system-alert.module.ts | 2 +- src/app/common/table.module.ts | 2 +- .../core/admin/cache-entries/cache-entries.module.ts | 4 ++-- .../admin/end-user-agreement/admin-eua.module.ts | 2 +- src/app/core/admin/feedback/admin-feedback.module.ts | 2 +- .../admin-list-feedback.component.spec.ts | 2 +- src/app/core/admin/messages/admin-messages.module.ts | 2 +- .../core/admin/user-management/admin-user.module.ts | 8 +++----- .../list-users/admin-list-users.component.spec.ts | 8 ++++---- src/app/core/audit/audit.module.ts | 8 ++++---- .../list-audit-entries.component.spec.ts | 12 ++++++------ src/app/core/core.module.ts | 2 +- src/app/core/feedback/feedback.module.ts | 9 +-------- .../core/site-navbar/site-navbar.component.spec.ts | 9 ++++----- src/app/core/teams/teams.module.ts | 6 +++--- src/app/core/teams/view-team/view-team.component.ts | 2 +- 19 files changed, 56 insertions(+), 47 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index d04fb442..33cba79f 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -1,5 +1,6 @@ import { TestBed, waitForAsync } from '@angular/core/testing'; +import { ModalModule } from 'ngx-bootstrap/modal'; import { PopoverModule } from 'ngx-bootstrap/popover'; import { of } from 'rxjs'; @@ -17,7 +18,13 @@ describe('AppComponent', () => { TestBed.configureTestingModule({ declarations: [AppComponent], - imports: [AppRoutingModule, CoreModule, SiteModule, PopoverModule.forRoot()], + imports: [ + AppRoutingModule, + CoreModule, + SiteModule, + PopoverModule, + ModalModule.forRoot() + ], providers: [{ provide: ConfigService, useValue: configServiceSpy }] }).compileComponents(); })); diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2a8112a0..aa5eb6d1 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -3,8 +3,14 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; +import { AlertModule } from 'ngx-bootstrap/alert'; +import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; +import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; +import { ModalModule } from 'ngx-bootstrap/modal'; import { PopoverModule } from 'ngx-bootstrap/popover'; +import { TabsModule } from 'ngx-bootstrap/tabs'; import { TooltipModule } from 'ngx-bootstrap/tooltip'; +import { TypeaheadModule } from 'ngx-bootstrap/typeahead'; import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; @@ -18,8 +24,14 @@ import { SiteModule } from './site/site.module'; BrowserAnimationsModule, HttpClientModule, + AlertModule.forRoot(), + BsDatepickerModule.forRoot(), + BsDropdownModule.forRoot(), + ModalModule.forRoot(), PopoverModule.forRoot(), + TabsModule.forRoot(), TooltipModule.forRoot(), + TypeaheadModule.forRoot(), AppRoutingModule, CoreModule, diff --git a/src/app/common/modal.module.ts b/src/app/common/modal.module.ts index d57ab96d..19ab008a 100644 --- a/src/app/common/modal.module.ts +++ b/src/app/common/modal.module.ts @@ -10,7 +10,7 @@ import { ContainerModalComponent } from './modal/container-modal/container-modal import { ModalComponent } from './modal/modal/modal.component'; @NgModule({ - imports: [BsModalModule.forRoot(), CommonModule, FormsModule, A11yModule], + imports: [BsModalModule, CommonModule, FormsModule, A11yModule], exports: [ConfigurableModalComponent, ModalComponent], declarations: [ConfigurableModalComponent, ContainerModalComponent, ModalComponent] }) diff --git a/src/app/common/system-alert.module.ts b/src/app/common/system-alert.module.ts index 75f34689..b3c84925 100644 --- a/src/app/common/system-alert.module.ts +++ b/src/app/common/system-alert.module.ts @@ -8,7 +8,7 @@ import { SystemAlertIconComponent } from './system-alert/system-alert-icon.compo import { SystemAlertComponent } from './system-alert/system-alert.component'; @NgModule({ - imports: [CommonModule, FormsModule, AlertModule.forRoot()], + imports: [CommonModule, FormsModule, AlertModule], exports: [SystemAlertComponent], declarations: [SystemAlertComponent, SystemAlertIconComponent] }) diff --git a/src/app/common/table.module.ts b/src/app/common/table.module.ts index ebec4f4c..7bf5cbee 100644 --- a/src/app/common/table.module.ts +++ b/src/app/common/table.module.ts @@ -31,7 +31,7 @@ import { AsyTableEmptyStateComponent } from './table/table-empty-state/asy-table FormsModule, SearchInputModule, NgSelectModule, - BsDropdownModule.forRoot(), + BsDropdownModule, BsDatepickerModule, DragDropModule ], diff --git a/src/app/core/admin/cache-entries/cache-entries.module.ts b/src/app/core/admin/cache-entries/cache-entries.module.ts index f94cba92..a633a778 100644 --- a/src/app/core/admin/cache-entries/cache-entries.module.ts +++ b/src/app/core/admin/cache-entries/cache-entries.module.ts @@ -19,8 +19,8 @@ import { CacheEntryModalComponent } from './cache-entry-modal.component'; @NgModule({ imports: [ - BsDropdownModule.forRoot(), - BsModalModule.forRoot(), + BsDropdownModule, + BsModalModule, CommonModule, DirectivesModule, FormsModule, diff --git a/src/app/core/admin/end-user-agreement/admin-eua.module.ts b/src/app/core/admin/end-user-agreement/admin-eua.module.ts index 0a15850d..cd81faf1 100644 --- a/src/app/core/admin/end-user-agreement/admin-eua.module.ts +++ b/src/app/core/admin/end-user-agreement/admin-eua.module.ts @@ -20,7 +20,7 @@ import { AdminListEuasComponent } from './list-euas/admin-list-euas.component'; @NgModule({ imports: [ - BsDropdownModule.forRoot(), + BsDropdownModule, CommonModule, DirectivesModule, FormsModule, diff --git a/src/app/core/admin/feedback/admin-feedback.module.ts b/src/app/core/admin/feedback/admin-feedback.module.ts index 531acc93..f0cb06f1 100644 --- a/src/app/core/admin/feedback/admin-feedback.module.ts +++ b/src/app/core/admin/feedback/admin-feedback.module.ts @@ -15,7 +15,7 @@ import { AdminListFeedbackComponent } from './list-feedback/admin-list-feedback. imports: [ CommonModule, - TooltipModule.forRoot(), + TooltipModule, PipesModule, SearchInputModule, diff --git a/src/app/core/admin/feedback/list-feedback/admin-list-feedback.component.spec.ts b/src/app/core/admin/feedback/list-feedback/admin-list-feedback.component.spec.ts index 1cfb9972..6beeec2a 100644 --- a/src/app/core/admin/feedback/list-feedback/admin-list-feedback.component.spec.ts +++ b/src/app/core/admin/feedback/list-feedback/admin-list-feedback.component.spec.ts @@ -77,7 +77,7 @@ describe('Admin List Feedback Component Spec', () => { SearchInputModule, SystemAlertModule, NgSelectModule, - TooltipModule.forRoot(), + TooltipModule, CdkTableModule, TableModule, BrowserAnimationsModule diff --git a/src/app/core/admin/messages/admin-messages.module.ts b/src/app/core/admin/messages/admin-messages.module.ts index 79acdd1e..aa5bbcbb 100644 --- a/src/app/core/admin/messages/admin-messages.module.ts +++ b/src/app/core/admin/messages/admin-messages.module.ts @@ -18,7 +18,7 @@ import { ListMessagesComponent } from './list-messages/list-messages.component'; @NgModule({ imports: [ - BsDropdownModule.forRoot(), + BsDropdownModule, CommonModule, FormsModule, RouterModule, diff --git a/src/app/core/admin/user-management/admin-user.module.ts b/src/app/core/admin/user-management/admin-user.module.ts index 437b5bdd..a95571eb 100644 --- a/src/app/core/admin/user-management/admin-user.module.ts +++ b/src/app/core/admin/user-management/admin-user.module.ts @@ -5,7 +5,6 @@ import { FormsModule } from '@angular/forms'; import { RouterModule } from '@angular/router'; import { AlertModule } from 'ngx-bootstrap/alert'; -import { ButtonsModule } from 'ngx-bootstrap/buttons'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { TooltipModule } from 'ngx-bootstrap/tooltip'; @@ -21,10 +20,9 @@ import { UserRoleFilterDirective } from './list-users/user-role-filter.directive @NgModule({ imports: [ - AlertModule.forRoot(), - ButtonsModule.forRoot(), - BsDropdownModule.forRoot(), - TooltipModule.forRoot(), + AlertModule, + BsDropdownModule, + TooltipModule, CommonModule, DirectivesModule, diff --git a/src/app/core/admin/user-management/list-users/admin-list-users.component.spec.ts b/src/app/core/admin/user-management/list-users/admin-list-users.component.spec.ts index f13b9372..0d38ff9c 100644 --- a/src/app/core/admin/user-management/list-users/admin-list-users.component.spec.ts +++ b/src/app/core/admin/user-management/list-users/admin-list-users.component.spec.ts @@ -5,7 +5,7 @@ import { FormsModule } from '@angular/forms'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { RouterTestingModule } from '@angular/router/testing'; -import { BsModalService } from 'ngx-bootstrap/modal'; +import { ModalModule } from 'ngx-bootstrap/modal'; import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { of } from 'rxjs'; @@ -75,16 +75,16 @@ describe('Admin List Users Component Spec', () => { PipesModule, SearchInputModule, SystemAlertModule, - TooltipModule.forRoot(), + TooltipModule, CdkTableModule, TableModule, - BrowserAnimationsModule + BrowserAnimationsModule, + ModalModule.forRoot() ], providers: [ { provide: AdminUsersService, useValue: adminUsersServiceSpy }, { provide: ConfigService, useValue: configServiceSpy }, { provide: ExportConfigService, useValue: exportConfigServiceSpy }, - BsModalService, ModalService ] }); diff --git a/src/app/core/audit/audit.module.ts b/src/app/core/audit/audit.module.ts index adbcd4bb..50b943d8 100644 --- a/src/app/core/audit/audit.module.ts +++ b/src/app/core/audit/audit.module.ts @@ -32,10 +32,10 @@ import { ListAuditEntriesComponent } from './list-audit-entries/list-audit-entri @NgModule({ imports: [ - BsDatepickerModule.forRoot(), - BsModalModule.forRoot(), - TypeaheadModule.forRoot(), - TooltipModule.forRoot(), + BsDatepickerModule, + BsModalModule, + TypeaheadModule, + TooltipModule, NgSelectModule, AuditRoutingModule, diff --git a/src/app/core/audit/list-audit-entries/list-audit-entries.component.spec.ts b/src/app/core/audit/list-audit-entries/list-audit-entries.component.spec.ts index 543de23c..1512b46a 100644 --- a/src/app/core/audit/list-audit-entries/list-audit-entries.component.spec.ts +++ b/src/app/core/audit/list-audit-entries/list-audit-entries.component.spec.ts @@ -6,7 +6,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { NgSelectModule } from '@ng-select/ng-select'; import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; -import { BsModalService, ModalModule } from 'ngx-bootstrap/modal'; +import { ModalModule } from 'ngx-bootstrap/modal'; import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { TypeaheadModule } from 'ngx-bootstrap/typeahead'; import { of } from 'rxjs'; @@ -122,10 +122,10 @@ describe('Audit Component Spec', () => { UserAuthenticationObjectComponent ], imports: [ - BsDatepickerModule.forRoot(), + BsDatepickerModule, ModalModule.forRoot(), - TypeaheadModule.forRoot(), - TooltipModule.forRoot(), + TypeaheadModule, + TooltipModule, NgSelectModule, DirectivesModule, FormsModule, @@ -133,12 +133,12 @@ describe('Audit Component Spec', () => { SystemAlertModule, CdkTableModule, TableModule, - BrowserAnimationsModule + BrowserAnimationsModule, + ModalModule ], providers: [ { provide: AuditService, useValue: auditServiceSpy }, { provide: ConfigService, useValue: configServiceSpy }, - BsModalService, SystemAlertService ] }).overrideModule(BrowserDynamicTestingModule, { diff --git a/src/app/core/core.module.ts b/src/app/core/core.module.ts index d38d2d8a..922589c4 100644 --- a/src/app/core/core.module.ts +++ b/src/app/core/core.module.ts @@ -60,7 +60,7 @@ export function getConfiguration(configService: ConfigService) { HttpClientModule, RouterModule, - ModalModule.forRoot(), + ModalModule, PopoverModule, TooltipModule, diff --git a/src/app/core/feedback/feedback.module.ts b/src/app/core/feedback/feedback.module.ts index d25d0c01..a89405d4 100644 --- a/src/app/core/feedback/feedback.module.ts +++ b/src/app/core/feedback/feedback.module.ts @@ -11,14 +11,7 @@ import { FeedbackFlyoutComponent } from './feedback-flyout/feedback-flyout.compo import { FeedbackModalComponent } from './feedback-modal/feedback-modal.component'; @NgModule({ - imports: [ - TooltipModule.forRoot(), - NgSelectModule, - CommonModule, - FormsModule, - FlyoutModule, - ModalModule - ], + imports: [TooltipModule, NgSelectModule, CommonModule, FormsModule, FlyoutModule, ModalModule], exports: [FeedbackModalComponent, FeedbackFlyoutComponent], declarations: [FeedbackModalComponent, FeedbackFlyoutComponent] }) diff --git a/src/app/core/site-navbar/site-navbar.component.spec.ts b/src/app/core/site-navbar/site-navbar.component.spec.ts index e4853039..3460d49a 100644 --- a/src/app/core/site-navbar/site-navbar.component.spec.ts +++ b/src/app/core/site-navbar/site-navbar.component.spec.ts @@ -5,7 +5,7 @@ import { By } from '@angular/platform-browser'; import { RouterTestingModule } from '@angular/router/testing'; import { BsDatepickerModule } from 'ngx-bootstrap/datepicker'; -import { BsModalService, ModalModule } from 'ngx-bootstrap/modal'; +import { ModalModule } from 'ngx-bootstrap/modal'; import { PopoverDirective, PopoverModule } from 'ngx-bootstrap/popover'; import { TooltipModule } from 'ngx-bootstrap/tooltip'; import { of } from 'rxjs'; @@ -91,15 +91,14 @@ describe('Site Navbar Component Spec', () => { ], imports: [ HttpClientTestingModule, - BsDatepickerModule.forRoot(), + BsDatepickerModule, ModalModule.forRoot(), - TooltipModule.forRoot(), - PopoverModule.forRoot(), + TooltipModule, + PopoverModule, FormsModule, RouterTestingModule ], providers: [ - BsModalService, { provide: AuthorizationService, useValue: authorizationServiceSpy }, { provide: ConfigService, useValue: configServiceSpy }, { provide: MessageService, useValue: messageServiceSpy }, diff --git a/src/app/core/teams/teams.module.ts b/src/app/core/teams/teams.module.ts index 021d9701..e689e382 100644 --- a/src/app/core/teams/teams.module.ts +++ b/src/app/core/teams/teams.module.ts @@ -31,9 +31,9 @@ import { ViewTeamComponent } from './view-team/view-team.component'; @NgModule({ imports: [ - BsDropdownModule.forRoot(), - TabsModule.forRoot(), - TooltipModule.forRoot(), + BsDropdownModule, + TabsModule, + TooltipModule, NgSelectModule, diff --git a/src/app/core/teams/view-team/view-team.component.ts b/src/app/core/teams/view-team/view-team.component.ts index 018bd00c..cf9f988e 100644 --- a/src/app/core/teams/view-team/view-team.component.ts +++ b/src/app/core/teams/view-team/view-team.component.ts @@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { filter, first, map, switchMap, tap } from 'rxjs/operators'; +import { filter, first, map, switchMap } from 'rxjs/operators'; import { ModalAction } from '../../../common/modal/modal.model'; import { ModalService } from '../../../common/modal/modal.service';