From e7a2c4f750ed166b23753ea8e34c4f695fad83e2 Mon Sep 17 00:00:00 2001 From: mdelez <60604010+mdelez@users.noreply.github.com> Date: Fri, 3 Sep 2021 13:22:25 +0200 Subject: [PATCH] refactor: update imports step 1 (DSP-1882) (#516) * refactor: update imports * fix(test): fix login comp tests * fix(test): fix resource-class-form comp test * fix(test): fixes header comp tests * fix(test): fixes remaining failing unit tests * refactor(resource-class-form): updates the components used from the one found in the dsp-ui to the ones migrated to dsp-app --- src/app/app.component.spec.ts | 9 +- src/app/app.module.ts | 10 +-- src/app/main/cache/cache.service.spec.ts | 3 +- .../main/error/error-handler.service.spec.ts | 3 +- src/app/main/error/error-handler.service.ts | 4 +- src/app/main/guard/auth.guard.ts | 2 +- src/app/main/header/header.component.html | 4 +- src/app/main/header/header.component.spec.ts | 87 ++++++++++++------- src/app/main/header/header.component.ts | 4 +- src/app/main/help/help.component.spec.ts | 3 +- src/app/main/help/help.component.ts | 2 +- src/app/main/login/login.component.html | 2 +- src/app/main/login/login.component.spec.ts | 58 +++++++++---- src/app/main/main.component.spec.ts | 4 +- src/app/main/main.component.ts | 3 +- src/app/project/board/board.component.spec.ts | 3 +- src/app/project/board/board.component.ts | 3 +- .../add-user/add-user.component.spec.ts | 9 +- .../add-user/add-user.component.ts | 4 +- .../collaboration.component.spec.ts | 9 +- .../collaboration/collaboration.component.ts | 4 +- .../select-group.component.spec.ts | 8 +- .../select-group/select-group.component.ts | 3 +- .../list-info-form.component.html | 10 +-- .../list-info-form.component.spec.ts | 7 +- .../list-info-form.component.ts | 2 +- .../edit-list-item.component.html | 10 +-- .../edit-list-item.component.spec.ts | 3 +- .../edit-list-item.component.ts | 2 +- .../list-item-form.component.html | 12 +-- .../list-item-form.component.spec.ts | 12 +-- .../list-item-form.component.ts | 2 +- .../list-item/list-item.component.spec.ts | 6 +- .../list/list-item/list-item.component.ts | 2 +- src/app/project/list/list.component.html | 18 ++-- src/app/project/list/list.component.spec.ts | 16 ++-- src/app/project/list/list.component.ts | 3 +- .../ontology-form.component.spec.ts | 9 +- .../ontology-form/ontology-form.component.ts | 3 +- .../ontology-visualizer.component.spec.ts | 9 +- .../ontology-visualizer.component.ts | 2 +- .../ontology/ontology.component.spec.ts | 8 +- .../project/ontology/ontology.component.ts | 4 +- .../property-form.component.html | 12 +-- .../property-form.component.spec.ts | 3 +- .../property-form/property-form.component.ts | 3 +- .../property-info.component.spec.ts | 3 +- .../property-info/property-info.component.ts | 2 +- .../resource-class-form.component.html | 12 +-- .../resource-class-form.component.spec.ts | 20 +++-- .../resource-class-form.component.ts | 2 +- .../resource-class-info.component.spec.ts | 3 +- .../resource-class-info.component.ts | 3 +- .../permission/permission.component.spec.ts | 8 +- .../permission/permission.component.ts | 5 +- .../project-form/project-form.component.html | 8 +- .../project-form.component.spec.ts | 9 +- .../project-form/project-form.component.ts | 4 +- src/app/project/project.component.spec.ts | 9 +- src/app/project/project.component.ts | 3 +- .../projects-list.component.spec.ts | 9 +- .../projects-list/projects-list.component.ts | 9 +- .../projects/projects.component.spec.ts | 9 +- src/app/system/projects/projects.component.ts | 3 +- src/app/system/system.component.spec.ts | 4 +- src/app/system/system.component.ts | 2 +- .../users-list/users-list.component.spec.ts | 9 +- .../users/users-list/users-list.component.ts | 5 +- src/app/system/users/users.component.spec.ts | 9 +- src/app/system/users/users.component.ts | 2 +- .../user/account/account.component.spec.ts | 9 +- src/app/user/account/account.component.ts | 3 +- .../dashboard/dashboard.component.spec.ts | 9 +- src/app/user/dashboard/dashboard.component.ts | 3 +- .../membership/membership.component.spec.ts | 9 +- .../user/membership/membership.component.ts | 4 +- .../user/profile/profile.component.spec.ts | 9 +- src/app/user/profile/profile.component.ts | 3 +- .../password-form.component.spec.ts | 9 +- .../password-form/password-form.component.ts | 4 +- .../user-form/user-form.component.spec.ts | 9 +- src/app/user/user-form/user-form.component.ts | 4 +- .../user-menu/user-menu.component.spec.ts | 9 +- src/app/user/user-menu/user-menu.component.ts | 3 +- src/app/user/user.component.spec.ts | 9 +- src/app/user/user.component.ts | 3 +- .../intermediate.component.spec.ts | 3 +- .../resource/incoming.service.spec.ts | 2 +- .../workspace/resource/incoming.service.ts | 2 +- .../resource/project.service.spec.ts | 3 +- src/app/workspace/resource/project.service.ts | 3 +- .../properties/properties.component.spec.ts | 6 +- .../properties/properties.component.ts | 4 +- .../upload/upload-file.service.spec.ts | 2 +- .../upload/upload-file.service.ts | 2 +- .../representation/upload/upload.component.ts | 2 +- .../resource-instance-form.component.spec.ts | 11 +-- .../resource-instance-form.component.ts | 4 +- .../select-project.component.spec.ts | 6 +- .../resource-link-form.component.spec.ts | 10 +-- .../resource-link-form.component.ts | 3 +- .../resource/resource.component.spec.ts | 9 +- .../workspace/resource/resource.component.ts | 12 +-- .../workspace/results/results.component.html | 4 +- .../results/results.component.spec.ts | 9 +- test.config.ts | 2 +- 106 files changed, 352 insertions(+), 397 deletions(-) diff --git a/src/app/app.component.spec.ts b/src/app/app.component.spec.ts index 7bf06087a9..4f6b124f12 100644 --- a/src/app/app.component.spec.ts +++ b/src/app/app.component.spec.ts @@ -6,16 +6,11 @@ import { MatMenuModule } from '@angular/material/menu'; import { MatToolbarModule } from '@angular/material/toolbar'; import { RouterTestingModule } from '@angular/router/testing'; import { KnoraApiConnection } from '@dasch-swiss/dsp-js'; -import { - AppInitService, - DspActionModule, - DspApiConfigToken, - DspApiConnectionToken, - DspSearchModule -} from '@dasch-swiss/dsp-ui'; +import { AppInitService, DspActionModule, DspSearchModule } from '@dasch-swiss/dsp-ui'; import { TranslateModule } from '@ngx-translate/core'; import { TestConfig } from 'test.config'; import { AppComponent } from './app.component'; +import { DspApiConfigToken, DspApiConnectionToken } from './main/declarations/dsp-api-tokens'; import { HeaderComponent } from './main/header/header.component'; import { SelectLanguageComponent } from './main/select-language/select-language.component'; import { UserMenuComponent } from './user/user-menu/user-menu.component'; diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 2cef8761c9..93d474da4a 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -7,14 +7,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { KnoraApiConnection } from '@dasch-swiss/dsp-js'; -import { - DspActionModule, - DspApiConfigToken, - DspApiConnectionToken, - DspCoreModule, - DspSearchModule, - DspViewerModule -} from '@dasch-swiss/dsp-ui'; +import { DspActionModule, DspCoreModule, DspSearchModule, DspViewerModule } from '@dasch-swiss/dsp-ui'; import { TranslateLoader, TranslateModule } from '@ngx-translate/core'; import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { AngularSplitModule } from 'angular-split'; @@ -166,6 +159,7 @@ import { ResourceAndPropertySelectionComponent } from './workspace/search/advanc import { SearchSelectPropertyComponent } from './workspace/search/advanced-search/resource-and-property-selection/search-select-property/search-select-property.component'; import { SearchSelectResourceClassComponent } from './workspace/search/advanced-search/resource-and-property-selection/search-select-resource-class/search-select-resource-class.component'; import { SearchSelectOntologyComponent } from './workspace/search/advanced-search/search-select-ontology/search-select-ontology.component'; +import { DspApiConfigToken, DspApiConnectionToken } from './main/declarations/dsp-api-tokens'; // translate: AoT requires an exported function for factories export function httpLoaderFactory(httpClient: HttpClient) { diff --git a/src/app/main/cache/cache.service.spec.ts b/src/app/main/cache/cache.service.spec.ts index 92e47d567c..e79f34fc49 100644 --- a/src/app/main/cache/cache.service.spec.ts +++ b/src/app/main/cache/cache.service.spec.ts @@ -2,7 +2,8 @@ import { TestBed } from '@angular/core/testing'; import { MatDialogModule } from '@angular/material/dialog'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { DspActionModule, DspApiConnectionToken, DspCoreModule } from '@dasch-swiss/dsp-ui'; +import { DspActionModule, DspCoreModule } from '@dasch-swiss/dsp-ui'; +import { DspApiConnectionToken } from '../declarations/dsp-api-tokens'; import { CacheService } from './cache.service'; describe('CacheService', () => { diff --git a/src/app/main/error/error-handler.service.spec.ts b/src/app/main/error/error-handler.service.spec.ts index 56b6822462..614742af2e 100644 --- a/src/app/main/error/error-handler.service.spec.ts +++ b/src/app/main/error/error-handler.service.spec.ts @@ -2,7 +2,8 @@ import { TestBed } from '@angular/core/testing'; import { MatDialogModule } from '@angular/material/dialog'; import { MatSnackBarModule } from '@angular/material/snack-bar'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { DspActionModule, DspApiConnectionToken, DspCoreModule } from '@dasch-swiss/dsp-ui'; +import { DspActionModule, DspCoreModule } from '@dasch-swiss/dsp-ui'; +import { DspApiConnectionToken } from '../declarations/dsp-api-tokens'; import { ErrorHandlerService } from './error-handler.service'; describe('ErrorHandlerService', () => { diff --git a/src/app/main/error/error-handler.service.ts b/src/app/main/error/error-handler.service.ts index 4cecfed627..e7343294be 100644 --- a/src/app/main/error/error-handler.service.ts +++ b/src/app/main/error/error-handler.service.ts @@ -1,8 +1,10 @@ import { Inject, Injectable } from '@angular/core'; import { MatDialog, MatDialogConfig } from '@angular/material/dialog'; import { ApiResponseData, ApiResponseError, KnoraApiConnection, LogoutResponse } from '@dasch-swiss/dsp-js'; -import { DspApiConnectionToken, NotificationService, SessionService } from '@dasch-swiss/dsp-ui'; +import { DspApiConnectionToken } from '../declarations/dsp-api-tokens'; import { DialogComponent } from '../dialog/dialog.component'; +import { NotificationService } from '../services/notification.service'; +import { SessionService } from '../services/session.service'; @Injectable({ providedIn: 'root' diff --git a/src/app/main/guard/auth.guard.ts b/src/app/main/guard/auth.guard.ts index 75c33cb26a..07c73592e8 100644 --- a/src/app/main/guard/auth.guard.ts +++ b/src/app/main/guard/auth.guard.ts @@ -1,7 +1,7 @@ import { Injectable } from '@angular/core'; import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router'; import { Observable } from 'rxjs'; -import { SessionService } from '@dasch-swiss/dsp-ui'; +import { SessionService } from '../services/session.service'; @Injectable({ providedIn: 'root' diff --git a/src/app/main/header/header.component.html b/src/app/main/header/header.component.html index d78e08e897..5d2e39a905 100644 --- a/src/app/main/header/header.component.html +++ b/src/app/main/header/header.component.html @@ -13,12 +13,12 @@