Skip to content

Commit

Permalink
NAS-131364: Move more components to standalone
Browse files Browse the repository at this point in the history
  • Loading branch information
undsoft committed Sep 24, 2024
1 parent e286d73 commit 03a27a9
Show file tree
Hide file tree
Showing 26 changed files with 68 additions and 79 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { FeedbackType } from 'app/modules/feedback/interfaces/feedback.interface';
import { FeedbackService } from 'app/modules/feedback/services/feedback.service';
import { IxButtonGroupHarness } from 'app/modules/forms/ix-forms/components/ix-button-group/ix-button-group.harness';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { CastPipe } from 'app/modules/pipes/cast/cast.pipe';
import { SystemGeneralService } from 'app/services/system-general.service';

Expand All @@ -32,6 +33,7 @@ describe('FeedbackDialogComponent', () => {
imports: [
ReactiveFormsModule,
CastPipe,
FakeProgressBarComponent,
],
declarations: [
MockComponents(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { createDirectiveFactory, SpectatorDirective } from '@ngneat/spectator/jest';
import { of } from 'rxjs';
import {
WithLoadingStateErrorComponent,
} from 'app/modules/loader/directives/with-loading-state/with-loading-state-error/with-loading-state-error.component';
import {
WithLoadingStateLoaderComponent,
} from 'app/modules/loader/directives/with-loading-state/with-loading-state-loader/with-loading-state-loader.component';
Expand All @@ -12,10 +9,6 @@ describe('WithLoadingStateDirective', () => {
let spectator: SpectatorDirective<WithLoadingStateDirective>;
const createDirective = createDirectiveFactory({
directive: WithLoadingStateDirective,
declarations: [
WithLoadingStateLoaderComponent,
WithLoadingStateErrorComponent,
],
});

describe('when loading state is an observable', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { AppUpgradeSummary } from 'app/interfaces/application.interface';
import { CoreBulkQuery } from 'app/interfaces/core-bulk.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { BulkListItemComponent } from 'app/modules/lists/bulk-list-item/bulk-list-item.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { SnackbarService } from 'app/modules/snackbar/services/snackbar.service';
import { AppBulkUpgradeComponent } from 'app/pages/apps/components/installed-apps/app-bulk-upgrade/app-bulk-upgrade.component';
import { WebSocketService } from 'app/services/ws.service';
Expand Down Expand Up @@ -80,6 +81,7 @@ describe('AppBulkUpgradeComponent', () => {
ReactiveFormsModule,
ImgFallbackModule,
LetDirective,
FakeProgressBarComponent,
],
declarations: [
BulkListItemComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { JobState } from 'app/enums/job-state.enum';
import { App } from 'app/interfaces/app.interface';
import { EmptyComponent } from 'app/modules/empty/empty.component';
import { SearchInput1Component } from 'app/modules/forms/search-input1/search-input1.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { PageHeaderModule } from 'app/modules/page-header/page-header.module';
import { AppDetailsPanelComponent } from 'app/pages/apps/components/installed-apps/app-details-panel/app-details-panel.component';
import { AppRowComponent } from 'app/pages/apps/components/installed-apps/app-row/app-row.component';
Expand Down Expand Up @@ -46,6 +47,7 @@ describe('InstalledAppsComponent', () => {
ReactiveFormsModule,
MatTableModule,
MockModule(PageHeaderModule),
FakeProgressBarComponent,
],
declarations: [
EmptyComponent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ describe('WidgetGroupFormComponent', () => {
const createComponent = createComponentFactory({
component: WidgetGroupFormComponent,
imports: [
TestIdModule,
ReactiveFormsModule,
],
declarations: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { EmptyComponent } from 'app/modules/empty/empty.component';
import { SearchInput1Component } from 'app/modules/forms/search-input1/search-input1.component';
import { TreeVirtualScrollViewComponent } from 'app/modules/ix-tree/components/tree-virtual-scroll-view/tree-virtual-scroll-view.component';
import { TreeModule } from 'app/modules/ix-tree/tree.module';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { DatasetsManagementComponent } from 'app/pages/datasets/components/dataset-management/dataset-management.component';
import { DatasetTreeStore } from 'app/pages/datasets/store/dataset-store.service';

Expand All @@ -26,7 +27,12 @@ describe('DatasetsManagementComponent', () => {

const createComponent = createRoutingFactory({
component: DatasetsManagementComponent,
imports: [TreeModule, SearchInput1Component, EmptyComponent],
imports: [
TreeModule,
SearchInput1Component,
EmptyComponent,
FakeProgressBarComponent,
],
providers: [
mockAuth(),
mockWebSocket([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { fakeSuccessfulJob } from 'app/core/testing/utils/fake-job.utils';
import { mockJob, mockWebSocket } from 'app/core/testing/utils/mock-websocket.utils';
import { IpmiEvent } from 'app/interfaces/ipmi.interface';
import { EmptyComponent } from 'app/modules/empty/empty.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import {
IpmiEventsDialogComponent,
} from 'app/pages/network/components/ipmi-card/ipmi-events-dialog/ipmi-events-dialog.component';
Expand All @@ -21,6 +22,7 @@ describe('IpmiEventsDialogComponent', () => {
declarations: [
FakeFormatDateTimePipe,
EmptyComponent,
FakeProgressBarComponent,
],
providers: [
mockWebSocket([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { IxSlideInRef } from 'app/modules/forms/ix-forms/components/ix-slide-in/
import { SearchInput1Component } from 'app/modules/forms/search-input1/search-input1.component';
import { IxIconHarness } from 'app/modules/ix-icon/ix-icon.harness';
import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-table.harness';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { ReportingExportersFormComponent } from 'app/pages/reports-dashboard/components/exporters/reporting-exporters-form/reporting-exporters-form.component';
import { ReportingExporterListComponent } from 'app/pages/reports-dashboard/components/exporters/reporting-exporters-list/reporting-exporters-list.component';
import { IxSlideInService } from 'app/services/ix-slide-in.service';
Expand Down Expand Up @@ -38,6 +39,7 @@ describe('ReportingExportersListComponent', () => {
component: ReportingExporterListComponent,
imports: [
SearchInput1Component,
FakeProgressBarComponent,
],
providers: [
mockWebSocket([
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { AssociatedTargetFormComponent } from 'app/pages/sharing/iscsi/associated-target/associated-target-form/associated-target-form.component';
import { AssociatedTargetListComponent } from 'app/pages/sharing/iscsi/associated-target/associated-target-list/associated-target-list.component';
import { IxSlideInService } from 'app/services/ix-slide-in.service';
Expand Down Expand Up @@ -47,6 +48,7 @@ describe('AssociatedTargetListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
providers: [
mockAuth(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { AuthorizedAccessFormComponent } from 'app/pages/sharing/iscsi/authorized-access/authorized-access-form/authorized-access-form.component';
import { AuthorizedAccessListComponent } from 'app/pages/sharing/iscsi/authorized-access/authorized-access-list/authorized-access-list.component';
import { IxSlideInService } from 'app/services/ix-slide-in.service';
Expand All @@ -40,6 +41,7 @@ describe('AuthorizedAccessListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
providers: [
mockAuth(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { ExtentFormComponent } from 'app/pages/sharing/iscsi/extent/extent-form/extent-form.component';
import { DeleteExtentDialogComponent } from 'app/pages/sharing/iscsi/extent/extent-list/delete-extent-dialog/delete-extent-dialog.component';
import { ExtentListComponent } from 'app/pages/sharing/iscsi/extent/extent-list/extent-list.component';
Expand Down Expand Up @@ -43,6 +44,7 @@ describe('ExtentListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
providers: [
mockProvider(EmptyService),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { PortalFormComponent } from 'app/pages/sharing/iscsi/portal/portal-form/portal-form.component';
import { PortalListComponent } from 'app/pages/sharing/iscsi/portal/portal-list/portal-list.component';
import { IxSlideInService } from 'app/services/ix-slide-in.service';
Expand Down Expand Up @@ -47,6 +48,7 @@ describe('PortalListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
providers: [
mockProvider(EmptyService),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { TargetFormComponent } from 'app/pages/sharing/iscsi/target/target-form/target-form.component';
import { TargetListComponent } from 'app/pages/sharing/iscsi/target/target-list/target-list.component';
import { IxSlideInService } from 'app/services/ix-slide-in.service';
Expand All @@ -36,6 +37,7 @@ describe('TargetListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
providers: [
mockProvider(EmptyService),
Expand Down
2 changes: 2 additions & 0 deletions src/app/pages/sharing/nfs/nfs-list/nfs-list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { NfsFormComponent } from 'app/pages/sharing/nfs/nfs-form/nfs-form.component';
import { NfsListComponent } from 'app/pages/sharing/nfs/nfs-list/nfs-list.component';
import { IxSlideInService } from 'app/services/ix-slide-in.service';
Expand All @@ -41,6 +42,7 @@ describe('NfsListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
providers: [
mockAuth(),
Expand Down
2 changes: 2 additions & 0 deletions src/app/pages/sharing/smb/smb-list/smb-list.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { IxTableHarness } from 'app/modules/ix-table/components/ix-table/ix-tabl
import {
IxTableColumnsSelectorComponent,
} from 'app/modules/ix-table/components/ix-table-columns-selector/ix-table-columns-selector.component';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { ServiceStateButtonComponent } from 'app/pages/sharing/components/shares-dashboard/service-state-button/service-state-button.component';
import { SmbAclComponent } from 'app/pages/sharing/smb/smb-acl/smb-acl.component';
import { SmbFormComponent } from 'app/pages/sharing/smb/smb-form/smb-form.component';
Expand Down Expand Up @@ -53,6 +54,7 @@ describe('SmbListComponent', () => {
imports: [
SearchInput1Component,
IxTableColumnsSelectorComponent,
FakeProgressBarComponent,
],
declarations: [
MockComponents(
Expand Down
4 changes: 2 additions & 2 deletions src/app/pages/signin/signin.component.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { MatInputModule } from '@angular/material/input';
import { createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator/jest';
import { MockComponents, MockModule } from 'ng-mocks';
import { MockComponents } from 'ng-mocks';
import { BehaviorSubject, of } from 'rxjs';
import { FailoverDisabledReason } from 'app/enums/failover-disabled-reason.enum';
import { FailoverStatus } from 'app/enums/failover-status.enum';
Expand Down Expand Up @@ -44,7 +44,7 @@ describe('SigninComponent', () => {
component: SigninComponent,
imports: [
MatInputModule,
MockModule(IxIconComponent),
MockComponents(IxIconComponent),
],
declarations: [
MockComponents(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { mockCall, mockJob, mockWebSocket } from 'app/core/testing/utils/mock-we
import { CreateVdevLayout, VdevType } from 'app/enums/v-dev-type.enum';
import { Pool } from 'app/interfaces/pool.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { SnackbarService } from 'app/modules/snackbar/services/snackbar.service';
import { AddVdevsStore } from 'app/pages/storage/modules/pool-manager/components/add-vdevs/store/add-vdevs-store.service';
import {
Expand Down Expand Up @@ -98,6 +99,7 @@ describe('PoolManagerWizardComponent', () => {
component: PoolManagerWizardComponent,
imports: [
MatStepperModule,
FakeProgressBarComponent,
],
declarations: [
MockComponents(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { ReactiveFormsModule } from '@angular/forms';
import { MatStepperModule } from '@angular/material/stepper';
import { Router } from '@angular/router';
import { createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator/jest';
import { of } from 'rxjs';
Expand All @@ -13,15 +11,11 @@ import { TopologyItemType } from 'app/enums/v-dev-type.enum';
import { DetailsDisk } from 'app/interfaces/disk.interface';
import { Enclosure } from 'app/interfaces/enclosure.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { IxWarningComponent } from 'app/modules/forms/ix-forms/components/ix-warning/ix-warning.component';
import { CastPipe } from 'app/modules/pipes/cast/cast.pipe';
import { FileSizePipe } from 'app/modules/pipes/file-size/file-size.pipe';
import { MapValuePipe } from 'app/modules/pipes/map-value/map-value.pipe';
import { AddVdevsComponent } from 'app/pages/storage/modules/pool-manager/components/add-vdevs/add-vdevs.component';
import { AddVdevsStore } from 'app/pages/storage/modules/pool-manager/components/add-vdevs/store/add-vdevs-store.service';
import { existingPool, existingPoolDisks } from 'app/pages/storage/modules/pool-manager/components/pool-manager/tests/add-vdev-to-pool-data';
import {
commonDeclarations,
commonDeclarations, commonImports,
commonProviders,
} from 'app/pages/storage/modules/pool-manager/components/pool-manager/tests/common.utils';
import {
Expand All @@ -37,12 +31,7 @@ describe('AddVdevsComponent – Add Vdev to existing pool', () => {
const createComponent = createComponentFactory({
component: AddVdevsComponent,
imports: [
ReactiveFormsModule,
MatStepperModule,
FileSizePipe,
MapValuePipe,
CastPipe,
IxWarningComponent,
...commonImports,
],
declarations: [
...commonDeclarations,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { ReactiveFormsModule } from '@angular/forms';
import { MatDialog } from '@angular/material/dialog';
import { MatIconRegistry } from '@angular/material/icon';
import { MatStepperModule } from '@angular/material/stepper';
import { createSpyObject, mockProvider } from '@ngneat/spectator/jest';
import { provideMockStore } from '@ngrx/store/testing';
import { EMPTY, of } from 'rxjs';
import { Job } from 'app/interfaces/job.interface';
import { Pool } from 'app/interfaces/pool.interface';
import { DialogService } from 'app/modules/dialog/dialog.service';
import { IxWarningComponent } from 'app/modules/forms/ix-forms/components/ix-warning/ix-warning.component';
import { IxIconRegistry } from 'app/modules/ix-icon/ix-icon.service';
import { FakeProgressBarComponent } from 'app/modules/loader/components/fake-progress-bar/fake-progress-bar.component';
import { CastPipe } from 'app/modules/pipes/cast/cast.pipe';
import { FileSizePipe } from 'app/modules/pipes/file-size/file-size.pipe';
import { MapValuePipe } from 'app/modules/pipes/map-value/map-value.pipe';
import {
AddVdevsStore,
} from 'app/pages/storage/modules/pool-manager/components/add-vdevs/store/add-vdevs-store.service';
Expand Down Expand Up @@ -85,6 +92,16 @@ import {
} from 'app/pages/storage/modules/pool-manager/utils/generate-vdevs/generate-vdevs.service';
import { selectHasEnclosureSupport } from 'app/store/system-info/system-info.selectors';

export const commonImports = [
ReactiveFormsModule,
MatStepperModule,
FileSizePipe,
MapValuePipe,
CastPipe,
IxWarningComponent,
FakeProgressBarComponent,
];

export const commonDeclarations = [
ConfigurationPreviewComponent,
ExistingConfigurationPreviewComponent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { TestbedHarnessEnvironment } from '@angular/cdk/testing/testbed';
import { ReactiveFormsModule } from '@angular/forms';
import { MatStepperModule } from '@angular/material/stepper';
import { Router } from '@angular/router';
import { createComponentFactory, mockProvider, Spectator } from '@ngneat/spectator/jest';
import { of } from 'rxjs';
Expand All @@ -11,14 +9,11 @@ import { mockCall, mockJob, mockWebSocket } from 'app/core/testing/utils/mock-we
import { DiskType } from 'app/enums/disk-type.enum';
import { DetailsDisk } from 'app/interfaces/disk.interface';
import { Enclosure } from 'app/interfaces/enclosure.interface';
import { CastPipe } from 'app/modules/pipes/cast/cast.pipe';
import { FileSizePipe } from 'app/modules/pipes/file-size/file-size.pipe';
import { MapValuePipe } from 'app/modules/pipes/map-value/map-value.pipe';
import {
PoolManagerComponent,
} from 'app/pages/storage/modules/pool-manager/components/pool-manager/pool-manager.component';
import {
commonDeclarations,
commonDeclarations, commonImports,
commonProviders,
} from 'app/pages/storage/modules/pool-manager/components/pool-manager/tests/common.utils';
import {
Expand All @@ -33,11 +28,7 @@ describe('PoolManagerComponent – create pool', () => {
const createComponent = createComponentFactory({
component: PoolManagerComponent,
imports: [
ReactiveFormsModule,
MatStepperModule,
FileSizePipe,
MapValuePipe,
CastPipe,
...commonImports,
],
declarations: [
...commonDeclarations,
Expand Down
Loading

0 comments on commit 03a27a9

Please sign in to comment.