diff --git a/src/app/core/data/relationship-type.service.ts b/src/app/core/data/relationship-type.service.ts index a9daab1986..9d7de280a9 100644 --- a/src/app/core/data/relationship-type.service.ts +++ b/src/app/core/data/relationship-type.service.ts @@ -56,8 +56,8 @@ 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.rightLabel === label) return this.checkType(type, firstType, secondType); - else if (type.leftLabel === label) return this.checkType(type, secondType, firstType); + if (type.leftLabel === label) return this.checkType(type, firstType, secondType); + else if (type.rightLabel === label) return this.checkType(type, secondType, firstType); else return []; }), ); diff --git a/src/app/core/data/relationship.service.ts b/src/app/core/data/relationship.service.ts index 9fb32d4eb7..8a1619e277 100644 --- a/src/app/core/data/relationship.service.ts +++ b/src/app/core/data/relationship.service.ts @@ -247,6 +247,8 @@ export class RelationshipService extends DataService { getRelationshipByItemsAndLabel(item1: Item, item2: Item, label: string): Observable { return this.getItemRelationshipsByLabel(item1, label) .pipe( + getSucceededRemoteData(), + map((relationshipListRD: RemoteData>) => relationshipListRD.payload.page), mergeMap((relationships: Relationship[]) => { return observableCombineLatest(...relationships.map((relationship: Relationship) => { return observableCombineLatest( diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html index 706e96a26d..c577641a4a 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/dynamic-lookup-relation-modal.component.html @@ -15,7 +15,8 @@ [selection$]="selection$" [listId]="listId" [relationship]="relationship" - [repeatable]="repeatable"> + [repeatable]="repeatable" + class="d-block pt-3"> 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 92143c5bb8..d61ffe3296 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 @@ -9,7 +9,6 @@ import { hasNoValue, hasValueOperator } 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'; -import { cloneDeep } from 'lodash'; const DEBOUNCE_TIME = 5000; @@ -74,13 +73,13 @@ export class RelationshipEffects { private addRelationship(item1: Item, item2: Item, relationshipType: string) { - // const type1: string = item1.firstMetadataValue('relationship.type'); - const type1: string = 'JournalVolume'; + const type1: string = item1.firstMetadataValue('relationship.type'); + // const type1: string = 'JournalVolume'; const type2: string = item2.firstMetadataValue('relationship.type'); return this.relationshipTypeService.getRelationshipTypeByLabelAndTypes(relationshipType, type1, type2) .pipe( mergeMap((type: RelationshipType) => { - const isSwitched = type.leftLabel === relationshipType; + const isSwitched = type.rightLabel === relationshipType; if (isSwitched) { return this.relationshipService.addRelationship(type.id, item2, item1); } else { diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.html index a3fba7119d..af7574fd02 100644 --- a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.html +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component.html @@ -1,7 +1,7 @@
+ [inPlaceSearch]="true" [showViewModes]="false">
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 0d2257f198..947555dc16 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 @@ -44,7 +44,6 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest @Input() itemRD$; @Input() repeatable: boolean; @Input() selection$: Observable; - resultsRD$: Observable>>>; searchConfig: PaginatedSearchOptions; searchQuery; diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.html b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.html new file mode 100644 index 0000000000..508765bb42 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.html @@ -0,0 +1,4 @@ + \ No newline at end of file diff --git a/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.scss b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.scss new file mode 100644 index 0000000000..e69de29bb2 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 new file mode 100644 index 0000000000..56c8a382e8 --- /dev/null +++ b/src/app/shared/form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component.ts @@ -0,0 +1,33 @@ +import { Component, Input, OnDestroy, OnInit } from '@angular/core'; +import { SEARCH_CONFIG_SERVICE } from '../../../../../../+my-dspace-page/my-dspace-page.component'; +import { SearchConfigurationService } from '../../../../../../core/shared/search/search-configuration.service'; +import { Observable } from 'rxjs'; +import { RelationshipOptions } from '../../../models/relationship-options.model'; +import { ListableObject } from '../../../../../object-collection/shared/listable-object.model'; + +@Component({ + selector: 'ds-dynamic-lookup-relation-selection-tab', + styleUrls: ['./dynamic-lookup-relation-selection-tab.component.scss'], + templateUrl: './dynamic-lookup-relation-selection-tab.component.html', + providers: [ + { + provide: SEARCH_CONFIG_SERVICE, + useClass: SearchConfigurationService + } + ] +}) + +export class DsDynamicLookupRelationSelectionTabComponent { + @Input() label: string; + @Input() relationship: RelationshipOptions; + @Input() listId: string; + @Input() itemRD$; + @Input() repeatable: boolean; + @Input() selection$: Observable; + + constructor( + + ) { + } + +} \ No newline at end of file diff --git a/src/app/shared/mocks/mock-form-models.ts b/src/app/shared/mocks/mock-form-models.ts index 7f234eb528..2bc99fc69f 100644 --- a/src/app/shared/mocks/mock-form-models.ts +++ b/src/app/shared/mocks/mock-form-models.ts @@ -77,7 +77,8 @@ const rowArrayQualdropConfig = { notRepeatable: true, groupFactory: () => { return [MockQualdropModel]; - } + }, + required: false } as DynamicRowArrayModelConfig; export const MockRowArrayQualdropModel: DynamicRowArrayModel = new DynamicRowArrayModel(rowArrayQualdropConfig); diff --git a/src/app/shared/search/search-sidebar/search-sidebar.component.html b/src/app/shared/search/search-sidebar/search-sidebar.component.html index 7a5857fcff..8ffe588982 100644 --- a/src/app/shared/search/search-sidebar/search-sidebar.component.html +++ b/src/app/shared/search/search-sidebar/search-sidebar.component.html @@ -8,7 +8,7 @@
- +