diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts
index e98da94c9d..54fce0a68e 100644
--- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts
+++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.spec.ts
@@ -5,7 +5,6 @@ import { ObjectUpdatesService } from '../../../../core/data/object-updates/objec
import { NO_ERRORS_SCHEMA } from '@angular/core';
import { EditRelationshipComponent } from './edit-relationship.component';
import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model';
-import { ResourceType } from '../../../../core/shared/resource-type';
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { Item } from '../../../../core/shared/item.model';
diff --git a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts
index 497b06775a..302ebf68a7 100644
--- a/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts
+++ b/src/app/+item-page/edit-item-page/item-relationships/edit-relationship/edit-relationship.component.ts
@@ -4,7 +4,7 @@ import { cloneDeep } from 'lodash';
import { Item } from '../../../../core/shared/item.model';
import { ObjectUpdatesService } from '../../../../core/data/object-updates/object-updates.service';
import { FieldChangeType } from '../../../../core/data/object-updates/object-updates.actions';
-import { ItemViewMode } from '../../../../shared/items/item-type-decorator';
+import { ViewMode } from '../../../../core/shared/view-mode.model';
@Component({
// tslint:disable-next-line:component-selector
@@ -31,7 +31,7 @@ export class EditRelationshipComponent implements OnChanges {
/**
* The view-mode we're currently on
*/
- viewMode = ItemViewMode.Element;
+ viewMode = ViewMode.ListElement;
constructor(private objectUpdatesService: ObjectUpdatesService) {
}
diff --git a/src/app/+item-page/full/full-item-page.component.spec.ts b/src/app/+item-page/full/full-item-page.component.spec.ts
index 2f151b4997..e276d69a69 100644
--- a/src/app/+item-page/full/full-item-page.component.spec.ts
+++ b/src/app/+item-page/full/full-item-page.component.spec.ts
@@ -23,7 +23,7 @@ import {
} from '../../shared/testing/utils';
const mockItem: Item = Object.assign(new Item(), {
- bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
+ bundles: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: {
'dc.title': [
{
diff --git a/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.ts b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.ts
index ee7d27a11f..3b8d261dcc 100644
--- a/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.ts
+++ b/src/app/+item-page/simple/field-components/specific-field/generic/generic-item-page-field.component.ts
@@ -10,7 +10,7 @@ import { ItemPageFieldComponent } from '../item-page-field.component';
/**
* This component can be used to represent metadata on a simple item page.
* It is the most generic way of displaying metadata values
- * It expects 4 parameters: The item, a seperator, the metadata keys and an i18n key
+ * It expects 4 parameters: The item, a separator, the metadata keys and an i18n key
*/
export class GenericItemPageFieldComponent extends ItemPageFieldComponent {
diff --git a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts
index 1b7acb2e3b..faf3862063 100644
--- a/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts
+++ b/src/app/+item-page/simple/field-components/specific-field/item-page-field.component.spec.ts
@@ -4,12 +4,9 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Item } from '../../../../core/shared/item.model';
import { PaginatedList } from '../../../../core/data/paginated-list';
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
-import { Observable } from 'rxjs';
import { PageInfo } from '../../../../core/shared/page-info.model';
-import { RemoteData } from '../../../../core/data/remote-data';
import { ItemPageFieldComponent } from './item-page-field.component';
import { MetadataValuesComponent } from '../../../field-components/metadata-values/metadata-values.component';
-import { of as observableOf } from 'rxjs';
import { MetadataMap, MetadataValue } from '../../../../core/shared/metadata.models';
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
@@ -53,7 +50,7 @@ describe('ItemPageFieldComponent', () => {
export function mockItemWithMetadataFieldAndValue(field: string, value: string): Item {
const item = Object.assign(new Item(), {
- bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
+ bundles: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: new MetadataMap()
});
item.metadata[field] = [{
diff --git a/src/app/+item-page/simple/item-page.component.html b/src/app/+item-page/simple/item-page.component.html
index b6de496dc4..501e3e161e 100644
--- a/src/app/+item-page/simple/item-page.component.html
+++ b/src/app/+item-page/simple/item-page.component.html
@@ -1,7 +1,7 @@
diff --git a/src/app/+item-page/simple/item-page.component.ts b/src/app/+item-page/simple/item-page.component.ts
index 89d5977583..10deef23e4 100644
--- a/src/app/+item-page/simple/item-page.component.ts
+++ b/src/app/+item-page/simple/item-page.component.ts
@@ -1,21 +1,18 @@
-
-import { mergeMap, filter, map, take, tap } from 'rxjs/operators';
+import { map } from 'rxjs/operators';
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { Observable } from 'rxjs';
import { ItemDataService } from '../../core/data/item-data.service';
import { RemoteData } from '../../core/data/remote-data';
-import { Bitstream } from '../../core/shared/bitstream.model';
import { Item } from '../../core/shared/item.model';
import { MetadataService } from '../../core/metadata/metadata.service';
import { fadeInOut } from '../../shared/animations/fade';
-import { hasValue } from '../../shared/empty.util';
import { redirectToPageNotFoundOn404 } from '../../core/shared/operators';
-import { ItemViewMode } from '../../shared/items/item-type-decorator';
+import { ViewMode } from '../../core/shared/view-mode.model';
/**
* This component renders a simple item page.
@@ -44,7 +41,7 @@ export class ItemPageComponent implements OnInit {
/**
* The view-mode we're currently on
*/
- viewMode = ItemViewMode.Full;
+ viewMode = ViewMode.StandalonePage;
constructor(
private route: ActivatedRoute,
@@ -53,6 +50,9 @@ export class ItemPageComponent implements OnInit {
private metadataService: MetadataService,
) { }
+ /**
+ * Initialize instance variables
+ */
ngOnInit(): void {
this.itemRD$ = this.route.data.pipe(
map((data) => data.item as RemoteData
- ),
diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.html b/src/app/+item-page/simple/item-types/publication/publication.component.html
index abf5225c27..3cd4d0aa69 100644
--- a/src/app/+item-page/simple/item-types/publication/publication.component.html
+++ b/src/app/+item-page/simple/item-types/publication/publication.component.html
@@ -1,67 +1,72 @@
- {{'publication.page.titleprefix' | translate}}
+ {{'publication.page.titleprefix' | translate}}
-
+
-
-
-
-
+
+
+
-
-
-
+ [parentItem]="object"
+ [itemType]="'Person'"
+ [metadataField]="'dc.contributor.author'"
+ [label]="'relationships.isAuthorOf' | translate">
-
-
+
-
-
-
-
+
+
diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts b/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts
index 59400fa2b9..0ff6612440 100644
--- a/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts
+++ b/src/app/+item-page/simple/item-types/publication/publication.component.spec.ts
@@ -3,19 +3,16 @@ import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
import { GenericItemPageFieldComponent } from '../../field-components/specific-field/generic/generic-item-page-field.component';
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
-import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { ItemDataService } from '../../../../core/data/item-data.service';
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
import { TruncatableService } from '../../../../shared/truncatable/truncatable.service';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { Item } from '../../../../core/shared/item.model';
-import { RemoteData } from '../../../../core/data/remote-data';
import { PaginatedList } from '../../../../core/data/paginated-list';
import { PageInfo } from '../../../../core/shared/page-info.model';
import { By } from '@angular/platform-browser';
import { createRelationshipsObservable } from '../shared/item.component.spec';
import { PublicationComponent } from './publication.component';
-import { of as observableOf } from 'rxjs';
import { MetadataMap } from '../../../../core/shared/metadata.models';
import { createSuccessfulRemoteDataObject$ } from '../../../../shared/testing/utils';
@@ -45,7 +42,6 @@ describe('PublicationComponent', () => {
})],
declarations: [PublicationComponent, GenericItemPageFieldComponent, TruncatePipe],
providers: [
- {provide: ITEM, useValue: mockItem},
{provide: ItemDataService, useValue: {}},
{provide: SearchFixedFilterService, useValue: searchFixedFilterServiceStub},
{provide: TruncatableService, useValue: {}}
@@ -60,6 +56,7 @@ describe('PublicationComponent', () => {
beforeEach(async(() => {
fixture = TestBed.createComponent(PublicationComponent);
comp = fixture.componentInstance;
+ comp.object = mockItem;
fixture.detectChanges();
}));
diff --git a/src/app/+item-page/simple/item-types/publication/publication.component.ts b/src/app/+item-page/simple/item-types/publication/publication.component.ts
index 81e2726e0c..a8c7539e64 100644
--- a/src/app/+item-page/simple/item-types/publication/publication.component.ts
+++ b/src/app/+item-page/simple/item-types/publication/publication.component.ts
@@ -1,62 +1,20 @@
-import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
-import { Observable } from 'rxjs';
-import { Item } from '../../../../core/shared/item.model';
-import {
- DEFAULT_ITEM_TYPE, ItemViewMode,
- rendersItemType
-} from '../../../../shared/items/item-type-decorator';
+import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ItemComponent } from '../shared/item.component';
-import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
-import { getRelatedItemsByTypeLabel } from '../shared/item-relationships-utils';
+import { listableObjectComponent } from '../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
+import { Item } from '../../../../core/shared/item.model';
+import { ViewMode } from '../../../../core/shared/view-mode.model';
-@rendersItemType('Publication', ItemViewMode.Full)
-@rendersItemType(DEFAULT_ITEM_TYPE, ItemViewMode.Full)
+/**
+ * Component that represents a publication Item page
+ */
+
+@listableObjectComponent('Publication', ViewMode.StandalonePage)
+@listableObjectComponent(Item, ViewMode.StandalonePage)
@Component({
selector: 'ds-publication',
styleUrls: ['./publication.component.scss'],
templateUrl: './publication.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
-export class PublicationComponent extends ItemComponent implements OnInit {
- /**
- * The authors related to this publication
- */
- authors$: Observable;
-
- /**
- * The projects related to this publication
- */
- projects$: Observable- ;
-
- /**
- * The organisation units related to this publication
- */
- orgUnits$: Observable
- ;
-
- /**
- * The journal issues related to this publication
- */
- journalIssues$: Observable
- ;
-
- ngOnInit(): void {
- super.ngOnInit();
-
- if (this.resolvedRelsAndTypes$) {
-
- this.authors$ = this.buildRepresentations('Person', 'dc.contributor.author');
-
- this.projects$ = this.resolvedRelsAndTypes$.pipe(
- getRelatedItemsByTypeLabel(this.item.id, 'isProjectOfPublication')
- );
-
- this.orgUnits$ = this.resolvedRelsAndTypes$.pipe(
- getRelatedItemsByTypeLabel(this.item.id, 'isOrgUnitOfPublication')
- );
-
- this.journalIssues$ = this.resolvedRelsAndTypes$.pipe(
- getRelatedItemsByTypeLabel(this.item.id, 'isJournalIssueOfPublication')
- );
-
- }
- }
+export class PublicationComponent extends ItemComponent {
}
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 228b52d7c7..b40b1a17b6 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,18 +1,14 @@
-import { ItemMetadataRepresentation } from '../../../../core/shared/metadata-representation/item/item-metadata-representation.model';
-import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
-import { MetadatumRepresentation } from '../../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
-import { MetadataValue } from '../../../../core/shared/metadata.models';
import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators';
import { hasNoValue, hasValue } from '../../../../shared/empty.util';
import { Observable } from 'rxjs/internal/Observable';
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model';
-import { distinctUntilChanged, filter, flatMap, map, switchMap, tap } from 'rxjs/operators';
-import { of as observableOf, zip as observableZip, combineLatest as observableCombineLatest } from 'rxjs';
-import { ItemDataService } from '../../../../core/data/item-data.service';
+import { distinctUntilChanged, flatMap, map, switchMap } from 'rxjs/operators';
+import { zip as observableZip, combineLatest as observableCombineLatest } from 'rxjs';
import { Item } from '../../../../core/shared/item.model';
import { RemoteData } from '../../../../core/data/remote-data';
import { RelationshipService } from '../../../../core/data/relationship.service';
+import { PaginatedList } from '../../../../core/data/paginated-list';
/**
* Operator for comparing arrays using a mapping function
@@ -100,53 +96,37 @@ export const relationsToItems = (thisId: string) =>
);
/**
- * Operator for turning a list of relationships and their relationship-types into a list of relevant items by relationship label
- * @param thisId The item's id of which the relations belong to
- * @param label The label of the relationship-type to filter on
- * @param side Filter only on one side of the relationship (for example: child-parent relationships)
+ * Operator for turning a paginated list of relationships into a paginated list of the relevant items
+ * The result is wrapped in the original RemoteData and PaginatedList
+ * @param {string} thisId The item's id of which the relations belong to
+ * @returns {(source: Observable) => Observable
- }
*/
-export const getRelatedItemsByTypeLabel = (thisId: string, label: string) =>
- (source: Observable<[Relationship[], RelationshipType[]]>): Observable
- =>
+export const paginatedRelationsToItems = (thisId: string) =>
+ (source: Observable>>): Observable>> =>
source.pipe(
- filterRelationsByTypeLabel(label, thisId),
- relationsToItems(thisId)
- );
-
-/**
- * Operator for turning a list of relationships into a list of metadatarepresentations given the original metadata
- * @param parentId The id of the parent item
- * @param itemType The type of relation this list resembles (for creating representations)
- * @param metadata The list of original Metadatum objects
- */
-export const relationsToRepresentations = (parentId: string, itemType: string, metadata: MetadataValue[]) =>
- (source: Observable): Observable =>
- source.pipe(
- flatMap((rels: Relationship[]) =>
- observableZip(
- ...metadata
- .map((metadatum: any) => Object.assign(new MetadataValue(), metadatum))
- .map((metadatum: MetadataValue) => {
- if (metadatum.isVirtual) {
- const matchingRels = rels.filter((rel: Relationship) => ('' + rel.id) === metadatum.virtualValue);
- if (matchingRels.length > 0) {
- const matchingRel = matchingRels[0];
- return observableCombineLatest(matchingRel.leftItem, matchingRel.rightItem).pipe(
- map(([leftItem, rightItem]) => {
- if (leftItem.payload.id === parentId) {
- return rightItem.payload;
- } else if (rightItem.payload.id === parentId) {
- return leftItem.payload;
- }
- }),
- map((item: Item) => Object.assign(new ItemMetadataRepresentation(metadatum), item))
- );
+ getSucceededRemoteData(),
+ switchMap((relationshipsRD: RemoteData>) => {
+ return observableZip(
+ ...relationshipsRD.payload.page.map((rel: Relationship) => observableCombineLatest(rel.leftItem, rel.rightItem))
+ ).pipe(
+ map((arr) =>
+ arr
+ .filter(([leftItem, rightItem]) => leftItem.hasSucceeded && rightItem.hasSucceeded)
+ .map(([leftItem, rightItem]) => {
+ if (leftItem.payload.id === thisId) {
+ return rightItem.payload;
+ } else if (rightItem.payload.id === thisId) {
+ return leftItem.payload;
}
- } else {
- return observableOf(Object.assign(new MetadatumRepresentation(itemType), metadatum));
- }
- })
+ })
+ .filter((item: Item) => hasValue(item))
+ ),
+ distinctUntilChanged(compareArraysUsingIds()),
+ map((relatedItems: Item[]) =>
+ Object.assign(relationshipsRD, { payload: Object.assign(relationshipsRD.payload, { page: relatedItems } )})
+ )
)
- )
+ })
);
/**
diff --git a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts
index 4414d9a713..add2fb1e17 100644
--- a/src/app/+item-page/simple/item-types/shared/item.component.spec.ts
+++ b/src/app/+item-page/simple/item-types/shared/item.component.spec.ts
@@ -7,17 +7,14 @@ import { ItemDataService } from '../../../../core/data/item-data.service';
import { TranslateLoader, TranslateModule } from '@ngx-translate/core';
import { MockTranslateLoader } from '../../../../shared/mocks/mock-translate-loader';
import { ChangeDetectionStrategy, DebugElement, NO_ERRORS_SCHEMA } from '@angular/core';
-import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
import { TruncatePipe } from '../../../../shared/utils/truncate.pipe';
import { isNotEmpty } from '../../../../shared/empty.util';
import { SearchFixedFilterService } from '../../../../+search-page/search-filters/search-filter/search-fixed-filter.service';
import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model';
import { PaginatedList } from '../../../../core/data/paginated-list';
-import { RemoteData } from '../../../../core/data/remote-data';
import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
import { PageInfo } from '../../../../core/shared/page-info.model';
import { ItemComponent } from './item.component';
-import { of as observableOf } from 'rxjs';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { VarDirective } from '../../../../shared/utils/var.directive';
import { Observable } from 'rxjs/internal/Observable';
@@ -56,7 +53,6 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
})],
declarations: [component, GenericItemPageFieldComponent, TruncatePipe],
providers: [
- {provide: ITEM, useValue: mockItem},
{provide: ItemDataService, useValue: {}},
{provide: SearchFixedFilterService, useValue: searchFixedFilterServiceStub},
{provide: TruncatableService, useValue: {}}
@@ -71,6 +67,7 @@ export function getItemPageFieldsTest(mockItem: Item, component) {
beforeEach(async(() => {
fixture = TestBed.createComponent(component);
comp = fixture.componentInstance;
+ comp.object = mockItem;
fixture.detectChanges();
}));
@@ -317,115 +314,4 @@ describe('ItemComponent', () => {
});
});
- describe('when calling buildRepresentations', () => {
- let comp: ItemComponent;
- let fixture: ComponentFixture;
-
- const metadataField = 'dc.contributor.author';
- const relatedItem = Object.assign(new Item(), {
- id: '2',
- metadata: Object.assign(new MetadataMap(), {
- 'dc.title': [
- {
- language: 'en_US',
- value: 'related item'
- }
- ]
- })
- });
- const mockItem = Object.assign(new Item(), {
- id: '1',
- uuid: '1',
- metadata: new MetadataMap()
- });
- mockItem.relationships = createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [
- Object.assign(new Relationship(), {
- uuid: '123',
- id: '123',
- leftItem: createSuccessfulRemoteDataObject$(mockItem),
- rightItem: createSuccessfulRemoteDataObject$(relatedItem),
- relationshipType: createSuccessfulRemoteDataObject$(new RelationshipType())
- })
- ]));
- mockItem.metadata[metadataField] = [
- {
- value: 'Second value',
- place: 1
- },
- {
- value: 'Third value',
- place: 2,
- authority: 'virtual::123'
- },
- {
- value: 'First value',
- place: 0
- },
- {
- value: 'Fourth value',
- place: 3,
- authority: '123'
- }
- ] as MetadataValue[];
- const mockItemDataService = Object.assign({
- findById: (id) => {
- if (id === relatedItem.id) {
- return createSuccessfulRemoteDataObject$(relatedItem)
- }
- }
- }) as ItemDataService;
-
- let representations: Observable;
-
- beforeEach(async(() => {
- TestBed.configureTestingModule({
- imports: [TranslateModule.forRoot({
- loader: {
- provide: TranslateLoader,
- useClass: MockTranslateLoader
- }
- }), BrowserAnimationsModule],
- declarations: [ItemComponent, VarDirective],
- providers: [
- {provide: ITEM, useValue: mockItem}
- ],
-
- schemas: [NO_ERRORS_SCHEMA]
- }).overrideComponent(ItemComponent, {
- set: {changeDetection: ChangeDetectionStrategy.Default}
- }).compileComponents();
- }));
-
- beforeEach(async(() => {
- fixture = TestBed.createComponent(ItemComponent);
- comp = fixture.componentInstance;
- fixture.detectChanges();
- representations = comp.buildRepresentations('bogus', metadataField);
- }));
-
- it('should contain exactly 4 metadata-representations', () => {
- representations.subscribe((reps: MetadataRepresentation[]) => {
- expect(reps.length).toEqual(4);
- });
- });
-
- it('should have all the representations in the correct order', () => {
- representations.subscribe((reps: MetadataRepresentation[]) => {
- expect(reps[0].getValue()).toEqual('First value');
- expect(reps[1].getValue()).toEqual('Second value');
- expect(reps[2].getValue()).toEqual('Third value');
- expect(reps[3].getValue()).toEqual('Fourth value');
- });
- });
-
- it('should have created the correct MetadatumRepresentation and ItemMetadataRepresentation objects for the correct Metadata', () => {
- representations.subscribe((reps: MetadataRepresentation[]) => {
- expect(reps[0] instanceof MetadatumRepresentation).toEqual(true);
- expect(reps[1] instanceof MetadatumRepresentation).toEqual(true);
- expect(reps[2] instanceof ItemMetadataRepresentation).toEqual(true);
- expect(reps[3] instanceof MetadatumRepresentation).toEqual(true);
- });
- });
- })
-
});
diff --git a/src/app/+item-page/simple/item-types/shared/item.component.ts b/src/app/+item-page/simple/item-types/shared/item.component.ts
index 297a333eeb..d4b0c8de89 100644
--- a/src/app/+item-page/simple/item-types/shared/item.component.ts
+++ b/src/app/+item-page/simple/item-types/shared/item.component.ts
@@ -1,15 +1,5 @@
-import { Component, Inject, OnInit } from '@angular/core';
-import { Observable , zip as observableZip, combineLatest as observableCombineLatest } from 'rxjs';
-import { distinctUntilChanged, filter, flatMap, map } from 'rxjs/operators';
-import { PaginatedList } from '../../../../core/data/paginated-list';
-import { RemoteData } from '../../../../core/data/remote-data';
-import { RelationshipType } from '../../../../core/shared/item-relationships/relationship-type.model';
-import { Relationship } from '../../../../core/shared/item-relationships/relationship.model';
+import { Component, Inject, Input } from '@angular/core';
import { Item } from '../../../../core/shared/item.model';
-import { getRemoteDataPayload, getSucceededRemoteData } from '../../../../core/shared/operators';
-import { ITEM } from '../../../../shared/items/switcher/item-type-switcher.component';
-import { MetadataRepresentation } from '../../../../core/shared/metadata-representation/metadata-representation.model';
-import { compareArraysUsingIds, relationsToRepresentations } from './item-relationships-utils';
@Component({
selector: 'ds-item',
@@ -18,60 +8,6 @@ import { compareArraysUsingIds, relationsToRepresentations } from './item-relati
/**
* A generic component for displaying metadata and relations of an item
*/
-export class ItemComponent implements OnInit {
- /**
- * Resolved relationships and types together in one observable
- */
- resolvedRelsAndTypes$: Observable<[Relationship[], RelationshipType[]]>;
-
- constructor(
- @Inject(ITEM) public item: Item
- ) {}
-
- ngOnInit(): void {
- const relationships$ = this.item.relationships;
- if (relationships$) {
- const relsCurrentPage$ = relationships$.pipe(
- filter((rd: RemoteData>) => rd.hasSucceeded),
- getRemoteDataPayload(),
- map((pl: PaginatedList) => pl.page),
- distinctUntilChanged(compareArraysUsingIds())
- );
-
- const relTypesCurrentPage$ = relsCurrentPage$.pipe(
- flatMap((rels: Relationship[]) =>
- observableZip(...rels.map((rel: Relationship) => rel.relationshipType)).pipe(
- map(([...arr]: Array>) => arr.map((d: RemoteData) => d.payload))
- )
- ),
- distinctUntilChanged(compareArraysUsingIds())
- );
-
- this.resolvedRelsAndTypes$ = observableCombineLatest(
- relsCurrentPage$,
- relTypesCurrentPage$
- );
- }
- }
-
- /**
- * Build a list of MetadataRepresentations for the current item. This combines all metadata and relationships of a
- * certain type.
- * @param itemType The type of item we're building representations of. Used for matching templates.
- * @param metadataField The metadata field that resembles the item type.
- */
- buildRepresentations(itemType: string, metadataField: string): Observable {
- const metadata = this.item.findMetadataSortedByPlace(metadataField);
- const relsCurrentPage$ = this.item.relationships.pipe(
- getSucceededRemoteData(),
- getRemoteDataPayload(),
- map((pl: PaginatedList) => pl.page),
- distinctUntilChanged(compareArraysUsingIds())
- );
-
- return relsCurrentPage$.pipe(
- relationsToRepresentations(this.item.id, itemType, metadata)
- );
- }
-
+export class ItemComponent {
+ @Input() object: Item;
}
diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html
index 48eabf8451..64f1184181 100644
--- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html
+++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.html
@@ -1,5 +1,11 @@
- 0" [label]="label">
-
-
+ 0" [label]="label">
+
+
+
+
diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts
index da2af9f2c1..7beabdceba 100644
--- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts
+++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.spec.ts
@@ -2,23 +2,72 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { MetadataRepresentationListComponent } from './metadata-representation-list.component';
-import { MetadatumRepresentation } from '../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
-import { ItemMetadataRepresentation } from '../../../core/shared/metadata-representation/item/item-metadata-representation.model';
+import { RelationshipService } from '../../../core/data/relationship.service';
+import { Item } from '../../../core/shared/item.model';
+import { Relationship } from '../../../core/shared/item-relationships/relationship.model';
+import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
+import { TranslateModule } from '@ngx-translate/core';
-const itemType = 'type';
-const metadataRepresentation1 = new MetadatumRepresentation(itemType);
-const metadataRepresentation2 = new ItemMetadataRepresentation(Object.assign({}));
-const representations = [metadataRepresentation1, metadataRepresentation2];
+const itemType = 'Person';
+const metadataField = 'dc.contributor.author';
+const parentItem: Item = Object.assign(new Item(), {
+ id: 'parent-item',
+ metadata: {
+ 'dc.contributor.author': [
+ {
+ language: null,
+ value: 'Related Author with authority',
+ authority: 'virtual::related-author',
+ place: 2
+ },
+ {
+ language: null,
+ value: 'Author without authority',
+ place: 1
+ }
+ ],
+ 'dc.title': [
+ {
+ language: null,
+ value: 'Parent Item'
+ }
+ ]
+ }
+});
+const relatedAuthor: Item = Object.assign(new Item(), {
+ id: 'related-author',
+ metadata: {
+ 'dc.title': [
+ {
+ language: null,
+ value: 'Related Author'
+ }
+ ]
+ }
+});
+const relation: Relationship = Object.assign(new Relationship(), {
+ leftItem: createSuccessfulRemoteDataObject$(parentItem),
+ rightItem: createSuccessfulRemoteDataObject$(relatedAuthor)
+});
+let relationshipService: RelationshipService;
describe('MetadataRepresentationListComponent', () => {
let comp: MetadataRepresentationListComponent;
let fixture: ComponentFixture;
+ relationshipService = jasmine.createSpyObj('relationshipService',
+ {
+ findById: createSuccessfulRemoteDataObject$(relation)
+ }
+ );
+
beforeEach(async(() => {
TestBed.configureTestingModule({
- imports: [],
+ imports: [TranslateModule.forRoot()],
declarations: [MetadataRepresentationListComponent],
- providers: [],
+ providers: [
+ { provide: RelationshipService, useValue: relationshipService }
+ ],
schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(MetadataRepresentationListComponent, {
set: {changeDetection: ChangeDetectionStrategy.Default}
@@ -28,13 +77,45 @@ describe('MetadataRepresentationListComponent', () => {
beforeEach(async(() => {
fixture = TestBed.createComponent(MetadataRepresentationListComponent);
comp = fixture.componentInstance;
- comp.representations = representations;
+ comp.parentItem = parentItem;
+ comp.itemType = itemType;
+ comp.metadataField = metadataField;
fixture.detectChanges();
}));
- it(`should load ${representations.length} item-type-switcher components`, () => {
- const fields = fixture.debugElement.queryAll(By.css('ds-item-type-switcher'));
- expect(fields.length).toBe(representations.length);
+ it('should load 2 ds-metadata-representation-loader components', () => {
+ const fields = fixture.debugElement.queryAll(By.css('ds-metadata-representation-loader'));
+ expect(fields.length).toBe(2);
+ });
+
+ it('should initialize the original limit', () => {
+ expect(comp.originalLimit).toEqual(comp.limit);
+ });
+
+ describe('when viewMore is called', () => {
+ beforeEach(() => {
+ comp.viewMore();
+ });
+
+ it('should set the limit to a high number in order to retrieve all metadata representations', () => {
+ expect(comp.limit).toBeGreaterThanOrEqual(999);
+ });
+ });
+
+ describe('when viewLess is called', () => {
+ let originalLimit;
+
+ beforeEach(() => {
+ // Store the original value of limit
+ originalLimit = comp.limit;
+ // Set limit to a random number
+ comp.limit = 458;
+ comp.viewLess();
+ });
+
+ it('should reset the limit to the original value', () => {
+ expect(comp.limit).toEqual(originalLimit);
+ });
});
});
diff --git a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts
index f0dc222bf1..b58290d87c 100644
--- a/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts
+++ b/src/app/+item-page/simple/metadata-representation-list/metadata-representation-list.component.ts
@@ -1,6 +1,16 @@
-import { Component, Input } from '@angular/core';
+import { Component, Input, OnInit } from '@angular/core';
import { MetadataRepresentation } from '../../../core/shared/metadata-representation/metadata-representation.model';
-import { ItemViewMode } from '../../../shared/items/item-type-decorator';
+import { Observable } from 'rxjs/internal/Observable';
+import { RemoteData } from '../../../core/data/remote-data';
+import { RelationshipService } from '../../../core/data/relationship.service';
+import { Item } from '../../../core/shared/item.model';
+import { combineLatest as observableCombineLatest, of as observableOf, zip as observableZip } from 'rxjs';
+import { MetadataValue } from '../../../core/shared/metadata.models';
+import { MetadatumRepresentation } from '../../../core/shared/metadata-representation/metadatum/metadatum-representation.model';
+import { filter, map, switchMap } from 'rxjs/operators';
+import { getSucceededRemoteData } from '../../../core/shared/operators';
+import { Relationship } from '../../../core/shared/item-relationships/relationship.model';
+import { ItemMetadataRepresentation } from '../../../core/shared/metadata-representation/item/item-metadata-representation.model';
@Component({
selector: 'ds-metadata-representation-list',
@@ -8,13 +18,25 @@ import { ItemViewMode } from '../../../shared/items/item-type-decorator';
})
/**
* This component is used for displaying metadata
- * It expects a list of MetadataRepresentation objects and a label to put on top of the list
+ * It expects an item and a metadataField to fetch metadata
+ * It expects an itemType to resolve the metadata to a an item
+ * It expects a label to put on top of the list
*/
-export class MetadataRepresentationListComponent {
+export class MetadataRepresentationListComponent implements OnInit {
/**
- * A list of metadata-representations to display
+ * The parent of the list of related items to display
*/
- @Input() representations: MetadataRepresentation[];
+ @Input() parentItem: Item;
+
+ /**
+ * The type of item to create a representation of
+ */
+ @Input() itemType: string;
+
+ /**
+ * The metadata field to use for fetching metadata from the item
+ */
+ @Input() metadataField: string;
/**
* An i18n label to use as a title for the list
@@ -22,8 +44,91 @@ export class MetadataRepresentationListComponent {
@Input() label: string;
/**
- * The view-mode we're currently on
- * @type {ElementViewMode}
+ * The max amount of representations to display
+ * Defaults to 10
+ * The default can optionally be overridden by providing the limit as input to the component
*/
- viewMode = ItemViewMode.Metadata;
+ @Input() limit = 10;
+
+ /**
+ * A list of metadata-representations to display
+ */
+ representations$: Observable;
+
+ /**
+ * The originally provided limit
+ * Used for resetting the limit to the original value when collapsing the list
+ */
+ originalLimit: number;
+
+ /**
+ * The total amount of metadata values available
+ */
+ total: number;
+
+ constructor(public relationshipService: RelationshipService) {
+ }
+
+ ngOnInit(): void {
+ this.originalLimit = this.limit;
+ this.setRepresentations();
+ }
+
+ /**
+ * Initialize the metadata representations
+ */
+ setRepresentations() {
+ const metadata = this.parentItem.findMetadataSortedByPlace(this.metadataField);
+ this.total = metadata.length;
+ this.representations$ = this.resolveMetadataRepresentations(metadata);
+ }
+
+ /**
+ * Resolve a list of metadata values to a list of metadata representations
+ * @param metadata
+ */
+ resolveMetadataRepresentations(metadata: MetadataValue[]): Observable {
+ return observableZip(
+ ...metadata
+ .slice(0, this.limit)
+ .map((metadatum: any) => Object.assign(new MetadataValue(), metadatum))
+ .map((metadatum: MetadataValue) => {
+ if (metadatum.isVirtual) {
+ return this.relationshipService.findById(metadatum.virtualValue).pipe(
+ getSucceededRemoteData(),
+ switchMap((relRD: RemoteData) =>
+ observableCombineLatest(relRD.payload.leftItem, relRD.payload.rightItem).pipe(
+ filter(([leftItem, rightItem]) => leftItem.hasSucceeded && rightItem.hasSucceeded),
+ map(([leftItem, rightItem]) => {
+ if (leftItem.payload.id === this.parentItem.id) {
+ return rightItem.payload;
+ } else if (rightItem.payload.id === this.parentItem.id) {
+ return leftItem.payload;
+ }
+ }),
+ map((item: Item) => Object.assign(new ItemMetadataRepresentation(metadatum), item))
+ )
+ ));
+ } else {
+ return observableOf(Object.assign(new MetadatumRepresentation(this.itemType), metadatum));
+ }
+ })
+ );
+ }
+
+ /**
+ * Expand the list to display all metadata representations
+ */
+ viewMore() {
+ this.limit = 9999;
+ this.setRepresentations();
+ }
+
+ /**
+ * Collapse the list to display the originally displayed metadata representations
+ */
+ viewLess() {
+ this.limit = this.originalLimit;
+ this.setRepresentations();
+ }
}
diff --git a/src/app/+item-page/simple/related-items/related-items-component.ts b/src/app/+item-page/simple/related-items/related-items-component.ts
index 7b54d7316a..9cbfd2c28d 100644
--- a/src/app/+item-page/simple/related-items/related-items-component.ts
+++ b/src/app/+item-page/simple/related-items/related-items-component.ts
@@ -1,6 +1,12 @@
-import { Component, Input } from '@angular/core';
+import { Component, HostBinding, Input, OnDestroy, OnInit } from '@angular/core';
import { Item } from '../../../core/shared/item.model';
-import { ItemViewMode } from '../../../shared/items/item-type-decorator';
+import { Observable } from 'rxjs/internal/Observable';
+import { RemoteData } from '../../../core/data/remote-data';
+import { PaginatedList } from '../../../core/data/paginated-list';
+import { RelationshipService } from '../../../core/data/relationship.service';
+import { FindAllOptions } from '../../../core/data/request.models';
+import { Subscription } from 'rxjs/internal/Subscription';
+import { ViewMode } from '../../../core/shared/view-mode.model';
@Component({
selector: 'ds-related-items',
@@ -9,22 +15,94 @@ import { ItemViewMode } from '../../../shared/items/item-type-decorator';
})
/**
* This component is used for displaying relations between items
- * It expects a list of items to display and a label to put on top
+ * It expects a parent item and relationship type, as well as a label to display on top
*/
-export class RelatedItemsComponent {
+export class RelatedItemsComponent implements OnInit, OnDestroy {
/**
- * A list of items to display
+ * The parent of the list of related items to display
*/
- @Input() items: Item[];
+ @Input() parentItem: Item;
+
+ /**
+ * The label of the relationship type to display
+ * Used in sending a search request to the REST API
+ */
+ @Input() relationType: string;
+
+ /**
+ * Default options to start a search request with
+ * Optional input, should you wish a different page size (or other options)
+ */
+ @Input() options = Object.assign(new FindAllOptions(), { elementsPerPage: 5 });
/**
* An i18n label to use as a title for the list (usually describes the relation)
*/
@Input() label: string;
+ /**
+ * Completely hide the component until there's at least one item visible
+ */
+ @HostBinding('class.d-none') hidden = true;
+
+ /**
+ * The list of related items
+ */
+ items$: Observable>>;
+
+ /**
+ * Search options for displaying all elements in a list
+ */
+ allOptions = Object.assign(new FindAllOptions(), { elementsPerPage: 9999 });
+
/**
* The view-mode we're currently on
* @type {ElementViewMode}
*/
- viewMode = ItemViewMode.Element;
+ viewMode = ViewMode.ListElement;
+
+ /**
+ * Whether or not the list is currently expanded to show all related items
+ */
+ showingAll = false;
+
+ /**
+ * Subscription on items used to update the "hidden" property of this component
+ */
+ itemSub: Subscription;
+
+ constructor(public relationshipService: RelationshipService) {
+ }
+
+ ngOnInit(): void {
+ this.items$ = this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, this.options);
+ this.itemSub = this.items$.subscribe((itemsRD: RemoteData>) => {
+ this.hidden = !(itemsRD.hasSucceeded && itemsRD.payload && itemsRD.payload.page.length > 0);
+ });
+ }
+
+ /**
+ * Expand the list to display all related items
+ */
+ viewMore() {
+ this.items$ = this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, this.allOptions);
+ this.showingAll = true;
+ }
+
+ /**
+ * Collapse the list to display the originally displayed items
+ */
+ viewLess() {
+ this.items$ = this.relationshipService.getRelatedItemsByLabel(this.parentItem, this.relationType, this.options);
+ this.showingAll = false;
+ }
+
+ /**
+ * Unsubscribe from the item subscription
+ */
+ ngOnDestroy(): void {
+ if (this.itemSub) {
+ this.itemSub.unsubscribe();
+ }
+ }
}
diff --git a/src/app/+item-page/simple/related-items/related-items.component.html b/src/app/+item-page/simple/related-items/related-items.component.html
index 4b284ad63c..bb6c2afdc6 100644
--- a/src/app/+item-page/simple/related-items/related-items.component.html
+++ b/src/app/+item-page/simple/related-items/related-items.component.html
@@ -1,5 +1,11 @@
- 0" [label]="label">
- 0" [label]="label">
+
-
+
+
+
diff --git a/src/app/+item-page/simple/related-items/related-items.component.spec.ts b/src/app/+item-page/simple/related-items/related-items.component.spec.ts
index 1896f46015..4a751a31b8 100644
--- a/src/app/+item-page/simple/related-items/related-items.component.spec.ts
+++ b/src/app/+item-page/simple/related-items/related-items.component.spec.ts
@@ -2,35 +2,50 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { RelatedItemsComponent } from './related-items-component';
import { Item } from '../../../core/shared/item.model';
-import { RemoteData } from '../../../core/data/remote-data';
import { PaginatedList } from '../../../core/data/paginated-list';
import { PageInfo } from '../../../core/shared/page-info.model';
import { By } from '@angular/platform-browser';
import { createRelationshipsObservable } from '../item-types/shared/item.component.spec';
-import { of as observableOf } from 'rxjs';
import { createSuccessfulRemoteDataObject$ } from '../../../shared/testing/utils';
+import { RelationshipService } from '../../../core/data/relationship.service';
+import { TranslateModule } from '@ngx-translate/core';
+const parentItem: Item = Object.assign(new Item(), {
+ bundles: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
+ metadata: [],
+ relationships: createRelationshipsObservable()
+});
const mockItem1: Item = Object.assign(new Item(), {
- bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
+ bundles: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
const mockItem2: Item = Object.assign(new Item(), {
- bitstreams: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
+ bundles: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), [])),
metadata: [],
relationships: createRelationshipsObservable()
});
const mockItems = [mockItem1, mockItem2];
+const relationType = 'isItemOfItem';
+let relationshipService: RelationshipService;
describe('RelatedItemsComponent', () => {
let comp: RelatedItemsComponent;
let fixture: ComponentFixture;
beforeEach(async(() => {
+ relationshipService = jasmine.createSpyObj('relationshipService',
+ {
+ getRelatedItemsByLabel: createSuccessfulRemoteDataObject$(new PaginatedList(new PageInfo(), mockItems)),
+ }
+ );
+
TestBed.configureTestingModule({
- imports: [],
+ imports: [TranslateModule.forRoot()],
declarations: [RelatedItemsComponent],
- providers: [],
+ providers: [
+ { provide: RelationshipService, useValue: relationshipService }
+ ],
schemas: [NO_ERRORS_SCHEMA]
}).overrideComponent(RelatedItemsComponent, {
set: {changeDetection: ChangeDetectionStrategy.Default}
@@ -40,13 +55,42 @@ describe('RelatedItemsComponent', () => {
beforeEach(async(() => {
fixture = TestBed.createComponent(RelatedItemsComponent);
comp = fixture.componentInstance;
- comp.items = mockItems;
+ comp.parentItem = parentItem;
+ comp.relationType = relationType;
fixture.detectChanges();
}));
it(`should load ${mockItems.length} item-type-switcher components`, () => {
- const fields = fixture.debugElement.queryAll(By.css('ds-item-type-switcher'));
+ const fields = fixture.debugElement.queryAll(By.css('ds-listable-object-component-loader'));
expect(fields.length).toBe(mockItems.length);
});
+ describe('when viewMore is called', () => {
+ beforeEach(() => {
+ comp.viewMore();
+ });
+
+ it('should call relationship-service\'s getRelatedItemsByLabel with the correct arguments', () => {
+ expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, comp.allOptions);
+ });
+
+ it('should set showingAll to true', () => {
+ expect(comp.showingAll).toEqual(true);
+ });
+ });
+
+ describe('when viewLess is called', () => {
+ beforeEach(() => {
+ comp.viewLess();
+ });
+
+ it('should call relationship-service\'s getRelatedItemsByLabel with the correct arguments', () => {
+ expect(relationshipService.getRelatedItemsByLabel).toHaveBeenCalledWith(parentItem, relationType, comp.options);
+ });
+
+ it('should set showingAll to false', () => {
+ expect(comp.showingAll).toEqual(false);
+ });
+ });
+
});
diff --git a/src/app/+lookup-by-id/lookup-by-id-routing.module.ts b/src/app/+lookup-by-id/lookup-by-id-routing.module.ts
new file mode 100644
index 0000000000..71865dd6c6
--- /dev/null
+++ b/src/app/+lookup-by-id/lookup-by-id-routing.module.ts
@@ -0,0 +1,43 @@
+import { LookupGuard } from './lookup-guard';
+import { NgModule } from '@angular/core';
+import { RouterModule, UrlSegment } from '@angular/router';
+import { ObjectNotFoundComponent } from './objectnotfound/objectnotfound.component';
+import { hasValue, isNotEmpty } from '../shared/empty.util';
+
+@NgModule({
+ imports: [
+ RouterModule.forChild([
+ {
+ matcher: urlMatcher,
+ canActivate: [LookupGuard],
+ component: ObjectNotFoundComponent }
+ ])
+ ],
+ providers: [
+ LookupGuard
+ ]
+})
+
+export class LookupRoutingModule {
+
+}
+
+export function urlMatcher(url) {
+ // The expected path is :idType/:id
+ const idType = url[0].path;
+ // Allow for handles that are delimited with a forward slash.
+ const id = url
+ .slice(1)
+ .map((us: UrlSegment) => us.path)
+ .join('/');
+ if (isNotEmpty(idType) && isNotEmpty(id)) {
+ return {
+ consumed: url,
+ posParams: {
+ idType: new UrlSegment(idType, {}),
+ id: new UrlSegment(id, {})
+ }
+ };
+ }
+ return null;
+}
diff --git a/src/app/+lookup-by-id/lookup-by-id.module.ts b/src/app/+lookup-by-id/lookup-by-id.module.ts
new file mode 100644
index 0000000000..1b070c1279
--- /dev/null
+++ b/src/app/+lookup-by-id/lookup-by-id.module.ts
@@ -0,0 +1,23 @@
+import { NgModule } from '@angular/core';
+import { CommonModule } from '@angular/common';
+import { SharedModule } from '../shared/shared.module';
+import { LookupRoutingModule } from './lookup-by-id-routing.module';
+import { ObjectNotFoundComponent } from './objectnotfound/objectnotfound.component';
+import { DsoRedirectDataService } from '../core/data/dso-redirect-data.service';
+
+@NgModule({
+ imports: [
+ LookupRoutingModule,
+ CommonModule,
+ SharedModule,
+ ],
+ declarations: [
+ ObjectNotFoundComponent
+ ],
+ providers: [
+ DsoRedirectDataService
+ ]
+})
+export class LookupIdModule {
+
+}
diff --git a/src/app/+lookup-by-id/lookup-guard.spec.ts b/src/app/+lookup-by-id/lookup-guard.spec.ts
new file mode 100644
index 0000000000..dce039eff3
--- /dev/null
+++ b/src/app/+lookup-by-id/lookup-guard.spec.ts
@@ -0,0 +1,50 @@
+import { LookupGuard } from './lookup-guard';
+import { of as observableOf } from 'rxjs';
+import { IdentifierType } from '../core/data/request.models';
+
+describe('LookupGuard', () => {
+ let dsoService: any;
+ let guard: any;
+
+ beforeEach(() => {
+ dsoService = {
+ findById: jasmine.createSpy('findById').and.returnValue(observableOf({ hasFailed: false,
+ hasSucceeded: true }))
+ };
+ guard = new LookupGuard(dsoService);
+ });
+
+ it('should call findById with handle params', () => {
+ const scopedRoute = {
+ params: {
+ id: '1234',
+ idType: '123456789'
+ }
+ };
+ guard.canActivate(scopedRoute as any, undefined);
+ expect(dsoService.findById).toHaveBeenCalledWith('123456789/1234', IdentifierType.HANDLE)
+ });
+
+ it('should call findById with handle params', () => {
+ const scopedRoute = {
+ params: {
+ id: '123456789%2F1234',
+ idType: 'handle'
+ }
+ };
+ guard.canActivate(scopedRoute as any, undefined);
+ expect(dsoService.findById).toHaveBeenCalledWith('123456789%2F1234', IdentifierType.HANDLE)
+ });
+
+ it('should call findById with UUID params', () => {
+ const scopedRoute = {
+ params: {
+ id: '34cfed7c-f597-49ef-9cbe-ea351f0023c2',
+ idType: 'uuid'
+ }
+ };
+ guard.canActivate(scopedRoute as any, undefined);
+ expect(dsoService.findById).toHaveBeenCalledWith('34cfed7c-f597-49ef-9cbe-ea351f0023c2', IdentifierType.UUID)
+ });
+
+});
diff --git a/src/app/+lookup-by-id/lookup-guard.ts b/src/app/+lookup-by-id/lookup-guard.ts
new file mode 100644
index 0000000000..c89e329241
--- /dev/null
+++ b/src/app/+lookup-by-id/lookup-guard.ts
@@ -0,0 +1,53 @@
+import { ActivatedRouteSnapshot, CanActivate, Router, RouterStateSnapshot } from '@angular/router';
+import { Injectable } from '@angular/core';
+import { IdentifierType } from '../core/data/request.models';
+import { Observable } from 'rxjs';
+import { map } from 'rxjs/operators';
+import { RemoteData } from '../core/data/remote-data';
+import { FindByIDRequest } from '../core/data/request.models';
+import { DsoRedirectDataService } from '../core/data/dso-redirect-data.service';
+
+interface LookupParams {
+ type: IdentifierType;
+ id: string;
+}
+
+@Injectable()
+export class LookupGuard implements CanActivate {
+
+ constructor(private dsoService: DsoRedirectDataService) {
+ }
+
+ canActivate(route: ActivatedRouteSnapshot, state:RouterStateSnapshot): Observable {
+ const params = this.getLookupParams(route);
+ return this.dsoService.findById(params.id, params.type).pipe(
+ map((response: RemoteData) => response.hasFailed)
+ );
+ }
+
+ private getLookupParams(route: ActivatedRouteSnapshot): LookupParams {
+ let type;
+ let id;
+ const idType = route.params.idType;
+
+ // If the idType is not recognized, assume a legacy handle request (handle/prefix/id)
+ if (idType !== IdentifierType.HANDLE && idType !== IdentifierType.UUID) {
+ type = IdentifierType.HANDLE;
+ const prefix = route.params.idType;
+ const handleId = route.params.id;
+ id = `${prefix}/${handleId}`;
+
+ } else if (route.params.idType === IdentifierType.HANDLE) {
+ type = IdentifierType.HANDLE;
+ id = route.params.id;
+
+ } else {
+ type = IdentifierType.UUID;
+ id = route.params.id;
+ }
+ return {
+ type: type,
+ id: id
+ };
+ }
+}
diff --git a/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.html b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.html
new file mode 100644
index 0000000000..e1cf58b5b2
--- /dev/null
+++ b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.html
@@ -0,0 +1,8 @@
+
diff --git a/src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.scss b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.scss
similarity index 100%
rename from src/app/entity-groups/research-entities/item-grid-elements/orgunit/orgunit-grid-element.component.scss
rename to src/app/+lookup-by-id/objectnotfound/objectnotfound.component.scss
diff --git a/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts
new file mode 100644
index 0000000000..7905655a06
--- /dev/null
+++ b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.spec.ts
@@ -0,0 +1,79 @@
+import { NO_ERRORS_SCHEMA } from '@angular/core';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { TranslateModule } from '@ngx-translate/core';
+
+import { ObjectNotFoundComponent } from './objectnotfound.component';
+import { ActivatedRouteStub } from '../../shared/testing/active-router-stub';
+import { of as observableOf } from 'rxjs';
+import { ActivatedRoute } from '@angular/router';
+
+describe('ObjectNotFoundComponent', () => {
+ let comp: ObjectNotFoundComponent;
+ let fixture: ComponentFixture;
+ const testUUID = '34cfed7c-f597-49ef-9cbe-ea351f0023c2';
+ const uuidType = 'uuid';
+ const handlePrefix = '123456789';
+ const handleId = '22';
+ const activatedRouteStub = Object.assign(new ActivatedRouteStub(), {
+ params: observableOf({id: testUUID, idType: uuidType})
+ });
+ const activatedRouteStubHandle = Object.assign(new ActivatedRouteStub(), {
+ params: observableOf({id: handleId, idType: handlePrefix})
+ });
+ describe('uuid request', () => {
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ TranslateModule.forRoot()
+ ], providers: [
+ {provide: ActivatedRoute, useValue: activatedRouteStub}
+ ],
+ declarations: [ObjectNotFoundComponent],
+ schemas: [NO_ERRORS_SCHEMA]
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ObjectNotFoundComponent);
+ comp = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create instance', () => {
+ expect(comp).toBeDefined()
+ });
+
+ it('should have id and idType', () => {
+ expect(comp.id).toEqual(testUUID);
+ expect(comp.idType).toEqual(uuidType);
+ expect(comp.missingItem).toEqual('uuid: ' + testUUID);
+ });
+ });
+
+ describe( 'legacy handle request', () => {
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [
+ TranslateModule.forRoot()
+ ], providers: [
+ {provide: ActivatedRoute, useValue: activatedRouteStubHandle}
+ ],
+ declarations: [ObjectNotFoundComponent],
+ schemas: [NO_ERRORS_SCHEMA]
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ObjectNotFoundComponent);
+ comp = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should have handle prefix and id', () => {
+ expect(comp.id).toEqual(handleId);
+ expect(comp.idType).toEqual(handlePrefix);
+ expect(comp.missingItem).toEqual('handle: ' + handlePrefix + '/' + handleId);
+ });
+ });
+
+});
diff --git a/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.ts b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.ts
new file mode 100644
index 0000000000..813b56920a
--- /dev/null
+++ b/src/app/+lookup-by-id/objectnotfound/objectnotfound.component.ts
@@ -0,0 +1,43 @@
+
+import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+
+/**
+ * This component representing the `PageNotFound` DSpace page.
+ */
+@Component({
+ selector: 'ds-objnotfound',
+ styleUrls: ['./objectnotfound.component.scss'],
+ templateUrl: './objectnotfound.component.html',
+ changeDetection: ChangeDetectionStrategy.Default
+})
+export class ObjectNotFoundComponent implements OnInit {
+
+ idType: string;
+
+ id: string;
+
+ missingItem: string;
+
+ /**
+ * Initialize instance variables
+ *
+ * @param {AuthService} authservice
+ * @param {ServerResponseService} responseService
+ */
+ constructor(private route: ActivatedRoute) {
+ route.params.subscribe((params) => {
+ this.idType = params.idType;
+ this.id = params.id;
+ })
+ }
+
+ ngOnInit(): void {
+ if (this.idType.startsWith('handle') || this.idType.startsWith('uuid')) {
+ this.missingItem = this.idType + ': ' + this.id;
+ } else {
+ this.missingItem = 'handle: ' + this.idType + '/' + this.id;
+ }
+ }
+
+}
diff --git a/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts
index 938a1ec899..76853db924 100644
--- a/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts
+++ b/src/app/+my-dspace-page/my-dspace-new-submission/my-dspace-new-submission.component.ts
@@ -7,7 +7,6 @@ import { TranslateService } from '@ngx-translate/core';
import { SubmissionState } from '../../submission/submission.reducers';
import { AuthService } from '../../core/auth/auth.service';
-import { MyDSpaceResult } from '../my-dspace-result.model';
import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { NotificationsService } from '../../shared/notifications/notifications.service';
import { NotificationOptions } from '../../shared/notifications/models/notification-options.model';
@@ -15,6 +14,7 @@ import { UploaderOptions } from '../../shared/uploader/uploader-options.model';
import { HALEndpointService } from '../../core/shared/hal-endpoint.service';
import { NotificationType } from '../../shared/notifications/models/notification-type';
import { hasValue } from '../../shared/empty.util';
+import { SearchResult } from '../../+search-page/search-result.model';
/**
* This component represents the whole mydspace page header
@@ -25,7 +25,10 @@ import { hasValue } from '../../shared/empty.util';
templateUrl: './my-dspace-new-submission.component.html'
})
export class MyDSpaceNewSubmissionComponent implements OnDestroy, OnInit {
- @Output() uploadEnd = new EventEmitter>>();
+ /**
+ * Output that emits the workspace item when the upload has completed
+ */
+ @Output() uploadEnd = new EventEmitter>>();
/**
* The UploaderOptions object
diff --git a/src/app/+my-dspace-page/my-dspace-page.component.html b/src/app/+my-dspace-page/my-dspace-page.component.html
index 4c691028fc..e6d1a5c80d 100644
--- a/src/app/+my-dspace-page/my-dspace-page.component.html
+++ b/src/app/+my-dspace-page/my-dspace-page.component.html
@@ -39,7 +39,8 @@
+ [searchConfig]="searchOptions$ | async"
+ [context]="context$ | async">
diff --git a/src/app/+my-dspace-page/my-dspace-page.component.spec.ts b/src/app/+my-dspace-page/my-dspace-page.component.spec.ts
index 27daa30a0f..653f4a4844 100644
--- a/src/app/+my-dspace-page/my-dspace-page.component.spec.ts
+++ b/src/app/+my-dspace-page/my-dspace-page.component.spec.ts
@@ -15,7 +15,6 @@ import { SortDirection, SortOptions } from '../core/cache/models/sort-options.mo
import { CommunityDataService } from '../core/data/community-data.service';
import { HostWindowService } from '../shared/host-window.service';
import { PaginationComponentOptions } from '../shared/pagination/pagination-component-options.model';
-import { RemoteData } from '../core/data/remote-data';
import { MyDSpacePageComponent, SEARCH_CONFIG_SERVICE } from './my-dspace-page.component';
import { RouteService } from '../core/services/route.service';
import { routeServiceStub } from '../shared/testing/route-service-stub';
@@ -50,6 +49,7 @@ describe('MyDSpacePageComponent', () => {
const mockResults = createSuccessfulRemoteDataObject$(['test', 'data']);
const searchServiceStub = jasmine.createSpyObj('SearchService', {
search: mockResults,
+ getEndpoint: observableOf('discover/search/objects'),
getSearchLink: '/mydspace',
getScopes: observableOf(['test-scope']),
setServiceOptions: {}
@@ -76,6 +76,7 @@ describe('MyDSpacePageComponent', () => {
scope: scopeParam
})
};
+
const sidebarService = {
isCollapsed: observableOf(true),
collapse: () => this.isCollapsed = observableOf(true),
diff --git a/src/app/+my-dspace-page/my-dspace-page.component.ts b/src/app/+my-dspace-page/my-dspace-page.component.ts
index 251bf50bd1..ced237f682 100644
--- a/src/app/+my-dspace-page/my-dspace-page.component.ts
+++ b/src/app/+my-dspace-page/my-dspace-page.component.ts
@@ -8,7 +8,7 @@ import {
} from '@angular/core';
import { BehaviorSubject, Observable, Subscription } from 'rxjs';
-import { switchMap, tap, } from 'rxjs/operators';
+import { map, switchMap, tap, } from 'rxjs/operators';
import { PaginatedList } from '../core/data/paginated-list';
import { RemoteData } from '../core/data/remote-data';
@@ -20,7 +20,6 @@ import { SearchService } from '../+search-page/search-service/search.service';
import { SearchSidebarService } from '../+search-page/search-sidebar/search-sidebar.service';
import { hasValue } from '../shared/empty.util';
import { getSucceededRemoteData } from '../core/shared/operators';
-import { MyDSpaceResult } from './my-dspace-result.model';
import { MyDSpaceResponseParsingService } from '../core/data/mydspace-response-parsing.service';
import { SearchConfigurationOption } from '../+search-page/search-switch-configuration/search-configuration-option.model';
import { RoleType } from '../core/roles/role-types';
@@ -28,6 +27,8 @@ import { SearchConfigurationService } from '../+search-page/search-service/searc
import { MyDSpaceConfigurationService } from './my-dspace-configuration.service';
import { ViewMode } from '../core/shared/view-mode.model';
import { MyDSpaceRequest } from '../core/data/request.models';
+import { SearchResult } from '../+search-page/search-result.model';
+import { Context } from '../core/shared/context.model';
export const MYDSPACE_ROUTE = '/mydspace';
export const SEARCH_CONFIG_SERVICE: InjectionToken
= new InjectionToken('searchConfigurationService');
@@ -63,7 +64,7 @@ export class MyDSpacePageComponent implements OnInit {
/**
* The current search results
*/
- resultsRD$: BehaviorSubject>>> = new BehaviorSubject(null);
+ resultsRD$: BehaviorSubject>>> = new BehaviorSubject(null);
/**
* The current paginated search options
@@ -93,7 +94,12 @@ export class MyDSpacePageComponent implements OnInit {
/**
* List of available view mode
*/
- viewModeList = [ViewMode.List, ViewMode.Detail];
+ viewModeList = [ViewMode.ListElement, ViewMode.DetailedListElement];
+
+ /**
+ * The current context of this page: workspace or workflow
+ */
+ context$: Observable;
constructor(private service: SearchService,
private sidebarService: SearchSidebarService,
@@ -111,21 +117,35 @@ export class MyDSpacePageComponent implements OnInit {
*
* Listen to changes in the scope
* If something changes, update the list of scopes for the dropdown
+ *
+ * Listen to changes in the configuration
+ * If something changes, update the current context
*/
ngOnInit(): void {
this.configurationList$ = this.searchConfigService.getAvailableConfigurationOptions();
this.searchOptions$ = this.searchConfigService.paginatedSearchOptions;
-
this.sub = this.searchOptions$.pipe(
tap(() => this.resultsRD$.next(null)),
switchMap((options: PaginatedSearchOptions) => this.service.search(options).pipe(getSucceededRemoteData())))
.subscribe((results) => {
this.resultsRD$.next(results);
});
+
this.scopeListRD$ = this.searchConfigService.getCurrentScope('').pipe(
switchMap((scopeId) => this.service.getScopes(scopeId))
);
+ this.context$ = this.searchConfigService.getCurrentConfiguration('workspace')
+ .pipe(
+ map((configuration: string) => {
+ if (configuration === 'workspace') {
+ return Context.Workspace
+ } else {
+ return Context.Workflow
+ }
+ })
+ );
+
}
/**
diff --git a/src/app/+my-dspace-page/my-dspace-page.module.ts b/src/app/+my-dspace-page/my-dspace-page.module.ts
index 4b8cf37b7a..be14aebdea 100644
--- a/src/app/+my-dspace-page/my-dspace-page.module.ts
+++ b/src/app/+my-dspace-page/my-dspace-page.module.ts
@@ -7,19 +7,20 @@ import { MyDspacePageRoutingModule } from './my-dspace-page-routing.module';
import { MyDSpacePageComponent } from './my-dspace-page.component';
import { SearchPageModule } from '../+search-page/search-page.module';
import { MyDSpaceResultsComponent } from './my-dspace-results/my-dspace-results.component';
-import { WorkspaceitemMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-list-element.component';
-import { ItemMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/item-my-dspace-result/item-my-dspace-result-list-element.component';
-import { WorkflowitemMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-list-element.component';
-import { ClaimedMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/claimed-my-dspace-result/claimed-my-dspace-result-list-element.component';
-import { PoolMyDSpaceResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/pool-my-dspace-result/pool-my-dspace-result-list-element.component';
+import { WorkspaceItemSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/workspace-item-search-result/workspace-item-search-result-list-element.component';
+import { ClaimedSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/claimed-search-result/claimed-search-result-list-element.component';
+import { PoolSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/pool-search-result/pool-search-result-list-element.component';
import { MyDSpaceNewSubmissionComponent } from './my-dspace-new-submission/my-dspace-new-submission.component';
-import { ItemMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-my-dspace-result/item-my-dspace-result-detail-element.component';
-import { WorkspaceitemMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/workspaceitem-my-dspace-result/workspaceitem-my-dspace-result-detail-element.component';
-import { WorkflowitemMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/workflowitem-my-dspace-result/workflowitem-my-dspace-result-detail-element.component';
-import { ClaimedMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/claimed-my-dspace-result/claimed-my-dspace-result-detail-element.component';
-import { PoolMyDSpaceResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/pool-my-dspace-result/pool-my-dspace-result-detail-lement.component';
+import { ItemSearchResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/item-search-result/item-search-result-detail-element.component';
+import { WorkspaceItemSearchResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/workspace-item-search-result/workspace-item-search-result-detail-element.component';
+import { WorkflowItemSearchResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/workflow-item-search-result/workflow-item-search-result-detail-element.component';
+import { ClaimedTaskSearchResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/claimed-task-search-result/claimed-task-search-result-detail-element.component';
import { MyDSpaceGuard } from './my-dspace.guard';
import { MyDSpaceConfigurationService } from './my-dspace-configuration.service';
+import { SearchResultListElementComponent } from '../shared/object-list/search-result-list-element/search-result-list-element.component';
+import { ItemSearchResultListElementSubmissionComponent } from '../shared/object-list/my-dspace-result-list-element/item-search-result/item-search-result-list-element-submission.component';
+import { WorkflowItemSearchResultListElementComponent } from '../shared/object-list/my-dspace-result-list-element/workflow-item-search-result/workflow-item-search-result-list-element.component';
+import { PoolSearchResultDetailElementComponent } from '../shared/object-detail/my-dspace-result-detail-element/pool-search-result/pool-search-result-detail-element.component';
@NgModule({
imports: [
@@ -31,33 +32,34 @@ import { MyDSpaceConfigurationService } from './my-dspace-configuration.service'
declarations: [
MyDSpacePageComponent,
MyDSpaceResultsComponent,
- ItemMyDSpaceResultListElementComponent,
- WorkspaceitemMyDSpaceResultListElementComponent,
- WorkflowitemMyDSpaceResultListElementComponent,
- ClaimedMyDSpaceResultListElementComponent,
- PoolMyDSpaceResultListElementComponent,
- ItemMyDSpaceResultDetailElementComponent,
- WorkspaceitemMyDSpaceResultDetailElementComponent,
- WorkflowitemMyDSpaceResultDetailElementComponent,
- ClaimedMyDSpaceResultDetailElementComponent,
- PoolMyDSpaceResultDetailElementComponent,
- MyDSpaceNewSubmissionComponent
+ WorkspaceItemSearchResultListElementComponent,
+ WorkflowItemSearchResultListElementComponent,
+ ClaimedSearchResultListElementComponent,
+ PoolSearchResultListElementComponent,
+ ItemSearchResultDetailElementComponent,
+ WorkspaceItemSearchResultDetailElementComponent,
+ WorkflowItemSearchResultDetailElementComponent,
+ ClaimedTaskSearchResultDetailElementComponent,
+ PoolSearchResultDetailElementComponent,
+ MyDSpaceNewSubmissionComponent,
+ ItemSearchResultListElementSubmissionComponent
],
providers: [
MyDSpaceGuard,
MyDSpaceConfigurationService
],
entryComponents: [
- ItemMyDSpaceResultListElementComponent,
- WorkspaceitemMyDSpaceResultListElementComponent,
- WorkflowitemMyDSpaceResultListElementComponent,
- ClaimedMyDSpaceResultListElementComponent,
- PoolMyDSpaceResultListElementComponent,
- ItemMyDSpaceResultDetailElementComponent,
- WorkspaceitemMyDSpaceResultDetailElementComponent,
- WorkflowitemMyDSpaceResultDetailElementComponent,
- ClaimedMyDSpaceResultDetailElementComponent,
- PoolMyDSpaceResultDetailElementComponent
+ SearchResultListElementComponent,
+ WorkspaceItemSearchResultListElementComponent,
+ WorkflowItemSearchResultListElementComponent,
+ ClaimedSearchResultListElementComponent,
+ PoolSearchResultListElementComponent,
+ ItemSearchResultDetailElementComponent,
+ WorkspaceItemSearchResultDetailElementComponent,
+ WorkflowItemSearchResultDetailElementComponent,
+ ClaimedTaskSearchResultDetailElementComponent,
+ PoolSearchResultDetailElementComponent,
+ ItemSearchResultListElementSubmissionComponent
]
})
diff --git a/src/app/+my-dspace-page/my-dspace-result.model.ts b/src/app/+my-dspace-page/my-dspace-result.model.ts
deleted file mode 100644
index d300ed0bc8..0000000000
--- a/src/app/+my-dspace-page/my-dspace-result.model.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { DSpaceObject } from '../core/shared/dspace-object.model';
-import { MetadataMap } from '../core/shared/metadata.models';
-import { ListableObject } from '../shared/object-collection/shared/listable-object.model';
-
-/**
- * Represents a search result object of a certain () DSpaceObject
- */
-export class MyDSpaceResult implements ListableObject {
- /**
- * The DSpaceObject that was found
- */
- indexableObject: T;
-
- /**
- * The metadata that was used to find this item, hithighlighted
- */
- hitHighlights: MetadataMap;
-
-}
diff --git a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.html b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.html
index 132a0d2204..63eb0ff9a7 100644
--- a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.html
+++ b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.html
@@ -4,7 +4,8 @@
[hasBorder]="hasBorder"
[sortConfig]="searchConfig.sort"
[objects]="searchResults"
- [hideGear]="true">
+ [hideGear]="true"
+ [context]="context">
diff --git a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.ts b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.ts
index 3a16def9c1..91c206fc79 100644
--- a/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.ts
+++ b/src/app/+my-dspace-page/my-dspace-results/my-dspace-results.component.ts
@@ -1,13 +1,13 @@
import { Component, Input } from '@angular/core';
-
import { RemoteData } from '../../core/data/remote-data';
import { DSpaceObject } from '../../core/shared/dspace-object.model';
import { fadeIn, fadeInOut } from '../../shared/animations/fade';
-import { MyDSpaceResult } from '../my-dspace-result.model';
import { SearchOptions } from '../../+search-page/search-options.model';
import { PaginatedList } from '../../core/data/paginated-list';
import { ViewMode } from '../../core/shared/view-mode.model';
import { isEmpty } from '../../shared/empty.util';
+import { SearchResult } from '../../+search-page/search-result.model';
+import { Context } from '../../core/shared/context.model';
/**
* Component that represents all results for mydspace page
@@ -25,7 +25,7 @@ export class MyDSpaceResultsComponent {
/**
* The actual search result objects
*/
- @Input() searchResults: RemoteData