diff --git a/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts index ab06f0cad5..7baf260c61 100644 --- a/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts +++ b/src/app/+item-page/simple/item-types/shared/item-relationships-utils.ts @@ -95,4 +95,4 @@ export const paginatedRelationsToItems = (thisId: string) => ) ) }) - ); \ No newline at end of file + ); diff --git a/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.ts b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.ts index 28e575634c..d20bee2d4a 100644 --- a/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.ts +++ b/src/app/+item-page/simple/related-entities/related-entities-search/related-entities-search.component.ts @@ -49,9 +49,6 @@ export class RelatedEntitiesSearchComponent implements OnInit { fixedFilter: string; configuration$: Observable; - constructor() { - } - ngOnInit(): void { if (isNotEmpty(this.relationType) && isNotEmpty(this.item)) { this.fixedFilter = getFilterByRelation(this.relationType, this.item.id); diff --git a/src/app/+search-page/search-page.module.ts b/src/app/+search-page/search-page.module.ts index bb64d0c123..3234e814af 100644 --- a/src/app/+search-page/search-page.module.ts +++ b/src/app/+search-page/search-page.module.ts @@ -8,7 +8,6 @@ import { ConfigurationSearchPageGuard } from './configuration-search-page.guard' import { ConfigurationSearchPageComponent } from './configuration-search-page.component'; import { FilteredSearchPageComponent } from './filtered-search-page.component'; - const components = [ SearchPageComponent, FilteredSearchPageComponent, diff --git a/src/app/core/data/relationship-type.service.spec.ts b/src/app/core/data/relationship-type.service.spec.ts index 12ad82e374..118baf8738 100644 --- a/src/app/core/data/relationship-type.service.spec.ts +++ b/src/app/core/data/relationship-type.service.spec.ts @@ -12,7 +12,7 @@ import { ItemType } from '../shared/item-relationships/item-type.model'; describe('RelationshipTypeService', () => { let service: RelationshipTypeService; - let requestService : RequestService; + let requestService: RequestService; let restEndpointURL; let halService: any; let publicationTypeString; @@ -23,8 +23,6 @@ describe('RelationshipTypeService', () => { let orgUnitType; let relationshipType1; - - let relationshipType2; let buildList; @@ -49,7 +47,6 @@ describe('RelationshipTypeService', () => { rightType: createSuccessfulRemoteDataObject$(personType) }); - relationshipType2 = Object.assign(new RelationshipType(), { id: '2', uuid: '2', diff --git a/src/app/core/data/relationship-type.service.ts b/src/app/core/data/relationship-type.service.ts index 7a2c8af681..a30dd5d57e 100644 --- a/src/app/core/data/relationship-type.service.ts +++ b/src/app/core/data/relationship-type.service.ts @@ -56,9 +56,13 @@ export class RelationshipTypeService { /* Flatten the page so we can treat it like an observable */ switchMap((typeListRD: RemoteData>) => typeListRD.payload.page), switchMap((type: RelationshipType) => { - if (type.leftwardType === label) return this.checkType(type, firstType, secondType); - else if (type.rightwardType === label) return this.checkType(type, secondType, firstType); - else return []; + if (type.leftwardType === label) { + return this.checkType(type, firstType, secondType); + } else if (type.rightwardType === label) { + return this.checkType(type, secondType, firstType); + } else { + return []; + } }), ); } @@ -74,4 +78,4 @@ export class RelationshipTypeService { map(() => type) ); } -} \ No newline at end of file +} diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index b57b0b924e..70b59b614e 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -30,7 +30,6 @@ import { AppState, keySelector } from '../../app.reducer'; import { NameVariantListState } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer'; import { RemoveNameVariantAction, SetNameVariantAction } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions'; - const relationshipListsStateSelector = (state: AppState) => state.relationshipLists; const relationshipListStateSelector = (listID: string): MemoizedSelector => { @@ -313,7 +312,7 @@ export class RelationshipService extends DataService { relation.relationshipType.pipe( getSucceededRemoteData(), getRemoteDataPayload(), - map(type => { + map((type) => { return { relation, type } }) ) diff --git a/src/app/core/eperson/models/normalized-group.model.ts b/src/app/core/eperson/models/normalized-group.model.ts index 1d75905b14..72b4e7b1a4 100644 --- a/src/app/core/eperson/models/normalized-group.model.ts +++ b/src/app/core/eperson/models/normalized-group.model.ts @@ -34,4 +34,3 @@ export class NormalizedGroup extends NormalizedDSpaceObject implements Ca @autoserialize public permanent: boolean; } - diff --git a/src/app/core/router/router.actions.ts b/src/app/core/router/router.actions.ts index bb9497106e..e12356f372 100644 --- a/src/app/core/router/router.actions.ts +++ b/src/app/core/router/router.actions.ts @@ -1,6 +1,5 @@ import { Action } from '@ngrx/store'; import { type } from '../../shared/ngrx/type'; -import { Params } from '@angular/router'; /** * The list of HrefIndexAction type definitions @@ -18,12 +17,6 @@ export const RouterActionTypes = { */ export class RouteUpdateAction implements Action { type = RouterActionTypes.ROUTE_UPDATE; - - /** - * Create a new RouteUpdateAction - */ - constructor() { - } } /* tslint:enable:max-classes-per-file */ diff --git a/src/app/core/router/router.effects.ts b/src/app/core/router/router.effects.ts index 2865d54922..b73d11c1d6 100644 --- a/src/app/core/router/router.effects.ts +++ b/src/app/core/router/router.effects.ts @@ -19,7 +19,7 @@ export class RouterEffects { map((actions: RouterNavigationAction[]) => actions.map((navigateAction) => { const urlTree = this.router.parseUrl(navigateAction.payload.routerState.url); - return urlTree.root.children['primary'].segments.map(it => it.path).join('/'); + return urlTree.root.children.primary.segments.map((it) => it.path).join('/'); })), filter((actions: string[]) => actions[0] !== actions[1]), map(() => new RouteUpdateAction()) diff --git a/src/app/core/services/route.reducer.ts b/src/app/core/services/route.reducer.ts index 666e1d655a..2d5356a5db 100644 --- a/src/app/core/services/route.reducer.ts +++ b/src/app/core/services/route.reducer.ts @@ -94,4 +94,4 @@ function setParameter(state: RouteState, action: SetParameterAction | SetQueryPa const subState = state[paramType]; const newSubstate = Object.assign({}, subState, { [action.payload.key]: action.payload.value }); return Object.assign({}, state, { [paramType]: newSubstate }); -} \ No newline at end of file +} diff --git a/src/app/core/shared/operators.ts b/src/app/core/shared/operators.ts index 57161aff6c..0d1aa74591 100644 --- a/src/app/core/shared/operators.ts +++ b/src/app/core/shared/operators.ts @@ -126,9 +126,8 @@ export const getFirstOccurrence = () => map((rd) => Object.assign(rd, { payload: rd.payload.page.length > 0 ? rd.payload.page[0] : undefined })) ); - export const obsLog = (logString?: string) => (source: Observable): Observable => source.pipe( tap((t) => console.log(logString || '', t)) - ); \ No newline at end of file + ); diff --git a/src/app/core/shared/page-info.model.ts b/src/app/core/shared/page-info.model.ts index db18682d63..273510da60 100644 --- a/src/app/core/shared/page-info.model.ts +++ b/src/app/core/shared/page-info.model.ts @@ -5,21 +5,6 @@ import { hasValue } from '../../shared/empty.util'; * Represents the state of a paginated response */ export class PageInfo { - constructor( - options?: { - elementsPerPage: number, - totalElements: number, - totalPages: number, - currentPage: number - } - ) { - if (hasValue(options)) { - this.elementsPerPage = options.elementsPerPage; - this.totalElements = options.totalElements; - this.totalPages = options.totalPages; - this.currentPage = options.currentPage; - } - } /** * The number of elements on a page @@ -59,4 +44,20 @@ export class PageInfo { @autoserialize self: string; + + constructor( + options?: { + elementsPerPage: number, + totalElements: number, + totalPages: number, + currentPage: number + } + ) { + if (hasValue(options)) { + this.elementsPerPage = options.elementsPerPage; + this.totalElements = options.totalElements; + this.totalPages = options.totalPages; + this.currentPage = options.currentPage; + } + } } diff --git a/src/app/core/utilities/equals.decorators.ts b/src/app/core/utilities/equals.decorators.ts index dd2aef8bfa..6dde05922e 100644 --- a/src/app/core/utilities/equals.decorators.ts +++ b/src/app/core/utilities/equals.decorators.ts @@ -32,6 +32,7 @@ export function excludeFromEquals(object: any, propertyName: string): any { excludedFromEquals.set(object.constructor, [...list, propertyName]); } +// tslint:disable-next-line:ban-types export function getExcludedFromEqualsFor(constructor: Function): string[] { return excludedFromEquals.get(constructor) || []; } @@ -50,8 +51,8 @@ export function fieldsForEquals(...fields: string[]): any { } } - +// tslint:disable-next-line:ban-types export function getFieldsForEquals(constructor: Function, field: string): string[] { const fieldMap = fieldsForEqualsMap.get(constructor) || new Map(); return fieldMap.get(field); -} \ No newline at end of file +} diff --git a/src/app/core/utilities/equatable.spec.ts b/src/app/core/utilities/equatable.spec.ts index 52524360f3..79136cd221 100644 --- a/src/app/core/utilities/equatable.spec.ts +++ b/src/app/core/utilities/equatable.spec.ts @@ -14,6 +14,7 @@ class Dog extends EquatableObject { public favouriteToy: { name: string, colour: string }; } +// tslint:disable-next-line:max-classes-per-file class Owner extends EquatableObject { @excludeFromEquals favouriteFood: string; @@ -110,4 +111,3 @@ describe('equatable', () => { expect(isEqual).toBe(false); }); }); - diff --git a/src/app/core/utilities/equatable.ts b/src/app/core/utilities/equatable.ts index 9699c77b80..1029a295ba 100644 --- a/src/app/core/utilities/equatable.ts +++ b/src/app/core/utilities/equatable.ts @@ -39,4 +39,4 @@ export abstract class EquatableObject { const keys = Object.keys(this).filter((key) => !excludedKeys.includes(key)); return equalsByFields(this, other, keys); } -} \ No newline at end of file +} diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts index f94154e870..fc53df8497 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/org-unit/org-unit-search-result-list-submission-element.component.spec.ts @@ -26,7 +26,6 @@ let mockItemWithoutMetadata: ItemSearchResult; let nameVariant; let mockRelationshipService; - function init() { mockItemWithMetadata = Object.assign( new ItemSearchResult(), @@ -65,7 +64,7 @@ function init() { }) }); - nameVariant = "Doe J."; + nameVariant = 'Doe J.'; mockRelationshipService = { getNameVariant: () => observableOf(nameVariant) }; diff --git a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts index 76a7fe3dd7..a21f0ec075 100644 --- a/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts +++ b/src/app/entity-groups/research-entities/submission/item-list-elements/person/person-search-result-list-submission-element.component.spec.ts @@ -26,7 +26,6 @@ let mockItemWithoutMetadata: ItemSearchResult; let nameVariant; let mockRelationshipService; - function init() { mockItemWithMetadata = Object.assign( new ItemSearchResult(), @@ -65,7 +64,7 @@ function init() { }) }); - nameVariant = "Doe J."; + nameVariant = 'Doe J.'; mockRelationshipService = { getNameVariant: () => observableOf(nameVariant) }; diff --git a/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.ts b/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.ts index 47b0a6f4d2..34eab47b47 100644 --- a/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.ts +++ b/src/app/entity-groups/research-entities/submission/name-variant-modal/name-variant-modal.component.ts @@ -1,19 +1,14 @@ -import { Component, Input, OnInit } from '@angular/core'; -import { NgbActiveModal, NgbModal } from '@ng-bootstrap/ng-bootstrap'; +import { Component, Input } from '@angular/core'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; @Component({ - selector: 'name-variant-modal', + selector: 'ds-name-variant-modal', templateUrl: './name-variant-modal.component.html', styleUrls: ['./name-variant-modal.component.scss'] }) -export class NameVariantModalComponent implements OnInit { +export class NameVariantModalComponent { @Input() value: string; constructor(public modal: NgbActiveModal) { } - - ngOnInit() { - - } - } diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts index 79d279fdf1..91c1dbc085 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.spec.ts @@ -190,6 +190,7 @@ describe('DsDynamicFormControlContainerComponent test suite', () => { const ngZone = TestBed.get(NgZone); + // tslint:disable-next-line:ban-types spyOn(ngZone, 'runOutsideAngular').and.callFake((fn: Function) => fn()); component = fixture.componentInstance; debugElement = fixture.debugElement; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts index c65105a092..176b718cda 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/ds-dynamic-form-control-container.component.ts @@ -178,7 +178,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo @Input() hasErrorMessaging = false; @Input() layout = null as DynamicFormLayout; @Input() model: any; - relationships$: Observable[]>; + relationships$: Observable>>; hasRelationLookup: boolean; modalRef: NgbModalRef; item$: Observable; @@ -231,14 +231,14 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo take(1), switchMap((item: Item) => this.relationService.getRelatedItemsByLabel(item, this.model.relationship.relationshipType)), map((items: RemoteData>) => items.payload.page.map((item) => Object.assign(new ItemSearchResult(), { indexableObject: item }))), - ).subscribe((relatedItems: SearchResult[]) => this.selectableListService.select(this.listId, relatedItems)); + ).subscribe((relatedItems: Array>) => this.selectableListService.select(this.listId, relatedItems)); this.relationships$ = this.selectableListService.getSelectableList(this.listId).pipe( map((listState: SelectableListState) => hasValue(listState) && hasValue(listState.selection) ? listState.selection : []), - ) as Observable[]>; + ) as Observable>>; this.modelValueMDRepresentation = observableCombineLatest(this.item$, this.relationships$).pipe( - map(([item, relatedItems]: [Item, SearchResult[]]) => + map(([item, relatedItems]: [Item, Array>]) => relatedItems .map((element: SearchResult) => { const relationMD: MetadataValue = item.firstMetadata(this.model.relationship.metadataField, { value: element.indexableObject.uuid }); @@ -294,7 +294,7 @@ export class DsDynamicFormControlContainerComponent extends DynamicFormControlCo } public hasResultsSelected(): Observable { - return this.model.value.pipe(map((list: SearchResult[]) => isNotEmpty(list))); + return this.model.value.pipe(map((list: Array>) => isNotEmpty(list))); } openLookup() { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts index 7c28f77572..a4f77fd364 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.spec.ts @@ -58,8 +58,8 @@ describe('DsDynamicLookupRelationModalComponent', () => { { provide: RelationshipTypeService, useValue: {} }, { provide: Store, useValue: { - dispatch: () => { - } + // tslint:disable-next-line:no-empty + dispatch: () => {} } }, { provide: NgZone, useValue: new NgZone({}) }, diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts index 6a3bf798ad..2a67c4fd63 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.ts @@ -74,7 +74,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy this.modal.close(); } - select(...selectableObjects: SearchResult[]) { + select(...selectableObjects: Array>) { this.zone.runOutsideAngular( () => { const obs: Observable = combineLatest(...selectableObjects.map((sri: SearchResult) => { @@ -92,8 +92,8 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy }) ); obs - .subscribe((obs: any[]) => { - return obs.forEach((object: any) => { + .subscribe((arr: any[]) => { + return arr.forEach((object: any) => { this.store.dispatch(new AddRelationshipAction(this.item, object.item, this.relationshipOptions.relationshipType, object.nameVariant)); } ); @@ -108,7 +108,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy ).subscribe((nameVariant: string) => this.store.dispatch(new UpdateRelationshipAction(this.item, sri.indexableObject, this.relationshipOptions.relationshipType, nameVariant))) } - deselect(...selectableObjects: SearchResult[]) { + deselect(...selectableObjects: Array>) { this.zone.runOutsideAngular( () => selectableObjects.forEach((object) => { this.subMap[object.indexableObject.uuid].unsubscribe(); @@ -120,7 +120,7 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy private setExistingNameVariants() { const virtualMDs: MetadataValue[] = this.item.allMetadata(this.metadataFields).filter((mdValue) => mdValue.isVirtual); - const relatedItemPairs$: Observable<[Item, Item][]> = + const relatedItemPairs$: Observable> = combineLatest(virtualMDs.map((md: MetadataValue) => this.relationshipService.findById(md.virtualValue).pipe(getSucceededRemoteData(), getRemoteDataPayload()))) .pipe( switchMap((relationships: Relationship[]) => combineLatest(relationships.map((relationship: Relationship) => @@ -133,11 +133,11 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy ); const relatedItems$: Observable = relatedItemPairs$.pipe( - map(([relatedItemPairs,]: [[Item, Item][]]) => relatedItemPairs.map(([left, right]: [Item, Item]) => left.uuid === this.item.uuid ? left : right)) + map(([relatedItemPairs,]: [Array<[Item, Item]>]) => relatedItemPairs.map(([left, right]: [Item, Item]) => left.uuid === this.item.uuid ? left : right)) ); relatedItems$.pipe(take(1)).subscribe((relatedItems) => { - let index: number = 0; + let index = 0; virtualMDs.forEach( (md: MetadataValue) => { this.relationshipService.setNameVariant(this.listId, relatedItems[index].uuid, md.value); @@ -151,4 +151,4 @@ export class DsDynamicLookupRelationModalComponent implements OnInit, OnDestroy ngOnDestroy() { Object.values(this.subMap).forEach((subscription) => subscription.unsubscribe()); } -} \ No newline at end of file +} diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts index 42c9d6c9b5..1ac6cd55d1 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.spec.ts @@ -25,7 +25,6 @@ function init() { variantList1Item2 = 'Test Name Variant 2'; } - describe('nameVariantReducer', () => { beforeEach(() => { init(); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.ts index 9e6ade440c..9f93cf2dd1 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer.ts @@ -5,14 +5,14 @@ import { NameVariantAction, NameVariantActionTypes, SetNameVariantAction } from './name-variant.actions'; import { hasValue } from '../../../../empty.util'; -export type NameVariantListsState = { +export interface NameVariantListsState { [listID: string]: NameVariantListState; } /** * Represents the state of a single list containing nameVariants in the store */ -export type NameVariantListState = { +export interface NameVariantListState { [itemID: string]: string; } @@ -35,6 +35,8 @@ export function nameVariantReducer(state: NameVariantListsState = {}, action: Na if (hasValue(listState) && hasValue(listState[action.payload.itemID])) { const newListState = setNameVariant(listState, action.payload.itemID, undefined); return Object.assign({}, state, { [action.payload.listID]: newListState }); + } else { + return state; } } default: { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts index ec47f88c6c..3870721463 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.spec.ts @@ -40,7 +40,6 @@ describe('RelationshipEffects', () => { let mockRelationshipService; let mockRelationshipTypeService; - function init() { testUUID1 = '20e24c2f-a00a-467c-bdee-c929e79bf08d'; testUUID2 = '7f66a4d0-8557-4e77-8b1e-19930895f10a'; @@ -125,7 +124,7 @@ describe('RelationshipEffects', () => { describe('When it\'s not the first time for this identifier', () => { let action; - let testActionType = "TEST_TYPE"; + const testActionType = 'TEST_TYPE'; beforeEach(() => { (relationEffects as any).initialActionMap[identifier] = testActionType; (relationEffects as any).debounceMap[identifier] = new BehaviorSubject(testActionType); @@ -197,7 +196,7 @@ describe('RelationshipEffects', () => { describe('When it\'s not the first time for this identifier', () => { let action; - let testActionType = "TEST_TYPE"; + const testActionType = 'TEST_TYPE'; beforeEach(() => { (relationEffects as any).initialActionMap[identifier] = testActionType; (relationEffects as any).debounceMap[identifier] = new BehaviorSubject(testActionType); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts index bdd0bd64b5..7b530f39c5 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/relationship.effects.ts @@ -28,12 +28,10 @@ export class RelationshipEffects { [identifier: string]: string } = {}; - private initialActionMap: { [identifier: string]: string } = {}; - /** * Effect that makes sure all last fired RelationshipActions' types are stored in the map of this service, with the object uuid as their key */ @@ -92,19 +90,16 @@ export class RelationshipEffects { ) ); - constructor(private actions$: Actions, private relationshipService: RelationshipService, private relationshipTypeService: RelationshipTypeService, ) { } - private createIdentifier(item1: Item, item2: Item, relationshipType: string): string { return `${item1.uuid}-${item2.uuid}-${relationshipType}`; } - private addRelationship(item1: Item, item2: Item, relationshipType: string, nameVariant?: string) { const type1: string = item1.firstMetadataValue('relationship.type'); const type2: string = item2.firstMetadataValue('relationship.type'); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.ts index 745aa48b4e..c7bb7104b5 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.ts @@ -96,21 +96,21 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest }); } - selectPage(page: SearchResult[]) { + selectPage(page: Array>) { this.selection$ .pipe(take(1)) - .subscribe((selection: SearchResult[]) => { + .subscribe((selection: Array>) => { const filteredPage = page.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) < 0); this.selectObject.emit(...filteredPage); }); this.selectableListService.select(this.listId, page); } - deselectPage(page: SearchResult[]) { + deselectPage(page: Array>) { this.allSelected = false; this.selection$ .pipe(take(1)) - .subscribe((selection: SearchResult[]) => { + .subscribe((selection: Array>) => { const filteredPage = page.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) >= 0); this.deselectObject.emit(...filteredPage); }); @@ -133,7 +133,7 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest ).subscribe((results) => { this.selection$ .pipe(take(1)) - .subscribe((selection: SearchResult[]) => { + .subscribe((selection: Array>) => { const filteredResults = results.filter((pageItem) => selection.findIndex((selected) => selected.equals(pageItem)) < 0); this.selectObject.emit(...filteredResults); }); diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.ts index ea0acb5821..b47207a957 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.ts @@ -75,4 +75,4 @@ export class DsDynamicLookupRelationSelectionTabComponent { queryParams: Object.assign({}, { page: 1, pageSize: this.initialPagination.pageSize }), }); } -} \ No newline at end of file +} diff --git a/src/app/shared/form/builder/models/relationship-options.model.ts b/src/app/shared/form/builder/models/relationship-options.model.ts index 87b84cc1d5..7d9542794b 100644 --- a/src/app/shared/form/builder/models/relationship-options.model.ts +++ b/src/app/shared/form/builder/models/relationship-options.model.ts @@ -1,4 +1,4 @@ -const RELATION_METADATA_PREFIX = "relation." +const RELATION_METADATA_PREFIX = 'relation.' export class RelationshipOptions { relationshipType: string; diff --git a/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.ts b/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.ts index 55145f21fb..735f06fe5f 100644 --- a/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.ts +++ b/src/app/shared/object-collection/shared/selectable-list-item-control/selectable-list-item-control.component.ts @@ -18,7 +18,6 @@ export class SelectableListItemControlComponent implements OnInit { */ @Input() object: ListableObject; - @Input() selectionConfig: { repeatable: boolean, listId: string }; /** @@ -30,7 +29,6 @@ export class SelectableListItemControlComponent implements OnInit { @Output() selectObject: EventEmitter = new EventEmitter(); - selected$: Observable; constructor(public selectionService: SelectableListService) { diff --git a/src/app/shared/object-list/object-list.component.ts b/src/app/shared/object-list/object-list.component.ts index 2f725bd2e1..1be0f69106 100644 --- a/src/app/shared/object-list/object-list.component.ts +++ b/src/app/shared/object-list/object-list.component.ts @@ -179,6 +179,4 @@ export class ObjectListComponent { onPaginationChange(event) { this.paginationChange.emit(event); } - - } diff --git a/src/app/shared/object-list/selectable-list/selectable-list.actions.ts b/src/app/shared/object-list/selectable-list/selectable-list.actions.ts index 28ba79867d..7b868c99ff 100644 --- a/src/app/shared/object-list/selectable-list/selectable-list.actions.ts +++ b/src/app/shared/object-list/selectable-list/selectable-list.actions.ts @@ -21,6 +21,7 @@ export const SelectableListActionTypes = { /* tslint:disable:max-classes-per-file */ export abstract class SelectableListAction implements Action { + // tslint:disable-next-line:no-shadowed-variable constructor(public type, public id: string) { } } @@ -75,12 +76,9 @@ export class SelectableListSetSelectionAction extends SelectableListAction { } } - export class SelectableListDeselectAllAction extends SelectableListAction { constructor(id: string) { super(SelectableListActionTypes.DESELECT_ALL, id); } } - - -/* tslint:enable:max-classes-per-file */ \ No newline at end of file +/* tslint:enable:max-classes-per-file */ diff --git a/src/app/shared/object-list/selectable-list/selectable-list.reducer.ts b/src/app/shared/object-list/selectable-list/selectable-list.reducer.ts index b42f9efef8..927e20ff21 100644 --- a/src/app/shared/object-list/selectable-list/selectable-list.reducer.ts +++ b/src/app/shared/object-list/selectable-list/selectable-list.reducer.ts @@ -12,7 +12,7 @@ import { hasNoValue } from '../../empty.util'; /** * Represents the state of all selectable lists in the store */ -export type SelectableListsState = { +export interface SelectableListsState { [id: string]: SelectableListState; } @@ -97,7 +97,6 @@ function clearSelection(id: string) { return { id: id, selection: [] }; } - function isObjectInSelection(selection: ListableObject[], object: ListableObject) { return selection.findIndex((selected) => selected.equals(object)) >= 0 } diff --git a/src/app/shared/utils/relation-query.utils.ts b/src/app/shared/utils/relation-query.utils.ts index 8f3c8b5cfd..74f9e64cc9 100644 --- a/src/app/shared/utils/relation-query.utils.ts +++ b/src/app/shared/utils/relation-query.utils.ts @@ -15,4 +15,4 @@ export function getQueryByRelations(relationType: string, itemUUID: string): str */ export function getFilterByRelation(relationType: string, itemUUID: string): string { return `f.${relationType}=${itemUUID}`; -} \ No newline at end of file +} diff --git a/src/app/shared/utils/route.utils.ts b/src/app/shared/utils/route.utils.ts index 10144083aa..b0771d4f13 100644 --- a/src/app/shared/utils/route.utils.ts +++ b/src/app/shared/utils/route.utils.ts @@ -2,5 +2,5 @@ import { Router } from '@angular/router'; export function currentPath(router: Router) { const urlTree = router.parseUrl(router.url); - return '/' + urlTree.root.children['primary'].segments.map(it => it.path).join('/') -} \ No newline at end of file + return '/' + urlTree.root.children.primary.segments.map((it) => it.path).join('/') +}