forked from DSpace/dspace-angular
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathexternal-source-entry-list-submission-element.component.ts
More file actions
111 lines (97 loc) · 4.02 KB
/
external-source-entry-list-submission-element.component.ts
File metadata and controls
111 lines (97 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
import { AbstractListableElementComponent } from '../../../../../shared/object-collection/shared/object-collection-element/abstract-listable-element.component';
import { ExternalSourceEntry } from '../../../../../core/shared/external-source-entry.model';
import { listableObjectComponent } from '../../../../../shared/object-collection/shared/listable-object/listable-object.decorator';
import { ViewMode } from '../../../../../core/shared/view-mode.model';
import { Context } from '../../../../../core/shared/context.model';
import { Component, OnInit } from '@angular/core';
import { Metadata } from '../../../../../core/shared/metadata.utils';
import { MetadataMap, MetadataValue } from '../../../../../core/shared/metadata.models';
import { getItemPageRoute } from '../../../../../item-page/item-page-routing-paths';
import { DuplicateMatchMetadataDetailConfig } from '../../../../../submission/sections/detect-duplicate/models/duplicate-detail-metadata.model';
import { environment } from '../../../../../../environments/environment';
import { Item } from '../../../../../core/shared/item.model';
import { PaginationComponentOptions } from '../../../../../shared/pagination/pagination-component-options.model';
@listableObjectComponent(ExternalSourceEntry, ViewMode.ListElement, Context.EntitySearchModal)
@listableObjectComponent(ExternalSourceEntry, ViewMode.ListElement, Context.EntitySearchModalWithNameVariants)
@Component({
selector: 'ds-external-source-entry-list-submission-element',
styleUrls: ['./external-source-entry-list-submission-element.component.scss'],
templateUrl: './external-source-entry-list-submission-element.component.html'
})
/**
* The component for displaying a list element of an external source entry
*/
export class ExternalSourceEntryListSubmissionElementComponent extends AbstractListableElementComponent<ExternalSourceEntry> implements OnInit {
/**
* The metadata value for the object's uri
*/
uri: MetadataValue;
/**
* The metadata value for issue date
*/
issued: MetadataValue;
/**
* The metadata value for abstract
*/
abstract: MetadataValue;
/**
* The metadata value for contributors
*/
contributors: MetadataValue[];
/**
* The metadata value for identifiers
*/
identifiers: MetadataValue[];
/**
* The search result object.
* @type {object}
*/
itemPreviewObject = { hitHighlights: [] };
/**
* The list of the metadata, of the possible duplication, to show in HTML.
* @type {DuplicateMatchMetadataDetailConfig}
*/
metadataList: DuplicateMatchMetadataDetailConfig[];
/**
* Boolean value indicating whether the external source entry matchObjects section is collapsed or not.
*/
isCollapsed = true;
/**
* The item page route
*/
itemPageRoute: string;
/**
* The current pagination configuration for the page
*/
pageConfig: PaginationComponentOptions = Object.assign(new PaginationComponentOptions(), {
id: 'sobm',
pageSize: 2,
currentPage: 1,
});
ngOnInit(): void {
this.uri = Metadata.first(this.object.metadata, 'dc.identifier.uri');
this.issued = Metadata.first(this.object.metadata, 'dc.date.issued');
this.abstract = Metadata.first(this.object.metadata, 'dc.description.abstract');
this.contributors = Metadata.all(this.object.metadata, 'dc.contributor.*');
this.identifiers = Metadata.all(this.object.metadata, 'dc.identifier.*');
this.metadataList = environment.submission.detectDuplicate.metadataDetailsList || [];
}
/**
* Returns the route for the given item.
* @param item The item to get the route for.
* @returns The route for the given item.
*/
getItemRoute(item: Item): string {
if (item) {
return getItemPageRoute(item);
}
}
/**
* filter the metadata list from the configuration to the metadatafields which are present in the
* external-source entry
* @param metadatamap
*/
filterMatchingValues(metadatamap: MetadataMap): DuplicateMatchMetadataDetailConfig[] {
return this.metadataList.filter(value => metadatamap.hasOwnProperty(value.name));
}
}