[DURACOM-191] run angular script for migration

This commit is contained in:
Andrea Barbasso
2023-12-20 11:23:00 +01:00
parent 3a461eee80
commit 8b665a6d99
19 changed files with 158 additions and 123 deletions

View File

@@ -9,19 +9,17 @@ import { AdminQualityAssuranceSourcePageComponent } from './admin-quality-assura
import {NotificationsModule} from '../../notifications/notifications.module';
@NgModule({
imports: [
CommonModule,
SharedModule,
CoreModule.forRoot(),
AdminNotificationsRoutingModule,
NotificationsModule
],
declarations: [
AdminQualityAssuranceTopicsPageComponent,
AdminQualityAssuranceEventsPageComponent,
AdminQualityAssuranceSourcePageComponent
],
entryComponents: []
imports: [
CommonModule,
SharedModule,
CoreModule.forRoot(),
AdminNotificationsRoutingModule,
NotificationsModule,
AdminQualityAssuranceTopicsPageComponent,
AdminQualityAssuranceEventsPageComponent,
AdminQualityAssuranceSourcePageComponent
],
entryComponents: []
})
/**
* This module handles all components related to the notifications pages

View File

@@ -8,9 +8,9 @@ describe('AdminQualityAssuranceEventsPageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceEventsPageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
imports: [AdminQualityAssuranceEventsPageComponent],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));

View File

@@ -1,11 +1,14 @@
import { Component } from '@angular/core';
import { QualityAssuranceEventsComponent } from '../../../notifications/qa/events/quality-assurance-events.component';
/**
* Component for the page that show the QA events related to a specific topic.
*/
@Component({
selector: 'ds-quality-assurance-events-page',
templateUrl: './admin-quality-assurance-events-page.component.html'
selector: 'ds-quality-assurance-events-page',
templateUrl: './admin-quality-assurance-events-page.component.html',
standalone: true,
imports: [QualityAssuranceEventsComponent]
})
export class AdminQualityAssuranceEventsPageComponent {

View File

@@ -9,9 +9,9 @@ describe('AdminQualityAssuranceSourcePageComponent', () => {
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceSourcePageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
imports: [AdminQualityAssuranceSourcePageComponent],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
});

View File

@@ -1,10 +1,13 @@
import { Component } from '@angular/core';
import { QualityAssuranceSourceComponent } from '../../../notifications/qa/source/quality-assurance-source.component';
/**
* Component for the page that show the QA sources.
*/
@Component({
selector: 'ds-admin-quality-assurance-source-page-component',
templateUrl: './admin-quality-assurance-source-page.component.html',
selector: 'ds-admin-quality-assurance-source-page-component',
templateUrl: './admin-quality-assurance-source-page.component.html',
standalone: true,
imports: [QualityAssuranceSourceComponent]
})
export class AdminQualityAssuranceSourcePageComponent {}

View File

@@ -8,9 +8,9 @@ describe('AdminQualityAssuranceTopicsPageComponent', () => {
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ AdminQualityAssuranceTopicsPageComponent ],
schemas: [NO_ERRORS_SCHEMA]
})
imports: [AdminQualityAssuranceTopicsPageComponent],
schemas: [NO_ERRORS_SCHEMA]
})
.compileComponents();
}));

View File

@@ -1,11 +1,14 @@
import { Component } from '@angular/core';
import { QualityAssuranceTopicsComponent } from '../../../notifications/qa/topics/quality-assurance-topics.component';
/**
* Component for the page that show the QA topics related to a specific source.
*/
@Component({
selector: 'ds-notification-qa-page',
templateUrl: './admin-quality-assurance-topics-page.component.html'
selector: 'ds-notification-qa-page',
templateUrl: './admin-quality-assurance-topics-page.component.html',
standalone: true,
imports: [QualityAssuranceTopicsComponent]
})
export class AdminQualityAssuranceTopicsPageComponent {

View File

@@ -79,7 +79,8 @@ describe('ItemEditBitstreamComponent', () => {
TranslateModule.forRoot(),
RouterTestingModule.withRoutes([]),
ItemEditBitstreamComponent,
VarDirective],
VarDirective
],
declarations: [BrowserOnlyMockPipe],
providers: [
{ provide: ObjectUpdatesService, useValue: objectUpdatesService },

View File

@@ -60,23 +60,21 @@ const PROVIDERS = [
@NgModule({
imports: [
...MODULES
...MODULES,
...COMPONENTS,
...DIRECTIVES,
...ENTRY_COMPONENTS
],
declarations: [
...COMPONENTS,
...DIRECTIVES,
...ENTRY_COMPONENTS
],
providers: [
...PROVIDERS
],
entryComponents: [
...ENTRY_COMPONENTS
],
exports: [
...COMPONENTS,
...DIRECTIVES
]
providers: [
...PROVIDERS
],
entryComponents: [
...ENTRY_COMPONENTS
],
exports: [
...COMPONENTS,
...DIRECTIVES
]
})
/**

View File

@@ -103,15 +103,13 @@ describe('QualityAssuranceEventsComponent test suite', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
imports: [
CommonModule,
TranslateModule.forRoot(),
],
declarations: [
QualityAssuranceEventsComponent,
TestComponent,
],
providers: [
TestComponent
],
providers: [
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub(activatedRouteParamsMap, activatedRouteParams) },
{ provide: QualityAssuranceEventDataService, useValue: qualityAssuranceEventRestServiceStub },
{ provide: NgbModal, useValue: modalStub },
@@ -119,9 +117,9 @@ describe('QualityAssuranceEventsComponent test suite', () => {
{ provide: TranslateService, useValue: getMockTranslateService() },
{ provide: PaginationService, useValue: paginationService },
QualityAssuranceEventsComponent
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then();
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then();
scheduler = getTestScheduler();
}));
@@ -332,8 +330,10 @@ describe('QualityAssuranceEventsComponent test suite', () => {
// declare a test component
@Component({
selector: 'ds-test-cmp',
template: ``
selector: 'ds-test-cmp',
template: ``,
standalone: true,
imports: [CommonModule]
})
class TestComponent {

View File

@@ -1,8 +1,8 @@
import { Component, OnDestroy, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService } from '@ngx-translate/core';
import { NgbModal, NgbTooltipModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateService, TranslateModule } from '@ngx-translate/core';
import { BehaviorSubject, combineLatest, from, Observable, of, Subscription } from 'rxjs';
import { distinctUntilChanged, last, map, mergeMap, scan, switchMap, take, tap } from 'rxjs/operators';
@@ -31,14 +31,20 @@ import { PaginationService } from '../../../core/pagination/pagination.service';
import { Item } from '../../../core/shared/item.model';
import { FindListOptions } from '../../../core/data/find-list-options.model';
import {environment} from '../../../../environments/environment';
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { AlertComponent } from '../../../shared/alert/alert.component';
/**
* Component to display the Quality Assurance event list.
*/
@Component({
selector: 'ds-quality-assurance-events',
templateUrl: './quality-assurance-events.component.html',
styleUrls: ['./quality-assurance-events.component.scss'],
selector: 'ds-quality-assurance-events',
templateUrl: './quality-assurance-events.component.html',
styleUrls: ['./quality-assurance-events.component.scss'],
standalone: true,
imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, NgbTooltipModule, AsyncPipe, TranslateModule]
})
export class QualityAssuranceEventsComponent implements OnInit, OnDestroy {
/**

View File

@@ -71,22 +71,20 @@ describe('ProjectEntryImportModalComponent test suite', () => {
beforeEach(async (() => {
TestBed.configureTestingModule({
imports: [
imports: [
CommonModule,
TranslateModule.forRoot(),
],
declarations: [
ProjectEntryImportModalComponent,
TestComponent,
],
providers: [
TestComponent
],
providers: [
{ provide: NgbActiveModal, useValue: modalStub },
{ provide: SearchService, useValue: searchServiceStub },
{ provide: SelectableListService, useValue: jasmine.createSpyObj('selectableListService', ['deselect', 'select', 'deselectAll']) },
ProjectEntryImportModalComponent
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then();
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then();
}));
// First test to check the correct component creation
@@ -202,8 +200,10 @@ describe('ProjectEntryImportModalComponent test suite', () => {
// declare a test component
@Component({
selector: 'ds-test-cmp',
template: ``
selector: 'ds-test-cmp',
template: ``,
standalone: true,
imports: [CommonModule]
})
class TestComponent {
eventData = eventData;

View File

@@ -18,6 +18,13 @@ import {
} from '../../../core/notifications/qa/models/quality-assurance-event.model';
import { hasValue, isNotEmpty } from '../../../shared/empty.util';
import { Item } from '../../../core/shared/item.model';
import { TranslateModule } from '@ngx-translate/core';
import { AlertComponent } from '../../../shared/alert/alert.component';
import { ThemedSearchResultsComponent } from '../../../shared/search/search-results/themed-search-results.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { FormsModule } from '@angular/forms';
import { NgIf, AsyncPipe } from '@angular/common';
import { RouterLink } from '@angular/router';
/**
* The possible types of import for the external entry
@@ -77,9 +84,11 @@ export interface QualityAssuranceEventData {
}
@Component({
selector: 'ds-project-entry-import-modal',
styleUrls: ['./project-entry-import-modal.component.scss'],
templateUrl: './project-entry-import-modal.component.html'
selector: 'ds-project-entry-import-modal',
styleUrls: ['./project-entry-import-modal.component.scss'],
templateUrl: './project-entry-import-modal.component.html',
standalone: true,
imports: [RouterLink, NgIf, FormsModule, LoadingComponent, ThemedSearchResultsComponent, AlertComponent, AsyncPipe, TranslateModule]
})
/**
* Component to display a modal window for linking a project to an Quality Assurance event

View File

@@ -31,22 +31,20 @@ describe('QualityAssuranceSourceComponent test suite', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
imports: [
CommonModule,
TranslateModule.forRoot(),
],
declarations: [
QualityAssuranceSourceComponent,
TestComponent,
],
providers: [
TestComponent
],
providers: [
{ provide: NotificationsStateService, useValue: mockNotificationsStateService },
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), params: observableOf({}) } },
{ provide: PaginationService, useValue: paginationService },
QualityAssuranceSourceComponent
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => {
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => {
mockNotificationsStateService.getQualityAssuranceSource.and.returnValue(observableOf([
qualityAssuranceSourceObjectMorePid,
qualityAssuranceSourceObjectMoreAbstract
@@ -144,8 +142,10 @@ describe('QualityAssuranceSourceComponent test suite', () => {
// declare a test component
@Component({
selector: 'ds-test-cmp',
template: ``
selector: 'ds-test-cmp',
template: ``,
standalone: true,
imports: [CommonModule]
})
class TestComponent {

View File

@@ -8,14 +8,22 @@ import { PaginationComponentOptions } from '../../../shared/pagination/paginatio
import { NotificationsStateService } from '../../notifications-state.service';
import { AdminQualityAssuranceSourcePageParams } from '../../../admin/admin-notifications/admin-quality-assurance-source-page-component/admin-quality-assurance-source-page-resolver.service';
import { hasValue } from '../../../shared/empty.util';
import { TranslateModule } from '@ngx-translate/core';
import { RouterLink } from '@angular/router';
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { AlertComponent } from '../../../shared/alert/alert.component';
/**
* Component to display the Quality Assurance source list.
*/
@Component({
selector: 'ds-quality-assurance-source',
templateUrl: './quality-assurance-source.component.html',
styleUrls: ['./quality-assurance-source.component.scss']
selector: 'ds-quality-assurance-source',
templateUrl: './quality-assurance-source.component.html',
styleUrls: ['./quality-assurance-source.component.scss'],
standalone: true,
imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, AsyncPipe, TranslateModule]
})
export class QualityAssuranceSourceComponent implements OnInit {

View File

@@ -33,28 +33,26 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [
imports: [
CommonModule,
TranslateModule.forRoot(),
],
declarations: [
QualityAssuranceTopicsComponent,
TestComponent,
],
providers: [
TestComponent
],
providers: [
{ provide: NotificationsStateService, useValue: mockNotificationsStateService },
{ provide: ActivatedRoute, useValue: { data: observableOf(activatedRouteParams), snapshot: {
paramMap: {
get: () => 'openaire',
},
}}},
paramMap: {
get: () => 'openaire',
},
} } },
{ provide: PaginationService, useValue: paginationService },
QualityAssuranceTopicsComponent,
// tslint:disable-next-line: no-empty
{ provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } }}
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => {
{ provide: QualityAssuranceTopicsService, useValue: { setSourceId: (sourceId: string) => { } } }
],
schemas: [NO_ERRORS_SCHEMA]
}).compileComponents().then(() => {
mockNotificationsStateService.getQualityAssuranceTopics.and.returnValue(observableOf([
qualityAssuranceTopicObjectMorePid,
qualityAssuranceTopicObjectMoreAbstract
@@ -152,8 +150,10 @@ describe('QualityAssuranceTopicsComponent test suite', () => {
// declare a test component
@Component({
selector: 'ds-test-cmp',
template: ``
selector: 'ds-test-cmp',
template: ``,
standalone: true,
imports: [CommonModule]
})
class TestComponent {

View File

@@ -14,16 +14,23 @@ import {
AdminQualityAssuranceTopicsPageParams
} from '../../../admin/admin-notifications/admin-quality-assurance-topics-page/admin-quality-assurance-topics-page-resolver.service';
import { PaginationService } from '../../../core/pagination/pagination.service';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, RouterLink } from '@angular/router';
import { QualityAssuranceTopicsService } from './quality-assurance-topics.service';
import { TranslateModule } from '@ngx-translate/core';
import { PaginationComponent } from '../../../shared/pagination/pagination.component';
import { LoadingComponent } from '../../../shared/loading/loading.component';
import { NgIf, NgFor, AsyncPipe } from '@angular/common';
import { AlertComponent } from '../../../shared/alert/alert.component';
/**
* Component to display the Quality Assurance topic list.
*/
@Component({
selector: 'ds-quality-assurance-topic',
templateUrl: './quality-assurance-topics.component.html',
styleUrls: ['./quality-assurance-topics.component.scss'],
selector: 'ds-quality-assurance-topic',
templateUrl: './quality-assurance-topics.component.html',
styleUrls: ['./quality-assurance-topics.component.scss'],
standalone: true,
imports: [AlertComponent, NgIf, LoadingComponent, PaginationComponent, NgFor, RouterLink, AsyncPipe, TranslateModule]
})
export class QualityAssuranceTopicsComponent implements OnInit {
/**

View File

@@ -79,17 +79,17 @@ describe('AuthNavMenuComponent', () => {
}),
TranslateModule.forRoot(),
AuthNavMenuComponent
],
declarations: [BrowserOnlyMockPipe],
providers: [
{ provide: HostWindowService, useValue: window },
{ provide: AuthService, useValue: authService },
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
})
],
declarations: [BrowserOnlyMockPipe],
providers: [
{ provide: HostWindowService, useValue: window },
{ provide: AuthService, useValue: authService },
{ provide: ActivatedRoute, useValue: new ActivatedRouteStub() },
],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
})
.compileComponents();
}));

View File

@@ -199,8 +199,7 @@ export function configureSearchComponentTestingModule(compType, additionalDeclar
searchConfigurationServiceStub.paginatedSearchOptions = new BehaviorSubject(new PaginatedSearchOptions({pagination: {id: 'default'} as any}));
TestBed.configureTestingModule({
declarations: [...additionalDeclarations],
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, NgbCollapseModule, compType],
imports: [TranslateModule.forRoot(), RouterTestingModule.withRoutes([]), NoopAnimationsModule, NgbCollapseModule, compType, ...additionalDeclarations],
providers: [
{ provide: SearchService, useValue: searchServiceStub },
{