From 587affd06436f4a3bda19c6f856f4ae01536a6e8 Mon Sep 17 00:00:00 2001 From: Giuseppe Digilio Date: Fri, 4 Dec 2020 10:16:37 +0100 Subject: [PATCH] added missing decorator for classes that use Angular features --- .../workflow-item-action-page.component.ts | 7 +++++-- .../parameter-value-input/value-input.component.ts | 7 +++++-- .../profile-page-metadata-form.component.ts | 7 ++++--- .../dso-selector-modal-wrapper.component.ts | 9 +++++---- .../models/dynamic-vocabulary.component.ts | 7 +++++-- .../abstract/claimed-task-actions-abstract.component.ts | 7 +++++-- src/app/shared/mydspace-actions/mydspace-actions.ts | 7 +++++-- .../object-select/object-select.component.ts | 7 +++++-- ...stract-paginated-drag-and-drop-list.component.spec.ts | 7 +++++-- .../abstract-paginated-drag-and-drop-list.component.ts | 7 +++++-- .../shared/starts-with/starts-with-abstract.component.ts | 9 ++++++--- .../statistics-page/statistics-page.component.ts | 7 +++++-- src/app/submission/sections/models/section.model.ts | 7 +++++-- 13 files changed, 65 insertions(+), 30 deletions(-) diff --git a/src/app/+workflowitems-edit-page/workflow-item-action-page.component.ts b/src/app/+workflowitems-edit-page/workflow-item-action-page.component.ts index a683fdc98e..87f46aeb39 100644 --- a/src/app/+workflowitems-edit-page/workflow-item-action-page.component.ts +++ b/src/app/+workflowitems-edit-page/workflow-item-action-page.component.ts @@ -1,4 +1,4 @@ -import { OnInit, Directive } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { Observable } from 'rxjs'; import { map, switchMap, take } from 'rxjs/operators'; import { TranslateService } from '@ngx-translate/core'; @@ -15,7 +15,10 @@ import { isEmpty } from '../shared/empty.util'; /** * Abstract component representing a page to perform an action on a workflow item */ -@Directive() +@Component({ + selector: 'ds-workflowitem-action-page', + template: '' +}) export abstract class WorkflowItemActionPageComponent implements OnInit { public type; public wfi$: Observable; diff --git a/src/app/process-page/form/process-parameters/parameter-value-input/value-input.component.ts b/src/app/process-page/form/process-parameters/parameter-value-input/value-input.component.ts index bbac174b9b..b8a7391487 100644 --- a/src/app/process-page/form/process-parameters/parameter-value-input/value-input.component.ts +++ b/src/app/process-page/form/process-parameters/parameter-value-input/value-input.component.ts @@ -1,9 +1,12 @@ -import { EventEmitter, Input, Output, Directive } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; /** * Abstract class that represents value input components */ -@Directive() +@Component({ + selector: 'ds-value-input', + template: '' +}) export abstract class ValueInputComponent { @Input() index: number; /** diff --git a/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.ts b/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.ts index c1216cbb5f..3d3eed4571 100644 --- a/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.ts +++ b/src/app/profile-page/profile-page-metadata-form/profile-page-metadata-form.component.ts @@ -1,8 +1,9 @@ -import { Component, Inject, Input, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { DynamicFormControlModel, DynamicFormValueControlModel, - DynamicInputModel, DynamicSelectModel + DynamicInputModel, + DynamicSelectModel } from '@ng-dynamic-forms/core'; import { FormGroup } from '@angular/forms'; import { EPerson } from '../../core/eperson/models/eperson.model'; @@ -124,7 +125,7 @@ export class ProfilePageMetadataFormComponent implements OnInit { */ setFormValues() { this.formModel.forEach( - (fieldModel: DynamicInputModel | DynamicSelectModel) => { + (fieldModel: any) => { if (fieldModel.name === 'email') { fieldModel.value = this.user.email; } else { diff --git a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts index fceab5c414..bd6aa5b9e6 100644 --- a/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts +++ b/src/app/shared/dso-selector/modal-wrappers/dso-selector-modal-wrapper.component.ts @@ -1,4 +1,4 @@ -import { Injectable, Input, OnInit, Directive } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { ActivatedRoute, ActivatedRouteSnapshot } from '@angular/router'; import { DSpaceObject } from '../../../core/shared/dspace-object.model'; import { RemoteData } from '../../../core/data/remote-data'; @@ -15,9 +15,10 @@ export enum SelectorActionType { /** * Abstract base class that represents a wrapper for modal content used to select a DSpace Object */ - -@Directive() -@Injectable() +@Component({ + selector: 'ds-dso-selector-modal', + template: '' +}) export abstract class DSOSelectorModalWrapperComponent implements OnInit { /** * The current page's DSO diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts index 7676d5858f..3b75c28efc 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/models/dynamic-vocabulary.component.ts @@ -1,4 +1,4 @@ -import { EventEmitter, Input, Output, Directive } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { FormGroup } from '@angular/forms'; import { @@ -19,7 +19,10 @@ import { PageInfo } from '../../../../../core/shared/page-info.model'; /** * An abstract class to be extended by form components that handle vocabulary */ -@Directive() +@Component({ + selector: 'ds-dynamic-vocabulary', + template: '' +}) export abstract class DsDynamicVocabularyComponent extends DynamicFormControlComponent { @Input() abstract group: FormGroup; diff --git a/src/app/shared/mydspace-actions/claimed-task/abstract/claimed-task-actions-abstract.component.ts b/src/app/shared/mydspace-actions/claimed-task/abstract/claimed-task-actions-abstract.component.ts index ead16c0556..da03fbc3ad 100644 --- a/src/app/shared/mydspace-actions/claimed-task/abstract/claimed-task-actions-abstract.component.ts +++ b/src/app/shared/mydspace-actions/claimed-task/abstract/claimed-task-actions-abstract.component.ts @@ -1,4 +1,4 @@ -import { Directive, EventEmitter, Input, Output } from '@angular/core'; +import { Component, EventEmitter, Input, Output } from '@angular/core'; import { ClaimedTask } from '../../../../core/tasks/models/claimed-task-object.model'; import { BehaviorSubject } from 'rxjs'; import { ClaimedTaskDataService } from '../../../../core/tasks/claimed-task-data.service'; @@ -11,7 +11,10 @@ import { ProcessTaskResponse } from '../../../../core/tasks/models/process-task- * - Add a @rendersWorkflowTaskOption annotation to your component providing the same enum value * - Optionally overwrite createBody if the request body requires more than just the option */ -@Directive() +@Component({ + selector: 'ds-calim-task-action-abstract', + template: '' +}) export abstract class ClaimedTaskActionsAbstractComponent { /** * The workflow task option the child component represents diff --git a/src/app/shared/mydspace-actions/mydspace-actions.ts b/src/app/shared/mydspace-actions/mydspace-actions.ts index 4787f58387..61f7b43869 100644 --- a/src/app/shared/mydspace-actions/mydspace-actions.ts +++ b/src/app/shared/mydspace-actions/mydspace-actions.ts @@ -1,5 +1,5 @@ import { Router } from '@angular/router'; -import { Injector, Input, Directive } from '@angular/core'; +import { Component, Injector, Input } from '@angular/core'; import { find, take, tap } from 'rxjs/operators'; @@ -18,7 +18,10 @@ import { SearchService } from '../../core/shared/search/search.service'; /** * Abstract class for all different representations of mydspace actions */ -@Directive() +@Component({ + selector: 'ds-mydspace-actions-abstract', + template: '' +}) export abstract class MyDSpaceActionsComponent> { /** diff --git a/src/app/shared/object-select/object-select/object-select.component.ts b/src/app/shared/object-select/object-select/object-select.component.ts index 77c848347f..b52637d70c 100644 --- a/src/app/shared/object-select/object-select/object-select.component.ts +++ b/src/app/shared/object-select/object-select/object-select.component.ts @@ -1,4 +1,4 @@ -import { EventEmitter, Input, OnDestroy, OnInit, Output, Directive } from '@angular/core'; +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { take } from 'rxjs/operators'; import { Observable } from 'rxjs'; import { RemoteData } from '../../../core/data/remote-data'; @@ -10,7 +10,10 @@ import { SortOptions } from '../../../core/cache/models/sort-options.model'; /** * An abstract component used to select DSpaceObjects from a specific list and returning the UUIDs of the selected DSpaceObjects */ -@Directive() +@Component({ + selector: 'ds-object-select-abstract', + template: '' +}) export abstract class ObjectSelectComponent implements OnInit, OnDestroy { /** diff --git a/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.spec.ts b/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.spec.ts index 266e50b09a..75f99f35b3 100644 --- a/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.spec.ts +++ b/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.spec.ts @@ -1,7 +1,7 @@ import { AbstractPaginatedDragAndDropListComponent } from './abstract-paginated-drag-and-drop-list.component'; import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { ObjectUpdatesService } from '../../core/data/object-updates/object-updates.service'; -import { Directive, ElementRef } from '@angular/core'; +import { Component, ElementRef } from '@angular/core'; import { BehaviorSubject, Observable, of as observableOf } from 'rxjs'; import { PaginatedList } from '../../core/data/paginated-list'; import { RemoteData } from '../../core/data/remote-data'; @@ -12,7 +12,10 @@ import { createSuccessfulRemoteDataObject } from '../remote-data.utils'; import { createPaginatedList } from '../testing/utils.test'; import { ObjectValuesPipe } from '../utils/object-values-pipe'; -@Directive() +@Component({ + selector: 'ds-mock-paginated-drag-drop-abstract', + template: '' +}) class MockAbstractPaginatedDragAndDropListComponent extends AbstractPaginatedDragAndDropListComponent { constructor(protected objectUpdatesService: ObjectUpdatesService, diff --git a/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.ts b/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.ts index 1a9bee6875..ccb5d92a5a 100644 --- a/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.ts +++ b/src/app/shared/pagination-drag-and-drop/abstract-paginated-drag-and-drop-list.component.ts @@ -9,7 +9,7 @@ import { hasValue } from '../empty.util'; import { paginatedListToArray } from '../../core/shared/operators'; import { DSpaceObject } from '../../core/shared/dspace-object.model'; import { CdkDragDrop, moveItemInArray } from '@angular/cdk/drag-drop'; -import { Directive, ElementRef, EventEmitter, OnDestroy, Output, ViewChild } from '@angular/core'; +import { Component, ElementRef, EventEmitter, OnDestroy, Output, ViewChild } from '@angular/core'; import { PaginationComponent } from '../pagination/pagination.component'; import { ObjectValuesPipe } from '../utils/object-values-pipe'; import { compareArraysUsing } from '../../+item-page/simple/item-types/shared/item-relationships-utils'; @@ -36,7 +36,10 @@ export const compareArraysUsingFieldUuids = () => * * An example component extending from this abstract component: PaginatedDragAndDropBitstreamListComponent */ -@Directive() +@Component({ + selector: 'ds-paginated-drag-drop-abstract', + template: '' +}) export abstract class AbstractPaginatedDragAndDropListComponent implements OnDestroy { /** * A view on the child pagination component diff --git a/src/app/shared/starts-with/starts-with-abstract.component.ts b/src/app/shared/starts-with/starts-with-abstract.component.ts index a6ddc7dfe3..229777e96d 100644 --- a/src/app/shared/starts-with/starts-with-abstract.component.ts +++ b/src/app/shared/starts-with/starts-with-abstract.component.ts @@ -1,4 +1,4 @@ -import { Directive, Inject, OnDestroy, OnInit } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { Subscription } from 'rxjs'; import { FormControl, FormGroup } from '@angular/forms'; @@ -7,8 +7,11 @@ import { hasValue } from '../empty.util'; /** * An abstract component to render StartsWith options */ -@Directive() -export class StartsWithAbstractComponent implements OnInit, OnDestroy { +@Component({ + selector: 'ds-start-with-abstract', + template: '' +}) +export abstract class StartsWithAbstractComponent implements OnInit, OnDestroy { /** * The currently selected startsWith in string format */ diff --git a/src/app/statistics-page/statistics-page/statistics-page.component.ts b/src/app/statistics-page/statistics-page/statistics-page.component.ts index e61fd6153b..3c6ddbce41 100644 --- a/src/app/statistics-page/statistics-page/statistics-page.component.ts +++ b/src/app/statistics-page/statistics-page/statistics-page.component.ts @@ -1,4 +1,4 @@ -import { OnInit, Directive } from '@angular/core'; +import { Component, OnInit } from '@angular/core'; import { combineLatest, Observable } from 'rxjs'; import { UsageReportService } from '../../core/statistics/usage-report-data.service'; import { map, switchMap } from 'rxjs/operators'; @@ -12,7 +12,10 @@ import { DSONameService } from '../../core/breadcrumbs/dso-name.service'; /** * Class representing an abstract statistics page component. */ -@Directive() +@Component({ + selector: 'ds-statistics-page', + templateUrl: '' +}) export abstract class StatisticsPageComponent implements OnInit { /** diff --git a/src/app/submission/sections/models/section.model.ts b/src/app/submission/sections/models/section.model.ts index 086515665e..0626e87dc9 100644 --- a/src/app/submission/sections/models/section.model.ts +++ b/src/app/submission/sections/models/section.model.ts @@ -1,4 +1,4 @@ -import { Inject, OnDestroy, OnInit, Directive } from '@angular/core'; +import { Component, Inject, OnDestroy, OnInit } from '@angular/core'; import { Observable, Subscription } from 'rxjs'; import { filter, startWith } from 'rxjs/operators'; @@ -14,7 +14,10 @@ export interface SectionDataModel { /** * An abstract model class for a submission edit form section. */ -@Directive() +@Component({ + selector: 'ds-section-model', + template: '' +}) export abstract class SectionModelComponent implements OnDestroy, OnInit, SectionDataModel { protected abstract sectionService: SectionsService;