mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
created new tab for lookup
This commit is contained in:
@@ -56,8 +56,8 @@ export class RelationshipTypeService {
|
|||||||
/* Flatten the page so we can treat it like an observable */
|
/* Flatten the page so we can treat it like an observable */
|
||||||
switchMap((typeListRD: RemoteData<PaginatedList<RelationshipType>>) => typeListRD.payload.page),
|
switchMap((typeListRD: RemoteData<PaginatedList<RelationshipType>>) => typeListRD.payload.page),
|
||||||
switchMap((type: RelationshipType) => {
|
switchMap((type: RelationshipType) => {
|
||||||
if (type.rightLabel === label) return this.checkType(type, firstType, secondType);
|
if (type.leftLabel === label) return this.checkType(type, firstType, secondType);
|
||||||
else if (type.leftLabel === label) return this.checkType(type, secondType, firstType);
|
else if (type.rightLabel === label) return this.checkType(type, secondType, firstType);
|
||||||
else return [];
|
else return [];
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@@ -247,6 +247,8 @@ export class RelationshipService extends DataService<Relationship> {
|
|||||||
getRelationshipByItemsAndLabel(item1: Item, item2: Item, label: string): Observable<Relationship> {
|
getRelationshipByItemsAndLabel(item1: Item, item2: Item, label: string): Observable<Relationship> {
|
||||||
return this.getItemRelationshipsByLabel(item1, label)
|
return this.getItemRelationshipsByLabel(item1, label)
|
||||||
.pipe(
|
.pipe(
|
||||||
|
getSucceededRemoteData(),
|
||||||
|
map((relationshipListRD: RemoteData<PaginatedList<Relationship>>) => relationshipListRD.payload.page),
|
||||||
mergeMap((relationships: Relationship[]) => {
|
mergeMap((relationships: Relationship[]) => {
|
||||||
return observableCombineLatest(...relationships.map((relationship: Relationship) => {
|
return observableCombineLatest(...relationships.map((relationship: Relationship) => {
|
||||||
return observableCombineLatest(
|
return observableCombineLatest(
|
||||||
|
@@ -15,7 +15,8 @@
|
|||||||
[selection$]="selection$"
|
[selection$]="selection$"
|
||||||
[listId]="listId"
|
[listId]="listId"
|
||||||
[relationship]="relationship"
|
[relationship]="relationship"
|
||||||
[repeatable]="repeatable">
|
[repeatable]="repeatable"
|
||||||
|
class="d-block pt-3">
|
||||||
</ds-dynamic-lookup-relation-search-tab>
|
</ds-dynamic-lookup-relation-search-tab>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
</ngb-tab>
|
</ngb-tab>
|
||||||
|
@@ -9,7 +9,6 @@ import { hasNoValue, hasValueOperator } from '../../../../empty.util';
|
|||||||
import { Relationship } from '../../../../../core/shared/item-relationships/relationship.model';
|
import { Relationship } from '../../../../../core/shared/item-relationships/relationship.model';
|
||||||
import { RelationshipType } from '../../../../../core/shared/item-relationships/relationship-type.model';
|
import { RelationshipType } from '../../../../../core/shared/item-relationships/relationship-type.model';
|
||||||
import { RelationshipTypeService } from '../../../../../core/data/relationship-type.service';
|
import { RelationshipTypeService } from '../../../../../core/data/relationship-type.service';
|
||||||
import { cloneDeep } from 'lodash';
|
|
||||||
|
|
||||||
const DEBOUNCE_TIME = 5000;
|
const DEBOUNCE_TIME = 5000;
|
||||||
|
|
||||||
@@ -74,13 +73,13 @@ export class RelationshipEffects {
|
|||||||
|
|
||||||
|
|
||||||
private addRelationship(item1: Item, item2: Item, relationshipType: string) {
|
private addRelationship(item1: Item, item2: Item, relationshipType: string) {
|
||||||
// const type1: string = item1.firstMetadataValue('relationship.type');
|
const type1: string = item1.firstMetadataValue('relationship.type');
|
||||||
const type1: string = 'JournalVolume';
|
// const type1: string = 'JournalVolume';
|
||||||
const type2: string = item2.firstMetadataValue('relationship.type');
|
const type2: string = item2.firstMetadataValue('relationship.type');
|
||||||
return this.relationshipTypeService.getRelationshipTypeByLabelAndTypes(relationshipType, type1, type2)
|
return this.relationshipTypeService.getRelationshipTypeByLabelAndTypes(relationshipType, type1, type2)
|
||||||
.pipe(
|
.pipe(
|
||||||
mergeMap((type: RelationshipType) => {
|
mergeMap((type: RelationshipType) => {
|
||||||
const isSwitched = type.leftLabel === relationshipType;
|
const isSwitched = type.rightLabel === relationshipType;
|
||||||
if (isSwitched) {
|
if (isSwitched) {
|
||||||
return this.relationshipService.addRelationship(type.id, item2, item1);
|
return this.relationshipService.addRelationship(type.id, item2, item1);
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<div class="row" *ngVar="(resultsRD$ | async) as resultsRD">
|
<div class="row" *ngVar="(resultsRD$ | async) as resultsRD">
|
||||||
<ds-search-sidebar class="col-4" id="search-sidebar"
|
<ds-search-sidebar class="col-4" id="search-sidebar"
|
||||||
[resultCount]="(resultsRD$ | async)?.payload?.totalElements"
|
[resultCount]="(resultsRD$ | async)?.payload?.totalElements"
|
||||||
[inPlaceSearch]="true"></ds-search-sidebar>
|
[inPlaceSearch]="true" [showViewModes]="false"></ds-search-sidebar>
|
||||||
<div class="col-8">
|
<div class="col-8">
|
||||||
<form class="input-group mb-3" #queryForm="ngForm"
|
<form class="input-group mb-3" #queryForm="ngForm"
|
||||||
(ngSubmit)="search(queryForm.value.query)">
|
(ngSubmit)="search(queryForm.value.query)">
|
||||||
|
@@ -44,7 +44,6 @@ export class DsDynamicLookupRelationSearchTabComponent implements OnInit, OnDest
|
|||||||
@Input() itemRD$;
|
@Input() itemRD$;
|
||||||
@Input() repeatable: boolean;
|
@Input() repeatable: boolean;
|
||||||
@Input() selection$: Observable<ListableObject[]>;
|
@Input() selection$: Observable<ListableObject[]>;
|
||||||
|
|
||||||
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<Item>>>>;
|
resultsRD$: Observable<RemoteData<PaginatedList<SearchResult<Item>>>>;
|
||||||
searchConfig: PaginatedSearchOptions;
|
searchConfig: PaginatedSearchOptions;
|
||||||
searchQuery;
|
searchQuery;
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
<ds-search-results [searchResults]="selection$ | async"
|
||||||
|
[selectable]="true"
|
||||||
|
[selectionConfig]="{ repeatable: repeatable, listId: listId }"
|
||||||
|
></ds-search-results>
|
@@ -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<ListableObject[]>;
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -77,7 +77,8 @@ const rowArrayQualdropConfig = {
|
|||||||
notRepeatable: true,
|
notRepeatable: true,
|
||||||
groupFactory: () => {
|
groupFactory: () => {
|
||||||
return [MockQualdropModel];
|
return [MockQualdropModel];
|
||||||
}
|
},
|
||||||
|
required: false
|
||||||
} as DynamicRowArrayModelConfig;
|
} as DynamicRowArrayModelConfig;
|
||||||
|
|
||||||
export const MockRowArrayQualdropModel: DynamicRowArrayModel = new DynamicRowArrayModel(rowArrayQualdropConfig);
|
export const MockRowArrayQualdropModel: DynamicRowArrayModel = new DynamicRowArrayModel(rowArrayQualdropConfig);
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="search-sidebar-content">
|
<div id="search-sidebar-content">
|
||||||
<ds-view-mode-switch [viewModeList]="viewModeList" class="d-none d-md-block"></ds-view-mode-switch>
|
<ds-view-mode-switch *ngIf="showViewModes" [viewModeList]="viewModeList" class="d-none d-md-block"></ds-view-mode-switch>
|
||||||
<div class="sidebar-content">
|
<div class="sidebar-content">
|
||||||
<ds-search-switch-configuration [inPlaceSearch]="inPlaceSearch" *ngIf="configurationList" [configurationList]="configurationList"></ds-search-switch-configuration>
|
<ds-search-switch-configuration [inPlaceSearch]="inPlaceSearch" *ngIf="configurationList" [configurationList]="configurationList"></ds-search-switch-configuration>
|
||||||
<ds-search-filters [inPlaceSearch]="inPlaceSearch"></ds-search-filters>
|
<ds-search-filters [inPlaceSearch]="inPlaceSearch"></ds-search-filters>
|
||||||
|
@@ -34,6 +34,11 @@ export class SearchSidebarComponent {
|
|||||||
*/
|
*/
|
||||||
@Input() viewModeList;
|
@Input() viewModeList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether to show the view mode switch
|
||||||
|
*/
|
||||||
|
@Input() showViewModes = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* True when the search component should show results on the current page
|
* True when the search component should show results on the current page
|
||||||
*/
|
*/
|
||||||
|
@@ -161,6 +161,7 @@ import { SearchSwitchConfigurationComponent } from './search/search-switch-confi
|
|||||||
import { SearchAuthorityFilterComponent } from './search/search-filters/search-filter/search-authority-filter/search-authority-filter.component';
|
import { SearchAuthorityFilterComponent } from './search/search-filters/search-filter/search-authority-filter/search-authority-filter.component';
|
||||||
import { DsDynamicDisabledComponent } from './form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component';
|
import { DsDynamicDisabledComponent } from './form/builder/ds-dynamic-form-ui/models/disabled/dynamic-disabled.component';
|
||||||
import { DsDynamicLookupRelationSearchTabComponent } from './form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component';
|
import { DsDynamicLookupRelationSearchTabComponent } from './form/builder/ds-dynamic-form-ui/relation-lookup-modal/search-tab/dynamic-lookup-relation-search-tab.component';
|
||||||
|
import { DsDynamicLookupRelationSelectionTabComponent } from './form/builder/ds-dynamic-form-ui/relation-lookup-modal/selection-tab/dynamic-lookup-relation-selection-tab.component';
|
||||||
|
|
||||||
const MODULES = [
|
const MODULES = [
|
||||||
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
// Do NOT include UniversalModule, HttpModule, or JsonpModule here
|
||||||
@@ -362,7 +363,8 @@ const ENTRY_COMPONENTS = [
|
|||||||
SearchFacetSelectedOptionComponent,
|
SearchFacetSelectedOptionComponent,
|
||||||
SearchFacetRangeOptionComponent,
|
SearchFacetRangeOptionComponent,
|
||||||
SearchAuthorityFilterComponent,
|
SearchAuthorityFilterComponent,
|
||||||
DsDynamicLookupRelationSearchTabComponent
|
DsDynamicLookupRelationSearchTabComponent,
|
||||||
|
DsDynamicLookupRelationSelectionTabComponent
|
||||||
];
|
];
|
||||||
|
|
||||||
const SHARED_ITEM_PAGE_COMPONENTS = [
|
const SHARED_ITEM_PAGE_COMPONENTS = [
|
||||||
|
Reference in New Issue
Block a user