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 12a87c2277..6ef035f1e6 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 @@ -1,14 +1,11 @@ import { combineLatest as observableCombineLatest, zip as observableZip } from 'rxjs'; import { Observable } from 'rxjs/internal/Observable'; -import { distinctUntilChanged, flatMap, map, switchMap, tap } from 'rxjs/operators'; +import { distinctUntilChanged, flatMap, map, switchMap } from 'rxjs/operators'; import { PaginatedList } from '../../../../core/data/paginated-list'; import { RemoteData } from '../../../../core/data/remote-data'; import { Relationship } from '../../../../core/shared/item-relationships/relationship.model'; import { Item } from '../../../../core/shared/item.model'; -import { - getFirstSucceededRemoteDataPayload, - getSucceededRemoteData -} from '../../../../core/shared/operators'; +import { getFirstSucceededRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators'; import { hasValue } from '../../../../shared/empty.util'; /** diff --git a/src/app/core/cache/builders/remote-data-build.service.ts b/src/app/core/cache/builders/remote-data-build.service.ts index bc03ce3d52..ae3b0e4fd1 100644 --- a/src/app/core/cache/builders/remote-data-build.service.ts +++ b/src/app/core/cache/builders/remote-data-build.service.ts @@ -1,13 +1,7 @@ import { Injectable } from '@angular/core'; import { combineLatest as observableCombineLatest, Observable, of as observableOf, race as observableRace } from 'rxjs'; -import { distinctUntilChanged, filter, map, startWith, switchMap } from 'rxjs/operators'; -import { - hasValue, - hasValueOperator, - isEmpty, - isNotEmpty, - isNotUndefined -} from '../../../shared/empty.util'; +import { distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators'; +import { hasValue, hasValueOperator, isEmpty, isNotEmpty, isNotUndefined } from '../../../shared/empty.util'; import { createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils'; import { FollowLinkConfig } from '../../../shared/utils/follow-link-config.model'; import { PaginatedList } from '../../data/paginated-list'; @@ -15,12 +9,7 @@ import { RemoteData } from '../../data/remote-data'; import { RemoteDataError } from '../../data/remote-data-error'; import { RequestEntry } from '../../data/request.reducer'; import { RequestService } from '../../data/request.service'; -import { - filterSuccessfulResponses, - getRequestFromRequestHref, - getRequestFromRequestUUID, - getResourceLinksFromResponse -} from '../../shared/operators'; +import { filterSuccessfulResponses, getRequestFromRequestHref, getRequestFromRequestUUID, getResourceLinksFromResponse } from '../../shared/operators'; import { PageInfo } from '../../shared/page-info.model'; import { CacheableObject } from '../object-cache.reducer'; import { ObjectCacheService } from '../object-cache.service'; diff --git a/src/app/core/cache/server-sync-buffer.reducer.ts b/src/app/core/cache/server-sync-buffer.reducer.ts index ff143a822a..7b65db0fbb 100644 --- a/src/app/core/cache/server-sync-buffer.reducer.ts +++ b/src/app/core/cache/server-sync-buffer.reducer.ts @@ -72,7 +72,6 @@ function addToServerSyncQueue(state: ServerSyncBufferState, action: AddToSSBActi } else { return state; } - return state; } /** diff --git a/src/app/core/data/relationship-type.service.ts b/src/app/core/data/relationship-type.service.ts index 23e56e31c9..bd279dbb0b 100644 --- a/src/app/core/data/relationship-type.service.ts +++ b/src/app/core/data/relationship-type.service.ts @@ -3,9 +3,9 @@ import { Injectable } from '@angular/core'; import { Store } from '@ngrx/store'; import { combineLatest as observableCombineLatest } from 'rxjs'; import { Observable } from 'rxjs/internal/Observable'; -import { filter, find, map, switchMap, tap, mergeMap } from 'rxjs/operators'; +import { filter, find, map, mergeMap, switchMap } from 'rxjs/operators'; import { AppState } from '../../app.reducer'; -import { isNotUndefined, hasValue, isNotEmpty } from '../../shared/empty.util'; +import { isNotUndefined } from '../../shared/empty.util'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { followLink } from '../../shared/utils/follow-link-config.model'; import { dataService } from '../cache/builders/build-decorators'; diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index 2bb1c1d912..6d9b237db0 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -1,31 +1,14 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Injectable } from '@angular/core'; import { MemoizedSelector, select, Store } from '@ngrx/store'; -import { combineLatest as observableCombineLatest, OperatorFunction } from 'rxjs'; +import { combineLatest as observableCombineLatest } from 'rxjs'; import { Observable } from 'rxjs/internal/Observable'; -import { - distinctUntilChanged, - filter, - find, - map, - startWith, - switchMap, - take, - tap, - mergeMap -} from 'rxjs/operators'; -import { - compareArraysUsingIds, - paginatedRelationsToItems, - relationsToItems -} from '../../+item-page/simple/item-types/shared/item-relationships-utils'; +import { distinctUntilChanged, filter, map, mergeMap, startWith, switchMap, take, tap } from 'rxjs/operators'; +import { compareArraysUsingIds, paginatedRelationsToItems, relationsToItems } from '../../+item-page/simple/item-types/shared/item-relationships-utils'; import { AppState, keySelector } from '../../app.reducer'; import { hasValue, hasValueOperator, isNotEmpty, isNotEmptyOperator } from '../../shared/empty.util'; import { ReorderableRelationship } from '../../shared/form/builder/ds-dynamic-form-ui/existing-metadata-list-element/existing-metadata-list-element.component'; -import { - RemoveNameVariantAction, - SetNameVariantAction -} from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions'; +import { RemoveNameVariantAction, SetNameVariantAction } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.actions'; import { NameVariantListState } from '../../shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/name-variant.reducer'; import { NotificationsService } from '../../shared/notifications/notifications.service'; import { followLink, FollowLinkConfig } from '../../shared/utils/follow-link-config.model'; @@ -41,26 +24,14 @@ import { RelationshipType } from '../shared/item-relationships/relationship-type import { Relationship } from '../shared/item-relationships/relationship.model'; import { RELATIONSHIP } from '../shared/item-relationships/relationship.resource-type'; import { Item } from '../shared/item.model'; -import { - configureRequest, getFirstSucceededRemoteDataPayload, - getRemoteDataPayload, - getResponseFromEntry, - getSucceededRemoteData, getPaginatedListPayload -} from '../shared/operators'; +import { configureRequest, getFirstSucceededRemoteDataPayload, getRemoteDataPayload, getResponseFromEntry, getSucceededRemoteData } from '../shared/operators'; import { DataService } from './data.service'; import { DefaultChangeAnalyzer } from './default-change-analyzer.service'; import { ItemDataService } from './item-data.service'; import { PaginatedList } from './paginated-list'; import { RemoteData, RemoteDataState } from './remote-data'; -import { - DeleteRequest, - FindListOptions, - PostRequest, - RestRequest, - FindByIDRequest -} from './request.models'; +import { DeleteRequest, FindListOptions, PostRequest, RestRequest } from './request.models'; import { RequestService } from './request.service'; -import has = Reflect.has; const relationshipListsStateSelector = (state: AppState) => state.relationshipLists; 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 a55981786e..a968a3d7c7 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 @@ -17,7 +17,7 @@ import { ViewChild, ViewContainerRef } from '@angular/core'; -import { FormGroup, FormArray } from '@angular/forms'; +import { FormArray, FormGroup } from '@angular/forms'; import { DYNAMIC_FORM_CONTROL_TYPE_ARRAY, @@ -30,15 +30,20 @@ import { DYNAMIC_FORM_CONTROL_TYPE_SELECT, DYNAMIC_FORM_CONTROL_TYPE_TEXTAREA, DYNAMIC_FORM_CONTROL_TYPE_TIMEPICKER, - DynamicDatePickerModel, DynamicFormComponentService, + DynamicDatePickerModel, + DynamicFormArrayGroupModel, + DynamicFormArrayModel, + DynamicFormComponentService, DynamicFormControl, DynamicFormControlContainerComponent, - DynamicFormControlEvent, DynamicFormControlEventType, + DynamicFormControlEvent, + DynamicFormControlEventType, DynamicFormControlModel, DynamicFormLayout, - DynamicFormLayoutService, DynamicFormRelationService, + DynamicFormLayoutService, + DynamicFormRelationService, DynamicFormValidationService, - DynamicTemplateDirective, DynamicFormArrayGroupModel, DynamicFormArrayModel, + DynamicTemplateDirective, } from '@ng-dynamic-forms/core'; import { DynamicNGBootstrapCalendarComponent, @@ -60,7 +65,7 @@ import { DYNAMIC_FORM_CONTROL_TYPE_DSDATEPICKER } from './models/date-picker/dat import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP } from './models/lookup/dynamic-lookup.model'; import { DynamicListCheckboxGroupModel } from './models/list/dynamic-list-checkbox-group.model'; import { DynamicListRadioGroupModel } from './models/list/dynamic-list-radio-group.model'; -import { hasNoValue, hasValue, isEmpty, isNotEmpty, isNotUndefined } from '../../../empty.util'; +import { hasNoValue, hasValue, isNotEmpty, isNotUndefined } from '../../../empty.util'; import { DYNAMIC_FORM_CONTROL_TYPE_LOOKUP_NAME } from './models/lookup/dynamic-lookup-name.model'; import { DsDynamicTagComponent } from './models/tag/dynamic-tag.component'; import { DsDatePickerComponent } from './models/date-picker/date-picker.component'; @@ -75,7 +80,7 @@ import { DYNAMIC_FORM_CONTROL_TYPE_RELATION_GROUP } from './models/relation-grou import { DsDatePickerInlineComponent } from './models/date-picker-inline/dynamic-date-picker-inline.component'; import { DYNAMIC_FORM_CONTROL_TYPE_CUSTOM_SWITCH } from './models/custom-switch/custom-switch.model'; import { CustomSwitchComponent } from './models/custom-switch/custom-switch.component'; -import { map, startWith, switchMap, find, take, tap } from 'rxjs/operators'; +import { find, map, startWith, switchMap, take } from 'rxjs/operators'; import { combineLatest as observableCombineLatest, Observable, Subscription } from 'rxjs'; import { SearchResult } from '../../../search/search-result.model'; import { DSpaceObject } from '../../../../core/shared/dspace-object.model'; @@ -85,12 +90,7 @@ import { SelectableListService } from '../../../object-list/selectable-list/sele import { DsDynamicDisabledComponent } from './models/disabled/dynamic-disabled.component'; import { DYNAMIC_FORM_CONTROL_TYPE_DISABLED } from './models/disabled/dynamic-disabled.model'; import { DsDynamicLookupRelationModalComponent } from './relation-lookup-modal/dynamic-lookup-relation-modal.component'; -import { - getAllSucceededRemoteData, - getRemoteDataPayload, - getSucceededRemoteData, - getAllSucceededRemoteDataPayload, getPaginatedListPayload, getFirstSucceededRemoteDataPayload -} from '../../../../core/shared/operators'; +import { getAllSucceededRemoteData, getFirstSucceededRemoteDataPayload, getPaginatedListPayload, getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators'; import { RemoteData } from '../../../../core/data/remote-data'; import { Item } from '../../../../core/shared/item.model'; import { ItemDataService } from '../../../../core/data/item-data.service'; @@ -110,8 +110,6 @@ import { followLink } from '../../../utils/follow-link-config.model'; import { paginatedRelationsToItems } from '../../../../+item-page/simple/item-types/shared/item-relationships-utils'; import { RelationshipOptions } from '../models/relationship-options.model'; import { FormBuilderService } from '../form-builder.service'; -import { modalConfigDefaults } from 'ngx-bootstrap/modal/modal-options.class'; -import { models } from '../../../../core/core.module'; export function dsDynamicFormControlMapFn(model: DynamicFormControlModel): Type | null { switch (model.type) { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts index 5bab5896c0..65b3730773 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/existing-relation-list-element/existing-relation-list-element.component.ts @@ -1,16 +1,6 @@ -import { - Component, - Input, - OnChanges, - OnDestroy, - OnInit, - Output, - EventEmitter -} from '@angular/core'; -import { FormControl } from '@angular/forms'; -import { DynamicFormArrayGroupModel } from '@ng-dynamic-forms/core'; +import { Component, EventEmitter, Input, OnChanges, OnDestroy, OnInit, Output } from '@angular/core'; import { Store } from '@ngrx/store'; -import { Observable, of as observableOf, Subscription, BehaviorSubject } from 'rxjs'; +import { BehaviorSubject, Observable, Subscription } from 'rxjs'; import { filter } from 'rxjs/operators'; import { AppState } from '../../../../../app.reducer'; import { Item } from '../../../../../core/shared/item.model'; @@ -18,15 +8,10 @@ import { getAllSucceededRemoteData, getRemoteDataPayload } from '../../../../../ import { hasValue, isNotEmpty } from '../../../../empty.util'; import { ItemSearchResult } from '../../../../object-collection/shared/item-search-result.model'; import { SelectableListService } from '../../../../object-list/selectable-list/selectable-list.service'; -import { FormFieldMetadataValueObject } from '../../models/form-field-metadata-value.model'; import { RelationshipOptions } from '../../models/relationship-options.model'; -import { DynamicConcatModel } from '../models/ds-dynamic-concat.model'; import { RemoveRelationshipAction } from '../relation-lookup-modal/relationship.actions'; import { ViewMode } from '../../../../../core/shared/view-mode.model'; import { ReorderableRelationship } from '../existing-metadata-list-element/existing-metadata-list-element.component'; -import { - SaveSubmissionFormAction -} from '../../../../../submission/objects/submission-objects.actions'; // tslint:disable:max-classes-per-file /** 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 d69935d91c..c43d229ac4 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 @@ -1,12 +1,12 @@ import { Injectable } from '@angular/core'; import { Actions, Effect, ofType } from '@ngrx/effects'; -import { debounceTime, filter, map, mergeMap, switchMap, take, tap } from 'rxjs/operators'; +import { debounceTime, filter, map, mergeMap, switchMap, take } from 'rxjs/operators'; import { BehaviorSubject, combineLatest, Observable } from 'rxjs'; import { RelationshipService } from '../../../../../core/data/relationship.service'; import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../../core/shared/operators'; import { AddRelationshipAction, RelationshipAction, RelationshipActionTypes, UpdateRelationshipAction, UpdateRelationshipNameVariantAction } from './relationship.actions'; import { Item } from '../../../../../core/shared/item.model'; -import { hasNoValue, hasValue, hasValueOperator } from '../../../../empty.util'; +import { hasNoValue, hasValue } from '../../../../empty.util'; import { Relationship } from '../../../../../core/shared/item-relationships/relationship.model'; import { RelationshipType } from '../../../../../core/shared/item-relationships/relationship-type.model'; import { RelationshipTypeService } from '../../../../../core/data/relationship-type.service'; @@ -18,7 +18,7 @@ import { Store } from '@ngrx/store'; import { ObjectCacheService } from '../../../../../core/cache/object-cache.service'; import { RequestService } from '../../../../../core/data/request.service'; import { ServerSyncBufferActionTypes } from '../../../../../core/cache/server-sync-buffer.actions'; -import { CommitPatchOperationsAction, JsonPatchOperationsActionTypes, PatchOperationsActions } from '../../../../../core/json-patch/json-patch-operations.actions'; +import { JsonPatchOperationsActionTypes } from '../../../../../core/json-patch/json-patch-operations.actions'; import { followLink } from '../../../../utils/follow-link-config.model'; import { RemoteData } from '../../../../../core/data/remote-data'; diff --git a/src/app/shared/form/builder/parsers/field-parser.ts b/src/app/shared/form/builder/parsers/field-parser.ts index fe670fbca2..6fafe9cbc1 100644 --- a/src/app/shared/form/builder/parsers/field-parser.ts +++ b/src/app/shared/form/builder/parsers/field-parser.ts @@ -58,7 +58,6 @@ export abstract class FieldParser { hasSelectableMetadata: isNotEmpty(this.configData.selectableMetadata), groupFactory: () => { let model; - let isFirstModelInArray = true; if ((arrayCounter === 0)) { model = this.modelFactory(); arrayCounter++; @@ -70,7 +69,6 @@ export abstract class FieldParser { fieldValue = ''; } else { fieldValue = this.getInitFieldValue(arrayCounter - 1, fieldArrayCounter - 1); - isFirstModelInArray = false; } fieldArrayCounter++; if (fieldArrayCounter === fieldArrayOfValueLength + 1) { diff --git a/src/app/shared/form/form.component.ts b/src/app/shared/form/form.component.ts index 0cce0ee9a8..dee06c29b2 100644 --- a/src/app/shared/form/form.component.ts +++ b/src/app/shared/form/form.component.ts @@ -1,22 +1,8 @@ import { distinctUntilChanged, filter, map } from 'rxjs/operators'; -import { - ChangeDetectorRef, - Component, - EventEmitter, - Input, - OnDestroy, - OnInit, - Output -} from '@angular/core'; +import { ChangeDetectorRef, Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; import { AbstractControl, FormArray, FormControl, FormGroup } from '@angular/forms'; -import { - DynamicFormArrayModel, - DynamicFormControlEvent, - DynamicFormControlModel, - DynamicFormGroupModel, - DynamicFormLayout, DYNAMIC_FORM_CONTROL_TYPE_GROUP, -} from '@ng-dynamic-forms/core'; +import { DynamicFormArrayModel, DynamicFormControlEvent, DynamicFormControlModel, DynamicFormGroupModel, DynamicFormLayout, } from '@ng-dynamic-forms/core'; import { findIndex } from 'lodash'; import { FormBuilderService } from './builder/form-builder.service'; import { Observable, Subscription } from 'rxjs'; @@ -24,10 +10,7 @@ import { hasValue, isNotEmpty, isNotNull, isNull } from '../empty.util'; import { FormService } from './form.service'; import { FormEntry, FormError } from './form.reducer'; import { DYNAMIC_FORM_CONTROL_TYPE_SCROLLABLE_DROPDOWN } from './builder/ds-dynamic-form-ui/models/scrollable-dropdown/dynamic-scrollable-dropdown.model'; -import { - QUALDROP_GROUP_SUFFIX, - QUALDROP_VALUE_SUFFIX -} from './builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; +import { QUALDROP_GROUP_SUFFIX } from './builder/ds-dynamic-form-ui/models/ds-dynamic-qualdrop.model'; const QUALDROP_GROUP_REGEX = new RegExp(`${QUALDROP_GROUP_SUFFIX}_\\d+$`);